//! Generated by `trust-tasks-codegen` — do not edit by hand.
//!
//! Spec slug: `messaging/monitor/subscribe`. Version: `0.1`.
/// Why this specification version is deprecated (SPEC "Superseded and
/// Withdrawn Versions"), or `None` while it is current.
pub const DEPRECATION: Option<&str> = None;
#[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.
///
#[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`
///
#[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())
})
}
}
///Selects which events a monitor subscription receives. Every member present narrows the selection (members are ANDed; values within one member are ORed). An empty filter selects everything the requester is entitled to see.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct MonitorFilter {
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub channels: ::std::option::Option<Vec<TrafficChannel>>,
///Only events whose `from` or `to` is one of these accounts.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub dids: ::std::option::Option<Vec<Vid>>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub directions: ::std::option::Option<Vec<TrafficDirection>>,
///Only events that carry an `outcome`.
#[serde(
rename = "failuresOnly",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub failures_only: ::std::option::Option<bool>,
///Only events whose `messageType` starts with one of these strings. Events with no `messageType` never match when this member is present.
#[serde(
rename = "messageTypePrefixes",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub message_type_prefixes: ::std::option::Option<Vec<MonitorFilterMessageTypePrefixesItem>>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub protocols: ::std::option::Option<Vec<WireProtocol>>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub stages: ::std::option::Option<Vec<TrafficStage>>,
}
impl ::std::default::Default for MonitorFilter {
fn default() -> Self {
Self {
channels: Default::default(),
dids: Default::default(),
directions: Default::default(),
failures_only: Default::default(),
message_type_prefixes: Default::default(),
protocols: Default::default(),
stages: Default::default(),
}
}
}
impl MonitorFilter {
pub fn builder() -> builder::MonitorFilter {
Default::default()
}
}
///`MonitorFilterMessageTypePrefixesItem`
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct MonitorFilterMessageTypePrefixesItem(::std::string::String);
impl ::std::ops::Deref for MonitorFilterMessageTypePrefixesItem {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<MonitorFilterMessageTypePrefixesItem> for ::std::string::String {
fn from(value: MonitorFilterMessageTypePrefixesItem) -> Self {
value.0
}
}
impl ::std::str::FromStr for MonitorFilterMessageTypePrefixesItem {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 512usize {
return Err("longer than 512 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 MonitorFilterMessageTypePrefixesItem {
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 MonitorFilterMessageTypePrefixesItem {
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 MonitorFilterMessageTypePrefixesItem {
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 MonitorFilterMessageTypePrefixesItem {
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())
})
}
}
///`Payload`
///
#[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>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub filter: ::std::option::Option<MonitorFilter>,
///How long the subscription lives unless renewed. Default 300.
#[serde(
rename = "leaseSeconds",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub lease_seconds: ::std::option::Option<i64>,
///Rate ceiling the subscriber can absorb; the mediator MAY apply a lower one. Events over the ceiling are counted as dropped, never queued.
#[serde(
rename = "maxEventsPerSecond",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub max_events_per_second: ::std::option::Option<::std::num::NonZeroU64>,
///Renew or re-filter an existing subscription held by the same requester. Omitted = create a new one.
#[serde(
rename = "subscriptionId",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub subscription_id: ::std::option::Option<PayloadSubscriptionId>,
}
impl ::std::default::Default for Payload {
fn default() -> Self {
Self {
ext: Default::default(),
filter: Default::default(),
lease_seconds: Default::default(),
max_events_per_second: Default::default(),
subscription_id: Default::default(),
}
}
}
impl Payload {
pub fn builder() -> builder::Payload {
Default::default()
}
}
///Renew or re-filter an existing subscription held by the same requester. Omitted = create a new one.
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PayloadSubscriptionId(::std::string::String);
impl ::std::ops::Deref for PayloadSubscriptionId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PayloadSubscriptionId> for ::std::string::String {
fn from(value: PayloadSubscriptionId) -> Self {
value.0
}
}
impl ::std::str::FromStr for PayloadSubscriptionId {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for PayloadSubscriptionId {
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 PayloadSubscriptionId {
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 PayloadSubscriptionId {
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 PayloadSubscriptionId {
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/monitor/subscribe request. Carried in a Trust Task document whose type is https://trusttasks.org/spec/messaging/monitor/subscribe/0.1#response.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Response {
#[serde(rename = "expiresAt")]
pub expires_at: ::chrono::DateTime<::chrono::offset::Utc>,
///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 filter in force, after the mediator narrowed it to what the requester is entitled to see.
pub filter: MonitorFilter,
///The rate ceiling in force.
#[serde(rename = "maxEventsPerSecond")]
pub max_events_per_second: ::std::num::NonZeroU64,
#[serde(rename = "subscriptionId")]
pub subscription_id: ResponseSubscriptionId,
}
impl Response {
pub fn builder() -> builder::Response {
Default::default()
}
}
///`ResponseSubscriptionId`
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ResponseSubscriptionId(::std::string::String);
impl ::std::ops::Deref for ResponseSubscriptionId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ResponseSubscriptionId> for ::std::string::String {
fn from(value: ResponseSubscriptionId) -> Self {
value.0
}
}
impl ::std::str::FromStr for ResponseSubscriptionId {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ResponseSubscriptionId {
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 ResponseSubscriptionId {
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 ResponseSubscriptionId {
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 ResponseSubscriptionId {
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())
})
}
}
///How the traffic reached or left the mediator. `peerMediator` is mediator-to-mediator forwarding.
///
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum TrafficChannel {
#[serde(rename = "websocket")]
Websocket,
#[serde(rename = "rest")]
Rest,
#[serde(rename = "peerMediator")]
PeerMediator,
#[serde(rename = "internal")]
Internal,
}
impl ::std::fmt::Display for TrafficChannel {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Websocket => f.write_str("websocket"),
Self::Rest => f.write_str("rest"),
Self::PeerMediator => f.write_str("peerMediator"),
Self::Internal => f.write_str("internal"),
}
}
}
impl ::std::str::FromStr for TrafficChannel {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"websocket" => Ok(Self::Websocket),
"rest" => Ok(Self::Rest),
"peerMediator" => Ok(Self::PeerMediator),
"internal" => Ok(Self::Internal),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for TrafficChannel {
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 TrafficChannel {
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 TrafficChannel {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///`inbound`: arriving at the mediator. `outbound`: leaving it (delivery to a recipient, or a forward to another mediator). `internal`: a state change with no wire traffic (expiry, deletion, purge).
///
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum TrafficDirection {
#[serde(rename = "inbound")]
Inbound,
#[serde(rename = "outbound")]
Outbound,
#[serde(rename = "internal")]
Internal,
}
impl ::std::fmt::Display for TrafficDirection {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Inbound => f.write_str("inbound"),
Self::Outbound => f.write_str("outbound"),
Self::Internal => f.write_str("internal"),
}
}
}
impl ::std::str::FromStr for TrafficDirection {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"inbound" => Ok(Self::Inbound),
"outbound" => Ok(Self::Outbound),
"internal" => Ok(Self::Internal),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for TrafficDirection {
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 TrafficDirection {
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 TrafficDirection {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///What happened. `received`: a frame arrived. `stored`: it was queued for a local account. `delivered`: handed to its recipient. `forwarded`: relayed to another mediator. `refused`: rejected (see the event's `outcome`). `deleted`: removed by its recipient or an administrator. `expired`: removed by expiry. `purged`: removed by a queue purge.
///
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum TrafficStage {
#[serde(rename = "received")]
Received,
#[serde(rename = "stored")]
Stored,
#[serde(rename = "delivered")]
Delivered,
#[serde(rename = "forwarded")]
Forwarded,
#[serde(rename = "refused")]
Refused,
#[serde(rename = "deleted")]
Deleted,
#[serde(rename = "expired")]
Expired,
#[serde(rename = "purged")]
Purged,
}
impl ::std::fmt::Display for TrafficStage {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Received => f.write_str("received"),
Self::Stored => f.write_str("stored"),
Self::Delivered => f.write_str("delivered"),
Self::Forwarded => f.write_str("forwarded"),
Self::Refused => f.write_str("refused"),
Self::Deleted => f.write_str("deleted"),
Self::Expired => f.write_str("expired"),
Self::Purged => f.write_str("purged"),
}
}
}
impl ::std::str::FromStr for TrafficStage {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"received" => Ok(Self::Received),
"stored" => Ok(Self::Stored),
"delivered" => Ok(Self::Delivered),
"forwarded" => Ok(Self::Forwarded),
"refused" => Ok(Self::Refused),
"deleted" => Ok(Self::Deleted),
"expired" => Ok(Self::Expired),
"purged" => Ok(Self::Purged),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for TrafficStage {
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 TrafficStage {
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 TrafficStage {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///A Verifiable Identifier (SPEC §4.8). For a mediator-served account this is the account's controlling DID, carried verbatim and compared by exact string equality. For privacy — and because some mediators key accounts by a one-way hash and never hold the full DID — a stable hash of the DID (e.g. its SHA-256 digest) is an equally valid value here: producer and consumer simply agree on the same opaque identifier and compare by exact string equality. The field carries whichever form the issuing mediator uses.
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct Vid(::std::string::String);
impl ::std::ops::Deref for Vid {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<Vid> for ::std::string::String {
fn from(value: Vid) -> Self {
value.0
}
}
impl ::std::str::FromStr for Vid {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for Vid {
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 Vid {
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 Vid {
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 Vid {
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 protocol a message travelled in, as the mediator detected it from the wire form. `didcomm` is DIDComm v2 (JWE/JWS); `didcommV1` is a DIDComm v1 envelope; `tsp` is a Trust Spanning Protocol message; `other` is anything the mediator could not classify.
///
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum WireProtocol {
#[serde(rename = "didcomm")]
Didcomm,
#[serde(rename = "didcommV1")]
DidcommV1,
#[serde(rename = "tsp")]
Tsp,
#[serde(rename = "other")]
Other,
}
impl ::std::fmt::Display for WireProtocol {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Didcomm => f.write_str("didcomm"),
Self::DidcommV1 => f.write_str("didcommV1"),
Self::Tsp => f.write_str("tsp"),
Self::Other => f.write_str("other"),
}
}
}
impl ::std::str::FromStr for WireProtocol {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"didcomm" => Ok(Self::Didcomm),
"didcommV1" => Ok(Self::DidcommV1),
"tsp" => Ok(Self::Tsp),
"other" => Ok(Self::Other),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for WireProtocol {
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 WireProtocol {
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 WireProtocol {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
/// Types for composing complex structures.
pub mod builder {
#[derive(Clone, Debug)]
pub struct MonitorFilter {
channels: ::std::result::Result<
::std::option::Option<Vec<super::TrafficChannel>>,
::std::string::String,
>,
dids: ::std::result::Result<::std::option::Option<Vec<super::Vid>>, ::std::string::String>,
directions: ::std::result::Result<
::std::option::Option<Vec<super::TrafficDirection>>,
::std::string::String,
>,
failures_only: ::std::result::Result<::std::option::Option<bool>, ::std::string::String>,
message_type_prefixes: ::std::result::Result<
::std::option::Option<Vec<super::MonitorFilterMessageTypePrefixesItem>>,
::std::string::String,
>,
protocols: ::std::result::Result<
::std::option::Option<Vec<super::WireProtocol>>,
::std::string::String,
>,
stages: ::std::result::Result<
::std::option::Option<Vec<super::TrafficStage>>,
::std::string::String,
>,
}
impl ::std::default::Default for MonitorFilter {
fn default() -> Self {
Self {
channels: Ok(Default::default()),
dids: Ok(Default::default()),
directions: Ok(Default::default()),
failures_only: Ok(Default::default()),
message_type_prefixes: Ok(Default::default()),
protocols: Ok(Default::default()),
stages: Ok(Default::default()),
}
}
}
impl MonitorFilter {
pub fn channels<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<Vec<super::TrafficChannel>>>,
T::Error: ::std::fmt::Display,
{
self.channels = value
.try_into()
.map_err(|e| format!("error converting supplied value for channels: {e}"));
self
}
pub fn dids<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<Vec<super::Vid>>>,
T::Error: ::std::fmt::Display,
{
self.dids = value
.try_into()
.map_err(|e| format!("error converting supplied value for dids: {e}"));
self
}
pub fn directions<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<Vec<super::TrafficDirection>>>,
T::Error: ::std::fmt::Display,
{
self.directions = value
.try_into()
.map_err(|e| format!("error converting supplied value for directions: {e}"));
self
}
pub fn failures_only<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<bool>>,
T::Error: ::std::fmt::Display,
{
self.failures_only = value
.try_into()
.map_err(|e| format!("error converting supplied value for failures_only: {e}"));
self
}
pub fn message_type_prefixes<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::std::option::Option<Vec<super::MonitorFilterMessageTypePrefixesItem>>,
>,
T::Error: ::std::fmt::Display,
{
self.message_type_prefixes = value.try_into().map_err(|e| {
format!("error converting supplied value for message_type_prefixes: {e}")
});
self
}
pub fn protocols<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<Vec<super::WireProtocol>>>,
T::Error: ::std::fmt::Display,
{
self.protocols = value
.try_into()
.map_err(|e| format!("error converting supplied value for protocols: {e}"));
self
}
pub fn stages<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<Vec<super::TrafficStage>>>,
T::Error: ::std::fmt::Display,
{
self.stages = value
.try_into()
.map_err(|e| format!("error converting supplied value for stages: {e}"));
self
}
}
impl ::std::convert::TryFrom<MonitorFilter> for super::MonitorFilter {
type Error = super::error::ConversionError;
fn try_from(
value: MonitorFilter,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
channels: value.channels?,
dids: value.dids?,
directions: value.directions?,
failures_only: value.failures_only?,
message_type_prefixes: value.message_type_prefixes?,
protocols: value.protocols?,
stages: value.stages?,
})
}
}
impl ::std::convert::From<super::MonitorFilter> for MonitorFilter {
fn from(value: super::MonitorFilter) -> Self {
Self {
channels: Ok(value.channels),
dids: Ok(value.dids),
directions: Ok(value.directions),
failures_only: Ok(value.failures_only),
message_type_prefixes: Ok(value.message_type_prefixes),
protocols: Ok(value.protocols),
stages: Ok(value.stages),
}
}
}
#[derive(Clone, Debug)]
pub struct Payload {
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
filter: ::std::result::Result<
::std::option::Option<super::MonitorFilter>,
::std::string::String,
>,
lease_seconds: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
max_events_per_second: ::std::result::Result<
::std::option::Option<::std::num::NonZeroU64>,
::std::string::String,
>,
subscription_id: ::std::result::Result<
::std::option::Option<super::PayloadSubscriptionId>,
::std::string::String,
>,
}
impl ::std::default::Default for Payload {
fn default() -> Self {
Self {
ext: Ok(Default::default()),
filter: Ok(Default::default()),
lease_seconds: Ok(Default::default()),
max_events_per_second: Ok(Default::default()),
subscription_id: Ok(Default::default()),
}
}
}
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 filter<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::MonitorFilter>>,
T::Error: ::std::fmt::Display,
{
self.filter = value
.try_into()
.map_err(|e| format!("error converting supplied value for filter: {e}"));
self
}
pub fn lease_seconds<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<i64>>,
T::Error: ::std::fmt::Display,
{
self.lease_seconds = value
.try_into()
.map_err(|e| format!("error converting supplied value for lease_seconds: {e}"));
self
}
pub fn max_events_per_second<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::std::num::NonZeroU64>>,
T::Error: ::std::fmt::Display,
{
self.max_events_per_second = value.try_into().map_err(|e| {
format!("error converting supplied value for max_events_per_second: {e}")
});
self
}
pub fn subscription_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PayloadSubscriptionId>>,
T::Error: ::std::fmt::Display,
{
self.subscription_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for subscription_id: {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?,
filter: value.filter?,
lease_seconds: value.lease_seconds?,
max_events_per_second: value.max_events_per_second?,
subscription_id: value.subscription_id?,
})
}
}
impl ::std::convert::From<super::Payload> for Payload {
fn from(value: super::Payload) -> Self {
Self {
ext: Ok(value.ext),
filter: Ok(value.filter),
lease_seconds: Ok(value.lease_seconds),
max_events_per_second: Ok(value.max_events_per_second),
subscription_id: Ok(value.subscription_id),
}
}
}
#[derive(Clone, Debug)]
pub struct Response {
expires_at:
::std::result::Result<::chrono::DateTime<::chrono::offset::Utc>, ::std::string::String>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
filter: ::std::result::Result<super::MonitorFilter, ::std::string::String>,
max_events_per_second: ::std::result::Result<::std::num::NonZeroU64, ::std::string::String>,
subscription_id:
::std::result::Result<super::ResponseSubscriptionId, ::std::string::String>,
}
impl ::std::default::Default for Response {
fn default() -> Self {
Self {
expires_at: Err("no value supplied for expires_at".to_string()),
ext: Ok(Default::default()),
filter: Err("no value supplied for filter".to_string()),
max_events_per_second: Err(
"no value supplied for max_events_per_second".to_string()
),
subscription_id: Err("no value supplied for subscription_id".to_string()),
}
}
}
impl Response {
pub fn expires_at<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
T::Error: ::std::fmt::Display,
{
self.expires_at = value
.try_into()
.map_err(|e| format!("error converting supplied value for expires_at: {e}"));
self
}
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 filter<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::MonitorFilter>,
T::Error: ::std::fmt::Display,
{
self.filter = value
.try_into()
.map_err(|e| format!("error converting supplied value for filter: {e}"));
self
}
pub fn max_events_per_second<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::num::NonZeroU64>,
T::Error: ::std::fmt::Display,
{
self.max_events_per_second = value.try_into().map_err(|e| {
format!("error converting supplied value for max_events_per_second: {e}")
});
self
}
pub fn subscription_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ResponseSubscriptionId>,
T::Error: ::std::fmt::Display,
{
self.subscription_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for subscription_id: {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 {
expires_at: value.expires_at?,
ext: value.ext?,
filter: value.filter?,
max_events_per_second: value.max_events_per_second?,
subscription_id: value.subscription_id?,
})
}
}
impl ::std::convert::From<super::Response> for Response {
fn from(value: super::Response) -> Self {
Self {
expires_at: Ok(value.expires_at),
ext: Ok(value.ext),
filter: Ok(value.filter),
max_events_per_second: Ok(value.max_events_per_second),
subscription_id: Ok(value.subscription_id),
}
}
}
}
impl crate::Payload for Payload {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/messaging/monitor/subscribe/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(
"{\"$defs\":{\"Ext\":{\"additionalProperties\":true,\"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.\",\"minProperties\":1,\"propertyNames\":{\"pattern\":\"^[a-z][a-z0-9-]*(\\\\.[a-z0-9-]+)+$\"},\"title\":\"Ext\",\"type\":\"object\"},\"MonitorFilter\":{\"additionalProperties\":false,\"description\":\"Selects which events a monitor subscription receives. Every member present narrows the selection (members are ANDed; values within one member are ORed). An empty filter selects everything the requester is entitled to see.\",\"properties\":{\"channels\":{\"items\":{\"$ref\":\"#/$defs/TrafficChannel\"},\"minItems\":1,\"type\":\"array\",\"uniqueItems\":true},\"dids\":{\"description\":\"Only events whose `from` or `to` is one of these accounts.\",\"items\":{\"$ref\":\"#/$defs/Vid\"},\"maxItems\":100,\"minItems\":1,\"type\":\"array\",\"uniqueItems\":true},\"directions\":{\"items\":{\"$ref\":\"#/$defs/TrafficDirection\"},\"minItems\":1,\"type\":\"array\",\"uniqueItems\":true},\"failuresOnly\":{\"description\":\"Only events that carry an `outcome`.\",\"type\":\"boolean\"},\"messageTypePrefixes\":{\"description\":\"Only events whose `messageType` starts with one of these strings. Events with no `messageType` never match when this member is present.\",\"items\":{\"maxLength\":512,\"minLength\":1,\"type\":\"string\"},\"maxItems\":20,\"minItems\":1,\"type\":\"array\",\"uniqueItems\":true},\"protocols\":{\"items\":{\"$ref\":\"#/$defs/WireProtocol\"},\"minItems\":1,\"type\":\"array\",\"uniqueItems\":true},\"stages\":{\"items\":{\"$ref\":\"#/$defs/TrafficStage\"},\"minItems\":1,\"type\":\"array\",\"uniqueItems\":true}},\"title\":\"MonitorFilter\",\"type\":\"object\"},\"Response\":{\"$anchor\":\"response\",\"additionalProperties\":false,\"description\":\"The success response to a messaging/monitor/subscribe request. Carried in a Trust Task document whose type is https://trusttasks.org/spec/messaging/monitor/subscribe/0.1#response.\",\"properties\":{\"expiresAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"ext\":{\"$ref\":\"#/$defs/Ext\",\"description\":\"Ecosystem-defined extension members per SPEC.md §4.5.1.\"},\"filter\":{\"$ref\":\"#/$defs/MonitorFilter\",\"description\":\"The filter in force, after the mediator narrowed it to what the requester is entitled to see.\"},\"maxEventsPerSecond\":{\"description\":\"The rate ceiling in force.\",\"minimum\":1,\"type\":\"integer\"},\"subscriptionId\":{\"minLength\":1,\"type\":\"string\"}},\"required\":[\"subscriptionId\",\"expiresAt\",\"filter\",\"maxEventsPerSecond\"],\"title\":\"Messaging — Subscribe to Traffic Monitor — response payload\",\"type\":\"object\"},\"TrafficChannel\":{\"description\":\"How the traffic reached or left the mediator. `peerMediator` is mediator-to-mediator forwarding.\",\"enum\":[\"websocket\",\"rest\",\"peerMediator\",\"internal\"],\"title\":\"TrafficChannel\",\"type\":\"string\"},\"TrafficDirection\":{\"description\":\"`inbound`: arriving at the mediator. `outbound`: leaving it (delivery to a recipient, or a forward to another mediator). `internal`: a state change with no wire traffic (expiry, deletion, purge).\",\"enum\":[\"inbound\",\"outbound\",\"internal\"],\"title\":\"TrafficDirection\",\"type\":\"string\"},\"TrafficStage\":{\"description\":\"What happened. `received`: a frame arrived. `stored`: it was queued for a local account. `delivered`: handed to its recipient. `forwarded`: relayed to another mediator. `refused`: rejected (see the event's `outcome`). `deleted`: removed by its recipient or an administrator. `expired`: removed by expiry. `purged`: removed by a queue purge.\",\"enum\":[\"received\",\"stored\",\"delivered\",\"forwarded\",\"refused\",\"deleted\",\"expired\",\"purged\"],\"title\":\"TrafficStage\",\"type\":\"string\"},\"Vid\":{\"description\":\"A Verifiable Identifier (SPEC §4.8). For a mediator-served account this is the account's controlling DID, carried verbatim and compared by exact string equality. For privacy — and because some mediators key accounts by a one-way hash and never hold the full DID — a stable hash of the DID (e.g. its SHA-256 digest) is an equally valid value here: producer and consumer simply agree on the same opaque identifier and compare by exact string equality. The field carries whichever form the issuing mediator uses.\",\"minLength\":1,\"title\":\"Vid\",\"type\":\"string\"},\"WireProtocol\":{\"description\":\"The protocol a message travelled in, as the mediator detected it from the wire form. `didcomm` is DIDComm v2 (JWE/JWS); `didcommV1` is a DIDComm v1 envelope; `tsp` is a Trust Spanning Protocol message; `other` is anything the mediator could not classify.\",\"enum\":[\"didcomm\",\"didcommV1\",\"tsp\",\"other\"],\"title\":\"WireProtocol\",\"type\":\"string\"}},\"$id\":\"https://trusttasks.org/spec/messaging/monitor/subscribe/0.1\",\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"additionalProperties\":false,\"properties\":{\"ext\":{\"$ref\":\"#/$defs/Ext\",\"description\":\"Ecosystem-defined extension members per SPEC.md §4.5.1.\"},\"filter\":{\"$ref\":\"#/$defs/MonitorFilter\"},\"leaseSeconds\":{\"description\":\"How long the subscription lives unless renewed. Default 300.\",\"maximum\":3600,\"minimum\":10,\"type\":\"integer\"},\"maxEventsPerSecond\":{\"description\":\"Rate ceiling the subscriber can absorb; the mediator MAY apply a lower one. Events over the ceiling are counted as dropped, never queued.\",\"maximum\":1000,\"minimum\":1,\"type\":\"integer\"},\"subscriptionId\":{\"description\":\"Renew or re-filter an existing subscription held by the same requester. Omitted = create a new one.\",\"minLength\":1,\"type\":\"string\"}},\"title\":\"Messaging — Subscribe to Traffic Monitor — payload\",\"type\":\"object\"}\n",
);
}
impl crate::Payload for Response {
const TYPE_URI: &'static str =
"https://trusttasks.org/spec/messaging/monitor/subscribe/0.1#response";
const IS_ISSUED_AT_REQUIRED: bool = true;
const IS_RECIPIENT_REQUIRED: bool = true;
const PAYLOAD_SCHEMA: Option<&'static str> = Some(
"{\"$defs\":{\"Ext\":{\"additionalProperties\":true,\"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.\",\"minProperties\":1,\"propertyNames\":{\"pattern\":\"^[a-z][a-z0-9-]*(\\\\.[a-z0-9-]+)+$\"},\"title\":\"Ext\",\"type\":\"object\"},\"MonitorFilter\":{\"additionalProperties\":false,\"description\":\"Selects which events a monitor subscription receives. Every member present narrows the selection (members are ANDed; values within one member are ORed). An empty filter selects everything the requester is entitled to see.\",\"properties\":{\"channels\":{\"items\":{\"$ref\":\"#/$defs/TrafficChannel\"},\"minItems\":1,\"type\":\"array\",\"uniqueItems\":true},\"dids\":{\"description\":\"Only events whose `from` or `to` is one of these accounts.\",\"items\":{\"$ref\":\"#/$defs/Vid\"},\"maxItems\":100,\"minItems\":1,\"type\":\"array\",\"uniqueItems\":true},\"directions\":{\"items\":{\"$ref\":\"#/$defs/TrafficDirection\"},\"minItems\":1,\"type\":\"array\",\"uniqueItems\":true},\"failuresOnly\":{\"description\":\"Only events that carry an `outcome`.\",\"type\":\"boolean\"},\"messageTypePrefixes\":{\"description\":\"Only events whose `messageType` starts with one of these strings. Events with no `messageType` never match when this member is present.\",\"items\":{\"maxLength\":512,\"minLength\":1,\"type\":\"string\"},\"maxItems\":20,\"minItems\":1,\"type\":\"array\",\"uniqueItems\":true},\"protocols\":{\"items\":{\"$ref\":\"#/$defs/WireProtocol\"},\"minItems\":1,\"type\":\"array\",\"uniqueItems\":true},\"stages\":{\"items\":{\"$ref\":\"#/$defs/TrafficStage\"},\"minItems\":1,\"type\":\"array\",\"uniqueItems\":true}},\"title\":\"MonitorFilter\",\"type\":\"object\"},\"Response\":{\"$anchor\":\"response\",\"additionalProperties\":false,\"description\":\"The success response to a messaging/monitor/subscribe request. Carried in a Trust Task document whose type is https://trusttasks.org/spec/messaging/monitor/subscribe/0.1#response.\",\"properties\":{\"expiresAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"ext\":{\"$ref\":\"#/$defs/Ext\",\"description\":\"Ecosystem-defined extension members per SPEC.md §4.5.1.\"},\"filter\":{\"$ref\":\"#/$defs/MonitorFilter\",\"description\":\"The filter in force, after the mediator narrowed it to what the requester is entitled to see.\"},\"maxEventsPerSecond\":{\"description\":\"The rate ceiling in force.\",\"minimum\":1,\"type\":\"integer\"},\"subscriptionId\":{\"minLength\":1,\"type\":\"string\"}},\"required\":[\"subscriptionId\",\"expiresAt\",\"filter\",\"maxEventsPerSecond\"],\"title\":\"Messaging — Subscribe to Traffic Monitor — response payload\",\"type\":\"object\"},\"TrafficChannel\":{\"description\":\"How the traffic reached or left the mediator. `peerMediator` is mediator-to-mediator forwarding.\",\"enum\":[\"websocket\",\"rest\",\"peerMediator\",\"internal\"],\"title\":\"TrafficChannel\",\"type\":\"string\"},\"TrafficDirection\":{\"description\":\"`inbound`: arriving at the mediator. `outbound`: leaving it (delivery to a recipient, or a forward to another mediator). `internal`: a state change with no wire traffic (expiry, deletion, purge).\",\"enum\":[\"inbound\",\"outbound\",\"internal\"],\"title\":\"TrafficDirection\",\"type\":\"string\"},\"TrafficStage\":{\"description\":\"What happened. `received`: a frame arrived. `stored`: it was queued for a local account. `delivered`: handed to its recipient. `forwarded`: relayed to another mediator. `refused`: rejected (see the event's `outcome`). `deleted`: removed by its recipient or an administrator. `expired`: removed by expiry. `purged`: removed by a queue purge.\",\"enum\":[\"received\",\"stored\",\"delivered\",\"forwarded\",\"refused\",\"deleted\",\"expired\",\"purged\"],\"title\":\"TrafficStage\",\"type\":\"string\"},\"Vid\":{\"description\":\"A Verifiable Identifier (SPEC §4.8). For a mediator-served account this is the account's controlling DID, carried verbatim and compared by exact string equality. For privacy — and because some mediators key accounts by a one-way hash and never hold the full DID — a stable hash of the DID (e.g. its SHA-256 digest) is an equally valid value here: producer and consumer simply agree on the same opaque identifier and compare by exact string equality. The field carries whichever form the issuing mediator uses.\",\"minLength\":1,\"title\":\"Vid\",\"type\":\"string\"},\"WireProtocol\":{\"description\":\"The protocol a message travelled in, as the mediator detected it from the wire form. `didcomm` is DIDComm v2 (JWE/JWS); `didcommV1` is a DIDComm v1 envelope; `tsp` is a Trust Spanning Protocol message; `other` is anything the mediator could not classify.\",\"enum\":[\"didcomm\",\"didcommV1\",\"tsp\",\"other\"],\"title\":\"WireProtocol\",\"type\":\"string\"}},\"$ref\":\"#/$defs/Response\",\"$schema\":\"https://json-schema.org/draft/2020-12/schema\"}\n",
);
}
impl crate::RequestPayload for Payload {
type Response = Response;
}
/// The earlier `MAJOR.MINOR` of this slug that this version declares it
/// extends (front matter `extends`, SPEC §5.2 "Declared extension"), or
/// `None`. Only the direct declaration; walk a chain with
/// [`crate::extension::extends_for`].
pub const EXTENDS: Option<&str> = None;
/// 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] = &[
error_codes::UNKNOWN_SUBSCRIPTION,
error_codes::TOO_MANY_SUBSCRIPTIONS,
];
/// One constant per extended error code this specification declares
/// (SPEC §7.3 item 9), named for its local part.
///
/// Emit these rather than a string literal: the code is read from the
/// specification, so it cannot name a code the specification never
/// declared.
pub mod error_codes {
/// `messaging/monitor/subscribe:unknownSubscription`
///
/// The request names a `subscriptionId` the mediator does not hold for this requester — it never existed, has expired, was ended, or belongs to someone else. Omit `subscriptionId` to open a new subscription.
///
/// Declared `retryable: false`.
pub const UNKNOWN_SUBSCRIPTION: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "messaging/monitor/subscribe:unknownSubscription",
retryable: false,
details_schema: ::core::option::Option::None,
};
/// `messaging/monitor/subscribe:tooManySubscriptions`
///
/// The requester already holds the maximum number of concurrent subscriptions the mediator allows. End one, or wait for one to expire.
///
/// Declared `retryable: true`.
pub const TOO_MANY_SUBSCRIPTIONS: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "messaging/monitor/subscribe:tooManySubscriptions",
retryable: true,
details_schema: ::core::option::Option::None,
};
}