forked from loafle/openapi-generator-original
[C++] better code format for cpprest templates (#4379)
* replace tab with 4-space in cpprest templates * remove trailing whitespaces from templates * fix code indentation in cpprest templates * remove empty block in cpprest templates
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
{{>licenseInfo}}
|
||||
{{#operations}}/*
|
||||
* {{classname}}.h
|
||||
*
|
||||
*
|
||||
* {{description}}
|
||||
*/
|
||||
|
||||
|
||||
#ifndef {{classname}}_H_
|
||||
#define {{classname}}_H_
|
||||
|
||||
@@ -35,11 +35,11 @@ public:
|
||||
{{#allParams}}/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}</param>{{/allParams}}
|
||||
pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> {{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
||||
{{/operation}}
|
||||
|
||||
|
||||
protected:
|
||||
std::shared_ptr<ApiClient> m_ApiClient;
|
||||
std::shared_ptr<ApiClient> m_ApiClient;
|
||||
};
|
||||
|
||||
|
||||
{{#apiNamespaceDeclarations}}
|
||||
}
|
||||
{{/apiNamespaceDeclarations}}
|
||||
|
||||
@@ -35,23 +35,24 @@ pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/r
|
||||
throw ApiException(400, U("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}"));
|
||||
}
|
||||
{{/isContainer}}{{/isPrimitiveType}}{{/required}}{{/allParams}}
|
||||
|
||||
|
||||
std::shared_ptr<ApiConfiguration> apiConfiguration( m_ApiClient->getConfiguration() );
|
||||
utility::string_t path = U("{{path}}");
|
||||
{{#pathParams}}boost::replace_all(path, U("{") U("{{baseName}}") U("}"), ApiClient::parameterToString({{{paramName}}}));
|
||||
{{/pathParams}}
|
||||
|
||||
|
||||
std::map<utility::string_t, utility::string_t> queryParams;
|
||||
std::map<utility::string_t, utility::string_t> headerParams( apiConfiguration->getDefaultHeaders() );
|
||||
std::map<utility::string_t, utility::string_t> formParams;
|
||||
std::map<utility::string_t, std::shared_ptr<HttpContent>> fileParams;
|
||||
|
||||
std::unordered_set<utility::string_t> responseHttpContentTypes;
|
||||
{{#produces}}responseHttpContentTypes.insert( U("{{mediaType}}") );
|
||||
{{#produces}}
|
||||
responseHttpContentTypes.insert( U("{{mediaType}}") );
|
||||
{{/produces}}
|
||||
|
||||
|
||||
utility::string_t responseHttpContentType;
|
||||
|
||||
|
||||
// use JSON if possible
|
||||
if ( responseHttpContentTypes.size() == 0 )
|
||||
{
|
||||
@@ -67,13 +68,13 @@ pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/r
|
||||
{
|
||||
responseHttpContentType = U("application/json");
|
||||
}
|
||||
// multipart formdata
|
||||
// multipart formdata
|
||||
else if( responseHttpContentTypes.find(U("multipart/form-data")) != responseHttpContentTypes.end() )
|
||||
{
|
||||
responseHttpContentType = U("multipart/form-data");
|
||||
}
|
||||
{{#vendorExtensions.x-codegen-response.isString}}
|
||||
// plain text
|
||||
// plain text
|
||||
else if( responseHttpContentTypes.find(U("text/plain")) != responseHttpContentTypes.end() )
|
||||
{
|
||||
responseHttpContentType = U("text/plain");
|
||||
@@ -90,41 +91,70 @@ pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/r
|
||||
else
|
||||
{
|
||||
throw ApiException(400, U("{{classname}}->{{operationId}} does not produce any supported media type"));
|
||||
}
|
||||
{{/vendorExtensions.x-codegen-response-ishttpcontent}}
|
||||
|
||||
headerParams[U("Accept")] = responseHttpContentType;
|
||||
|
||||
std::unordered_set<utility::string_t> consumeHttpContentTypes;
|
||||
{{#consumes}}consumeHttpContentTypes.insert( U("{{mediaType}}") );
|
||||
{{/consumes}}
|
||||
|
||||
{{#allParams}}{{^isBodyParam}}{{^isPrimitiveType}}{{^isContainer}}if ({{paramName}} != nullptr){{/isContainer}}{{/isPrimitiveType}}
|
||||
{
|
||||
{{#isContainer}}{{#isQueryParam}}queryParams[U("{{baseName}}")] = ApiClient::parameterToArrayString<{{items.datatype}}>({{paramName}});
|
||||
{{/isQueryParam}}{{#isHeaderParam}}headerParams[U("{{baseName}}")] = ApiClient::parameterToArrayString<{{items.datatype}}>({{paramName}});
|
||||
{{/isHeaderParam}}{{#isFormParam}}{{^isFile}}formParams[ U("{{baseName}}") ] = ApiClient::parameterToArrayString<{{items.datatype}}>({{paramName}});
|
||||
{{/isFile}}{{/isFormParam}}{{/isContainer}}{{^isContainer}}{{#isQueryParam}}queryParams[U("{{baseName}}")] = ApiClient::parameterToString({{paramName}});
|
||||
{{/isQueryParam}}{{#isHeaderParam}}headerParams[U("{{baseName}}")] = ApiClient::parameterToString({{paramName}});
|
||||
{{/isHeaderParam}}{{#isFormParam}}{{#isFile}}fileParams[ U("{{baseName}}") ] = {{paramName}};
|
||||
{{/isFile}}{{^isFile}}formParams[ U("{{baseName}}") ] = ApiClient::parameterToString({{paramName}});
|
||||
{{/isFile}}{{/isFormParam}}{{/isContainer}}
|
||||
}
|
||||
{{/isBodyParam}}{{/allParams}}
|
||||
{{/vendorExtensions.x-codegen-response-ishttpcontent}}
|
||||
|
||||
headerParams[U("Accept")] = responseHttpContentType;
|
||||
|
||||
std::unordered_set<utility::string_t> consumeHttpContentTypes;
|
||||
{{#consumes}}
|
||||
consumeHttpContentTypes.insert( U("{{mediaType}}") );
|
||||
{{/consumes}}
|
||||
|
||||
{{#allParams}}
|
||||
{{^isBodyParam}}
|
||||
{{^isPathParam}}
|
||||
{{^isPrimitiveType}}{{^isContainer}}if ({{paramName}} != nullptr){{/isContainer}}{{/isPrimitiveType}}
|
||||
{
|
||||
{{#isContainer}}
|
||||
{{#isQueryParam}}
|
||||
queryParams[U("{{baseName}}")] = ApiClient::parameterToArrayString<{{items.datatype}}>({{paramName}});
|
||||
{{/isQueryParam}}
|
||||
{{#isHeaderParam}}
|
||||
headerParams[U("{{baseName}}")] = ApiClient::parameterToArrayString<{{items.datatype}}>({{paramName}});
|
||||
{{/isHeaderParam}}
|
||||
{{#isFormParam}}
|
||||
{{^isFile}}
|
||||
formParams[ U("{{baseName}}") ] = ApiClient::parameterToArrayString<{{items.datatype}}>({{paramName}});
|
||||
{{/isFile}}
|
||||
{{/isFormParam}}
|
||||
{{/isContainer}}
|
||||
{{^isContainer}}
|
||||
{{#isQueryParam}}
|
||||
queryParams[U("{{baseName}}")] = ApiClient::parameterToString({{paramName}});
|
||||
{{/isQueryParam}}
|
||||
{{#isHeaderParam}}
|
||||
headerParams[U("{{baseName}}")] = ApiClient::parameterToString({{paramName}});
|
||||
{{/isHeaderParam}}
|
||||
{{#isFormParam}}
|
||||
{{#isFile}}
|
||||
fileParams[ U("{{baseName}}") ] = {{paramName}};
|
||||
{{/isFile}}
|
||||
{{^isFile}}
|
||||
formParams[ U("{{baseName}}") ] = ApiClient::parameterToString({{paramName}});
|
||||
{{/isFile}}
|
||||
{{/isFormParam}}
|
||||
{{/isContainer}}
|
||||
}
|
||||
{{/isPathParam}}
|
||||
{{/isBodyParam}}
|
||||
{{/allParams}}
|
||||
|
||||
std::shared_ptr<IHttpBody> httpBody;
|
||||
utility::string_t requestHttpContentType;
|
||||
|
||||
|
||||
// use JSON if possible
|
||||
if ( consumeHttpContentTypes.size() == 0 || consumeHttpContentTypes.find(U("application/json")) != consumeHttpContentTypes.end() )
|
||||
{
|
||||
requestHttpContentType = U("application/json");
|
||||
|
||||
{{#bodyParam}}
|
||||
web::json::value json;
|
||||
|
||||
{{#isPrimitiveType}} json = ModelBase::toJson({{paramName}});
|
||||
{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isListContainer}}
|
||||
|
||||
{{#isPrimitiveType}}
|
||||
json = ModelBase::toJson({{paramName}});
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
{{#isListContainer}}
|
||||
{
|
||||
std::vector<web::json::value> jsonArray;
|
||||
for( auto& item : {{paramName}} )
|
||||
@@ -137,22 +167,26 @@ pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/r
|
||||
}
|
||||
json = web::json::value::array(jsonArray);
|
||||
}
|
||||
{{/isListContainer}}{{^isListContainer}}json = ModelBase::toJson({{paramName}});
|
||||
{{/isListContainer}}{{/isPrimitiveType}}
|
||||
|
||||
{{/isListContainer}}
|
||||
{{^isListContainer}}
|
||||
json = ModelBase::toJson({{paramName}});
|
||||
{{/isListContainer}}
|
||||
{{/isPrimitiveType}}
|
||||
|
||||
httpBody = std::shared_ptr<IHttpBody>( new JsonBody( json ) );
|
||||
|
||||
{{/bodyParam}}
|
||||
}
|
||||
// multipart formdata
|
||||
// multipart formdata
|
||||
else if( consumeHttpContentTypes.find(U("multipart/form-data")) != consumeHttpContentTypes.end() )
|
||||
{
|
||||
requestHttpContentType = U("multipart/form-data");
|
||||
|
||||
{{#bodyParam}}
|
||||
std::shared_ptr<MultipartFormData> multipart(new MultipartFormData);
|
||||
{{#isPrimitiveType}} multipart->add(ModelBase::toHttpContent("{{paramName}}", {{paramName}}));
|
||||
{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isListContainer}}
|
||||
{{#isPrimitiveType}}
|
||||
multipart->add(ModelBase::toHttpContent("{{paramName}}", {{paramName}}));
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
{{#isListContainer}}
|
||||
{
|
||||
std::vector<web::json::value> jsonArray;
|
||||
for( auto& item : {{paramName}} )
|
||||
@@ -165,13 +199,18 @@ pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/r
|
||||
}
|
||||
multipart->add(ModelBase::toHttpContent(U("{{paramName}}"), web::json::value::array(jsonArray), U("application/json")));
|
||||
}
|
||||
{{/isListContainer}}{{^isListContainer}}{{#isString}}multipart->add(ModelBase::toHttpContent(U("{{paramName}}"), {{paramName}}));
|
||||
{{/isString}}{{^isString}}
|
||||
{{/isListContainer}}
|
||||
{{^isListContainer}}
|
||||
{{#isString}}multipart->add(ModelBase::toHttpContent(U("{{paramName}}"), {{paramName}}));
|
||||
{{/isString}}
|
||||
{{^isString}}
|
||||
if({{paramName}}.get())
|
||||
{
|
||||
{{paramName}}->toMultipart(multipart, U("{{paramName}}"));
|
||||
}
|
||||
{{/isString}}{{/isListContainer}}{{/isPrimitiveType}}
|
||||
{{/isString}}
|
||||
{{/isListContainer}}
|
||||
{{/isPrimitiveType}}
|
||||
|
||||
httpBody = multipart;
|
||||
requestHttpContentType += U("; boundary=") + multipart->getBoundary();
|
||||
@@ -181,10 +220,10 @@ pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/r
|
||||
{
|
||||
throw ApiException(415, U("{{classname}}->{{operationId}} does not consume any supported media type"));
|
||||
}
|
||||
|
||||
|
||||
//Set the request content type in the header.
|
||||
headerParams[U("Content-Type")] = requestHttpContentType;
|
||||
|
||||
|
||||
{{#authMethods}}
|
||||
// authentication ({{name}}) required
|
||||
{{#isApiKey}}
|
||||
@@ -214,13 +253,13 @@ pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/r
|
||||
// oauth2 authentication is added automatically as part of the http_client_config
|
||||
{{/isOAuth}}
|
||||
{{/authMethods}}
|
||||
|
||||
|
||||
return m_ApiClient->callApi(path, U("{{httpMethod}}"), queryParams, httpBody, headerParams, formParams, fileParams, requestHttpContentType)
|
||||
.then([=](web::http::http_response response)
|
||||
{
|
||||
// 1xx - informational : OK
|
||||
// 2xx - successful : OK
|
||||
// 3xx - redirection : OK
|
||||
// 3xx - redirection : OK
|
||||
// 4xx - client error : not OK
|
||||
// 5xx - client error : not OK
|
||||
if (response.status_code() >= 400)
|
||||
@@ -229,7 +268,7 @@ pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/r
|
||||
, U("error calling {{operationId}}: ") + response.reason_phrase()
|
||||
, std::make_shared<std::stringstream>(response.extract_utf8string(true).get()));
|
||||
}
|
||||
|
||||
|
||||
// check response content type
|
||||
if(response.headers().has(U("Content-Type")))
|
||||
{
|
||||
@@ -241,7 +280,7 @@ pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/r
|
||||
, std::make_shared<std::stringstream>(response.extract_utf8string(true).get()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
{{#vendorExtensions.x-codegen-response-ishttpcontent}}
|
||||
return response.extract_vector();
|
||||
})
|
||||
@@ -257,21 +296,28 @@ pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/r
|
||||
})
|
||||
.then([=](utility::string_t response)
|
||||
{
|
||||
{{^returnType}}return void();
|
||||
{{/returnType}}{{#returnType}}{{#returnContainer}}{{{returnType}}} result;
|
||||
{{/returnContainer}}{{^returnContainer}}{{{returnType}}} result({{{defaultResponse}}});{{/returnContainer}}
|
||||
|
||||
{{^returnType}}
|
||||
return void();
|
||||
{{/returnType}}
|
||||
{{#returnType}}
|
||||
{{#returnContainer}}
|
||||
{{{returnType}}} result;
|
||||
{{/returnContainer}}
|
||||
{{^returnContainer}}
|
||||
{{{returnType}}} result({{{defaultResponse}}});
|
||||
{{/returnContainer}}
|
||||
|
||||
if(responseHttpContentType == U("application/json"))
|
||||
{
|
||||
web::json::value json = web::json::value::parse(response);
|
||||
|
||||
|
||||
{{#isListContainer}}for( auto& item : json.as_array() )
|
||||
{
|
||||
{{#vendorExtensions.x-codegen-response.items.isPrimitiveType}}result.push_back(ModelBase::{{vendorExtensions.x-codegen-response.items.datatype}}FromJson(item));
|
||||
{{/vendorExtensions.x-codegen-response.items.isPrimitiveType}}{{^vendorExtensions.x-codegen-response.items.isPrimitiveType}}{{#vendorExtensions.x-codegen-response.items.isString}}result.push_back(ModelBase::stringFromJson(item));
|
||||
{{#vendorExtensions.x-codegen-response.items.isPrimitiveType}}result.push_back(ModelBase::{{vendorExtensions.x-codegen-response.items.datatype}}FromJson(item));
|
||||
{{/vendorExtensions.x-codegen-response.items.isPrimitiveType}}{{^vendorExtensions.x-codegen-response.items.isPrimitiveType}}{{#vendorExtensions.x-codegen-response.items.isString}}result.push_back(ModelBase::stringFromJson(item));
|
||||
{{/vendorExtensions.x-codegen-response.items.isString}}{{^vendorExtensions.x-codegen-response.items.isString}}{{{vendorExtensions.x-codegen-response.items.datatype}}} itemObj({{{vendorExtensions.x-codegen-response.items.defaultValue}}});
|
||||
itemObj->fromJson(item);
|
||||
result.push_back(itemObj);
|
||||
result.push_back(itemObj);
|
||||
{{/vendorExtensions.x-codegen-response.items.isString}}{{/vendorExtensions.x-codegen-response.items.isPrimitiveType}}
|
||||
}
|
||||
{{/isListContainer}}{{^isListContainer}}{{#isMapContainer}}for( auto& item : json.as_object() )
|
||||
@@ -282,7 +328,7 @@ pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/r
|
||||
itemObj->fromJson(item);
|
||||
result[item.first] = itemObj;
|
||||
{{/vendorExtensions.x-codegen-response.items.isString}}{{/vendorExtensions.x-codegen-response.items.isPrimitiveType}}
|
||||
}
|
||||
}
|
||||
{{/isMapContainer}}{{^isMapContainer}}{{#vendorExtensions.x-codegen-response.isPrimitiveType}}result = ModelBase::{{vendorExtensions.x-codegen-response.items.datatype}}FromJson(json);
|
||||
{{/vendorExtensions.x-codegen-response.isPrimitiveType}}{{^vendorExtensions.x-codegen-response.isPrimitiveType}}{{#vendorExtensions.x-codegen-response.isString}}result = ModelBase::stringFromJson(json);
|
||||
{{/vendorExtensions.x-codegen-response.isString}}{{^vendorExtensions.x-codegen-response.isString}}result->fromJson(json);{{/vendorExtensions.x-codegen-response.isString}}{{/vendorExtensions.x-codegen-response.isPrimitiveType}}{{/isMapContainer}}{{/isListContainer}}
|
||||
@@ -293,18 +339,18 @@ pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/r
|
||||
}{{/vendorExtensions.x-codegen-response.isString}}
|
||||
// else if(responseHttpContentType == U("multipart/form-data"))
|
||||
// {
|
||||
// TODO multipart response parsing
|
||||
// TODO multipart response parsing
|
||||
// }
|
||||
else
|
||||
else
|
||||
{
|
||||
throw ApiException(500
|
||||
, U("error calling findPetsByStatus: unsupported response type"));
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
{{/returnType}}
|
||||
{{/vendorExtensions.x-codegen-response-ishttpcontent}}
|
||||
});
|
||||
});
|
||||
}
|
||||
{{/operation}}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{{>licenseInfo}}
|
||||
/*
|
||||
* ApiClient.h
|
||||
*
|
||||
* This is an API client responsible for stating the HTTP calls
|
||||
*
|
||||
* This is an API client responsible for stating the HTTP calls
|
||||
*/
|
||||
|
||||
#ifndef ApiClient_H_
|
||||
@@ -14,8 +14,8 @@
|
||||
#include "IHttpBody.h"
|
||||
#include "HttpContent.h"
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <cpprest/details/basic_types.h>
|
||||
#include <cpprest/http_client.h>
|
||||
@@ -31,39 +31,39 @@ class {{declspec}} ApiClient
|
||||
public:
|
||||
ApiClient( std::shared_ptr<ApiConfiguration> configuration = nullptr );
|
||||
virtual ~ApiClient();
|
||||
|
||||
|
||||
std::shared_ptr<ApiConfiguration> getConfiguration() const;
|
||||
void setConfiguration(std::shared_ptr<ApiConfiguration> configuration);
|
||||
|
||||
|
||||
static utility::string_t parameterToString(utility::string_t value);
|
||||
static utility::string_t parameterToString(int32_t value);
|
||||
static utility::string_t parameterToString(int64_t value);
|
||||
|
||||
|
||||
template<class T>
|
||||
static utility::string_t parameterToArrayString(std::vector<T> value)
|
||||
{
|
||||
utility::stringstream_t ss;
|
||||
|
||||
|
||||
for( size_t i = 0; i < value.size(); i++)
|
||||
{
|
||||
if( i > 0) ss << U(", ");
|
||||
ss << ApiClient::parameterToString(value[i]);
|
||||
}
|
||||
|
||||
return ss.str();
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
pplx::task<web::http::http_response> callApi(
|
||||
const utility::string_t& path,
|
||||
const utility::string_t& method,
|
||||
const std::map<utility::string_t, utility::string_t>& queryParams,
|
||||
const std::shared_ptr<IHttpBody> postBody,
|
||||
const std::map<utility::string_t, utility::string_t>& headerParams,
|
||||
const std::map<utility::string_t, utility::string_t>& formParams,
|
||||
|
||||
pplx::task<web::http::http_response> callApi(
|
||||
const utility::string_t& path,
|
||||
const utility::string_t& method,
|
||||
const std::map<utility::string_t, utility::string_t>& queryParams,
|
||||
const std::shared_ptr<IHttpBody> postBody,
|
||||
const std::map<utility::string_t, utility::string_t>& headerParams,
|
||||
const std::map<utility::string_t, utility::string_t>& formParams,
|
||||
const std::map<utility::string_t, std::shared_ptr<HttpContent>>& fileParams,
|
||||
const utility::string_t& contentType
|
||||
) const;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
std::shared_ptr<ApiConfiguration> m_Configuration;
|
||||
|
||||
@@ -40,91 +40,91 @@ utility::string_t ApiClient::parameterToString(int32_t value)
|
||||
return utility::conversions::to_string_t(std::to_string(value));
|
||||
}
|
||||
|
||||
pplx::task<web::http::http_response> ApiClient::callApi(
|
||||
const utility::string_t& path,
|
||||
const utility::string_t& method,
|
||||
const std::map<utility::string_t, utility::string_t>& queryParams,
|
||||
pplx::task<web::http::http_response> ApiClient::callApi(
|
||||
const utility::string_t& path,
|
||||
const utility::string_t& method,
|
||||
const std::map<utility::string_t, utility::string_t>& queryParams,
|
||||
const std::shared_ptr<IHttpBody> postBody,
|
||||
const std::map<utility::string_t, utility::string_t>& headerParams,
|
||||
const std::map<utility::string_t, utility::string_t>& formParams,
|
||||
const std::map<utility::string_t, utility::string_t>& headerParams,
|
||||
const std::map<utility::string_t, utility::string_t>& formParams,
|
||||
const std::map<utility::string_t, std::shared_ptr<HttpContent>>& fileParams,
|
||||
const utility::string_t& contentType
|
||||
) const
|
||||
{
|
||||
if (postBody != nullptr && formParams.size() != 0)
|
||||
{
|
||||
throw ApiException(400, U("Cannot have body and form params"));
|
||||
}
|
||||
if (postBody != nullptr && formParams.size() != 0)
|
||||
{
|
||||
throw ApiException(400, U("Cannot have body and form params"));
|
||||
}
|
||||
|
||||
if (postBody != nullptr && fileParams.size() != 0)
|
||||
{
|
||||
throw ApiException(400, U("Cannot have body and file params"));
|
||||
}
|
||||
if (postBody != nullptr && fileParams.size() != 0)
|
||||
{
|
||||
throw ApiException(400, U("Cannot have body and file params"));
|
||||
}
|
||||
|
||||
if (fileParams.size() > 0 && contentType != U("multipart/form-data"))
|
||||
{
|
||||
throw ApiException(400, U("Operations with file parameters must be called with multipart/form-data"));
|
||||
}
|
||||
if (fileParams.size() > 0 && contentType != U("multipart/form-data"))
|
||||
{
|
||||
throw ApiException(400, U("Operations with file parameters must be called with multipart/form-data"));
|
||||
}
|
||||
|
||||
web::http::client::http_client client(m_Configuration->getBaseUrl(), m_Configuration->getHttpConfig());
|
||||
web::http::client::http_client client(m_Configuration->getBaseUrl(), m_Configuration->getHttpConfig());
|
||||
|
||||
web::http::http_request request;
|
||||
for ( auto& kvp : headerParams )
|
||||
{
|
||||
request.headers().add(kvp.first, kvp.second);
|
||||
}
|
||||
web::http::http_request request;
|
||||
for ( auto& kvp : headerParams )
|
||||
{
|
||||
request.headers().add(kvp.first, kvp.second);
|
||||
}
|
||||
|
||||
if (fileParams.size() > 0)
|
||||
{
|
||||
MultipartFormData uploadData;
|
||||
for (auto& kvp : formParams)
|
||||
{
|
||||
uploadData.add(ModelBase::toHttpContent(kvp.first, kvp.second));
|
||||
}
|
||||
for (auto& kvp : fileParams)
|
||||
{
|
||||
uploadData.add(ModelBase::toHttpContent(kvp.first, kvp.second));
|
||||
}
|
||||
std::stringstream data;
|
||||
postBody->writeTo(data);
|
||||
auto bodyString = data.str();
|
||||
auto length = bodyString.size();
|
||||
request.set_body(concurrency::streams::bytestream::open_istream(std::move(bodyString)), length, contentType);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (postBody != nullptr)
|
||||
{
|
||||
std::stringstream data;
|
||||
postBody->writeTo(data);
|
||||
auto bodyString = data.str();
|
||||
auto length = bodyString.size();
|
||||
request.set_body(concurrency::streams::bytestream::open_istream(std::move(bodyString)), length, contentType);
|
||||
}
|
||||
else
|
||||
{
|
||||
web::http::uri_builder formData;
|
||||
for (auto& kvp : formParams)
|
||||
{
|
||||
formData.append_query(kvp.first, kvp.second);
|
||||
}
|
||||
request.set_body(formData.query(), U("application/x-www-form-urlencoded"));
|
||||
}
|
||||
}
|
||||
if (fileParams.size() > 0)
|
||||
{
|
||||
MultipartFormData uploadData;
|
||||
for (auto& kvp : formParams)
|
||||
{
|
||||
uploadData.add(ModelBase::toHttpContent(kvp.first, kvp.second));
|
||||
}
|
||||
for (auto& kvp : fileParams)
|
||||
{
|
||||
uploadData.add(ModelBase::toHttpContent(kvp.first, kvp.second));
|
||||
}
|
||||
std::stringstream data;
|
||||
postBody->writeTo(data);
|
||||
auto bodyString = data.str();
|
||||
auto length = bodyString.size();
|
||||
request.set_body(concurrency::streams::bytestream::open_istream(std::move(bodyString)), length, contentType);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (postBody != nullptr)
|
||||
{
|
||||
std::stringstream data;
|
||||
postBody->writeTo(data);
|
||||
auto bodyString = data.str();
|
||||
auto length = bodyString.size();
|
||||
request.set_body(concurrency::streams::bytestream::open_istream(std::move(bodyString)), length, contentType);
|
||||
}
|
||||
else
|
||||
{
|
||||
web::http::uri_builder formData;
|
||||
for (auto& kvp : formParams)
|
||||
{
|
||||
formData.append_query(kvp.first, kvp.second);
|
||||
}
|
||||
request.set_body(formData.query(), U("application/x-www-form-urlencoded"));
|
||||
}
|
||||
}
|
||||
|
||||
web::http::uri_builder builder(path);
|
||||
for (auto& kvp : queryParams)
|
||||
{
|
||||
builder.append_query(kvp.first, kvp.second);
|
||||
}
|
||||
request.set_request_uri(builder.to_uri());
|
||||
request.set_method(method);
|
||||
if ( !request.headers().has( web::http::header_names::user_agent ) )
|
||||
{
|
||||
request.headers().add( web::http::header_names::user_agent, m_Configuration->getUserAgent() );
|
||||
}
|
||||
web::http::uri_builder builder(path);
|
||||
for (auto& kvp : queryParams)
|
||||
{
|
||||
builder.append_query(kvp.first, kvp.second);
|
||||
}
|
||||
request.set_request_uri(builder.to_uri());
|
||||
request.set_method(method);
|
||||
if ( !request.headers().has( web::http::header_names::user_agent ) )
|
||||
{
|
||||
request.headers().add( web::http::header_names::user_agent, m_Configuration->getUserAgent() );
|
||||
}
|
||||
|
||||
return client.request(request);
|
||||
return client.request(request);
|
||||
}
|
||||
|
||||
{{#apiNamespaceDeclarations}}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{{>licenseInfo}}
|
||||
/*
|
||||
* ApiConfiguration.h
|
||||
*
|
||||
* This class represents a single item of a multipart-formdata request.
|
||||
*
|
||||
* This class represents a single item of a multipart-formdata request.
|
||||
*/
|
||||
|
||||
#ifndef ApiConfiguration_H_
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <cpprest/details/basic_types.h>
|
||||
#include <cpprest/details/basic_types.h>
|
||||
#include <cpprest/http_client.h>
|
||||
{{#apiNamespaceDeclarations}}
|
||||
namespace {{this}} {
|
||||
@@ -23,18 +23,18 @@ class {{declspec}} ApiConfiguration
|
||||
public:
|
||||
ApiConfiguration();
|
||||
virtual ~ApiConfiguration();
|
||||
|
||||
|
||||
web::http::client::http_client_config& getHttpConfig();
|
||||
void setHttpConfig( web::http::client::http_client_config& value );
|
||||
|
||||
|
||||
utility::string_t getBaseUrl() const;
|
||||
void setBaseUrl( const utility::string_t value );
|
||||
|
||||
|
||||
utility::string_t getUserAgent() const;
|
||||
void setUserAgent( const utility::string_t value );
|
||||
|
||||
|
||||
std::map<utility::string_t, utility::string_t>& getDefaultHeaders();
|
||||
|
||||
|
||||
utility::string_t getApiKey( const utility::string_t& prefix) const;
|
||||
void setApiKey( const utility::string_t& prefix, const utility::string_t& apiKey );
|
||||
|
||||
@@ -43,7 +43,7 @@ protected:
|
||||
std::map<utility::string_t, utility::string_t> m_DefaultHeaders;
|
||||
std::map<utility::string_t, utility::string_t> m_ApiKeys;
|
||||
web::http::client::http_client_config m_HttpConfig;
|
||||
utility::string_t m_UserAgent;
|
||||
utility::string_t m_UserAgent;
|
||||
};
|
||||
|
||||
{{#apiNamespaceDeclarations}}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{{>licenseInfo}}
|
||||
/*
|
||||
* ApiException.h
|
||||
*
|
||||
*
|
||||
* This is the exception being thrown in case the api call was not successful
|
||||
*/
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
{{{defaultInclude}}}
|
||||
|
||||
#include <memory>
|
||||
#include <memory>
|
||||
#include <map>
|
||||
|
||||
#include <cpprest/details/basic_types.h>
|
||||
@@ -33,12 +33,12 @@ public:
|
||||
, std::map<utility::string_t, utility::string_t>& headers
|
||||
, std::shared_ptr<std::istream> content = nullptr );
|
||||
virtual ~ApiException();
|
||||
|
||||
|
||||
std::map<utility::string_t, utility::string_t>& getHeaders();
|
||||
std::shared_ptr<std::istream> getContent() const;
|
||||
|
||||
|
||||
protected:
|
||||
std::shared_ptr<std::istream> m_Content;
|
||||
std::shared_ptr<std::istream> m_Content;
|
||||
std::map<utility::string_t, utility::string_t> m_Headers;
|
||||
};
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ git init
|
||||
# Adds the files in the local repository and stages them for commit.
|
||||
git add .
|
||||
|
||||
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||
git commit -m "$release_note"
|
||||
|
||||
# Sets the new remote
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{{>licenseInfo}}
|
||||
/*
|
||||
* HttpContent.h
|
||||
*
|
||||
* This class represents a single item of a multipart-formdata request.
|
||||
*
|
||||
* This class represents a single item of a multipart-formdata request.
|
||||
*/
|
||||
|
||||
#ifndef HttpContent_H_
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <cpprest/details/basic_types.h>
|
||||
#include <cpprest/details/basic_types.h>
|
||||
|
||||
{{#modelNamespaceDeclarations}}
|
||||
namespace {{this}} {
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
|
||||
virtual std::shared_ptr<std::istream> getData();
|
||||
virtual void setData( std::shared_ptr<std::istream> value );
|
||||
|
||||
|
||||
virtual void writeTo( std::ostream& stream );
|
||||
|
||||
protected:
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{{>licenseInfo}}
|
||||
/*
|
||||
* IHttpBody.h
|
||||
*
|
||||
* This is the interface for contents that can be sent to a remote HTTP server.
|
||||
*
|
||||
* This is the interface for contents that can be sent to a remote HTTP server.
|
||||
*/
|
||||
|
||||
#ifndef IHttpBody_H_
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{{>licenseInfo}}
|
||||
/*
|
||||
* JsonBody.h
|
||||
*
|
||||
* This is a JSON http body which can be submitted via http
|
||||
*
|
||||
* This is a JSON http body which can be submitted via http
|
||||
*/
|
||||
|
||||
#ifndef JsonBody_H_
|
||||
@@ -11,7 +11,7 @@
|
||||
{{{defaultInclude}}}
|
||||
#include "IHttpBody.h"
|
||||
|
||||
#include <cpprest/json.h>
|
||||
#include <cpprest/json.h>
|
||||
|
||||
{{#modelNamespaceDeclarations}}
|
||||
namespace {{this}} {
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
virtual ~JsonBody();
|
||||
|
||||
void writeTo( std::ostream& target ) override;
|
||||
|
||||
|
||||
protected:
|
||||
web::json::value m_Json;
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace {{this}} {
|
||||
|
||||
JsonBody::JsonBody( const web::json::value& json)
|
||||
: m_Json(json)
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
JsonBody::~JsonBody()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{{>licenseInfo}}
|
||||
{{#models}}{{#model}}/*
|
||||
* {{classname}}.h
|
||||
*
|
||||
*
|
||||
* {{description}}
|
||||
*/
|
||||
|
||||
@@ -22,15 +22,15 @@ namespace {{this}} {
|
||||
/// {{description}}
|
||||
/// </summary>
|
||||
class {{declspec}} {{classname}}
|
||||
: public ModelBase
|
||||
: public ModelBase
|
||||
{
|
||||
public:
|
||||
{{classname}}();
|
||||
virtual ~{{classname}}();
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// ModelBase overrides
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// ModelBase overrides
|
||||
|
||||
void validate() override;
|
||||
|
||||
web::json::value toJson() const override;
|
||||
@@ -38,10 +38,10 @@ public:
|
||||
|
||||
void toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix) const override;
|
||||
void fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix) override;
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// {{classname}} members
|
||||
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// {{classname}} members
|
||||
|
||||
{{#vars}}
|
||||
/// <summary>
|
||||
/// {{description}}
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
void unset{{name}}();
|
||||
{{/required}}
|
||||
{{/vars}}
|
||||
|
||||
|
||||
protected:
|
||||
{{#vars}}{{{datatype}}} m_{{name}};
|
||||
{{^required}}bool m_{{name}}IsSet;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace {{this}} {
|
||||
{
|
||||
}
|
||||
|
||||
void {{classname}}::validate()
|
||||
void {{classname}}::validate()
|
||||
{
|
||||
// TODO: implement validation
|
||||
}
|
||||
@@ -28,7 +28,7 @@ void {{classname}}::validate()
|
||||
web::json::value {{classname}}::toJson() const
|
||||
{
|
||||
web::json::value val = web::json::value::object();
|
||||
|
||||
|
||||
{{#vars}}{{#isPrimitiveType}}{{^isListContainer}}{{^required}}if(m_{{name}}IsSet)
|
||||
{
|
||||
val[U("{{baseName}}")] = ModelBase::toJson(m_{{name}});
|
||||
@@ -42,7 +42,7 @@ web::json::value {{classname}}::toJson() const
|
||||
}
|
||||
{{#required}}val[U("{{baseName}}")] = web::json::value::array(jsonArray);
|
||||
{{/required}}{{^required}}
|
||||
if(jsonArray.size() > 0)
|
||||
if(jsonArray.size() > 0)
|
||||
{
|
||||
val[U("{{baseName}}")] = web::json::value::array(jsonArray);
|
||||
}
|
||||
@@ -77,7 +77,7 @@ void {{classname}}::fromJson(web::json::value& val)
|
||||
{{/isPrimitiveType}}{{^isPrimitiveType}}{{#items.isString}}m_{{name}}.push_back(ModelBase::stringFromJson(item));
|
||||
{{/items.isString}}{{^items.isString}}{{#items.isDateTime}}m_{{name}}.push_back(ModelBase::dateFromJson(item));
|
||||
{{/items.isDateTime}}{{^items.isDateTime}}
|
||||
if(item.is_null())
|
||||
if(item.is_null())
|
||||
{
|
||||
m_{{name}}.push_back( {{{items.datatype}}}(nullptr) );
|
||||
}
|
||||
@@ -89,7 +89,7 @@ void {{classname}}::fromJson(web::json::value& val)
|
||||
}
|
||||
{{/items.isDateTime}}{{/items.isString}}{{/isPrimitiveType}}
|
||||
}
|
||||
{{^required}}
|
||||
{{^required}}
|
||||
}
|
||||
{{/required}}
|
||||
}
|
||||
@@ -97,13 +97,13 @@ void {{classname}}::fromJson(web::json::value& val)
|
||||
{
|
||||
{{#isString}}{{setter}}(ModelBase::stringFromJson(val[U("{{baseName}}")]));
|
||||
{{/isString}}{{^isString}}{{#isDateTime}}{{setter}}(ModelBase::dateFromJson(val[U("{{baseName}}")]));
|
||||
{{/isDateTime}}{{^isDateTime}}if(!val[U("{{baseName}}")].is_null())
|
||||
{{/isDateTime}}{{^isDateTime}}if(!val[U("{{baseName}}")].is_null())
|
||||
{
|
||||
{{{datatype}}} newItem({{{defaultValue}}});
|
||||
newItem->fromJson(val[U("{{baseName}}")]);
|
||||
{{setter}}( newItem );
|
||||
}
|
||||
{{/isDateTime}}{{/isString}}
|
||||
{{/isDateTime}}{{/isString}}
|
||||
}
|
||||
{{/required}}{{#required}}{{#isString}}{{setter}}(ModelBase::stringFromJson(val[U("{{baseName}}")]));
|
||||
{{/isString}}{{^isString}}{{#isDateTime}}{{setter}}(ModelBase::dateFromJson(val[U("{{baseName}}")]));
|
||||
@@ -135,7 +135,7 @@ void {{classname}}::toMultipart(std::shared_ptr<MultipartFormData> multipart, co
|
||||
}
|
||||
{{#required}}multipart->add(ModelBase::toHttpContent(namePrefix + U("{{baseName}}"), web::json::value::array(jsonArray), U("application/json")));
|
||||
{{/required}}{{^required}}
|
||||
if(jsonArray.size() > 0)
|
||||
if(jsonArray.size() > 0)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + U("{{baseName}}"), web::json::value::array(jsonArray), U("application/json")));
|
||||
}
|
||||
@@ -149,7 +149,7 @@ void {{classname}}::toMultipart(std::shared_ptr<MultipartFormData> multipart, co
|
||||
{
|
||||
m_{{name}}->toMultipart(multipart, U("{{baseName}}."));
|
||||
}
|
||||
{{/isDateTime}}{{/isString}}
|
||||
{{/isDateTime}}{{/isString}}
|
||||
}
|
||||
{{/required}}{{#required}}{{#isString}}multipart->add(ModelBase::toHttpContent(namePrefix + U("{{baseName}}"), m_{{name}}));
|
||||
{{/isString}}{{^isString}}{{#isDateTime}}multipart->add(ModelBase::toHttpContent(namePrefix + U("{{baseName}}"), m_{{name}}));
|
||||
@@ -174,9 +174,9 @@ void {{classname}}::fromMultiPart(std::shared_ptr<MultipartFormData> multipart,
|
||||
{{/required}}{{/isListContainer}}{{/isPrimitiveType}}{{#isListContainer}}{
|
||||
m_{{name}}.clear();
|
||||
{{^required}}if(multipart->hasContent(U("{{baseName}}")))
|
||||
{
|
||||
{
|
||||
{{/required}}
|
||||
|
||||
|
||||
web::json::value jsonArray = web::json::value::parse(ModelBase::stringFromHttpContent(multipart->getContent(U("{{baseName}}"))));
|
||||
for( auto& item : jsonArray.as_array() )
|
||||
{
|
||||
@@ -184,7 +184,7 @@ void {{classname}}::fromMultiPart(std::shared_ptr<MultipartFormData> multipart,
|
||||
{{/isPrimitiveType}}{{^isPrimitiveType}}{{#items.isString}}m_{{name}}.push_back(ModelBase::stringFromJson(item));
|
||||
{{/items.isString}}{{^items.isString}}{{#items.isDateTime}}m_{{name}}.push_back(ModelBase::dateFromJson(item));
|
||||
{{/items.isDateTime}}{{^items.isDateTime}}
|
||||
if(item.is_null())
|
||||
if(item.is_null())
|
||||
{
|
||||
m_{{name}}.push_back( {{{items.datatype}}}(nullptr) );
|
||||
}
|
||||
@@ -196,7 +196,7 @@ void {{classname}}::fromMultiPart(std::shared_ptr<MultipartFormData> multipart,
|
||||
}
|
||||
{{/items.isDateTime}}{{/items.isString}}{{/isPrimitiveType}}
|
||||
}
|
||||
{{^required}}
|
||||
{{^required}}
|
||||
}
|
||||
{{/required}}
|
||||
}
|
||||
@@ -210,7 +210,7 @@ void {{classname}}::fromMultiPart(std::shared_ptr<MultipartFormData> multipart,
|
||||
newItem->fromMultiPart(multipart, U("{{baseName}}."));
|
||||
{{setter}}( newItem );
|
||||
}
|
||||
{{/isDateTime}}{{/isString}}
|
||||
{{/isDateTime}}{{/isString}}
|
||||
}
|
||||
{{/required}}{{#required}}{{#isString}}{{setter}}(ModelBase::stringFromHttpContent(multipart->getContent(U("{{baseName}}"))));
|
||||
{{/isString}}{{^isString}}{{#isDateTime}}{{setter}}(ModelBase::dateFromHttpContent(multipart->getContent(U("{{baseName}}"))));
|
||||
@@ -220,8 +220,8 @@ void {{classname}}::fromMultiPart(std::shared_ptr<MultipartFormData> multipart,
|
||||
{{setter}}( new{{name}} );
|
||||
{{/vendorExtensions.x-codegen-file}}{{/isDateTime}}{{/isString}}{{/required}}{{/isPrimitiveType}}{{/isListContainer}}{{/vars}}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
{{#vars}}{{^isNotContainer}}{{{datatype}}}& {{classname}}::{{getter}}()
|
||||
{
|
||||
return m_{{name}};
|
||||
@@ -235,12 +235,12 @@ void {{classname}}::{{setter}}({{{datatype}}} value)
|
||||
m_{{name}} = value;
|
||||
{{^required}}m_{{name}}IsSet = true;{{/required}}
|
||||
}
|
||||
{{/isNotContainer}}
|
||||
{{/isNotContainer}}
|
||||
{{^required}}bool {{classname}}::{{baseName}}IsSet() const
|
||||
{
|
||||
return m_{{name}}IsSet;
|
||||
}
|
||||
void {{classname}}::unset{{name}}()
|
||||
void {{classname}}::unset{{name}}()
|
||||
{
|
||||
m_{{name}}IsSet = false;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{{>licenseInfo}}
|
||||
/*
|
||||
* ModelBase.h
|
||||
*
|
||||
*
|
||||
* This is the base class for all model classes
|
||||
*/
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "MultipartFormData.h"
|
||||
|
||||
#include <cpprest/details/basic_types.h>
|
||||
#include <cpprest/json.h>
|
||||
#include <cpprest/json.h>
|
||||
|
||||
{{#modelNamespaceDeclarations}}
|
||||
namespace {{this}} {
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
static web::json::value toJson( int32_t value );
|
||||
static web::json::value toJson( int64_t value );
|
||||
static web::json::value toJson( double value );
|
||||
|
||||
|
||||
static int64_t int64_tFromJson(web::json::value& val);
|
||||
static int32_t int32_tFromJson(web::json::value& val);
|
||||
static utility::string_t stringFromJson(web::json::value& val);
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
static double doubleFromJson(web::json::value& val);
|
||||
static bool boolFromJson(web::json::value& val);
|
||||
static std::shared_ptr<HttpContent> fileFromJson(web::json::value& val);
|
||||
|
||||
|
||||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, const utility::string_t& value, const utility::string_t& contentType = U(""));
|
||||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, const utility::datetime& value, const utility::string_t& contentType = U(""));
|
||||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, std::shared_ptr<HttpContent> value );
|
||||
@@ -56,14 +56,14 @@ public:
|
||||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, int32_t value, const utility::string_t& contentType = U("") );
|
||||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, int64_t value, const utility::string_t& contentType = U("") );
|
||||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, double value, const utility::string_t& contentType = U("") );
|
||||
|
||||
|
||||
static int64_t int64_tFromHttpContent(std::shared_ptr<HttpContent> val);
|
||||
static int32_t int32_tFromHttpContent(std::shared_ptr<HttpContent> val);
|
||||
static utility::string_t stringFromHttpContent(std::shared_ptr<HttpContent> val);
|
||||
static utility::datetime dateFromHttpContent(std::shared_ptr<HttpContent> val);
|
||||
static bool boolFromHttpContent(std::shared_ptr<HttpContent> val);
|
||||
static double doubleFromHttpContent(std::shared_ptr<HttpContent> val);
|
||||
|
||||
|
||||
|
||||
static utility::string_t toBase64( utility::string_t value );
|
||||
static utility::string_t toBase64( std::shared_ptr<std::istream> value );
|
||||
|
||||
@@ -14,7 +14,7 @@ ModelBase::~ModelBase()
|
||||
|
||||
web::json::value ModelBase::toJson( const utility::string_t& value )
|
||||
{
|
||||
return web::json::value::string(value);
|
||||
return web::json::value::string(value);
|
||||
}
|
||||
web::json::value ModelBase::toJson( const utility::datetime& value )
|
||||
{
|
||||
@@ -26,7 +26,7 @@ web::json::value ModelBase::toJson( int32_t value )
|
||||
}
|
||||
web::json::value ModelBase::toJson( int64_t value )
|
||||
{
|
||||
return web::json::value::number(value);
|
||||
return web::json::value::number(value);
|
||||
}
|
||||
web::json::value ModelBase::toJson( double value )
|
||||
{
|
||||
@@ -46,7 +46,7 @@ web::json::value ModelBase::toJson( std::shared_ptr<HttpContent> content )
|
||||
std::shared_ptr<HttpContent> ModelBase::fileFromJson(web::json::value& val)
|
||||
{
|
||||
std::shared_ptr<HttpContent> content(new HttpContent);
|
||||
|
||||
|
||||
if(val.has_field(U("ContentDisposition")))
|
||||
{
|
||||
content->setContentDisposition( ModelBase::stringFromJson(val[U("ContentDisposition")]) );
|
||||
@@ -169,14 +169,14 @@ utility::string_t ModelBase::toBase64( std::shared_ptr<std::istream> value )
|
||||
{
|
||||
case 1:
|
||||
value->read( read, 1 );
|
||||
temp = read[0] << 16;
|
||||
temp = read[0] << 16;
|
||||
base64.append( 1, Base64Chars[(temp & 0x00FC0000) >> 18] );
|
||||
base64.append( 1, Base64Chars[(temp & 0x0003F000) >> 12] );
|
||||
base64.append( 2, Base64PadChar );
|
||||
break;
|
||||
case 2:
|
||||
value->read( read, 2 );
|
||||
temp = read[0] << 16;
|
||||
temp = read[0] << 16;
|
||||
temp += read[1] << 8;
|
||||
base64.append( 1, Base64Chars[(temp & 0x00FC0000) >> 18] );
|
||||
base64.append( 1, Base64Chars[(temp & 0x0003F000) >> 12] );
|
||||
@@ -191,7 +191,7 @@ utility::string_t ModelBase::toBase64( std::shared_ptr<std::istream> value )
|
||||
std::shared_ptr<std::istream> ModelBase::fromBase64( const utility::string_t& encoded )
|
||||
{
|
||||
std::shared_ptr<std::stringstream> result(new std::stringstream);
|
||||
|
||||
|
||||
char outBuf[3] = { 0 };
|
||||
uint32_t temp = 0;
|
||||
|
||||
@@ -201,9 +201,9 @@ std::shared_ptr<std::istream> ModelBase::fromBase64( const utility::string_t& en
|
||||
for ( size_t quantumPosition = 0; quantumPosition < 4; quantumPosition++ )
|
||||
{
|
||||
temp <<= 6;
|
||||
if ( *cursor >= 0x41 && *cursor <= 0x5A )
|
||||
if ( *cursor >= 0x41 && *cursor <= 0x5A )
|
||||
{
|
||||
temp |= *cursor - 0x41;
|
||||
temp |= *cursor - 0x41;
|
||||
}
|
||||
else if ( *cursor >= 0x61 && *cursor <= 0x7A )
|
||||
{
|
||||
@@ -283,7 +283,7 @@ double ModelBase::doubleFromJson(web::json::value& val)
|
||||
int64_t ModelBase::int64_tFromHttpContent(std::shared_ptr<HttpContent> val)
|
||||
{
|
||||
utility::string_t str = ModelBase::stringFromHttpContent(val);
|
||||
|
||||
|
||||
utility::stringstream_t ss(str);
|
||||
int64_t result = 0;
|
||||
ss >> result;
|
||||
@@ -292,7 +292,7 @@ int64_t ModelBase::int64_tFromHttpContent(std::shared_ptr<HttpContent> val)
|
||||
int32_t ModelBase::int32_tFromHttpContent(std::shared_ptr<HttpContent> val)
|
||||
{
|
||||
utility::string_t str = ModelBase::stringFromHttpContent(val);
|
||||
|
||||
|
||||
utility::stringstream_t ss(str);
|
||||
int32_t result = 0;
|
||||
ss >> result;
|
||||
@@ -302,22 +302,22 @@ utility::string_t ModelBase::stringFromHttpContent(std::shared_ptr<HttpContent>
|
||||
{
|
||||
std::shared_ptr<std::istream> data = val->getData();
|
||||
data->seekg( 0, data->beg );
|
||||
|
||||
|
||||
std::string str((std::istreambuf_iterator<char>(*data.get())),
|
||||
std::istreambuf_iterator<char>());
|
||||
|
||||
|
||||
return utility::conversions::to_string_t(str);
|
||||
}
|
||||
utility::datetime ModelBase::dateFromHttpContent(std::shared_ptr<HttpContent> val)
|
||||
{
|
||||
utility::string_t str = ModelBase::stringFromHttpContent(val);
|
||||
utility::string_t str = ModelBase::stringFromHttpContent(val);
|
||||
return utility::datetime::from_string(str, utility::datetime::ISO_8601);
|
||||
}
|
||||
|
||||
bool ModelBase::boolFromHttpContent(std::shared_ptr<HttpContent> val)
|
||||
{
|
||||
utility::string_t str = ModelBase::stringFromHttpContent(val);
|
||||
|
||||
|
||||
utility::stringstream_t ss(str);
|
||||
bool result = false;
|
||||
ss >> result;
|
||||
@@ -326,7 +326,7 @@ bool ModelBase::boolFromHttpContent(std::shared_ptr<HttpContent> val)
|
||||
double ModelBase::doubleFromHttpContent(std::shared_ptr<HttpContent> val)
|
||||
{
|
||||
utility::string_t str = ModelBase::stringFromHttpContent(val);
|
||||
|
||||
|
||||
utility::stringstream_t ss(str);
|
||||
double result = 0.0;
|
||||
ss >> result;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{{>licenseInfo}}
|
||||
/*
|
||||
* MultipartFormData.h
|
||||
*
|
||||
* This class represents a container for building a application/x-multipart-formdata requests.
|
||||
*
|
||||
* This class represents a container for building a application/x-multipart-formdata requests.
|
||||
*/
|
||||
|
||||
#ifndef MultipartFormData_H_
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
virtual std::shared_ptr<HttpContent> getContent(const utility::string_t& name) const;
|
||||
virtual bool hasContent(const utility::string_t& name) const;
|
||||
virtual void writeTo( std::ostream& target );
|
||||
|
||||
|
||||
protected:
|
||||
std::vector<std::shared_ptr<HttpContent>> m_Contents;
|
||||
utility::string_t m_Boundary;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{{>licenseInfo}}
|
||||
#include "MultipartFormData.h"
|
||||
#include "ModelBase.h"
|
||||
#include "ModelBase.h"
|
||||
|
||||
#include <boost/uuid/random_generator.hpp>
|
||||
#include <boost/uuid/uuid_io.hpp>
|
||||
#include <boost/uuid/uuid_io.hpp>
|
||||
|
||||
{{#modelNamespaceDeclarations}}
|
||||
namespace {{this}} {
|
||||
@@ -82,7 +82,7 @@ void MultipartFormData::writeTo( std::ostream& target )
|
||||
|
||||
// body
|
||||
std::shared_ptr<std::istream> data = content->getData();
|
||||
|
||||
|
||||
data->seekg( 0, data->end );
|
||||
std::vector<char> dataBytes( data->tellg() );
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
@@ -52,91 +52,91 @@ utility::string_t ApiClient::parameterToString(int32_t value)
|
||||
return utility::conversions::to_string_t(std::to_string(value));
|
||||
}
|
||||
|
||||
pplx::task<web::http::http_response> ApiClient::callApi(
|
||||
const utility::string_t& path,
|
||||
const utility::string_t& method,
|
||||
const std::map<utility::string_t, utility::string_t>& queryParams,
|
||||
pplx::task<web::http::http_response> ApiClient::callApi(
|
||||
const utility::string_t& path,
|
||||
const utility::string_t& method,
|
||||
const std::map<utility::string_t, utility::string_t>& queryParams,
|
||||
const std::shared_ptr<IHttpBody> postBody,
|
||||
const std::map<utility::string_t, utility::string_t>& headerParams,
|
||||
const std::map<utility::string_t, utility::string_t>& formParams,
|
||||
const std::map<utility::string_t, utility::string_t>& headerParams,
|
||||
const std::map<utility::string_t, utility::string_t>& formParams,
|
||||
const std::map<utility::string_t, std::shared_ptr<HttpContent>>& fileParams,
|
||||
const utility::string_t& contentType
|
||||
) const
|
||||
{
|
||||
if (postBody != nullptr && formParams.size() != 0)
|
||||
{
|
||||
throw ApiException(400, U("Cannot have body and form params"));
|
||||
}
|
||||
if (postBody != nullptr && formParams.size() != 0)
|
||||
{
|
||||
throw ApiException(400, U("Cannot have body and form params"));
|
||||
}
|
||||
|
||||
if (postBody != nullptr && fileParams.size() != 0)
|
||||
{
|
||||
throw ApiException(400, U("Cannot have body and file params"));
|
||||
}
|
||||
if (postBody != nullptr && fileParams.size() != 0)
|
||||
{
|
||||
throw ApiException(400, U("Cannot have body and file params"));
|
||||
}
|
||||
|
||||
if (fileParams.size() > 0 && contentType != U("multipart/form-data"))
|
||||
{
|
||||
throw ApiException(400, U("Operations with file parameters must be called with multipart/form-data"));
|
||||
}
|
||||
if (fileParams.size() > 0 && contentType != U("multipart/form-data"))
|
||||
{
|
||||
throw ApiException(400, U("Operations with file parameters must be called with multipart/form-data"));
|
||||
}
|
||||
|
||||
web::http::client::http_client client(m_Configuration->getBaseUrl(), m_Configuration->getHttpConfig());
|
||||
web::http::client::http_client client(m_Configuration->getBaseUrl(), m_Configuration->getHttpConfig());
|
||||
|
||||
web::http::http_request request;
|
||||
for ( auto& kvp : headerParams )
|
||||
{
|
||||
request.headers().add(kvp.first, kvp.second);
|
||||
}
|
||||
web::http::http_request request;
|
||||
for ( auto& kvp : headerParams )
|
||||
{
|
||||
request.headers().add(kvp.first, kvp.second);
|
||||
}
|
||||
|
||||
if (fileParams.size() > 0)
|
||||
{
|
||||
MultipartFormData uploadData;
|
||||
for (auto& kvp : formParams)
|
||||
{
|
||||
uploadData.add(ModelBase::toHttpContent(kvp.first, kvp.second));
|
||||
}
|
||||
for (auto& kvp : fileParams)
|
||||
{
|
||||
uploadData.add(ModelBase::toHttpContent(kvp.first, kvp.second));
|
||||
}
|
||||
std::stringstream data;
|
||||
postBody->writeTo(data);
|
||||
auto bodyString = data.str();
|
||||
auto length = bodyString.size();
|
||||
request.set_body(concurrency::streams::bytestream::open_istream(std::move(bodyString)), length, contentType);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (postBody != nullptr)
|
||||
{
|
||||
std::stringstream data;
|
||||
postBody->writeTo(data);
|
||||
auto bodyString = data.str();
|
||||
auto length = bodyString.size();
|
||||
request.set_body(concurrency::streams::bytestream::open_istream(std::move(bodyString)), length, contentType);
|
||||
}
|
||||
else
|
||||
{
|
||||
web::http::uri_builder formData;
|
||||
for (auto& kvp : formParams)
|
||||
{
|
||||
formData.append_query(kvp.first, kvp.second);
|
||||
}
|
||||
request.set_body(formData.query(), U("application/x-www-form-urlencoded"));
|
||||
}
|
||||
}
|
||||
if (fileParams.size() > 0)
|
||||
{
|
||||
MultipartFormData uploadData;
|
||||
for (auto& kvp : formParams)
|
||||
{
|
||||
uploadData.add(ModelBase::toHttpContent(kvp.first, kvp.second));
|
||||
}
|
||||
for (auto& kvp : fileParams)
|
||||
{
|
||||
uploadData.add(ModelBase::toHttpContent(kvp.first, kvp.second));
|
||||
}
|
||||
std::stringstream data;
|
||||
postBody->writeTo(data);
|
||||
auto bodyString = data.str();
|
||||
auto length = bodyString.size();
|
||||
request.set_body(concurrency::streams::bytestream::open_istream(std::move(bodyString)), length, contentType);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (postBody != nullptr)
|
||||
{
|
||||
std::stringstream data;
|
||||
postBody->writeTo(data);
|
||||
auto bodyString = data.str();
|
||||
auto length = bodyString.size();
|
||||
request.set_body(concurrency::streams::bytestream::open_istream(std::move(bodyString)), length, contentType);
|
||||
}
|
||||
else
|
||||
{
|
||||
web::http::uri_builder formData;
|
||||
for (auto& kvp : formParams)
|
||||
{
|
||||
formData.append_query(kvp.first, kvp.second);
|
||||
}
|
||||
request.set_body(formData.query(), U("application/x-www-form-urlencoded"));
|
||||
}
|
||||
}
|
||||
|
||||
web::http::uri_builder builder(path);
|
||||
for (auto& kvp : queryParams)
|
||||
{
|
||||
builder.append_query(kvp.first, kvp.second);
|
||||
}
|
||||
request.set_request_uri(builder.to_uri());
|
||||
request.set_method(method);
|
||||
if ( !request.headers().has( web::http::header_names::user_agent ) )
|
||||
{
|
||||
request.headers().add( web::http::header_names::user_agent, m_Configuration->getUserAgent() );
|
||||
}
|
||||
web::http::uri_builder builder(path);
|
||||
for (auto& kvp : queryParams)
|
||||
{
|
||||
builder.append_query(kvp.first, kvp.second);
|
||||
}
|
||||
request.set_request_uri(builder.to_uri());
|
||||
request.set_method(method);
|
||||
if ( !request.headers().has( web::http::header_names::user_agent ) )
|
||||
{
|
||||
request.headers().add( web::http::header_names::user_agent, m_Configuration->getUserAgent() );
|
||||
}
|
||||
|
||||
return client.request(request);
|
||||
return client.request(request);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
@@ -12,8 +12,8 @@
|
||||
|
||||
/*
|
||||
* ApiClient.h
|
||||
*
|
||||
* This is an API client responsible for stating the HTTP calls
|
||||
*
|
||||
* This is an API client responsible for stating the HTTP calls
|
||||
*/
|
||||
|
||||
#ifndef ApiClient_H_
|
||||
@@ -25,8 +25,8 @@
|
||||
#include "IHttpBody.h"
|
||||
#include "HttpContent.h"
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <cpprest/details/basic_types.h>
|
||||
#include <cpprest/http_client.h>
|
||||
@@ -43,39 +43,39 @@ class ApiClient
|
||||
public:
|
||||
ApiClient( std::shared_ptr<ApiConfiguration> configuration = nullptr );
|
||||
virtual ~ApiClient();
|
||||
|
||||
|
||||
std::shared_ptr<ApiConfiguration> getConfiguration() const;
|
||||
void setConfiguration(std::shared_ptr<ApiConfiguration> configuration);
|
||||
|
||||
|
||||
static utility::string_t parameterToString(utility::string_t value);
|
||||
static utility::string_t parameterToString(int32_t value);
|
||||
static utility::string_t parameterToString(int64_t value);
|
||||
|
||||
|
||||
template<class T>
|
||||
static utility::string_t parameterToArrayString(std::vector<T> value)
|
||||
{
|
||||
utility::stringstream_t ss;
|
||||
|
||||
|
||||
for( size_t i = 0; i < value.size(); i++)
|
||||
{
|
||||
if( i > 0) ss << U(", ");
|
||||
ss << ApiClient::parameterToString(value[i]);
|
||||
}
|
||||
|
||||
return ss.str();
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
pplx::task<web::http::http_response> callApi(
|
||||
const utility::string_t& path,
|
||||
const utility::string_t& method,
|
||||
const std::map<utility::string_t, utility::string_t>& queryParams,
|
||||
const std::shared_ptr<IHttpBody> postBody,
|
||||
const std::map<utility::string_t, utility::string_t>& headerParams,
|
||||
const std::map<utility::string_t, utility::string_t>& formParams,
|
||||
|
||||
pplx::task<web::http::http_response> callApi(
|
||||
const utility::string_t& path,
|
||||
const utility::string_t& method,
|
||||
const std::map<utility::string_t, utility::string_t>& queryParams,
|
||||
const std::shared_ptr<IHttpBody> postBody,
|
||||
const std::map<utility::string_t, utility::string_t>& headerParams,
|
||||
const std::map<utility::string_t, utility::string_t>& formParams,
|
||||
const std::map<utility::string_t, std::shared_ptr<HttpContent>>& fileParams,
|
||||
const utility::string_t& contentType
|
||||
) const;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
std::shared_ptr<ApiConfiguration> m_Configuration;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
@@ -12,8 +12,8 @@
|
||||
|
||||
/*
|
||||
* ApiConfiguration.h
|
||||
*
|
||||
* This class represents a single item of a multipart-formdata request.
|
||||
*
|
||||
* This class represents a single item of a multipart-formdata request.
|
||||
*/
|
||||
|
||||
#ifndef ApiConfiguration_H_
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <cpprest/details/basic_types.h>
|
||||
#include <cpprest/details/basic_types.h>
|
||||
#include <cpprest/http_client.h>
|
||||
namespace io {
|
||||
namespace swagger {
|
||||
@@ -35,18 +35,18 @@ class ApiConfiguration
|
||||
public:
|
||||
ApiConfiguration();
|
||||
virtual ~ApiConfiguration();
|
||||
|
||||
|
||||
web::http::client::http_client_config& getHttpConfig();
|
||||
void setHttpConfig( web::http::client::http_client_config& value );
|
||||
|
||||
|
||||
utility::string_t getBaseUrl() const;
|
||||
void setBaseUrl( const utility::string_t value );
|
||||
|
||||
|
||||
utility::string_t getUserAgent() const;
|
||||
void setUserAgent( const utility::string_t value );
|
||||
|
||||
|
||||
std::map<utility::string_t, utility::string_t>& getDefaultHeaders();
|
||||
|
||||
|
||||
utility::string_t getApiKey( const utility::string_t& prefix) const;
|
||||
void setApiKey( const utility::string_t& prefix, const utility::string_t& apiKey );
|
||||
|
||||
@@ -55,7 +55,7 @@ protected:
|
||||
std::map<utility::string_t, utility::string_t> m_DefaultHeaders;
|
||||
std::map<utility::string_t, utility::string_t> m_ApiKeys;
|
||||
web::http::client::http_client_config m_HttpConfig;
|
||||
utility::string_t m_UserAgent;
|
||||
utility::string_t m_UserAgent;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
/*
|
||||
* ApiException.h
|
||||
*
|
||||
*
|
||||
* This is the exception being thrown in case the api call was not successful
|
||||
*/
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
|
||||
|
||||
#include <memory>
|
||||
#include <memory>
|
||||
#include <map>
|
||||
|
||||
#include <cpprest/details/basic_types.h>
|
||||
@@ -45,12 +45,12 @@ public:
|
||||
, std::map<utility::string_t, utility::string_t>& headers
|
||||
, std::shared_ptr<std::istream> content = nullptr );
|
||||
virtual ~ApiException();
|
||||
|
||||
|
||||
std::map<utility::string_t, utility::string_t>& getHeaders();
|
||||
std::shared_ptr<std::istream> getContent() const;
|
||||
|
||||
|
||||
protected:
|
||||
std::shared_ptr<std::istream> m_Content;
|
||||
std::shared_ptr<std::istream> m_Content;
|
||||
std::map<utility::string_t, utility::string_t> m_Headers;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
@@ -12,8 +12,8 @@
|
||||
|
||||
/*
|
||||
* HttpContent.h
|
||||
*
|
||||
* This class represents a single item of a multipart-formdata request.
|
||||
*
|
||||
* This class represents a single item of a multipart-formdata request.
|
||||
*/
|
||||
|
||||
#ifndef HttpContent_H_
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <cpprest/details/basic_types.h>
|
||||
#include <cpprest/details/basic_types.h>
|
||||
|
||||
namespace io {
|
||||
namespace swagger {
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
|
||||
virtual std::shared_ptr<std::istream> getData();
|
||||
virtual void setData( std::shared_ptr<std::istream> value );
|
||||
|
||||
|
||||
virtual void writeTo( std::ostream& stream );
|
||||
|
||||
protected:
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
@@ -12,8 +12,8 @@
|
||||
|
||||
/*
|
||||
* IHttpBody.h
|
||||
*
|
||||
* This is the interface for contents that can be sent to a remote HTTP server.
|
||||
*
|
||||
* This is the interface for contents that can be sent to a remote HTTP server.
|
||||
*/
|
||||
|
||||
#ifndef IHttpBody_H_
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
@@ -19,7 +19,7 @@ namespace model {
|
||||
|
||||
JsonBody::JsonBody( const web::json::value& json)
|
||||
: m_Json(json)
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
JsonBody::~JsonBody()
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
@@ -12,8 +12,8 @@
|
||||
|
||||
/*
|
||||
* JsonBody.h
|
||||
*
|
||||
* This is a JSON http body which can be submitted via http
|
||||
*
|
||||
* This is a JSON http body which can be submitted via http
|
||||
*/
|
||||
|
||||
#ifndef JsonBody_H_
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "IHttpBody.h"
|
||||
|
||||
#include <cpprest/json.h>
|
||||
#include <cpprest/json.h>
|
||||
|
||||
namespace io {
|
||||
namespace swagger {
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
virtual ~JsonBody();
|
||||
|
||||
void writeTo( std::ostream& target ) override;
|
||||
|
||||
|
||||
protected:
|
||||
web::json::value m_Json;
|
||||
};
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
@@ -26,7 +26,7 @@ ModelBase::~ModelBase()
|
||||
|
||||
web::json::value ModelBase::toJson( const utility::string_t& value )
|
||||
{
|
||||
return web::json::value::string(value);
|
||||
return web::json::value::string(value);
|
||||
}
|
||||
web::json::value ModelBase::toJson( const utility::datetime& value )
|
||||
{
|
||||
@@ -38,7 +38,7 @@ web::json::value ModelBase::toJson( int32_t value )
|
||||
}
|
||||
web::json::value ModelBase::toJson( int64_t value )
|
||||
{
|
||||
return web::json::value::number(value);
|
||||
return web::json::value::number(value);
|
||||
}
|
||||
web::json::value ModelBase::toJson( double value )
|
||||
{
|
||||
@@ -58,7 +58,7 @@ web::json::value ModelBase::toJson( std::shared_ptr<HttpContent> content )
|
||||
std::shared_ptr<HttpContent> ModelBase::fileFromJson(web::json::value& val)
|
||||
{
|
||||
std::shared_ptr<HttpContent> content(new HttpContent);
|
||||
|
||||
|
||||
if(val.has_field(U("ContentDisposition")))
|
||||
{
|
||||
content->setContentDisposition( ModelBase::stringFromJson(val[U("ContentDisposition")]) );
|
||||
@@ -181,14 +181,14 @@ utility::string_t ModelBase::toBase64( std::shared_ptr<std::istream> value )
|
||||
{
|
||||
case 1:
|
||||
value->read( read, 1 );
|
||||
temp = read[0] << 16;
|
||||
temp = read[0] << 16;
|
||||
base64.append( 1, Base64Chars[(temp & 0x00FC0000) >> 18] );
|
||||
base64.append( 1, Base64Chars[(temp & 0x0003F000) >> 12] );
|
||||
base64.append( 2, Base64PadChar );
|
||||
break;
|
||||
case 2:
|
||||
value->read( read, 2 );
|
||||
temp = read[0] << 16;
|
||||
temp = read[0] << 16;
|
||||
temp += read[1] << 8;
|
||||
base64.append( 1, Base64Chars[(temp & 0x00FC0000) >> 18] );
|
||||
base64.append( 1, Base64Chars[(temp & 0x0003F000) >> 12] );
|
||||
@@ -203,7 +203,7 @@ utility::string_t ModelBase::toBase64( std::shared_ptr<std::istream> value )
|
||||
std::shared_ptr<std::istream> ModelBase::fromBase64( const utility::string_t& encoded )
|
||||
{
|
||||
std::shared_ptr<std::stringstream> result(new std::stringstream);
|
||||
|
||||
|
||||
char outBuf[3] = { 0 };
|
||||
uint32_t temp = 0;
|
||||
|
||||
@@ -213,9 +213,9 @@ std::shared_ptr<std::istream> ModelBase::fromBase64( const utility::string_t& en
|
||||
for ( size_t quantumPosition = 0; quantumPosition < 4; quantumPosition++ )
|
||||
{
|
||||
temp <<= 6;
|
||||
if ( *cursor >= 0x41 && *cursor <= 0x5A )
|
||||
if ( *cursor >= 0x41 && *cursor <= 0x5A )
|
||||
{
|
||||
temp |= *cursor - 0x41;
|
||||
temp |= *cursor - 0x41;
|
||||
}
|
||||
else if ( *cursor >= 0x61 && *cursor <= 0x7A )
|
||||
{
|
||||
@@ -295,7 +295,7 @@ double ModelBase::doubleFromJson(web::json::value& val)
|
||||
int64_t ModelBase::int64_tFromHttpContent(std::shared_ptr<HttpContent> val)
|
||||
{
|
||||
utility::string_t str = ModelBase::stringFromHttpContent(val);
|
||||
|
||||
|
||||
utility::stringstream_t ss(str);
|
||||
int64_t result = 0;
|
||||
ss >> result;
|
||||
@@ -304,7 +304,7 @@ int64_t ModelBase::int64_tFromHttpContent(std::shared_ptr<HttpContent> val)
|
||||
int32_t ModelBase::int32_tFromHttpContent(std::shared_ptr<HttpContent> val)
|
||||
{
|
||||
utility::string_t str = ModelBase::stringFromHttpContent(val);
|
||||
|
||||
|
||||
utility::stringstream_t ss(str);
|
||||
int32_t result = 0;
|
||||
ss >> result;
|
||||
@@ -314,22 +314,22 @@ utility::string_t ModelBase::stringFromHttpContent(std::shared_ptr<HttpContent>
|
||||
{
|
||||
std::shared_ptr<std::istream> data = val->getData();
|
||||
data->seekg( 0, data->beg );
|
||||
|
||||
|
||||
std::string str((std::istreambuf_iterator<char>(*data.get())),
|
||||
std::istreambuf_iterator<char>());
|
||||
|
||||
|
||||
return utility::conversions::to_string_t(str);
|
||||
}
|
||||
utility::datetime ModelBase::dateFromHttpContent(std::shared_ptr<HttpContent> val)
|
||||
{
|
||||
utility::string_t str = ModelBase::stringFromHttpContent(val);
|
||||
utility::string_t str = ModelBase::stringFromHttpContent(val);
|
||||
return utility::datetime::from_string(str, utility::datetime::ISO_8601);
|
||||
}
|
||||
|
||||
bool ModelBase::boolFromHttpContent(std::shared_ptr<HttpContent> val)
|
||||
{
|
||||
utility::string_t str = ModelBase::stringFromHttpContent(val);
|
||||
|
||||
|
||||
utility::stringstream_t ss(str);
|
||||
bool result = false;
|
||||
ss >> result;
|
||||
@@ -338,7 +338,7 @@ bool ModelBase::boolFromHttpContent(std::shared_ptr<HttpContent> val)
|
||||
double ModelBase::doubleFromHttpContent(std::shared_ptr<HttpContent> val)
|
||||
{
|
||||
utility::string_t str = ModelBase::stringFromHttpContent(val);
|
||||
|
||||
|
||||
utility::stringstream_t ss(str);
|
||||
double result = 0.0;
|
||||
ss >> result;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
/*
|
||||
* ModelBase.h
|
||||
*
|
||||
*
|
||||
* This is the base class for all model classes
|
||||
*/
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "MultipartFormData.h"
|
||||
|
||||
#include <cpprest/details/basic_types.h>
|
||||
#include <cpprest/json.h>
|
||||
#include <cpprest/json.h>
|
||||
|
||||
namespace io {
|
||||
namespace swagger {
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
static web::json::value toJson( int32_t value );
|
||||
static web::json::value toJson( int64_t value );
|
||||
static web::json::value toJson( double value );
|
||||
|
||||
|
||||
static int64_t int64_tFromJson(web::json::value& val);
|
||||
static int32_t int32_tFromJson(web::json::value& val);
|
||||
static utility::string_t stringFromJson(web::json::value& val);
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
static double doubleFromJson(web::json::value& val);
|
||||
static bool boolFromJson(web::json::value& val);
|
||||
static std::shared_ptr<HttpContent> fileFromJson(web::json::value& val);
|
||||
|
||||
|
||||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, const utility::string_t& value, const utility::string_t& contentType = U(""));
|
||||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, const utility::datetime& value, const utility::string_t& contentType = U(""));
|
||||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, std::shared_ptr<HttpContent> value );
|
||||
@@ -68,14 +68,14 @@ public:
|
||||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, int32_t value, const utility::string_t& contentType = U("") );
|
||||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, int64_t value, const utility::string_t& contentType = U("") );
|
||||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, double value, const utility::string_t& contentType = U("") );
|
||||
|
||||
|
||||
static int64_t int64_tFromHttpContent(std::shared_ptr<HttpContent> val);
|
||||
static int32_t int32_tFromHttpContent(std::shared_ptr<HttpContent> val);
|
||||
static utility::string_t stringFromHttpContent(std::shared_ptr<HttpContent> val);
|
||||
static utility::datetime dateFromHttpContent(std::shared_ptr<HttpContent> val);
|
||||
static bool boolFromHttpContent(std::shared_ptr<HttpContent> val);
|
||||
static double doubleFromHttpContent(std::shared_ptr<HttpContent> val);
|
||||
|
||||
|
||||
|
||||
static utility::string_t toBase64( utility::string_t value );
|
||||
static utility::string_t toBase64( std::shared_ptr<std::istream> value );
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
@@ -11,10 +11,10 @@
|
||||
*/
|
||||
|
||||
#include "MultipartFormData.h"
|
||||
#include "ModelBase.h"
|
||||
#include "ModelBase.h"
|
||||
|
||||
#include <boost/uuid/random_generator.hpp>
|
||||
#include <boost/uuid/uuid_io.hpp>
|
||||
#include <boost/uuid/uuid_io.hpp>
|
||||
|
||||
namespace io {
|
||||
namespace swagger {
|
||||
@@ -94,7 +94,7 @@ void MultipartFormData::writeTo( std::ostream& target )
|
||||
|
||||
// body
|
||||
std::shared_ptr<std::istream> data = content->getData();
|
||||
|
||||
|
||||
data->seekg( 0, data->end );
|
||||
std::vector<char> dataBytes( data->tellg() );
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
@@ -12,8 +12,8 @@
|
||||
|
||||
/*
|
||||
* MultipartFormData.h
|
||||
*
|
||||
* This class represents a container for building a application/x-multipart-formdata requests.
|
||||
*
|
||||
* This class represents a container for building a application/x-multipart-formdata requests.
|
||||
*/
|
||||
|
||||
#ifndef MultipartFormData_H_
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
virtual std::shared_ptr<HttpContent> getContent(const utility::string_t& name) const;
|
||||
virtual bool hasContent(const utility::string_t& name) const;
|
||||
virtual void writeTo( std::ostream& target );
|
||||
|
||||
|
||||
protected:
|
||||
std::vector<std::shared_ptr<HttpContent>> m_Contents;
|
||||
utility::string_t m_Boundary;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
@@ -12,16 +12,17 @@
|
||||
|
||||
/*
|
||||
* PetApi.h
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef PetApi_H_
|
||||
#define PetApi_H_
|
||||
|
||||
|
||||
#include "ApiClient.h"
|
||||
|
||||
#include "ApiResponse.h"
|
||||
#include "HttpContent.h"
|
||||
#include "Pet.h"
|
||||
#include <cpprest/details/basic_types.h>
|
||||
@@ -44,7 +45,7 @@ public:
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="body">Pet object that needs to be added to the store (optional)</param>
|
||||
/// <param name="body">Pet object that needs to be added to the store</param>
|
||||
pplx::task<void> addPet(std::shared_ptr<Pet> body);
|
||||
/// <summary>
|
||||
/// Deletes a pet
|
||||
@@ -60,7 +61,7 @@ public:
|
||||
/// <remarks>
|
||||
/// Multiple status values can be provided with comma separated strings
|
||||
/// </remarks>
|
||||
/// <param name="status">Status values that need to be considered for filter (optional, default to available)</param>
|
||||
/// <param name="status">Status values that need to be considered for filter</param>
|
||||
pplx::task<std::vector<std::shared_ptr<Pet>>> findPetsByStatus(std::vector<utility::string_t> status);
|
||||
/// <summary>
|
||||
/// Finds Pets by tags
|
||||
@@ -68,15 +69,15 @@ public:
|
||||
/// <remarks>
|
||||
/// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
/// </remarks>
|
||||
/// <param name="tags">Tags to filter by (optional)</param>
|
||||
/// <param name="tags">Tags to filter by</param>
|
||||
pplx::task<std::vector<std::shared_ptr<Pet>>> findPetsByTags(std::vector<utility::string_t> tags);
|
||||
/// <summary>
|
||||
/// Find pet by ID
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
/// Returns a single pet
|
||||
/// </remarks>
|
||||
/// <param name="petId">ID of pet that needs to be fetched</param>
|
||||
/// <param name="petId">ID of pet to return</param>
|
||||
pplx::task<std::shared_ptr<Pet>> getPetById(int64_t petId);
|
||||
/// <summary>
|
||||
/// Update an existing pet
|
||||
@@ -84,7 +85,7 @@ public:
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="body">Pet object that needs to be added to the store (optional)</param>
|
||||
/// <param name="body">Pet object that needs to be added to the store</param>
|
||||
pplx::task<void> updatePet(std::shared_ptr<Pet> body);
|
||||
/// <summary>
|
||||
/// Updates a pet in the store with form data
|
||||
@@ -93,7 +94,7 @@ public:
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="petId">ID of pet that needs to be updated</param>/// <param name="name">Updated name of the pet (optional)</param>/// <param name="status">Updated status of the pet (optional)</param>
|
||||
pplx::task<void> updatePetWithForm(utility::string_t petId, utility::string_t name, utility::string_t status);
|
||||
pplx::task<void> updatePetWithForm(int64_t petId, utility::string_t name, utility::string_t status);
|
||||
/// <summary>
|
||||
/// uploads an image
|
||||
/// </summary>
|
||||
@@ -101,12 +102,12 @@ public:
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="petId">ID of pet to update</param>/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>/// <param name="file">file to upload (optional)</param>
|
||||
pplx::task<void> uploadFile(int64_t petId, utility::string_t additionalMetadata, std::shared_ptr<HttpContent> file);
|
||||
|
||||
pplx::task<std::shared_ptr<ApiResponse>> uploadFile(int64_t petId, utility::string_t additionalMetadata, std::shared_ptr<HttpContent> file);
|
||||
|
||||
protected:
|
||||
std::shared_ptr<ApiClient> m_ApiClient;
|
||||
std::shared_ptr<ApiClient> m_ApiClient;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
@@ -39,22 +39,22 @@ StoreApi::~StoreApi()
|
||||
pplx::task<void> StoreApi::deleteOrder(utility::string_t orderId)
|
||||
{
|
||||
|
||||
|
||||
|
||||
std::shared_ptr<ApiConfiguration> apiConfiguration( m_ApiClient->getConfiguration() );
|
||||
utility::string_t path = U("/store/order/{orderId}");
|
||||
boost::replace_all(path, U("{") U("orderId") U("}"), ApiClient::parameterToString(orderId));
|
||||
|
||||
|
||||
std::map<utility::string_t, utility::string_t> queryParams;
|
||||
std::map<utility::string_t, utility::string_t> headerParams( apiConfiguration->getDefaultHeaders() );
|
||||
std::map<utility::string_t, utility::string_t> formParams;
|
||||
std::map<utility::string_t, std::shared_ptr<HttpContent>> fileParams;
|
||||
|
||||
std::unordered_set<utility::string_t> responseHttpContentTypes;
|
||||
responseHttpContentTypes.insert( U("application/xml") );
|
||||
responseHttpContentTypes.insert( U("application/json") );
|
||||
responseHttpContentTypes.insert( U("application/xml") );
|
||||
|
||||
|
||||
utility::string_t responseHttpContentType;
|
||||
|
||||
|
||||
// use JSON if possible
|
||||
if ( responseHttpContentTypes.size() == 0 )
|
||||
{
|
||||
@@ -65,7 +65,7 @@ responseHttpContentTypes.insert( U("application/xml") );
|
||||
{
|
||||
responseHttpContentType = U("application/json");
|
||||
}
|
||||
// multipart formdata
|
||||
// multipart formdata
|
||||
else if( responseHttpContentTypes.find(U("multipart/form-data")) != responseHttpContentTypes.end() )
|
||||
{
|
||||
responseHttpContentType = U("multipart/form-data");
|
||||
@@ -73,48 +73,41 @@ responseHttpContentTypes.insert( U("application/xml") );
|
||||
else
|
||||
{
|
||||
throw ApiException(400, U("StoreApi->deleteOrder does not produce any supported media type"));
|
||||
}
|
||||
|
||||
headerParams[U("Accept")] = responseHttpContentType;
|
||||
|
||||
std::unordered_set<utility::string_t> consumeHttpContentTypes;
|
||||
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
headerParams[U("Accept")] = responseHttpContentType;
|
||||
|
||||
std::unordered_set<utility::string_t> consumeHttpContentTypes;
|
||||
|
||||
|
||||
std::shared_ptr<IHttpBody> httpBody;
|
||||
utility::string_t requestHttpContentType;
|
||||
|
||||
|
||||
// use JSON if possible
|
||||
if ( consumeHttpContentTypes.size() == 0 || consumeHttpContentTypes.find(U("application/json")) != consumeHttpContentTypes.end() )
|
||||
{
|
||||
requestHttpContentType = U("application/json");
|
||||
|
||||
}
|
||||
// multipart formdata
|
||||
// multipart formdata
|
||||
else if( consumeHttpContentTypes.find(U("multipart/form-data")) != consumeHttpContentTypes.end() )
|
||||
{
|
||||
requestHttpContentType = U("multipart/form-data");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
throw ApiException(415, U("StoreApi->deleteOrder does not consume any supported media type"));
|
||||
}
|
||||
|
||||
//Set the request content type in the header.
|
||||
headerParams[U("Content-Type")] = requestHttpContentType;
|
||||
|
||||
|
||||
|
||||
//Set the request content type in the header.
|
||||
headerParams[U("Content-Type")] = requestHttpContentType;
|
||||
|
||||
|
||||
return m_ApiClient->callApi(path, U("DELETE"), queryParams, httpBody, headerParams, formParams, fileParams, requestHttpContentType)
|
||||
.then([=](web::http::http_response response)
|
||||
{
|
||||
// 1xx - informational : OK
|
||||
// 2xx - successful : OK
|
||||
// 3xx - redirection : OK
|
||||
// 3xx - redirection : OK
|
||||
// 4xx - client error : not OK
|
||||
// 5xx - client error : not OK
|
||||
if (response.status_code() >= 400)
|
||||
@@ -123,7 +116,7 @@ responseHttpContentTypes.insert( U("application/xml") );
|
||||
, U("error calling deleteOrder: ") + response.reason_phrase()
|
||||
, std::make_shared<std::stringstream>(response.extract_utf8string(true).get()));
|
||||
}
|
||||
|
||||
|
||||
// check response content type
|
||||
if(response.headers().has(U("Content-Type")))
|
||||
{
|
||||
@@ -135,21 +128,21 @@ responseHttpContentTypes.insert( U("application/xml") );
|
||||
, std::make_shared<std::stringstream>(response.extract_utf8string(true).get()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return response.extract_string();
|
||||
})
|
||||
.then([=](utility::string_t response)
|
||||
{
|
||||
return void();
|
||||
});
|
||||
});
|
||||
}
|
||||
pplx::task<std::map<utility::string_t, int32_t>> StoreApi::getInventory()
|
||||
{
|
||||
|
||||
|
||||
|
||||
std::shared_ptr<ApiConfiguration> apiConfiguration( m_ApiClient->getConfiguration() );
|
||||
utility::string_t path = U("/store/inventory");
|
||||
|
||||
|
||||
std::map<utility::string_t, utility::string_t> queryParams;
|
||||
std::map<utility::string_t, utility::string_t> headerParams( apiConfiguration->getDefaultHeaders() );
|
||||
std::map<utility::string_t, utility::string_t> formParams;
|
||||
@@ -157,10 +150,9 @@ pplx::task<std::map<utility::string_t, int32_t>> StoreApi::getInventory()
|
||||
|
||||
std::unordered_set<utility::string_t> responseHttpContentTypes;
|
||||
responseHttpContentTypes.insert( U("application/json") );
|
||||
responseHttpContentTypes.insert( U("application/xml") );
|
||||
|
||||
|
||||
utility::string_t responseHttpContentType;
|
||||
|
||||
|
||||
// use JSON if possible
|
||||
if ( responseHttpContentTypes.size() == 0 )
|
||||
{
|
||||
@@ -171,7 +163,7 @@ responseHttpContentTypes.insert( U("application/xml") );
|
||||
{
|
||||
responseHttpContentType = U("application/json");
|
||||
}
|
||||
// multipart formdata
|
||||
// multipart formdata
|
||||
else if( responseHttpContentTypes.find(U("multipart/form-data")) != responseHttpContentTypes.end() )
|
||||
{
|
||||
responseHttpContentType = U("multipart/form-data");
|
||||
@@ -179,37 +171,34 @@ responseHttpContentTypes.insert( U("application/xml") );
|
||||
else
|
||||
{
|
||||
throw ApiException(400, U("StoreApi->getInventory does not produce any supported media type"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
headerParams[U("Accept")] = responseHttpContentType;
|
||||
|
||||
|
||||
std::unordered_set<utility::string_t> consumeHttpContentTypes;
|
||||
|
||||
|
||||
|
||||
|
||||
std::shared_ptr<IHttpBody> httpBody;
|
||||
utility::string_t requestHttpContentType;
|
||||
|
||||
|
||||
// use JSON if possible
|
||||
if ( consumeHttpContentTypes.size() == 0 || consumeHttpContentTypes.find(U("application/json")) != consumeHttpContentTypes.end() )
|
||||
{
|
||||
requestHttpContentType = U("application/json");
|
||||
|
||||
}
|
||||
// multipart formdata
|
||||
// multipart formdata
|
||||
else if( consumeHttpContentTypes.find(U("multipart/form-data")) != consumeHttpContentTypes.end() )
|
||||
{
|
||||
requestHttpContentType = U("multipart/form-data");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
throw ApiException(415, U("StoreApi->getInventory does not consume any supported media type"));
|
||||
}
|
||||
|
||||
//Set the request content type in the header.
|
||||
headerParams[U("Content-Type")] = requestHttpContentType;
|
||||
|
||||
|
||||
//Set the request content type in the header.
|
||||
headerParams[U("Content-Type")] = requestHttpContentType;
|
||||
|
||||
// authentication (api_key) required
|
||||
{
|
||||
utility::string_t apiKey = apiConfiguration->getApiKey(U("api_key"));
|
||||
@@ -218,13 +207,13 @@ responseHttpContentTypes.insert( U("application/xml") );
|
||||
headerParams[U("api_key")] = apiKey;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return m_ApiClient->callApi(path, U("GET"), queryParams, httpBody, headerParams, formParams, fileParams, requestHttpContentType)
|
||||
.then([=](web::http::http_response response)
|
||||
{
|
||||
// 1xx - informational : OK
|
||||
// 2xx - successful : OK
|
||||
// 3xx - redirection : OK
|
||||
// 3xx - redirection : OK
|
||||
// 4xx - client error : not OK
|
||||
// 5xx - client error : not OK
|
||||
if (response.status_code() >= 400)
|
||||
@@ -233,7 +222,7 @@ responseHttpContentTypes.insert( U("application/xml") );
|
||||
, U("error calling getInventory: ") + response.reason_phrase()
|
||||
, std::make_shared<std::stringstream>(response.extract_utf8string(true).get()));
|
||||
}
|
||||
|
||||
|
||||
// check response content type
|
||||
if(response.headers().has(U("Content-Type")))
|
||||
{
|
||||
@@ -245,57 +234,56 @@ responseHttpContentTypes.insert( U("application/xml") );
|
||||
, std::make_shared<std::stringstream>(response.extract_utf8string(true).get()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return response.extract_string();
|
||||
})
|
||||
.then([=](utility::string_t response)
|
||||
{
|
||||
std::map<utility::string_t, int32_t> result;
|
||||
|
||||
|
||||
|
||||
if(responseHttpContentType == U("application/json"))
|
||||
{
|
||||
web::json::value json = web::json::value::parse(response);
|
||||
|
||||
|
||||
for( auto& item : json.as_object() )
|
||||
{
|
||||
result[item.first] = ModelBase::int32_tFromJson(item.second);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// else if(responseHttpContentType == U("multipart/form-data"))
|
||||
// {
|
||||
// TODO multipart response parsing
|
||||
// TODO multipart response parsing
|
||||
// }
|
||||
else
|
||||
else
|
||||
{
|
||||
throw ApiException(500
|
||||
, U("error calling findPetsByStatus: unsupported response type"));
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
});
|
||||
});
|
||||
}
|
||||
pplx::task<std::shared_ptr<Order>> StoreApi::getOrderById(utility::string_t orderId)
|
||||
pplx::task<std::shared_ptr<Order>> StoreApi::getOrderById(int64_t orderId)
|
||||
{
|
||||
|
||||
|
||||
|
||||
std::shared_ptr<ApiConfiguration> apiConfiguration( m_ApiClient->getConfiguration() );
|
||||
utility::string_t path = U("/store/order/{orderId}");
|
||||
boost::replace_all(path, U("{") U("orderId") U("}"), ApiClient::parameterToString(orderId));
|
||||
|
||||
|
||||
std::map<utility::string_t, utility::string_t> queryParams;
|
||||
std::map<utility::string_t, utility::string_t> headerParams( apiConfiguration->getDefaultHeaders() );
|
||||
std::map<utility::string_t, utility::string_t> formParams;
|
||||
std::map<utility::string_t, std::shared_ptr<HttpContent>> fileParams;
|
||||
|
||||
std::unordered_set<utility::string_t> responseHttpContentTypes;
|
||||
responseHttpContentTypes.insert( U("application/xml") );
|
||||
responseHttpContentTypes.insert( U("application/json") );
|
||||
responseHttpContentTypes.insert( U("application/xml") );
|
||||
|
||||
|
||||
utility::string_t responseHttpContentType;
|
||||
|
||||
|
||||
// use JSON if possible
|
||||
if ( responseHttpContentTypes.size() == 0 )
|
||||
{
|
||||
@@ -306,7 +294,7 @@ responseHttpContentTypes.insert( U("application/xml") );
|
||||
{
|
||||
responseHttpContentType = U("application/json");
|
||||
}
|
||||
// multipart formdata
|
||||
// multipart formdata
|
||||
else if( responseHttpContentTypes.find(U("multipart/form-data")) != responseHttpContentTypes.end() )
|
||||
{
|
||||
responseHttpContentType = U("multipart/form-data");
|
||||
@@ -314,48 +302,41 @@ responseHttpContentTypes.insert( U("application/xml") );
|
||||
else
|
||||
{
|
||||
throw ApiException(400, U("StoreApi->getOrderById does not produce any supported media type"));
|
||||
}
|
||||
|
||||
headerParams[U("Accept")] = responseHttpContentType;
|
||||
|
||||
std::unordered_set<utility::string_t> consumeHttpContentTypes;
|
||||
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
headerParams[U("Accept")] = responseHttpContentType;
|
||||
|
||||
std::unordered_set<utility::string_t> consumeHttpContentTypes;
|
||||
|
||||
|
||||
std::shared_ptr<IHttpBody> httpBody;
|
||||
utility::string_t requestHttpContentType;
|
||||
|
||||
|
||||
// use JSON if possible
|
||||
if ( consumeHttpContentTypes.size() == 0 || consumeHttpContentTypes.find(U("application/json")) != consumeHttpContentTypes.end() )
|
||||
{
|
||||
requestHttpContentType = U("application/json");
|
||||
|
||||
}
|
||||
// multipart formdata
|
||||
// multipart formdata
|
||||
else if( consumeHttpContentTypes.find(U("multipart/form-data")) != consumeHttpContentTypes.end() )
|
||||
{
|
||||
requestHttpContentType = U("multipart/form-data");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
throw ApiException(415, U("StoreApi->getOrderById does not consume any supported media type"));
|
||||
}
|
||||
|
||||
//Set the request content type in the header.
|
||||
headerParams[U("Content-Type")] = requestHttpContentType;
|
||||
|
||||
|
||||
|
||||
//Set the request content type in the header.
|
||||
headerParams[U("Content-Type")] = requestHttpContentType;
|
||||
|
||||
|
||||
return m_ApiClient->callApi(path, U("GET"), queryParams, httpBody, headerParams, formParams, fileParams, requestHttpContentType)
|
||||
.then([=](web::http::http_response response)
|
||||
{
|
||||
// 1xx - informational : OK
|
||||
// 2xx - successful : OK
|
||||
// 3xx - redirection : OK
|
||||
// 3xx - redirection : OK
|
||||
// 4xx - client error : not OK
|
||||
// 5xx - client error : not OK
|
||||
if (response.status_code() >= 400)
|
||||
@@ -364,7 +345,7 @@ responseHttpContentTypes.insert( U("application/xml") );
|
||||
, U("error calling getOrderById: ") + response.reason_phrase()
|
||||
, std::make_shared<std::stringstream>(response.extract_utf8string(true).get()));
|
||||
}
|
||||
|
||||
|
||||
// check response content type
|
||||
if(response.headers().has(U("Content-Type")))
|
||||
{
|
||||
@@ -376,50 +357,56 @@ responseHttpContentTypes.insert( U("application/xml") );
|
||||
, std::make_shared<std::stringstream>(response.extract_utf8string(true).get()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return response.extract_string();
|
||||
})
|
||||
.then([=](utility::string_t response)
|
||||
{
|
||||
std::shared_ptr<Order> result(new Order());
|
||||
|
||||
|
||||
if(responseHttpContentType == U("application/json"))
|
||||
{
|
||||
web::json::value json = web::json::value::parse(response);
|
||||
|
||||
|
||||
result->fromJson(json);
|
||||
}
|
||||
// else if(responseHttpContentType == U("multipart/form-data"))
|
||||
// {
|
||||
// TODO multipart response parsing
|
||||
// TODO multipart response parsing
|
||||
// }
|
||||
else
|
||||
else
|
||||
{
|
||||
throw ApiException(500
|
||||
, U("error calling findPetsByStatus: unsupported response type"));
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
});
|
||||
});
|
||||
}
|
||||
pplx::task<std::shared_ptr<Order>> StoreApi::placeOrder(std::shared_ptr<Order> body)
|
||||
{
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == nullptr)
|
||||
{
|
||||
throw ApiException(400, U("Missing required parameter 'body' when calling StoreApi->placeOrder"));
|
||||
}
|
||||
|
||||
|
||||
std::shared_ptr<ApiConfiguration> apiConfiguration( m_ApiClient->getConfiguration() );
|
||||
utility::string_t path = U("/store/order");
|
||||
|
||||
|
||||
std::map<utility::string_t, utility::string_t> queryParams;
|
||||
std::map<utility::string_t, utility::string_t> headerParams( apiConfiguration->getDefaultHeaders() );
|
||||
std::map<utility::string_t, utility::string_t> formParams;
|
||||
std::map<utility::string_t, std::shared_ptr<HttpContent>> fileParams;
|
||||
|
||||
std::unordered_set<utility::string_t> responseHttpContentTypes;
|
||||
responseHttpContentTypes.insert( U("application/xml") );
|
||||
responseHttpContentTypes.insert( U("application/json") );
|
||||
responseHttpContentTypes.insert( U("application/xml") );
|
||||
|
||||
|
||||
utility::string_t responseHttpContentType;
|
||||
|
||||
|
||||
// use JSON if possible
|
||||
if ( responseHttpContentTypes.size() == 0 )
|
||||
{
|
||||
@@ -430,7 +417,7 @@ responseHttpContentTypes.insert( U("application/xml") );
|
||||
{
|
||||
responseHttpContentType = U("application/json");
|
||||
}
|
||||
// multipart formdata
|
||||
// multipart formdata
|
||||
else if( responseHttpContentTypes.find(U("multipart/form-data")) != responseHttpContentTypes.end() )
|
||||
{
|
||||
responseHttpContentType = U("multipart/form-data");
|
||||
@@ -438,42 +425,35 @@ responseHttpContentTypes.insert( U("application/xml") );
|
||||
else
|
||||
{
|
||||
throw ApiException(400, U("StoreApi->placeOrder does not produce any supported media type"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
headerParams[U("Accept")] = responseHttpContentType;
|
||||
|
||||
|
||||
std::unordered_set<utility::string_t> consumeHttpContentTypes;
|
||||
|
||||
|
||||
|
||||
|
||||
std::shared_ptr<IHttpBody> httpBody;
|
||||
utility::string_t requestHttpContentType;
|
||||
|
||||
|
||||
// use JSON if possible
|
||||
if ( consumeHttpContentTypes.size() == 0 || consumeHttpContentTypes.find(U("application/json")) != consumeHttpContentTypes.end() )
|
||||
{
|
||||
requestHttpContentType = U("application/json");
|
||||
|
||||
web::json::value json;
|
||||
|
||||
|
||||
json = ModelBase::toJson(body);
|
||||
|
||||
|
||||
|
||||
httpBody = std::shared_ptr<IHttpBody>( new JsonBody( json ) );
|
||||
|
||||
}
|
||||
// multipart formdata
|
||||
// multipart formdata
|
||||
else if( consumeHttpContentTypes.find(U("multipart/form-data")) != consumeHttpContentTypes.end() )
|
||||
{
|
||||
requestHttpContentType = U("multipart/form-data");
|
||||
|
||||
std::shared_ptr<MultipartFormData> multipart(new MultipartFormData);
|
||||
|
||||
if(body.get())
|
||||
if(body.get())
|
||||
{
|
||||
body->toMultipart(multipart, U("body"));
|
||||
}
|
||||
|
||||
|
||||
httpBody = multipart;
|
||||
requestHttpContentType += U("; boundary=") + multipart->getBoundary();
|
||||
@@ -482,17 +462,17 @@ responseHttpContentTypes.insert( U("application/xml") );
|
||||
{
|
||||
throw ApiException(415, U("StoreApi->placeOrder does not consume any supported media type"));
|
||||
}
|
||||
|
||||
//Set the request content type in the header.
|
||||
headerParams[U("Content-Type")] = requestHttpContentType;
|
||||
|
||||
|
||||
|
||||
//Set the request content type in the header.
|
||||
headerParams[U("Content-Type")] = requestHttpContentType;
|
||||
|
||||
|
||||
return m_ApiClient->callApi(path, U("POST"), queryParams, httpBody, headerParams, formParams, fileParams, requestHttpContentType)
|
||||
.then([=](web::http::http_response response)
|
||||
{
|
||||
// 1xx - informational : OK
|
||||
// 2xx - successful : OK
|
||||
// 3xx - redirection : OK
|
||||
// 3xx - redirection : OK
|
||||
// 4xx - client error : not OK
|
||||
// 5xx - client error : not OK
|
||||
if (response.status_code() >= 400)
|
||||
@@ -501,7 +481,7 @@ responseHttpContentTypes.insert( U("application/xml") );
|
||||
, U("error calling placeOrder: ") + response.reason_phrase()
|
||||
, std::make_shared<std::stringstream>(response.extract_utf8string(true).get()));
|
||||
}
|
||||
|
||||
|
||||
// check response content type
|
||||
if(response.headers().has(U("Content-Type")))
|
||||
{
|
||||
@@ -513,31 +493,31 @@ responseHttpContentTypes.insert( U("application/xml") );
|
||||
, std::make_shared<std::stringstream>(response.extract_utf8string(true).get()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return response.extract_string();
|
||||
})
|
||||
.then([=](utility::string_t response)
|
||||
{
|
||||
std::shared_ptr<Order> result(new Order());
|
||||
|
||||
|
||||
if(responseHttpContentType == U("application/json"))
|
||||
{
|
||||
web::json::value json = web::json::value::parse(response);
|
||||
|
||||
|
||||
result->fromJson(json);
|
||||
}
|
||||
// else if(responseHttpContentType == U("multipart/form-data"))
|
||||
// {
|
||||
// TODO multipart response parsing
|
||||
// TODO multipart response parsing
|
||||
// }
|
||||
else
|
||||
else
|
||||
{
|
||||
throw ApiException(500
|
||||
, U("error calling findPetsByStatus: unsupported response type"));
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
@@ -12,10 +12,10 @@
|
||||
|
||||
/*
|
||||
* StoreApi.h
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef StoreApi_H_
|
||||
#define StoreApi_H_
|
||||
|
||||
@@ -61,20 +61,20 @@ public:
|
||||
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
/// </remarks>
|
||||
/// <param name="orderId">ID of pet that needs to be fetched</param>
|
||||
pplx::task<std::shared_ptr<Order>> getOrderById(utility::string_t orderId);
|
||||
pplx::task<std::shared_ptr<Order>> getOrderById(int64_t orderId);
|
||||
/// <summary>
|
||||
/// Place an order for a pet
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="body">order placed for purchasing the pet (optional)</param>
|
||||
/// <param name="body">order placed for purchasing the pet</param>
|
||||
pplx::task<std::shared_ptr<Order>> placeOrder(std::shared_ptr<Order> body);
|
||||
|
||||
|
||||
protected:
|
||||
std::shared_ptr<ApiClient> m_ApiClient;
|
||||
std::shared_ptr<ApiClient> m_ApiClient;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
@@ -12,10 +12,10 @@
|
||||
|
||||
/*
|
||||
* UserApi.h
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef UserApi_H_
|
||||
#define UserApi_H_
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
/// <remarks>
|
||||
/// This can only be done by the logged in user.
|
||||
/// </remarks>
|
||||
/// <param name="body">Created user object (optional)</param>
|
||||
/// <param name="body">Created user object</param>
|
||||
pplx::task<void> createUser(std::shared_ptr<User> body);
|
||||
/// <summary>
|
||||
/// Creates list of users with given input array
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="body">List of user object (optional)</param>
|
||||
/// <param name="body">List of user object</param>
|
||||
pplx::task<void> createUsersWithArrayInput(std::vector<std::shared_ptr<User>> body);
|
||||
/// <summary>
|
||||
/// Creates list of users with given input array
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="body">List of user object (optional)</param>
|
||||
/// <param name="body">List of user object</param>
|
||||
pplx::task<void> createUsersWithListInput(std::vector<std::shared_ptr<User>> body);
|
||||
/// <summary>
|
||||
/// Delete user
|
||||
@@ -84,7 +84,7 @@ public:
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="username">The user name for login (optional)</param>/// <param name="password">The password for login in clear text (optional)</param>
|
||||
/// <param name="username">The user name for login</param>/// <param name="password">The password for login in clear text</param>
|
||||
pplx::task<utility::string_t> loginUser(utility::string_t username, utility::string_t password);
|
||||
/// <summary>
|
||||
/// Logs out current logged in user session
|
||||
@@ -100,13 +100,13 @@ public:
|
||||
/// <remarks>
|
||||
/// This can only be done by the logged in user.
|
||||
/// </remarks>
|
||||
/// <param name="username">name that need to be deleted</param>/// <param name="body">Updated user object (optional)</param>
|
||||
/// <param name="username">name that need to be deleted</param>/// <param name="body">Updated user object</param>
|
||||
pplx::task<void> updateUser(utility::string_t username, std::shared_ptr<User> body);
|
||||
|
||||
|
||||
protected:
|
||||
std::shared_ptr<ApiClient> m_ApiClient;
|
||||
std::shared_ptr<ApiClient> m_ApiClient;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ git init
|
||||
# Adds the files in the local repository and stages them for commit.
|
||||
git add .
|
||||
|
||||
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||
git commit -m "$release_note"
|
||||
|
||||
# Sets the new remote
|
||||
|
||||
@@ -34,7 +34,7 @@ ApiResponse::~ApiResponse()
|
||||
{
|
||||
}
|
||||
|
||||
void ApiResponse::validate()
|
||||
void ApiResponse::validate()
|
||||
{
|
||||
// TODO: implement validation
|
||||
}
|
||||
@@ -42,7 +42,7 @@ void ApiResponse::validate()
|
||||
web::json::value ApiResponse::toJson() const
|
||||
{
|
||||
web::json::value val = web::json::value::object();
|
||||
|
||||
|
||||
if(m_CodeIsSet)
|
||||
{
|
||||
val[U("code")] = ModelBase::toJson(m_Code);
|
||||
@@ -69,12 +69,12 @@ void ApiResponse::fromJson(web::json::value& val)
|
||||
if(val.has_field(U("type")))
|
||||
{
|
||||
setType(ModelBase::stringFromJson(val[U("type")]));
|
||||
|
||||
|
||||
}
|
||||
if(val.has_field(U("message")))
|
||||
{
|
||||
setMessage(ModelBase::stringFromJson(val[U("message")]));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -94,12 +94,12 @@ void ApiResponse::toMultipart(std::shared_ptr<MultipartFormData> multipart, cons
|
||||
if(m_TypeIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + U("type"), m_Type));
|
||||
|
||||
|
||||
}
|
||||
if(m_MessageIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + U("message"), m_Message));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -119,17 +119,17 @@ void ApiResponse::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, co
|
||||
if(multipart->hasContent(U("type")))
|
||||
{
|
||||
setType(ModelBase::stringFromHttpContent(multipart->getContent(U("type"))));
|
||||
|
||||
|
||||
}
|
||||
if(multipart->hasContent(U("message")))
|
||||
{
|
||||
setMessage(ModelBase::stringFromHttpContent(multipart->getContent(U("message"))));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int32_t ApiResponse::getCode() const
|
||||
{
|
||||
return m_Code;
|
||||
@@ -143,7 +143,7 @@ bool ApiResponse::codeIsSet() const
|
||||
{
|
||||
return m_CodeIsSet;
|
||||
}
|
||||
void ApiResponse::unsetCode()
|
||||
void ApiResponse::unsetCode()
|
||||
{
|
||||
m_CodeIsSet = false;
|
||||
}
|
||||
@@ -160,7 +160,7 @@ bool ApiResponse::typeIsSet() const
|
||||
{
|
||||
return m_TypeIsSet;
|
||||
}
|
||||
void ApiResponse::unsetType()
|
||||
void ApiResponse::unsetType()
|
||||
{
|
||||
m_TypeIsSet = false;
|
||||
}
|
||||
@@ -177,7 +177,7 @@ bool ApiResponse::messageIsSet() const
|
||||
{
|
||||
return m_MessageIsSet;
|
||||
}
|
||||
void ApiResponse::unsetMessage()
|
||||
void ApiResponse::unsetMessage()
|
||||
{
|
||||
m_MessageIsSet = false;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
/*
|
||||
* ApiResponse.h
|
||||
*
|
||||
*
|
||||
* Describes the result of uploading an image resource
|
||||
*/
|
||||
|
||||
@@ -33,15 +33,15 @@ namespace model {
|
||||
/// Describes the result of uploading an image resource
|
||||
/// </summary>
|
||||
class ApiResponse
|
||||
: public ModelBase
|
||||
: public ModelBase
|
||||
{
|
||||
public:
|
||||
ApiResponse();
|
||||
virtual ~ApiResponse();
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// ModelBase overrides
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// ModelBase overrides
|
||||
|
||||
void validate() override;
|
||||
|
||||
web::json::value toJson() const override;
|
||||
@@ -49,10 +49,10 @@ public:
|
||||
|
||||
void toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix) const override;
|
||||
void fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix) override;
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// ApiResponse members
|
||||
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// ApiResponse members
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
void setMessage(utility::string_t value);
|
||||
bool messageIsSet() const;
|
||||
void unsetMessage();
|
||||
|
||||
|
||||
protected:
|
||||
int32_t m_Code;
|
||||
bool m_CodeIsSet;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
@@ -32,7 +32,7 @@ Category::~Category()
|
||||
{
|
||||
}
|
||||
|
||||
void Category::validate()
|
||||
void Category::validate()
|
||||
{
|
||||
// TODO: implement validation
|
||||
}
|
||||
@@ -40,7 +40,7 @@ void Category::validate()
|
||||
web::json::value Category::toJson() const
|
||||
{
|
||||
web::json::value val = web::json::value::object();
|
||||
|
||||
|
||||
if(m_IdIsSet)
|
||||
{
|
||||
val[U("id")] = ModelBase::toJson(m_Id);
|
||||
@@ -63,7 +63,7 @@ void Category::fromJson(web::json::value& val)
|
||||
if(val.has_field(U("name")))
|
||||
{
|
||||
setName(ModelBase::stringFromJson(val[U("name")]));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -83,7 +83,7 @@ void Category::toMultipart(std::shared_ptr<MultipartFormData> multipart, const u
|
||||
if(m_NameIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + U("name"), m_Name));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -103,12 +103,12 @@ void Category::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const
|
||||
if(multipart->hasContent(U("name")))
|
||||
{
|
||||
setName(ModelBase::stringFromHttpContent(multipart->getContent(U("name"))));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int64_t Category::getId() const
|
||||
{
|
||||
return m_Id;
|
||||
@@ -122,7 +122,7 @@ bool Category::idIsSet() const
|
||||
{
|
||||
return m_IdIsSet;
|
||||
}
|
||||
void Category::unsetId()
|
||||
void Category::unsetId()
|
||||
{
|
||||
m_IdIsSet = false;
|
||||
}
|
||||
@@ -139,7 +139,7 @@ bool Category::nameIsSet() const
|
||||
{
|
||||
return m_NameIsSet;
|
||||
}
|
||||
void Category::unsetName()
|
||||
void Category::unsetName()
|
||||
{
|
||||
m_NameIsSet = false;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
@@ -12,8 +12,8 @@
|
||||
|
||||
/*
|
||||
* Category.h
|
||||
*
|
||||
*
|
||||
*
|
||||
* A category for a pet
|
||||
*/
|
||||
|
||||
#ifndef Category_H_
|
||||
@@ -30,18 +30,18 @@ namespace client {
|
||||
namespace model {
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// A category for a pet
|
||||
/// </summary>
|
||||
class Category
|
||||
: public ModelBase
|
||||
: public ModelBase
|
||||
{
|
||||
public:
|
||||
Category();
|
||||
virtual ~Category();
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// ModelBase overrides
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// ModelBase overrides
|
||||
|
||||
void validate() override;
|
||||
|
||||
web::json::value toJson() const override;
|
||||
@@ -49,10 +49,10 @@ public:
|
||||
|
||||
void toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix) const override;
|
||||
void fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix) override;
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// Category members
|
||||
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// Category members
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
void setName(utility::string_t value);
|
||||
bool nameIsSet() const;
|
||||
void unsetName();
|
||||
|
||||
|
||||
protected:
|
||||
int64_t m_Id;
|
||||
bool m_IdIsSet;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
@@ -40,7 +40,7 @@ Order::~Order()
|
||||
{
|
||||
}
|
||||
|
||||
void Order::validate()
|
||||
void Order::validate()
|
||||
{
|
||||
// TODO: implement validation
|
||||
}
|
||||
@@ -48,7 +48,7 @@ void Order::validate()
|
||||
web::json::value Order::toJson() const
|
||||
{
|
||||
web::json::value val = web::json::value::object();
|
||||
|
||||
|
||||
if(m_IdIsSet)
|
||||
{
|
||||
val[U("id")] = ModelBase::toJson(m_Id);
|
||||
@@ -95,12 +95,12 @@ void Order::fromJson(web::json::value& val)
|
||||
if(val.has_field(U("shipDate")))
|
||||
{
|
||||
setShipDate(ModelBase::dateFromJson(val[U("shipDate")]));
|
||||
|
||||
|
||||
}
|
||||
if(val.has_field(U("status")))
|
||||
{
|
||||
setStatus(ModelBase::stringFromJson(val[U("status")]));
|
||||
|
||||
|
||||
}
|
||||
if(val.has_field(U("complete")))
|
||||
{
|
||||
@@ -132,12 +132,12 @@ void Order::toMultipart(std::shared_ptr<MultipartFormData> multipart, const util
|
||||
if(m_ShipDateIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + U("shipDate"), m_ShipDate));
|
||||
|
||||
|
||||
}
|
||||
if(m_StatusIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + U("status"), m_Status));
|
||||
|
||||
|
||||
}
|
||||
if(m_CompleteIsSet)
|
||||
{
|
||||
@@ -169,12 +169,12 @@ void Order::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const ut
|
||||
if(multipart->hasContent(U("shipDate")))
|
||||
{
|
||||
setShipDate(ModelBase::dateFromHttpContent(multipart->getContent(U("shipDate"))));
|
||||
|
||||
|
||||
}
|
||||
if(multipart->hasContent(U("status")))
|
||||
{
|
||||
setStatus(ModelBase::stringFromHttpContent(multipart->getContent(U("status"))));
|
||||
|
||||
|
||||
}
|
||||
if(multipart->hasContent(U("complete")))
|
||||
{
|
||||
@@ -182,8 +182,8 @@ void Order::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const ut
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int64_t Order::getId() const
|
||||
{
|
||||
return m_Id;
|
||||
@@ -197,7 +197,7 @@ bool Order::idIsSet() const
|
||||
{
|
||||
return m_IdIsSet;
|
||||
}
|
||||
void Order::unsetId()
|
||||
void Order::unsetId()
|
||||
{
|
||||
m_IdIsSet = false;
|
||||
}
|
||||
@@ -214,7 +214,7 @@ bool Order::petIdIsSet() const
|
||||
{
|
||||
return m_PetIdIsSet;
|
||||
}
|
||||
void Order::unsetPetId()
|
||||
void Order::unsetPetId()
|
||||
{
|
||||
m_PetIdIsSet = false;
|
||||
}
|
||||
@@ -231,7 +231,7 @@ bool Order::quantityIsSet() const
|
||||
{
|
||||
return m_QuantityIsSet;
|
||||
}
|
||||
void Order::unsetQuantity()
|
||||
void Order::unsetQuantity()
|
||||
{
|
||||
m_QuantityIsSet = false;
|
||||
}
|
||||
@@ -248,7 +248,7 @@ bool Order::shipDateIsSet() const
|
||||
{
|
||||
return m_ShipDateIsSet;
|
||||
}
|
||||
void Order::unsetShipDate()
|
||||
void Order::unsetShipDate()
|
||||
{
|
||||
m_ShipDateIsSet = false;
|
||||
}
|
||||
@@ -265,7 +265,7 @@ bool Order::statusIsSet() const
|
||||
{
|
||||
return m_StatusIsSet;
|
||||
}
|
||||
void Order::unsetStatus()
|
||||
void Order::unsetStatus()
|
||||
{
|
||||
m_StatusIsSet = false;
|
||||
}
|
||||
@@ -282,7 +282,7 @@ bool Order::completeIsSet() const
|
||||
{
|
||||
return m_CompleteIsSet;
|
||||
}
|
||||
void Order::unsetComplete()
|
||||
void Order::unsetComplete()
|
||||
{
|
||||
m_CompleteIsSet = false;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
@@ -12,8 +12,8 @@
|
||||
|
||||
/*
|
||||
* Order.h
|
||||
*
|
||||
*
|
||||
*
|
||||
* An order for a pets from the pet store
|
||||
*/
|
||||
|
||||
#ifndef Order_H_
|
||||
@@ -30,18 +30,18 @@ namespace client {
|
||||
namespace model {
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// An order for a pets from the pet store
|
||||
/// </summary>
|
||||
class Order
|
||||
: public ModelBase
|
||||
: public ModelBase
|
||||
{
|
||||
public:
|
||||
Order();
|
||||
virtual ~Order();
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// ModelBase overrides
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// ModelBase overrides
|
||||
|
||||
void validate() override;
|
||||
|
||||
web::json::value toJson() const override;
|
||||
@@ -49,10 +49,10 @@ public:
|
||||
|
||||
void toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix) const override;
|
||||
void fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix) override;
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// Order members
|
||||
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// Order members
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
void setComplete(bool value);
|
||||
bool completeIsSet() const;
|
||||
void unsetComplete();
|
||||
|
||||
|
||||
protected:
|
||||
int64_t m_Id;
|
||||
bool m_IdIsSet;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
@@ -35,7 +35,7 @@ Pet::~Pet()
|
||||
{
|
||||
}
|
||||
|
||||
void Pet::validate()
|
||||
void Pet::validate()
|
||||
{
|
||||
// TODO: implement validation
|
||||
}
|
||||
@@ -43,7 +43,7 @@ void Pet::validate()
|
||||
web::json::value Pet::toJson() const
|
||||
{
|
||||
web::json::value val = web::json::value::object();
|
||||
|
||||
|
||||
if(m_IdIsSet)
|
||||
{
|
||||
val[U("id")] = ModelBase::toJson(m_Id);
|
||||
@@ -68,7 +68,7 @@ web::json::value Pet::toJson() const
|
||||
jsonArray.push_back(ModelBase::toJson(item));
|
||||
}
|
||||
|
||||
if(jsonArray.size() > 0)
|
||||
if(jsonArray.size() > 0)
|
||||
{
|
||||
val[U("tags")] = web::json::value::array(jsonArray);
|
||||
}
|
||||
@@ -90,13 +90,13 @@ void Pet::fromJson(web::json::value& val)
|
||||
}
|
||||
if(val.has_field(U("category")))
|
||||
{
|
||||
if(!val[U("category")].is_null())
|
||||
if(!val[U("category")].is_null())
|
||||
{
|
||||
std::shared_ptr<Category> newItem(new Category());
|
||||
newItem->fromJson(val[U("category")]);
|
||||
setCategory( newItem );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
setName(ModelBase::stringFromJson(val[U("name")]));
|
||||
{
|
||||
@@ -116,7 +116,7 @@ void Pet::fromJson(web::json::value& val)
|
||||
for( auto& item : val[U("tags")].as_array() )
|
||||
{
|
||||
|
||||
if(item.is_null())
|
||||
if(item.is_null())
|
||||
{
|
||||
m_Tags.push_back( std::shared_ptr<Tag>(nullptr) );
|
||||
}
|
||||
@@ -133,7 +133,7 @@ void Pet::fromJson(web::json::value& val)
|
||||
if(val.has_field(U("status")))
|
||||
{
|
||||
setStatus(ModelBase::stringFromJson(val[U("status")]));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -156,7 +156,7 @@ void Pet::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utilit
|
||||
{
|
||||
m_Category->toMultipart(multipart, U("category."));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + U("name"), m_Name));
|
||||
{
|
||||
@@ -174,7 +174,7 @@ void Pet::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utilit
|
||||
jsonArray.push_back(ModelBase::toJson(item));
|
||||
}
|
||||
|
||||
if(jsonArray.size() > 0)
|
||||
if(jsonArray.size() > 0)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + U("tags"), web::json::value::array(jsonArray), U("application/json")));
|
||||
}
|
||||
@@ -182,7 +182,7 @@ void Pet::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utilit
|
||||
if(m_StatusIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + U("status"), m_Status));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -207,12 +207,12 @@ void Pet::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const util
|
||||
newItem->fromMultiPart(multipart, U("category."));
|
||||
setCategory( newItem );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
setName(ModelBase::stringFromHttpContent(multipart->getContent(U("name"))));
|
||||
{
|
||||
m_PhotoUrls.clear();
|
||||
|
||||
|
||||
web::json::value jsonArray = web::json::value::parse(ModelBase::stringFromHttpContent(multipart->getContent(U("photoUrls"))));
|
||||
for( auto& item : jsonArray.as_array() )
|
||||
{
|
||||
@@ -223,13 +223,13 @@ void Pet::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const util
|
||||
{
|
||||
m_Tags.clear();
|
||||
if(multipart->hasContent(U("tags")))
|
||||
{
|
||||
|
||||
{
|
||||
|
||||
web::json::value jsonArray = web::json::value::parse(ModelBase::stringFromHttpContent(multipart->getContent(U("tags"))));
|
||||
for( auto& item : jsonArray.as_array() )
|
||||
{
|
||||
|
||||
if(item.is_null())
|
||||
if(item.is_null())
|
||||
{
|
||||
m_Tags.push_back( std::shared_ptr<Tag>(nullptr) );
|
||||
}
|
||||
@@ -246,12 +246,12 @@ void Pet::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const util
|
||||
if(multipart->hasContent(U("status")))
|
||||
{
|
||||
setStatus(ModelBase::stringFromHttpContent(multipart->getContent(U("status"))));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int64_t Pet::getId() const
|
||||
{
|
||||
return m_Id;
|
||||
@@ -265,7 +265,7 @@ bool Pet::idIsSet() const
|
||||
{
|
||||
return m_IdIsSet;
|
||||
}
|
||||
void Pet::unsetId()
|
||||
void Pet::unsetId()
|
||||
{
|
||||
m_IdIsSet = false;
|
||||
}
|
||||
@@ -282,7 +282,7 @@ bool Pet::categoryIsSet() const
|
||||
{
|
||||
return m_CategoryIsSet;
|
||||
}
|
||||
void Pet::unsetCategory()
|
||||
void Pet::unsetCategory()
|
||||
{
|
||||
m_CategoryIsSet = false;
|
||||
}
|
||||
@@ -307,7 +307,7 @@ bool Pet::tagsIsSet() const
|
||||
{
|
||||
return m_TagsIsSet;
|
||||
}
|
||||
void Pet::unsetTags()
|
||||
void Pet::unsetTags()
|
||||
{
|
||||
m_TagsIsSet = false;
|
||||
}
|
||||
@@ -324,7 +324,7 @@ bool Pet::statusIsSet() const
|
||||
{
|
||||
return m_StatusIsSet;
|
||||
}
|
||||
void Pet::unsetStatus()
|
||||
void Pet::unsetStatus()
|
||||
{
|
||||
m_StatusIsSet = false;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
@@ -12,8 +12,8 @@
|
||||
|
||||
/*
|
||||
* Pet.h
|
||||
*
|
||||
*
|
||||
*
|
||||
* A pet for sale in the pet store
|
||||
*/
|
||||
|
||||
#ifndef Pet_H_
|
||||
@@ -22,10 +22,10 @@
|
||||
|
||||
#include "ModelBase.h"
|
||||
|
||||
#include "Tag.h"
|
||||
#include <cpprest/details/basic_types.h>
|
||||
#include "Category.h"
|
||||
#include <cpprest/details/basic_types.h>
|
||||
#include <vector>
|
||||
#include "Tag.h"
|
||||
|
||||
namespace io {
|
||||
namespace swagger {
|
||||
@@ -33,18 +33,18 @@ namespace client {
|
||||
namespace model {
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// A pet for sale in the pet store
|
||||
/// </summary>
|
||||
class Pet
|
||||
: public ModelBase
|
||||
: public ModelBase
|
||||
{
|
||||
public:
|
||||
Pet();
|
||||
virtual ~Pet();
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// ModelBase overrides
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// ModelBase overrides
|
||||
|
||||
void validate() override;
|
||||
|
||||
web::json::value toJson() const override;
|
||||
@@ -52,10 +52,10 @@ public:
|
||||
|
||||
void toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix) const override;
|
||||
void fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix) override;
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// Pet members
|
||||
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// Pet members
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
void setStatus(utility::string_t value);
|
||||
bool statusIsSet() const;
|
||||
void unsetStatus();
|
||||
|
||||
|
||||
protected:
|
||||
int64_t m_Id;
|
||||
bool m_IdIsSet;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
@@ -32,7 +32,7 @@ Tag::~Tag()
|
||||
{
|
||||
}
|
||||
|
||||
void Tag::validate()
|
||||
void Tag::validate()
|
||||
{
|
||||
// TODO: implement validation
|
||||
}
|
||||
@@ -40,7 +40,7 @@ void Tag::validate()
|
||||
web::json::value Tag::toJson() const
|
||||
{
|
||||
web::json::value val = web::json::value::object();
|
||||
|
||||
|
||||
if(m_IdIsSet)
|
||||
{
|
||||
val[U("id")] = ModelBase::toJson(m_Id);
|
||||
@@ -63,7 +63,7 @@ void Tag::fromJson(web::json::value& val)
|
||||
if(val.has_field(U("name")))
|
||||
{
|
||||
setName(ModelBase::stringFromJson(val[U("name")]));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -83,7 +83,7 @@ void Tag::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utilit
|
||||
if(m_NameIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + U("name"), m_Name));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -103,12 +103,12 @@ void Tag::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const util
|
||||
if(multipart->hasContent(U("name")))
|
||||
{
|
||||
setName(ModelBase::stringFromHttpContent(multipart->getContent(U("name"))));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int64_t Tag::getId() const
|
||||
{
|
||||
return m_Id;
|
||||
@@ -122,7 +122,7 @@ bool Tag::idIsSet() const
|
||||
{
|
||||
return m_IdIsSet;
|
||||
}
|
||||
void Tag::unsetId()
|
||||
void Tag::unsetId()
|
||||
{
|
||||
m_IdIsSet = false;
|
||||
}
|
||||
@@ -139,7 +139,7 @@ bool Tag::nameIsSet() const
|
||||
{
|
||||
return m_NameIsSet;
|
||||
}
|
||||
void Tag::unsetName()
|
||||
void Tag::unsetName()
|
||||
{
|
||||
m_NameIsSet = false;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
@@ -12,8 +12,8 @@
|
||||
|
||||
/*
|
||||
* Tag.h
|
||||
*
|
||||
*
|
||||
*
|
||||
* A tag for a pet
|
||||
*/
|
||||
|
||||
#ifndef Tag_H_
|
||||
@@ -30,18 +30,18 @@ namespace client {
|
||||
namespace model {
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// A tag for a pet
|
||||
/// </summary>
|
||||
class Tag
|
||||
: public ModelBase
|
||||
: public ModelBase
|
||||
{
|
||||
public:
|
||||
Tag();
|
||||
virtual ~Tag();
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// ModelBase overrides
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// ModelBase overrides
|
||||
|
||||
void validate() override;
|
||||
|
||||
web::json::value toJson() const override;
|
||||
@@ -49,10 +49,10 @@ public:
|
||||
|
||||
void toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix) const override;
|
||||
void fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix) override;
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// Tag members
|
||||
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// Tag members
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
void setName(utility::string_t value);
|
||||
bool nameIsSet() const;
|
||||
void unsetName();
|
||||
|
||||
|
||||
protected:
|
||||
int64_t m_Id;
|
||||
bool m_IdIsSet;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
@@ -44,7 +44,7 @@ User::~User()
|
||||
{
|
||||
}
|
||||
|
||||
void User::validate()
|
||||
void User::validate()
|
||||
{
|
||||
// TODO: implement validation
|
||||
}
|
||||
@@ -52,7 +52,7 @@ void User::validate()
|
||||
web::json::value User::toJson() const
|
||||
{
|
||||
web::json::value val = web::json::value::object();
|
||||
|
||||
|
||||
if(m_IdIsSet)
|
||||
{
|
||||
val[U("id")] = ModelBase::toJson(m_Id);
|
||||
@@ -99,32 +99,32 @@ void User::fromJson(web::json::value& val)
|
||||
if(val.has_field(U("username")))
|
||||
{
|
||||
setUsername(ModelBase::stringFromJson(val[U("username")]));
|
||||
|
||||
|
||||
}
|
||||
if(val.has_field(U("firstName")))
|
||||
{
|
||||
setFirstName(ModelBase::stringFromJson(val[U("firstName")]));
|
||||
|
||||
|
||||
}
|
||||
if(val.has_field(U("lastName")))
|
||||
{
|
||||
setLastName(ModelBase::stringFromJson(val[U("lastName")]));
|
||||
|
||||
|
||||
}
|
||||
if(val.has_field(U("email")))
|
||||
{
|
||||
setEmail(ModelBase::stringFromJson(val[U("email")]));
|
||||
|
||||
|
||||
}
|
||||
if(val.has_field(U("password")))
|
||||
{
|
||||
setPassword(ModelBase::stringFromJson(val[U("password")]));
|
||||
|
||||
|
||||
}
|
||||
if(val.has_field(U("phone")))
|
||||
{
|
||||
setPhone(ModelBase::stringFromJson(val[U("phone")]));
|
||||
|
||||
|
||||
}
|
||||
if(val.has_field(U("userStatus")))
|
||||
{
|
||||
@@ -148,32 +148,32 @@ void User::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utili
|
||||
if(m_UsernameIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + U("username"), m_Username));
|
||||
|
||||
|
||||
}
|
||||
if(m_FirstNameIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + U("firstName"), m_FirstName));
|
||||
|
||||
|
||||
}
|
||||
if(m_LastNameIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + U("lastName"), m_LastName));
|
||||
|
||||
|
||||
}
|
||||
if(m_EmailIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + U("email"), m_Email));
|
||||
|
||||
|
||||
}
|
||||
if(m_PasswordIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + U("password"), m_Password));
|
||||
|
||||
|
||||
}
|
||||
if(m_PhoneIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + U("phone"), m_Phone));
|
||||
|
||||
|
||||
}
|
||||
if(m_UserStatusIsSet)
|
||||
{
|
||||
@@ -197,32 +197,32 @@ void User::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const uti
|
||||
if(multipart->hasContent(U("username")))
|
||||
{
|
||||
setUsername(ModelBase::stringFromHttpContent(multipart->getContent(U("username"))));
|
||||
|
||||
|
||||
}
|
||||
if(multipart->hasContent(U("firstName")))
|
||||
{
|
||||
setFirstName(ModelBase::stringFromHttpContent(multipart->getContent(U("firstName"))));
|
||||
|
||||
|
||||
}
|
||||
if(multipart->hasContent(U("lastName")))
|
||||
{
|
||||
setLastName(ModelBase::stringFromHttpContent(multipart->getContent(U("lastName"))));
|
||||
|
||||
|
||||
}
|
||||
if(multipart->hasContent(U("email")))
|
||||
{
|
||||
setEmail(ModelBase::stringFromHttpContent(multipart->getContent(U("email"))));
|
||||
|
||||
|
||||
}
|
||||
if(multipart->hasContent(U("password")))
|
||||
{
|
||||
setPassword(ModelBase::stringFromHttpContent(multipart->getContent(U("password"))));
|
||||
|
||||
|
||||
}
|
||||
if(multipart->hasContent(U("phone")))
|
||||
{
|
||||
setPhone(ModelBase::stringFromHttpContent(multipart->getContent(U("phone"))));
|
||||
|
||||
|
||||
}
|
||||
if(multipart->hasContent(U("userStatus")))
|
||||
{
|
||||
@@ -230,8 +230,8 @@ void User::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const uti
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int64_t User::getId() const
|
||||
{
|
||||
return m_Id;
|
||||
@@ -245,7 +245,7 @@ bool User::idIsSet() const
|
||||
{
|
||||
return m_IdIsSet;
|
||||
}
|
||||
void User::unsetId()
|
||||
void User::unsetId()
|
||||
{
|
||||
m_IdIsSet = false;
|
||||
}
|
||||
@@ -262,7 +262,7 @@ bool User::usernameIsSet() const
|
||||
{
|
||||
return m_UsernameIsSet;
|
||||
}
|
||||
void User::unsetUsername()
|
||||
void User::unsetUsername()
|
||||
{
|
||||
m_UsernameIsSet = false;
|
||||
}
|
||||
@@ -279,7 +279,7 @@ bool User::firstNameIsSet() const
|
||||
{
|
||||
return m_FirstNameIsSet;
|
||||
}
|
||||
void User::unsetFirstName()
|
||||
void User::unsetFirstName()
|
||||
{
|
||||
m_FirstNameIsSet = false;
|
||||
}
|
||||
@@ -296,7 +296,7 @@ bool User::lastNameIsSet() const
|
||||
{
|
||||
return m_LastNameIsSet;
|
||||
}
|
||||
void User::unsetLastName()
|
||||
void User::unsetLastName()
|
||||
{
|
||||
m_LastNameIsSet = false;
|
||||
}
|
||||
@@ -313,7 +313,7 @@ bool User::emailIsSet() const
|
||||
{
|
||||
return m_EmailIsSet;
|
||||
}
|
||||
void User::unsetEmail()
|
||||
void User::unsetEmail()
|
||||
{
|
||||
m_EmailIsSet = false;
|
||||
}
|
||||
@@ -330,7 +330,7 @@ bool User::passwordIsSet() const
|
||||
{
|
||||
return m_PasswordIsSet;
|
||||
}
|
||||
void User::unsetPassword()
|
||||
void User::unsetPassword()
|
||||
{
|
||||
m_PasswordIsSet = false;
|
||||
}
|
||||
@@ -347,7 +347,7 @@ bool User::phoneIsSet() const
|
||||
{
|
||||
return m_PhoneIsSet;
|
||||
}
|
||||
void User::unsetPhone()
|
||||
void User::unsetPhone()
|
||||
{
|
||||
m_PhoneIsSet = false;
|
||||
}
|
||||
@@ -364,7 +364,7 @@ bool User::userStatusIsSet() const
|
||||
{
|
||||
return m_UserStatusIsSet;
|
||||
}
|
||||
void User::unsetUserStatus()
|
||||
void User::unsetUserStatus()
|
||||
{
|
||||
m_UserStatusIsSet = false;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
@@ -12,8 +12,8 @@
|
||||
|
||||
/*
|
||||
* User.h
|
||||
*
|
||||
*
|
||||
*
|
||||
* A User who is purchasing from the pet store
|
||||
*/
|
||||
|
||||
#ifndef User_H_
|
||||
@@ -30,18 +30,18 @@ namespace client {
|
||||
namespace model {
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// A User who is purchasing from the pet store
|
||||
/// </summary>
|
||||
class User
|
||||
: public ModelBase
|
||||
: public ModelBase
|
||||
{
|
||||
public:
|
||||
User();
|
||||
virtual ~User();
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// ModelBase overrides
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// ModelBase overrides
|
||||
|
||||
void validate() override;
|
||||
|
||||
web::json::value toJson() const override;
|
||||
@@ -49,10 +49,10 @@ public:
|
||||
|
||||
void toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix) const override;
|
||||
void fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix) override;
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// User members
|
||||
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// User members
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -109,7 +109,7 @@ public:
|
||||
void setUserStatus(int32_t value);
|
||||
bool userStatusIsSet() const;
|
||||
void unsetUserStatus();
|
||||
|
||||
|
||||
protected:
|
||||
int64_t m_Id;
|
||||
bool m_IdIsSet;
|
||||
|
||||
Reference in New Issue
Block a user