1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*
 * Box Platform API
 *
 * [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.
 *
 * The version of the OpenAPI document: 2.0.0
 * Contact: devrel@box.com
 * Generated by: https://openapi-generator.tech
 */

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct ClientErrorContextInfo {
    /// More details on the error.
    #[serde(rename = "message", skip_serializing_if = "Option::is_none")]
    pub message: Option<String>,
}

impl ClientErrorContextInfo {
    /// 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.
    pub fn new() -> ClientErrorContextInfo {
        ClientErrorContextInfo { message: None }
    }
}

/// ClientError : A generic error

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct BoxAPIErrorResponse {
    /// `error`
    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
    pub object_type: Option<ObjectType>,
    /// The HTTP status of the response.
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<i32>,
    /// A Box-specific error code
    #[serde(rename = "code", skip_serializing_if = "Option::is_none")]
    pub code: Option<Code>,
    /// A short message describing the error.
    #[serde(rename = "message", skip_serializing_if = "Option::is_none")]
    pub message: Option<String>,
    #[serde(rename = "context_info", skip_serializing_if = "Option::is_none")]
    pub context_info: Option<Box<ClientErrorContextInfo>>,
    /// A URL that links to more information about why this error occurred.
    #[serde(rename = "help_url", skip_serializing_if = "Option::is_none")]
    pub help_url: Option<String>,
    /// A unique identifier for this response, which can be used when contacting Box support.
    #[serde(rename = "request_id", skip_serializing_if = "Option::is_none")]
    pub request_id: Option<String>,
}

impl BoxAPIErrorResponse {
    /// A generic error
    pub fn new() -> BoxAPIErrorResponse {
        BoxAPIErrorResponse {
            object_type: None,
            status: None,
            code: None,
            message: None,
            context_info: None,
            help_url: None,
            request_id: None,
        }
    }
}

/// `error`
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ObjectType {
    #[serde(rename = "error")]
    Error,
}

impl Default for ObjectType {
    fn default() -> ObjectType {
        Self::Error
    }
}
/// A Box-specific error code
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Code {
    #[serde(rename = "created")]
    Created,
    #[serde(rename = "accepted")]
    Accepted,
    #[serde(rename = "no_content")]
    NoContent,
    #[serde(rename = "redirect")]
    Redirect,
    #[serde(rename = "not_modified")]
    NotModified,
    #[serde(rename = "bad_request")]
    BadRequest,
    #[serde(rename = "unauthorized")]
    Unauthorized,
    #[serde(rename = "forbidden")]
    Forbidden,
    #[serde(rename = "not_found")]
    NotFound,
    #[serde(rename = "method_not_allowed")]
    MethodNotAllowed,
    #[serde(rename = "conflict")]
    Conflict,
    #[serde(rename = "precondition_failed")]
    PreconditionFailed,
    #[serde(rename = "too_many_requests")]
    TooManyRequests,
    #[serde(rename = "internal_server_error")]
    InternalServerError,
    #[serde(rename = "unavailable")]
    Unavailable,
    #[serde(rename = "item_name_invalid")]
    ItemNameInvalid,
    #[serde(rename = "insufficient_scope")]
    InsufficientScope,
    #[serde(rename = "user_login_already_used")]
    UserLoginAlreadyUsed,
}

impl Default for Code {
    fn default() -> Code {
        Self::NoContent
    }
}