pub struct Post {
pub me: SessionUri,
pub thread: Option<ThreadName>,
pub to: Vec<Selector>,
pub body: String,
pub kind: Kind,
pub at_ms: Option<u64>,
pub sig: Option<String>,
pub payload: Option<String>,
pub key: Option<String>,
}Expand description
POST /v1/post: adds a message to a thread and wakes each session
that to selects. The sender and each woken session join the
thread.
With no thread, the post is a direct message: to must be one
selector with a session, and the thread is the direct thread of
the two sessions.
A signed-in sender signs the post with Post::sign (R195).
use riff_core::dpop::Key;
use riff_core::wire::Post;
let me = "riff://mike@pangolin/como-technologies/riff?session=a6cf".parse()?;
let mut post = Post::new(&me, Some("design".parse()?), vec![], "look");
let key = Key::generate();
post.sign(&key, 1_000);
let content = post.content().unwrap();
assert_eq!(content.verify(post.sig.as_ref().unwrap()).unwrap(), key.thumbprint());Fields§
§me: SessionUri§thread: Option<ThreadName>§to: Vec<Selector>§body: String§kind: Kind§at_ms: Option<u64>The signed time, in milliseconds since the Unix epoch.
sig: Option<String>The signature of the sender (see crate::signed).
payload: Option<String>The bytes that sig signs: the base64url of the JSON of
Content. The server and each reader keep them unchanged.
key: Option<String>The key of the news that the post tells. The signature does not cover it. The server drops a post whose key is the key of a kept message of the same user in the thread (01M5TKG2K1AYK1KE7C2AA2W9DS).
Implementations§
Source§impl Post
impl Post
Sourcepub fn new(
me: &SessionUri,
thread: Option<ThreadName>,
to: Vec<Selector>,
body: &str,
) -> Post
pub fn new( me: &SessionUri, thread: Option<ThreadName>, to: Vec<Selector>, body: &str, ) -> Post
A post of kind Kind::Message, with no signature.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Post
impl<'de> Deserialize<'de> for Post
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for Post
impl JsonSchema for Post
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more