jacquard-api 0.12.0-beta.2

Generated AT Protocol API bindings for Jacquard
Documentation
// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: app.rocksky.dropbox.defs
//
// This file was automatically generated from Lexicon schemas.
// Any manual changes will be overwritten on the next regeneration.

pub mod download_file;
pub mod get_files;
pub mod get_metadata;
pub mod get_temporary_link;

#[allow(unused_imports)]
use alloc::collections::BTreeMap;
use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr};

#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::string::{Datetime, UriValue};
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;

use crate::app_rocksky::dropbox;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(
    rename_all = "camelCase",
    bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct FileListView<S: BosStr = DefaultStr> {
    ///A list of files in the Dropbox.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub files: Option<Vec<dropbox::FileView<S>>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(
    rename_all = "camelCase",
    bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct FileView<S: BosStr = DefaultStr> {
    ///The last modified date and time of the file on the client.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub client_modified: Option<Datetime>,
    ///The unique identifier of the file.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub id: Option<S>,
    ///The name of the file.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub name: Option<S>,
    ///The display path of the file.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub path_display: Option<S>,
    ///The lowercased path of the file.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub path_lower: Option<S>,
    ///The last modified date and time of the file on the server.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub server_modified: Option<Datetime>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(
    rename_all = "camelCase",
    bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct TemporaryLinkView<S: BosStr = DefaultStr> {
    ///The temporary link to access the file.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub link: Option<UriValue<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

impl<S: BosStr> LexiconSchema for FileListView<S> {
    fn nsid() -> &'static str {
        "app.rocksky.dropbox.defs"
    }
    fn def_name() -> &'static str {
        "fileListView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_app_rocksky_dropbox_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for FileView<S> {
    fn nsid() -> &'static str {
        "app.rocksky.dropbox.defs"
    }
    fn def_name() -> &'static str {
        "fileView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_app_rocksky_dropbox_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for TemporaryLinkView<S> {
    fn nsid() -> &'static str {
        "app.rocksky.dropbox.defs"
    }
    fn def_name() -> &'static str {
        "temporaryLinkView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_app_rocksky_dropbox_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

fn lexicon_doc_app_rocksky_dropbox_defs() -> LexiconDoc<'static> {
    use alloc::collections::BTreeMap;
    #[allow(unused_imports)]
    use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
    use jacquard_lexicon::lexicon::*;
    LexiconDoc {
        lexicon: Lexicon::Lexicon1,
        id: CowStr::new_static("app.rocksky.dropbox.defs"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("fileListView"),
                LexUserType::Object(LexObject {
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("files"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(CowStr::new_static(
                                    "A list of files in the Dropbox.",
                                )),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("app.rocksky.dropbox.defs#fileView"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("fileView"),
                LexUserType::Object(LexObject {
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("clientModified"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static(
                                    "The last modified date and time of the file on the client.",
                                )),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("id"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static(
                                    "The unique identifier of the file.",
                                )),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("The name of the file.")),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("pathDisplay"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static(
                                    "The display path of the file.",
                                )),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("pathLower"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static(
                                    "The lowercased path of the file.",
                                )),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("serverModified"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static(
                                    "The last modified date and time of the file on the server.",
                                )),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("temporaryLinkView"),
                LexUserType::Object(LexObject {
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("link"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static(
                                    "The temporary link to access the file.",
                                )),
                                format: Some(LexStringFormat::Uri),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}