forked from loafle/openapi-generator-original
Add rust discriminator (#3895)
* Add support for the `discriminator` feature of OpenAPI 3, and implement it with `enum` in Rust * Add all missing explicit `dyn` to trait types to remove warnings * Add missing re-export for properties that are enum (was missing from #2244).
This commit is contained in:
parent
a979fd8e13
commit
f96ed69c26
@ -156,6 +156,45 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
return postProcessModelsEnum(objs);
|
return postProcessModelsEnum(objs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"static-method", "unchecked"})
|
||||||
|
public Map<String, Object> postProcessAllModels(Map<String, Object> objs) {
|
||||||
|
// Index all CodegenModels by model name.
|
||||||
|
Map<String, CodegenModel> allModels = new HashMap<>();
|
||||||
|
for (Map.Entry<String, Object> entry : objs.entrySet()) {
|
||||||
|
String modelName = toModelName(entry.getKey());
|
||||||
|
Map<String, Object> inner = (Map<String, Object>) entry.getValue();
|
||||||
|
List<Map<String, Object>> models = (List<Map<String, Object>>) inner.get("models");
|
||||||
|
for (Map<String, Object> mo : models) {
|
||||||
|
CodegenModel cm = (CodegenModel) mo.get("model");
|
||||||
|
allModels.put(modelName, cm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (Map.Entry<String, Object> entry : objs.entrySet()) {
|
||||||
|
Map<String, Object> inner = (Map<String, Object>) entry.getValue();
|
||||||
|
List<Map<String, Object>> models = (List<Map<String, Object>>) inner.get("models");
|
||||||
|
for (Map<String, Object> mo : models) {
|
||||||
|
CodegenModel cm = (CodegenModel) mo.get("model");
|
||||||
|
if (cm.discriminator != null) {
|
||||||
|
List<Object> discriminatorVars = new ArrayList<>();
|
||||||
|
for(CodegenDiscriminator.MappedModel mappedModel: cm.discriminator.getMappedModels()) {
|
||||||
|
CodegenModel model = allModels.get(mappedModel.getModelName());
|
||||||
|
Map<String, Object> mas = new HashMap<>();
|
||||||
|
mas.put("modelName", camelize(mappedModel.getModelName()));
|
||||||
|
mas.put("mappingName", mappedModel.getMappingName());
|
||||||
|
List<CodegenProperty> vars = model.getVars();
|
||||||
|
vars.removeIf(p -> p.name.equals(cm.discriminator.getPropertyName()));
|
||||||
|
mas.put("vars", vars);
|
||||||
|
discriminatorVars.add(mas);
|
||||||
|
}
|
||||||
|
// TODO: figure out how to properly have the original property type that didn't go through toVarName
|
||||||
|
cm.vendorExtensions.put("tagName", cm.discriminator.getPropertyName().replace("_", ""));
|
||||||
|
cm.vendorExtensions.put("mappedModels", discriminatorVars);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return objs;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processOpts() {
|
public void processOpts() {
|
||||||
super.processOpts();
|
super.processOpts();
|
||||||
|
@ -16,7 +16,7 @@ pub struct {{{classname}}}Client<C: hyper::client::Connect> {
|
|||||||
impl<C: hyper::client::Connect> {{{classname}}}Client<C> {
|
impl<C: hyper::client::Connect> {{{classname}}}Client<C> {
|
||||||
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> {{{classname}}}Client<C> {
|
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> {{{classname}}}Client<C> {
|
||||||
{{{classname}}}Client {
|
{{{classname}}}Client {
|
||||||
configuration: configuration,
|
configuration,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -24,7 +24,7 @@ impl<C: hyper::client::Connect> {{{classname}}}Client<C> {
|
|||||||
pub trait {{{classname}}} {
|
pub trait {{{classname}}} {
|
||||||
{{#operations}}
|
{{#operations}}
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}crate::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Box<Future<Item = {{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error = Error<serde_json::Value>>>;
|
fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}crate::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Box<dyn Future<Item = {{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error = Error<serde_json::Value>>>;
|
||||||
{{/operation}}
|
{{/operation}}
|
||||||
{{/operations}}
|
{{/operations}}
|
||||||
}
|
}
|
||||||
@ -33,7 +33,7 @@ pub trait {{{classname}}} {
|
|||||||
impl<C: hyper::client::Connect>{{{classname}}} for {{{classname}}}Client<C> {
|
impl<C: hyper::client::Connect>{{{classname}}} for {{{classname}}}Client<C> {
|
||||||
{{#operations}}
|
{{#operations}}
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}crate::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Box<Future<Item = {{^returnType}}(){{/returnType}}{{#returnType}}{{{.}}}{{/returnType}}, Error = Error<serde_json::Value>>> {
|
fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}crate::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Box<dyn Future<Item = {{^returnType}}(){{/returnType}}{{#returnType}}{{{.}}}{{/returnType}}, Error = Error<serde_json::Value>>> {
|
||||||
__internal_request::Request::new(hyper::Method::{{{httpMethod}}}, "{{{path}}}".to_string())
|
__internal_request::Request::new(hyper::Method::{{{httpMethod}}}, "{{{path}}}".to_string())
|
||||||
{{#hasAuthMethods}}
|
{{#hasAuthMethods}}
|
||||||
{{#authMethods}}
|
{{#authMethods}}
|
||||||
|
@ -9,7 +9,7 @@ pub struct APIClient {
|
|||||||
{{#operations}}
|
{{#operations}}
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
{{#-last}}
|
{{#-last}}
|
||||||
{{{classFilename}}}: Box<crate::apis::{{{classname}}}>,
|
{{{classFilename}}}: Box<dyn crate::apis::{{{classname}}}>,
|
||||||
{{/-last}}
|
{{/-last}}
|
||||||
{{/operation}}
|
{{/operation}}
|
||||||
{{/operations}}
|
{{/operations}}
|
||||||
@ -41,7 +41,7 @@ impl APIClient {
|
|||||||
{{#operations}}
|
{{#operations}}
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
{{#-last}}
|
{{#-last}}
|
||||||
pub fn {{{classFilename}}}(&self) -> &crate::apis::{{{classname}}}{
|
pub fn {{{classFilename}}}(&self) -> &dyn crate::apis::{{{classname}}}{
|
||||||
self.{{{classFilename}}}.as_ref()
|
self.{{{classFilename}}}.as_ref()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
{{!-- for enum schemas --}}
|
{{!-- for enum schemas --}}
|
||||||
{{#isEnum}}
|
{{#isEnum}}
|
||||||
/// {{{description}}}
|
/// {{{description}}}
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub enum {{classname}} {
|
pub enum {{classname}} {
|
||||||
{{#allowableValues}}
|
{{#allowableValues}}
|
||||||
{{#enumVars}}
|
{{#enumVars}}
|
||||||
@ -18,8 +18,32 @@ pub enum {{classname}} {
|
|||||||
}
|
}
|
||||||
{{/isEnum}}
|
{{/isEnum}}
|
||||||
|
|
||||||
|
{{!-- for schemas that have a discriminator --}}
|
||||||
|
{{#discriminator}}
|
||||||
|
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||||
|
#[serde(tag = "{{{vendorExtensions.tagName}}}")]
|
||||||
|
pub enum {{classname}} {
|
||||||
|
{{#vendorExtensions}}
|
||||||
|
{{#mappedModels}}
|
||||||
|
#[serde(rename="{{mappingName}}")]
|
||||||
|
{{modelName}} {
|
||||||
|
{{#vars}}
|
||||||
|
{{#description}}
|
||||||
|
/// {{{description}}}
|
||||||
|
{{/description}}
|
||||||
|
#[serde(rename = "{{{baseName}}}"{{^required}}, skip_serializing_if = "Option::is_none"{{/required}})]
|
||||||
|
{{{name}}}: {{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{^required}}Option<{{/required}}{{#isEnum}}{{{enumName}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{^required}}>{{/required}},
|
||||||
|
{{/vars}}
|
||||||
|
},
|
||||||
|
{{/mappedModels}}
|
||||||
|
{{/vendorExtensions}}
|
||||||
|
}
|
||||||
|
|
||||||
|
{{/discriminator}}
|
||||||
|
|
||||||
{{!-- for non-enum schemas --}}
|
{{!-- for non-enum schemas --}}
|
||||||
{{^isEnum}}
|
{{^isEnum}}
|
||||||
|
{{^discriminator}}
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct {{{classname}}} {
|
pub struct {{{classname}}} {
|
||||||
{{#vars}}
|
{{#vars}}
|
||||||
@ -38,11 +62,12 @@ impl {{{classname}}} {
|
|||||||
pub fn new({{#requiredVars}}{{{name}}}: {{#isNullable}}Option<{{/isNullable}}{{#isEnum}}{{{enumName}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}}>{{/isNullable}}{{^-last}}, {{/-last}}{{/requiredVars}}) -> {{{classname}}} {
|
pub fn new({{#requiredVars}}{{{name}}}: {{#isNullable}}Option<{{/isNullable}}{{#isEnum}}{{{enumName}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}}>{{/isNullable}}{{^-last}}, {{/-last}}{{/requiredVars}}) -> {{{classname}}} {
|
||||||
{{{classname}}} {
|
{{{classname}}} {
|
||||||
{{#vars}}
|
{{#vars}}
|
||||||
{{{name}}}: {{#required}}{{{name}}}{{/required}}{{^required}}{{#isListContainer}}None{{/isListContainer}}{{#isMapContainer}}None{{/isMapContainer}}{{^isContainer}}None{{/isContainer}}{{/required}},
|
{{{name}}}{{^required}}{{#isListContainer}}: None{{/isListContainer}}{{#isMapContainer}}: None{{/isMapContainer}}{{^isContainer}}: None{{/isContainer}}{{/required}},
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
{{/discriminator}}
|
||||||
{{/isEnum}}
|
{{/isEnum}}
|
||||||
|
|
||||||
{{!-- for properties that are of enum type --}}
|
{{!-- for properties that are of enum type --}}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{{#models}}
|
{{#models}}
|
||||||
{{#model}}
|
{{#model}}
|
||||||
mod {{{classFilename}}};
|
pub mod {{{classFilename}}};
|
||||||
pub use self::{{{classFilename}}}::{{{classname}}};
|
pub use self::{{{classFilename}}}::{{{classname}}};
|
||||||
{{/model}}
|
{{/model}}
|
||||||
{{/models}}
|
{{/models}}
|
||||||
|
@ -98,7 +98,7 @@ impl Request {
|
|||||||
pub fn execute<'a, C, U>(
|
pub fn execute<'a, C, U>(
|
||||||
self,
|
self,
|
||||||
conf: &configuration::Configuration<C>,
|
conf: &configuration::Configuration<C>,
|
||||||
) -> Box<Future<Item = U, Error = Error<serde_json::Value>> + 'a>
|
) -> Box<dyn Future<Item = U, Error = Error<serde_json::Value>> + 'a>
|
||||||
where
|
where
|
||||||
C: hyper::client::Connect,
|
C: hyper::client::Connect,
|
||||||
U: Sized + 'a,
|
U: Sized + 'a,
|
||||||
|
@ -13,7 +13,7 @@ pub struct {{{classname}}}Client {
|
|||||||
impl {{{classname}}}Client {
|
impl {{{classname}}}Client {
|
||||||
pub fn new(configuration: Rc<configuration::Configuration>) -> {{{classname}}}Client {
|
pub fn new(configuration: Rc<configuration::Configuration>) -> {{{classname}}}Client {
|
||||||
{{{classname}}}Client {
|
{{{classname}}}Client {
|
||||||
configuration: configuration,
|
configuration,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ pub struct APIClient {
|
|||||||
{{#operations}}
|
{{#operations}}
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
{{#-last}}
|
{{#-last}}
|
||||||
{{{classFilename}}}: Box<crate::apis::{{{classname}}}>,
|
{{{classFilename}}}: Box<dyn crate::apis::{{{classname}}}>,
|
||||||
{{/-last}}
|
{{/-last}}
|
||||||
{{/operation}}
|
{{/operation}}
|
||||||
{{/operations}}
|
{{/operations}}
|
||||||
@ -40,7 +40,7 @@ impl APIClient {
|
|||||||
{{#operations}}
|
{{#operations}}
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
{{#-last}}
|
{{#-last}}
|
||||||
pub fn {{{classFilename}}}(&self) -> &crate::apis::{{{classname}}}{
|
pub fn {{{classFilename}}}(&self) -> &dyn crate::apis::{{{classname}}}{
|
||||||
self.{{{classFilename}}}.as_ref()
|
self.{{{classFilename}}}.as_ref()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
4.1.0-SNAPSHOT
|
4.1.3-SNAPSHOT
|
@ -1,11 +1,17 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||||
#
|
#
|
||||||
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
|
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
|
||||||
|
|
||||||
git_user_id=$1
|
git_user_id=$1
|
||||||
git_repo_id=$2
|
git_repo_id=$2
|
||||||
release_note=$3
|
release_note=$3
|
||||||
|
git_host=$4
|
||||||
|
|
||||||
|
if [ "$git_host" = "" ]; then
|
||||||
|
git_host="github.com"
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$git_user_id" = "" ]; then
|
if [ "$git_user_id" = "" ]; then
|
||||||
git_user_id="GIT_USER_ID"
|
git_user_id="GIT_USER_ID"
|
||||||
@ -37,9 +43,9 @@ if [ "$git_remote" = "" ]; then # git remote not defined
|
|||||||
|
|
||||||
if [ "$GIT_TOKEN" = "" ]; then
|
if [ "$GIT_TOKEN" = "" ]; then
|
||||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
||||||
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
||||||
else
|
else
|
||||||
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
@ -47,6 +53,6 @@ fi
|
|||||||
git pull origin master
|
git pull origin master
|
||||||
|
|
||||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||||
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
||||||
git push origin master 2>&1 | grep -v 'To https'
|
git push origin master 2>&1 | grep -v 'To https'
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ use hyper;
|
|||||||
use super::configuration::Configuration;
|
use super::configuration::Configuration;
|
||||||
|
|
||||||
pub struct APIClient {
|
pub struct APIClient {
|
||||||
default_api: Box<crate::apis::DefaultApi>,
|
default_api: Box<dyn crate::apis::DefaultApi>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl APIClient {
|
impl APIClient {
|
||||||
@ -16,7 +16,7 @@ impl APIClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn default_api(&self) -> &crate::apis::DefaultApi{
|
pub fn default_api(&self) -> &dyn crate::apis::DefaultApi{
|
||||||
self.default_api.as_ref()
|
self.default_api.as_ref()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,18 +25,18 @@ pub struct DefaultApiClient<C: hyper::client::Connect> {
|
|||||||
impl<C: hyper::client::Connect> DefaultApiClient<C> {
|
impl<C: hyper::client::Connect> DefaultApiClient<C> {
|
||||||
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> DefaultApiClient<C> {
|
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> DefaultApiClient<C> {
|
||||||
DefaultApiClient {
|
DefaultApiClient {
|
||||||
configuration: configuration,
|
configuration,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait DefaultApi {
|
pub trait DefaultApi {
|
||||||
fn fileresponsetest(&self, ) -> Box<Future<Item = std::path::PathBuf, Error = Error<serde_json::Value>>>;
|
fn fileresponsetest(&self, ) -> Box<dyn Future<Item = std::path::PathBuf, Error = Error<serde_json::Value>>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl<C: hyper::client::Connect>DefaultApi for DefaultApiClient<C> {
|
impl<C: hyper::client::Connect>DefaultApi for DefaultApiClient<C> {
|
||||||
fn fileresponsetest(&self, ) -> Box<Future<Item = std::path::PathBuf, Error = Error<serde_json::Value>>> {
|
fn fileresponsetest(&self, ) -> Box<dyn Future<Item = std::path::PathBuf, Error = Error<serde_json::Value>>> {
|
||||||
__internal_request::Request::new(hyper::Method::Get, "/tests/fileResponse".to_string())
|
__internal_request::Request::new(hyper::Method::Get, "/tests/fileResponse".to_string())
|
||||||
.execute(self.configuration.borrow())
|
.execute(self.configuration.borrow())
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ impl Request {
|
|||||||
pub fn execute<'a, C, U>(
|
pub fn execute<'a, C, U>(
|
||||||
self,
|
self,
|
||||||
conf: &configuration::Configuration<C>,
|
conf: &configuration::Configuration<C>,
|
||||||
) -> Box<Future<Item = U, Error = Error<serde_json::Value>> + 'a>
|
) -> Box<dyn Future<Item = U, Error = Error<serde_json::Value>> + 'a>
|
||||||
where
|
where
|
||||||
C: hyper::client::Connect,
|
C: hyper::client::Connect,
|
||||||
U: Sized + 'a,
|
U: Sized + 'a,
|
||||||
|
@ -1 +1 @@
|
|||||||
4.1.0-SNAPSHOT
|
4.1.3-SNAPSHOT
|
@ -1,11 +1,17 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||||
#
|
#
|
||||||
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
|
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
|
||||||
|
|
||||||
git_user_id=$1
|
git_user_id=$1
|
||||||
git_repo_id=$2
|
git_repo_id=$2
|
||||||
release_note=$3
|
release_note=$3
|
||||||
|
git_host=$4
|
||||||
|
|
||||||
|
if [ "$git_host" = "" ]; then
|
||||||
|
git_host="github.com"
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$git_user_id" = "" ]; then
|
if [ "$git_user_id" = "" ]; then
|
||||||
git_user_id="GIT_USER_ID"
|
git_user_id="GIT_USER_ID"
|
||||||
@ -37,9 +43,9 @@ if [ "$git_remote" = "" ]; then # git remote not defined
|
|||||||
|
|
||||||
if [ "$GIT_TOKEN" = "" ]; then
|
if [ "$GIT_TOKEN" = "" ]; then
|
||||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
||||||
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
||||||
else
|
else
|
||||||
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
@ -47,6 +53,6 @@ fi
|
|||||||
git pull origin master
|
git pull origin master
|
||||||
|
|
||||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||||
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
||||||
git push origin master 2>&1 | grep -v 'To https'
|
git push origin master 2>&1 | grep -v 'To https'
|
||||||
|
|
||||||
|
@ -4,9 +4,9 @@ use hyper;
|
|||||||
use super::configuration::Configuration;
|
use super::configuration::Configuration;
|
||||||
|
|
||||||
pub struct APIClient {
|
pub struct APIClient {
|
||||||
pet_api: Box<crate::apis::PetApi>,
|
pet_api: Box<dyn crate::apis::PetApi>,
|
||||||
store_api: Box<crate::apis::StoreApi>,
|
store_api: Box<dyn crate::apis::StoreApi>,
|
||||||
user_api: Box<crate::apis::UserApi>,
|
user_api: Box<dyn crate::apis::UserApi>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl APIClient {
|
impl APIClient {
|
||||||
@ -20,15 +20,15 @@ impl APIClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn pet_api(&self) -> &crate::apis::PetApi{
|
pub fn pet_api(&self) -> &dyn crate::apis::PetApi{
|
||||||
self.pet_api.as_ref()
|
self.pet_api.as_ref()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn store_api(&self) -> &crate::apis::StoreApi{
|
pub fn store_api(&self) -> &dyn crate::apis::StoreApi{
|
||||||
self.store_api.as_ref()
|
self.store_api.as_ref()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn user_api(&self) -> &crate::apis::UserApi{
|
pub fn user_api(&self) -> &dyn crate::apis::UserApi{
|
||||||
self.user_api.as_ref()
|
self.user_api.as_ref()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,25 +25,25 @@ pub struct PetApiClient<C: hyper::client::Connect> {
|
|||||||
impl<C: hyper::client::Connect> PetApiClient<C> {
|
impl<C: hyper::client::Connect> PetApiClient<C> {
|
||||||
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> PetApiClient<C> {
|
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> PetApiClient<C> {
|
||||||
PetApiClient {
|
PetApiClient {
|
||||||
configuration: configuration,
|
configuration,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait PetApi {
|
pub trait PetApi {
|
||||||
fn add_pet(&self, body: crate::models::Pet) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
fn add_pet(&self, body: crate::models::Pet) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||||
fn delete_pet(&self, pet_id: i64, api_key: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
fn delete_pet(&self, pet_id: i64, api_key: &str) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||||
fn find_pets_by_status(&self, status: Vec<String>) -> Box<Future<Item = Vec<crate::models::Pet>, Error = Error<serde_json::Value>>>;
|
fn find_pets_by_status(&self, status: Vec<String>) -> Box<dyn Future<Item = Vec<crate::models::Pet>, Error = Error<serde_json::Value>>>;
|
||||||
fn find_pets_by_tags(&self, tags: Vec<String>) -> Box<Future<Item = Vec<crate::models::Pet>, Error = Error<serde_json::Value>>>;
|
fn find_pets_by_tags(&self, tags: Vec<String>) -> Box<dyn Future<Item = Vec<crate::models::Pet>, Error = Error<serde_json::Value>>>;
|
||||||
fn get_pet_by_id(&self, pet_id: i64) -> Box<Future<Item = crate::models::Pet, Error = Error<serde_json::Value>>>;
|
fn get_pet_by_id(&self, pet_id: i64) -> Box<dyn Future<Item = crate::models::Pet, Error = Error<serde_json::Value>>>;
|
||||||
fn update_pet(&self, body: crate::models::Pet) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
fn update_pet(&self, body: crate::models::Pet) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||||
fn update_pet_with_form(&self, pet_id: i64, name: &str, status: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
fn update_pet_with_form(&self, pet_id: i64, name: &str, status: &str) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||||
fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: std::path::PathBuf) -> Box<Future<Item = crate::models::ApiResponse, Error = Error<serde_json::Value>>>;
|
fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: std::path::PathBuf) -> Box<dyn Future<Item = crate::models::ApiResponse, Error = Error<serde_json::Value>>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl<C: hyper::client::Connect>PetApi for PetApiClient<C> {
|
impl<C: hyper::client::Connect>PetApi for PetApiClient<C> {
|
||||||
fn add_pet(&self, body: crate::models::Pet) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
|
fn add_pet(&self, body: crate::models::Pet) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>> {
|
||||||
__internal_request::Request::new(hyper::Method::Post, "/pet".to_string())
|
__internal_request::Request::new(hyper::Method::Post, "/pet".to_string())
|
||||||
.with_auth(__internal_request::Auth::Oauth)
|
.with_auth(__internal_request::Auth::Oauth)
|
||||||
.with_body_param(body)
|
.with_body_param(body)
|
||||||
@ -51,7 +51,7 @@ impl<C: hyper::client::Connect>PetApi for PetApiClient<C> {
|
|||||||
.execute(self.configuration.borrow())
|
.execute(self.configuration.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn delete_pet(&self, pet_id: i64, api_key: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
|
fn delete_pet(&self, pet_id: i64, api_key: &str) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>> {
|
||||||
__internal_request::Request::new(hyper::Method::Delete, "/pet/{petId}".to_string())
|
__internal_request::Request::new(hyper::Method::Delete, "/pet/{petId}".to_string())
|
||||||
.with_auth(__internal_request::Auth::Oauth)
|
.with_auth(__internal_request::Auth::Oauth)
|
||||||
.with_path_param("petId".to_string(), pet_id.to_string())
|
.with_path_param("petId".to_string(), pet_id.to_string())
|
||||||
@ -60,21 +60,21 @@ impl<C: hyper::client::Connect>PetApi for PetApiClient<C> {
|
|||||||
.execute(self.configuration.borrow())
|
.execute(self.configuration.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn find_pets_by_status(&self, status: Vec<String>) -> Box<Future<Item = Vec<crate::models::Pet>, Error = Error<serde_json::Value>>> {
|
fn find_pets_by_status(&self, status: Vec<String>) -> Box<dyn Future<Item = Vec<crate::models::Pet>, Error = Error<serde_json::Value>>> {
|
||||||
__internal_request::Request::new(hyper::Method::Get, "/pet/findByStatus".to_string())
|
__internal_request::Request::new(hyper::Method::Get, "/pet/findByStatus".to_string())
|
||||||
.with_auth(__internal_request::Auth::Oauth)
|
.with_auth(__internal_request::Auth::Oauth)
|
||||||
.with_query_param("status".to_string(), status.join(",").to_string())
|
.with_query_param("status".to_string(), status.join(",").to_string())
|
||||||
.execute(self.configuration.borrow())
|
.execute(self.configuration.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn find_pets_by_tags(&self, tags: Vec<String>) -> Box<Future<Item = Vec<crate::models::Pet>, Error = Error<serde_json::Value>>> {
|
fn find_pets_by_tags(&self, tags: Vec<String>) -> Box<dyn Future<Item = Vec<crate::models::Pet>, Error = Error<serde_json::Value>>> {
|
||||||
__internal_request::Request::new(hyper::Method::Get, "/pet/findByTags".to_string())
|
__internal_request::Request::new(hyper::Method::Get, "/pet/findByTags".to_string())
|
||||||
.with_auth(__internal_request::Auth::Oauth)
|
.with_auth(__internal_request::Auth::Oauth)
|
||||||
.with_query_param("tags".to_string(), tags.join(",").to_string())
|
.with_query_param("tags".to_string(), tags.join(",").to_string())
|
||||||
.execute(self.configuration.borrow())
|
.execute(self.configuration.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_pet_by_id(&self, pet_id: i64) -> Box<Future<Item = crate::models::Pet, Error = Error<serde_json::Value>>> {
|
fn get_pet_by_id(&self, pet_id: i64) -> Box<dyn Future<Item = crate::models::Pet, Error = Error<serde_json::Value>>> {
|
||||||
__internal_request::Request::new(hyper::Method::Get, "/pet/{petId}".to_string())
|
__internal_request::Request::new(hyper::Method::Get, "/pet/{petId}".to_string())
|
||||||
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
|
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
|
||||||
in_header: true,
|
in_header: true,
|
||||||
@ -85,7 +85,7 @@ impl<C: hyper::client::Connect>PetApi for PetApiClient<C> {
|
|||||||
.execute(self.configuration.borrow())
|
.execute(self.configuration.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_pet(&self, body: crate::models::Pet) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
|
fn update_pet(&self, body: crate::models::Pet) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>> {
|
||||||
__internal_request::Request::new(hyper::Method::Put, "/pet".to_string())
|
__internal_request::Request::new(hyper::Method::Put, "/pet".to_string())
|
||||||
.with_auth(__internal_request::Auth::Oauth)
|
.with_auth(__internal_request::Auth::Oauth)
|
||||||
.with_body_param(body)
|
.with_body_param(body)
|
||||||
@ -93,7 +93,7 @@ impl<C: hyper::client::Connect>PetApi for PetApiClient<C> {
|
|||||||
.execute(self.configuration.borrow())
|
.execute(self.configuration.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_pet_with_form(&self, pet_id: i64, name: &str, status: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
|
fn update_pet_with_form(&self, pet_id: i64, name: &str, status: &str) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>> {
|
||||||
__internal_request::Request::new(hyper::Method::Post, "/pet/{petId}".to_string())
|
__internal_request::Request::new(hyper::Method::Post, "/pet/{petId}".to_string())
|
||||||
.with_auth(__internal_request::Auth::Oauth)
|
.with_auth(__internal_request::Auth::Oauth)
|
||||||
.with_path_param("petId".to_string(), pet_id.to_string())
|
.with_path_param("petId".to_string(), pet_id.to_string())
|
||||||
@ -103,7 +103,7 @@ impl<C: hyper::client::Connect>PetApi for PetApiClient<C> {
|
|||||||
.execute(self.configuration.borrow())
|
.execute(self.configuration.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: std::path::PathBuf) -> Box<Future<Item = crate::models::ApiResponse, Error = Error<serde_json::Value>>> {
|
fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: std::path::PathBuf) -> Box<dyn Future<Item = crate::models::ApiResponse, Error = Error<serde_json::Value>>> {
|
||||||
__internal_request::Request::new(hyper::Method::Post, "/pet/{petId}/uploadImage".to_string())
|
__internal_request::Request::new(hyper::Method::Post, "/pet/{petId}/uploadImage".to_string())
|
||||||
.with_auth(__internal_request::Auth::Oauth)
|
.with_auth(__internal_request::Auth::Oauth)
|
||||||
.with_path_param("petId".to_string(), pet_id.to_string())
|
.with_path_param("petId".to_string(), pet_id.to_string())
|
||||||
|
@ -98,7 +98,7 @@ impl Request {
|
|||||||
pub fn execute<'a, C, U>(
|
pub fn execute<'a, C, U>(
|
||||||
self,
|
self,
|
||||||
conf: &configuration::Configuration<C>,
|
conf: &configuration::Configuration<C>,
|
||||||
) -> Box<Future<Item = U, Error = Error<serde_json::Value>> + 'a>
|
) -> Box<dyn Future<Item = U, Error = Error<serde_json::Value>> + 'a>
|
||||||
where
|
where
|
||||||
C: hyper::client::Connect,
|
C: hyper::client::Connect,
|
||||||
U: Sized + 'a,
|
U: Sized + 'a,
|
||||||
|
@ -25,28 +25,28 @@ pub struct StoreApiClient<C: hyper::client::Connect> {
|
|||||||
impl<C: hyper::client::Connect> StoreApiClient<C> {
|
impl<C: hyper::client::Connect> StoreApiClient<C> {
|
||||||
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> StoreApiClient<C> {
|
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> StoreApiClient<C> {
|
||||||
StoreApiClient {
|
StoreApiClient {
|
||||||
configuration: configuration,
|
configuration,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait StoreApi {
|
pub trait StoreApi {
|
||||||
fn delete_order(&self, order_id: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
fn delete_order(&self, order_id: &str) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||||
fn get_inventory(&self, ) -> Box<Future<Item = ::std::collections::HashMap<String, i32>, Error = Error<serde_json::Value>>>;
|
fn get_inventory(&self, ) -> Box<dyn Future<Item = ::std::collections::HashMap<String, i32>, Error = Error<serde_json::Value>>>;
|
||||||
fn get_order_by_id(&self, order_id: i64) -> Box<Future<Item = crate::models::Order, Error = Error<serde_json::Value>>>;
|
fn get_order_by_id(&self, order_id: i64) -> Box<dyn Future<Item = crate::models::Order, Error = Error<serde_json::Value>>>;
|
||||||
fn place_order(&self, body: crate::models::Order) -> Box<Future<Item = crate::models::Order, Error = Error<serde_json::Value>>>;
|
fn place_order(&self, body: crate::models::Order) -> Box<dyn Future<Item = crate::models::Order, Error = Error<serde_json::Value>>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl<C: hyper::client::Connect>StoreApi for StoreApiClient<C> {
|
impl<C: hyper::client::Connect>StoreApi for StoreApiClient<C> {
|
||||||
fn delete_order(&self, order_id: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
|
fn delete_order(&self, order_id: &str) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>> {
|
||||||
__internal_request::Request::new(hyper::Method::Delete, "/store/order/{orderId}".to_string())
|
__internal_request::Request::new(hyper::Method::Delete, "/store/order/{orderId}".to_string())
|
||||||
.with_path_param("orderId".to_string(), order_id.to_string())
|
.with_path_param("orderId".to_string(), order_id.to_string())
|
||||||
.returns_nothing()
|
.returns_nothing()
|
||||||
.execute(self.configuration.borrow())
|
.execute(self.configuration.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_inventory(&self, ) -> Box<Future<Item = ::std::collections::HashMap<String, i32>, Error = Error<serde_json::Value>>> {
|
fn get_inventory(&self, ) -> Box<dyn Future<Item = ::std::collections::HashMap<String, i32>, Error = Error<serde_json::Value>>> {
|
||||||
__internal_request::Request::new(hyper::Method::Get, "/store/inventory".to_string())
|
__internal_request::Request::new(hyper::Method::Get, "/store/inventory".to_string())
|
||||||
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
|
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
|
||||||
in_header: true,
|
in_header: true,
|
||||||
@ -56,13 +56,13 @@ impl<C: hyper::client::Connect>StoreApi for StoreApiClient<C> {
|
|||||||
.execute(self.configuration.borrow())
|
.execute(self.configuration.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_order_by_id(&self, order_id: i64) -> Box<Future<Item = crate::models::Order, Error = Error<serde_json::Value>>> {
|
fn get_order_by_id(&self, order_id: i64) -> Box<dyn Future<Item = crate::models::Order, Error = Error<serde_json::Value>>> {
|
||||||
__internal_request::Request::new(hyper::Method::Get, "/store/order/{orderId}".to_string())
|
__internal_request::Request::new(hyper::Method::Get, "/store/order/{orderId}".to_string())
|
||||||
.with_path_param("orderId".to_string(), order_id.to_string())
|
.with_path_param("orderId".to_string(), order_id.to_string())
|
||||||
.execute(self.configuration.borrow())
|
.execute(self.configuration.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn place_order(&self, body: crate::models::Order) -> Box<Future<Item = crate::models::Order, Error = Error<serde_json::Value>>> {
|
fn place_order(&self, body: crate::models::Order) -> Box<dyn Future<Item = crate::models::Order, Error = Error<serde_json::Value>>> {
|
||||||
__internal_request::Request::new(hyper::Method::Post, "/store/order".to_string())
|
__internal_request::Request::new(hyper::Method::Post, "/store/order".to_string())
|
||||||
.with_body_param(body)
|
.with_body_param(body)
|
||||||
.execute(self.configuration.borrow())
|
.execute(self.configuration.borrow())
|
||||||
|
@ -25,72 +25,72 @@ pub struct UserApiClient<C: hyper::client::Connect> {
|
|||||||
impl<C: hyper::client::Connect> UserApiClient<C> {
|
impl<C: hyper::client::Connect> UserApiClient<C> {
|
||||||
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> UserApiClient<C> {
|
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> UserApiClient<C> {
|
||||||
UserApiClient {
|
UserApiClient {
|
||||||
configuration: configuration,
|
configuration,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait UserApi {
|
pub trait UserApi {
|
||||||
fn create_user(&self, body: crate::models::User) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
fn create_user(&self, body: crate::models::User) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||||
fn create_users_with_array_input(&self, body: Vec<crate::models::User>) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
fn create_users_with_array_input(&self, body: Vec<crate::models::User>) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||||
fn create_users_with_list_input(&self, body: Vec<crate::models::User>) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
fn create_users_with_list_input(&self, body: Vec<crate::models::User>) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||||
fn delete_user(&self, username: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
fn delete_user(&self, username: &str) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||||
fn get_user_by_name(&self, username: &str) -> Box<Future<Item = crate::models::User, Error = Error<serde_json::Value>>>;
|
fn get_user_by_name(&self, username: &str) -> Box<dyn Future<Item = crate::models::User, Error = Error<serde_json::Value>>>;
|
||||||
fn login_user(&self, username: &str, password: &str) -> Box<Future<Item = String, Error = Error<serde_json::Value>>>;
|
fn login_user(&self, username: &str, password: &str) -> Box<dyn Future<Item = String, Error = Error<serde_json::Value>>>;
|
||||||
fn logout_user(&self, ) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
fn logout_user(&self, ) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||||
fn update_user(&self, username: &str, body: crate::models::User) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
fn update_user(&self, username: &str, body: crate::models::User) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl<C: hyper::client::Connect>UserApi for UserApiClient<C> {
|
impl<C: hyper::client::Connect>UserApi for UserApiClient<C> {
|
||||||
fn create_user(&self, body: crate::models::User) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
|
fn create_user(&self, body: crate::models::User) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>> {
|
||||||
__internal_request::Request::new(hyper::Method::Post, "/user".to_string())
|
__internal_request::Request::new(hyper::Method::Post, "/user".to_string())
|
||||||
.with_body_param(body)
|
.with_body_param(body)
|
||||||
.returns_nothing()
|
.returns_nothing()
|
||||||
.execute(self.configuration.borrow())
|
.execute(self.configuration.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_users_with_array_input(&self, body: Vec<crate::models::User>) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
|
fn create_users_with_array_input(&self, body: Vec<crate::models::User>) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>> {
|
||||||
__internal_request::Request::new(hyper::Method::Post, "/user/createWithArray".to_string())
|
__internal_request::Request::new(hyper::Method::Post, "/user/createWithArray".to_string())
|
||||||
.with_body_param(body)
|
.with_body_param(body)
|
||||||
.returns_nothing()
|
.returns_nothing()
|
||||||
.execute(self.configuration.borrow())
|
.execute(self.configuration.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_users_with_list_input(&self, body: Vec<crate::models::User>) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
|
fn create_users_with_list_input(&self, body: Vec<crate::models::User>) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>> {
|
||||||
__internal_request::Request::new(hyper::Method::Post, "/user/createWithList".to_string())
|
__internal_request::Request::new(hyper::Method::Post, "/user/createWithList".to_string())
|
||||||
.with_body_param(body)
|
.with_body_param(body)
|
||||||
.returns_nothing()
|
.returns_nothing()
|
||||||
.execute(self.configuration.borrow())
|
.execute(self.configuration.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn delete_user(&self, username: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
|
fn delete_user(&self, username: &str) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>> {
|
||||||
__internal_request::Request::new(hyper::Method::Delete, "/user/{username}".to_string())
|
__internal_request::Request::new(hyper::Method::Delete, "/user/{username}".to_string())
|
||||||
.with_path_param("username".to_string(), username.to_string())
|
.with_path_param("username".to_string(), username.to_string())
|
||||||
.returns_nothing()
|
.returns_nothing()
|
||||||
.execute(self.configuration.borrow())
|
.execute(self.configuration.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_user_by_name(&self, username: &str) -> Box<Future<Item = crate::models::User, Error = Error<serde_json::Value>>> {
|
fn get_user_by_name(&self, username: &str) -> Box<dyn Future<Item = crate::models::User, Error = Error<serde_json::Value>>> {
|
||||||
__internal_request::Request::new(hyper::Method::Get, "/user/{username}".to_string())
|
__internal_request::Request::new(hyper::Method::Get, "/user/{username}".to_string())
|
||||||
.with_path_param("username".to_string(), username.to_string())
|
.with_path_param("username".to_string(), username.to_string())
|
||||||
.execute(self.configuration.borrow())
|
.execute(self.configuration.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn login_user(&self, username: &str, password: &str) -> Box<Future<Item = String, Error = Error<serde_json::Value>>> {
|
fn login_user(&self, username: &str, password: &str) -> Box<dyn Future<Item = String, Error = Error<serde_json::Value>>> {
|
||||||
__internal_request::Request::new(hyper::Method::Get, "/user/login".to_string())
|
__internal_request::Request::new(hyper::Method::Get, "/user/login".to_string())
|
||||||
.with_query_param("username".to_string(), username.to_string())
|
.with_query_param("username".to_string(), username.to_string())
|
||||||
.with_query_param("password".to_string(), password.to_string())
|
.with_query_param("password".to_string(), password.to_string())
|
||||||
.execute(self.configuration.borrow())
|
.execute(self.configuration.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn logout_user(&self, ) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
|
fn logout_user(&self, ) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>> {
|
||||||
__internal_request::Request::new(hyper::Method::Get, "/user/logout".to_string())
|
__internal_request::Request::new(hyper::Method::Get, "/user/logout".to_string())
|
||||||
.returns_nothing()
|
.returns_nothing()
|
||||||
.execute(self.configuration.borrow())
|
.execute(self.configuration.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_user(&self, username: &str, body: crate::models::User) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
|
fn update_user(&self, username: &str, body: crate::models::User) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>> {
|
||||||
__internal_request::Request::new(hyper::Method::Put, "/user/{username}".to_string())
|
__internal_request::Request::new(hyper::Method::Put, "/user/{username}".to_string())
|
||||||
.with_path_param("username".to_string(), username.to_string())
|
.with_path_param("username".to_string(), username.to_string())
|
||||||
.with_body_param(body)
|
.with_body_param(body)
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
/// ApiResponse : Describes the result of uploading an image resource
|
/// ApiResponse : Describes the result of uploading an image resource
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct ApiResponse {
|
pub struct ApiResponse {
|
||||||
#[serde(rename = "code", skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "code", skip_serializing_if = "Option::is_none")]
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
/// Category : A category for a pet
|
/// Category : A category for a pet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct Category {
|
pub struct Category {
|
||||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
mod api_response;
|
pub mod api_response;
|
||||||
pub use self::api_response::ApiResponse;
|
pub use self::api_response::ApiResponse;
|
||||||
mod category;
|
pub mod category;
|
||||||
pub use self::category::Category;
|
pub use self::category::Category;
|
||||||
mod order;
|
pub mod order;
|
||||||
pub use self::order::Order;
|
pub use self::order::Order;
|
||||||
mod pet;
|
pub mod pet;
|
||||||
pub use self::pet::Pet;
|
pub use self::pet::Pet;
|
||||||
mod tag;
|
pub mod tag;
|
||||||
pub use self::tag::Tag;
|
pub use self::tag::Tag;
|
||||||
mod user;
|
pub mod user;
|
||||||
pub use self::user::User;
|
pub use self::user::User;
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
/// Order : An order for a pets from the pet store
|
/// Order : An order for a pets from the pet store
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct Order {
|
pub struct Order {
|
||||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
/// Pet : A pet for sale in the pet store
|
/// Pet : A pet for sale in the pet store
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct Pet {
|
pub struct Pet {
|
||||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||||
@ -34,8 +35,8 @@ impl Pet {
|
|||||||
Pet {
|
Pet {
|
||||||
id: None,
|
id: None,
|
||||||
category: None,
|
category: None,
|
||||||
name: name,
|
name,
|
||||||
photo_urls: photo_urls,
|
photo_urls,
|
||||||
tags: None,
|
tags: None,
|
||||||
status: None,
|
status: None,
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
/// Tag : A tag for a pet
|
/// Tag : A tag for a pet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct Tag {
|
pub struct Tag {
|
||||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
/// User : A User who is purchasing from the pet store
|
/// User : A User who is purchasing from the pet store
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct User {
|
pub struct User {
|
||||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||||
|
@ -1 +1 @@
|
|||||||
4.1.0-SNAPSHOT
|
4.1.3-SNAPSHOT
|
@ -1,11 +1,17 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||||
#
|
#
|
||||||
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
|
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
|
||||||
|
|
||||||
git_user_id=$1
|
git_user_id=$1
|
||||||
git_repo_id=$2
|
git_repo_id=$2
|
||||||
release_note=$3
|
release_note=$3
|
||||||
|
git_host=$4
|
||||||
|
|
||||||
|
if [ "$git_host" = "" ]; then
|
||||||
|
git_host="github.com"
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$git_user_id" = "" ]; then
|
if [ "$git_user_id" = "" ]; then
|
||||||
git_user_id="GIT_USER_ID"
|
git_user_id="GIT_USER_ID"
|
||||||
@ -37,9 +43,9 @@ if [ "$git_remote" = "" ]; then # git remote not defined
|
|||||||
|
|
||||||
if [ "$GIT_TOKEN" = "" ]; then
|
if [ "$GIT_TOKEN" = "" ]; then
|
||||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
||||||
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
||||||
else
|
else
|
||||||
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
@ -47,6 +53,6 @@ fi
|
|||||||
git pull origin master
|
git pull origin master
|
||||||
|
|
||||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||||
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
||||||
git push origin master 2>&1 | grep -v 'To https'
|
git push origin master 2>&1 | grep -v 'To https'
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ use hyper;
|
|||||||
use super::configuration::Configuration;
|
use super::configuration::Configuration;
|
||||||
|
|
||||||
pub struct APIClient {
|
pub struct APIClient {
|
||||||
default_api: Box<crate::apis::DefaultApi>,
|
default_api: Box<dyn crate::apis::DefaultApi>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl APIClient {
|
impl APIClient {
|
||||||
@ -16,7 +16,7 @@ impl APIClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn default_api(&self) -> &crate::apis::DefaultApi{
|
pub fn default_api(&self) -> &dyn crate::apis::DefaultApi{
|
||||||
self.default_api.as_ref()
|
self.default_api.as_ref()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,18 +25,18 @@ pub struct DefaultApiClient<C: hyper::client::Connect> {
|
|||||||
impl<C: hyper::client::Connect> DefaultApiClient<C> {
|
impl<C: hyper::client::Connect> DefaultApiClient<C> {
|
||||||
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> DefaultApiClient<C> {
|
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> DefaultApiClient<C> {
|
||||||
DefaultApiClient {
|
DefaultApiClient {
|
||||||
configuration: configuration,
|
configuration,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait DefaultApi {
|
pub trait DefaultApi {
|
||||||
fn dummy_get(&self, ) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
fn dummy_get(&self, ) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl<C: hyper::client::Connect>DefaultApi for DefaultApiClient<C> {
|
impl<C: hyper::client::Connect>DefaultApi for DefaultApiClient<C> {
|
||||||
fn dummy_get(&self, ) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
|
fn dummy_get(&self, ) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>> {
|
||||||
__internal_request::Request::new(hyper::Method::Get, "/dummy".to_string())
|
__internal_request::Request::new(hyper::Method::Get, "/dummy".to_string())
|
||||||
.returns_nothing()
|
.returns_nothing()
|
||||||
.execute(self.configuration.borrow())
|
.execute(self.configuration.borrow())
|
||||||
|
@ -98,7 +98,7 @@ impl Request {
|
|||||||
pub fn execute<'a, C, U>(
|
pub fn execute<'a, C, U>(
|
||||||
self,
|
self,
|
||||||
conf: &configuration::Configuration<C>,
|
conf: &configuration::Configuration<C>,
|
||||||
) -> Box<Future<Item = U, Error = Error<serde_json::Value>> + 'a>
|
) -> Box<dyn Future<Item = U, Error = Error<serde_json::Value>> + 'a>
|
||||||
where
|
where
|
||||||
C: hyper::client::Connect,
|
C: hyper::client::Connect,
|
||||||
U: Sized + 'a,
|
U: Sized + 'a,
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
mod type_testing;
|
pub mod type_testing;
|
||||||
pub use self::type_testing::TypeTesting;
|
pub use self::type_testing::TypeTesting;
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
/// TypeTesting : Test handling of differing types (see \\#3463)
|
/// TypeTesting : Test handling of differing types (see \\#3463)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct TypeTesting {
|
pub struct TypeTesting {
|
||||||
#[serde(rename = "integer", skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "integer", skip_serializing_if = "Option::is_none")]
|
||||||
|
@ -1 +1 @@
|
|||||||
4.1.0-SNAPSHOT
|
4.1.3-SNAPSHOT
|
@ -1,11 +1,17 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||||
#
|
#
|
||||||
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
|
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
|
||||||
|
|
||||||
git_user_id=$1
|
git_user_id=$1
|
||||||
git_repo_id=$2
|
git_repo_id=$2
|
||||||
release_note=$3
|
release_note=$3
|
||||||
|
git_host=$4
|
||||||
|
|
||||||
|
if [ "$git_host" = "" ]; then
|
||||||
|
git_host="github.com"
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$git_user_id" = "" ]; then
|
if [ "$git_user_id" = "" ]; then
|
||||||
git_user_id="GIT_USER_ID"
|
git_user_id="GIT_USER_ID"
|
||||||
@ -37,9 +43,9 @@ if [ "$git_remote" = "" ]; then # git remote not defined
|
|||||||
|
|
||||||
if [ "$GIT_TOKEN" = "" ]; then
|
if [ "$GIT_TOKEN" = "" ]; then
|
||||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
||||||
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
||||||
else
|
else
|
||||||
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
@ -47,6 +53,6 @@ fi
|
|||||||
git pull origin master
|
git pull origin master
|
||||||
|
|
||||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||||
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
||||||
git push origin master 2>&1 | grep -v 'To https'
|
git push origin master 2>&1 | grep -v 'To https'
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ use std::rc::Rc;
|
|||||||
use super::configuration::Configuration;
|
use super::configuration::Configuration;
|
||||||
|
|
||||||
pub struct APIClient {
|
pub struct APIClient {
|
||||||
default_api: Box<crate::apis::DefaultApi>,
|
default_api: Box<dyn crate::apis::DefaultApi>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl APIClient {
|
impl APIClient {
|
||||||
@ -15,7 +15,7 @@ impl APIClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn default_api(&self) -> &crate::apis::DefaultApi{
|
pub fn default_api(&self) -> &dyn crate::apis::DefaultApi{
|
||||||
self.default_api.as_ref()
|
self.default_api.as_ref()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ pub struct DefaultApiClient {
|
|||||||
impl DefaultApiClient {
|
impl DefaultApiClient {
|
||||||
pub fn new(configuration: Rc<configuration::Configuration>) -> DefaultApiClient {
|
pub fn new(configuration: Rc<configuration::Configuration>) -> DefaultApiClient {
|
||||||
DefaultApiClient {
|
DefaultApiClient {
|
||||||
configuration: configuration,
|
configuration,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
4.1.1-SNAPSHOT
|
4.1.3-SNAPSHOT
|
@ -1,11 +1,17 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||||
#
|
#
|
||||||
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
|
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
|
||||||
|
|
||||||
git_user_id=$1
|
git_user_id=$1
|
||||||
git_repo_id=$2
|
git_repo_id=$2
|
||||||
release_note=$3
|
release_note=$3
|
||||||
|
git_host=$4
|
||||||
|
|
||||||
|
if [ "$git_host" = "" ]; then
|
||||||
|
git_host="github.com"
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$git_user_id" = "" ]; then
|
if [ "$git_user_id" = "" ]; then
|
||||||
git_user_id="GIT_USER_ID"
|
git_user_id="GIT_USER_ID"
|
||||||
@ -37,9 +43,9 @@ if [ "$git_remote" = "" ]; then # git remote not defined
|
|||||||
|
|
||||||
if [ "$GIT_TOKEN" = "" ]; then
|
if [ "$GIT_TOKEN" = "" ]; then
|
||||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
||||||
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
||||||
else
|
else
|
||||||
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
@ -47,6 +53,6 @@ fi
|
|||||||
git pull origin master
|
git pull origin master
|
||||||
|
|
||||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||||
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
||||||
git push origin master 2>&1 | grep -v 'To https'
|
git push origin master 2>&1 | grep -v 'To https'
|
||||||
|
|
||||||
|
@ -3,9 +3,9 @@ use std::rc::Rc;
|
|||||||
use super::configuration::Configuration;
|
use super::configuration::Configuration;
|
||||||
|
|
||||||
pub struct APIClient {
|
pub struct APIClient {
|
||||||
pet_api: Box<crate::apis::PetApi>,
|
pet_api: Box<dyn crate::apis::PetApi>,
|
||||||
store_api: Box<crate::apis::StoreApi>,
|
store_api: Box<dyn crate::apis::StoreApi>,
|
||||||
user_api: Box<crate::apis::UserApi>,
|
user_api: Box<dyn crate::apis::UserApi>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl APIClient {
|
impl APIClient {
|
||||||
@ -19,15 +19,15 @@ impl APIClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn pet_api(&self) -> &crate::apis::PetApi{
|
pub fn pet_api(&self) -> &dyn crate::apis::PetApi{
|
||||||
self.pet_api.as_ref()
|
self.pet_api.as_ref()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn store_api(&self) -> &crate::apis::StoreApi{
|
pub fn store_api(&self) -> &dyn crate::apis::StoreApi{
|
||||||
self.store_api.as_ref()
|
self.store_api.as_ref()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn user_api(&self) -> &crate::apis::UserApi{
|
pub fn user_api(&self) -> &dyn crate::apis::UserApi{
|
||||||
self.user_api.as_ref()
|
self.user_api.as_ref()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ pub struct PetApiClient {
|
|||||||
impl PetApiClient {
|
impl PetApiClient {
|
||||||
pub fn new(configuration: Rc<configuration::Configuration>) -> PetApiClient {
|
pub fn new(configuration: Rc<configuration::Configuration>) -> PetApiClient {
|
||||||
PetApiClient {
|
PetApiClient {
|
||||||
configuration: configuration,
|
configuration,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -210,10 +210,10 @@ impl PetApi for PetApiClient {
|
|||||||
if let Some(ref token) = configuration.oauth_access_token {
|
if let Some(ref token) = configuration.oauth_access_token {
|
||||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||||
};
|
};
|
||||||
let mut form_params = std::collections::HashMap::new();
|
let form = reqwest::multipart::Form::new()
|
||||||
form_params.insert("additionalMetadata", additional_metadata.to_string());
|
.text("additionalMetadata", additional_metadata.to_string())
|
||||||
form_params.insert("file", unimplemented!("File form param not supported with x-www-form-urlencoded content"));
|
.file("file", file)?;
|
||||||
req_builder = req_builder.form(&form_params);
|
req_builder = req_builder.multipart(form);
|
||||||
|
|
||||||
// send request
|
// send request
|
||||||
let req = req_builder.build()?;
|
let req = req_builder.build()?;
|
||||||
|
@ -22,7 +22,7 @@ pub struct StoreApiClient {
|
|||||||
impl StoreApiClient {
|
impl StoreApiClient {
|
||||||
pub fn new(configuration: Rc<configuration::Configuration>) -> StoreApiClient {
|
pub fn new(configuration: Rc<configuration::Configuration>) -> StoreApiClient {
|
||||||
StoreApiClient {
|
StoreApiClient {
|
||||||
configuration: configuration,
|
configuration,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ pub struct UserApiClient {
|
|||||||
impl UserApiClient {
|
impl UserApiClient {
|
||||||
pub fn new(configuration: Rc<configuration::Configuration>) -> UserApiClient {
|
pub fn new(configuration: Rc<configuration::Configuration>) -> UserApiClient {
|
||||||
UserApiClient {
|
UserApiClient {
|
||||||
configuration: configuration,
|
configuration,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
/// ApiResponse : Describes the result of uploading an image resource
|
/// ApiResponse : Describes the result of uploading an image resource
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct ApiResponse {
|
pub struct ApiResponse {
|
||||||
#[serde(rename = "code", skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "code", skip_serializing_if = "Option::is_none")]
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
/// Category : A category for a pet
|
/// Category : A category for a pet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct Category {
|
pub struct Category {
|
||||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
mod api_response;
|
pub mod api_response;
|
||||||
pub use self::api_response::ApiResponse;
|
pub use self::api_response::ApiResponse;
|
||||||
mod category;
|
pub mod category;
|
||||||
pub use self::category::Category;
|
pub use self::category::Category;
|
||||||
mod order;
|
pub mod order;
|
||||||
pub use self::order::Order;
|
pub use self::order::Order;
|
||||||
mod pet;
|
pub mod pet;
|
||||||
pub use self::pet::Pet;
|
pub use self::pet::Pet;
|
||||||
mod tag;
|
pub mod tag;
|
||||||
pub use self::tag::Tag;
|
pub use self::tag::Tag;
|
||||||
mod user;
|
pub mod user;
|
||||||
pub use self::user::User;
|
pub use self::user::User;
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
/// Order : An order for a pets from the pet store
|
/// Order : An order for a pets from the pet store
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct Order {
|
pub struct Order {
|
||||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
/// Pet : A pet for sale in the pet store
|
/// Pet : A pet for sale in the pet store
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct Pet {
|
pub struct Pet {
|
||||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||||
@ -34,8 +35,8 @@ impl Pet {
|
|||||||
Pet {
|
Pet {
|
||||||
id: None,
|
id: None,
|
||||||
category: None,
|
category: None,
|
||||||
name: name,
|
name,
|
||||||
photo_urls: photo_urls,
|
photo_urls,
|
||||||
tags: None,
|
tags: None,
|
||||||
status: None,
|
status: None,
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
/// Tag : A tag for a pet
|
/// Tag : A tag for a pet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct Tag {
|
pub struct Tag {
|
||||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
/// User : A User who is purchasing from the pet store
|
/// User : A User who is purchasing from the pet store
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct User {
|
pub struct User {
|
||||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||||
|
@ -1 +1 @@
|
|||||||
4.1.0-SNAPSHOT
|
4.1.3-SNAPSHOT
|
@ -1,11 +1,17 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||||
#
|
#
|
||||||
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
|
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
|
||||||
|
|
||||||
git_user_id=$1
|
git_user_id=$1
|
||||||
git_repo_id=$2
|
git_repo_id=$2
|
||||||
release_note=$3
|
release_note=$3
|
||||||
|
git_host=$4
|
||||||
|
|
||||||
|
if [ "$git_host" = "" ]; then
|
||||||
|
git_host="github.com"
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$git_user_id" = "" ]; then
|
if [ "$git_user_id" = "" ]; then
|
||||||
git_user_id="GIT_USER_ID"
|
git_user_id="GIT_USER_ID"
|
||||||
@ -37,9 +43,9 @@ if [ "$git_remote" = "" ]; then # git remote not defined
|
|||||||
|
|
||||||
if [ "$GIT_TOKEN" = "" ]; then
|
if [ "$GIT_TOKEN" = "" ]; then
|
||||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
||||||
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
||||||
else
|
else
|
||||||
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
@ -47,6 +53,6 @@ fi
|
|||||||
git pull origin master
|
git pull origin master
|
||||||
|
|
||||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||||
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
||||||
git push origin master 2>&1 | grep -v 'To https'
|
git push origin master 2>&1 | grep -v 'To https'
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ use std::rc::Rc;
|
|||||||
use super::configuration::Configuration;
|
use super::configuration::Configuration;
|
||||||
|
|
||||||
pub struct APIClient {
|
pub struct APIClient {
|
||||||
default_api: Box<crate::apis::DefaultApi>,
|
default_api: Box<dyn crate::apis::DefaultApi>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl APIClient {
|
impl APIClient {
|
||||||
@ -15,7 +15,7 @@ impl APIClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn default_api(&self) -> &crate::apis::DefaultApi{
|
pub fn default_api(&self) -> &dyn crate::apis::DefaultApi{
|
||||||
self.default_api.as_ref()
|
self.default_api.as_ref()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ pub struct DefaultApiClient {
|
|||||||
impl DefaultApiClient {
|
impl DefaultApiClient {
|
||||||
pub fn new(configuration: Rc<configuration::Configuration>) -> DefaultApiClient {
|
pub fn new(configuration: Rc<configuration::Configuration>) -> DefaultApiClient {
|
||||||
DefaultApiClient {
|
DefaultApiClient {
|
||||||
configuration: configuration,
|
configuration,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
mod type_testing;
|
pub mod type_testing;
|
||||||
pub use self::type_testing::TypeTesting;
|
pub use self::type_testing::TypeTesting;
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
/// TypeTesting : Test handling of differing types (see \\#3463)
|
/// TypeTesting : Test handling of differing types (see \\#3463)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct TypeTesting {
|
pub struct TypeTesting {
|
||||||
#[serde(rename = "integer", skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "integer", skip_serializing_if = "Option::is_none")]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user