//! Generated by `trust-tasks-codegen` — do not edit by hand.
//!
//! Spec slug: `persona/profile/compose`. Version: `1.0`.
#[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())
}
}
}
/**
The vocabulary token naming what a value IS — `name.legal`, `phone.mobile`, `address.postal`, `person.birthDate`. Dotted, most-general segment first, so that a consumer with no knowledge of the specific token can still group by its prefix.
The token is the maintainer's own; no external vocabulary is primary. External vocabularies (vCard/jCard, OIDC standard claims, schema.org) are mappings applied at PRESENTATION by a renderer, not at rest, so that a query written in any of them can be matched without the store having to live inside any one of them.
The `x:` prefix is an open extension namespace and is not decoration. The closest prior art — Windows CardSpace's self-issued card — supported exactly fifteen predefined claim types with no extensibility, and that is the specific way it failed the requirement a holder actually has. An `x:` attribute stores, composes, binds and discloses exactly like a known one; it renders generically and matches only an explicit query.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "ClaimType",
/// "description": "\nThe vocabulary token naming what a value IS — `name.legal`, `phone.mobile`, `address.postal`, `person.birthDate`. Dotted, most-general segment first, so that a consumer with no knowledge of the specific token can still group by its prefix.\n\nThe token is the maintainer's own; no external vocabulary is primary. External vocabularies (vCard/jCard, OIDC standard claims, schema.org) are mappings applied at PRESENTATION by a renderer, not at rest, so that a query written in any of them can be matched without the store having to live inside any one of them.\n\nThe `x:` prefix is an open extension namespace and is not decoration. The closest prior art — Windows CardSpace's self-issued card — supported exactly fifteen predefined claim types with no extensibility, and that is the specific way it failed the requirement a holder actually has. An `x:` attribute stores, composes, binds and discloses exactly like a known one; it renders generically and matches only an explicit query.",
/// "type": "string",
/// "maxLength": 128,
/// "minLength": 1,
/// "pattern": "^(x:)?[a-z][a-zA-Z0-9]*(\\.[a-z][a-zA-Z0-9]*)*$"
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ClaimType(::std::string::String);
impl ::std::ops::Deref for ClaimType {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ClaimType> for ::std::string::String {
fn from(value: ClaimType) -> Self {
value.0
}
}
impl ::std::str::FromStr for ClaimType {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 128usize {
return Err("longer than 128 characters".into());
}
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| {
::regress::Regex::new("^(x:)?[a-z][a-zA-Z0-9]*(\\.[a-z][a-zA-Z0-9]*)*$").unwrap()
});
if PATTERN.find(value).is_none() {
return Err(
"doesn't match pattern \"^(x:)?[a-z][a-zA-Z0-9]*(\\.[a-z][a-zA-Z0-9]*)*$\"".into(),
);
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ClaimType {
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 ClaimType {
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 ClaimType {
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 ClaimType {
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())
})
}
}
///One claim of the face being composed: a value typed now, or an attribute the holder already keeps.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "ComposeClaim",
/// "description": "One claim of the face being composed: a value typed now, or an attribute the holder already keeps.",
/// "oneOf": [
/// {
/// "$ref": "#/definitions/NewClaim"
/// },
/// {
/// "$ref": "#/definitions/HeldClaim"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
#[non_exhaustive]
pub enum ComposeClaim {
NewClaim(NewClaim),
HeldClaim(HeldClaim),
}
impl ::std::convert::From<NewClaim> for ComposeClaim {
fn from(value: NewClaim) -> Self {
Self::NewClaim(value)
}
}
impl ::std::convert::From<HeldClaim> for ComposeClaim {
fn from(value: HeldClaim) -> Self {
Self::HeldClaim(value)
}
}
///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())
})
}
}
///An attribute already in the holder's pool, presented live.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "HeldClaim",
/// "description": "An attribute already in the holder's pool, presented live.",
/// "type": "object",
/// "required": [
/// "attributeId"
/// ],
/// "properties": {
/// "attributeId": {
/// "$ref": "#/definitions/Ulid"
/// },
/// "slot": {
/// "$ref": "#/definitions/Slot"
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct HeldClaim {
#[serde(rename = "attributeId")]
pub attribute_id: Ulid,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub slot: ::std::option::Option<Slot>,
}
impl HeldClaim {
pub fn builder() -> builder::HeldClaim {
Default::default()
}
}
///A value the holder types now. Self-asserted: a value typed at this step has no issuer behind it, and a claim that could carry a provenance here would let a typed value present as attested.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "NewClaim",
/// "description": "A value the holder types now. Self-asserted: a value typed at this step has no issuer behind it, and a claim that could carry a provenance here would let a typed value present as attested.",
/// "type": "object",
/// "required": [
/// "type",
/// "value",
/// "valueType"
/// ],
/// "properties": {
/// "label": {
/// "description": "The holder's note to self for this value. Never disclosed.",
/// "type": "string",
/// "maxLength": 128
/// },
/// "share": {
/// "description": "`local` (the default) keeps the value in this face alone: it is carried inline and enters no pool, so no other face can come to present it by accident. `pool` makes it reusable — the maintainer references a self-asserted pool attribute holding exactly this type and value, creating one when none exists.",
/// "default": "local",
/// "type": "string",
/// "enum": [
/// "local",
/// "pool"
/// ]
/// },
/// "slot": {
/// "$ref": "#/definitions/Slot"
/// },
/// "type": {
/// "$ref": "#/definitions/ClaimType"
/// },
/// "value": {},
/// "valueType": {
/// "$ref": "#/definitions/ValueType"
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct NewClaim {
///The holder's note to self for this value. Never disclosed.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub label: ::std::option::Option<NewClaimLabel>,
///`local` (the default) keeps the value in this face alone: it is carried inline and enters no pool, so no other face can come to present it by accident. `pool` makes it reusable — the maintainer references a self-asserted pool attribute holding exactly this type and value, creating one when none exists.
#[serde(default = "defaults::new_claim_share")]
pub share: NewClaimShare,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub slot: ::std::option::Option<Slot>,
#[serde(rename = "type")]
pub type_: ClaimType,
pub value: ::serde_json::Value,
#[serde(rename = "valueType")]
pub value_type: ValueType,
}
impl NewClaim {
pub fn builder() -> builder::NewClaim {
Default::default()
}
}
///The holder's note to self for this value. Never disclosed.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The holder's note to self for this value. Never disclosed.",
/// "type": "string",
/// "maxLength": 128
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct NewClaimLabel(::std::string::String);
impl ::std::ops::Deref for NewClaimLabel {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<NewClaimLabel> for ::std::string::String {
fn from(value: NewClaimLabel) -> Self {
value.0
}
}
impl ::std::str::FromStr for NewClaimLabel {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 128usize {
return Err("longer than 128 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for NewClaimLabel {
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 NewClaimLabel {
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 NewClaimLabel {
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 NewClaimLabel {
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())
})
}
}
///`local` (the default) keeps the value in this face alone: it is carried inline and enters no pool, so no other face can come to present it by accident. `pool` makes it reusable — the maintainer references a self-asserted pool attribute holding exactly this type and value, creating one when none exists.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "`local` (the default) keeps the value in this face alone: it is carried inline and enters no pool, so no other face can come to present it by accident. `pool` makes it reusable — the maintainer references a self-asserted pool attribute holding exactly this type and value, creating one when none exists.",
/// "default": "local",
/// "type": "string",
/// "enum": [
/// "local",
/// "pool"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum NewClaimShare {
#[serde(rename = "local")]
Local,
#[serde(rename = "pool")]
Pool,
}
impl ::std::fmt::Display for NewClaimShare {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Local => f.write_str("local"),
Self::Pool => f.write_str("pool"),
}
}
}
impl ::std::str::FromStr for NewClaimShare {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"local" => Ok(Self::Local),
"pool" => Ok(Self::Pool),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for NewClaimShare {
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 NewClaimShare {
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 NewClaimShare {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::default::Default for NewClaimShare {
fn default() -> Self {
NewClaimShare::Local
}
}
///Compose a face for one context, where it is needed, from values typed now and attributes already held — and optionally wear it there in the same act. Local by default: a value typed here stays in this context unless the holder says it should be reusable. Where the face lives follows from what it carries, so there is no scope parameter to get wrong.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "$id": "https://trusttasks.org/spec/persona/profile/compose/1.0",
/// "title": "Payload",
/// "description": "Compose a face for one context, where it is needed, from values typed now and attributes already held — and optionally wear it there in the same act. Local by default: a value typed here stays in this context unless the holder says it should be reusable. Where the face lives follows from what it carries, so there is no scope parameter to get wrong.",
/// "type": "object",
/// "required": [
/// "claims",
/// "contextId",
/// "name"
/// ],
/// "properties": {
/// "claims": {
/// "description": "Ordered; the order is display order.",
/// "type": "array",
/// "items": {
/// "$ref": "#/definitions/ComposeClaim"
/// },
/// "maxItems": 64,
/// "minItems": 1
/// },
/// "contextId": {
/// "description": "The context the face is composed for. A face whose every claim is local lives in this context and nowhere else; a face carrying any pool claim lives above contexts, and is bound into this one when `personaDid` is given.",
/// "type": "string",
/// "minLength": 1
/// },
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "label": {
/// "description": "What the context may call the face, as on persona/binding/set. Meaningful only when the face is worn (`personaDid` or `wear`); a maintainer MUST refuse it otherwise rather than drop it.",
/// "type": "string",
/// "maxLength": 128,
/// "minLength": 1
/// },
/// "name": {
/// "description": "The holder's name for the face. Never disclosed; what a context may call the face is `label`.",
/// "type": "string",
/// "maxLength": 128,
/// "minLength": 1
/// },
/// "personaDid": {
/// "description": "Wear the new face as this persona in `contextId`, in the same act. Omit to compose without wearing it.",
/// "type": "string",
/// "maxLength": 2048,
/// "minLength": 1
/// },
/// "until": {
/// "description": "When wearing the face here ends on its own, as persona/binding/set `until`: at it the binding clears and the face, if worn nowhere else, is retired — never deleted. For the face composed at the door of a conference or a listing, which is where a throwaway face is usually made. Meaningful only when the face is worn (`personaDid` or `wear`), and refused otherwise or in the past (`untilNotFuture`).",
/// "type": "string",
/// "format": "date-time"
/// },
/// "wear": {
/// "description": "Wear the new face in `contextId` as the persona the holder already uses in `contextId` — the one DID with a binding there, current or cleared. None is refused (`noPersonaHere`): a persona is minted on its own, through the DID-template path, never as a side effect of wearing a face. Several are refused (`personaAmbiguous`, naming them): picking one for the holder would decide which of their identities a context sees. Not with `personaDid`, which names the persona instead.",
/// "default": false,
/// "type": "boolean"
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Payload {
///Ordered; the order is display order.
pub claims: ::std::vec::Vec<ComposeClaim>,
///The context the face is composed for. A face whose every claim is local lives in this context and nowhere else; a face carrying any pool claim lives above contexts, and is bound into this one when `personaDid` is given.
#[serde(rename = "contextId")]
pub context_id: PayloadContextId,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
///What the context may call the face, as on persona/binding/set. Meaningful only when the face is worn (`personaDid` or `wear`); a maintainer MUST refuse it otherwise rather than drop it.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub label: ::std::option::Option<PayloadLabel>,
///The holder's name for the face. Never disclosed; what a context may call the face is `label`.
pub name: PayloadName,
///Wear the new face as this persona in `contextId`, in the same act. Omit to compose without wearing it.
#[serde(
rename = "personaDid",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub persona_did: ::std::option::Option<PayloadPersonaDid>,
///When wearing the face here ends on its own, as persona/binding/set `until`: at it the binding clears and the face, if worn nowhere else, is retired — never deleted. For the face composed at the door of a conference or a listing, which is where a throwaway face is usually made. Meaningful only when the face is worn (`personaDid` or `wear`), and refused otherwise or in the past (`untilNotFuture`).
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub until: ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
///Wear the new face in `contextId` as the persona the holder already uses in `contextId` — the one DID with a binding there, current or cleared. None is refused (`noPersonaHere`): a persona is minted on its own, through the DID-template path, never as a side effect of wearing a face. Several are refused (`personaAmbiguous`, naming them): picking one for the holder would decide which of their identities a context sees. Not with `personaDid`, which names the persona instead.
#[serde(default)]
pub wear: bool,
}
impl Payload {
pub fn builder() -> builder::Payload {
Default::default()
}
}
///The context the face is composed for. A face whose every claim is local lives in this context and nowhere else; a face carrying any pool claim lives above contexts, and is bound into this one when `personaDid` is given.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The context the face is composed for. A face whose every claim is local lives in this context and nowhere else; a face carrying any pool claim lives above contexts, and is bound into this one when `personaDid` is given.",
/// "type": "string",
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PayloadContextId(::std::string::String);
impl ::std::ops::Deref for PayloadContextId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PayloadContextId> for ::std::string::String {
fn from(value: PayloadContextId) -> Self {
value.0
}
}
impl ::std::str::FromStr for PayloadContextId {
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 PayloadContextId {
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 PayloadContextId {
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 PayloadContextId {
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 PayloadContextId {
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())
})
}
}
///What the context may call the face, as on persona/binding/set. Meaningful only when the face is worn (`personaDid` or `wear`); a maintainer MUST refuse it otherwise rather than drop it.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "What the context may call the face, as on persona/binding/set. Meaningful only when the face is worn (`personaDid` or `wear`); a maintainer MUST refuse it otherwise rather than drop it.",
/// "type": "string",
/// "maxLength": 128,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PayloadLabel(::std::string::String);
impl ::std::ops::Deref for PayloadLabel {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PayloadLabel> for ::std::string::String {
fn from(value: PayloadLabel) -> Self {
value.0
}
}
impl ::std::str::FromStr for PayloadLabel {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 128usize {
return Err("longer than 128 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 PayloadLabel {
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 PayloadLabel {
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 PayloadLabel {
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 PayloadLabel {
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 holder's name for the face. Never disclosed; what a context may call the face is `label`.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The holder's name for the face. Never disclosed; what a context may call the face is `label`.",
/// "type": "string",
/// "maxLength": 128,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PayloadName(::std::string::String);
impl ::std::ops::Deref for PayloadName {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PayloadName> for ::std::string::String {
fn from(value: PayloadName) -> Self {
value.0
}
}
impl ::std::str::FromStr for PayloadName {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 128usize {
return Err("longer than 128 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 PayloadName {
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 PayloadName {
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 PayloadName {
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 PayloadName {
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())
})
}
}
///Wear the new face as this persona in `contextId`, in the same act. Omit to compose without wearing it.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Wear the new face as this persona in `contextId`, in the same act. Omit to compose without wearing it.",
/// "type": "string",
/// "maxLength": 2048,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PayloadPersonaDid(::std::string::String);
impl ::std::ops::Deref for PayloadPersonaDid {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PayloadPersonaDid> for ::std::string::String {
fn from(value: PayloadPersonaDid) -> Self {
value.0
}
}
impl ::std::str::FromStr for PayloadPersonaDid {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 2048usize {
return Err("longer than 2048 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 PayloadPersonaDid {
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 PayloadPersonaDid {
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 PayloadPersonaDid {
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 PayloadPersonaDid {
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())
})
}
}
///Success response to persona/profile/compose. Type https://trusttasks.org/spec/persona/profile/compose/1.0#response.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Response",
/// "description": "Success response to persona/profile/compose. Type https://trusttasks.org/spec/persona/profile/compose/1.0#response.",
/// "type": "object",
/// "required": [
/// "profileId",
/// "scope",
/// "version"
/// ],
/// "properties": {
/// "binding": {
/// "description": "Present when `personaDid` was given: the face is now worn there.",
/// "type": "object",
/// "required": [
/// "personaDid",
/// "version"
/// ],
/// "properties": {
/// "alsoBoundPersonaCount": {
/// "description": "How many other personas in this context wear this face. Always zero for a face this task just created; present for parity with persona/binding/set.",
/// "type": "integer",
/// "minimum": 0.0
/// },
/// "personaDid": {
/// "type": "string",
/// "minLength": 1
/// },
/// "version": {
/// "$ref": "#/definitions/Version"
/// }
/// },
/// "additionalProperties": false
/// },
/// "correlation": {
/// "description": "Advisory, as on persona/profile/put: how many of the face's claims present a value another face also presents. A count; identifiers come from persona/correlation/analyze. The write has applied.",
/// "type": "object",
/// "required": [
/// "severity"
/// ],
/// "properties": {
/// "severity": {
/// "type": "string",
/// "enum": [
/// "none",
/// "low",
/// "high"
/// ]
/// },
/// "sharedAttributeCount": {
/// "type": "integer",
/// "minimum": 0.0
/// }
/// },
/// "additionalProperties": false
/// },
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "pooled": {
/// "description": "For each `share: pool` claim, in request order, the pool attribute the face now references and whether this compose created it. `created: false` means the holder already kept exactly this value, and the face now shares it with whatever else presents it. Absent when no claim was pooled.",
/// "type": "array",
/// "items": {
/// "type": "object",
/// "required": [
/// "attributeId",
/// "created"
/// ],
/// "properties": {
/// "attributeId": {
/// "$ref": "#/definitions/Ulid"
/// },
/// "created": {
/// "type": "boolean"
/// }
/// },
/// "additionalProperties": false
/// },
/// "maxItems": 64
/// },
/// "profileId": {
/// "$ref": "#/definitions/Ulid"
/// },
/// "scope": {
/// "description": "Where the face lives. `local`: in `contextId` only, readable through persona/local/profile/get. `pool`: above contexts, readable through persona/profile/get, and able to be worn in other contexts later.",
/// "type": "string",
/// "enum": [
/// "local",
/// "pool"
/// ]
/// },
/// "version": {
/// "$ref": "#/definitions/Version"
/// }
/// },
/// "additionalProperties": false,
/// "$anchor": "response"
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Response {
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub binding: ::std::option::Option<ResponseBinding>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub correlation: ::std::option::Option<ResponseCorrelation>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
///For each `share: pool` claim, in request order, the pool attribute the face now references and whether this compose created it. `created: false` means the holder already kept exactly this value, and the face now shares it with whatever else presents it. Absent when no claim was pooled.
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub pooled: ::std::vec::Vec<ResponsePooledItem>,
#[serde(rename = "profileId")]
pub profile_id: Ulid,
///Where the face lives. `local`: in `contextId` only, readable through persona/local/profile/get. `pool`: above contexts, readable through persona/profile/get, and able to be worn in other contexts later.
pub scope: ResponseScope,
pub version: Version,
}
impl Response {
pub fn builder() -> builder::Response {
Default::default()
}
}
///Present when `personaDid` was given: the face is now worn there.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Present when `personaDid` was given: the face is now worn there.",
/// "type": "object",
/// "required": [
/// "personaDid",
/// "version"
/// ],
/// "properties": {
/// "alsoBoundPersonaCount": {
/// "description": "How many other personas in this context wear this face. Always zero for a face this task just created; present for parity with persona/binding/set.",
/// "type": "integer",
/// "minimum": 0.0
/// },
/// "personaDid": {
/// "type": "string",
/// "minLength": 1
/// },
/// "version": {
/// "$ref": "#/definitions/Version"
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ResponseBinding {
///How many other personas in this context wear this face. Always zero for a face this task just created; present for parity with persona/binding/set.
#[serde(
rename = "alsoBoundPersonaCount",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub also_bound_persona_count: ::std::option::Option<u64>,
#[serde(rename = "personaDid")]
pub persona_did: ResponseBindingPersonaDid,
pub version: Version,
}
impl ResponseBinding {
pub fn builder() -> builder::ResponseBinding {
Default::default()
}
}
///`ResponseBindingPersonaDid`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "string",
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ResponseBindingPersonaDid(::std::string::String);
impl ::std::ops::Deref for ResponseBindingPersonaDid {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ResponseBindingPersonaDid> for ::std::string::String {
fn from(value: ResponseBindingPersonaDid) -> Self {
value.0
}
}
impl ::std::str::FromStr for ResponseBindingPersonaDid {
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 ResponseBindingPersonaDid {
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 ResponseBindingPersonaDid {
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 ResponseBindingPersonaDid {
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 ResponseBindingPersonaDid {
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())
})
}
}
///Advisory, as on persona/profile/put: how many of the face's claims present a value another face also presents. A count; identifiers come from persona/correlation/analyze. The write has applied.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Advisory, as on persona/profile/put: how many of the face's claims present a value another face also presents. A count; identifiers come from persona/correlation/analyze. The write has applied.",
/// "type": "object",
/// "required": [
/// "severity"
/// ],
/// "properties": {
/// "severity": {
/// "type": "string",
/// "enum": [
/// "none",
/// "low",
/// "high"
/// ]
/// },
/// "sharedAttributeCount": {
/// "type": "integer",
/// "minimum": 0.0
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ResponseCorrelation {
pub severity: ResponseCorrelationSeverity,
#[serde(
rename = "sharedAttributeCount",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub shared_attribute_count: ::std::option::Option<u64>,
}
impl ResponseCorrelation {
pub fn builder() -> builder::ResponseCorrelation {
Default::default()
}
}
///`ResponseCorrelationSeverity`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "string",
/// "enum": [
/// "none",
/// "low",
/// "high"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum ResponseCorrelationSeverity {
#[serde(rename = "none")]
None,
#[serde(rename = "low")]
Low,
#[serde(rename = "high")]
High,
}
impl ::std::fmt::Display for ResponseCorrelationSeverity {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::None => f.write_str("none"),
Self::Low => f.write_str("low"),
Self::High => f.write_str("high"),
}
}
}
impl ::std::str::FromStr for ResponseCorrelationSeverity {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"none" => Ok(Self::None),
"low" => Ok(Self::Low),
"high" => Ok(Self::High),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for ResponseCorrelationSeverity {
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 ResponseCorrelationSeverity {
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 ResponseCorrelationSeverity {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///`ResponsePooledItem`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "attributeId",
/// "created"
/// ],
/// "properties": {
/// "attributeId": {
/// "$ref": "#/definitions/Ulid"
/// },
/// "created": {
/// "type": "boolean"
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ResponsePooledItem {
#[serde(rename = "attributeId")]
pub attribute_id: Ulid,
pub created: bool,
}
impl ResponsePooledItem {
pub fn builder() -> builder::ResponsePooledItem {
Default::default()
}
}
///Where the face lives. `local`: in `contextId` only, readable through persona/local/profile/get. `pool`: above contexts, readable through persona/profile/get, and able to be worn in other contexts later.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Where the face lives. `local`: in `contextId` only, readable through persona/local/profile/get. `pool`: above contexts, readable through persona/profile/get, and able to be worn in other contexts later.",
/// "type": "string",
/// "enum": [
/// "local",
/// "pool"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum ResponseScope {
#[serde(rename = "local")]
Local,
#[serde(rename = "pool")]
Pool,
}
impl ::std::fmt::Display for ResponseScope {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Local => f.write_str("local"),
Self::Pool => f.write_str("pool"),
}
}
}
impl ::std::str::FromStr for ResponseScope {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"local" => Ok(Self::Local),
"pool" => Ok(Self::Pool),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for ResponseScope {
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 ResponseScope {
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 ResponseScope {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
/**
A role a profile entry plays within its profile, so a consumer can find it without guessing from its claim type. A profile MAY hold several entries of one type — a legal name and a display name, two phone numbers — and only a slot says which answers a given question. Unique within a profile.
Well-known slots:
- `displayName` — what this face calls itself. The entry a consumer renders as the face's name to anyone it is shown to. Distinct from the profile's own `name`, which is the holder's private label and never disclosed.
- `primaryEmail`, `primaryPhone`, `primaryAddress` — the entry to use where a counterparty asks for one of a kind and the profile holds several.
- `avatar` — the image this face presents.
Other values are the holder's or the producer's own and carry no meaning a maintainer interprets.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Slot",
/// "description": "\nA role a profile entry plays within its profile, so a consumer can find it without guessing from its claim type. A profile MAY hold several entries of one type — a legal name and a display name, two phone numbers — and only a slot says which answers a given question. Unique within a profile.\n\nWell-known slots:\n\n- `displayName` — what this face calls itself. The entry a consumer renders as the face's name to anyone it is shown to. Distinct from the profile's own `name`, which is the holder's private label and never disclosed.\n- `primaryEmail`, `primaryPhone`, `primaryAddress` — the entry to use where a counterparty asks for one of a kind and the profile holds several.\n- `avatar` — the image this face presents.\n\nOther values are the holder's or the producer's own and carry no meaning a maintainer interprets.",
/// "type": "string",
/// "pattern": "^[a-z][A-Za-z0-9]{0,31}$"
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct Slot(::std::string::String);
impl ::std::ops::Deref for Slot {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<Slot> for ::std::string::String {
fn from(value: Slot) -> Self {
value.0
}
}
impl ::std::str::FromStr for Slot {
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-Za-z0-9]{0,31}$").unwrap()
});
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^[a-z][A-Za-z0-9]{0,31}$\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for Slot {
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 Slot {
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 Slot {
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 Slot {
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())
})
}
}
///A ULID in Crockford base32, uppercase. Used for `attributeId` and `profileId`. Chosen over a UUID because the leading 48 bits are a timestamp, so a key-ordered scan of the store is also creation-ordered and a `list` needs no secondary sort. Server-assigned on create; a producer MAY supply one to make a create idempotent, and a maintainer MUST reject a supplied value that already exists rather than silently overwriting.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Ulid",
/// "description": "A ULID in Crockford base32, uppercase. Used for `attributeId` and `profileId`. Chosen over a UUID because the leading 48 bits are a timestamp, so a key-ordered scan of the store is also creation-ordered and a `list` needs no secondary sort. Server-assigned on create; a producer MAY supply one to make a create idempotent, and a maintainer MUST reject a supplied value that already exists rather than silently overwriting.",
/// "type": "string",
/// "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct Ulid(::std::string::String);
impl ::std::ops::Deref for Ulid {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<Ulid> for ::std::string::String {
fn from(value: Ulid) -> Self {
value.0
}
}
impl ::std::str::FromStr for Ulid {
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("^[0-9A-HJKMNP-TV-Z]{26}$").unwrap()
});
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^[0-9A-HJKMNP-TV-Z]{26}$\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for Ulid {
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 Ulid {
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 Ulid {
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 Ulid {
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 JSON shape of `value`, declared so that a consumer can render and compare without guessing. The maintainer validates that `value` agrees with this member and does nothing further: it does NOT validate a phone number against a phone-number grammar. That is a producer's affordance, and a store that grows opinions about the contents of its records eventually blocks its consumer's release.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "ValueType",
/// "description": "The JSON shape of `value`, declared so that a consumer can render and compare without guessing. The maintainer validates that `value` agrees with this member and does nothing further: it does NOT validate a phone number against a phone-number grammar. That is a producer's affordance, and a store that grows opinions about the contents of its records eventually blocks its consumer's release.",
/// "type": "string",
/// "enum": [
/// "string",
/// "number",
/// "boolean",
/// "date",
/// "object"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum ValueType {
#[serde(rename = "string")]
String,
#[serde(rename = "number")]
Number,
#[serde(rename = "boolean")]
Boolean,
#[serde(rename = "date")]
Date,
#[serde(rename = "object")]
Object,
}
impl ::std::fmt::Display for ValueType {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::String => f.write_str("string"),
Self::Number => f.write_str("number"),
Self::Boolean => f.write_str("boolean"),
Self::Date => f.write_str("date"),
Self::Object => f.write_str("object"),
}
}
}
impl ::std::str::FromStr for ValueType {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"string" => Ok(Self::String),
"number" => Ok(Self::Number),
"boolean" => Ok(Self::Boolean),
"date" => Ok(Self::Date),
"object" => Ok(Self::Object),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for ValueType {
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 ValueType {
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 ValueType {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///A value of the store's monotonic write counter. Server-assigned; a producer never chooses one.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Version",
/// "description": "A value of the store's monotonic write counter. Server-assigned; a producer never chooses one.",
/// "type": "integer",
/// "minimum": 1.0
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(transparent)]
pub struct Version(pub ::std::num::NonZeroU64);
impl ::std::ops::Deref for Version {
type Target = ::std::num::NonZeroU64;
fn deref(&self) -> &::std::num::NonZeroU64 {
&self.0
}
}
impl ::std::convert::From<Version> for ::std::num::NonZeroU64 {
fn from(value: Version) -> Self {
value.0
}
}
impl ::std::convert::From<::std::num::NonZeroU64> for Version {
fn from(value: ::std::num::NonZeroU64) -> Self {
Self(value)
}
}
impl ::std::str::FromStr for Version {
type Err = <::std::num::NonZeroU64 as ::std::str::FromStr>::Err;
fn from_str(value: &str) -> ::std::result::Result<Self, Self::Err> {
Ok(Self(value.parse()?))
}
}
impl ::std::convert::TryFrom<&str> for Version {
type Error = <::std::num::NonZeroU64 as ::std::str::FromStr>::Err;
fn try_from(value: &str) -> ::std::result::Result<Self, Self::Error> {
value.parse()
}
}
impl ::std::convert::TryFrom<String> for Version {
type Error = <::std::num::NonZeroU64 as ::std::str::FromStr>::Err;
fn try_from(value: String) -> ::std::result::Result<Self, Self::Error> {
value.parse()
}
}
impl ::std::fmt::Display for Version {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
self.0.fmt(f)
}
}
/// Types for composing complex structures.
pub mod builder {
#[derive(Clone, Debug)]
pub struct HeldClaim {
attribute_id: ::std::result::Result<super::Ulid, ::std::string::String>,
slot: ::std::result::Result<::std::option::Option<super::Slot>, ::std::string::String>,
}
impl ::std::default::Default for HeldClaim {
fn default() -> Self {
Self {
attribute_id: Err("no value supplied for attribute_id".to_string()),
slot: Ok(Default::default()),
}
}
}
impl HeldClaim {
pub fn attribute_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::Ulid>,
T::Error: ::std::fmt::Display,
{
self.attribute_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for attribute_id: {e}"));
self
}
pub fn slot<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::Slot>>,
T::Error: ::std::fmt::Display,
{
self.slot = value
.try_into()
.map_err(|e| format!("error converting supplied value for slot: {e}"));
self
}
}
impl ::std::convert::TryFrom<HeldClaim> for super::HeldClaim {
type Error = super::error::ConversionError;
fn try_from(
value: HeldClaim,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
attribute_id: value.attribute_id?,
slot: value.slot?,
})
}
}
impl ::std::convert::From<super::HeldClaim> for HeldClaim {
fn from(value: super::HeldClaim) -> Self {
Self {
attribute_id: Ok(value.attribute_id),
slot: Ok(value.slot),
}
}
}
#[derive(Clone, Debug)]
pub struct NewClaim {
label: ::std::result::Result<
::std::option::Option<super::NewClaimLabel>,
::std::string::String,
>,
share: ::std::result::Result<super::NewClaimShare, ::std::string::String>,
slot: ::std::result::Result<::std::option::Option<super::Slot>, ::std::string::String>,
type_: ::std::result::Result<super::ClaimType, ::std::string::String>,
value: ::std::result::Result<::serde_json::Value, ::std::string::String>,
value_type: ::std::result::Result<super::ValueType, ::std::string::String>,
}
impl ::std::default::Default for NewClaim {
fn default() -> Self {
Self {
label: Ok(Default::default()),
share: Ok(super::defaults::new_claim_share()),
slot: Ok(Default::default()),
type_: Err("no value supplied for type_".to_string()),
value: Err("no value supplied for value".to_string()),
value_type: Err("no value supplied for value_type".to_string()),
}
}
}
impl NewClaim {
pub fn label<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::NewClaimLabel>>,
T::Error: ::std::fmt::Display,
{
self.label = value
.try_into()
.map_err(|e| format!("error converting supplied value for label: {e}"));
self
}
pub fn share<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::NewClaimShare>,
T::Error: ::std::fmt::Display,
{
self.share = value
.try_into()
.map_err(|e| format!("error converting supplied value for share: {e}"));
self
}
pub fn slot<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::Slot>>,
T::Error: ::std::fmt::Display,
{
self.slot = value
.try_into()
.map_err(|e| format!("error converting supplied value for slot: {e}"));
self
}
pub fn type_<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ClaimType>,
T::Error: ::std::fmt::Display,
{
self.type_ = value
.try_into()
.map_err(|e| format!("error converting supplied value for type_: {e}"));
self
}
pub fn value<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::serde_json::Value>,
T::Error: ::std::fmt::Display,
{
self.value = value
.try_into()
.map_err(|e| format!("error converting supplied value for value: {e}"));
self
}
pub fn value_type<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ValueType>,
T::Error: ::std::fmt::Display,
{
self.value_type = value
.try_into()
.map_err(|e| format!("error converting supplied value for value_type: {e}"));
self
}
}
impl ::std::convert::TryFrom<NewClaim> for super::NewClaim {
type Error = super::error::ConversionError;
fn try_from(value: NewClaim) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
label: value.label?,
share: value.share?,
slot: value.slot?,
type_: value.type_?,
value: value.value?,
value_type: value.value_type?,
})
}
}
impl ::std::convert::From<super::NewClaim> for NewClaim {
fn from(value: super::NewClaim) -> Self {
Self {
label: Ok(value.label),
share: Ok(value.share),
slot: Ok(value.slot),
type_: Ok(value.type_),
value: Ok(value.value),
value_type: Ok(value.value_type),
}
}
}
#[derive(Clone, Debug)]
pub struct Payload {
claims: ::std::result::Result<::std::vec::Vec<super::ComposeClaim>, ::std::string::String>,
context_id: ::std::result::Result<super::PayloadContextId, ::std::string::String>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
label: ::std::result::Result<
::std::option::Option<super::PayloadLabel>,
::std::string::String,
>,
name: ::std::result::Result<super::PayloadName, ::std::string::String>,
persona_did: ::std::result::Result<
::std::option::Option<super::PayloadPersonaDid>,
::std::string::String,
>,
until: ::std::result::Result<
::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
::std::string::String,
>,
wear: ::std::result::Result<bool, ::std::string::String>,
}
impl ::std::default::Default for Payload {
fn default() -> Self {
Self {
claims: Err("no value supplied for claims".to_string()),
context_id: Err("no value supplied for context_id".to_string()),
ext: Ok(Default::default()),
label: Ok(Default::default()),
name: Err("no value supplied for name".to_string()),
persona_did: Ok(Default::default()),
until: Ok(Default::default()),
wear: Ok(Default::default()),
}
}
}
impl Payload {
pub fn claims<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::ComposeClaim>>,
T::Error: ::std::fmt::Display,
{
self.claims = value
.try_into()
.map_err(|e| format!("error converting supplied value for claims: {e}"));
self
}
pub fn context_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::PayloadContextId>,
T::Error: ::std::fmt::Display,
{
self.context_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for context_id: {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 label<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PayloadLabel>>,
T::Error: ::std::fmt::Display,
{
self.label = value
.try_into()
.map_err(|e| format!("error converting supplied value for label: {e}"));
self
}
pub fn name<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::PayloadName>,
T::Error: ::std::fmt::Display,
{
self.name = value
.try_into()
.map_err(|e| format!("error converting supplied value for name: {e}"));
self
}
pub fn persona_did<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PayloadPersonaDid>>,
T::Error: ::std::fmt::Display,
{
self.persona_did = value
.try_into()
.map_err(|e| format!("error converting supplied value for persona_did: {e}"));
self
}
pub fn until<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.until = value
.try_into()
.map_err(|e| format!("error converting supplied value for until: {e}"));
self
}
pub fn wear<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<bool>,
T::Error: ::std::fmt::Display,
{
self.wear = value
.try_into()
.map_err(|e| format!("error converting supplied value for wear: {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 {
claims: value.claims?,
context_id: value.context_id?,
ext: value.ext?,
label: value.label?,
name: value.name?,
persona_did: value.persona_did?,
until: value.until?,
wear: value.wear?,
})
}
}
impl ::std::convert::From<super::Payload> for Payload {
fn from(value: super::Payload) -> Self {
Self {
claims: Ok(value.claims),
context_id: Ok(value.context_id),
ext: Ok(value.ext),
label: Ok(value.label),
name: Ok(value.name),
persona_did: Ok(value.persona_did),
until: Ok(value.until),
wear: Ok(value.wear),
}
}
}
#[derive(Clone, Debug)]
pub struct Response {
binding: ::std::result::Result<
::std::option::Option<super::ResponseBinding>,
::std::string::String,
>,
correlation: ::std::result::Result<
::std::option::Option<super::ResponseCorrelation>,
::std::string::String,
>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
pooled: ::std::result::Result<
::std::vec::Vec<super::ResponsePooledItem>,
::std::string::String,
>,
profile_id: ::std::result::Result<super::Ulid, ::std::string::String>,
scope: ::std::result::Result<super::ResponseScope, ::std::string::String>,
version: ::std::result::Result<super::Version, ::std::string::String>,
}
impl ::std::default::Default for Response {
fn default() -> Self {
Self {
binding: Ok(Default::default()),
correlation: Ok(Default::default()),
ext: Ok(Default::default()),
pooled: Ok(Default::default()),
profile_id: Err("no value supplied for profile_id".to_string()),
scope: Err("no value supplied for scope".to_string()),
version: Err("no value supplied for version".to_string()),
}
}
}
impl Response {
pub fn binding<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::ResponseBinding>>,
T::Error: ::std::fmt::Display,
{
self.binding = value
.try_into()
.map_err(|e| format!("error converting supplied value for binding: {e}"));
self
}
pub fn correlation<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::ResponseCorrelation>>,
T::Error: ::std::fmt::Display,
{
self.correlation = value
.try_into()
.map_err(|e| format!("error converting supplied value for correlation: {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 pooled<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::ResponsePooledItem>>,
T::Error: ::std::fmt::Display,
{
self.pooled = value
.try_into()
.map_err(|e| format!("error converting supplied value for pooled: {e}"));
self
}
pub fn profile_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::Ulid>,
T::Error: ::std::fmt::Display,
{
self.profile_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for profile_id: {e}"));
self
}
pub fn scope<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ResponseScope>,
T::Error: ::std::fmt::Display,
{
self.scope = value
.try_into()
.map_err(|e| format!("error converting supplied value for scope: {e}"));
self
}
pub fn version<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::Version>,
T::Error: ::std::fmt::Display,
{
self.version = value
.try_into()
.map_err(|e| format!("error converting supplied value for version: {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 {
binding: value.binding?,
correlation: value.correlation?,
ext: value.ext?,
pooled: value.pooled?,
profile_id: value.profile_id?,
scope: value.scope?,
version: value.version?,
})
}
}
impl ::std::convert::From<super::Response> for Response {
fn from(value: super::Response) -> Self {
Self {
binding: Ok(value.binding),
correlation: Ok(value.correlation),
ext: Ok(value.ext),
pooled: Ok(value.pooled),
profile_id: Ok(value.profile_id),
scope: Ok(value.scope),
version: Ok(value.version),
}
}
}
#[derive(Clone, Debug)]
pub struct ResponseBinding {
also_bound_persona_count:
::std::result::Result<::std::option::Option<u64>, ::std::string::String>,
persona_did: ::std::result::Result<super::ResponseBindingPersonaDid, ::std::string::String>,
version: ::std::result::Result<super::Version, ::std::string::String>,
}
impl ::std::default::Default for ResponseBinding {
fn default() -> Self {
Self {
also_bound_persona_count: Ok(Default::default()),
persona_did: Err("no value supplied for persona_did".to_string()),
version: Err("no value supplied for version".to_string()),
}
}
}
impl ResponseBinding {
pub fn also_bound_persona_count<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<u64>>,
T::Error: ::std::fmt::Display,
{
self.also_bound_persona_count = value.try_into().map_err(|e| {
format!("error converting supplied value for also_bound_persona_count: {e}")
});
self
}
pub fn persona_did<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ResponseBindingPersonaDid>,
T::Error: ::std::fmt::Display,
{
self.persona_did = value
.try_into()
.map_err(|e| format!("error converting supplied value for persona_did: {e}"));
self
}
pub fn version<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::Version>,
T::Error: ::std::fmt::Display,
{
self.version = value
.try_into()
.map_err(|e| format!("error converting supplied value for version: {e}"));
self
}
}
impl ::std::convert::TryFrom<ResponseBinding> for super::ResponseBinding {
type Error = super::error::ConversionError;
fn try_from(
value: ResponseBinding,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
also_bound_persona_count: value.also_bound_persona_count?,
persona_did: value.persona_did?,
version: value.version?,
})
}
}
impl ::std::convert::From<super::ResponseBinding> for ResponseBinding {
fn from(value: super::ResponseBinding) -> Self {
Self {
also_bound_persona_count: Ok(value.also_bound_persona_count),
persona_did: Ok(value.persona_did),
version: Ok(value.version),
}
}
}
#[derive(Clone, Debug)]
pub struct ResponseCorrelation {
severity: ::std::result::Result<super::ResponseCorrelationSeverity, ::std::string::String>,
shared_attribute_count:
::std::result::Result<::std::option::Option<u64>, ::std::string::String>,
}
impl ::std::default::Default for ResponseCorrelation {
fn default() -> Self {
Self {
severity: Err("no value supplied for severity".to_string()),
shared_attribute_count: Ok(Default::default()),
}
}
}
impl ResponseCorrelation {
pub fn severity<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ResponseCorrelationSeverity>,
T::Error: ::std::fmt::Display,
{
self.severity = value
.try_into()
.map_err(|e| format!("error converting supplied value for severity: {e}"));
self
}
pub fn shared_attribute_count<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<u64>>,
T::Error: ::std::fmt::Display,
{
self.shared_attribute_count = value.try_into().map_err(|e| {
format!("error converting supplied value for shared_attribute_count: {e}")
});
self
}
}
impl ::std::convert::TryFrom<ResponseCorrelation> for super::ResponseCorrelation {
type Error = super::error::ConversionError;
fn try_from(
value: ResponseCorrelation,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
severity: value.severity?,
shared_attribute_count: value.shared_attribute_count?,
})
}
}
impl ::std::convert::From<super::ResponseCorrelation> for ResponseCorrelation {
fn from(value: super::ResponseCorrelation) -> Self {
Self {
severity: Ok(value.severity),
shared_attribute_count: Ok(value.shared_attribute_count),
}
}
}
#[derive(Clone, Debug)]
pub struct ResponsePooledItem {
attribute_id: ::std::result::Result<super::Ulid, ::std::string::String>,
created: ::std::result::Result<bool, ::std::string::String>,
}
impl ::std::default::Default for ResponsePooledItem {
fn default() -> Self {
Self {
attribute_id: Err("no value supplied for attribute_id".to_string()),
created: Err("no value supplied for created".to_string()),
}
}
}
impl ResponsePooledItem {
pub fn attribute_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::Ulid>,
T::Error: ::std::fmt::Display,
{
self.attribute_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for attribute_id: {e}"));
self
}
pub fn created<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<bool>,
T::Error: ::std::fmt::Display,
{
self.created = value
.try_into()
.map_err(|e| format!("error converting supplied value for created: {e}"));
self
}
}
impl ::std::convert::TryFrom<ResponsePooledItem> for super::ResponsePooledItem {
type Error = super::error::ConversionError;
fn try_from(
value: ResponsePooledItem,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
attribute_id: value.attribute_id?,
created: value.created?,
})
}
}
impl ::std::convert::From<super::ResponsePooledItem> for ResponsePooledItem {
fn from(value: super::ResponsePooledItem) -> Self {
Self {
attribute_id: Ok(value.attribute_id),
created: Ok(value.created),
}
}
}
}
/// Generation of default values for serde.
pub mod defaults {
pub(super) fn new_claim_share() -> super::NewClaimShare {
super::NewClaimShare::Local
}
}
impl crate::Payload for Payload {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/persona/profile/compose/1.0";
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 \"ClaimType\": {\n \"description\": \"The vocabulary token naming what a value IS — `name.legal`, `phone.mobile`, `address.postal`, `person.birthDate`. Dotted, most-general segment first, so that a consumer with no knowledge of the specific token can still group by its prefix.\\n\\nThe token is the maintainer's own; no external vocabulary is primary. External vocabularies (vCard/jCard, OIDC standard claims, schema.org) are mappings applied at PRESENTATION by a renderer, not at rest, so that a query written in any of them can be matched without the store having to live inside any one of them.\\n\\nThe `x:` prefix is an open extension namespace and is not decoration. The closest prior art — Windows CardSpace's self-issued card — supported exactly fifteen predefined claim types with no extensibility, and that is the specific way it failed the requirement a holder actually has. An `x:` attribute stores, composes, binds and discloses exactly like a known one; it renders generically and matches only an explicit query.\",\n \"maxLength\": 128,\n \"minLength\": 1,\n \"pattern\": \"^(x:)?[a-z][a-zA-Z0-9]*(\\\\.[a-z][a-zA-Z0-9]*)*$\",\n \"title\": \"ClaimType\",\n \"type\": \"string\"\n },\n \"ComposeClaim\": {\n \"description\": \"One claim of the face being composed: a value typed now, or an attribute the holder already keeps.\",\n \"oneOf\": [\n {\n \"$ref\": \"#/$defs/NewClaim\"\n },\n {\n \"$ref\": \"#/$defs/HeldClaim\"\n }\n ],\n \"title\": \"ComposeClaim\"\n },\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 \"HeldClaim\": {\n \"additionalProperties\": false,\n \"description\": \"An attribute already in the holder's pool, presented live.\",\n \"properties\": {\n \"attributeId\": {\n \"$ref\": \"#/$defs/Ulid\"\n },\n \"slot\": {\n \"$ref\": \"#/$defs/Slot\"\n }\n },\n \"required\": [\n \"attributeId\"\n ],\n \"title\": \"HeldClaim\",\n \"type\": \"object\"\n },\n \"NewClaim\": {\n \"additionalProperties\": false,\n \"description\": \"A value the holder types now. Self-asserted: a value typed at this step has no issuer behind it, and a claim that could carry a provenance here would let a typed value present as attested.\",\n \"properties\": {\n \"label\": {\n \"description\": \"The holder's note to self for this value. Never disclosed.\",\n \"maxLength\": 128,\n \"type\": \"string\"\n },\n \"share\": {\n \"default\": \"local\",\n \"description\": \"`local` (the default) keeps the value in this face alone: it is carried inline and enters no pool, so no other face can come to present it by accident. `pool` makes it reusable — the maintainer references a self-asserted pool attribute holding exactly this type and value, creating one when none exists.\",\n \"enum\": [\n \"local\",\n \"pool\"\n ],\n \"type\": \"string\"\n },\n \"slot\": {\n \"$ref\": \"#/$defs/Slot\"\n },\n \"type\": {\n \"$ref\": \"#/$defs/ClaimType\"\n },\n \"value\": {},\n \"valueType\": {\n \"$ref\": \"#/$defs/ValueType\"\n }\n },\n \"required\": [\n \"type\",\n \"valueType\",\n \"value\"\n ],\n \"title\": \"NewClaim\",\n \"type\": \"object\"\n },\n \"Response\": {\n \"$anchor\": \"response\",\n \"additionalProperties\": false,\n \"description\": \"Success response to persona/profile/compose. Type https://trusttasks.org/spec/persona/profile/compose/1.0#response.\",\n \"properties\": {\n \"binding\": {\n \"additionalProperties\": false,\n \"description\": \"Present when `personaDid` was given: the face is now worn there.\",\n \"properties\": {\n \"alsoBoundPersonaCount\": {\n \"description\": \"How many other personas in this context wear this face. Always zero for a face this task just created; present for parity with persona/binding/set.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"personaDid\": {\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"version\": {\n \"$ref\": \"#/$defs/Version\"\n }\n },\n \"required\": [\n \"personaDid\",\n \"version\"\n ],\n \"type\": \"object\"\n },\n \"correlation\": {\n \"additionalProperties\": false,\n \"description\": \"Advisory, as on persona/profile/put: how many of the face's claims present a value another face also presents. A count; identifiers come from persona/correlation/analyze. The write has applied.\",\n \"properties\": {\n \"severity\": {\n \"enum\": [\n \"none\",\n \"low\",\n \"high\"\n ],\n \"type\": \"string\"\n },\n \"sharedAttributeCount\": {\n \"minimum\": 0,\n \"type\": \"integer\"\n }\n },\n \"required\": [\n \"severity\"\n ],\n \"type\": \"object\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"pooled\": {\n \"description\": \"For each `share: pool` claim, in request order, the pool attribute the face now references and whether this compose created it. `created: false` means the holder already kept exactly this value, and the face now shares it with whatever else presents it. Absent when no claim was pooled.\",\n \"items\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"attributeId\": {\n \"$ref\": \"#/$defs/Ulid\"\n },\n \"created\": {\n \"type\": \"boolean\"\n }\n },\n \"required\": [\n \"attributeId\",\n \"created\"\n ],\n \"type\": \"object\"\n },\n \"maxItems\": 64,\n \"type\": \"array\"\n },\n \"profileId\": {\n \"$ref\": \"#/$defs/Ulid\"\n },\n \"scope\": {\n \"description\": \"Where the face lives. `local`: in `contextId` only, readable through persona/local/profile/get. `pool`: above contexts, readable through persona/profile/get, and able to be worn in other contexts later.\",\n \"enum\": [\n \"local\",\n \"pool\"\n ],\n \"type\": \"string\"\n },\n \"version\": {\n \"$ref\": \"#/$defs/Version\"\n }\n },\n \"required\": [\n \"profileId\",\n \"scope\",\n \"version\"\n ],\n \"title\": \"Persona Profile Compose — response payload\",\n \"type\": \"object\"\n },\n \"Slot\": {\n \"description\": \"A role a profile entry plays within its profile, so a consumer can find it without guessing from its claim type. A profile MAY hold several entries of one type — a legal name and a display name, two phone numbers — and only a slot says which answers a given question. Unique within a profile.\\n\\nWell-known slots:\\n\\n- `displayName` — what this face calls itself. The entry a consumer renders as the face's name to anyone it is shown to. Distinct from the profile's own `name`, which is the holder's private label and never disclosed.\\n- `primaryEmail`, `primaryPhone`, `primaryAddress` — the entry to use where a counterparty asks for one of a kind and the profile holds several.\\n- `avatar` — the image this face presents.\\n\\nOther values are the holder's or the producer's own and carry no meaning a maintainer interprets.\",\n \"pattern\": \"^[a-z][A-Za-z0-9]{0,31}$\",\n \"title\": \"Slot\",\n \"type\": \"string\"\n },\n \"Ulid\": {\n \"description\": \"A ULID in Crockford base32, uppercase. Used for `attributeId` and `profileId`. Chosen over a UUID because the leading 48 bits are a timestamp, so a key-ordered scan of the store is also creation-ordered and a `list` needs no secondary sort. Server-assigned on create; a producer MAY supply one to make a create idempotent, and a maintainer MUST reject a supplied value that already exists rather than silently overwriting.\",\n \"pattern\": \"^[0-9A-HJKMNP-TV-Z]{26}$\",\n \"title\": \"Ulid\",\n \"type\": \"string\"\n },\n \"ValueType\": {\n \"description\": \"The JSON shape of `value`, declared so that a consumer can render and compare without guessing. The maintainer validates that `value` agrees with this member and does nothing further: it does NOT validate a phone number against a phone-number grammar. That is a producer's affordance, and a store that grows opinions about the contents of its records eventually blocks its consumer's release.\",\n \"enum\": [\n \"string\",\n \"number\",\n \"boolean\",\n \"date\",\n \"object\"\n ],\n \"title\": \"ValueType\",\n \"type\": \"string\"\n },\n \"Version\": {\n \"description\": \"A value of the store's monotonic write counter. Server-assigned; a producer never chooses one.\",\n \"minimum\": 1,\n \"title\": \"Version\",\n \"type\": \"integer\"\n }\n },\n \"$id\": \"https://trusttasks.org/spec/persona/profile/compose/1.0\",\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\": false,\n \"description\": \"Compose a face for one context, where it is needed, from values typed now and attributes already held — and optionally wear it there in the same act. Local by default: a value typed here stays in this context unless the holder says it should be reusable. Where the face lives follows from what it carries, so there is no scope parameter to get wrong.\",\n \"properties\": {\n \"claims\": {\n \"description\": \"Ordered; the order is display order.\",\n \"items\": {\n \"$ref\": \"#/$defs/ComposeClaim\"\n },\n \"maxItems\": 64,\n \"minItems\": 1,\n \"type\": \"array\"\n },\n \"contextId\": {\n \"description\": \"The context the face is composed for. A face whose every claim is local lives in this context and nowhere else; a face carrying any pool claim lives above contexts, and is bound into this one when `personaDid` is given.\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"label\": {\n \"description\": \"What the context may call the face, as on persona/binding/set. Meaningful only when the face is worn (`personaDid` or `wear`); a maintainer MUST refuse it otherwise rather than drop it.\",\n \"maxLength\": 128,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"name\": {\n \"description\": \"The holder's name for the face. Never disclosed; what a context may call the face is `label`.\",\n \"maxLength\": 128,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"personaDid\": {\n \"description\": \"Wear the new face as this persona in `contextId`, in the same act. Omit to compose without wearing it.\",\n \"maxLength\": 2048,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"until\": {\n \"description\": \"When wearing the face here ends on its own, as persona/binding/set `until`: at it the binding clears and the face, if worn nowhere else, is retired — never deleted. For the face composed at the door of a conference or a listing, which is where a throwaway face is usually made. Meaningful only when the face is worn (`personaDid` or `wear`), and refused otherwise or in the past (`untilNotFuture`).\",\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"wear\": {\n \"default\": false,\n \"description\": \"Wear the new face in `contextId` as the persona the holder already uses in `contextId` — the one DID with a binding there, current or cleared. None is refused (`noPersonaHere`): a persona is minted on its own, through the DID-template path, never as a side effect of wearing a face. Several are refused (`personaAmbiguous`, naming them): picking one for the holder would decide which of their identities a context sees. Not with `personaDid`, which names the persona instead.\",\n \"type\": \"boolean\"\n }\n },\n \"required\": [\n \"contextId\",\n \"name\",\n \"claims\"\n ],\n \"title\": \"Persona Profile Compose — payload\",\n \"type\": \"object\"\n}\n",
);
}
impl crate::Payload for Response {
const TYPE_URI: &'static str =
"https://trusttasks.org/spec/persona/profile/compose/1.0#response";
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 \"ClaimType\": {\n \"description\": \"The vocabulary token naming what a value IS — `name.legal`, `phone.mobile`, `address.postal`, `person.birthDate`. Dotted, most-general segment first, so that a consumer with no knowledge of the specific token can still group by its prefix.\\n\\nThe token is the maintainer's own; no external vocabulary is primary. External vocabularies (vCard/jCard, OIDC standard claims, schema.org) are mappings applied at PRESENTATION by a renderer, not at rest, so that a query written in any of them can be matched without the store having to live inside any one of them.\\n\\nThe `x:` prefix is an open extension namespace and is not decoration. The closest prior art — Windows CardSpace's self-issued card — supported exactly fifteen predefined claim types with no extensibility, and that is the specific way it failed the requirement a holder actually has. An `x:` attribute stores, composes, binds and discloses exactly like a known one; it renders generically and matches only an explicit query.\",\n \"maxLength\": 128,\n \"minLength\": 1,\n \"pattern\": \"^(x:)?[a-z][a-zA-Z0-9]*(\\\\.[a-z][a-zA-Z0-9]*)*$\",\n \"title\": \"ClaimType\",\n \"type\": \"string\"\n },\n \"ComposeClaim\": {\n \"description\": \"One claim of the face being composed: a value typed now, or an attribute the holder already keeps.\",\n \"oneOf\": [\n {\n \"$ref\": \"#/$defs/NewClaim\"\n },\n {\n \"$ref\": \"#/$defs/HeldClaim\"\n }\n ],\n \"title\": \"ComposeClaim\"\n },\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 \"HeldClaim\": {\n \"additionalProperties\": false,\n \"description\": \"An attribute already in the holder's pool, presented live.\",\n \"properties\": {\n \"attributeId\": {\n \"$ref\": \"#/$defs/Ulid\"\n },\n \"slot\": {\n \"$ref\": \"#/$defs/Slot\"\n }\n },\n \"required\": [\n \"attributeId\"\n ],\n \"title\": \"HeldClaim\",\n \"type\": \"object\"\n },\n \"NewClaim\": {\n \"additionalProperties\": false,\n \"description\": \"A value the holder types now. Self-asserted: a value typed at this step has no issuer behind it, and a claim that could carry a provenance here would let a typed value present as attested.\",\n \"properties\": {\n \"label\": {\n \"description\": \"The holder's note to self for this value. Never disclosed.\",\n \"maxLength\": 128,\n \"type\": \"string\"\n },\n \"share\": {\n \"default\": \"local\",\n \"description\": \"`local` (the default) keeps the value in this face alone: it is carried inline and enters no pool, so no other face can come to present it by accident. `pool` makes it reusable — the maintainer references a self-asserted pool attribute holding exactly this type and value, creating one when none exists.\",\n \"enum\": [\n \"local\",\n \"pool\"\n ],\n \"type\": \"string\"\n },\n \"slot\": {\n \"$ref\": \"#/$defs/Slot\"\n },\n \"type\": {\n \"$ref\": \"#/$defs/ClaimType\"\n },\n \"value\": {},\n \"valueType\": {\n \"$ref\": \"#/$defs/ValueType\"\n }\n },\n \"required\": [\n \"type\",\n \"valueType\",\n \"value\"\n ],\n \"title\": \"NewClaim\",\n \"type\": \"object\"\n },\n \"Response\": {\n \"$anchor\": \"response\",\n \"additionalProperties\": false,\n \"description\": \"Success response to persona/profile/compose. Type https://trusttasks.org/spec/persona/profile/compose/1.0#response.\",\n \"properties\": {\n \"binding\": {\n \"additionalProperties\": false,\n \"description\": \"Present when `personaDid` was given: the face is now worn there.\",\n \"properties\": {\n \"alsoBoundPersonaCount\": {\n \"description\": \"How many other personas in this context wear this face. Always zero for a face this task just created; present for parity with persona/binding/set.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"personaDid\": {\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"version\": {\n \"$ref\": \"#/$defs/Version\"\n }\n },\n \"required\": [\n \"personaDid\",\n \"version\"\n ],\n \"type\": \"object\"\n },\n \"correlation\": {\n \"additionalProperties\": false,\n \"description\": \"Advisory, as on persona/profile/put: how many of the face's claims present a value another face also presents. A count; identifiers come from persona/correlation/analyze. The write has applied.\",\n \"properties\": {\n \"severity\": {\n \"enum\": [\n \"none\",\n \"low\",\n \"high\"\n ],\n \"type\": \"string\"\n },\n \"sharedAttributeCount\": {\n \"minimum\": 0,\n \"type\": \"integer\"\n }\n },\n \"required\": [\n \"severity\"\n ],\n \"type\": \"object\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"pooled\": {\n \"description\": \"For each `share: pool` claim, in request order, the pool attribute the face now references and whether this compose created it. `created: false` means the holder already kept exactly this value, and the face now shares it with whatever else presents it. Absent when no claim was pooled.\",\n \"items\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"attributeId\": {\n \"$ref\": \"#/$defs/Ulid\"\n },\n \"created\": {\n \"type\": \"boolean\"\n }\n },\n \"required\": [\n \"attributeId\",\n \"created\"\n ],\n \"type\": \"object\"\n },\n \"maxItems\": 64,\n \"type\": \"array\"\n },\n \"profileId\": {\n \"$ref\": \"#/$defs/Ulid\"\n },\n \"scope\": {\n \"description\": \"Where the face lives. `local`: in `contextId` only, readable through persona/local/profile/get. `pool`: above contexts, readable through persona/profile/get, and able to be worn in other contexts later.\",\n \"enum\": [\n \"local\",\n \"pool\"\n ],\n \"type\": \"string\"\n },\n \"version\": {\n \"$ref\": \"#/$defs/Version\"\n }\n },\n \"required\": [\n \"profileId\",\n \"scope\",\n \"version\"\n ],\n \"title\": \"Persona Profile Compose — response payload\",\n \"type\": \"object\"\n },\n \"Slot\": {\n \"description\": \"A role a profile entry plays within its profile, so a consumer can find it without guessing from its claim type. A profile MAY hold several entries of one type — a legal name and a display name, two phone numbers — and only a slot says which answers a given question. Unique within a profile.\\n\\nWell-known slots:\\n\\n- `displayName` — what this face calls itself. The entry a consumer renders as the face's name to anyone it is shown to. Distinct from the profile's own `name`, which is the holder's private label and never disclosed.\\n- `primaryEmail`, `primaryPhone`, `primaryAddress` — the entry to use where a counterparty asks for one of a kind and the profile holds several.\\n- `avatar` — the image this face presents.\\n\\nOther values are the holder's or the producer's own and carry no meaning a maintainer interprets.\",\n \"pattern\": \"^[a-z][A-Za-z0-9]{0,31}$\",\n \"title\": \"Slot\",\n \"type\": \"string\"\n },\n \"Ulid\": {\n \"description\": \"A ULID in Crockford base32, uppercase. Used for `attributeId` and `profileId`. Chosen over a UUID because the leading 48 bits are a timestamp, so a key-ordered scan of the store is also creation-ordered and a `list` needs no secondary sort. Server-assigned on create; a producer MAY supply one to make a create idempotent, and a maintainer MUST reject a supplied value that already exists rather than silently overwriting.\",\n \"pattern\": \"^[0-9A-HJKMNP-TV-Z]{26}$\",\n \"title\": \"Ulid\",\n \"type\": \"string\"\n },\n \"ValueType\": {\n \"description\": \"The JSON shape of `value`, declared so that a consumer can render and compare without guessing. The maintainer validates that `value` agrees with this member and does nothing further: it does NOT validate a phone number against a phone-number grammar. That is a producer's affordance, and a store that grows opinions about the contents of its records eventually blocks its consumer's release.\",\n \"enum\": [\n \"string\",\n \"number\",\n \"boolean\",\n \"date\",\n \"object\"\n ],\n \"title\": \"ValueType\",\n \"type\": \"string\"\n },\n \"Version\": {\n \"description\": \"A value of the store's monotonic write counter. Server-assigned; a producer never chooses one.\",\n \"minimum\": 1,\n \"title\": \"Version\",\n \"type\": \"integer\"\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] = &[
error_codes::UNRESOLVED_REFERENCE,
error_codes::DUPLICATE_SLOT,
error_codes::NO_PERSONA_HERE,
error_codes::PERSONA_AMBIGUOUS,
error_codes::WEAR_AND_PERSONA,
error_codes::UNTIL_NOT_FUTURE,
error_codes::LABEL_WITHOUT_PERSONA,
];
/// 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 {
/// `persona/profile/compose:unresolvedReference`
///
/// A held claim names an attribute the pool does not hold. The details name the offending `attributeId`s. Nothing is written.
///
/// Declared `retryable: false`.
pub const UNRESOLVED_REFERENCE: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "persona/profile/compose:unresolvedReference",
retryable: false,
};
/// `persona/profile/compose:duplicateSlot`
///
/// Two claims carry the same `slot`. The details name the slot. Nothing is written.
///
/// Declared `retryable: false`.
pub const DUPLICATE_SLOT: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "persona/profile/compose:duplicateSlot",
retryable: false,
};
/// `persona/profile/compose:noPersonaHere`
///
/// `wear` was set and the holder has no persona in `contextId`. Nothing is written — a persona is minted first, through the DID-template path.
///
/// Declared `retryable: false`.
pub const NO_PERSONA_HERE: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "persona/profile/compose:noPersonaHere",
retryable: false,
};
/// `persona/profile/compose:personaAmbiguous`
///
/// `wear` was set and the holder has several personas in `contextId`. The details name them. Nothing is written.
///
/// Declared `retryable: false`.
pub const PERSONA_AMBIGUOUS: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "persona/profile/compose:personaAmbiguous",
retryable: false,
};
/// `persona/profile/compose:wearAndPersona`
///
/// Both `wear` and `personaDid` were given. They are two ways to say who wears the face; one is needed. Nothing is written.
///
/// Declared `retryable: false`.
pub const WEAR_AND_PERSONA: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "persona/profile/compose:wearAndPersona",
retryable: false,
};
/// `persona/profile/compose:untilNotFuture`
///
/// `until` is not in the future, or was given without `personaDid`. Nothing is written.
///
/// Declared `retryable: false`.
pub const UNTIL_NOT_FUTURE: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "persona/profile/compose:untilNotFuture",
retryable: false,
};
/// `persona/profile/compose:labelWithoutPersona`
///
/// A `label` was given without a `personaDid`. A label names the face to the context it is worn in, and a face composed without being worn has no context to name it to. Nothing is written.
///
/// Declared `retryable: false`.
pub const LABEL_WITHOUT_PERSONA: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "persona/profile/compose:labelWithoutPersona",
retryable: false,
};
}