//! Generated by `trust-tasks-codegen` — do not edit by hand.
//!
//! Spec slug: `did-management/server/stats-sync`. 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())
})
}
}
///`Payload`
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Payload {
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub buckets: ::std::vec::Vec<PayloadBucketsItem>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
#[serde(rename = "instanceId")]
pub instance_id: PayloadInstanceId,
#[serde(rename = "perMnemonic")]
pub per_mnemonic: ::std::vec::Vec<PayloadPerMnemonicItem>,
}
impl Payload {
pub fn builder() -> builder::Payload {
Default::default()
}
}
///`PayloadBucketsItem`
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct PayloadBucketsItem {
pub epoch: u64,
pub mnemonic: PayloadBucketsItemMnemonic,
pub r: u64,
pub u: u64,
}
impl PayloadBucketsItem {
pub fn builder() -> builder::PayloadBucketsItem {
Default::default()
}
}
///`PayloadBucketsItemMnemonic`
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PayloadBucketsItemMnemonic(::std::string::String);
impl ::std::ops::Deref for PayloadBucketsItemMnemonic {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PayloadBucketsItemMnemonic> for ::std::string::String {
fn from(value: PayloadBucketsItemMnemonic) -> Self {
value.0
}
}
impl ::std::str::FromStr for PayloadBucketsItemMnemonic {
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 PayloadBucketsItemMnemonic {
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 PayloadBucketsItemMnemonic {
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 PayloadBucketsItemMnemonic {
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 PayloadBucketsItemMnemonic {
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())
})
}
}
///`PayloadInstanceId`
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PayloadInstanceId(::std::string::String);
impl ::std::ops::Deref for PayloadInstanceId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PayloadInstanceId> for ::std::string::String {
fn from(value: PayloadInstanceId) -> Self {
value.0
}
}
impl ::std::str::FromStr for PayloadInstanceId {
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 PayloadInstanceId {
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 PayloadInstanceId {
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 PayloadInstanceId {
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 PayloadInstanceId {
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())
})
}
}
///`PayloadPerMnemonicItem`
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct PayloadPerMnemonicItem {
pub mnemonic: PayloadPerMnemonicItemMnemonic,
pub resolves: u64,
pub updates: u64,
}
impl PayloadPerMnemonicItem {
pub fn builder() -> builder::PayloadPerMnemonicItem {
Default::default()
}
}
///`PayloadPerMnemonicItemMnemonic`
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PayloadPerMnemonicItemMnemonic(::std::string::String);
impl ::std::ops::Deref for PayloadPerMnemonicItemMnemonic {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PayloadPerMnemonicItemMnemonic> for ::std::string::String {
fn from(value: PayloadPerMnemonicItemMnemonic) -> Self {
value.0
}
}
impl ::std::str::FromStr for PayloadPerMnemonicItemMnemonic {
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 PayloadPerMnemonicItemMnemonic {
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 PayloadPerMnemonicItemMnemonic {
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 PayloadPerMnemonicItemMnemonic {
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 PayloadPerMnemonicItemMnemonic {
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())
})
}
}
///`Response`
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Response {
pub accepted: u64,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
#[serde(rename = "instanceId")]
pub instance_id: ::std::string::String,
}
impl Response {
pub fn builder() -> builder::Response {
Default::default()
}
}
/// Types for composing complex structures.
pub mod builder {
#[derive(Clone, Debug)]
pub struct Payload {
buckets: ::std::result::Result<
::std::vec::Vec<super::PayloadBucketsItem>,
::std::string::String,
>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
instance_id: ::std::result::Result<super::PayloadInstanceId, ::std::string::String>,
per_mnemonic: ::std::result::Result<
::std::vec::Vec<super::PayloadPerMnemonicItem>,
::std::string::String,
>,
}
impl ::std::default::Default for Payload {
fn default() -> Self {
Self {
buckets: Ok(Default::default()),
ext: Ok(Default::default()),
instance_id: Err("no value supplied for instance_id".to_string()),
per_mnemonic: Err("no value supplied for per_mnemonic".to_string()),
}
}
}
impl Payload {
pub fn buckets<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::PayloadBucketsItem>>,
T::Error: ::std::fmt::Display,
{
self.buckets = value
.try_into()
.map_err(|e| format!("error converting supplied value for buckets: {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 instance_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::PayloadInstanceId>,
T::Error: ::std::fmt::Display,
{
self.instance_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for instance_id: {e}"));
self
}
pub fn per_mnemonic<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::PayloadPerMnemonicItem>>,
T::Error: ::std::fmt::Display,
{
self.per_mnemonic = value
.try_into()
.map_err(|e| format!("error converting supplied value for per_mnemonic: {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 {
buckets: value.buckets?,
ext: value.ext?,
instance_id: value.instance_id?,
per_mnemonic: value.per_mnemonic?,
})
}
}
impl ::std::convert::From<super::Payload> for Payload {
fn from(value: super::Payload) -> Self {
Self {
buckets: Ok(value.buckets),
ext: Ok(value.ext),
instance_id: Ok(value.instance_id),
per_mnemonic: Ok(value.per_mnemonic),
}
}
}
#[derive(Clone, Debug)]
pub struct PayloadBucketsItem {
epoch: ::std::result::Result<u64, ::std::string::String>,
mnemonic: ::std::result::Result<super::PayloadBucketsItemMnemonic, ::std::string::String>,
r: ::std::result::Result<u64, ::std::string::String>,
u: ::std::result::Result<u64, ::std::string::String>,
}
impl ::std::default::Default for PayloadBucketsItem {
fn default() -> Self {
Self {
epoch: Err("no value supplied for epoch".to_string()),
mnemonic: Err("no value supplied for mnemonic".to_string()),
r: Err("no value supplied for r".to_string()),
u: Err("no value supplied for u".to_string()),
}
}
}
impl PayloadBucketsItem {
pub fn epoch<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.epoch = value
.try_into()
.map_err(|e| format!("error converting supplied value for epoch: {e}"));
self
}
pub fn mnemonic<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::PayloadBucketsItemMnemonic>,
T::Error: ::std::fmt::Display,
{
self.mnemonic = value
.try_into()
.map_err(|e| format!("error converting supplied value for mnemonic: {e}"));
self
}
pub fn r<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.r = value
.try_into()
.map_err(|e| format!("error converting supplied value for r: {e}"));
self
}
pub fn u<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.u = value
.try_into()
.map_err(|e| format!("error converting supplied value for u: {e}"));
self
}
}
impl ::std::convert::TryFrom<PayloadBucketsItem> for super::PayloadBucketsItem {
type Error = super::error::ConversionError;
fn try_from(
value: PayloadBucketsItem,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
epoch: value.epoch?,
mnemonic: value.mnemonic?,
r: value.r?,
u: value.u?,
})
}
}
impl ::std::convert::From<super::PayloadBucketsItem> for PayloadBucketsItem {
fn from(value: super::PayloadBucketsItem) -> Self {
Self {
epoch: Ok(value.epoch),
mnemonic: Ok(value.mnemonic),
r: Ok(value.r),
u: Ok(value.u),
}
}
}
#[derive(Clone, Debug)]
pub struct PayloadPerMnemonicItem {
mnemonic:
::std::result::Result<super::PayloadPerMnemonicItemMnemonic, ::std::string::String>,
resolves: ::std::result::Result<u64, ::std::string::String>,
updates: ::std::result::Result<u64, ::std::string::String>,
}
impl ::std::default::Default for PayloadPerMnemonicItem {
fn default() -> Self {
Self {
mnemonic: Err("no value supplied for mnemonic".to_string()),
resolves: Err("no value supplied for resolves".to_string()),
updates: Err("no value supplied for updates".to_string()),
}
}
}
impl PayloadPerMnemonicItem {
pub fn mnemonic<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::PayloadPerMnemonicItemMnemonic>,
T::Error: ::std::fmt::Display,
{
self.mnemonic = value
.try_into()
.map_err(|e| format!("error converting supplied value for mnemonic: {e}"));
self
}
pub fn resolves<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.resolves = value
.try_into()
.map_err(|e| format!("error converting supplied value for resolves: {e}"));
self
}
pub fn updates<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.updates = value
.try_into()
.map_err(|e| format!("error converting supplied value for updates: {e}"));
self
}
}
impl ::std::convert::TryFrom<PayloadPerMnemonicItem> for super::PayloadPerMnemonicItem {
type Error = super::error::ConversionError;
fn try_from(
value: PayloadPerMnemonicItem,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
mnemonic: value.mnemonic?,
resolves: value.resolves?,
updates: value.updates?,
})
}
}
impl ::std::convert::From<super::PayloadPerMnemonicItem> for PayloadPerMnemonicItem {
fn from(value: super::PayloadPerMnemonicItem) -> Self {
Self {
mnemonic: Ok(value.mnemonic),
resolves: Ok(value.resolves),
updates: Ok(value.updates),
}
}
}
#[derive(Clone, Debug)]
pub struct Response {
accepted: ::std::result::Result<u64, ::std::string::String>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
instance_id: ::std::result::Result<::std::string::String, ::std::string::String>,
}
impl ::std::default::Default for Response {
fn default() -> Self {
Self {
accepted: Err("no value supplied for accepted".to_string()),
ext: Ok(Default::default()),
instance_id: Err("no value supplied for instance_id".to_string()),
}
}
}
impl Response {
pub fn accepted<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.accepted = value
.try_into()
.map_err(|e| format!("error converting supplied value for accepted: {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 instance_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::string::String>,
T::Error: ::std::fmt::Display,
{
self.instance_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for instance_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 {
accepted: value.accepted?,
ext: value.ext?,
instance_id: value.instance_id?,
})
}
}
impl ::std::convert::From<super::Response> for Response {
fn from(value: super::Response) -> Self {
Self {
accepted: Ok(value.accepted),
ext: Ok(value.ext),
instance_id: Ok(value.instance_id),
}
}
}
}
impl crate::Payload for Payload {
const TYPE_URI: &'static str =
"https://trusttasks.org/spec/did-management/server/stats-sync/0.1";
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\"},\"Response\":{\"$anchor\":\"response\",\"additionalProperties\":false,\"properties\":{\"accepted\":{\"minimum\":0,\"type\":\"integer\"},\"ext\":{\"$ref\":\"#/$defs/Ext\"},\"instanceId\":{\"type\":\"string\"}},\"required\":[\"instanceId\",\"accepted\"],\"title\":\"Server Stats Sync — response payload\",\"type\":\"object\"}},\"$id\":\"https://trusttasks.org/spec/did-management/server/stats-sync/0.1\",\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"additionalProperties\":false,\"properties\":{\"buckets\":{\"items\":{\"additionalProperties\":false,\"properties\":{\"epoch\":{\"minimum\":0,\"type\":\"integer\"},\"mnemonic\":{\"minLength\":1,\"type\":\"string\"},\"r\":{\"minimum\":0,\"type\":\"integer\"},\"u\":{\"minimum\":0,\"type\":\"integer\"}},\"required\":[\"mnemonic\",\"epoch\",\"r\",\"u\"],\"type\":\"object\"},\"type\":\"array\"},\"ext\":{\"$ref\":\"#/$defs/Ext\"},\"instanceId\":{\"minLength\":1,\"type\":\"string\"},\"perMnemonic\":{\"items\":{\"additionalProperties\":false,\"properties\":{\"mnemonic\":{\"minLength\":1,\"type\":\"string\"},\"resolves\":{\"minimum\":0,\"type\":\"integer\"},\"updates\":{\"minimum\":0,\"type\":\"integer\"}},\"required\":[\"mnemonic\",\"resolves\",\"updates\"],\"type\":\"object\"},\"type\":\"array\"}},\"required\":[\"instanceId\",\"perMnemonic\"],\"title\":\"Server Stats Sync — payload\",\"type\":\"object\"}\n",
);
}
impl crate::Payload for Response {
const TYPE_URI: &'static str =
"https://trusttasks.org/spec/did-management/server/stats-sync/0.1#response";
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\"},\"Response\":{\"$anchor\":\"response\",\"additionalProperties\":false,\"properties\":{\"accepted\":{\"minimum\":0,\"type\":\"integer\"},\"ext\":{\"$ref\":\"#/$defs/Ext\"},\"instanceId\":{\"type\":\"string\"}},\"required\":[\"instanceId\",\"accepted\"],\"title\":\"Server Stats Sync — response payload\",\"type\":\"object\"}},\"$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::FORBIDDEN];
/// 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 {
/// `did-management/server/stats-sync:forbidden`
///
/// Caller does not hold the `Service` role on this control plane.
///
/// Declared `retryable: false`.
pub const FORBIDDEN: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "did-management/server/stats-sync:forbidden",
retryable: false,
details_schema: ::core::option::Option::None,
};
}