atrium-api 0.26.0

API library for AT Protocol (Bluesky)
Documentation
// @generated - This file is generated by atrium-codegen. DO NOT EDIT.
//!Definitions for the `app.bsky.video.uploadPart` namespace.
pub const NSID: &str = "app.bsky.video.uploadPart";
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct OutputData {
    pub part_number: core::num::NonZeroU64,
    pub size_bytes: i64,
}
pub type Output = crate::types::Object<OutputData>;
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(tag = "error", content = "message")]
pub enum Error {
    ///The job ID is unknown or aged out of retention; known terminal sessions are never reported as not found.
    UploadNotFound(Option<String>),
    ///The upload session expired before completion.
    UploadExpired(Option<String>),
    ///The part number is outside the upload's valid part range.
    InvalidPartNumber(Option<String>),
    ///Content-Length does not exactly match the expected size for this part.
    PartSizeMismatch(Option<String>),
    ///A finish is in progress; check getUploadStatus and retry.
    UploadNotReady(Option<String>),
    ///The session is known to have failed; the error carries its failure reason.
    UploadFailed(Option<String>),
    ///The session is known to have been aborted.
    UploadAborted(Option<String>),
    ///The session is known to have already completed.
    UploadAlreadyCompleted(Option<String>),
    ///The service is draining or temporarily at capacity; retry on another worker.
    ServiceOverloaded(Option<String>),
}
impl std::fmt::Display for Error {
    fn fmt(&self, _f: &mut std::fmt::Formatter) -> std::fmt::Result {
        match self {
            Error::UploadNotFound(msg) => {
                write!(_f, "UploadNotFound")?;
                if let Some(msg) = msg {
                    write!(_f, ": {msg}")?;
                }
            }
            Error::UploadExpired(msg) => {
                write!(_f, "UploadExpired")?;
                if let Some(msg) = msg {
                    write!(_f, ": {msg}")?;
                }
            }
            Error::InvalidPartNumber(msg) => {
                write!(_f, "InvalidPartNumber")?;
                if let Some(msg) = msg {
                    write!(_f, ": {msg}")?;
                }
            }
            Error::PartSizeMismatch(msg) => {
                write!(_f, "PartSizeMismatch")?;
                if let Some(msg) = msg {
                    write!(_f, ": {msg}")?;
                }
            }
            Error::UploadNotReady(msg) => {
                write!(_f, "UploadNotReady")?;
                if let Some(msg) = msg {
                    write!(_f, ": {msg}")?;
                }
            }
            Error::UploadFailed(msg) => {
                write!(_f, "UploadFailed")?;
                if let Some(msg) = msg {
                    write!(_f, ": {msg}")?;
                }
            }
            Error::UploadAborted(msg) => {
                write!(_f, "UploadAborted")?;
                if let Some(msg) = msg {
                    write!(_f, ": {msg}")?;
                }
            }
            Error::UploadAlreadyCompleted(msg) => {
                write!(_f, "UploadAlreadyCompleted")?;
                if let Some(msg) = msg {
                    write!(_f, ": {msg}")?;
                }
            }
            Error::ServiceOverloaded(msg) => {
                write!(_f, "ServiceOverloaded")?;
                if let Some(msg) = msg {
                    write!(_f, ": {msg}")?;
                }
            }
        }
        Ok(())
    }
}