//! Generated by `trust-tasks-codegen` — do not edit by hand.
//!
//! Spec slug: `vtc/rooms/usage`. Version: `0.1`.
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
/// Error types.
pub mod error {
/// Error from a `TryFrom` or `FromStr` implementation.
pub struct ConversionError(::std::borrow::Cow<'static, str>);
impl ::std::error::Error for ConversionError {}
impl ::std::fmt::Display for ConversionError {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
::std::fmt::Display::fmt(&self.0, f)
}
}
impl ::std::fmt::Debug for ConversionError {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
::std::fmt::Debug::fmt(&self.0, f)
}
}
impl From<&'static str> for ConversionError {
fn from(value: &'static str) -> Self {
Self(value.into())
}
}
impl From<String> for ConversionError {
fn from(value: String) -> Self {
Self(value.into())
}
}
}
///Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Ext",
/// "description": "Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.",
/// "type": "object",
/// "minProperties": 1,
/// "additionalProperties": true,
/// "propertyNames": {
/// "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(transparent)]
pub struct Ext(pub ::std::collections::HashMap<ExtKey, ::serde_json::Value>);
impl ::std::ops::Deref for Ext {
type Target = ::std::collections::HashMap<ExtKey, ::serde_json::Value>;
fn deref(&self) -> &::std::collections::HashMap<ExtKey, ::serde_json::Value> {
&self.0
}
}
impl ::std::convert::From<Ext> for ::std::collections::HashMap<ExtKey, ::serde_json::Value> {
fn from(value: Ext) -> Self {
value.0
}
}
impl ::std::convert::From<::std::collections::HashMap<ExtKey, ::serde_json::Value>> for Ext {
fn from(value: ::std::collections::HashMap<ExtKey, ::serde_json::Value>) -> Self {
Self(value)
}
}
///`ExtKey`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "string",
/// "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ExtKey(::std::string::String);
impl ::std::ops::Deref for ExtKey {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ExtKey> for ::std::string::String {
fn from(value: ExtKey) -> Self {
value.0
}
}
impl ::std::str::FromStr for ExtKey {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| {
::regress::Regex::new("^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$").unwrap()
});
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ExtKey {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for ExtKey {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for ExtKey {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for ExtKey {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///A room-hosting administrator reports the storage and activity of the community's hosted rooms, grouped by room, member, storage config or day. The outer document members are owned by the framework — SPEC §6.3.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "$id": "https://trusttasks.org/spec/vtc/rooms/usage/0.1",
/// "title": "Payload",
/// "description": "A room-hosting administrator reports the storage and activity of the community's hosted rooms, grouped by room, member, storage config or day. The outer document members are owned by the framework — SPEC §6.3.",
/// "type": "object",
/// "required": [
/// "groupBy"
/// ],
/// "properties": {
/// "cursor": {
/// "description": "Opaque continuation token from a previous page's `nextCursor`.",
/// "type": "string",
/// "maxLength": 1024,
/// "minLength": 1
/// },
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "filter": {
/// "description": "Every member optional; all given apply together.",
/// "type": "object",
/// "properties": {
/// "from": {
/// "description": "First UTC day of the range. Default: 29 days before `to`.",
/// "type": "string",
/// "format": "date"
/// },
/// "member": {
/// "description": "One member's figures, across the `attributed` rooms selected.",
/// "type": "string",
/// "maxLength": 2048,
/// "pattern": "^did:"
/// },
/// "roomId": {
/// "description": "The room's identifier, as its owner minted it.",
/// "type": "string",
/// "maxLength": 512,
/// "minLength": 1
/// },
/// "storageConfig": {
/// "$ref": "#/definitions/StorageConfigId"
/// },
/// "to": {
/// "description": "Last UTC day of the range, inclusive. Default: today.",
/// "type": "string",
/// "format": "date"
/// }
/// },
/// "additionalProperties": false
/// },
/// "groupBy": {
/// "description": "What each row describes. `day` is the daily history of whatever the filter selects.",
/// "type": "string",
/// "enum": [
/// "room",
/// "member",
/// "storageConfig",
/// "day"
/// ]
/// },
/// "limit": {
/// "description": "Page size. The community chooses when absent (50 in the reference implementation).",
/// "type": "integer",
/// "maximum": 100.0,
/// "minimum": 1.0
/// },
/// "sort": {
/// "type": "object",
/// "required": [
/// "by"
/// ],
/// "properties": {
/// "by": {
/// "type": "string",
/// "enum": [
/// "bytes",
/// "files",
/// "uploads",
/// "downloads",
/// "egressBytes",
/// "date"
/// ]
/// },
/// "order": {
/// "type": "string",
/// "enum": [
/// "asc",
/// "desc"
/// ]
/// }
/// },
/// "additionalProperties": false
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Payload {
///Opaque continuation token from a previous page's `nextCursor`.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub cursor: ::std::option::Option<PayloadCursor>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub filter: ::std::option::Option<PayloadFilter>,
///What each row describes. `day` is the daily history of whatever the filter selects.
#[serde(rename = "groupBy")]
pub group_by: PayloadGroupBy,
///Page size. The community chooses when absent (50 in the reference implementation).
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub limit: ::std::option::Option<::std::num::NonZeroU64>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub sort: ::std::option::Option<PayloadSort>,
}
impl Payload {
pub fn builder() -> builder::Payload {
Default::default()
}
}
///Opaque continuation token from a previous page's `nextCursor`.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Opaque continuation token from a previous page's `nextCursor`.",
/// "type": "string",
/// "maxLength": 1024,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PayloadCursor(::std::string::String);
impl ::std::ops::Deref for PayloadCursor {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PayloadCursor> for ::std::string::String {
fn from(value: PayloadCursor) -> Self {
value.0
}
}
impl ::std::str::FromStr for PayloadCursor {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 1024usize {
return Err("longer than 1024 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 PayloadCursor {
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 PayloadCursor {
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 PayloadCursor {
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 PayloadCursor {
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())
})
}
}
///Every member optional; all given apply together.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Every member optional; all given apply together.",
/// "type": "object",
/// "properties": {
/// "from": {
/// "description": "First UTC day of the range. Default: 29 days before `to`.",
/// "type": "string",
/// "format": "date"
/// },
/// "member": {
/// "description": "One member's figures, across the `attributed` rooms selected.",
/// "type": "string",
/// "maxLength": 2048,
/// "pattern": "^did:"
/// },
/// "roomId": {
/// "description": "The room's identifier, as its owner minted it.",
/// "type": "string",
/// "maxLength": 512,
/// "minLength": 1
/// },
/// "storageConfig": {
/// "$ref": "#/definitions/StorageConfigId"
/// },
/// "to": {
/// "description": "Last UTC day of the range, inclusive. Default: today.",
/// "type": "string",
/// "format": "date"
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct PayloadFilter {
///First UTC day of the range. Default: 29 days before `to`.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub from: ::std::option::Option<::chrono::naive::NaiveDate>,
///One member's figures, across the `attributed` rooms selected.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub member: ::std::option::Option<PayloadFilterMember>,
///The room's identifier, as its owner minted it.
#[serde(
rename = "roomId",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub room_id: ::std::option::Option<PayloadFilterRoomId>,
#[serde(
rename = "storageConfig",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub storage_config: ::std::option::Option<StorageConfigId>,
///Last UTC day of the range, inclusive. Default: today.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub to: ::std::option::Option<::chrono::naive::NaiveDate>,
}
impl ::std::default::Default for PayloadFilter {
fn default() -> Self {
Self {
from: Default::default(),
member: Default::default(),
room_id: Default::default(),
storage_config: Default::default(),
to: Default::default(),
}
}
}
impl PayloadFilter {
pub fn builder() -> builder::PayloadFilter {
Default::default()
}
}
///One member's figures, across the `attributed` rooms selected.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "One member's figures, across the `attributed` rooms selected.",
/// "type": "string",
/// "maxLength": 2048,
/// "pattern": "^did:"
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PayloadFilterMember(::std::string::String);
impl ::std::ops::Deref for PayloadFilterMember {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PayloadFilterMember> for ::std::string::String {
fn from(value: PayloadFilterMember) -> Self {
value.0
}
}
impl ::std::str::FromStr for PayloadFilterMember {
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 PayloadFilterMember {
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 PayloadFilterMember {
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 PayloadFilterMember {
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 PayloadFilterMember {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///The room's identifier, as its owner minted it.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The room's identifier, as its owner minted it.",
/// "type": "string",
/// "maxLength": 512,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PayloadFilterRoomId(::std::string::String);
impl ::std::ops::Deref for PayloadFilterRoomId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PayloadFilterRoomId> for ::std::string::String {
fn from(value: PayloadFilterRoomId) -> Self {
value.0
}
}
impl ::std::str::FromStr for PayloadFilterRoomId {
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 PayloadFilterRoomId {
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 PayloadFilterRoomId {
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 PayloadFilterRoomId {
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 PayloadFilterRoomId {
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 each row describes. `day` is the daily history of whatever the filter selects.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "What each row describes. `day` is the daily history of whatever the filter selects.",
/// "type": "string",
/// "enum": [
/// "room",
/// "member",
/// "storageConfig",
/// "day"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum PayloadGroupBy {
#[serde(rename = "room")]
Room,
#[serde(rename = "member")]
Member,
#[serde(rename = "storageConfig")]
StorageConfig,
#[serde(rename = "day")]
Day,
}
impl ::std::fmt::Display for PayloadGroupBy {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Room => f.write_str("room"),
Self::Member => f.write_str("member"),
Self::StorageConfig => f.write_str("storageConfig"),
Self::Day => f.write_str("day"),
}
}
}
impl ::std::str::FromStr for PayloadGroupBy {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"room" => Ok(Self::Room),
"member" => Ok(Self::Member),
"storageConfig" => Ok(Self::StorageConfig),
"day" => Ok(Self::Day),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for PayloadGroupBy {
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 PayloadGroupBy {
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 PayloadGroupBy {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///`PayloadSort`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "by"
/// ],
/// "properties": {
/// "by": {
/// "type": "string",
/// "enum": [
/// "bytes",
/// "files",
/// "uploads",
/// "downloads",
/// "egressBytes",
/// "date"
/// ]
/// },
/// "order": {
/// "type": "string",
/// "enum": [
/// "asc",
/// "desc"
/// ]
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct PayloadSort {
pub by: PayloadSortBy,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub order: ::std::option::Option<PayloadSortOrder>,
}
impl PayloadSort {
pub fn builder() -> builder::PayloadSort {
Default::default()
}
}
///`PayloadSortBy`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "string",
/// "enum": [
/// "bytes",
/// "files",
/// "uploads",
/// "downloads",
/// "egressBytes",
/// "date"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum PayloadSortBy {
#[serde(rename = "bytes")]
Bytes,
#[serde(rename = "files")]
Files,
#[serde(rename = "uploads")]
Uploads,
#[serde(rename = "downloads")]
Downloads,
#[serde(rename = "egressBytes")]
EgressBytes,
#[serde(rename = "date")]
Date,
}
impl ::std::fmt::Display for PayloadSortBy {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Bytes => f.write_str("bytes"),
Self::Files => f.write_str("files"),
Self::Uploads => f.write_str("uploads"),
Self::Downloads => f.write_str("downloads"),
Self::EgressBytes => f.write_str("egressBytes"),
Self::Date => f.write_str("date"),
}
}
}
impl ::std::str::FromStr for PayloadSortBy {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"bytes" => Ok(Self::Bytes),
"files" => Ok(Self::Files),
"uploads" => Ok(Self::Uploads),
"downloads" => Ok(Self::Downloads),
"egressBytes" => Ok(Self::EgressBytes),
"date" => Ok(Self::Date),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for PayloadSortBy {
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 PayloadSortBy {
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 PayloadSortBy {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///`PayloadSortOrder`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "string",
/// "enum": [
/// "asc",
/// "desc"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum PayloadSortOrder {
#[serde(rename = "asc")]
Asc,
#[serde(rename = "desc")]
Desc,
}
impl ::std::fmt::Display for PayloadSortOrder {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Asc => f.write_str("asc"),
Self::Desc => f.write_str("desc"),
}
}
}
impl ::std::str::FromStr for PayloadSortOrder {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"asc" => Ok(Self::Asc),
"desc" => Ok(Self::Desc),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for PayloadSortOrder {
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 PayloadSortOrder {
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 PayloadSortOrder {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///`Response`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Response",
/// "type": "object",
/// "required": [
/// "asOf",
/// "from",
/// "items",
/// "to"
/// ],
/// "properties": {
/// "asOf": {
/// "type": "string",
/// "format": "date-time"
/// },
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "from": {
/// "type": "string",
/// "format": "date"
/// },
/// "items": {
/// "type": "array",
/// "items": {
/// "$ref": "#/definitions/UsageRow"
/// },
/// "maxItems": 100
/// },
/// "nextCursor": {
/// "description": "Present when more remain; pass it as `cursor`.",
/// "type": "string",
/// "maxLength": 1024,
/// "minLength": 1
/// },
/// "to": {
/// "type": "string",
/// "format": "date"
/// }
/// },
/// "additionalProperties": false,
/// "$anchor": "response"
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Response {
#[serde(rename = "asOf")]
pub as_of: ::chrono::DateTime<::chrono::offset::Utc>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
pub from: ::chrono::naive::NaiveDate,
pub items: ::std::vec::Vec<UsageRow>,
///Present when more remain; pass it as `cursor`.
#[serde(
rename = "nextCursor",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub next_cursor: ::std::option::Option<ResponseNextCursor>,
pub to: ::chrono::naive::NaiveDate,
}
impl Response {
pub fn builder() -> builder::Response {
Default::default()
}
}
///Present when more remain; pass it as `cursor`.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Present when more remain; pass it as `cursor`.",
/// "type": "string",
/// "maxLength": 1024,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ResponseNextCursor(::std::string::String);
impl ::std::ops::Deref for ResponseNextCursor {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ResponseNextCursor> for ::std::string::String {
fn from(value: ResponseNextCursor) -> Self {
value.0
}
}
impl ::std::str::FromStr for ResponseNextCursor {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 1024usize {
return Err("longer than 1024 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 ResponseNextCursor {
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 ResponseNextCursor {
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 ResponseNextCursor {
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 ResponseNextCursor {
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())
})
}
}
///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.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "ScopeLimits",
/// "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.",
/// "type": "object",
/// "properties": {
/// "maxBytes": {
/// "description": "The total size of the committed and reserved blobs the scope may hold.",
/// "type": "integer",
/// "minimum": 0.0
/// },
/// "maxFileBytes": {
/// "description": "The largest single blob the scope accepts. Never above 1 GiB, the transfer ceiling (BlobManifest).",
/// "type": "integer",
/// "maximum": 1073741824.0,
/// "minimum": 0.0
/// },
/// "maxFiles": {
/// "description": "The number of committed blobs the scope may hold. 0 refuses every upload at this scope.",
/// "type": "integer",
/// "minimum": 0.0
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[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.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "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.",
/// "type": "string",
/// "maxLength": 64,
/// "minLength": 1,
/// "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$"
///}
/// ```
/// </details>
#[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())
})
}
}
///One group's figures. Holdings as of the read (or the end of the day, on a `day` row); activity over the range (or the day).
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "One group's figures. Holdings as of the read (or the end of the day, on a `day` row); activity over the range (or the day).",
/// "type": "object",
/// "required": [
/// "bytes",
/// "downloads",
/// "egressBytes",
/// "files",
/// "reservedBytes",
/// "uploads"
/// ],
/// "properties": {
/// "bytes": {
/// "type": "integer",
/// "minimum": 0.0
/// },
/// "capacityBytes": {
/// "description": "On a `storageConfig` row, the config's capacity when it has one.",
/// "type": "integer",
/// "minimum": 0.0
/// },
/// "date": {
/// "description": "Present on a `day` row.",
/// "type": "string",
/// "format": "date"
/// },
/// "downloads": {
/// "type": "integer",
/// "minimum": 0.0
/// },
/// "egressBytes": {
/// "type": "integer",
/// "minimum": 0.0
/// },
/// "files": {
/// "type": "integer",
/// "minimum": 0.0
/// },
/// "limits": {
/// "description": "On a `room` row the room's limits, on a `member` row (one room selected) that member's.",
/// "$ref": "#/definitions/ScopeLimits"
/// },
/// "member": {
/// "description": "Present on a `member` row.",
/// "type": "string",
/// "maxLength": 2048,
/// "pattern": "^did:"
/// },
/// "reservedBytes": {
/// "type": "integer",
/// "minimum": 0.0
/// },
/// "roomId": {
/// "description": "Present on a `room` row.",
/// "type": "string",
/// "maxLength": 512,
/// "minLength": 1
/// },
/// "storageConfig": {
/// "description": "Present on a `storageConfig` row, and on a `room` row as the room's assigned config.",
/// "$ref": "#/definitions/StorageConfigId"
/// },
/// "uploads": {
/// "type": "integer",
/// "minimum": 0.0
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct UsageRow {
pub bytes: u64,
///On a `storageConfig` row, the config's capacity when it has one.
#[serde(
rename = "capacityBytes",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub capacity_bytes: ::std::option::Option<u64>,
///Present on a `day` row.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub date: ::std::option::Option<::chrono::naive::NaiveDate>,
pub downloads: u64,
#[serde(rename = "egressBytes")]
pub egress_bytes: u64,
pub files: u64,
///On a `room` row the room's limits, on a `member` row (one room selected) that member's.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub limits: ::std::option::Option<ScopeLimits>,
///Present on a `member` row.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub member: ::std::option::Option<UsageRowMember>,
#[serde(rename = "reservedBytes")]
pub reserved_bytes: u64,
///Present on a `room` row.
#[serde(
rename = "roomId",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub room_id: ::std::option::Option<UsageRowRoomId>,
///Present on a `storageConfig` row, and on a `room` row as the room's assigned config.
#[serde(
rename = "storageConfig",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub storage_config: ::std::option::Option<StorageConfigId>,
pub uploads: u64,
}
impl UsageRow {
pub fn builder() -> builder::UsageRow {
Default::default()
}
}
///Present on a `member` row.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Present on a `member` row.",
/// "type": "string",
/// "maxLength": 2048,
/// "pattern": "^did:"
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct UsageRowMember(::std::string::String);
impl ::std::ops::Deref for UsageRowMember {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<UsageRowMember> for ::std::string::String {
fn from(value: UsageRowMember) -> Self {
value.0
}
}
impl ::std::str::FromStr for UsageRowMember {
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 UsageRowMember {
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 UsageRowMember {
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 UsageRowMember {
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 UsageRowMember {
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())
})
}
}
///Present on a `room` row.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Present on a `room` row.",
/// "type": "string",
/// "maxLength": 512,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct UsageRowRoomId(::std::string::String);
impl ::std::ops::Deref for UsageRowRoomId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<UsageRowRoomId> for ::std::string::String {
fn from(value: UsageRowRoomId) -> Self {
value.0
}
}
impl ::std::str::FromStr for UsageRowRoomId {
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 UsageRowRoomId {
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 UsageRowRoomId {
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 UsageRowRoomId {
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 UsageRowRoomId {
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())
})
}
}
/// Types for composing complex structures.
pub mod builder {
#[derive(Clone, Debug)]
pub struct Payload {
cursor: ::std::result::Result<
::std::option::Option<super::PayloadCursor>,
::std::string::String,
>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
filter: ::std::result::Result<
::std::option::Option<super::PayloadFilter>,
::std::string::String,
>,
group_by: ::std::result::Result<super::PayloadGroupBy, ::std::string::String>,
limit: ::std::result::Result<
::std::option::Option<::std::num::NonZeroU64>,
::std::string::String,
>,
sort:
::std::result::Result<::std::option::Option<super::PayloadSort>, ::std::string::String>,
}
impl ::std::default::Default for Payload {
fn default() -> Self {
Self {
cursor: Ok(Default::default()),
ext: Ok(Default::default()),
filter: Ok(Default::default()),
group_by: Err("no value supplied for group_by".to_string()),
limit: Ok(Default::default()),
sort: Ok(Default::default()),
}
}
}
impl Payload {
pub fn cursor<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PayloadCursor>>,
T::Error: ::std::fmt::Display,
{
self.cursor = value
.try_into()
.map_err(|e| format!("error converting supplied value for cursor: {e}"));
self
}
pub fn ext<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::Ext>>,
T::Error: ::std::fmt::Display,
{
self.ext = value
.try_into()
.map_err(|e| format!("error converting supplied value for ext: {e}"));
self
}
pub fn filter<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PayloadFilter>>,
T::Error: ::std::fmt::Display,
{
self.filter = value
.try_into()
.map_err(|e| format!("error converting supplied value for filter: {e}"));
self
}
pub fn group_by<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::PayloadGroupBy>,
T::Error: ::std::fmt::Display,
{
self.group_by = value
.try_into()
.map_err(|e| format!("error converting supplied value for group_by: {e}"));
self
}
pub fn limit<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::std::num::NonZeroU64>>,
T::Error: ::std::fmt::Display,
{
self.limit = value
.try_into()
.map_err(|e| format!("error converting supplied value for limit: {e}"));
self
}
pub fn sort<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PayloadSort>>,
T::Error: ::std::fmt::Display,
{
self.sort = value
.try_into()
.map_err(|e| format!("error converting supplied value for sort: {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 {
cursor: value.cursor?,
ext: value.ext?,
filter: value.filter?,
group_by: value.group_by?,
limit: value.limit?,
sort: value.sort?,
})
}
}
impl ::std::convert::From<super::Payload> for Payload {
fn from(value: super::Payload) -> Self {
Self {
cursor: Ok(value.cursor),
ext: Ok(value.ext),
filter: Ok(value.filter),
group_by: Ok(value.group_by),
limit: Ok(value.limit),
sort: Ok(value.sort),
}
}
}
#[derive(Clone, Debug)]
pub struct PayloadFilter {
from: ::std::result::Result<
::std::option::Option<::chrono::naive::NaiveDate>,
::std::string::String,
>,
member: ::std::result::Result<
::std::option::Option<super::PayloadFilterMember>,
::std::string::String,
>,
room_id: ::std::result::Result<
::std::option::Option<super::PayloadFilterRoomId>,
::std::string::String,
>,
storage_config: ::std::result::Result<
::std::option::Option<super::StorageConfigId>,
::std::string::String,
>,
to: ::std::result::Result<
::std::option::Option<::chrono::naive::NaiveDate>,
::std::string::String,
>,
}
impl ::std::default::Default for PayloadFilter {
fn default() -> Self {
Self {
from: Ok(Default::default()),
member: Ok(Default::default()),
room_id: Ok(Default::default()),
storage_config: Ok(Default::default()),
to: Ok(Default::default()),
}
}
}
impl PayloadFilter {
pub fn from<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::chrono::naive::NaiveDate>>,
T::Error: ::std::fmt::Display,
{
self.from = value
.try_into()
.map_err(|e| format!("error converting supplied value for from: {e}"));
self
}
pub fn member<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PayloadFilterMember>>,
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_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PayloadFilterRoomId>>,
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 storage_config<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::StorageConfigId>>,
T::Error: ::std::fmt::Display,
{
self.storage_config = value
.try_into()
.map_err(|e| format!("error converting supplied value for storage_config: {e}"));
self
}
pub fn to<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::chrono::naive::NaiveDate>>,
T::Error: ::std::fmt::Display,
{
self.to = value
.try_into()
.map_err(|e| format!("error converting supplied value for to: {e}"));
self
}
}
impl ::std::convert::TryFrom<PayloadFilter> for super::PayloadFilter {
type Error = super::error::ConversionError;
fn try_from(
value: PayloadFilter,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
from: value.from?,
member: value.member?,
room_id: value.room_id?,
storage_config: value.storage_config?,
to: value.to?,
})
}
}
impl ::std::convert::From<super::PayloadFilter> for PayloadFilter {
fn from(value: super::PayloadFilter) -> Self {
Self {
from: Ok(value.from),
member: Ok(value.member),
room_id: Ok(value.room_id),
storage_config: Ok(value.storage_config),
to: Ok(value.to),
}
}
}
#[derive(Clone, Debug)]
pub struct PayloadSort {
by: ::std::result::Result<super::PayloadSortBy, ::std::string::String>,
order: ::std::result::Result<
::std::option::Option<super::PayloadSortOrder>,
::std::string::String,
>,
}
impl ::std::default::Default for PayloadSort {
fn default() -> Self {
Self {
by: Err("no value supplied for by".to_string()),
order: Ok(Default::default()),
}
}
}
impl PayloadSort {
pub fn by<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::PayloadSortBy>,
T::Error: ::std::fmt::Display,
{
self.by = value
.try_into()
.map_err(|e| format!("error converting supplied value for by: {e}"));
self
}
pub fn order<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PayloadSortOrder>>,
T::Error: ::std::fmt::Display,
{
self.order = value
.try_into()
.map_err(|e| format!("error converting supplied value for order: {e}"));
self
}
}
impl ::std::convert::TryFrom<PayloadSort> for super::PayloadSort {
type Error = super::error::ConversionError;
fn try_from(
value: PayloadSort,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
by: value.by?,
order: value.order?,
})
}
}
impl ::std::convert::From<super::PayloadSort> for PayloadSort {
fn from(value: super::PayloadSort) -> Self {
Self {
by: Ok(value.by),
order: Ok(value.order),
}
}
}
#[derive(Clone, Debug)]
pub struct Response {
as_of:
::std::result::Result<::chrono::DateTime<::chrono::offset::Utc>, ::std::string::String>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
from: ::std::result::Result<::chrono::naive::NaiveDate, ::std::string::String>,
items: ::std::result::Result<::std::vec::Vec<super::UsageRow>, ::std::string::String>,
next_cursor: ::std::result::Result<
::std::option::Option<super::ResponseNextCursor>,
::std::string::String,
>,
to: ::std::result::Result<::chrono::naive::NaiveDate, ::std::string::String>,
}
impl ::std::default::Default for Response {
fn default() -> Self {
Self {
as_of: Err("no value supplied for as_of".to_string()),
ext: Ok(Default::default()),
from: Err("no value supplied for from".to_string()),
items: Err("no value supplied for items".to_string()),
next_cursor: Ok(Default::default()),
to: Err("no value supplied for to".to_string()),
}
}
}
impl Response {
pub fn as_of<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
T::Error: ::std::fmt::Display,
{
self.as_of = value
.try_into()
.map_err(|e| format!("error converting supplied value for as_of: {e}"));
self
}
pub fn ext<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::Ext>>,
T::Error: ::std::fmt::Display,
{
self.ext = value
.try_into()
.map_err(|e| format!("error converting supplied value for ext: {e}"));
self
}
pub fn from<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::chrono::naive::NaiveDate>,
T::Error: ::std::fmt::Display,
{
self.from = value
.try_into()
.map_err(|e| format!("error converting supplied value for from: {e}"));
self
}
pub fn items<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::UsageRow>>,
T::Error: ::std::fmt::Display,
{
self.items = value
.try_into()
.map_err(|e| format!("error converting supplied value for items: {e}"));
self
}
pub fn next_cursor<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::ResponseNextCursor>>,
T::Error: ::std::fmt::Display,
{
self.next_cursor = value
.try_into()
.map_err(|e| format!("error converting supplied value for next_cursor: {e}"));
self
}
pub fn to<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::chrono::naive::NaiveDate>,
T::Error: ::std::fmt::Display,
{
self.to = value
.try_into()
.map_err(|e| format!("error converting supplied value for to: {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 {
as_of: value.as_of?,
ext: value.ext?,
from: value.from?,
items: value.items?,
next_cursor: value.next_cursor?,
to: value.to?,
})
}
}
impl ::std::convert::From<super::Response> for Response {
fn from(value: super::Response) -> Self {
Self {
as_of: Ok(value.as_of),
ext: Ok(value.ext),
from: Ok(value.from),
items: Ok(value.items),
next_cursor: Ok(value.next_cursor),
to: Ok(value.to),
}
}
}
#[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 UsageRow {
bytes: ::std::result::Result<u64, ::std::string::String>,
capacity_bytes: ::std::result::Result<::std::option::Option<u64>, ::std::string::String>,
date: ::std::result::Result<
::std::option::Option<::chrono::naive::NaiveDate>,
::std::string::String,
>,
downloads: ::std::result::Result<u64, ::std::string::String>,
egress_bytes: ::std::result::Result<u64, ::std::string::String>,
files: ::std::result::Result<u64, ::std::string::String>,
limits:
::std::result::Result<::std::option::Option<super::ScopeLimits>, ::std::string::String>,
member: ::std::result::Result<
::std::option::Option<super::UsageRowMember>,
::std::string::String,
>,
reserved_bytes: ::std::result::Result<u64, ::std::string::String>,
room_id: ::std::result::Result<
::std::option::Option<super::UsageRowRoomId>,
::std::string::String,
>,
storage_config: ::std::result::Result<
::std::option::Option<super::StorageConfigId>,
::std::string::String,
>,
uploads: ::std::result::Result<u64, ::std::string::String>,
}
impl ::std::default::Default for UsageRow {
fn default() -> Self {
Self {
bytes: Err("no value supplied for bytes".to_string()),
capacity_bytes: Ok(Default::default()),
date: Ok(Default::default()),
downloads: Err("no value supplied for downloads".to_string()),
egress_bytes: Err("no value supplied for egress_bytes".to_string()),
files: Err("no value supplied for files".to_string()),
limits: Ok(Default::default()),
member: Ok(Default::default()),
reserved_bytes: Err("no value supplied for reserved_bytes".to_string()),
room_id: Ok(Default::default()),
storage_config: Ok(Default::default()),
uploads: Err("no value supplied for uploads".to_string()),
}
}
}
impl UsageRow {
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 capacity_bytes<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<u64>>,
T::Error: ::std::fmt::Display,
{
self.capacity_bytes = value
.try_into()
.map_err(|e| format!("error converting supplied value for capacity_bytes: {e}"));
self
}
pub fn date<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::chrono::naive::NaiveDate>>,
T::Error: ::std::fmt::Display,
{
self.date = value
.try_into()
.map_err(|e| format!("error converting supplied value for date: {e}"));
self
}
pub fn downloads<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.downloads = value
.try_into()
.map_err(|e| format!("error converting supplied value for downloads: {e}"));
self
}
pub fn egress_bytes<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.egress_bytes = value
.try_into()
.map_err(|e| format!("error converting supplied value for egress_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 limits<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::ScopeLimits>>,
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<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::UsageRowMember>>,
T::Error: ::std::fmt::Display,
{
self.member = value
.try_into()
.map_err(|e| format!("error converting supplied value for member: {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 room_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::UsageRowRoomId>>,
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 storage_config<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::StorageConfigId>>,
T::Error: ::std::fmt::Display,
{
self.storage_config = value
.try_into()
.map_err(|e| format!("error converting supplied value for storage_config: {e}"));
self
}
pub fn uploads<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.uploads = value
.try_into()
.map_err(|e| format!("error converting supplied value for uploads: {e}"));
self
}
}
impl ::std::convert::TryFrom<UsageRow> for super::UsageRow {
type Error = super::error::ConversionError;
fn try_from(value: UsageRow) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
bytes: value.bytes?,
capacity_bytes: value.capacity_bytes?,
date: value.date?,
downloads: value.downloads?,
egress_bytes: value.egress_bytes?,
files: value.files?,
limits: value.limits?,
member: value.member?,
reserved_bytes: value.reserved_bytes?,
room_id: value.room_id?,
storage_config: value.storage_config?,
uploads: value.uploads?,
})
}
}
impl ::std::convert::From<super::UsageRow> for UsageRow {
fn from(value: super::UsageRow) -> Self {
Self {
bytes: Ok(value.bytes),
capacity_bytes: Ok(value.capacity_bytes),
date: Ok(value.date),
downloads: Ok(value.downloads),
egress_bytes: Ok(value.egress_bytes),
files: Ok(value.files),
limits: Ok(value.limits),
member: Ok(value.member),
reserved_bytes: Ok(value.reserved_bytes),
room_id: Ok(value.room_id),
storage_config: Ok(value.storage_config),
uploads: Ok(value.uploads),
}
}
}
}
impl crate::Payload for Payload {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/vtc/rooms/usage/0.1";
const IS_RECIPIENT_REQUIRED: bool = true;
const PAYLOAD_SCHEMA: Option<&'static str> = Some(
"{\n \"$defs\": {\n \"Ext\": {\n \"additionalProperties\": true,\n \"description\": \"Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.\",\n \"minProperties\": 1,\n \"propertyNames\": {\n \"pattern\": \"^[a-z][a-z0-9-]*(\\\\.[a-z0-9-]+)+$\"\n },\n \"title\": \"Ext\",\n \"type\": \"object\"\n },\n \"Response\": {\n \"$anchor\": \"response\",\n \"additionalProperties\": false,\n \"properties\": {\n \"asOf\": {\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"from\": {\n \"format\": \"date\",\n \"type\": \"string\"\n },\n \"items\": {\n \"items\": {\n \"$ref\": \"#/$defs/UsageRow\"\n },\n \"maxItems\": 100,\n \"type\": \"array\"\n },\n \"nextCursor\": {\n \"description\": \"Present when more remain; pass it as `cursor`.\",\n \"maxLength\": 1024,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"to\": {\n \"format\": \"date\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"asOf\",\n \"from\",\n \"to\",\n \"items\"\n ],\n \"title\": \"VTC Rooms — Usage — response payload\",\n \"type\": \"object\"\n },\n \"ScopeLimits\": {\n \"additionalProperties\": false,\n \"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.\",\n \"properties\": {\n \"maxBytes\": {\n \"description\": \"The total size of the committed and reserved blobs the scope may hold.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"maxFileBytes\": {\n \"description\": \"The largest single blob the scope accepts. Never above 1 GiB, the transfer ceiling (BlobManifest).\",\n \"maximum\": 1073741824,\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"maxFiles\": {\n \"description\": \"The number of committed blobs the scope may hold. 0 refuses every upload at this scope.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n }\n },\n \"title\": \"ScopeLimits\",\n \"type\": \"object\"\n },\n \"StorageConfigId\": {\n \"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.\",\n \"maxLength\": 64,\n \"minLength\": 1,\n \"pattern\": \"^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$\",\n \"title\": \"StorageConfigId\",\n \"type\": \"string\"\n },\n \"UsageRow\": {\n \"additionalProperties\": false,\n \"description\": \"One group's figures. Holdings as of the read (or the end of the day, on a `day` row); activity over the range (or the day).\",\n \"properties\": {\n \"bytes\": {\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"capacityBytes\": {\n \"description\": \"On a `storageConfig` row, the config's capacity when it has one.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"date\": {\n \"description\": \"Present on a `day` row.\",\n \"format\": \"date\",\n \"type\": \"string\"\n },\n \"downloads\": {\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"egressBytes\": {\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"files\": {\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"limits\": {\n \"$ref\": \"#/$defs/ScopeLimits\",\n \"description\": \"On a `room` row the room's limits, on a `member` row (one room selected) that member's.\"\n },\n \"member\": {\n \"description\": \"Present on a `member` row.\",\n \"maxLength\": 2048,\n \"pattern\": \"^did:\",\n \"type\": \"string\"\n },\n \"reservedBytes\": {\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"roomId\": {\n \"description\": \"Present on a `room` row.\",\n \"maxLength\": 512,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"storageConfig\": {\n \"$ref\": \"#/$defs/StorageConfigId\",\n \"description\": \"Present on a `storageConfig` row, and on a `room` row as the room's assigned config.\"\n },\n \"uploads\": {\n \"minimum\": 0,\n \"type\": \"integer\"\n }\n },\n \"required\": [\n \"files\",\n \"bytes\",\n \"reservedBytes\",\n \"uploads\",\n \"downloads\",\n \"egressBytes\"\n ],\n \"type\": \"object\"\n }\n },\n \"$id\": \"https://trusttasks.org/spec/vtc/rooms/usage/0.1\",\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\": false,\n \"description\": \"A room-hosting administrator reports the storage and activity of the community's hosted rooms, grouped by room, member, storage config or day. The outer document members are owned by the framework — SPEC §6.3.\",\n \"properties\": {\n \"cursor\": {\n \"description\": \"Opaque continuation token from a previous page's `nextCursor`.\",\n \"maxLength\": 1024,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"filter\": {\n \"additionalProperties\": false,\n \"description\": \"Every member optional; all given apply together.\",\n \"properties\": {\n \"from\": {\n \"description\": \"First UTC day of the range. Default: 29 days before `to`.\",\n \"format\": \"date\",\n \"type\": \"string\"\n },\n \"member\": {\n \"description\": \"One member's figures, across the `attributed` rooms selected.\",\n \"maxLength\": 2048,\n \"pattern\": \"^did:\",\n \"type\": \"string\"\n },\n \"roomId\": {\n \"description\": \"The room's identifier, as its owner minted it.\",\n \"maxLength\": 512,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"storageConfig\": {\n \"$ref\": \"#/$defs/StorageConfigId\"\n },\n \"to\": {\n \"description\": \"Last UTC day of the range, inclusive. Default: today.\",\n \"format\": \"date\",\n \"type\": \"string\"\n }\n },\n \"type\": \"object\"\n },\n \"groupBy\": {\n \"description\": \"What each row describes. `day` is the daily history of whatever the filter selects.\",\n \"enum\": [\n \"room\",\n \"member\",\n \"storageConfig\",\n \"day\"\n ],\n \"type\": \"string\"\n },\n \"limit\": {\n \"description\": \"Page size. The community chooses when absent (50 in the reference implementation).\",\n \"maximum\": 100,\n \"minimum\": 1,\n \"type\": \"integer\"\n },\n \"sort\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"by\": {\n \"enum\": [\n \"bytes\",\n \"files\",\n \"uploads\",\n \"downloads\",\n \"egressBytes\",\n \"date\"\n ],\n \"type\": \"string\"\n },\n \"order\": {\n \"enum\": [\n \"asc\",\n \"desc\"\n ],\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"by\"\n ],\n \"type\": \"object\"\n }\n },\n \"required\": [\n \"groupBy\"\n ],\n \"title\": \"VTC Rooms — Usage — payload\",\n \"type\": \"object\"\n}\n",
);
}
impl crate::Payload for Response {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/vtc/rooms/usage/0.1#response";
const IS_RECIPIENT_REQUIRED: bool = true;
const PAYLOAD_SCHEMA: Option<&'static str> = Some(
"{\n \"$defs\": {\n \"Ext\": {\n \"additionalProperties\": true,\n \"description\": \"Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.\",\n \"minProperties\": 1,\n \"propertyNames\": {\n \"pattern\": \"^[a-z][a-z0-9-]*(\\\\.[a-z0-9-]+)+$\"\n },\n \"title\": \"Ext\",\n \"type\": \"object\"\n },\n \"Response\": {\n \"$anchor\": \"response\",\n \"additionalProperties\": false,\n \"properties\": {\n \"asOf\": {\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"from\": {\n \"format\": \"date\",\n \"type\": \"string\"\n },\n \"items\": {\n \"items\": {\n \"$ref\": \"#/$defs/UsageRow\"\n },\n \"maxItems\": 100,\n \"type\": \"array\"\n },\n \"nextCursor\": {\n \"description\": \"Present when more remain; pass it as `cursor`.\",\n \"maxLength\": 1024,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"to\": {\n \"format\": \"date\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"asOf\",\n \"from\",\n \"to\",\n \"items\"\n ],\n \"title\": \"VTC Rooms — Usage — response payload\",\n \"type\": \"object\"\n },\n \"ScopeLimits\": {\n \"additionalProperties\": false,\n \"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.\",\n \"properties\": {\n \"maxBytes\": {\n \"description\": \"The total size of the committed and reserved blobs the scope may hold.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"maxFileBytes\": {\n \"description\": \"The largest single blob the scope accepts. Never above 1 GiB, the transfer ceiling (BlobManifest).\",\n \"maximum\": 1073741824,\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"maxFiles\": {\n \"description\": \"The number of committed blobs the scope may hold. 0 refuses every upload at this scope.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n }\n },\n \"title\": \"ScopeLimits\",\n \"type\": \"object\"\n },\n \"StorageConfigId\": {\n \"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.\",\n \"maxLength\": 64,\n \"minLength\": 1,\n \"pattern\": \"^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$\",\n \"title\": \"StorageConfigId\",\n \"type\": \"string\"\n },\n \"UsageRow\": {\n \"additionalProperties\": false,\n \"description\": \"One group's figures. Holdings as of the read (or the end of the day, on a `day` row); activity over the range (or the day).\",\n \"properties\": {\n \"bytes\": {\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"capacityBytes\": {\n \"description\": \"On a `storageConfig` row, the config's capacity when it has one.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"date\": {\n \"description\": \"Present on a `day` row.\",\n \"format\": \"date\",\n \"type\": \"string\"\n },\n \"downloads\": {\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"egressBytes\": {\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"files\": {\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"limits\": {\n \"$ref\": \"#/$defs/ScopeLimits\",\n \"description\": \"On a `room` row the room's limits, on a `member` row (one room selected) that member's.\"\n },\n \"member\": {\n \"description\": \"Present on a `member` row.\",\n \"maxLength\": 2048,\n \"pattern\": \"^did:\",\n \"type\": \"string\"\n },\n \"reservedBytes\": {\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"roomId\": {\n \"description\": \"Present on a `room` row.\",\n \"maxLength\": 512,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"storageConfig\": {\n \"$ref\": \"#/$defs/StorageConfigId\",\n \"description\": \"Present on a `storageConfig` row, and on a `room` row as the room's assigned config.\"\n },\n \"uploads\": {\n \"minimum\": 0,\n \"type\": \"integer\"\n }\n },\n \"required\": [\n \"files\",\n \"bytes\",\n \"reservedBytes\",\n \"uploads\",\n \"downloads\",\n \"egressBytes\"\n ],\n \"type\": \"object\"\n }\n },\n \"$ref\": \"#/$defs/Response\",\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\"\n}\n",
);
}
impl crate::RequestPayload for Payload {
type Response = Response;
}
/// The extended error codes this specification declares (SPEC §7.3 item 9,
/// §8.5), in declaration order. Empty when it declares none.
pub const ERROR_CODES: &[crate::DeclaredErrorCode] = &[
error_codes::INVALID_RANGE,
error_codes::MEMBER_USAGE_UNAVAILABLE,
error_codes::INVALID_CURSOR,
];
/// 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/usage:invalidRange`
///
/// `from` is after `to`, the range is longer than 400 days, or it begins before the community's oldest retained day. `details.earliest` states the oldest day it holds.
///
/// Declared `retryable: false`.
/// Declares a `detailsSchema` for the error's `details` member.
pub const INVALID_RANGE: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "vtc/rooms/usage:invalidRange",
retryable: false,
details_schema: ::core::option::Option::Some(
"{\"additionalProperties\":false,\"properties\":{\"earliest\":{\"format\":\"date\",\"type\":\"string\"}},\"type\":\"object\"}",
),
};
/// `vtc/rooms/usage:memberUsageUnavailable`
///
/// Grouping or filtering by member was asked for a `private` room, whose host cannot tell members apart.
///
/// Declared `retryable: false`.
pub const MEMBER_USAGE_UNAVAILABLE: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "vtc/rooms/usage:memberUsageUnavailable",
retryable: false,
details_schema: ::core::option::Option::None,
};
/// `vtc/rooms/usage:invalidCursor`
///
/// `cursor` was not issued by this community for this filter, grouping and sort.
///
/// Declared `retryable: false`.
pub const INVALID_CURSOR: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "vtc/rooms/usage:invalidCursor",
retryable: false,
details_schema: ::core::option::Option::None,
};
}