//! Generated by `trust-tasks-codegen` — do not edit by hand.
//!
//! Spec slug: `persona/attribute/promote`. Version: `1.0`.
#![allow(deprecated)]
/// Why this specification version is deprecated (SPEC "Superseded and
/// Withdrawn Versions"), or `None` while it is current.
pub const DEPRECATION: Option<&str> = Some("superseded by persona/attribute/promote/1.1");
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
/// Error types.
pub mod error {
/// Error from a `TryFrom` or `FromStr` implementation.
pub struct ConversionError(::std::borrow::Cow<'static, str>);
impl ::std::error::Error for ConversionError {}
impl ::std::fmt::Display for ConversionError {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
::std::fmt::Display::fmt(&self.0, f)
}
}
impl ::std::fmt::Debug for ConversionError {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
::std::fmt::Debug::fmt(&self.0, f)
}
}
impl From<&'static str> for ConversionError {
fn from(value: &'static str) -> Self {
Self(value.into())
}
}
impl From<String> for ConversionError {
fn from(value: String) -> Self {
Self(value.into())
}
}
}
///Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(transparent)]
pub struct Ext(pub ::std::collections::HashMap<ExtKey, ::serde_json::Value>);
impl ::std::ops::Deref for Ext {
type Target = ::std::collections::HashMap<ExtKey, ::serde_json::Value>;
fn deref(&self) -> &::std::collections::HashMap<ExtKey, ::serde_json::Value> {
&self.0
}
}
impl ::std::convert::From<Ext> for ::std::collections::HashMap<ExtKey, ::serde_json::Value> {
fn from(value: Ext) -> Self {
value.0
}
}
impl ::std::convert::From<::std::collections::HashMap<ExtKey, ::serde_json::Value>> for Ext {
fn from(value: ::std::collections::HashMap<ExtKey, ::serde_json::Value>) -> Self {
Self(value)
}
}
///`ExtKey`
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ExtKey(::std::string::String);
impl ::std::ops::Deref for ExtKey {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ExtKey> for ::std::string::String {
fn from(value: ExtKey) -> Self {
value.0
}
}
impl ::std::str::FromStr for ExtKey {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| {
::regress::Regex::new("^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$").unwrap()
});
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ExtKey {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for ExtKey {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for ExtKey {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for ExtKey {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///Make values a context-local face carries reusable: each named entry's value becomes a pool attribute, and the face — which can no longer live inside one context once it references the pool — moves above contexts, keeping its id and staying worn wherever it was. One-way.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
#[deprecated(note = "superseded by persona/attribute/promote/1.1")]
pub struct Payload {
///The context the local face lives in.
#[serde(rename = "contextId")]
pub context_id: PayloadContextId,
///Zero-based positions, in the face's `entries`, of the values to promote. Positions are meaningful only against the version the producer read, which is why `expectedVersion` is required.
pub entries: Vec<u64>,
///The local face's version as the producer read it. Required: a position into a face edited since would promote a different value than the holder chose.
#[serde(rename = "expectedVersion")]
pub expected_version: Version,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
///The context-local face.
#[serde(rename = "profileId")]
pub profile_id: Ulid,
}
impl Payload {
pub fn builder() -> builder::Payload {
Default::default()
}
}
///The context the local face lives in.
///
#[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())
})
}
}
///Success response to persona/attribute/promote. Type https://trusttasks.org/spec/persona/attribute/promote/1.0#response.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
#[deprecated(note = "superseded by persona/attribute/promote/1.1")]
pub struct Response {
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
///Unchanged: the face keeps its id. It is now read through persona/profile/get.
#[serde(rename = "profileId")]
pub profile_id: Ulid,
///For each promoted position, in request order, the pool attribute the entry now references and whether this promote created it. `created: false` means the holder already kept exactly this value, and the face now shares it with whatever else presents it.
pub promoted: ::std::vec::Vec<ResponsePromotedItem>,
///Personas in `contextId` that wore the local face and now wear it from the pool. What they present is unchanged. Absent when none did.
#[serde(
rename = "reboundPersonaDids",
default,
skip_serializing_if = "::std::vec::Vec::is_empty"
)]
pub rebound_persona_dids: ::std::vec::Vec<ResponseReboundPersonaDidsItem>,
///The face's version in the pool.
pub version: Version,
}
impl Response {
pub fn builder() -> builder::Response {
Default::default()
}
}
///`ResponsePromotedItem`
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ResponsePromotedItem {
#[serde(rename = "attributeId")]
pub attribute_id: Ulid,
pub created: bool,
pub entry: u64,
}
impl ResponsePromotedItem {
pub fn builder() -> builder::ResponsePromotedItem {
Default::default()
}
}
///`ResponseReboundPersonaDidsItem`
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ResponseReboundPersonaDidsItem(::std::string::String);
impl ::std::ops::Deref for ResponseReboundPersonaDidsItem {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ResponseReboundPersonaDidsItem> for ::std::string::String {
fn from(value: ResponseReboundPersonaDidsItem) -> Self {
value.0
}
}
impl ::std::str::FromStr for ResponseReboundPersonaDidsItem {
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 ResponseReboundPersonaDidsItem {
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 ResponseReboundPersonaDidsItem {
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 ResponseReboundPersonaDidsItem {
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 ResponseReboundPersonaDidsItem {
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.
///
#[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())
})
}
}
///A value of the store's monotonic write counter. Server-assigned; a producer never chooses one.
///
#[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 Payload {
context_id: ::std::result::Result<super::PayloadContextId, ::std::string::String>,
entries: ::std::result::Result<Vec<u64>, ::std::string::String>,
expected_version: ::std::result::Result<super::Version, ::std::string::String>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
profile_id: ::std::result::Result<super::Ulid, ::std::string::String>,
}
impl ::std::default::Default for Payload {
fn default() -> Self {
Self {
context_id: Err("no value supplied for context_id".to_string()),
entries: Err("no value supplied for entries".to_string()),
expected_version: Err("no value supplied for expected_version".to_string()),
ext: Ok(Default::default()),
profile_id: Err("no value supplied for profile_id".to_string()),
}
}
}
impl Payload {
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 entries<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<Vec<u64>>,
T::Error: ::std::fmt::Display,
{
self.entries = value
.try_into()
.map_err(|e| format!("error converting supplied value for entries: {e}"));
self
}
pub fn expected_version<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::Version>,
T::Error: ::std::fmt::Display,
{
self.expected_version = value
.try_into()
.map_err(|e| format!("error converting supplied value for expected_version: {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 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
}
}
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 {
context_id: value.context_id?,
entries: value.entries?,
expected_version: value.expected_version?,
ext: value.ext?,
profile_id: value.profile_id?,
})
}
}
impl ::std::convert::From<super::Payload> for Payload {
fn from(value: super::Payload) -> Self {
Self {
context_id: Ok(value.context_id),
entries: Ok(value.entries),
expected_version: Ok(value.expected_version),
ext: Ok(value.ext),
profile_id: Ok(value.profile_id),
}
}
}
#[derive(Clone, Debug)]
pub struct Response {
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
profile_id: ::std::result::Result<super::Ulid, ::std::string::String>,
promoted: ::std::result::Result<
::std::vec::Vec<super::ResponsePromotedItem>,
::std::string::String,
>,
rebound_persona_dids: ::std::result::Result<
::std::vec::Vec<super::ResponseReboundPersonaDidsItem>,
::std::string::String,
>,
version: ::std::result::Result<super::Version, ::std::string::String>,
}
impl ::std::default::Default for Response {
fn default() -> Self {
Self {
ext: Ok(Default::default()),
profile_id: Err("no value supplied for profile_id".to_string()),
promoted: Err("no value supplied for promoted".to_string()),
rebound_persona_dids: Ok(Default::default()),
version: Err("no value supplied for version".to_string()),
}
}
}
impl Response {
pub fn ext<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::Ext>>,
T::Error: ::std::fmt::Display,
{
self.ext = value
.try_into()
.map_err(|e| format!("error converting supplied value for ext: {e}"));
self
}
pub fn 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 promoted<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::ResponsePromotedItem>>,
T::Error: ::std::fmt::Display,
{
self.promoted = value
.try_into()
.map_err(|e| format!("error converting supplied value for promoted: {e}"));
self
}
pub fn rebound_persona_dids<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::ResponseReboundPersonaDidsItem>>,
T::Error: ::std::fmt::Display,
{
self.rebound_persona_dids = value.try_into().map_err(|e| {
format!("error converting supplied value for rebound_persona_dids: {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 {
ext: value.ext?,
profile_id: value.profile_id?,
promoted: value.promoted?,
rebound_persona_dids: value.rebound_persona_dids?,
version: value.version?,
})
}
}
impl ::std::convert::From<super::Response> for Response {
fn from(value: super::Response) -> Self {
Self {
ext: Ok(value.ext),
profile_id: Ok(value.profile_id),
promoted: Ok(value.promoted),
rebound_persona_dids: Ok(value.rebound_persona_dids),
version: Ok(value.version),
}
}
}
#[derive(Clone, Debug)]
pub struct ResponsePromotedItem {
attribute_id: ::std::result::Result<super::Ulid, ::std::string::String>,
created: ::std::result::Result<bool, ::std::string::String>,
entry: ::std::result::Result<u64, ::std::string::String>,
}
impl ::std::default::Default for ResponsePromotedItem {
fn default() -> Self {
Self {
attribute_id: Err("no value supplied for attribute_id".to_string()),
created: Err("no value supplied for created".to_string()),
entry: Err("no value supplied for entry".to_string()),
}
}
}
impl ResponsePromotedItem {
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
}
pub fn entry<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.entry = value
.try_into()
.map_err(|e| format!("error converting supplied value for entry: {e}"));
self
}
}
impl ::std::convert::TryFrom<ResponsePromotedItem> for super::ResponsePromotedItem {
type Error = super::error::ConversionError;
fn try_from(
value: ResponsePromotedItem,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
attribute_id: value.attribute_id?,
created: value.created?,
entry: value.entry?,
})
}
}
impl ::std::convert::From<super::ResponsePromotedItem> for ResponsePromotedItem {
fn from(value: super::ResponsePromotedItem) -> Self {
Self {
attribute_id: Ok(value.attribute_id),
created: Ok(value.created),
entry: Ok(value.entry),
}
}
}
}
impl crate::Payload for Payload {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/persona/attribute/promote/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(
"{\"$defs\":{\"Ext\":{\"additionalProperties\":true,\"description\":\"Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.\",\"minProperties\":1,\"propertyNames\":{\"pattern\":\"^[a-z][a-z0-9-]*(\\\\.[a-z0-9-]+)+$\"},\"title\":\"Ext\",\"type\":\"object\"},\"Response\":{\"$anchor\":\"response\",\"additionalProperties\":false,\"description\":\"Success response to persona/attribute/promote. Type https://trusttasks.org/spec/persona/attribute/promote/1.0#response.\",\"properties\":{\"ext\":{\"$ref\":\"#/$defs/Ext\"},\"profileId\":{\"$ref\":\"#/$defs/Ulid\",\"description\":\"Unchanged: the face keeps its id. It is now read through persona/profile/get.\"},\"promoted\":{\"description\":\"For each promoted position, in request order, the pool attribute the entry now references and whether this promote created it. `created: false` means the holder already kept exactly this value, and the face now shares it with whatever else presents it.\",\"items\":{\"additionalProperties\":false,\"properties\":{\"attributeId\":{\"$ref\":\"#/$defs/Ulid\"},\"created\":{\"type\":\"boolean\"},\"entry\":{\"minimum\":0,\"type\":\"integer\"}},\"required\":[\"entry\",\"attributeId\",\"created\"],\"type\":\"object\"},\"maxItems\":64,\"minItems\":1,\"type\":\"array\"},\"reboundPersonaDids\":{\"description\":\"Personas in `contextId` that wore the local face and now wear it from the pool. What they present is unchanged. Absent when none did.\",\"items\":{\"minLength\":1,\"type\":\"string\"},\"maxItems\":256,\"type\":\"array\"},\"version\":{\"$ref\":\"#/$defs/Version\",\"description\":\"The face's version in the pool.\"}},\"required\":[\"profileId\",\"version\",\"promoted\"],\"title\":\"Persona Attribute Promote — response payload\",\"type\":\"object\"},\"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.\",\"pattern\":\"^[0-9A-HJKMNP-TV-Z]{26}$\",\"title\":\"Ulid\",\"type\":\"string\"},\"Version\":{\"description\":\"A value of the store's monotonic write counter. Server-assigned; a producer never chooses one.\",\"minimum\":1,\"title\":\"Version\",\"type\":\"integer\"}},\"$id\":\"https://trusttasks.org/spec/persona/attribute/promote/1.0\",\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"additionalProperties\":false,\"description\":\"Make values a context-local face carries reusable: each named entry's value becomes a pool attribute, and the face — which can no longer live inside one context once it references the pool — moves above contexts, keeping its id and staying worn wherever it was. One-way.\",\"properties\":{\"contextId\":{\"description\":\"The context the local face lives in.\",\"minLength\":1,\"type\":\"string\"},\"entries\":{\"description\":\"Zero-based positions, in the face's `entries`, of the values to promote. Positions are meaningful only against the version the producer read, which is why `expectedVersion` is required.\",\"items\":{\"minimum\":0,\"type\":\"integer\"},\"maxItems\":64,\"minItems\":1,\"type\":\"array\",\"uniqueItems\":true},\"expectedVersion\":{\"$ref\":\"#/$defs/Version\",\"description\":\"The local face's version as the producer read it. Required: a position into a face edited since would promote a different value than the holder chose.\"},\"ext\":{\"$ref\":\"#/$defs/Ext\"},\"profileId\":{\"$ref\":\"#/$defs/Ulid\",\"description\":\"The context-local face.\"}},\"required\":[\"contextId\",\"profileId\",\"entries\",\"expectedVersion\"],\"title\":\"Persona Attribute Promote — payload\",\"type\":\"object\"}\n",
);
}
impl crate::Payload for Response {
const TYPE_URI: &'static str =
"https://trusttasks.org/spec/persona/attribute/promote/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(
"{\"$defs\":{\"Ext\":{\"additionalProperties\":true,\"description\":\"Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.\",\"minProperties\":1,\"propertyNames\":{\"pattern\":\"^[a-z][a-z0-9-]*(\\\\.[a-z0-9-]+)+$\"},\"title\":\"Ext\",\"type\":\"object\"},\"Response\":{\"$anchor\":\"response\",\"additionalProperties\":false,\"description\":\"Success response to persona/attribute/promote. Type https://trusttasks.org/spec/persona/attribute/promote/1.0#response.\",\"properties\":{\"ext\":{\"$ref\":\"#/$defs/Ext\"},\"profileId\":{\"$ref\":\"#/$defs/Ulid\",\"description\":\"Unchanged: the face keeps its id. It is now read through persona/profile/get.\"},\"promoted\":{\"description\":\"For each promoted position, in request order, the pool attribute the entry now references and whether this promote created it. `created: false` means the holder already kept exactly this value, and the face now shares it with whatever else presents it.\",\"items\":{\"additionalProperties\":false,\"properties\":{\"attributeId\":{\"$ref\":\"#/$defs/Ulid\"},\"created\":{\"type\":\"boolean\"},\"entry\":{\"minimum\":0,\"type\":\"integer\"}},\"required\":[\"entry\",\"attributeId\",\"created\"],\"type\":\"object\"},\"maxItems\":64,\"minItems\":1,\"type\":\"array\"},\"reboundPersonaDids\":{\"description\":\"Personas in `contextId` that wore the local face and now wear it from the pool. What they present is unchanged. Absent when none did.\",\"items\":{\"minLength\":1,\"type\":\"string\"},\"maxItems\":256,\"type\":\"array\"},\"version\":{\"$ref\":\"#/$defs/Version\",\"description\":\"The face's version in the pool.\"}},\"required\":[\"profileId\",\"version\",\"promoted\"],\"title\":\"Persona Attribute Promote — response payload\",\"type\":\"object\"},\"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.\",\"pattern\":\"^[0-9A-HJKMNP-TV-Z]{26}$\",\"title\":\"Ulid\",\"type\":\"string\"},\"Version\":{\"description\":\"A value of the store's monotonic write counter. Server-assigned; a producer never chooses one.\",\"minimum\":1,\"title\":\"Version\",\"type\":\"integer\"}},\"$ref\":\"#/$defs/Response\",\"$schema\":\"https://json-schema.org/draft/2020-12/schema\"}\n",
);
}
impl crate::RequestPayload for Payload {
type Response = Response;
}
/// The earlier `MAJOR.MINOR` of this slug that this version declares it
/// extends (front matter `extends`, SPEC §5.2 "Declared extension"), or
/// `None`. Only the direct declaration; walk a chain with
/// [`crate::extension::extends_for`].
pub const EXTENDS: Option<&str> = None;
/// The extended error codes this specification declares (SPEC §7.3 item 9,
/// §8.5), in declaration order. Empty when it declares none.
pub const ERROR_CODES: &[crate::DeclaredErrorCode] = &[
error_codes::ENTRY_OUT_OF_RANGE,
error_codes::VERSION_CONFLICT,
];
/// 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/attribute/promote:entryOutOfRange`
///
/// A position is beyond the end of the face's entries. The details carry the face's entry count. Nothing is written.
///
/// Declared `retryable: false`.
/// Declares a `detailsSchema` for the error's `details` member.
pub const ENTRY_OUT_OF_RANGE: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "persona/attribute/promote:entryOutOfRange",
retryable: false,
details_schema: ::core::option::Option::Some(
"{\"additionalProperties\":false,\"properties\":{\"entryCount\":{\"minimum\":0,\"type\":\"integer\"}},\"required\":[\"entryCount\"],\"type\":\"object\"}",
),
};
/// `persona/attribute/promote:versionConflict`
///
/// The face's version is not `expectedVersion`. Details carry the current version. Nothing is written.
///
/// Declared `retryable: false`.
pub const VERSION_CONFLICT: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "persona/attribute/promote:versionConflict",
retryable: false,
details_schema: ::core::option::Option::None,
};
}