Skip to main content

atrium_api/app/bsky/video/
upload_part.rs

1// @generated - This file is generated by atrium-codegen. DO NOT EDIT.
2//!Definitions for the `app.bsky.video.uploadPart` namespace.
3pub const NSID: &str = "app.bsky.video.uploadPart";
4#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
5#[serde(rename_all = "camelCase")]
6pub struct OutputData {
7    pub part_number: core::num::NonZeroU64,
8    pub size_bytes: i64,
9}
10pub type Output = crate::types::Object<OutputData>;
11#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
12#[serde(tag = "error", content = "message")]
13pub enum Error {
14    ///The job ID is unknown or aged out of retention; known terminal sessions are never reported as not found.
15    UploadNotFound(Option<String>),
16    ///The upload session expired before completion.
17    UploadExpired(Option<String>),
18    ///The part number is outside the upload's valid part range.
19    InvalidPartNumber(Option<String>),
20    ///Content-Length does not exactly match the expected size for this part.
21    PartSizeMismatch(Option<String>),
22    ///A finish is in progress; check getUploadStatus and retry.
23    UploadNotReady(Option<String>),
24    ///The session is known to have failed; the error carries its failure reason.
25    UploadFailed(Option<String>),
26    ///The session is known to have been aborted.
27    UploadAborted(Option<String>),
28    ///The session is known to have already completed.
29    UploadAlreadyCompleted(Option<String>),
30    ///The service is draining or temporarily at capacity; retry on another worker.
31    ServiceOverloaded(Option<String>),
32}
33impl std::fmt::Display for Error {
34    fn fmt(&self, _f: &mut std::fmt::Formatter) -> std::fmt::Result {
35        match self {
36            Error::UploadNotFound(msg) => {
37                write!(_f, "UploadNotFound")?;
38                if let Some(msg) = msg {
39                    write!(_f, ": {msg}")?;
40                }
41            }
42            Error::UploadExpired(msg) => {
43                write!(_f, "UploadExpired")?;
44                if let Some(msg) = msg {
45                    write!(_f, ": {msg}")?;
46                }
47            }
48            Error::InvalidPartNumber(msg) => {
49                write!(_f, "InvalidPartNumber")?;
50                if let Some(msg) = msg {
51                    write!(_f, ": {msg}")?;
52                }
53            }
54            Error::PartSizeMismatch(msg) => {
55                write!(_f, "PartSizeMismatch")?;
56                if let Some(msg) = msg {
57                    write!(_f, ": {msg}")?;
58                }
59            }
60            Error::UploadNotReady(msg) => {
61                write!(_f, "UploadNotReady")?;
62                if let Some(msg) = msg {
63                    write!(_f, ": {msg}")?;
64                }
65            }
66            Error::UploadFailed(msg) => {
67                write!(_f, "UploadFailed")?;
68                if let Some(msg) = msg {
69                    write!(_f, ": {msg}")?;
70                }
71            }
72            Error::UploadAborted(msg) => {
73                write!(_f, "UploadAborted")?;
74                if let Some(msg) = msg {
75                    write!(_f, ": {msg}")?;
76                }
77            }
78            Error::UploadAlreadyCompleted(msg) => {
79                write!(_f, "UploadAlreadyCompleted")?;
80                if let Some(msg) = msg {
81                    write!(_f, ": {msg}")?;
82                }
83            }
84            Error::ServiceOverloaded(msg) => {
85                write!(_f, "ServiceOverloaded")?;
86                if let Some(msg) = msg {
87                    write!(_f, ": {msg}")?;
88                }
89            }
90        }
91        Ok(())
92    }
93}