forked from OpenAPITools/openapi-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod.rs
54 lines (45 loc) · 1.03 KB
/
mod.rs
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
use http;
use hyper;
use serde_json;
#[derive(Debug)]
pub enum Error {
Api(ApiError),
Header(hyper::http::header::InvalidHeaderValue),
Http(http::Error),
Hyper(hyper::Error),
Serde(serde_json::Error),
UriError(http::uri::InvalidUri),
}
#[derive(Debug)]
pub struct ApiError {
pub code: hyper::StatusCode,
pub body: hyper::body::Body,
}
impl From<(hyper::StatusCode, hyper::body::Body)> for Error {
fn from(e: (hyper::StatusCode, hyper::body::Body)) -> Self {
Error::Api(ApiError {
code: e.0,
body: e.1,
})
}
}
impl From<http::Error> for Error {
fn from(e: http::Error) -> Self {
Error::Http(e)
}
}
impl From<hyper::Error> for Error {
fn from(e: hyper::Error) -> Self {
Error::Hyper(e)
}
}
impl From<serde_json::Error> for Error {
fn from(e: serde_json::Error) -> Self {
Error::Serde(e)
}
}
mod request;
mod default_api;
pub use self::default_api::{ DefaultApi, DefaultApiClient };
pub mod configuration;
pub mod client;