//! Generated by `trust-tasks-codegen` — do not edit by hand.
//!
//! Spec slug: `messaging/message/status`. Version: `0.1`.
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
/// Error types.
pub mod error {
/// Error from a `TryFrom` or `FromStr` implementation.
pub struct ConversionError(::std::borrow::Cow<'static, str>);
impl ::std::error::Error for ConversionError {}
impl ::std::fmt::Display for ConversionError {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
::std::fmt::Display::fmt(&self.0, f)
}
}
impl ::std::fmt::Debug for ConversionError {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
::std::fmt::Debug::fmt(&self.0, f)
}
}
impl From<&'static str> for ConversionError {
fn from(value: &'static str) -> Self {
Self(value.into())
}
}
impl From<String> for ConversionError {
fn from(value: String) -> Self {
Self(value.into())
}
}
}
///Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Ext",
/// "description": "Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.",
/// "type": "object",
/// "minProperties": 1,
/// "additionalProperties": true,
/// "propertyNames": {
/// "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(transparent)]
pub struct Ext(pub ::std::collections::HashMap<ExtKey, ::serde_json::Value>);
impl ::std::ops::Deref for Ext {
type Target = ::std::collections::HashMap<ExtKey, ::serde_json::Value>;
fn deref(&self) -> &::std::collections::HashMap<ExtKey, ::serde_json::Value> {
&self.0
}
}
impl ::std::convert::From<Ext> for ::std::collections::HashMap<ExtKey, ::serde_json::Value> {
fn from(value: Ext) -> Self {
value.0
}
}
impl ::std::convert::From<::std::collections::HashMap<ExtKey, ::serde_json::Value>> for Ext {
fn from(value: ::std::collections::HashMap<ExtKey, ::serde_json::Value>) -> Self {
Self(value)
}
}
///`ExtKey`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "string",
/// "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ExtKey(::std::string::String);
impl ::std::ops::Deref for ExtKey {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ExtKey> for ::std::string::String {
fn from(value: ExtKey) -> Self {
value.0
}
}
impl ::std::str::FromStr for ExtKey {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| {
::regress::Regex::new("^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$").unwrap()
});
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ExtKey {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for ExtKey {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for ExtKey {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for ExtKey {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///Where a sent message stands. `queued`: held for the recipient and not yet handed over. `delivered`: handed to the recipient (pickup or live stream) and not yet removed by it. `collected`: removed by the recipient — acknowledged after pickup, fetched with delete, or deleted or purged by it. `withdrawn`: removed by the sender. `discarded`: removed by the mediator before the recipient took it — expired, or its account was removed. `unknown`: the mediator holds neither the message nor a receipt for it under the requester.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "MessageState",
/// "description": "Where a sent message stands. `queued`: held for the recipient and not yet handed over. `delivered`: handed to the recipient (pickup or live stream) and not yet removed by it. `collected`: removed by the recipient — acknowledged after pickup, fetched with delete, or deleted or purged by it. `withdrawn`: removed by the sender. `discarded`: removed by the mediator before the recipient took it — expired, or its account was removed. `unknown`: the mediator holds neither the message nor a receipt for it under the requester.",
/// "type": "string",
/// "enum": [
/// "queued",
/// "delivered",
/// "collected",
/// "withdrawn",
/// "discarded",
/// "unknown"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum MessageState {
#[serde(rename = "queued")]
Queued,
#[serde(rename = "delivered")]
Delivered,
#[serde(rename = "collected")]
Collected,
#[serde(rename = "withdrawn")]
Withdrawn,
#[serde(rename = "discarded")]
Discarded,
#[serde(rename = "unknown")]
Unknown,
}
impl ::std::fmt::Display for MessageState {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Queued => f.write_str("queued"),
Self::Delivered => f.write_str("delivered"),
Self::Collected => f.write_str("collected"),
Self::Withdrawn => f.write_str("withdrawn"),
Self::Discarded => f.write_str("discarded"),
Self::Unknown => f.write_str("unknown"),
}
}
}
impl ::std::str::FromStr for MessageState {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"queued" => Ok(Self::Queued),
"delivered" => Ok(Self::Delivered),
"collected" => Ok(Self::Collected),
"withdrawn" => Ok(Self::Withdrawn),
"discarded" => Ok(Self::Discarded),
"unknown" => Ok(Self::Unknown),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for MessageState {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for MessageState {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for MessageState {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///`Payload`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "$id": "https://trusttasks.org/spec/messaging/message/status/0.1",
/// "title": "Payload",
/// "type": "object",
/// "required": [
/// "msgIds"
/// ],
/// "properties": {
/// "ext": {
/// "description": "Ecosystem-defined extension members per SPEC.md §4.5.1.",
/// "$ref": "#/definitions/Ext"
/// },
/// "msgIds": {
/// "description": "The messages the requester sent and wants the status of, by the mediator's message identifier.",
/// "type": "array",
/// "items": {
/// "type": "string",
/// "maxLength": 256,
/// "minLength": 1
/// },
/// "maxItems": 100,
/// "minItems": 1,
/// "uniqueItems": true
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Payload {
///Ecosystem-defined extension members per SPEC.md §4.5.1.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
///The messages the requester sent and wants the status of, by the mediator's message identifier.
#[serde(rename = "msgIds")]
pub msg_ids: Vec<PayloadMsgIdsItem>,
}
impl Payload {
pub fn builder() -> builder::Payload {
Default::default()
}
}
///`PayloadMsgIdsItem`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "string",
/// "maxLength": 256,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PayloadMsgIdsItem(::std::string::String);
impl ::std::ops::Deref for PayloadMsgIdsItem {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PayloadMsgIdsItem> for ::std::string::String {
fn from(value: PayloadMsgIdsItem) -> Self {
value.0
}
}
impl ::std::str::FromStr for PayloadMsgIdsItem {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 256usize {
return Err("longer than 256 characters".into());
}
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for PayloadMsgIdsItem {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for PayloadMsgIdsItem {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for PayloadMsgIdsItem {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for PayloadMsgIdsItem {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///The success response to a messaging/message/status request. Carried in a Trust Task document whose type is https://trusttasks.org/spec/messaging/message/status/0.1#response.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Response",
/// "description": "The success response to a messaging/message/status request. Carried in a Trust Task document whose type is https://trusttasks.org/spec/messaging/message/status/0.1#response.",
/// "type": "object",
/// "required": [
/// "statuses"
/// ],
/// "properties": {
/// "ext": {
/// "description": "Ecosystem-defined extension members per SPEC.md §4.5.1.",
/// "$ref": "#/definitions/Ext"
/// },
/// "statuses": {
/// "description": "One entry per requested msgId, in request order.",
/// "type": "array",
/// "items": {
/// "type": "object",
/// "required": [
/// "msgId",
/// "state"
/// ],
/// "properties": {
/// "at": {
/// "description": "When the message reached this state: first handed over for `delivered`, removed for `collected`, `withdrawn` and `discarded`. Absent for `queued` and `unknown`, and wherever the mediator does not disclose it.",
/// "type": "string",
/// "format": "date-time"
/// },
/// "msgId": {
/// "type": "string",
/// "maxLength": 256,
/// "minLength": 1
/// },
/// "state": {
/// "$ref": "#/definitions/MessageState"
/// }
/// },
/// "additionalProperties": false
/// }
/// }
/// },
/// "additionalProperties": false,
/// "$anchor": "response"
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Response {
///Ecosystem-defined extension members per SPEC.md §4.5.1.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
///One entry per requested msgId, in request order.
pub statuses: ::std::vec::Vec<ResponseStatusesItem>,
}
impl Response {
pub fn builder() -> builder::Response {
Default::default()
}
}
///`ResponseStatusesItem`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "msgId",
/// "state"
/// ],
/// "properties": {
/// "at": {
/// "description": "When the message reached this state: first handed over for `delivered`, removed for `collected`, `withdrawn` and `discarded`. Absent for `queued` and `unknown`, and wherever the mediator does not disclose it.",
/// "type": "string",
/// "format": "date-time"
/// },
/// "msgId": {
/// "type": "string",
/// "maxLength": 256,
/// "minLength": 1
/// },
/// "state": {
/// "$ref": "#/definitions/MessageState"
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ResponseStatusesItem {
///When the message reached this state: first handed over for `delivered`, removed for `collected`, `withdrawn` and `discarded`. Absent for `queued` and `unknown`, and wherever the mediator does not disclose it.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub at: ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
#[serde(rename = "msgId")]
pub msg_id: ResponseStatusesItemMsgId,
pub state: MessageState,
}
impl ResponseStatusesItem {
pub fn builder() -> builder::ResponseStatusesItem {
Default::default()
}
}
///`ResponseStatusesItemMsgId`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "string",
/// "maxLength": 256,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ResponseStatusesItemMsgId(::std::string::String);
impl ::std::ops::Deref for ResponseStatusesItemMsgId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ResponseStatusesItemMsgId> for ::std::string::String {
fn from(value: ResponseStatusesItemMsgId) -> Self {
value.0
}
}
impl ::std::str::FromStr for ResponseStatusesItemMsgId {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 256usize {
return Err("longer than 256 characters".into());
}
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ResponseStatusesItemMsgId {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for ResponseStatusesItemMsgId {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for ResponseStatusesItemMsgId {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for ResponseStatusesItemMsgId {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
/// Types for composing complex structures.
pub mod builder {
#[derive(Clone, Debug)]
pub struct Payload {
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
msg_ids: ::std::result::Result<Vec<super::PayloadMsgIdsItem>, ::std::string::String>,
}
impl ::std::default::Default for Payload {
fn default() -> Self {
Self {
ext: Ok(Default::default()),
msg_ids: Err("no value supplied for msg_ids".to_string()),
}
}
}
impl Payload {
pub fn ext<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::Ext>>,
T::Error: ::std::fmt::Display,
{
self.ext = value
.try_into()
.map_err(|e| format!("error converting supplied value for ext: {e}"));
self
}
pub fn msg_ids<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<Vec<super::PayloadMsgIdsItem>>,
T::Error: ::std::fmt::Display,
{
self.msg_ids = value
.try_into()
.map_err(|e| format!("error converting supplied value for msg_ids: {e}"));
self
}
}
impl ::std::convert::TryFrom<Payload> for super::Payload {
type Error = super::error::ConversionError;
fn try_from(value: Payload) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
ext: value.ext?,
msg_ids: value.msg_ids?,
})
}
}
impl ::std::convert::From<super::Payload> for Payload {
fn from(value: super::Payload) -> Self {
Self {
ext: Ok(value.ext),
msg_ids: Ok(value.msg_ids),
}
}
}
#[derive(Clone, Debug)]
pub struct Response {
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
statuses: ::std::result::Result<
::std::vec::Vec<super::ResponseStatusesItem>,
::std::string::String,
>,
}
impl ::std::default::Default for Response {
fn default() -> Self {
Self {
ext: Ok(Default::default()),
statuses: Err("no value supplied for statuses".to_string()),
}
}
}
impl Response {
pub fn ext<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::Ext>>,
T::Error: ::std::fmt::Display,
{
self.ext = value
.try_into()
.map_err(|e| format!("error converting supplied value for ext: {e}"));
self
}
pub fn statuses<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::ResponseStatusesItem>>,
T::Error: ::std::fmt::Display,
{
self.statuses = value
.try_into()
.map_err(|e| format!("error converting supplied value for statuses: {e}"));
self
}
}
impl ::std::convert::TryFrom<Response> for super::Response {
type Error = super::error::ConversionError;
fn try_from(value: Response) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
ext: value.ext?,
statuses: value.statuses?,
})
}
}
impl ::std::convert::From<super::Response> for Response {
fn from(value: super::Response) -> Self {
Self {
ext: Ok(value.ext),
statuses: Ok(value.statuses),
}
}
}
#[derive(Clone, Debug)]
pub struct ResponseStatusesItem {
at: ::std::result::Result<
::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
::std::string::String,
>,
msg_id: ::std::result::Result<super::ResponseStatusesItemMsgId, ::std::string::String>,
state: ::std::result::Result<super::MessageState, ::std::string::String>,
}
impl ::std::default::Default for ResponseStatusesItem {
fn default() -> Self {
Self {
at: Ok(Default::default()),
msg_id: Err("no value supplied for msg_id".to_string()),
state: Err("no value supplied for state".to_string()),
}
}
}
impl ResponseStatusesItem {
pub fn at<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
>,
T::Error: ::std::fmt::Display,
{
self.at = value
.try_into()
.map_err(|e| format!("error converting supplied value for at: {e}"));
self
}
pub fn msg_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ResponseStatusesItemMsgId>,
T::Error: ::std::fmt::Display,
{
self.msg_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for msg_id: {e}"));
self
}
pub fn state<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::MessageState>,
T::Error: ::std::fmt::Display,
{
self.state = value
.try_into()
.map_err(|e| format!("error converting supplied value for state: {e}"));
self
}
}
impl ::std::convert::TryFrom<ResponseStatusesItem> for super::ResponseStatusesItem {
type Error = super::error::ConversionError;
fn try_from(
value: ResponseStatusesItem,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
at: value.at?,
msg_id: value.msg_id?,
state: value.state?,
})
}
}
impl ::std::convert::From<super::ResponseStatusesItem> for ResponseStatusesItem {
fn from(value: super::ResponseStatusesItem) -> Self {
Self {
at: Ok(value.at),
msg_id: Ok(value.msg_id),
state: Ok(value.state),
}
}
}
}
impl crate::Payload for Payload {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/messaging/message/status/0.1";
const IS_PROOF_REQUIRED: bool = true;
const IS_ISSUED_AT_REQUIRED: bool = true;
const IS_RECIPIENT_REQUIRED: bool = true;
const PAYLOAD_SCHEMA: Option<&'static str> = Some(
"{\n \"$defs\": {\n \"Ext\": {\n \"additionalProperties\": true,\n \"description\": \"Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.\",\n \"minProperties\": 1,\n \"propertyNames\": {\n \"pattern\": \"^[a-z][a-z0-9-]*(\\\\.[a-z0-9-]+)+$\"\n },\n \"title\": \"Ext\",\n \"type\": \"object\"\n },\n \"MessageState\": {\n \"description\": \"Where a sent message stands. `queued`: held for the recipient and not yet handed over. `delivered`: handed to the recipient (pickup or live stream) and not yet removed by it. `collected`: removed by the recipient — acknowledged after pickup, fetched with delete, or deleted or purged by it. `withdrawn`: removed by the sender. `discarded`: removed by the mediator before the recipient took it — expired, or its account was removed. `unknown`: the mediator holds neither the message nor a receipt for it under the requester.\",\n \"enum\": [\n \"queued\",\n \"delivered\",\n \"collected\",\n \"withdrawn\",\n \"discarded\",\n \"unknown\"\n ],\n \"title\": \"MessageState\",\n \"type\": \"string\"\n },\n \"Response\": {\n \"$anchor\": \"response\",\n \"additionalProperties\": false,\n \"description\": \"The success response to a messaging/message/status request. Carried in a Trust Task document whose type is https://trusttasks.org/spec/messaging/message/status/0.1#response.\",\n \"properties\": {\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\",\n \"description\": \"Ecosystem-defined extension members per SPEC.md §4.5.1.\"\n },\n \"statuses\": {\n \"description\": \"One entry per requested msgId, in request order.\",\n \"items\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"at\": {\n \"description\": \"When the message reached this state: first handed over for `delivered`, removed for `collected`, `withdrawn` and `discarded`. Absent for `queued` and `unknown`, and wherever the mediator does not disclose it.\",\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"msgId\": {\n \"maxLength\": 256,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"state\": {\n \"$ref\": \"#/$defs/MessageState\"\n }\n },\n \"required\": [\n \"msgId\",\n \"state\"\n ],\n \"type\": \"object\"\n },\n \"type\": \"array\"\n }\n },\n \"required\": [\n \"statuses\"\n ],\n \"title\": \"Messaging — Message Status — response payload\",\n \"type\": \"object\"\n }\n },\n \"$id\": \"https://trusttasks.org/spec/messaging/message/status/0.1\",\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\": false,\n \"properties\": {\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\",\n \"description\": \"Ecosystem-defined extension members per SPEC.md §4.5.1.\"\n },\n \"msgIds\": {\n \"description\": \"The messages the requester sent and wants the status of, by the mediator's message identifier.\",\n \"items\": {\n \"maxLength\": 256,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"maxItems\": 100,\n \"minItems\": 1,\n \"type\": \"array\",\n \"uniqueItems\": true\n }\n },\n \"required\": [\n \"msgIds\"\n ],\n \"title\": \"Messaging — Message Status — payload\",\n \"type\": \"object\"\n}\n",
);
}
impl crate::Payload for Response {
const TYPE_URI: &'static str =
"https://trusttasks.org/spec/messaging/message/status/0.1#response";
const IS_ISSUED_AT_REQUIRED: bool = true;
const IS_RECIPIENT_REQUIRED: bool = true;
const PAYLOAD_SCHEMA: Option<&'static str> = Some(
"{\n \"$defs\": {\n \"Ext\": {\n \"additionalProperties\": true,\n \"description\": \"Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.\",\n \"minProperties\": 1,\n \"propertyNames\": {\n \"pattern\": \"^[a-z][a-z0-9-]*(\\\\.[a-z0-9-]+)+$\"\n },\n \"title\": \"Ext\",\n \"type\": \"object\"\n },\n \"MessageState\": {\n \"description\": \"Where a sent message stands. `queued`: held for the recipient and not yet handed over. `delivered`: handed to the recipient (pickup or live stream) and not yet removed by it. `collected`: removed by the recipient — acknowledged after pickup, fetched with delete, or deleted or purged by it. `withdrawn`: removed by the sender. `discarded`: removed by the mediator before the recipient took it — expired, or its account was removed. `unknown`: the mediator holds neither the message nor a receipt for it under the requester.\",\n \"enum\": [\n \"queued\",\n \"delivered\",\n \"collected\",\n \"withdrawn\",\n \"discarded\",\n \"unknown\"\n ],\n \"title\": \"MessageState\",\n \"type\": \"string\"\n },\n \"Response\": {\n \"$anchor\": \"response\",\n \"additionalProperties\": false,\n \"description\": \"The success response to a messaging/message/status request. Carried in a Trust Task document whose type is https://trusttasks.org/spec/messaging/message/status/0.1#response.\",\n \"properties\": {\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\",\n \"description\": \"Ecosystem-defined extension members per SPEC.md §4.5.1.\"\n },\n \"statuses\": {\n \"description\": \"One entry per requested msgId, in request order.\",\n \"items\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"at\": {\n \"description\": \"When the message reached this state: first handed over for `delivered`, removed for `collected`, `withdrawn` and `discarded`. Absent for `queued` and `unknown`, and wherever the mediator does not disclose it.\",\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"msgId\": {\n \"maxLength\": 256,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"state\": {\n \"$ref\": \"#/$defs/MessageState\"\n }\n },\n \"required\": [\n \"msgId\",\n \"state\"\n ],\n \"type\": \"object\"\n },\n \"type\": \"array\"\n }\n },\n \"required\": [\n \"statuses\"\n ],\n \"title\": \"Messaging — Message Status — response payload\",\n \"type\": \"object\"\n }\n },\n \"$ref\": \"#/$defs/Response\",\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\"\n}\n",
);
}
impl crate::RequestPayload for Payload {
type Response = Response;
}
/// The extended error codes this specification declares (SPEC §7.3 item 9,
/// §8.5), in declaration order. Empty when it declares none.
pub const ERROR_CODES: &[crate::DeclaredErrorCode] = &[];