rusty_box/client/
client_error_model.rs

1/*
2 * Box Platform API
3 *
4 * [Box Platform](https://box.dev) provides functionality to provide access to content stored within [Box](https://box.com). It provides endpoints for basic manipulation of files and folders, management of users within an enterprise, as well as more complex topics such as legal holds and retention policies.
5 *
6 * The version of the OpenAPI document: 2.0.0
7 * Contact: devrel@box.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
12pub struct ClientErrorContextInfo {
13    /// More details on the error.
14    #[serde(rename = "message", skip_serializing_if = "Option::is_none")]
15    pub message: Option<String>,
16}
17
18impl ClientErrorContextInfo {
19    /// A free-form object that contains additional context about the error. The possible fields are defined on a per-endpoint basis. `message` is only one example.
20    pub fn new() -> ClientErrorContextInfo {
21        ClientErrorContextInfo { message: None }
22    }
23}
24
25/// ClientError : A generic error
26
27#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
28pub struct BoxAPIErrorResponse {
29    /// `error`
30    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
31    pub object_type: Option<ObjectType>,
32    /// The HTTP status of the response.
33    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
34    pub status: Option<i32>,
35    /// A Box-specific error code
36    #[serde(rename = "code", skip_serializing_if = "Option::is_none")]
37    pub code: Option<Code>,
38    /// A short message describing the error.
39    #[serde(rename = "message", skip_serializing_if = "Option::is_none")]
40    pub message: Option<String>,
41    #[serde(rename = "context_info", skip_serializing_if = "Option::is_none")]
42    pub context_info: Option<Box<ClientErrorContextInfo>>,
43    /// A URL that links to more information about why this error occurred.
44    #[serde(rename = "help_url", skip_serializing_if = "Option::is_none")]
45    pub help_url: Option<String>,
46    /// A unique identifier for this response, which can be used when contacting Box support.
47    #[serde(rename = "request_id", skip_serializing_if = "Option::is_none")]
48    pub request_id: Option<String>,
49}
50
51impl BoxAPIErrorResponse {
52    /// A generic error
53    pub fn new() -> BoxAPIErrorResponse {
54        BoxAPIErrorResponse {
55            object_type: None,
56            status: None,
57            code: None,
58            message: None,
59            context_info: None,
60            help_url: None,
61            request_id: None,
62        }
63    }
64}
65
66/// `error`
67#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
68pub enum ObjectType {
69    #[serde(rename = "error")]
70    Error,
71}
72
73impl Default for ObjectType {
74    fn default() -> ObjectType {
75        Self::Error
76    }
77}
78/// A Box-specific error code
79#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
80pub enum Code {
81    #[serde(rename = "created")]
82    Created,
83    #[serde(rename = "accepted")]
84    Accepted,
85    #[serde(rename = "no_content")]
86    NoContent,
87    #[serde(rename = "redirect")]
88    Redirect,
89    #[serde(rename = "not_modified")]
90    NotModified,
91    #[serde(rename = "bad_request")]
92    BadRequest,
93    #[serde(rename = "unauthorized")]
94    Unauthorized,
95    #[serde(rename = "forbidden")]
96    Forbidden,
97    #[serde(rename = "not_found")]
98    NotFound,
99    #[serde(rename = "method_not_allowed")]
100    MethodNotAllowed,
101    #[serde(rename = "conflict")]
102    Conflict,
103    #[serde(rename = "precondition_failed")]
104    PreconditionFailed,
105    #[serde(rename = "too_many_requests")]
106    TooManyRequests,
107    #[serde(rename = "internal_server_error")]
108    InternalServerError,
109    #[serde(rename = "unavailable")]
110    Unavailable,
111    #[serde(rename = "item_name_invalid")]
112    ItemNameInvalid,
113    #[serde(rename = "insufficient_scope")]
114    InsufficientScope,
115    #[serde(rename = "user_login_already_used")]
116    UserLoginAlreadyUsed,
117}
118
119impl Default for Code {
120    fn default() -> Code {
121        Self::NoContent
122    }
123}