atrium_api/com/atproto/repo/
create_record.rs

1// @generated - This file is generated by atrium-codegen. DO NOT EDIT.
2//!Definitions for the `com.atproto.repo.createRecord` namespace.
3pub const NSID: &str = "com.atproto.repo.createRecord";
4#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
5#[serde(rename_all = "camelCase")]
6pub struct InputData {
7    ///The NSID of the record collection.
8    pub collection: crate::types::string::Nsid,
9    ///The record itself. Must contain a $type field.
10    pub record: crate::types::Unknown,
11    ///The handle or DID of the repo (aka, current account).
12    pub repo: crate::types::string::AtIdentifier,
13    ///The Record Key.
14    #[serde(skip_serializing_if = "core::option::Option::is_none")]
15    pub rkey: core::option::Option<crate::types::string::RecordKey>,
16    ///Compare and swap with the previous commit by CID.
17    #[serde(skip_serializing_if = "core::option::Option::is_none")]
18    pub swap_commit: core::option::Option<crate::types::string::Cid>,
19    ///Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons.
20    #[serde(skip_serializing_if = "core::option::Option::is_none")]
21    pub validate: core::option::Option<bool>,
22}
23pub type Input = crate::types::Object<InputData>;
24#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
25#[serde(rename_all = "camelCase")]
26pub struct OutputData {
27    pub cid: crate::types::string::Cid,
28    #[serde(skip_serializing_if = "core::option::Option::is_none")]
29    pub commit: core::option::Option<crate::com::atproto::repo::defs::CommitMeta>,
30    pub uri: String,
31    #[serde(skip_serializing_if = "core::option::Option::is_none")]
32    pub validation_status: core::option::Option<String>,
33}
34pub type Output = crate::types::Object<OutputData>;
35#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
36#[serde(tag = "error", content = "message")]
37pub enum Error {
38    ///Indicates that 'swapCommit' didn't match current repo commit.
39    InvalidSwap(Option<String>),
40}
41impl std::fmt::Display for Error {
42    fn fmt(&self, _f: &mut std::fmt::Formatter) -> std::fmt::Result {
43        match self {
44            Error::InvalidSwap(msg) => {
45                write!(_f, "InvalidSwap")?;
46                if let Some(msg) = msg {
47                    write!(_f, ": {msg}")?;
48                }
49            }
50        }
51        Ok(())
52    }
53}