forked from loafle/openapi-generator-original
Error structure can be parametrized (but is still hardcoded with serde_json::Value in generated code).
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{{>partial_header}}
|
||||
#[allow(unused_imports)]
|
||||
use std::rc::Rc;
|
||||
use std::borrow::Borrow;
|
||||
{{^supportAsync}}use std::borrow::Borrow;{{/supportAsync}}
|
||||
use std::option::Option;
|
||||
|
||||
use reqwest;
|
||||
@@ -49,10 +49,10 @@ pub trait {{{classname}}} {
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
{{#vendorExtensions.x-group-parameters}}
|
||||
fn {{{operationId}}}(&self{{#allParams}}{{#-first}}, params: {{{operationIdCamelCase}}}Params{{/-first}}{{/allParams}}) -> Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error>;
|
||||
fn {{{operationId}}}(&self{{#allParams}}{{#-first}}, params: {{{operationIdCamelCase}}}Params{{/-first}}{{/allParams}}) -> Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error<serde_json::Value>>;
|
||||
{{/vendorExtensions.x-group-parameters}}
|
||||
{{^vendorExtensions.x-group-parameters}}
|
||||
fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}crate::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error>;
|
||||
fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}crate::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error<serde_json::Value>>;
|
||||
{{/vendorExtensions.x-group-parameters}}
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
@@ -63,7 +63,7 @@ impl {{{classname}}} for {{{classname}}}Client {
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
{{#vendorExtensions.x-group-parameters}}
|
||||
{{#supportAsync}}pub async {{/supportAsync}}fn {{{operationId}}}({{^supportAsync}}&self{{/supportAsync}}{{#supportAsync}}configuration: &configuration::Configuration{{/supportAsync}}{{#allParams}}{{#-first}}, params: {{{operationIdCamelCase}}}Params{{/-first}}{{/allParams}}) -> Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error> {
|
||||
{{#supportAsync}}pub async {{/supportAsync}}fn {{{operationId}}}({{^supportAsync}}&self{{/supportAsync}}{{#supportAsync}}configuration: &configuration::Configuration{{/supportAsync}}{{#allParams}}{{#-first}}, params: {{{operationIdCamelCase}}}Params{{/-first}}{{/allParams}}) -> Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error<serde_json::Value>> {
|
||||
// unbox the parameters
|
||||
{{#allParams}}
|
||||
let {{paramName}} = params.{{paramName}};
|
||||
@@ -71,7 +71,7 @@ impl {{{classname}}} for {{{classname}}}Client {
|
||||
|
||||
{{/vendorExtensions.x-group-parameters}}
|
||||
{{^vendorExtensions.x-group-parameters}}
|
||||
{{#supportAsync}}pub async {{/supportAsync}}fn {{{operationId}}}({{^supportAsync}}&self{{/supportAsync}}{{#supportAsync}}configuration: &configuration::Configuration{{/supportAsync}}, {{#allParams}}{{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}crate::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error> {
|
||||
{{#supportAsync}}pub async {{/supportAsync}}fn {{{operationId}}}({{^supportAsync}}&self{{/supportAsync}}{{#supportAsync}}configuration: &configuration::Configuration{{/supportAsync}}, {{#allParams}}{{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}crate::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error<serde_json::Value>> {
|
||||
{{/vendorExtensions.x-group-parameters}}
|
||||
{{^supportAsync}}
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
@@ -263,7 +263,7 @@ impl {{{classname}}} for {{{classname}}}Client {
|
||||
{{/hasBodyParam}}
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let mut resp = client.execute(req){{#supportAsync}}.await{{/supportAsync}}?;
|
||||
let {{^supportAsync}}mut {{/supportAsync}}resp = client.execute(req){{#supportAsync}}.await{{/supportAsync}}?;
|
||||
if resp.status().is_success() {
|
||||
{{^returnType}}
|
||||
Ok(())
|
||||
|
||||
@@ -2,33 +2,33 @@ use reqwest;
|
||||
use serde_json;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ResponseErrorContent {
|
||||
pub struct ResponseErrorContent<T> {
|
||||
pub status: reqwest::StatusCode,
|
||||
pub content: String,
|
||||
pub entity: Option<serde_json::Value>,
|
||||
pub entity: Option<T>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
pub enum Error<T> {
|
||||
Reqwest(reqwest::Error),
|
||||
Serde(serde_json::Error),
|
||||
Io(std::io::Error),
|
||||
ResponseError(ResponseErrorContent),
|
||||
ResponseError(ResponseErrorContent<T>),
|
||||
}
|
||||
|
||||
impl From<reqwest::Error> for Error {
|
||||
impl <T> From<reqwest::Error> for Error<T> {
|
||||
fn from(e: reqwest::Error) -> Self {
|
||||
Error::Reqwest(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<serde_json::Error> for Error {
|
||||
impl <T> From<serde_json::Error> for Error<T> {
|
||||
fn from(e: serde_json::Error) -> Self {
|
||||
Error::Serde(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<std::io::Error> for Error {
|
||||
impl <T> From<std::io::Error> for Error<T> {
|
||||
fn from(e: std::io::Error) -> Self {
|
||||
Error::Io(e)
|
||||
}
|
||||
|
||||
@@ -31,11 +31,11 @@ impl DefaultApiClient {
|
||||
|
||||
|
||||
pub trait DefaultApi {
|
||||
fn fileresponsetest(&self, ) -> Result<std::path::PathBuf, Error>;
|
||||
fn fileresponsetest(&self, ) -> Result<std::path::PathBuf, Error<serde_json::Value>>;
|
||||
}
|
||||
|
||||
impl DefaultApi for DefaultApiClient {
|
||||
fn fileresponsetest(&self, ) -> Result<std::path::PathBuf, Error> {
|
||||
fn fileresponsetest(&self, ) -> Result<std::path::PathBuf, Error<serde_json::Value>> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
|
||||
@@ -2,33 +2,33 @@ use reqwest;
|
||||
use serde_json;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ResponseErrorContent {
|
||||
pub struct ResponseErrorContent<T> {
|
||||
pub status: reqwest::StatusCode,
|
||||
pub content: String,
|
||||
pub entity: Option<serde_json::Value>,
|
||||
pub entity: Option<T>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
pub enum Error<T> {
|
||||
Reqwest(reqwest::Error),
|
||||
Serde(serde_json::Error),
|
||||
Io(std::io::Error),
|
||||
ResponseError(ResponseErrorContent),
|
||||
ResponseError(ResponseErrorContent<T>),
|
||||
}
|
||||
|
||||
impl From<reqwest::Error> for Error {
|
||||
impl <T> From<reqwest::Error> for Error<T> {
|
||||
fn from(e: reqwest::Error) -> Self {
|
||||
Error::Reqwest(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<serde_json::Error> for Error {
|
||||
impl <T> From<serde_json::Error> for Error<T> {
|
||||
fn from(e: serde_json::Error) -> Self {
|
||||
Error::Serde(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<std::io::Error> for Error {
|
||||
impl <T> From<std::io::Error> for Error<T> {
|
||||
fn from(e: std::io::Error) -> Self {
|
||||
Error::Io(e)
|
||||
}
|
||||
|
||||
@@ -2,33 +2,33 @@ use reqwest;
|
||||
use serde_json;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ResponseErrorContent {
|
||||
pub struct ResponseErrorContent<T> {
|
||||
pub status: reqwest::StatusCode,
|
||||
pub content: String,
|
||||
pub entity: Option<serde_json::Value>,
|
||||
pub entity: Option<T>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
pub enum Error<T> {
|
||||
Reqwest(reqwest::Error),
|
||||
Serde(serde_json::Error),
|
||||
Io(std::io::Error),
|
||||
ResponseError(ResponseErrorContent),
|
||||
ResponseError(ResponseErrorContent<T>),
|
||||
}
|
||||
|
||||
impl From<reqwest::Error> for Error {
|
||||
impl <T> From<reqwest::Error> for Error<T> {
|
||||
fn from(e: reqwest::Error) -> Self {
|
||||
Error::Reqwest(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<serde_json::Error> for Error {
|
||||
impl <T> From<serde_json::Error> for Error<T> {
|
||||
fn from(e: serde_json::Error) -> Self {
|
||||
Error::Serde(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<std::io::Error> for Error {
|
||||
impl <T> From<std::io::Error> for Error<T> {
|
||||
fn from(e: std::io::Error) -> Self {
|
||||
Error::Io(e)
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use std::rc::Rc;
|
||||
use std::borrow::Borrow;
|
||||
|
||||
use std::option::Option;
|
||||
|
||||
use reqwest;
|
||||
@@ -18,7 +18,7 @@ use reqwest;
|
||||
use super::{Error, configuration};
|
||||
|
||||
|
||||
pub async fn add_pet(configuration: &configuration::Configuration, body: crate::models::Pet) -> Result<(), Error> {
|
||||
pub async fn add_pet(configuration: &configuration::Configuration, body: crate::models::Pet) -> Result<(), Error<serde_json::Value>> {
|
||||
let client = &configuration.client;
|
||||
|
||||
let uri_str = format!("{}/pet", configuration.base_path);
|
||||
@@ -33,7 +33,7 @@ use super::{Error, configuration};
|
||||
req_builder = req_builder.json(&body);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let mut resp = client.execute(req).await?;
|
||||
let resp = client.execute(req).await?;
|
||||
if resp.status().is_success() {
|
||||
Ok(())
|
||||
} else {
|
||||
@@ -45,7 +45,7 @@ use super::{Error, configuration};
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn delete_pet(configuration: &configuration::Configuration, pet_id: i64, api_key: Option<&str>) -> Result<(), Error> {
|
||||
pub async fn delete_pet(configuration: &configuration::Configuration, pet_id: i64, api_key: Option<&str>) -> Result<(), Error<serde_json::Value>> {
|
||||
let client = &configuration.client;
|
||||
|
||||
let uri_str = format!("{}/pet/{petId}", configuration.base_path, petId=pet_id);
|
||||
@@ -62,7 +62,7 @@ use super::{Error, configuration};
|
||||
};
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let mut resp = client.execute(req).await?;
|
||||
let resp = client.execute(req).await?;
|
||||
if resp.status().is_success() {
|
||||
Ok(())
|
||||
} else {
|
||||
@@ -74,7 +74,7 @@ use super::{Error, configuration};
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn find_pets_by_status(configuration: &configuration::Configuration, status: Vec<String>) -> Result<Vec<crate::models::Pet>, Error> {
|
||||
pub async fn find_pets_by_status(configuration: &configuration::Configuration, status: Vec<String>) -> Result<Vec<crate::models::Pet>, Error<serde_json::Value>> {
|
||||
let client = &configuration.client;
|
||||
|
||||
let uri_str = format!("{}/pet/findByStatus", configuration.base_path);
|
||||
@@ -89,7 +89,7 @@ use super::{Error, configuration};
|
||||
};
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let mut resp = client.execute(req).await?;
|
||||
let resp = client.execute(req).await?;
|
||||
if resp.status().is_success() {
|
||||
Ok(resp.json::<Vec<crate::models::Pet>>().await?)
|
||||
} else {
|
||||
@@ -101,7 +101,7 @@ use super::{Error, configuration};
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn find_pets_by_tags(configuration: &configuration::Configuration, tags: Vec<String>) -> Result<Vec<crate::models::Pet>, Error> {
|
||||
pub async fn find_pets_by_tags(configuration: &configuration::Configuration, tags: Vec<String>) -> Result<Vec<crate::models::Pet>, Error<serde_json::Value>> {
|
||||
let client = &configuration.client;
|
||||
|
||||
let uri_str = format!("{}/pet/findByTags", configuration.base_path);
|
||||
@@ -116,7 +116,7 @@ use super::{Error, configuration};
|
||||
};
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let mut resp = client.execute(req).await?;
|
||||
let resp = client.execute(req).await?;
|
||||
if resp.status().is_success() {
|
||||
Ok(resp.json::<Vec<crate::models::Pet>>().await?)
|
||||
} else {
|
||||
@@ -128,7 +128,7 @@ use super::{Error, configuration};
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_pet_by_id(configuration: &configuration::Configuration, pet_id: i64) -> Result<crate::models::Pet, Error> {
|
||||
pub async fn get_pet_by_id(configuration: &configuration::Configuration, pet_id: i64) -> Result<crate::models::Pet, Error<serde_json::Value>> {
|
||||
let client = &configuration.client;
|
||||
|
||||
let uri_str = format!("{}/pet/{petId}", configuration.base_path, petId=pet_id);
|
||||
@@ -147,7 +147,7 @@ use super::{Error, configuration};
|
||||
};
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let mut resp = client.execute(req).await?;
|
||||
let resp = client.execute(req).await?;
|
||||
if resp.status().is_success() {
|
||||
Ok(resp.json::<crate::models::Pet>().await?)
|
||||
} else {
|
||||
@@ -159,7 +159,7 @@ use super::{Error, configuration};
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn update_pet(configuration: &configuration::Configuration, body: crate::models::Pet) -> Result<(), Error> {
|
||||
pub async fn update_pet(configuration: &configuration::Configuration, body: crate::models::Pet) -> Result<(), Error<serde_json::Value>> {
|
||||
let client = &configuration.client;
|
||||
|
||||
let uri_str = format!("{}/pet", configuration.base_path);
|
||||
@@ -174,7 +174,7 @@ use super::{Error, configuration};
|
||||
req_builder = req_builder.json(&body);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let mut resp = client.execute(req).await?;
|
||||
let resp = client.execute(req).await?;
|
||||
if resp.status().is_success() {
|
||||
Ok(())
|
||||
} else {
|
||||
@@ -186,7 +186,7 @@ use super::{Error, configuration};
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn update_pet_with_form(configuration: &configuration::Configuration, pet_id: i64, name: Option<&str>, status: Option<&str>) -> Result<(), Error> {
|
||||
pub async fn update_pet_with_form(configuration: &configuration::Configuration, pet_id: i64, name: Option<&str>, status: Option<&str>) -> Result<(), Error<serde_json::Value>> {
|
||||
let client = &configuration.client;
|
||||
|
||||
let uri_str = format!("{}/pet/{petId}", configuration.base_path, petId=pet_id);
|
||||
@@ -208,7 +208,7 @@ use super::{Error, configuration};
|
||||
req_builder = req_builder.form(&form_params);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let mut resp = client.execute(req).await?;
|
||||
let resp = client.execute(req).await?;
|
||||
if resp.status().is_success() {
|
||||
Ok(())
|
||||
} else {
|
||||
@@ -220,7 +220,7 @@ use super::{Error, configuration};
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn upload_file(configuration: &configuration::Configuration, pet_id: i64, additional_metadata: Option<&str>, file: Option<std::path::PathBuf>) -> Result<crate::models::ApiResponse, Error> {
|
||||
pub async fn upload_file(configuration: &configuration::Configuration, pet_id: i64, additional_metadata: Option<&str>, file: Option<std::path::PathBuf>) -> Result<crate::models::ApiResponse, Error<serde_json::Value>> {
|
||||
let client = &configuration.client;
|
||||
|
||||
let uri_str = format!("{}/pet/{petId}/uploadImage", configuration.base_path, petId=pet_id);
|
||||
@@ -240,7 +240,7 @@ use super::{Error, configuration};
|
||||
req_builder = req_builder.multipart(form);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let mut resp = client.execute(req).await?;
|
||||
let resp = client.execute(req).await?;
|
||||
if resp.status().is_success() {
|
||||
Ok(resp.json::<crate::models::ApiResponse>().await?)
|
||||
} else {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use std::rc::Rc;
|
||||
use std::borrow::Borrow;
|
||||
|
||||
use std::option::Option;
|
||||
|
||||
use reqwest;
|
||||
@@ -18,7 +18,7 @@ use reqwest;
|
||||
use super::{Error, configuration};
|
||||
|
||||
|
||||
pub async fn delete_order(configuration: &configuration::Configuration, order_id: &str) -> Result<(), Error> {
|
||||
pub async fn delete_order(configuration: &configuration::Configuration, order_id: &str) -> Result<(), Error<serde_json::Value>> {
|
||||
let client = &configuration.client;
|
||||
|
||||
let uri_str = format!("{}/store/order/{orderId}", configuration.base_path, orderId=crate::apis::urlencode(order_id));
|
||||
@@ -29,7 +29,7 @@ use super::{Error, configuration};
|
||||
}
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let mut resp = client.execute(req).await?;
|
||||
let resp = client.execute(req).await?;
|
||||
if resp.status().is_success() {
|
||||
Ok(())
|
||||
} else {
|
||||
@@ -41,7 +41,7 @@ use super::{Error, configuration};
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_inventory(configuration: &configuration::Configuration, ) -> Result<::std::collections::HashMap<String, i32>, Error> {
|
||||
pub async fn get_inventory(configuration: &configuration::Configuration, ) -> Result<::std::collections::HashMap<String, i32>, Error<serde_json::Value>> {
|
||||
let client = &configuration.client;
|
||||
|
||||
let uri_str = format!("{}/store/inventory", configuration.base_path);
|
||||
@@ -60,7 +60,7 @@ use super::{Error, configuration};
|
||||
};
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let mut resp = client.execute(req).await?;
|
||||
let resp = client.execute(req).await?;
|
||||
if resp.status().is_success() {
|
||||
Ok(resp.json::<::std::collections::HashMap<String, i32>>().await?)
|
||||
} else {
|
||||
@@ -72,7 +72,7 @@ use super::{Error, configuration};
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_order_by_id(configuration: &configuration::Configuration, order_id: i64) -> Result<crate::models::Order, Error> {
|
||||
pub async fn get_order_by_id(configuration: &configuration::Configuration, order_id: i64) -> Result<crate::models::Order, Error<serde_json::Value>> {
|
||||
let client = &configuration.client;
|
||||
|
||||
let uri_str = format!("{}/store/order/{orderId}", configuration.base_path, orderId=order_id);
|
||||
@@ -83,7 +83,7 @@ use super::{Error, configuration};
|
||||
}
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let mut resp = client.execute(req).await?;
|
||||
let resp = client.execute(req).await?;
|
||||
if resp.status().is_success() {
|
||||
Ok(resp.json::<crate::models::Order>().await?)
|
||||
} else {
|
||||
@@ -95,7 +95,7 @@ use super::{Error, configuration};
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn place_order(configuration: &configuration::Configuration, body: crate::models::Order) -> Result<crate::models::Order, Error> {
|
||||
pub async fn place_order(configuration: &configuration::Configuration, body: crate::models::Order) -> Result<crate::models::Order, Error<serde_json::Value>> {
|
||||
let client = &configuration.client;
|
||||
|
||||
let uri_str = format!("{}/store/order", configuration.base_path);
|
||||
@@ -107,7 +107,7 @@ use super::{Error, configuration};
|
||||
req_builder = req_builder.json(&body);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let mut resp = client.execute(req).await?;
|
||||
let resp = client.execute(req).await?;
|
||||
if resp.status().is_success() {
|
||||
Ok(resp.json::<crate::models::Order>().await?)
|
||||
} else {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use std::rc::Rc;
|
||||
use std::borrow::Borrow;
|
||||
|
||||
use std::option::Option;
|
||||
|
||||
use reqwest;
|
||||
@@ -18,7 +18,7 @@ use reqwest;
|
||||
use super::{Error, configuration};
|
||||
|
||||
|
||||
pub async fn create_user(configuration: &configuration::Configuration, body: crate::models::User) -> Result<(), Error> {
|
||||
pub async fn create_user(configuration: &configuration::Configuration, body: crate::models::User) -> Result<(), Error<serde_json::Value>> {
|
||||
let client = &configuration.client;
|
||||
|
||||
let uri_str = format!("{}/user", configuration.base_path);
|
||||
@@ -30,7 +30,7 @@ use super::{Error, configuration};
|
||||
req_builder = req_builder.json(&body);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let mut resp = client.execute(req).await?;
|
||||
let resp = client.execute(req).await?;
|
||||
if resp.status().is_success() {
|
||||
Ok(())
|
||||
} else {
|
||||
@@ -42,7 +42,7 @@ use super::{Error, configuration};
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn create_users_with_array_input(configuration: &configuration::Configuration, body: Vec<crate::models::User>) -> Result<(), Error> {
|
||||
pub async fn create_users_with_array_input(configuration: &configuration::Configuration, body: Vec<crate::models::User>) -> Result<(), Error<serde_json::Value>> {
|
||||
let client = &configuration.client;
|
||||
|
||||
let uri_str = format!("{}/user/createWithArray", configuration.base_path);
|
||||
@@ -54,7 +54,7 @@ use super::{Error, configuration};
|
||||
req_builder = req_builder.json(&body);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let mut resp = client.execute(req).await?;
|
||||
let resp = client.execute(req).await?;
|
||||
if resp.status().is_success() {
|
||||
Ok(())
|
||||
} else {
|
||||
@@ -66,7 +66,7 @@ use super::{Error, configuration};
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn create_users_with_list_input(configuration: &configuration::Configuration, body: Vec<crate::models::User>) -> Result<(), Error> {
|
||||
pub async fn create_users_with_list_input(configuration: &configuration::Configuration, body: Vec<crate::models::User>) -> Result<(), Error<serde_json::Value>> {
|
||||
let client = &configuration.client;
|
||||
|
||||
let uri_str = format!("{}/user/createWithList", configuration.base_path);
|
||||
@@ -78,7 +78,7 @@ use super::{Error, configuration};
|
||||
req_builder = req_builder.json(&body);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let mut resp = client.execute(req).await?;
|
||||
let resp = client.execute(req).await?;
|
||||
if resp.status().is_success() {
|
||||
Ok(())
|
||||
} else {
|
||||
@@ -90,7 +90,7 @@ use super::{Error, configuration};
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn delete_user(configuration: &configuration::Configuration, username: &str) -> Result<(), Error> {
|
||||
pub async fn delete_user(configuration: &configuration::Configuration, username: &str) -> Result<(), Error<serde_json::Value>> {
|
||||
let client = &configuration.client;
|
||||
|
||||
let uri_str = format!("{}/user/{username}", configuration.base_path, username=crate::apis::urlencode(username));
|
||||
@@ -101,7 +101,7 @@ use super::{Error, configuration};
|
||||
}
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let mut resp = client.execute(req).await?;
|
||||
let resp = client.execute(req).await?;
|
||||
if resp.status().is_success() {
|
||||
Ok(())
|
||||
} else {
|
||||
@@ -113,7 +113,7 @@ use super::{Error, configuration};
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_user_by_name(configuration: &configuration::Configuration, username: &str) -> Result<crate::models::User, Error> {
|
||||
pub async fn get_user_by_name(configuration: &configuration::Configuration, username: &str) -> Result<crate::models::User, Error<serde_json::Value>> {
|
||||
let client = &configuration.client;
|
||||
|
||||
let uri_str = format!("{}/user/{username}", configuration.base_path, username=crate::apis::urlencode(username));
|
||||
@@ -124,7 +124,7 @@ use super::{Error, configuration};
|
||||
}
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let mut resp = client.execute(req).await?;
|
||||
let resp = client.execute(req).await?;
|
||||
if resp.status().is_success() {
|
||||
Ok(resp.json::<crate::models::User>().await?)
|
||||
} else {
|
||||
@@ -136,7 +136,7 @@ use super::{Error, configuration};
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn login_user(configuration: &configuration::Configuration, username: &str, password: &str) -> Result<String, Error> {
|
||||
pub async fn login_user(configuration: &configuration::Configuration, username: &str, password: &str) -> Result<String, Error<serde_json::Value>> {
|
||||
let client = &configuration.client;
|
||||
|
||||
let uri_str = format!("{}/user/login", configuration.base_path);
|
||||
@@ -149,7 +149,7 @@ use super::{Error, configuration};
|
||||
}
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let mut resp = client.execute(req).await?;
|
||||
let resp = client.execute(req).await?;
|
||||
if resp.status().is_success() {
|
||||
Ok(resp.json::<String>().await?)
|
||||
} else {
|
||||
@@ -161,7 +161,7 @@ use super::{Error, configuration};
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn logout_user(configuration: &configuration::Configuration, ) -> Result<(), Error> {
|
||||
pub async fn logout_user(configuration: &configuration::Configuration, ) -> Result<(), Error<serde_json::Value>> {
|
||||
let client = &configuration.client;
|
||||
|
||||
let uri_str = format!("{}/user/logout", configuration.base_path);
|
||||
@@ -172,7 +172,7 @@ use super::{Error, configuration};
|
||||
}
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let mut resp = client.execute(req).await?;
|
||||
let resp = client.execute(req).await?;
|
||||
if resp.status().is_success() {
|
||||
Ok(())
|
||||
} else {
|
||||
@@ -184,7 +184,7 @@ use super::{Error, configuration};
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn update_user(configuration: &configuration::Configuration, username: &str, body: crate::models::User) -> Result<(), Error> {
|
||||
pub async fn update_user(configuration: &configuration::Configuration, username: &str, body: crate::models::User) -> Result<(), Error<serde_json::Value>> {
|
||||
let client = &configuration.client;
|
||||
|
||||
let uri_str = format!("{}/user/{username}", configuration.base_path, username=crate::apis::urlencode(username));
|
||||
@@ -196,7 +196,7 @@ use super::{Error, configuration};
|
||||
req_builder = req_builder.json(&body);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let mut resp = client.execute(req).await?;
|
||||
let resp = client.execute(req).await?;
|
||||
if resp.status().is_success() {
|
||||
Ok(())
|
||||
} else {
|
||||
|
||||
@@ -2,33 +2,33 @@ use reqwest;
|
||||
use serde_json;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ResponseErrorContent {
|
||||
pub struct ResponseErrorContent<T> {
|
||||
pub status: reqwest::StatusCode,
|
||||
pub content: String,
|
||||
pub entity: Option<serde_json::Value>,
|
||||
pub entity: Option<T>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
pub enum Error<T> {
|
||||
Reqwest(reqwest::Error),
|
||||
Serde(serde_json::Error),
|
||||
Io(std::io::Error),
|
||||
ResponseError(ResponseErrorContent),
|
||||
ResponseError(ResponseErrorContent<T>),
|
||||
}
|
||||
|
||||
impl From<reqwest::Error> for Error {
|
||||
impl <T> From<reqwest::Error> for Error<T> {
|
||||
fn from(e: reqwest::Error) -> Self {
|
||||
Error::Reqwest(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<serde_json::Error> for Error {
|
||||
impl <T> From<serde_json::Error> for Error<T> {
|
||||
fn from(e: serde_json::Error) -> Self {
|
||||
Error::Serde(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<std::io::Error> for Error {
|
||||
impl <T> From<std::io::Error> for Error<T> {
|
||||
fn from(e: std::io::Error) -> Self {
|
||||
Error::Io(e)
|
||||
}
|
||||
|
||||
@@ -31,18 +31,18 @@ impl PetApiClient {
|
||||
|
||||
|
||||
pub trait PetApi {
|
||||
fn add_pet(&self, body: crate::models::Pet) -> Result<(), Error>;
|
||||
fn delete_pet(&self, pet_id: i64, api_key: Option<&str>) -> Result<(), Error>;
|
||||
fn find_pets_by_status(&self, status: Vec<String>) -> Result<Vec<crate::models::Pet>, Error>;
|
||||
fn find_pets_by_tags(&self, tags: Vec<String>) -> Result<Vec<crate::models::Pet>, Error>;
|
||||
fn get_pet_by_id(&self, pet_id: i64) -> Result<crate::models::Pet, Error>;
|
||||
fn update_pet(&self, body: crate::models::Pet) -> Result<(), Error>;
|
||||
fn update_pet_with_form(&self, pet_id: i64, name: Option<&str>, status: Option<&str>) -> Result<(), Error>;
|
||||
fn upload_file(&self, pet_id: i64, additional_metadata: Option<&str>, file: Option<std::path::PathBuf>) -> Result<crate::models::ApiResponse, Error>;
|
||||
fn add_pet(&self, body: crate::models::Pet) -> Result<(), Error<serde_json::Value>>;
|
||||
fn delete_pet(&self, pet_id: i64, api_key: Option<&str>) -> Result<(), Error<serde_json::Value>>;
|
||||
fn find_pets_by_status(&self, status: Vec<String>) -> Result<Vec<crate::models::Pet>, Error<serde_json::Value>>;
|
||||
fn find_pets_by_tags(&self, tags: Vec<String>) -> Result<Vec<crate::models::Pet>, Error<serde_json::Value>>;
|
||||
fn get_pet_by_id(&self, pet_id: i64) -> Result<crate::models::Pet, Error<serde_json::Value>>;
|
||||
fn update_pet(&self, body: crate::models::Pet) -> Result<(), Error<serde_json::Value>>;
|
||||
fn update_pet_with_form(&self, pet_id: i64, name: Option<&str>, status: Option<&str>) -> Result<(), Error<serde_json::Value>>;
|
||||
fn upload_file(&self, pet_id: i64, additional_metadata: Option<&str>, file: Option<std::path::PathBuf>) -> Result<crate::models::ApiResponse, Error<serde_json::Value>>;
|
||||
}
|
||||
|
||||
impl PetApi for PetApiClient {
|
||||
fn add_pet(&self, body: crate::models::Pet) -> Result<(), Error> {
|
||||
fn add_pet(&self, body: crate::models::Pet) -> Result<(), Error<serde_json::Value>> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
@@ -70,7 +70,7 @@ impl PetApi for PetApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
fn delete_pet(&self, pet_id: i64, api_key: Option<&str>) -> Result<(), Error> {
|
||||
fn delete_pet(&self, pet_id: i64, api_key: Option<&str>) -> Result<(), Error<serde_json::Value>> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
@@ -100,7 +100,7 @@ impl PetApi for PetApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
fn find_pets_by_status(&self, status: Vec<String>) -> Result<Vec<crate::models::Pet>, Error> {
|
||||
fn find_pets_by_status(&self, status: Vec<String>) -> Result<Vec<crate::models::Pet>, Error<serde_json::Value>> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
@@ -128,7 +128,7 @@ impl PetApi for PetApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
fn find_pets_by_tags(&self, tags: Vec<String>) -> Result<Vec<crate::models::Pet>, Error> {
|
||||
fn find_pets_by_tags(&self, tags: Vec<String>) -> Result<Vec<crate::models::Pet>, Error<serde_json::Value>> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
@@ -156,7 +156,7 @@ impl PetApi for PetApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_pet_by_id(&self, pet_id: i64) -> Result<crate::models::Pet, Error> {
|
||||
fn get_pet_by_id(&self, pet_id: i64) -> Result<crate::models::Pet, Error<serde_json::Value>> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
@@ -188,7 +188,7 @@ impl PetApi for PetApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
fn update_pet(&self, body: crate::models::Pet) -> Result<(), Error> {
|
||||
fn update_pet(&self, body: crate::models::Pet) -> Result<(), Error<serde_json::Value>> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
@@ -216,7 +216,7 @@ impl PetApi for PetApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
fn update_pet_with_form(&self, pet_id: i64, name: Option<&str>, status: Option<&str>) -> Result<(), Error> {
|
||||
fn update_pet_with_form(&self, pet_id: i64, name: Option<&str>, status: Option<&str>) -> Result<(), Error<serde_json::Value>> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
@@ -251,7 +251,7 @@ impl PetApi for PetApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
fn upload_file(&self, pet_id: i64, additional_metadata: Option<&str>, file: Option<std::path::PathBuf>) -> Result<crate::models::ApiResponse, Error> {
|
||||
fn upload_file(&self, pet_id: i64, additional_metadata: Option<&str>, file: Option<std::path::PathBuf>) -> Result<crate::models::ApiResponse, Error<serde_json::Value>> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
|
||||
@@ -31,14 +31,14 @@ impl StoreApiClient {
|
||||
|
||||
|
||||
pub trait StoreApi {
|
||||
fn delete_order(&self, order_id: &str) -> Result<(), Error>;
|
||||
fn get_inventory(&self, ) -> Result<::std::collections::HashMap<String, i32>, Error>;
|
||||
fn get_order_by_id(&self, order_id: i64) -> Result<crate::models::Order, Error>;
|
||||
fn place_order(&self, body: crate::models::Order) -> Result<crate::models::Order, Error>;
|
||||
fn delete_order(&self, order_id: &str) -> Result<(), Error<serde_json::Value>>;
|
||||
fn get_inventory(&self, ) -> Result<::std::collections::HashMap<String, i32>, Error<serde_json::Value>>;
|
||||
fn get_order_by_id(&self, order_id: i64) -> Result<crate::models::Order, Error<serde_json::Value>>;
|
||||
fn place_order(&self, body: crate::models::Order) -> Result<crate::models::Order, Error<serde_json::Value>>;
|
||||
}
|
||||
|
||||
impl StoreApi for StoreApiClient {
|
||||
fn delete_order(&self, order_id: &str) -> Result<(), Error> {
|
||||
fn delete_order(&self, order_id: &str) -> Result<(), Error<serde_json::Value>> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
@@ -62,7 +62,7 @@ impl StoreApi for StoreApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_inventory(&self, ) -> Result<::std::collections::HashMap<String, i32>, Error> {
|
||||
fn get_inventory(&self, ) -> Result<::std::collections::HashMap<String, i32>, Error<serde_json::Value>> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
@@ -94,7 +94,7 @@ impl StoreApi for StoreApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_order_by_id(&self, order_id: i64) -> Result<crate::models::Order, Error> {
|
||||
fn get_order_by_id(&self, order_id: i64) -> Result<crate::models::Order, Error<serde_json::Value>> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
@@ -118,7 +118,7 @@ impl StoreApi for StoreApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
fn place_order(&self, body: crate::models::Order) -> Result<crate::models::Order, Error> {
|
||||
fn place_order(&self, body: crate::models::Order) -> Result<crate::models::Order, Error<serde_json::Value>> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
|
||||
@@ -31,18 +31,18 @@ impl UserApiClient {
|
||||
|
||||
|
||||
pub trait UserApi {
|
||||
fn create_user(&self, body: crate::models::User) -> Result<(), Error>;
|
||||
fn create_users_with_array_input(&self, body: Vec<crate::models::User>) -> Result<(), Error>;
|
||||
fn create_users_with_list_input(&self, body: Vec<crate::models::User>) -> Result<(), Error>;
|
||||
fn delete_user(&self, username: &str) -> Result<(), Error>;
|
||||
fn get_user_by_name(&self, username: &str) -> Result<crate::models::User, Error>;
|
||||
fn login_user(&self, username: &str, password: &str) -> Result<String, Error>;
|
||||
fn logout_user(&self, ) -> Result<(), Error>;
|
||||
fn update_user(&self, username: &str, body: crate::models::User) -> Result<(), Error>;
|
||||
fn create_user(&self, body: crate::models::User) -> Result<(), Error<serde_json::Value>>;
|
||||
fn create_users_with_array_input(&self, body: Vec<crate::models::User>) -> Result<(), Error<serde_json::Value>>;
|
||||
fn create_users_with_list_input(&self, body: Vec<crate::models::User>) -> Result<(), Error<serde_json::Value>>;
|
||||
fn delete_user(&self, username: &str) -> Result<(), Error<serde_json::Value>>;
|
||||
fn get_user_by_name(&self, username: &str) -> Result<crate::models::User, Error<serde_json::Value>>;
|
||||
fn login_user(&self, username: &str, password: &str) -> Result<String, Error<serde_json::Value>>;
|
||||
fn logout_user(&self, ) -> Result<(), Error<serde_json::Value>>;
|
||||
fn update_user(&self, username: &str, body: crate::models::User) -> Result<(), Error<serde_json::Value>>;
|
||||
}
|
||||
|
||||
impl UserApi for UserApiClient {
|
||||
fn create_user(&self, body: crate::models::User) -> Result<(), Error> {
|
||||
fn create_user(&self, body: crate::models::User) -> Result<(), Error<serde_json::Value>> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
@@ -67,7 +67,7 @@ impl UserApi for UserApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
fn create_users_with_array_input(&self, body: Vec<crate::models::User>) -> Result<(), Error> {
|
||||
fn create_users_with_array_input(&self, body: Vec<crate::models::User>) -> Result<(), Error<serde_json::Value>> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
@@ -92,7 +92,7 @@ impl UserApi for UserApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
fn create_users_with_list_input(&self, body: Vec<crate::models::User>) -> Result<(), Error> {
|
||||
fn create_users_with_list_input(&self, body: Vec<crate::models::User>) -> Result<(), Error<serde_json::Value>> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
@@ -117,7 +117,7 @@ impl UserApi for UserApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
fn delete_user(&self, username: &str) -> Result<(), Error> {
|
||||
fn delete_user(&self, username: &str) -> Result<(), Error<serde_json::Value>> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
@@ -141,7 +141,7 @@ impl UserApi for UserApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_user_by_name(&self, username: &str) -> Result<crate::models::User, Error> {
|
||||
fn get_user_by_name(&self, username: &str) -> Result<crate::models::User, Error<serde_json::Value>> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
@@ -165,7 +165,7 @@ impl UserApi for UserApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
fn login_user(&self, username: &str, password: &str) -> Result<String, Error> {
|
||||
fn login_user(&self, username: &str, password: &str) -> Result<String, Error<serde_json::Value>> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
@@ -191,7 +191,7 @@ impl UserApi for UserApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
fn logout_user(&self, ) -> Result<(), Error> {
|
||||
fn logout_user(&self, ) -> Result<(), Error<serde_json::Value>> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
@@ -215,7 +215,7 @@ impl UserApi for UserApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
fn update_user(&self, username: &str, body: crate::models::User) -> Result<(), Error> {
|
||||
fn update_user(&self, username: &str, body: crate::models::User) -> Result<(), Error<serde_json::Value>> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
|
||||
@@ -31,11 +31,11 @@ impl DefaultApiClient {
|
||||
|
||||
|
||||
pub trait DefaultApi {
|
||||
fn dummy_get(&self, ) -> Result<(), Error>;
|
||||
fn dummy_get(&self, ) -> Result<(), Error<serde_json::Value>>;
|
||||
}
|
||||
|
||||
impl DefaultApi for DefaultApiClient {
|
||||
fn dummy_get(&self, ) -> Result<(), Error> {
|
||||
fn dummy_get(&self, ) -> Result<(), Error<serde_json::Value>> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
|
||||
@@ -2,33 +2,33 @@ use reqwest;
|
||||
use serde_json;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ResponseErrorContent {
|
||||
pub struct ResponseErrorContent<T> {
|
||||
pub status: reqwest::StatusCode,
|
||||
pub content: String,
|
||||
pub entity: Option<serde_json::Value>,
|
||||
pub entity: Option<T>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
pub enum Error<T> {
|
||||
Reqwest(reqwest::Error),
|
||||
Serde(serde_json::Error),
|
||||
Io(std::io::Error),
|
||||
ResponseError(ResponseErrorContent),
|
||||
ResponseError(ResponseErrorContent<T>),
|
||||
}
|
||||
|
||||
impl From<reqwest::Error> for Error {
|
||||
impl <T> From<reqwest::Error> for Error<T> {
|
||||
fn from(e: reqwest::Error) -> Self {
|
||||
Error::Reqwest(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<serde_json::Error> for Error {
|
||||
impl <T> From<serde_json::Error> for Error<T> {
|
||||
fn from(e: serde_json::Error) -> Self {
|
||||
Error::Serde(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<std::io::Error> for Error {
|
||||
impl <T> From<std::io::Error> for Error<T> {
|
||||
fn from(e: std::io::Error) -> Self {
|
||||
Error::Io(e)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user