rust.hyper.api_mod.mustache Maven / Gradle / Ivy
use std::fmt;
use std::fmt::Debug;
use hyper;
use hyper::http;
use hyper_util::client::legacy::connect::Connect;
use serde_json;
#[derive(Debug)]
pub enum Error {
Api(ApiError),
Header(http::header::InvalidHeaderValue),
Http(http::Error),
Hyper(hyper::Error),
HyperClient(hyper_util::client::legacy::Error),
Serde(serde_json::Error),
UriError(http::uri::InvalidUri),
}
pub struct ApiError {
pub code: hyper::StatusCode,
pub body: hyper::body::Incoming,
}
impl Debug for ApiError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("ApiError")
.field("code", &self.code)
.field("body", &"hyper::body::Incoming")
.finish()
}
}
impl From<(hyper::StatusCode, hyper::body::Incoming)> for Error {
fn from(e: (hyper::StatusCode, hyper::body::Incoming)) -> Self {
Error::Api(ApiError {
code: e.0,
body: e.1,
})
}
}
impl From for Error {
fn from(e: http::Error) -> Self {
Error::Http(e)
}
}
impl From for Error {
fn from(e: hyper_util::client::legacy::Error) -> Self {
Error::HyperClient(e)
}
}
impl From for Error {
fn from(e: hyper::Error) -> Self {
Error::Hyper(e)
}
}
impl From for Error {
fn from(e: serde_json::Error) -> Self {
Error::Serde(e)
}
}
mod request;
{{#apiInfo}}
{{#apis}}
mod {{{classFilename}}};
{{#operations}}
{{#operation}}
{{#-last}}
pub use self::{{{classFilename}}}::{ {{{classname}}}, {{{classname}}}Client };
{{/-last}}
{{/operation}}
{{/operations}}
{{/apis}}
{{/apiInfo}}
pub mod configuration;
pub mod client;
© 2015 - 2024 Weber Informatics LLC | Privacy Policy