//! Generated by `trust-tasks-codegen` — do not edit by hand.
//!
//! Spec slug: `vtc/rooms/get`. Version: `0.2`.
#![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 vtc/rooms/get/0.3");
#[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())
}
}
}
///A config holding some of this room's blobs, other than the one it is assigned to.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ConfigHoldings {
pub bytes: u64,
#[serde(rename = "configId")]
pub config_id: StorageConfigId,
pub files: u64,
}
impl ConfigHoldings {
pub fn builder() -> builder::ConfigHoldings {
Default::default()
}
}
///The limits a room is enforced against now, with where each scope's came from.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct EffectiveLimits {
///The host-wide largest-file ceiling, which no room or member limit can exceed.
#[serde(
rename = "hostCeilingBytes",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub host_ceiling_bytes: ::std::option::Option<i64>,
pub limits: RoomLimits,
#[serde(rename = "memberSource")]
pub member_source: LimitSource,
#[serde(rename = "roomSource")]
pub room_source: LimitSource,
}
impl EffectiveLimits {
pub fn builder() -> builder::EffectiveLimits {
Default::default()
}
}
///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())
})
}
}
///One room, as its host holds it — member for member the `HostedRoom` of vtc/rooms/list/0.1, which defines it inside its own payload schema. Nothing derived from the room's contents, and no member list: the host has none.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct HostedRoom {
#[serde(rename = "createdAt")]
pub created_at: u64,
pub epoch: u64,
#[serde(
rename = "epochExpiresAt",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub epoch_expires_at: ::std::option::Option<u64>,
pub lifecycle: HostedRoomLifecycle,
#[serde(
rename = "mirrorOf",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub mirror_of: ::std::option::Option<HostedRoomMirrorOf>,
#[serde(rename = "ownerDid")]
pub owner_did: HostedRoomOwnerDid,
#[serde(rename = "retentionDays")]
pub retention_days: u64,
#[serde(rename = "retentionPolicy")]
pub retention_policy: RetentionPolicy,
#[serde(rename = "roomId")]
pub room_id: HostedRoomRoomId,
#[serde(rename = "updatedAt")]
pub updated_at: u64,
pub visibility: Visibility,
}
impl HostedRoom {
pub fn builder() -> builder::HostedRoom {
Default::default()
}
}
///`HostedRoomLifecycle`
///
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum HostedRoomLifecycle {
#[serde(rename = "live")]
Live,
#[serde(rename = "lapsed")]
Lapsed,
#[serde(rename = "dormant")]
Dormant,
#[serde(rename = "reclaimable")]
Reclaimable,
}
impl ::std::fmt::Display for HostedRoomLifecycle {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Live => f.write_str("live"),
Self::Lapsed => f.write_str("lapsed"),
Self::Dormant => f.write_str("dormant"),
Self::Reclaimable => f.write_str("reclaimable"),
}
}
}
impl ::std::str::FromStr for HostedRoomLifecycle {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"live" => Ok(Self::Live),
"lapsed" => Ok(Self::Lapsed),
"dormant" => Ok(Self::Dormant),
"reclaimable" => Ok(Self::Reclaimable),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for HostedRoomLifecycle {
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 HostedRoomLifecycle {
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 HostedRoomLifecycle {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///`HostedRoomMirrorOf`
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct HostedRoomMirrorOf(::std::string::String);
impl ::std::ops::Deref for HostedRoomMirrorOf {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<HostedRoomMirrorOf> for ::std::string::String {
fn from(value: HostedRoomMirrorOf) -> Self {
value.0
}
}
impl ::std::str::FromStr for HostedRoomMirrorOf {
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 HostedRoomMirrorOf {
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 HostedRoomMirrorOf {
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 HostedRoomMirrorOf {
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 HostedRoomMirrorOf {
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())
})
}
}
///`HostedRoomOwnerDid`
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct HostedRoomOwnerDid(::std::string::String);
impl ::std::ops::Deref for HostedRoomOwnerDid {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<HostedRoomOwnerDid> for ::std::string::String {
fn from(value: HostedRoomOwnerDid) -> Self {
value.0
}
}
impl ::std::str::FromStr for HostedRoomOwnerDid {
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());
}
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| ::regress::Regex::new("^did:").unwrap());
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^did:\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for HostedRoomOwnerDid {
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 HostedRoomOwnerDid {
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 HostedRoomOwnerDid {
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 HostedRoomOwnerDid {
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())
})
}
}
///`HostedRoomRoomId`
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct HostedRoomRoomId(::std::string::String);
impl ::std::ops::Deref for HostedRoomRoomId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<HostedRoomRoomId> for ::std::string::String {
fn from(value: HostedRoomRoomId) -> Self {
value.0
}
}
impl ::std::str::FromStr for HostedRoomRoomId {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 512usize {
return Err("longer than 512 characters".into());
}
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for HostedRoomRoomId {
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 HostedRoomRoomId {
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 HostedRoomRoomId {
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 HostedRoomRoomId {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///Where an effective limit came from. `policy`: the community's rooms policy at the room's creation. `override`: an administrator's vtc/rooms/limits/set. `default`: the community's configured defaults, where neither applies. The host-wide ceiling bounds all three.
///
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum LimitSource {
#[serde(rename = "policy")]
Policy,
#[serde(rename = "override")]
Override,
#[serde(rename = "default")]
Default,
}
impl ::std::fmt::Display for LimitSource {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Policy => f.write_str("policy"),
Self::Override => f.write_str("override"),
Self::Default => f.write_str("default"),
}
}
}
impl ::std::str::FromStr for LimitSource {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"policy" => Ok(Self::Policy),
"override" => Ok(Self::Override),
"default" => Ok(Self::Default),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for LimitSource {
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 LimitSource {
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 LimitSource {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///A one-line summary of the last failure, for an administrator: the step, the config and the backend's error code or status (`put to eu-s3-primary: 503 SlowDown`). Never a credential, a presigned URL, a signed request, a room identifier or anything derived from a room's contents.
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct MigrationLastError(::std::string::String);
impl ::std::ops::Deref for MigrationLastError {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<MigrationLastError> for ::std::string::String {
fn from(value: MigrationLastError) -> Self {
value.0
}
}
impl ::std::str::FromStr for MigrationLastError {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 500usize {
return Err("longer than 500 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 MigrationLastError {
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 MigrationLastError {
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 MigrationLastError {
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 MigrationLastError {
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())
})
}
}
///Why a migration is `paused`. `capacity`: the destination config cannot hold the rest. `source`: a config the blobs are being moved off keeps failing to serve them. `destination`: the destination config keeps refusing writes, or is no longer `active`. `credential`: the community cannot obtain a credential for one of the configs.
///
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum MigrationPauseCause {
#[serde(rename = "capacity")]
Capacity,
#[serde(rename = "source")]
Source,
#[serde(rename = "destination")]
Destination,
#[serde(rename = "credential")]
Credential,
}
impl ::std::fmt::Display for MigrationPauseCause {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Capacity => f.write_str("capacity"),
Self::Source => f.write_str("source"),
Self::Destination => f.write_str("destination"),
Self::Credential => f.write_str("credential"),
}
}
}
impl ::std::str::FromStr for MigrationPauseCause {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"capacity" => Ok(Self::Capacity),
"source" => Ok(Self::Source),
"destination" => Ok(Self::Destination),
"credential" => Ok(Self::Credential),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for MigrationPauseCause {
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 MigrationPauseCause {
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 MigrationPauseCause {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///Progress of the room's migration, as vtc/rooms/storage/migrate reports it.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct MigrationProgress {
#[serde(rename = "doneBytes")]
pub done_bytes: u64,
#[serde(rename = "doneFiles")]
pub done_files: u64,
///Present when `state` is `paused`; MAY be present while `running`, when a step is being retried.
#[serde(
rename = "lastError",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub last_error: ::std::option::Option<MigrationLastError>,
#[serde(rename = "migrationId")]
pub migration_id: MigrationProgressMigrationId,
///When the community will next try by itself. Present while a `running` migration waits out a backoff, and on a `paused` one the community will retry unprompted; absent on a `paused` one only re-issuing vtc/rooms/storage/migrate resumes (such as `capacity`).
#[serde(
rename = "nextAttemptAt",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub next_attempt_at: ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
///Present exactly when `state` is `paused`.
#[serde(
rename = "pausedCause",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub paused_cause: ::std::option::Option<MigrationPauseCause>,
pub state: MigrationState,
///The config this migration moves blobs to. After a reassignment during the migration it differs from `storage.configId`.
#[serde(rename = "toConfig")]
pub to_config: StorageConfigId,
#[serde(rename = "totalBytes")]
pub total_bytes: u64,
#[serde(rename = "totalFiles")]
pub total_files: u64,
}
impl MigrationProgress {
pub fn builder() -> builder::MigrationProgress {
Default::default()
}
}
///`MigrationProgressMigrationId`
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct MigrationProgressMigrationId(::std::string::String);
impl ::std::ops::Deref for MigrationProgressMigrationId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<MigrationProgressMigrationId> for ::std::string::String {
fn from(value: MigrationProgressMigrationId) -> Self {
value.0
}
}
impl ::std::str::FromStr for MigrationProgressMigrationId {
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-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
)
.unwrap()
});
if PATTERN.find(value).is_none() {
return Err(
"doesn't match pattern \"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$\""
.into(),
);
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for MigrationProgressMigrationId {
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 MigrationProgressMigrationId {
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 MigrationProgressMigrationId {
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 MigrationProgressMigrationId {
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())
})
}
}
///`queued`: approved and waiting for another migration on this community to finish; nothing copied yet (a community that runs one migration at a time). `running`: copying, including while it retries a failing step with backoff. `paused`: halted after its automatic retries reached their cap without success, or on a cause that retrying cannot clear (`pausedCause`); resumed by issuing vtc/rooms/storage/migrate again, and by the community itself at `nextAttemptAt` when present. `complete`: every blob that was to move has moved. `failed`: halted on a blob whose copy did not verify against its manifest; that blob stays where it was.
///
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum MigrationState {
#[serde(rename = "queued")]
Queued,
#[serde(rename = "running")]
Running,
#[serde(rename = "paused")]
Paused,
#[serde(rename = "complete")]
Complete,
#[serde(rename = "failed")]
Failed,
}
impl ::std::fmt::Display for MigrationState {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Queued => f.write_str("queued"),
Self::Running => f.write_str("running"),
Self::Paused => f.write_str("paused"),
Self::Complete => f.write_str("complete"),
Self::Failed => f.write_str("failed"),
}
}
}
impl ::std::str::FromStr for MigrationState {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"queued" => Ok(Self::Queued),
"running" => Ok(Self::Running),
"paused" => Ok(Self::Paused),
"complete" => Ok(Self::Complete),
"failed" => Ok(Self::Failed),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for MigrationState {
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 MigrationState {
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 MigrationState {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///A room-hosting administrator reads one hosted room's host record, storage placement, limits and usage. The outer document members are owned by the framework — SPEC §6.3.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
#[deprecated(note = "superseded by vtc/rooms/get/0.3")]
pub struct Payload {
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
///The room's identifier, as its owner minted it.
#[serde(rename = "roomId")]
pub room_id: PayloadRoomId,
}
impl Payload {
pub fn builder() -> builder::Payload {
Default::default()
}
}
///The room's identifier, as its owner minted it.
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PayloadRoomId(::std::string::String);
impl ::std::ops::Deref for PayloadRoomId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PayloadRoomId> for ::std::string::String {
fn from(value: PayloadRoomId) -> Self {
value.0
}
}
impl ::std::str::FromStr for PayloadRoomId {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 512usize {
return Err("longer than 512 characters".into());
}
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for PayloadRoomId {
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 PayloadRoomId {
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 PayloadRoomId {
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 PayloadRoomId {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///`Response`
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
#[deprecated(note = "superseded by vtc/rooms/get/0.3")]
pub struct Response {
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
///The room's largest committed blobs, by size only.
#[serde(
rename = "largestBlobs",
default,
skip_serializing_if = "::std::vec::Vec::is_empty"
)]
pub largest_blobs: ::std::vec::Vec<ResponseLargestBlobsItem>,
pub limits: EffectiveLimits,
///On an `attributed` room only: how many members have added files. Absent on `open` and `private` rooms.
#[serde(
rename = "membersWithUsage",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub members_with_usage: ::std::option::Option<u64>,
pub room: HostedRoom,
pub storage: ResponseStorage,
pub usage: ResponseUsage,
}
impl Response {
pub fn builder() -> builder::Response {
Default::default()
}
}
///`ResponseLargestBlobsItem`
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ResponseLargestBlobsItem {
#[serde(rename = "configId")]
pub config_id: StorageConfigId,
#[serde(rename = "createdAt")]
pub created_at: ::chrono::DateTime<::chrono::offset::Utc>,
pub size: ::std::num::NonZeroU64,
}
impl ResponseLargestBlobsItem {
pub fn builder() -> builder::ResponseLargestBlobsItem {
Default::default()
}
}
///Where the room's blobs are.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ResponseStorage {
#[serde(rename = "configId")]
pub config_id: StorageConfigId,
#[serde(rename = "earlierConfigs")]
pub earlier_configs: ::std::vec::Vec<ConfigHoldings>,
///Present while the room has a migration `queued`, `running` or `paused`; MAY remain, `complete` or `failed`, for the room's most recent finished one.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub migration: ::std::option::Option<MigrationProgress>,
}
impl ResponseStorage {
pub fn builder() -> builder::ResponseStorage {
Default::default()
}
}
///`ResponseUsage`
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ResponseUsage {
pub orphans: ResponseUsageOrphans,
pub room: Usage,
}
impl ResponseUsage {
pub fn builder() -> builder::ResponseUsage {
Default::default()
}
}
///Blobs no record names, awaiting deletion after the grace window.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ResponseUsageOrphans {
pub bytes: u64,
pub files: u64,
#[serde(
rename = "oldestOrphanedAt",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub oldest_orphaned_at: ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
}
impl ResponseUsageOrphans {
pub fn builder() -> builder::ResponseUsageOrphans {
Default::default()
}
}
///Whether a room keeps its history readable across a membership change, fixed at creation and immutable thereafter — like `Visibility`, and for the same reason: the rungs of an epoch key chain either exist for an epoch or they do not, and no later change of mind can seal key material that was never sealed or unseal what was already severed. `chained`: each advance produces an `EpochLink`, so every member reads the room's whole retained history however long they have been in it — what a **library** wants, at the cost of post-compromise security for record content, since a compromised current key then reaches every retained epoch. `fromJoin`: no rungs are produced, so a member reads only from the epoch their group state is at — what a **stream** wants, and what a room under a strict forward-secrecy obligation wants, at the cost that a joining member finds an empty-looking room and nobody can reread a record once their group state has moved past the epoch it was sealed under. Absent means `chained`; see the prose on why the absent case is the readable one.
///
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum RetentionPolicy {
#[serde(rename = "chained")]
Chained,
#[serde(rename = "fromJoin")]
FromJoin,
}
impl ::std::fmt::Display for RetentionPolicy {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Chained => f.write_str("chained"),
Self::FromJoin => f.write_str("fromJoin"),
}
}
}
impl ::std::str::FromStr for RetentionPolicy {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"chained" => Ok(Self::Chained),
"fromJoin" => Ok(Self::FromJoin),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for RetentionPolicy {
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 RetentionPolicy {
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 RetentionPolicy {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///How much a host is willing to store for one room, at the room and per member. A hosting decision, set by the host and never by anything in the room's credentials. An upload must fit every scope at once: the object against the smallest `maxFileBytes` that applies, and the member and the room with the file added.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct RoomLimits {
///False refuses every rooms/blobs/* upload for the room. Reads of blobs already stored continue.
#[serde(rename = "filesEnabled")]
pub files_enabled: bool,
///Limits on each member's own uploads in this room, unless that member has an override. A member is the subject at the root of the authority chain they present, never the key that signed, so an agent acting on an attenuated chain spends its member's allowance. Not applied on a `private` room, where the host cannot tell members apart; the room and object limits still hold there.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub member: ::std::option::Option<ScopeLimits>,
///Limits on the room as a whole.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub room: ::std::option::Option<ScopeLimits>,
}
impl RoomLimits {
pub fn builder() -> builder::RoomLimits {
Default::default()
}
}
///Limits at one scope. Every member is optional: an absent member means the scope sets no limit of that kind, and the next wider scope's limit, or the host's ceiling, governs. All sizes are ciphertext bytes.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ScopeLimits {
///The total size of the committed and reserved blobs the scope may hold.
#[serde(
rename = "maxBytes",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub max_bytes: ::std::option::Option<u64>,
///The largest single blob the scope accepts. Never above 1 GiB, the transfer ceiling (BlobManifest).
#[serde(
rename = "maxFileBytes",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub max_file_bytes: ::std::option::Option<i64>,
///The number of committed blobs the scope may hold. 0 refuses every upload at this scope.
#[serde(
rename = "maxFiles",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub max_files: ::std::option::Option<u64>,
}
impl ::std::default::Default for ScopeLimits {
fn default() -> Self {
Self {
max_bytes: Default::default(),
max_file_bytes: Default::default(),
max_files: Default::default(),
}
}
}
impl ScopeLimits {
pub fn builder() -> builder::ScopeLimits {
Default::default()
}
}
///A storage config's identifier, chosen by the administrator who creates it and immutable thereafter: lowercase letters, digits and inner hyphens, at most 64 characters (`eu-s3-primary`, `walrus-main`). Unique within the community. Never reused after a config is retired, because blobs name their config by this value.
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct StorageConfigId(::std::string::String);
impl ::std::ops::Deref for StorageConfigId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<StorageConfigId> for ::std::string::String {
fn from(value: StorageConfigId) -> Self {
value.0
}
}
impl ::std::str::FromStr for StorageConfigId {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 64usize {
return Err("longer than 64 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("^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$").unwrap()
});
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for StorageConfigId {
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 StorageConfigId {
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 StorageConfigId {
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 StorageConfigId {
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 one scope holds now. Ciphertext bytes throughout.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Usage {
///Their total size. A blob stops counting the moment it is orphaned (its last record dropped it or was retracted), not when the host finally deletes it, so a member who deletes a file has the room back at once.
pub bytes: u64,
///Committed blobs that are not orphaned.
pub files: u64,
///Bytes reserved by uploads begun and not yet committed, aborted or expired. Counted against `maxBytes`, so two concurrent uploads cannot both fit under a limit only one of them fits.
#[serde(rename = "reservedBytes")]
pub reserved_bytes: u64,
///Uploads begun and not yet committed, aborted or expired. Counted against `maxFiles`.
#[serde(
rename = "reservedFiles",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub reserved_files: ::std::option::Option<u64>,
}
impl Usage {
pub fn builder() -> builder::Usage {
Default::default()
}
}
///How much of a room its host can see, fixed at creation and immutable thereafter. `open`: records are cleartext, searchable and fully audited. `attributed`: record content is sealed, and the host still learns which member acted. `private`: content is sealed and membership is presented in zero knowledge, so the host verifies that a member acted without learning which. Immutable because a downgrade cannot un-see cleartext and an upgrade would protect only what came after while presenting as though it protected everything.
///
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum Visibility {
#[serde(rename = "open")]
Open,
#[serde(rename = "attributed")]
Attributed,
#[serde(rename = "private")]
Private,
}
impl ::std::fmt::Display for Visibility {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Open => f.write_str("open"),
Self::Attributed => f.write_str("attributed"),
Self::Private => f.write_str("private"),
}
}
}
impl ::std::str::FromStr for Visibility {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"open" => Ok(Self::Open),
"attributed" => Ok(Self::Attributed),
"private" => Ok(Self::Private),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for Visibility {
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 Visibility {
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 Visibility {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
/// Types for composing complex structures.
pub mod builder {
#[derive(Clone, Debug)]
pub struct ConfigHoldings {
bytes: ::std::result::Result<u64, ::std::string::String>,
config_id: ::std::result::Result<super::StorageConfigId, ::std::string::String>,
files: ::std::result::Result<u64, ::std::string::String>,
}
impl ::std::default::Default for ConfigHoldings {
fn default() -> Self {
Self {
bytes: Err("no value supplied for bytes".to_string()),
config_id: Err("no value supplied for config_id".to_string()),
files: Err("no value supplied for files".to_string()),
}
}
}
impl ConfigHoldings {
pub fn bytes<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.bytes = value
.try_into()
.map_err(|e| format!("error converting supplied value for bytes: {e}"));
self
}
pub fn config_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::StorageConfigId>,
T::Error: ::std::fmt::Display,
{
self.config_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for config_id: {e}"));
self
}
pub fn files<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.files = value
.try_into()
.map_err(|e| format!("error converting supplied value for files: {e}"));
self
}
}
impl ::std::convert::TryFrom<ConfigHoldings> for super::ConfigHoldings {
type Error = super::error::ConversionError;
fn try_from(
value: ConfigHoldings,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
bytes: value.bytes?,
config_id: value.config_id?,
files: value.files?,
})
}
}
impl ::std::convert::From<super::ConfigHoldings> for ConfigHoldings {
fn from(value: super::ConfigHoldings) -> Self {
Self {
bytes: Ok(value.bytes),
config_id: Ok(value.config_id),
files: Ok(value.files),
}
}
}
#[derive(Clone, Debug)]
pub struct EffectiveLimits {
host_ceiling_bytes:
::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
limits: ::std::result::Result<super::RoomLimits, ::std::string::String>,
member_source: ::std::result::Result<super::LimitSource, ::std::string::String>,
room_source: ::std::result::Result<super::LimitSource, ::std::string::String>,
}
impl ::std::default::Default for EffectiveLimits {
fn default() -> Self {
Self {
host_ceiling_bytes: Ok(Default::default()),
limits: Err("no value supplied for limits".to_string()),
member_source: Err("no value supplied for member_source".to_string()),
room_source: Err("no value supplied for room_source".to_string()),
}
}
}
impl EffectiveLimits {
pub fn host_ceiling_bytes<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<i64>>,
T::Error: ::std::fmt::Display,
{
self.host_ceiling_bytes = value.try_into().map_err(|e| {
format!("error converting supplied value for host_ceiling_bytes: {e}")
});
self
}
pub fn limits<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::RoomLimits>,
T::Error: ::std::fmt::Display,
{
self.limits = value
.try_into()
.map_err(|e| format!("error converting supplied value for limits: {e}"));
self
}
pub fn member_source<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::LimitSource>,
T::Error: ::std::fmt::Display,
{
self.member_source = value
.try_into()
.map_err(|e| format!("error converting supplied value for member_source: {e}"));
self
}
pub fn room_source<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::LimitSource>,
T::Error: ::std::fmt::Display,
{
self.room_source = value
.try_into()
.map_err(|e| format!("error converting supplied value for room_source: {e}"));
self
}
}
impl ::std::convert::TryFrom<EffectiveLimits> for super::EffectiveLimits {
type Error = super::error::ConversionError;
fn try_from(
value: EffectiveLimits,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
host_ceiling_bytes: value.host_ceiling_bytes?,
limits: value.limits?,
member_source: value.member_source?,
room_source: value.room_source?,
})
}
}
impl ::std::convert::From<super::EffectiveLimits> for EffectiveLimits {
fn from(value: super::EffectiveLimits) -> Self {
Self {
host_ceiling_bytes: Ok(value.host_ceiling_bytes),
limits: Ok(value.limits),
member_source: Ok(value.member_source),
room_source: Ok(value.room_source),
}
}
}
#[derive(Clone, Debug)]
pub struct HostedRoom {
created_at: ::std::result::Result<u64, ::std::string::String>,
epoch: ::std::result::Result<u64, ::std::string::String>,
epoch_expires_at: ::std::result::Result<::std::option::Option<u64>, ::std::string::String>,
lifecycle: ::std::result::Result<super::HostedRoomLifecycle, ::std::string::String>,
mirror_of: ::std::result::Result<
::std::option::Option<super::HostedRoomMirrorOf>,
::std::string::String,
>,
owner_did: ::std::result::Result<super::HostedRoomOwnerDid, ::std::string::String>,
retention_days: ::std::result::Result<u64, ::std::string::String>,
retention_policy: ::std::result::Result<super::RetentionPolicy, ::std::string::String>,
room_id: ::std::result::Result<super::HostedRoomRoomId, ::std::string::String>,
updated_at: ::std::result::Result<u64, ::std::string::String>,
visibility: ::std::result::Result<super::Visibility, ::std::string::String>,
}
impl ::std::default::Default for HostedRoom {
fn default() -> Self {
Self {
created_at: Err("no value supplied for created_at".to_string()),
epoch: Err("no value supplied for epoch".to_string()),
epoch_expires_at: Ok(Default::default()),
lifecycle: Err("no value supplied for lifecycle".to_string()),
mirror_of: Ok(Default::default()),
owner_did: Err("no value supplied for owner_did".to_string()),
retention_days: Err("no value supplied for retention_days".to_string()),
retention_policy: Err("no value supplied for retention_policy".to_string()),
room_id: Err("no value supplied for room_id".to_string()),
updated_at: Err("no value supplied for updated_at".to_string()),
visibility: Err("no value supplied for visibility".to_string()),
}
}
}
impl HostedRoom {
pub fn created_at<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.created_at = value
.try_into()
.map_err(|e| format!("error converting supplied value for created_at: {e}"));
self
}
pub fn epoch<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.epoch = value
.try_into()
.map_err(|e| format!("error converting supplied value for epoch: {e}"));
self
}
pub fn epoch_expires_at<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<u64>>,
T::Error: ::std::fmt::Display,
{
self.epoch_expires_at = value
.try_into()
.map_err(|e| format!("error converting supplied value for epoch_expires_at: {e}"));
self
}
pub fn lifecycle<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::HostedRoomLifecycle>,
T::Error: ::std::fmt::Display,
{
self.lifecycle = value
.try_into()
.map_err(|e| format!("error converting supplied value for lifecycle: {e}"));
self
}
pub fn mirror_of<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::HostedRoomMirrorOf>>,
T::Error: ::std::fmt::Display,
{
self.mirror_of = value
.try_into()
.map_err(|e| format!("error converting supplied value for mirror_of: {e}"));
self
}
pub fn owner_did<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::HostedRoomOwnerDid>,
T::Error: ::std::fmt::Display,
{
self.owner_did = value
.try_into()
.map_err(|e| format!("error converting supplied value for owner_did: {e}"));
self
}
pub fn retention_days<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.retention_days = value
.try_into()
.map_err(|e| format!("error converting supplied value for retention_days: {e}"));
self
}
pub fn retention_policy<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::RetentionPolicy>,
T::Error: ::std::fmt::Display,
{
self.retention_policy = value
.try_into()
.map_err(|e| format!("error converting supplied value for retention_policy: {e}"));
self
}
pub fn room_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::HostedRoomRoomId>,
T::Error: ::std::fmt::Display,
{
self.room_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for room_id: {e}"));
self
}
pub fn updated_at<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.updated_at = value
.try_into()
.map_err(|e| format!("error converting supplied value for updated_at: {e}"));
self
}
pub fn visibility<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::Visibility>,
T::Error: ::std::fmt::Display,
{
self.visibility = value
.try_into()
.map_err(|e| format!("error converting supplied value for visibility: {e}"));
self
}
}
impl ::std::convert::TryFrom<HostedRoom> for super::HostedRoom {
type Error = super::error::ConversionError;
fn try_from(
value: HostedRoom,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
created_at: value.created_at?,
epoch: value.epoch?,
epoch_expires_at: value.epoch_expires_at?,
lifecycle: value.lifecycle?,
mirror_of: value.mirror_of?,
owner_did: value.owner_did?,
retention_days: value.retention_days?,
retention_policy: value.retention_policy?,
room_id: value.room_id?,
updated_at: value.updated_at?,
visibility: value.visibility?,
})
}
}
impl ::std::convert::From<super::HostedRoom> for HostedRoom {
fn from(value: super::HostedRoom) -> Self {
Self {
created_at: Ok(value.created_at),
epoch: Ok(value.epoch),
epoch_expires_at: Ok(value.epoch_expires_at),
lifecycle: Ok(value.lifecycle),
mirror_of: Ok(value.mirror_of),
owner_did: Ok(value.owner_did),
retention_days: Ok(value.retention_days),
retention_policy: Ok(value.retention_policy),
room_id: Ok(value.room_id),
updated_at: Ok(value.updated_at),
visibility: Ok(value.visibility),
}
}
}
#[derive(Clone, Debug)]
pub struct MigrationProgress {
done_bytes: ::std::result::Result<u64, ::std::string::String>,
done_files: ::std::result::Result<u64, ::std::string::String>,
last_error: ::std::result::Result<
::std::option::Option<super::MigrationLastError>,
::std::string::String,
>,
migration_id:
::std::result::Result<super::MigrationProgressMigrationId, ::std::string::String>,
next_attempt_at: ::std::result::Result<
::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
::std::string::String,
>,
paused_cause: ::std::result::Result<
::std::option::Option<super::MigrationPauseCause>,
::std::string::String,
>,
state: ::std::result::Result<super::MigrationState, ::std::string::String>,
to_config: ::std::result::Result<super::StorageConfigId, ::std::string::String>,
total_bytes: ::std::result::Result<u64, ::std::string::String>,
total_files: ::std::result::Result<u64, ::std::string::String>,
}
impl ::std::default::Default for MigrationProgress {
fn default() -> Self {
Self {
done_bytes: Err("no value supplied for done_bytes".to_string()),
done_files: Err("no value supplied for done_files".to_string()),
last_error: Ok(Default::default()),
migration_id: Err("no value supplied for migration_id".to_string()),
next_attempt_at: Ok(Default::default()),
paused_cause: Ok(Default::default()),
state: Err("no value supplied for state".to_string()),
to_config: Err("no value supplied for to_config".to_string()),
total_bytes: Err("no value supplied for total_bytes".to_string()),
total_files: Err("no value supplied for total_files".to_string()),
}
}
}
impl MigrationProgress {
pub fn done_bytes<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.done_bytes = value
.try_into()
.map_err(|e| format!("error converting supplied value for done_bytes: {e}"));
self
}
pub fn done_files<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.done_files = value
.try_into()
.map_err(|e| format!("error converting supplied value for done_files: {e}"));
self
}
pub fn last_error<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::MigrationLastError>>,
T::Error: ::std::fmt::Display,
{
self.last_error = value
.try_into()
.map_err(|e| format!("error converting supplied value for last_error: {e}"));
self
}
pub fn migration_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::MigrationProgressMigrationId>,
T::Error: ::std::fmt::Display,
{
self.migration_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for migration_id: {e}"));
self
}
pub fn next_attempt_at<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
>,
T::Error: ::std::fmt::Display,
{
self.next_attempt_at = value
.try_into()
.map_err(|e| format!("error converting supplied value for next_attempt_at: {e}"));
self
}
pub fn paused_cause<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::MigrationPauseCause>>,
T::Error: ::std::fmt::Display,
{
self.paused_cause = value
.try_into()
.map_err(|e| format!("error converting supplied value for paused_cause: {e}"));
self
}
pub fn state<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::MigrationState>,
T::Error: ::std::fmt::Display,
{
self.state = value
.try_into()
.map_err(|e| format!("error converting supplied value for state: {e}"));
self
}
pub fn to_config<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::StorageConfigId>,
T::Error: ::std::fmt::Display,
{
self.to_config = value
.try_into()
.map_err(|e| format!("error converting supplied value for to_config: {e}"));
self
}
pub fn total_bytes<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.total_bytes = value
.try_into()
.map_err(|e| format!("error converting supplied value for total_bytes: {e}"));
self
}
pub fn total_files<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.total_files = value
.try_into()
.map_err(|e| format!("error converting supplied value for total_files: {e}"));
self
}
}
impl ::std::convert::TryFrom<MigrationProgress> for super::MigrationProgress {
type Error = super::error::ConversionError;
fn try_from(
value: MigrationProgress,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
done_bytes: value.done_bytes?,
done_files: value.done_files?,
last_error: value.last_error?,
migration_id: value.migration_id?,
next_attempt_at: value.next_attempt_at?,
paused_cause: value.paused_cause?,
state: value.state?,
to_config: value.to_config?,
total_bytes: value.total_bytes?,
total_files: value.total_files?,
})
}
}
impl ::std::convert::From<super::MigrationProgress> for MigrationProgress {
fn from(value: super::MigrationProgress) -> Self {
Self {
done_bytes: Ok(value.done_bytes),
done_files: Ok(value.done_files),
last_error: Ok(value.last_error),
migration_id: Ok(value.migration_id),
next_attempt_at: Ok(value.next_attempt_at),
paused_cause: Ok(value.paused_cause),
state: Ok(value.state),
to_config: Ok(value.to_config),
total_bytes: Ok(value.total_bytes),
total_files: Ok(value.total_files),
}
}
}
#[derive(Clone, Debug)]
pub struct Payload {
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
room_id: ::std::result::Result<super::PayloadRoomId, ::std::string::String>,
}
impl ::std::default::Default for Payload {
fn default() -> Self {
Self {
ext: Ok(Default::default()),
room_id: Err("no value supplied for room_id".to_string()),
}
}
}
impl Payload {
pub fn ext<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::Ext>>,
T::Error: ::std::fmt::Display,
{
self.ext = value
.try_into()
.map_err(|e| format!("error converting supplied value for ext: {e}"));
self
}
pub fn room_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::PayloadRoomId>,
T::Error: ::std::fmt::Display,
{
self.room_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for room_id: {e}"));
self
}
}
impl ::std::convert::TryFrom<Payload> for super::Payload {
type Error = super::error::ConversionError;
fn try_from(value: Payload) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
ext: value.ext?,
room_id: value.room_id?,
})
}
}
impl ::std::convert::From<super::Payload> for Payload {
fn from(value: super::Payload) -> Self {
Self {
ext: Ok(value.ext),
room_id: Ok(value.room_id),
}
}
}
#[derive(Clone, Debug)]
pub struct Response {
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
largest_blobs: ::std::result::Result<
::std::vec::Vec<super::ResponseLargestBlobsItem>,
::std::string::String,
>,
limits: ::std::result::Result<super::EffectiveLimits, ::std::string::String>,
members_with_usage:
::std::result::Result<::std::option::Option<u64>, ::std::string::String>,
room: ::std::result::Result<super::HostedRoom, ::std::string::String>,
storage: ::std::result::Result<super::ResponseStorage, ::std::string::String>,
usage: ::std::result::Result<super::ResponseUsage, ::std::string::String>,
}
impl ::std::default::Default for Response {
fn default() -> Self {
Self {
ext: Ok(Default::default()),
largest_blobs: Ok(Default::default()),
limits: Err("no value supplied for limits".to_string()),
members_with_usage: Ok(Default::default()),
room: Err("no value supplied for room".to_string()),
storage: Err("no value supplied for storage".to_string()),
usage: Err("no value supplied for usage".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 largest_blobs<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::ResponseLargestBlobsItem>>,
T::Error: ::std::fmt::Display,
{
self.largest_blobs = value
.try_into()
.map_err(|e| format!("error converting supplied value for largest_blobs: {e}"));
self
}
pub fn limits<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::EffectiveLimits>,
T::Error: ::std::fmt::Display,
{
self.limits = value
.try_into()
.map_err(|e| format!("error converting supplied value for limits: {e}"));
self
}
pub fn members_with_usage<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<u64>>,
T::Error: ::std::fmt::Display,
{
self.members_with_usage = value.try_into().map_err(|e| {
format!("error converting supplied value for members_with_usage: {e}")
});
self
}
pub fn room<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::HostedRoom>,
T::Error: ::std::fmt::Display,
{
self.room = value
.try_into()
.map_err(|e| format!("error converting supplied value for room: {e}"));
self
}
pub fn storage<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ResponseStorage>,
T::Error: ::std::fmt::Display,
{
self.storage = value
.try_into()
.map_err(|e| format!("error converting supplied value for storage: {e}"));
self
}
pub fn usage<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ResponseUsage>,
T::Error: ::std::fmt::Display,
{
self.usage = value
.try_into()
.map_err(|e| format!("error converting supplied value for usage: {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?,
largest_blobs: value.largest_blobs?,
limits: value.limits?,
members_with_usage: value.members_with_usage?,
room: value.room?,
storage: value.storage?,
usage: value.usage?,
})
}
}
impl ::std::convert::From<super::Response> for Response {
fn from(value: super::Response) -> Self {
Self {
ext: Ok(value.ext),
largest_blobs: Ok(value.largest_blobs),
limits: Ok(value.limits),
members_with_usage: Ok(value.members_with_usage),
room: Ok(value.room),
storage: Ok(value.storage),
usage: Ok(value.usage),
}
}
}
#[derive(Clone, Debug)]
pub struct ResponseLargestBlobsItem {
config_id: ::std::result::Result<super::StorageConfigId, ::std::string::String>,
created_at:
::std::result::Result<::chrono::DateTime<::chrono::offset::Utc>, ::std::string::String>,
size: ::std::result::Result<::std::num::NonZeroU64, ::std::string::String>,
}
impl ::std::default::Default for ResponseLargestBlobsItem {
fn default() -> Self {
Self {
config_id: Err("no value supplied for config_id".to_string()),
created_at: Err("no value supplied for created_at".to_string()),
size: Err("no value supplied for size".to_string()),
}
}
}
impl ResponseLargestBlobsItem {
pub fn config_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::StorageConfigId>,
T::Error: ::std::fmt::Display,
{
self.config_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for config_id: {e}"));
self
}
pub fn created_at<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
T::Error: ::std::fmt::Display,
{
self.created_at = value
.try_into()
.map_err(|e| format!("error converting supplied value for created_at: {e}"));
self
}
pub fn size<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::num::NonZeroU64>,
T::Error: ::std::fmt::Display,
{
self.size = value
.try_into()
.map_err(|e| format!("error converting supplied value for size: {e}"));
self
}
}
impl ::std::convert::TryFrom<ResponseLargestBlobsItem> for super::ResponseLargestBlobsItem {
type Error = super::error::ConversionError;
fn try_from(
value: ResponseLargestBlobsItem,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
config_id: value.config_id?,
created_at: value.created_at?,
size: value.size?,
})
}
}
impl ::std::convert::From<super::ResponseLargestBlobsItem> for ResponseLargestBlobsItem {
fn from(value: super::ResponseLargestBlobsItem) -> Self {
Self {
config_id: Ok(value.config_id),
created_at: Ok(value.created_at),
size: Ok(value.size),
}
}
}
#[derive(Clone, Debug)]
pub struct ResponseStorage {
config_id: ::std::result::Result<super::StorageConfigId, ::std::string::String>,
earlier_configs:
::std::result::Result<::std::vec::Vec<super::ConfigHoldings>, ::std::string::String>,
migration: ::std::result::Result<
::std::option::Option<super::MigrationProgress>,
::std::string::String,
>,
}
impl ::std::default::Default for ResponseStorage {
fn default() -> Self {
Self {
config_id: Err("no value supplied for config_id".to_string()),
earlier_configs: Err("no value supplied for earlier_configs".to_string()),
migration: Ok(Default::default()),
}
}
}
impl ResponseStorage {
pub fn config_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::StorageConfigId>,
T::Error: ::std::fmt::Display,
{
self.config_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for config_id: {e}"));
self
}
pub fn earlier_configs<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::ConfigHoldings>>,
T::Error: ::std::fmt::Display,
{
self.earlier_configs = value
.try_into()
.map_err(|e| format!("error converting supplied value for earlier_configs: {e}"));
self
}
pub fn migration<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::MigrationProgress>>,
T::Error: ::std::fmt::Display,
{
self.migration = value
.try_into()
.map_err(|e| format!("error converting supplied value for migration: {e}"));
self
}
}
impl ::std::convert::TryFrom<ResponseStorage> for super::ResponseStorage {
type Error = super::error::ConversionError;
fn try_from(
value: ResponseStorage,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
config_id: value.config_id?,
earlier_configs: value.earlier_configs?,
migration: value.migration?,
})
}
}
impl ::std::convert::From<super::ResponseStorage> for ResponseStorage {
fn from(value: super::ResponseStorage) -> Self {
Self {
config_id: Ok(value.config_id),
earlier_configs: Ok(value.earlier_configs),
migration: Ok(value.migration),
}
}
}
#[derive(Clone, Debug)]
pub struct ResponseUsage {
orphans: ::std::result::Result<super::ResponseUsageOrphans, ::std::string::String>,
room: ::std::result::Result<super::Usage, ::std::string::String>,
}
impl ::std::default::Default for ResponseUsage {
fn default() -> Self {
Self {
orphans: Err("no value supplied for orphans".to_string()),
room: Err("no value supplied for room".to_string()),
}
}
}
impl ResponseUsage {
pub fn orphans<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ResponseUsageOrphans>,
T::Error: ::std::fmt::Display,
{
self.orphans = value
.try_into()
.map_err(|e| format!("error converting supplied value for orphans: {e}"));
self
}
pub fn room<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::Usage>,
T::Error: ::std::fmt::Display,
{
self.room = value
.try_into()
.map_err(|e| format!("error converting supplied value for room: {e}"));
self
}
}
impl ::std::convert::TryFrom<ResponseUsage> for super::ResponseUsage {
type Error = super::error::ConversionError;
fn try_from(
value: ResponseUsage,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
orphans: value.orphans?,
room: value.room?,
})
}
}
impl ::std::convert::From<super::ResponseUsage> for ResponseUsage {
fn from(value: super::ResponseUsage) -> Self {
Self {
orphans: Ok(value.orphans),
room: Ok(value.room),
}
}
}
#[derive(Clone, Debug)]
pub struct ResponseUsageOrphans {
bytes: ::std::result::Result<u64, ::std::string::String>,
files: ::std::result::Result<u64, ::std::string::String>,
oldest_orphaned_at: ::std::result::Result<
::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
::std::string::String,
>,
}
impl ::std::default::Default for ResponseUsageOrphans {
fn default() -> Self {
Self {
bytes: Err("no value supplied for bytes".to_string()),
files: Err("no value supplied for files".to_string()),
oldest_orphaned_at: Ok(Default::default()),
}
}
}
impl ResponseUsageOrphans {
pub fn bytes<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.bytes = value
.try_into()
.map_err(|e| format!("error converting supplied value for bytes: {e}"));
self
}
pub fn files<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.files = value
.try_into()
.map_err(|e| format!("error converting supplied value for files: {e}"));
self
}
pub fn oldest_orphaned_at<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
>,
T::Error: ::std::fmt::Display,
{
self.oldest_orphaned_at = value.try_into().map_err(|e| {
format!("error converting supplied value for oldest_orphaned_at: {e}")
});
self
}
}
impl ::std::convert::TryFrom<ResponseUsageOrphans> for super::ResponseUsageOrphans {
type Error = super::error::ConversionError;
fn try_from(
value: ResponseUsageOrphans,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
bytes: value.bytes?,
files: value.files?,
oldest_orphaned_at: value.oldest_orphaned_at?,
})
}
}
impl ::std::convert::From<super::ResponseUsageOrphans> for ResponseUsageOrphans {
fn from(value: super::ResponseUsageOrphans) -> Self {
Self {
bytes: Ok(value.bytes),
files: Ok(value.files),
oldest_orphaned_at: Ok(value.oldest_orphaned_at),
}
}
}
#[derive(Clone, Debug)]
pub struct RoomLimits {
files_enabled: ::std::result::Result<bool, ::std::string::String>,
member:
::std::result::Result<::std::option::Option<super::ScopeLimits>, ::std::string::String>,
room:
::std::result::Result<::std::option::Option<super::ScopeLimits>, ::std::string::String>,
}
impl ::std::default::Default for RoomLimits {
fn default() -> Self {
Self {
files_enabled: Err("no value supplied for files_enabled".to_string()),
member: Ok(Default::default()),
room: Ok(Default::default()),
}
}
}
impl RoomLimits {
pub fn files_enabled<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<bool>,
T::Error: ::std::fmt::Display,
{
self.files_enabled = value
.try_into()
.map_err(|e| format!("error converting supplied value for files_enabled: {e}"));
self
}
pub fn member<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::ScopeLimits>>,
T::Error: ::std::fmt::Display,
{
self.member = value
.try_into()
.map_err(|e| format!("error converting supplied value for member: {e}"));
self
}
pub fn room<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::ScopeLimits>>,
T::Error: ::std::fmt::Display,
{
self.room = value
.try_into()
.map_err(|e| format!("error converting supplied value for room: {e}"));
self
}
}
impl ::std::convert::TryFrom<RoomLimits> for super::RoomLimits {
type Error = super::error::ConversionError;
fn try_from(
value: RoomLimits,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
files_enabled: value.files_enabled?,
member: value.member?,
room: value.room?,
})
}
}
impl ::std::convert::From<super::RoomLimits> for RoomLimits {
fn from(value: super::RoomLimits) -> Self {
Self {
files_enabled: Ok(value.files_enabled),
member: Ok(value.member),
room: Ok(value.room),
}
}
}
#[derive(Clone, Debug)]
pub struct ScopeLimits {
max_bytes: ::std::result::Result<::std::option::Option<u64>, ::std::string::String>,
max_file_bytes: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
max_files: ::std::result::Result<::std::option::Option<u64>, ::std::string::String>,
}
impl ::std::default::Default for ScopeLimits {
fn default() -> Self {
Self {
max_bytes: Ok(Default::default()),
max_file_bytes: Ok(Default::default()),
max_files: Ok(Default::default()),
}
}
}
impl ScopeLimits {
pub fn max_bytes<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<u64>>,
T::Error: ::std::fmt::Display,
{
self.max_bytes = value
.try_into()
.map_err(|e| format!("error converting supplied value for max_bytes: {e}"));
self
}
pub fn max_file_bytes<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<i64>>,
T::Error: ::std::fmt::Display,
{
self.max_file_bytes = value
.try_into()
.map_err(|e| format!("error converting supplied value for max_file_bytes: {e}"));
self
}
pub fn max_files<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<u64>>,
T::Error: ::std::fmt::Display,
{
self.max_files = value
.try_into()
.map_err(|e| format!("error converting supplied value for max_files: {e}"));
self
}
}
impl ::std::convert::TryFrom<ScopeLimits> for super::ScopeLimits {
type Error = super::error::ConversionError;
fn try_from(
value: ScopeLimits,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
max_bytes: value.max_bytes?,
max_file_bytes: value.max_file_bytes?,
max_files: value.max_files?,
})
}
}
impl ::std::convert::From<super::ScopeLimits> for ScopeLimits {
fn from(value: super::ScopeLimits) -> Self {
Self {
max_bytes: Ok(value.max_bytes),
max_file_bytes: Ok(value.max_file_bytes),
max_files: Ok(value.max_files),
}
}
}
#[derive(Clone, Debug)]
pub struct Usage {
bytes: ::std::result::Result<u64, ::std::string::String>,
files: ::std::result::Result<u64, ::std::string::String>,
reserved_bytes: ::std::result::Result<u64, ::std::string::String>,
reserved_files: ::std::result::Result<::std::option::Option<u64>, ::std::string::String>,
}
impl ::std::default::Default for Usage {
fn default() -> Self {
Self {
bytes: Err("no value supplied for bytes".to_string()),
files: Err("no value supplied for files".to_string()),
reserved_bytes: Err("no value supplied for reserved_bytes".to_string()),
reserved_files: Ok(Default::default()),
}
}
}
impl Usage {
pub fn bytes<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.bytes = value
.try_into()
.map_err(|e| format!("error converting supplied value for bytes: {e}"));
self
}
pub fn files<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.files = value
.try_into()
.map_err(|e| format!("error converting supplied value for files: {e}"));
self
}
pub fn reserved_bytes<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.reserved_bytes = value
.try_into()
.map_err(|e| format!("error converting supplied value for reserved_bytes: {e}"));
self
}
pub fn reserved_files<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<u64>>,
T::Error: ::std::fmt::Display,
{
self.reserved_files = value
.try_into()
.map_err(|e| format!("error converting supplied value for reserved_files: {e}"));
self
}
}
impl ::std::convert::TryFrom<Usage> for super::Usage {
type Error = super::error::ConversionError;
fn try_from(value: Usage) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
bytes: value.bytes?,
files: value.files?,
reserved_bytes: value.reserved_bytes?,
reserved_files: value.reserved_files?,
})
}
}
impl ::std::convert::From<super::Usage> for Usage {
fn from(value: super::Usage) -> Self {
Self {
bytes: Ok(value.bytes),
files: Ok(value.files),
reserved_bytes: Ok(value.reserved_bytes),
reserved_files: Ok(value.reserved_files),
}
}
}
}
impl crate::Payload for Payload {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/vtc/rooms/get/0.2";
const IS_RECIPIENT_REQUIRED: bool = true;
const PAYLOAD_SCHEMA: Option<&'static str> = Some(
"{\"$defs\":{\"ConfigHoldings\":{\"additionalProperties\":false,\"description\":\"A config holding some of this room's blobs, other than the one it is assigned to.\",\"properties\":{\"bytes\":{\"minimum\":0,\"type\":\"integer\"},\"configId\":{\"$ref\":\"#/$defs/StorageConfigId\"},\"files\":{\"minimum\":0,\"type\":\"integer\"}},\"required\":[\"configId\",\"files\",\"bytes\"],\"type\":\"object\"},\"EffectiveLimits\":{\"additionalProperties\":false,\"description\":\"The limits a room is enforced against now, with where each scope's came from.\",\"properties\":{\"hostCeilingBytes\":{\"description\":\"The host-wide largest-file ceiling, which no room or member limit can exceed.\",\"maximum\":1073741824,\"minimum\":0,\"type\":\"integer\"},\"limits\":{\"$ref\":\"#/$defs/RoomLimits\"},\"memberSource\":{\"$ref\":\"#/$defs/LimitSource\"},\"roomSource\":{\"$ref\":\"#/$defs/LimitSource\"}},\"required\":[\"limits\",\"roomSource\",\"memberSource\"],\"title\":\"EffectiveLimits\",\"type\":\"object\"},\"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\"},\"HostedRoom\":{\"additionalProperties\":false,\"description\":\"One room, as its host holds it — member for member the `HostedRoom` of vtc/rooms/list/0.1, which defines it inside its own payload schema. Nothing derived from the room's contents, and no member list: the host has none.\",\"properties\":{\"createdAt\":{\"minimum\":0,\"type\":\"integer\"},\"epoch\":{\"minimum\":0,\"type\":\"integer\"},\"epochExpiresAt\":{\"minimum\":0,\"type\":\"integer\"},\"lifecycle\":{\"enum\":[\"live\",\"lapsed\",\"dormant\",\"reclaimable\"],\"type\":\"string\"},\"mirrorOf\":{\"maxLength\":2048,\"minLength\":1,\"type\":\"string\"},\"ownerDid\":{\"maxLength\":2048,\"pattern\":\"^did:\",\"type\":\"string\"},\"retentionDays\":{\"minimum\":0,\"type\":\"integer\"},\"retentionPolicy\":{\"$ref\":\"#/$defs/RetentionPolicy\"},\"roomId\":{\"maxLength\":512,\"minLength\":1,\"type\":\"string\"},\"updatedAt\":{\"minimum\":0,\"type\":\"integer\"},\"visibility\":{\"$ref\":\"#/$defs/Visibility\"}},\"required\":[\"roomId\",\"ownerDid\",\"visibility\",\"retentionPolicy\",\"epoch\",\"lifecycle\",\"retentionDays\",\"createdAt\",\"updatedAt\"],\"title\":\"HostedRoom\",\"type\":\"object\"},\"LimitSource\":{\"description\":\"Where an effective limit came from. `policy`: the community's rooms policy at the room's creation. `override`: an administrator's vtc/rooms/limits/set. `default`: the community's configured defaults, where neither applies. The host-wide ceiling bounds all three.\",\"enum\":[\"policy\",\"override\",\"default\"],\"title\":\"LimitSource\",\"type\":\"string\"},\"MigrationLastError\":{\"description\":\"A one-line summary of the last failure, for an administrator: the step, the config and the backend's error code or status (`put to eu-s3-primary: 503 SlowDown`). Never a credential, a presigned URL, a signed request, a room identifier or anything derived from a room's contents.\",\"maxLength\":500,\"minLength\":1,\"title\":\"MigrationLastError\",\"type\":\"string\"},\"MigrationPauseCause\":{\"description\":\"Why a migration is `paused`. `capacity`: the destination config cannot hold the rest. `source`: a config the blobs are being moved off keeps failing to serve them. `destination`: the destination config keeps refusing writes, or is no longer `active`. `credential`: the community cannot obtain a credential for one of the configs.\",\"enum\":[\"capacity\",\"source\",\"destination\",\"credential\"],\"title\":\"MigrationPauseCause\",\"type\":\"string\"},\"MigrationProgress\":{\"additionalProperties\":false,\"description\":\"Progress of the room's migration, as vtc/rooms/storage/migrate reports it.\",\"properties\":{\"doneBytes\":{\"minimum\":0,\"type\":\"integer\"},\"doneFiles\":{\"minimum\":0,\"type\":\"integer\"},\"lastError\":{\"$ref\":\"#/$defs/MigrationLastError\",\"description\":\"Present when `state` is `paused`; MAY be present while `running`, when a step is being retried.\"},\"migrationId\":{\"pattern\":\"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$\",\"type\":\"string\"},\"nextAttemptAt\":{\"description\":\"When the community will next try by itself. Present while a `running` migration waits out a backoff, and on a `paused` one the community will retry unprompted; absent on a `paused` one only re-issuing vtc/rooms/storage/migrate resumes (such as `capacity`).\",\"format\":\"date-time\",\"type\":\"string\"},\"pausedCause\":{\"$ref\":\"#/$defs/MigrationPauseCause\",\"description\":\"Present exactly when `state` is `paused`.\"},\"state\":{\"$ref\":\"#/$defs/MigrationState\"},\"toConfig\":{\"$ref\":\"#/$defs/StorageConfigId\",\"description\":\"The config this migration moves blobs to. After a reassignment during the migration it differs from `storage.configId`.\"},\"totalBytes\":{\"minimum\":0,\"type\":\"integer\"},\"totalFiles\":{\"minimum\":0,\"type\":\"integer\"}},\"required\":[\"migrationId\",\"toConfig\",\"state\",\"totalFiles\",\"totalBytes\",\"doneFiles\",\"doneBytes\"],\"type\":\"object\"},\"MigrationState\":{\"description\":\"`queued`: approved and waiting for another migration on this community to finish; nothing copied yet (a community that runs one migration at a time). `running`: copying, including while it retries a failing step with backoff. `paused`: halted after its automatic retries reached their cap without success, or on a cause that retrying cannot clear (`pausedCause`); resumed by issuing vtc/rooms/storage/migrate again, and by the community itself at `nextAttemptAt` when present. `complete`: every blob that was to move has moved. `failed`: halted on a blob whose copy did not verify against its manifest; that blob stays where it was.\",\"enum\":[\"queued\",\"running\",\"paused\",\"complete\",\"failed\"],\"title\":\"MigrationState\",\"type\":\"string\"},\"Response\":{\"$anchor\":\"response\",\"additionalProperties\":false,\"properties\":{\"ext\":{\"$ref\":\"#/$defs/Ext\"},\"largestBlobs\":{\"description\":\"The room's largest committed blobs, by size only.\",\"items\":{\"additionalProperties\":false,\"properties\":{\"configId\":{\"$ref\":\"#/$defs/StorageConfigId\"},\"createdAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"size\":{\"minimum\":1,\"type\":\"integer\"}},\"required\":[\"size\",\"configId\",\"createdAt\"],\"type\":\"object\"},\"maxItems\":10,\"type\":\"array\"},\"limits\":{\"$ref\":\"#/$defs/EffectiveLimits\"},\"membersWithUsage\":{\"description\":\"On an `attributed` room only: how many members have added files. Absent on `open` and `private` rooms.\",\"minimum\":0,\"type\":\"integer\"},\"room\":{\"$ref\":\"#/$defs/HostedRoom\"},\"storage\":{\"additionalProperties\":false,\"description\":\"Where the room's blobs are.\",\"properties\":{\"configId\":{\"$ref\":\"#/$defs/StorageConfigId\"},\"earlierConfigs\":{\"items\":{\"$ref\":\"#/$defs/ConfigHoldings\"},\"maxItems\":64,\"type\":\"array\"},\"migration\":{\"$ref\":\"#/$defs/MigrationProgress\",\"description\":\"Present while the room has a migration `queued`, `running` or `paused`; MAY remain, `complete` or `failed`, for the room's most recent finished one.\"}},\"required\":[\"configId\",\"earlierConfigs\"],\"type\":\"object\"},\"usage\":{\"additionalProperties\":false,\"properties\":{\"orphans\":{\"additionalProperties\":false,\"description\":\"Blobs no record names, awaiting deletion after the grace window.\",\"properties\":{\"bytes\":{\"minimum\":0,\"type\":\"integer\"},\"files\":{\"minimum\":0,\"type\":\"integer\"},\"oldestOrphanedAt\":{\"format\":\"date-time\",\"type\":\"string\"}},\"required\":[\"files\",\"bytes\"],\"type\":\"object\"},\"room\":{\"$ref\":\"#/$defs/Usage\"}},\"required\":[\"room\",\"orphans\"],\"type\":\"object\"}},\"required\":[\"room\",\"storage\",\"limits\",\"usage\"],\"title\":\"VTC Rooms — Get — response payload\",\"type\":\"object\"},\"RetentionPolicy\":{\"$comment\":\"Deliberately no JSON Schema `default`. A declared default is materialised by the generated bindings — the member becomes non-optional with a serde default — so an absent value would reappear as an explicit one on re-serialisation and break round-trip idempotence for every document written before this member existed. The meaning of absence is stated in prose, where a binding cannot act on it.\",\"description\":\"Whether a room keeps its history readable across a membership change, fixed at creation and immutable thereafter — like `Visibility`, and for the same reason: the rungs of an epoch key chain either exist for an epoch or they do not, and no later change of mind can seal key material that was never sealed or unseal what was already severed. `chained`: each advance produces an `EpochLink`, so every member reads the room's whole retained history however long they have been in it — what a **library** wants, at the cost of post-compromise security for record content, since a compromised current key then reaches every retained epoch. `fromJoin`: no rungs are produced, so a member reads only from the epoch their group state is at — what a **stream** wants, and what a room under a strict forward-secrecy obligation wants, at the cost that a joining member finds an empty-looking room and nobody can reread a record once their group state has moved past the epoch it was sealed under. Absent means `chained`; see the prose on why the absent case is the readable one.\",\"enum\":[\"chained\",\"fromJoin\"],\"title\":\"RetentionPolicy\",\"type\":\"string\"},\"RoomLimits\":{\"additionalProperties\":false,\"description\":\"How much a host is willing to store for one room, at the room and per member. A hosting decision, set by the host and never by anything in the room's credentials. An upload must fit every scope at once: the object against the smallest `maxFileBytes` that applies, and the member and the room with the file added.\",\"properties\":{\"filesEnabled\":{\"description\":\"False refuses every rooms/blobs/* upload for the room. Reads of blobs already stored continue.\",\"type\":\"boolean\"},\"member\":{\"$ref\":\"#/$defs/ScopeLimits\",\"description\":\"Limits on each member's own uploads in this room, unless that member has an override. A member is the subject at the root of the authority chain they present, never the key that signed, so an agent acting on an attenuated chain spends its member's allowance. Not applied on a `private` room, where the host cannot tell members apart; the room and object limits still hold there.\"},\"room\":{\"$ref\":\"#/$defs/ScopeLimits\",\"description\":\"Limits on the room as a whole.\"}},\"required\":[\"filesEnabled\"],\"title\":\"RoomLimits\",\"type\":\"object\"},\"ScopeLimits\":{\"additionalProperties\":false,\"description\":\"Limits at one scope. Every member is optional: an absent member means the scope sets no limit of that kind, and the next wider scope's limit, or the host's ceiling, governs. All sizes are ciphertext bytes.\",\"properties\":{\"maxBytes\":{\"description\":\"The total size of the committed and reserved blobs the scope may hold.\",\"minimum\":0,\"type\":\"integer\"},\"maxFileBytes\":{\"description\":\"The largest single blob the scope accepts. Never above 1 GiB, the transfer ceiling (BlobManifest).\",\"maximum\":1073741824,\"minimum\":0,\"type\":\"integer\"},\"maxFiles\":{\"description\":\"The number of committed blobs the scope may hold. 0 refuses every upload at this scope.\",\"minimum\":0,\"type\":\"integer\"}},\"title\":\"ScopeLimits\",\"type\":\"object\"},\"StorageConfigId\":{\"description\":\"A storage config's identifier, chosen by the administrator who creates it and immutable thereafter: lowercase letters, digits and inner hyphens, at most 64 characters (`eu-s3-primary`, `walrus-main`). Unique within the community. Never reused after a config is retired, because blobs name their config by this value.\",\"maxLength\":64,\"minLength\":1,\"pattern\":\"^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$\",\"title\":\"StorageConfigId\",\"type\":\"string\"},\"Usage\":{\"additionalProperties\":false,\"description\":\"What one scope holds now. Ciphertext bytes throughout.\",\"properties\":{\"bytes\":{\"description\":\"Their total size. A blob stops counting the moment it is orphaned (its last record dropped it or was retracted), not when the host finally deletes it, so a member who deletes a file has the room back at once.\",\"minimum\":0,\"type\":\"integer\"},\"files\":{\"description\":\"Committed blobs that are not orphaned.\",\"minimum\":0,\"type\":\"integer\"},\"reservedBytes\":{\"description\":\"Bytes reserved by uploads begun and not yet committed, aborted or expired. Counted against `maxBytes`, so two concurrent uploads cannot both fit under a limit only one of them fits.\",\"minimum\":0,\"type\":\"integer\"},\"reservedFiles\":{\"description\":\"Uploads begun and not yet committed, aborted or expired. Counted against `maxFiles`.\",\"minimum\":0,\"type\":\"integer\"}},\"required\":[\"files\",\"bytes\",\"reservedBytes\"],\"title\":\"Usage\",\"type\":\"object\"},\"Visibility\":{\"description\":\"How much of a room its host can see, fixed at creation and immutable thereafter. `open`: records are cleartext, searchable and fully audited. `attributed`: record content is sealed, and the host still learns which member acted. `private`: content is sealed and membership is presented in zero knowledge, so the host verifies that a member acted without learning which. Immutable because a downgrade cannot un-see cleartext and an upgrade would protect only what came after while presenting as though it protected everything.\",\"enum\":[\"open\",\"attributed\",\"private\"],\"title\":\"Visibility\",\"type\":\"string\"}},\"$id\":\"https://trusttasks.org/spec/vtc/rooms/get/0.2\",\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"additionalProperties\":false,\"description\":\"A room-hosting administrator reads one hosted room's host record, storage placement, limits and usage. The outer document members are owned by the framework — SPEC §6.3.\",\"properties\":{\"ext\":{\"$ref\":\"#/$defs/Ext\"},\"roomId\":{\"description\":\"The room's identifier, as its owner minted it.\",\"maxLength\":512,\"minLength\":1,\"type\":\"string\"}},\"required\":[\"roomId\"],\"title\":\"VTC Rooms — Get — payload\",\"type\":\"object\"}\n",
);
}
impl crate::Payload for Response {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/vtc/rooms/get/0.2#response";
const IS_RECIPIENT_REQUIRED: bool = true;
const PAYLOAD_SCHEMA: Option<&'static str> = Some(
"{\"$defs\":{\"ConfigHoldings\":{\"additionalProperties\":false,\"description\":\"A config holding some of this room's blobs, other than the one it is assigned to.\",\"properties\":{\"bytes\":{\"minimum\":0,\"type\":\"integer\"},\"configId\":{\"$ref\":\"#/$defs/StorageConfigId\"},\"files\":{\"minimum\":0,\"type\":\"integer\"}},\"required\":[\"configId\",\"files\",\"bytes\"],\"type\":\"object\"},\"EffectiveLimits\":{\"additionalProperties\":false,\"description\":\"The limits a room is enforced against now, with where each scope's came from.\",\"properties\":{\"hostCeilingBytes\":{\"description\":\"The host-wide largest-file ceiling, which no room or member limit can exceed.\",\"maximum\":1073741824,\"minimum\":0,\"type\":\"integer\"},\"limits\":{\"$ref\":\"#/$defs/RoomLimits\"},\"memberSource\":{\"$ref\":\"#/$defs/LimitSource\"},\"roomSource\":{\"$ref\":\"#/$defs/LimitSource\"}},\"required\":[\"limits\",\"roomSource\",\"memberSource\"],\"title\":\"EffectiveLimits\",\"type\":\"object\"},\"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\"},\"HostedRoom\":{\"additionalProperties\":false,\"description\":\"One room, as its host holds it — member for member the `HostedRoom` of vtc/rooms/list/0.1, which defines it inside its own payload schema. Nothing derived from the room's contents, and no member list: the host has none.\",\"properties\":{\"createdAt\":{\"minimum\":0,\"type\":\"integer\"},\"epoch\":{\"minimum\":0,\"type\":\"integer\"},\"epochExpiresAt\":{\"minimum\":0,\"type\":\"integer\"},\"lifecycle\":{\"enum\":[\"live\",\"lapsed\",\"dormant\",\"reclaimable\"],\"type\":\"string\"},\"mirrorOf\":{\"maxLength\":2048,\"minLength\":1,\"type\":\"string\"},\"ownerDid\":{\"maxLength\":2048,\"pattern\":\"^did:\",\"type\":\"string\"},\"retentionDays\":{\"minimum\":0,\"type\":\"integer\"},\"retentionPolicy\":{\"$ref\":\"#/$defs/RetentionPolicy\"},\"roomId\":{\"maxLength\":512,\"minLength\":1,\"type\":\"string\"},\"updatedAt\":{\"minimum\":0,\"type\":\"integer\"},\"visibility\":{\"$ref\":\"#/$defs/Visibility\"}},\"required\":[\"roomId\",\"ownerDid\",\"visibility\",\"retentionPolicy\",\"epoch\",\"lifecycle\",\"retentionDays\",\"createdAt\",\"updatedAt\"],\"title\":\"HostedRoom\",\"type\":\"object\"},\"LimitSource\":{\"description\":\"Where an effective limit came from. `policy`: the community's rooms policy at the room's creation. `override`: an administrator's vtc/rooms/limits/set. `default`: the community's configured defaults, where neither applies. The host-wide ceiling bounds all three.\",\"enum\":[\"policy\",\"override\",\"default\"],\"title\":\"LimitSource\",\"type\":\"string\"},\"MigrationLastError\":{\"description\":\"A one-line summary of the last failure, for an administrator: the step, the config and the backend's error code or status (`put to eu-s3-primary: 503 SlowDown`). Never a credential, a presigned URL, a signed request, a room identifier or anything derived from a room's contents.\",\"maxLength\":500,\"minLength\":1,\"title\":\"MigrationLastError\",\"type\":\"string\"},\"MigrationPauseCause\":{\"description\":\"Why a migration is `paused`. `capacity`: the destination config cannot hold the rest. `source`: a config the blobs are being moved off keeps failing to serve them. `destination`: the destination config keeps refusing writes, or is no longer `active`. `credential`: the community cannot obtain a credential for one of the configs.\",\"enum\":[\"capacity\",\"source\",\"destination\",\"credential\"],\"title\":\"MigrationPauseCause\",\"type\":\"string\"},\"MigrationProgress\":{\"additionalProperties\":false,\"description\":\"Progress of the room's migration, as vtc/rooms/storage/migrate reports it.\",\"properties\":{\"doneBytes\":{\"minimum\":0,\"type\":\"integer\"},\"doneFiles\":{\"minimum\":0,\"type\":\"integer\"},\"lastError\":{\"$ref\":\"#/$defs/MigrationLastError\",\"description\":\"Present when `state` is `paused`; MAY be present while `running`, when a step is being retried.\"},\"migrationId\":{\"pattern\":\"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$\",\"type\":\"string\"},\"nextAttemptAt\":{\"description\":\"When the community will next try by itself. Present while a `running` migration waits out a backoff, and on a `paused` one the community will retry unprompted; absent on a `paused` one only re-issuing vtc/rooms/storage/migrate resumes (such as `capacity`).\",\"format\":\"date-time\",\"type\":\"string\"},\"pausedCause\":{\"$ref\":\"#/$defs/MigrationPauseCause\",\"description\":\"Present exactly when `state` is `paused`.\"},\"state\":{\"$ref\":\"#/$defs/MigrationState\"},\"toConfig\":{\"$ref\":\"#/$defs/StorageConfigId\",\"description\":\"The config this migration moves blobs to. After a reassignment during the migration it differs from `storage.configId`.\"},\"totalBytes\":{\"minimum\":0,\"type\":\"integer\"},\"totalFiles\":{\"minimum\":0,\"type\":\"integer\"}},\"required\":[\"migrationId\",\"toConfig\",\"state\",\"totalFiles\",\"totalBytes\",\"doneFiles\",\"doneBytes\"],\"type\":\"object\"},\"MigrationState\":{\"description\":\"`queued`: approved and waiting for another migration on this community to finish; nothing copied yet (a community that runs one migration at a time). `running`: copying, including while it retries a failing step with backoff. `paused`: halted after its automatic retries reached their cap without success, or on a cause that retrying cannot clear (`pausedCause`); resumed by issuing vtc/rooms/storage/migrate again, and by the community itself at `nextAttemptAt` when present. `complete`: every blob that was to move has moved. `failed`: halted on a blob whose copy did not verify against its manifest; that blob stays where it was.\",\"enum\":[\"queued\",\"running\",\"paused\",\"complete\",\"failed\"],\"title\":\"MigrationState\",\"type\":\"string\"},\"Response\":{\"$anchor\":\"response\",\"additionalProperties\":false,\"properties\":{\"ext\":{\"$ref\":\"#/$defs/Ext\"},\"largestBlobs\":{\"description\":\"The room's largest committed blobs, by size only.\",\"items\":{\"additionalProperties\":false,\"properties\":{\"configId\":{\"$ref\":\"#/$defs/StorageConfigId\"},\"createdAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"size\":{\"minimum\":1,\"type\":\"integer\"}},\"required\":[\"size\",\"configId\",\"createdAt\"],\"type\":\"object\"},\"maxItems\":10,\"type\":\"array\"},\"limits\":{\"$ref\":\"#/$defs/EffectiveLimits\"},\"membersWithUsage\":{\"description\":\"On an `attributed` room only: how many members have added files. Absent on `open` and `private` rooms.\",\"minimum\":0,\"type\":\"integer\"},\"room\":{\"$ref\":\"#/$defs/HostedRoom\"},\"storage\":{\"additionalProperties\":false,\"description\":\"Where the room's blobs are.\",\"properties\":{\"configId\":{\"$ref\":\"#/$defs/StorageConfigId\"},\"earlierConfigs\":{\"items\":{\"$ref\":\"#/$defs/ConfigHoldings\"},\"maxItems\":64,\"type\":\"array\"},\"migration\":{\"$ref\":\"#/$defs/MigrationProgress\",\"description\":\"Present while the room has a migration `queued`, `running` or `paused`; MAY remain, `complete` or `failed`, for the room's most recent finished one.\"}},\"required\":[\"configId\",\"earlierConfigs\"],\"type\":\"object\"},\"usage\":{\"additionalProperties\":false,\"properties\":{\"orphans\":{\"additionalProperties\":false,\"description\":\"Blobs no record names, awaiting deletion after the grace window.\",\"properties\":{\"bytes\":{\"minimum\":0,\"type\":\"integer\"},\"files\":{\"minimum\":0,\"type\":\"integer\"},\"oldestOrphanedAt\":{\"format\":\"date-time\",\"type\":\"string\"}},\"required\":[\"files\",\"bytes\"],\"type\":\"object\"},\"room\":{\"$ref\":\"#/$defs/Usage\"}},\"required\":[\"room\",\"orphans\"],\"type\":\"object\"}},\"required\":[\"room\",\"storage\",\"limits\",\"usage\"],\"title\":\"VTC Rooms — Get — response payload\",\"type\":\"object\"},\"RetentionPolicy\":{\"$comment\":\"Deliberately no JSON Schema `default`. A declared default is materialised by the generated bindings — the member becomes non-optional with a serde default — so an absent value would reappear as an explicit one on re-serialisation and break round-trip idempotence for every document written before this member existed. The meaning of absence is stated in prose, where a binding cannot act on it.\",\"description\":\"Whether a room keeps its history readable across a membership change, fixed at creation and immutable thereafter — like `Visibility`, and for the same reason: the rungs of an epoch key chain either exist for an epoch or they do not, and no later change of mind can seal key material that was never sealed or unseal what was already severed. `chained`: each advance produces an `EpochLink`, so every member reads the room's whole retained history however long they have been in it — what a **library** wants, at the cost of post-compromise security for record content, since a compromised current key then reaches every retained epoch. `fromJoin`: no rungs are produced, so a member reads only from the epoch their group state is at — what a **stream** wants, and what a room under a strict forward-secrecy obligation wants, at the cost that a joining member finds an empty-looking room and nobody can reread a record once their group state has moved past the epoch it was sealed under. Absent means `chained`; see the prose on why the absent case is the readable one.\",\"enum\":[\"chained\",\"fromJoin\"],\"title\":\"RetentionPolicy\",\"type\":\"string\"},\"RoomLimits\":{\"additionalProperties\":false,\"description\":\"How much a host is willing to store for one room, at the room and per member. A hosting decision, set by the host and never by anything in the room's credentials. An upload must fit every scope at once: the object against the smallest `maxFileBytes` that applies, and the member and the room with the file added.\",\"properties\":{\"filesEnabled\":{\"description\":\"False refuses every rooms/blobs/* upload for the room. Reads of blobs already stored continue.\",\"type\":\"boolean\"},\"member\":{\"$ref\":\"#/$defs/ScopeLimits\",\"description\":\"Limits on each member's own uploads in this room, unless that member has an override. A member is the subject at the root of the authority chain they present, never the key that signed, so an agent acting on an attenuated chain spends its member's allowance. Not applied on a `private` room, where the host cannot tell members apart; the room and object limits still hold there.\"},\"room\":{\"$ref\":\"#/$defs/ScopeLimits\",\"description\":\"Limits on the room as a whole.\"}},\"required\":[\"filesEnabled\"],\"title\":\"RoomLimits\",\"type\":\"object\"},\"ScopeLimits\":{\"additionalProperties\":false,\"description\":\"Limits at one scope. Every member is optional: an absent member means the scope sets no limit of that kind, and the next wider scope's limit, or the host's ceiling, governs. All sizes are ciphertext bytes.\",\"properties\":{\"maxBytes\":{\"description\":\"The total size of the committed and reserved blobs the scope may hold.\",\"minimum\":0,\"type\":\"integer\"},\"maxFileBytes\":{\"description\":\"The largest single blob the scope accepts. Never above 1 GiB, the transfer ceiling (BlobManifest).\",\"maximum\":1073741824,\"minimum\":0,\"type\":\"integer\"},\"maxFiles\":{\"description\":\"The number of committed blobs the scope may hold. 0 refuses every upload at this scope.\",\"minimum\":0,\"type\":\"integer\"}},\"title\":\"ScopeLimits\",\"type\":\"object\"},\"StorageConfigId\":{\"description\":\"A storage config's identifier, chosen by the administrator who creates it and immutable thereafter: lowercase letters, digits and inner hyphens, at most 64 characters (`eu-s3-primary`, `walrus-main`). Unique within the community. Never reused after a config is retired, because blobs name their config by this value.\",\"maxLength\":64,\"minLength\":1,\"pattern\":\"^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$\",\"title\":\"StorageConfigId\",\"type\":\"string\"},\"Usage\":{\"additionalProperties\":false,\"description\":\"What one scope holds now. Ciphertext bytes throughout.\",\"properties\":{\"bytes\":{\"description\":\"Their total size. A blob stops counting the moment it is orphaned (its last record dropped it or was retracted), not when the host finally deletes it, so a member who deletes a file has the room back at once.\",\"minimum\":0,\"type\":\"integer\"},\"files\":{\"description\":\"Committed blobs that are not orphaned.\",\"minimum\":0,\"type\":\"integer\"},\"reservedBytes\":{\"description\":\"Bytes reserved by uploads begun and not yet committed, aborted or expired. Counted against `maxBytes`, so two concurrent uploads cannot both fit under a limit only one of them fits.\",\"minimum\":0,\"type\":\"integer\"},\"reservedFiles\":{\"description\":\"Uploads begun and not yet committed, aborted or expired. Counted against `maxFiles`.\",\"minimum\":0,\"type\":\"integer\"}},\"required\":[\"files\",\"bytes\",\"reservedBytes\"],\"title\":\"Usage\",\"type\":\"object\"},\"Visibility\":{\"description\":\"How much of a room its host can see, fixed at creation and immutable thereafter. `open`: records are cleartext, searchable and fully audited. `attributed`: record content is sealed, and the host still learns which member acted. `private`: content is sealed and membership is presented in zero knowledge, so the host verifies that a member acted without learning which. Immutable because a downgrade cannot un-see cleartext and an upgrade would protect only what came after while presenting as though it protected everything.\",\"enum\":[\"open\",\"attributed\",\"private\"],\"title\":\"Visibility\",\"type\":\"string\"}},\"$ref\":\"#/$defs/Response\",\"$schema\":\"https://json-schema.org/draft/2020-12/schema\"}\n",
);
}
impl crate::RequestPayload for Payload {
type Response = Response;
}
/// The earlier `MAJOR.MINOR` of this slug that this version declares it
/// extends (front matter `extends`, SPEC §5.2 "Declared extension"), or
/// `None`. Only the direct declaration; walk a chain with
/// [`crate::extension::extends_for`].
pub const EXTENDS: Option<&str> = None;
/// The extended error codes this specification declares (SPEC §7.3 item 9,
/// §8.5), in declaration order. Empty when it declares none.
pub const ERROR_CODES: &[crate::DeclaredErrorCode] = &[error_codes::NOT_FOUND];
/// 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 {
/// `vtc/rooms/get:notFound`
///
/// The community hosts no room with this identifier.
///
/// Declared `retryable: false`.
pub const NOT_FOUND: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "vtc/rooms/get:notFound",
retryable: false,
details_schema: ::core::option::Option::None,
};
}