1use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
16pub enum HttpStatusCode {
17 #[serde(rename = "Continue")]
18 Continue,
19 #[serde(rename = "SwitchingProtocols")]
20 SwitchingProtocols,
21 #[serde(rename = "Processing")]
22 Processing,
23 #[serde(rename = "EarlyHints")]
24 EarlyHints,
25 #[serde(rename = "OK")]
26 Ok,
27 #[serde(rename = "Created")]
28 Created,
29 #[serde(rename = "Accepted")]
30 Accepted,
31 #[serde(rename = "NonAuthoritativeInformation")]
32 NonAuthoritativeInformation,
33 #[serde(rename = "NoContent")]
34 NoContent,
35 #[serde(rename = "ResetContent")]
36 ResetContent,
37 #[serde(rename = "PartialContent")]
38 PartialContent,
39 #[serde(rename = "MultiStatus")]
40 MultiStatus,
41 #[serde(rename = "AlreadyReported")]
42 AlreadyReported,
43 #[serde(rename = "IMUsed")]
44 ImUsed,
45 #[serde(rename = "MultipleChoices")]
46 MultipleChoices,
47 #[serde(rename = "MovedPermanently")]
48 MovedPermanently,
49 #[serde(rename = "Found")]
50 Found,
51 #[serde(rename = "SeeOther")]
52 SeeOther,
53 #[serde(rename = "NotModified")]
54 NotModified,
55 #[serde(rename = "UseProxy")]
56 UseProxy,
57 #[serde(rename = "Unused")]
58 Unused,
59 #[serde(rename = "TemporaryRedirect")]
60 TemporaryRedirect,
61 #[serde(rename = "PermanentRedirect")]
62 PermanentRedirect,
63 #[serde(rename = "BadRequest")]
64 BadRequest,
65 #[serde(rename = "Unauthorized")]
66 Unauthorized,
67 #[serde(rename = "PaymentRequired")]
68 PaymentRequired,
69 #[serde(rename = "Forbidden")]
70 Forbidden,
71 #[serde(rename = "NotFound")]
72 NotFound,
73 #[serde(rename = "MethodNotAllowed")]
74 MethodNotAllowed,
75 #[serde(rename = "NotAcceptable")]
76 NotAcceptable,
77 #[serde(rename = "ProxyAuthenticationRequired")]
78 ProxyAuthenticationRequired,
79 #[serde(rename = "RequestTimeout")]
80 RequestTimeout,
81 #[serde(rename = "Conflict")]
82 Conflict,
83 #[serde(rename = "Gone")]
84 Gone,
85 #[serde(rename = "LengthRequired")]
86 LengthRequired,
87 #[serde(rename = "PreconditionFailed")]
88 PreconditionFailed,
89 #[serde(rename = "RequestEntityTooLarge")]
90 RequestEntityTooLarge,
91 #[serde(rename = "RequestUriTooLong")]
92 RequestUriTooLong,
93 #[serde(rename = "UnsupportedMediaType")]
94 UnsupportedMediaType,
95 #[serde(rename = "RequestedRangeNotSatisfiable")]
96 RequestedRangeNotSatisfiable,
97 #[serde(rename = "ExpectationFailed")]
98 ExpectationFailed,
99 #[serde(rename = "MisdirectedRequest")]
100 MisdirectedRequest,
101 #[serde(rename = "UnprocessableEntity")]
102 UnprocessableEntity,
103 #[serde(rename = "Locked")]
104 Locked,
105 #[serde(rename = "FailedDependency")]
106 FailedDependency,
107 #[serde(rename = "UpgradeRequired")]
108 UpgradeRequired,
109 #[serde(rename = "PreconditionRequired")]
110 PreconditionRequired,
111 #[serde(rename = "TooManyRequests")]
112 TooManyRequests,
113 #[serde(rename = "RequestHeaderFieldsTooLarge")]
114 RequestHeaderFieldsTooLarge,
115 #[serde(rename = "UnavailableForLegalReasons")]
116 UnavailableForLegalReasons,
117 #[serde(rename = "InternalServerError")]
118 InternalServerError,
119 #[serde(rename = "NotImplemented")]
120 NotImplemented,
121 #[serde(rename = "BadGateway")]
122 BadGateway,
123 #[serde(rename = "ServiceUnavailable")]
124 ServiceUnavailable,
125 #[serde(rename = "GatewayTimeout")]
126 GatewayTimeout,
127 #[serde(rename = "HttpVersionNotSupported")]
128 HttpVersionNotSupported,
129 #[serde(rename = "VariantAlsoNegotiates")]
130 VariantAlsoNegotiates,
131 #[serde(rename = "InsufficientStorage")]
132 InsufficientStorage,
133 #[serde(rename = "LoopDetected")]
134 LoopDetected,
135 #[serde(rename = "NotExtended")]
136 NotExtended,
137 #[serde(rename = "NetworkAuthenticationRequired")]
138 NetworkAuthenticationRequired,
139
140}
141
142impl std::fmt::Display for HttpStatusCode {
143 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
144 match self {
145 Self::Continue => write!(f, "Continue"),
146 Self::SwitchingProtocols => write!(f, "SwitchingProtocols"),
147 Self::Processing => write!(f, "Processing"),
148 Self::EarlyHints => write!(f, "EarlyHints"),
149 Self::Ok => write!(f, "OK"),
150 Self::Created => write!(f, "Created"),
151 Self::Accepted => write!(f, "Accepted"),
152 Self::NonAuthoritativeInformation => write!(f, "NonAuthoritativeInformation"),
153 Self::NoContent => write!(f, "NoContent"),
154 Self::ResetContent => write!(f, "ResetContent"),
155 Self::PartialContent => write!(f, "PartialContent"),
156 Self::MultiStatus => write!(f, "MultiStatus"),
157 Self::AlreadyReported => write!(f, "AlreadyReported"),
158 Self::ImUsed => write!(f, "IMUsed"),
159 Self::MultipleChoices => write!(f, "MultipleChoices"),
160 Self::MovedPermanently => write!(f, "MovedPermanently"),
161 Self::Found => write!(f, "Found"),
162 Self::SeeOther => write!(f, "SeeOther"),
163 Self::NotModified => write!(f, "NotModified"),
164 Self::UseProxy => write!(f, "UseProxy"),
165 Self::Unused => write!(f, "Unused"),
166 Self::TemporaryRedirect => write!(f, "TemporaryRedirect"),
167 Self::PermanentRedirect => write!(f, "PermanentRedirect"),
168 Self::BadRequest => write!(f, "BadRequest"),
169 Self::Unauthorized => write!(f, "Unauthorized"),
170 Self::PaymentRequired => write!(f, "PaymentRequired"),
171 Self::Forbidden => write!(f, "Forbidden"),
172 Self::NotFound => write!(f, "NotFound"),
173 Self::MethodNotAllowed => write!(f, "MethodNotAllowed"),
174 Self::NotAcceptable => write!(f, "NotAcceptable"),
175 Self::ProxyAuthenticationRequired => write!(f, "ProxyAuthenticationRequired"),
176 Self::RequestTimeout => write!(f, "RequestTimeout"),
177 Self::Conflict => write!(f, "Conflict"),
178 Self::Gone => write!(f, "Gone"),
179 Self::LengthRequired => write!(f, "LengthRequired"),
180 Self::PreconditionFailed => write!(f, "PreconditionFailed"),
181 Self::RequestEntityTooLarge => write!(f, "RequestEntityTooLarge"),
182 Self::RequestUriTooLong => write!(f, "RequestUriTooLong"),
183 Self::UnsupportedMediaType => write!(f, "UnsupportedMediaType"),
184 Self::RequestedRangeNotSatisfiable => write!(f, "RequestedRangeNotSatisfiable"),
185 Self::ExpectationFailed => write!(f, "ExpectationFailed"),
186 Self::MisdirectedRequest => write!(f, "MisdirectedRequest"),
187 Self::UnprocessableEntity => write!(f, "UnprocessableEntity"),
188 Self::Locked => write!(f, "Locked"),
189 Self::FailedDependency => write!(f, "FailedDependency"),
190 Self::UpgradeRequired => write!(f, "UpgradeRequired"),
191 Self::PreconditionRequired => write!(f, "PreconditionRequired"),
192 Self::TooManyRequests => write!(f, "TooManyRequests"),
193 Self::RequestHeaderFieldsTooLarge => write!(f, "RequestHeaderFieldsTooLarge"),
194 Self::UnavailableForLegalReasons => write!(f, "UnavailableForLegalReasons"),
195 Self::InternalServerError => write!(f, "InternalServerError"),
196 Self::NotImplemented => write!(f, "NotImplemented"),
197 Self::BadGateway => write!(f, "BadGateway"),
198 Self::ServiceUnavailable => write!(f, "ServiceUnavailable"),
199 Self::GatewayTimeout => write!(f, "GatewayTimeout"),
200 Self::HttpVersionNotSupported => write!(f, "HttpVersionNotSupported"),
201 Self::VariantAlsoNegotiates => write!(f, "VariantAlsoNegotiates"),
202 Self::InsufficientStorage => write!(f, "InsufficientStorage"),
203 Self::LoopDetected => write!(f, "LoopDetected"),
204 Self::NotExtended => write!(f, "NotExtended"),
205 Self::NetworkAuthenticationRequired => write!(f, "NetworkAuthenticationRequired"),
206 }
207 }
208}
209
210impl Default for HttpStatusCode {
211 fn default() -> HttpStatusCode {
212 Self::Continue
213 }
214}
215