forked from loafle/openapi-generator-original
[CppRest] Support optional parameters (#6959)
* Use boost::optional for parameters that are not required. * Update sample petstore client.
This commit is contained in:
parent
803f337d24
commit
d9cea0f97e
@ -14,6 +14,8 @@
|
|||||||
{{#imports}}{{{import}}}
|
{{#imports}}{{{import}}}
|
||||||
{{/imports}}
|
{{/imports}}
|
||||||
|
|
||||||
|
#include <boost/optional.hpp>
|
||||||
|
|
||||||
{{#apiNamespaceDeclarations}}
|
{{#apiNamespaceDeclarations}}
|
||||||
namespace {{this}} {
|
namespace {{this}} {
|
||||||
{{/apiNamespaceDeclarations}}
|
{{/apiNamespaceDeclarations}}
|
||||||
@ -32,8 +34,14 @@ public:
|
|||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// {{notes}}
|
/// {{notes}}
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
{{#allParams}}/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}</param>{{/allParams}}
|
{{#allParams}}
|
||||||
pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> {{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}</param>
|
||||||
|
{{/allParams}}
|
||||||
|
pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> {{operationId}}(
|
||||||
|
{{#allParams}}
|
||||||
|
{{^required}}boost::optional<{{/required}}{{{dataType}}}{{^required}}>{{/required}} {{paramName}}{{#hasMore}},{{/hasMore}}
|
||||||
|
{{/allParams}}
|
||||||
|
);
|
||||||
{{/operation}}
|
{{/operation}}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -26,7 +26,7 @@ using namespace {{modelNamespace}};
|
|||||||
}
|
}
|
||||||
|
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> {{classname}}::{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
|
pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> {{classname}}::{{operationId}}({{#allParams}}{{^required}}boost::optional<{{/required}}{{{dataType}}}{{^required}}>{{/required}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
|
||||||
{
|
{
|
||||||
{{#allParams}}{{#required}}{{^isPrimitiveType}}{{^isContainer}}
|
{{#allParams}}{{#required}}{{^isPrimitiveType}}{{^isContainer}}
|
||||||
// verify the required parameter '{{paramName}}' is set
|
// verify the required parameter '{{paramName}}' is set
|
||||||
@ -104,34 +104,53 @@ pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/r
|
|||||||
{{#allParams}}
|
{{#allParams}}
|
||||||
{{^isBodyParam}}
|
{{^isBodyParam}}
|
||||||
{{^isPathParam}}
|
{{^isPathParam}}
|
||||||
{{^isPrimitiveType}}{{^isContainer}}if ({{paramName}} != nullptr){{/isContainer}}{{/isPrimitiveType}}
|
{{#required}}
|
||||||
|
{{^isPrimitiveType}}
|
||||||
|
{{^isContainer}}
|
||||||
|
if ({{paramName}} != nullptr)
|
||||||
|
{{/isContainer}}
|
||||||
|
{{/isPrimitiveType}}
|
||||||
|
{{/required}}
|
||||||
|
{{^required}}
|
||||||
|
{{^isPrimitiveType}}
|
||||||
|
{{^isContainer}}
|
||||||
|
if ({{paramName}} && *{{paramName}} != nullptr)
|
||||||
|
{{/isContainer}}
|
||||||
|
{{/isPrimitiveType}}
|
||||||
|
{{#isPrimitiveType}}
|
||||||
|
if ({{paramName}})
|
||||||
|
{{/isPrimitiveType}}
|
||||||
|
{{#isContainer}}
|
||||||
|
if ({{paramName}})
|
||||||
|
{{/isContainer}}
|
||||||
|
{{/required}}
|
||||||
{
|
{
|
||||||
{{#isContainer}}
|
{{#isContainer}}
|
||||||
{{#isQueryParam}}
|
{{#isQueryParam}}
|
||||||
queryParams[utility::conversions::to_string_t("{{baseName}}")] = ApiClient::parameterToArrayString<{{items.datatype}}>({{paramName}});
|
queryParams[utility::conversions::to_string_t("{{baseName}}")] = ApiClient::parameterToArrayString<{{items.datatype}}>({{^required}}*{{/required}}{{paramName}});
|
||||||
{{/isQueryParam}}
|
{{/isQueryParam}}
|
||||||
{{#isHeaderParam}}
|
{{#isHeaderParam}}
|
||||||
headerParams[utility::conversions::to_string_t("{{baseName}}")] = ApiClient::parameterToArrayString<{{items.datatype}}>({{paramName}});
|
headerParams[utility::conversions::to_string_t("{{baseName}}")] = ApiClient::parameterToArrayString<{{items.datatype}}>({{^required}}*{{/required}}{{paramName}});
|
||||||
{{/isHeaderParam}}
|
{{/isHeaderParam}}
|
||||||
{{#isFormParam}}
|
{{#isFormParam}}
|
||||||
{{^isFile}}
|
{{^isFile}}
|
||||||
formParams[ utility::conversions::to_string_t("{{baseName}}") ] = ApiClient::parameterToArrayString<{{items.datatype}}>({{paramName}});
|
formParams[ utility::conversions::to_string_t("{{baseName}}") ] = ApiClient::parameterToArrayString<{{items.datatype}}>({{^required}}*{{/required}}{{paramName}});
|
||||||
{{/isFile}}
|
{{/isFile}}
|
||||||
{{/isFormParam}}
|
{{/isFormParam}}
|
||||||
{{/isContainer}}
|
{{/isContainer}}
|
||||||
{{^isContainer}}
|
{{^isContainer}}
|
||||||
{{#isQueryParam}}
|
{{#isQueryParam}}
|
||||||
queryParams[utility::conversions::to_string_t("{{baseName}}")] = ApiClient::parameterToString({{paramName}});
|
queryParams[utility::conversions::to_string_t("{{baseName}}")] = ApiClient::parameterToString({{^required}}*{{/required}}{{paramName}});
|
||||||
{{/isQueryParam}}
|
{{/isQueryParam}}
|
||||||
{{#isHeaderParam}}
|
{{#isHeaderParam}}
|
||||||
headerParams[utility::conversions::to_string_t("{{baseName}}")] = ApiClient::parameterToString({{paramName}});
|
headerParams[utility::conversions::to_string_t("{{baseName}}")] = ApiClient::parameterToString({{^required}}*{{/required}}{{paramName}});
|
||||||
{{/isHeaderParam}}
|
{{/isHeaderParam}}
|
||||||
{{#isFormParam}}
|
{{#isFormParam}}
|
||||||
{{#isFile}}
|
{{#isFile}}
|
||||||
fileParams[ utility::conversions::to_string_t("{{baseName}}") ] = {{paramName}};
|
fileParams[ utility::conversions::to_string_t("{{baseName}}") ] = {{^required}}*{{/required}}{{paramName}};
|
||||||
{{/isFile}}
|
{{/isFile}}
|
||||||
{{^isFile}}
|
{{^isFile}}
|
||||||
formParams[ utility::conversions::to_string_t("{{baseName}}") ] = ApiClient::parameterToString({{paramName}});
|
formParams[ utility::conversions::to_string_t("{{baseName}}") ] = ApiClient::parameterToString({{^required}}*{{/required}}{{paramName}});
|
||||||
{{/isFile}}
|
{{/isFile}}
|
||||||
{{/isFormParam}}
|
{{/isFormParam}}
|
||||||
{{/isContainer}}
|
{{/isContainer}}
|
||||||
|
@ -155,7 +155,7 @@ pplx::task<void> PetApi::addPet(std::shared_ptr<Pet> body)
|
|||||||
return void();
|
return void();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
pplx::task<void> PetApi::deletePet(int64_t petId, utility::string_t apiKey)
|
pplx::task<void> PetApi::deletePet(int64_t petId, boost::optional<utility::string_t> apiKey)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
@ -198,9 +198,9 @@ pplx::task<void> PetApi::deletePet(int64_t petId, utility::string_t apiKey)
|
|||||||
|
|
||||||
std::unordered_set<utility::string_t> consumeHttpContentTypes;
|
std::unordered_set<utility::string_t> consumeHttpContentTypes;
|
||||||
|
|
||||||
|
if (apiKey)
|
||||||
{
|
{
|
||||||
headerParams[utility::conversions::to_string_t("api_key")] = ApiClient::parameterToString(apiKey);
|
headerParams[utility::conversions::to_string_t("api_key")] = ApiClient::parameterToString(*apiKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<IHttpBody> httpBody;
|
std::shared_ptr<IHttpBody> httpBody;
|
||||||
@ -300,7 +300,6 @@ pplx::task<std::vector<std::shared_ptr<Pet>>> PetApi::findPetsByStatus(std::vect
|
|||||||
|
|
||||||
std::unordered_set<utility::string_t> consumeHttpContentTypes;
|
std::unordered_set<utility::string_t> consumeHttpContentTypes;
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
queryParams[utility::conversions::to_string_t("status")] = ApiClient::parameterToArrayString<utility::string_t>(status);
|
queryParams[utility::conversions::to_string_t("status")] = ApiClient::parameterToArrayString<utility::string_t>(status);
|
||||||
}
|
}
|
||||||
@ -427,7 +426,6 @@ pplx::task<std::vector<std::shared_ptr<Pet>>> PetApi::findPetsByTags(std::vector
|
|||||||
|
|
||||||
std::unordered_set<utility::string_t> consumeHttpContentTypes;
|
std::unordered_set<utility::string_t> consumeHttpContentTypes;
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
queryParams[utility::conversions::to_string_t("tags")] = ApiClient::parameterToArrayString<utility::string_t>(tags);
|
queryParams[utility::conversions::to_string_t("tags")] = ApiClient::parameterToArrayString<utility::string_t>(tags);
|
||||||
}
|
}
|
||||||
@ -754,7 +752,7 @@ pplx::task<void> PetApi::updatePet(std::shared_ptr<Pet> body)
|
|||||||
return void();
|
return void();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
pplx::task<void> PetApi::updatePetWithForm(int64_t petId, utility::string_t name, utility::string_t status)
|
pplx::task<void> PetApi::updatePetWithForm(int64_t petId, boost::optional<utility::string_t> name, boost::optional<utility::string_t> status)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
@ -798,13 +796,13 @@ pplx::task<void> PetApi::updatePetWithForm(int64_t petId, utility::string_t name
|
|||||||
std::unordered_set<utility::string_t> consumeHttpContentTypes;
|
std::unordered_set<utility::string_t> consumeHttpContentTypes;
|
||||||
consumeHttpContentTypes.insert( utility::conversions::to_string_t("application/x-www-form-urlencoded") );
|
consumeHttpContentTypes.insert( utility::conversions::to_string_t("application/x-www-form-urlencoded") );
|
||||||
|
|
||||||
|
if (name)
|
||||||
{
|
{
|
||||||
formParams[ utility::conversions::to_string_t("name") ] = ApiClient::parameterToString(name);
|
formParams[ utility::conversions::to_string_t("name") ] = ApiClient::parameterToString(*name);
|
||||||
}
|
}
|
||||||
|
if (status)
|
||||||
{
|
{
|
||||||
formParams[ utility::conversions::to_string_t("status") ] = ApiClient::parameterToString(status);
|
formParams[ utility::conversions::to_string_t("status") ] = ApiClient::parameterToString(*status);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<IHttpBody> httpBody;
|
std::shared_ptr<IHttpBody> httpBody;
|
||||||
@ -862,7 +860,7 @@ pplx::task<void> PetApi::updatePetWithForm(int64_t petId, utility::string_t name
|
|||||||
return void();
|
return void();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
pplx::task<std::shared_ptr<ApiResponse>> PetApi::uploadFile(int64_t petId, utility::string_t additionalMetadata, std::shared_ptr<HttpContent> file)
|
pplx::task<std::shared_ptr<ApiResponse>> PetApi::uploadFile(int64_t petId, boost::optional<utility::string_t> additionalMetadata, boost::optional<std::shared_ptr<HttpContent>> file)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
@ -905,13 +903,13 @@ pplx::task<std::shared_ptr<ApiResponse>> PetApi::uploadFile(int64_t petId, utili
|
|||||||
std::unordered_set<utility::string_t> consumeHttpContentTypes;
|
std::unordered_set<utility::string_t> consumeHttpContentTypes;
|
||||||
consumeHttpContentTypes.insert( utility::conversions::to_string_t("multipart/form-data") );
|
consumeHttpContentTypes.insert( utility::conversions::to_string_t("multipart/form-data") );
|
||||||
|
|
||||||
|
if (additionalMetadata)
|
||||||
{
|
{
|
||||||
formParams[ utility::conversions::to_string_t("additionalMetadata") ] = ApiClient::parameterToString(additionalMetadata);
|
formParams[ utility::conversions::to_string_t("additionalMetadata") ] = ApiClient::parameterToString(*additionalMetadata);
|
||||||
}
|
}
|
||||||
if (file != nullptr)
|
if (file && *file != nullptr)
|
||||||
{
|
{
|
||||||
fileParams[ utility::conversions::to_string_t("file") ] = file;
|
fileParams[ utility::conversions::to_string_t("file") ] = *file;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<IHttpBody> httpBody;
|
std::shared_ptr<IHttpBody> httpBody;
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
#include "Pet.h"
|
#include "Pet.h"
|
||||||
#include <cpprest/details/basic_types.h>
|
#include <cpprest/details/basic_types.h>
|
||||||
|
|
||||||
|
#include <boost/optional.hpp>
|
||||||
|
|
||||||
namespace io {
|
namespace io {
|
||||||
namespace swagger {
|
namespace swagger {
|
||||||
namespace client {
|
namespace client {
|
||||||
@ -46,15 +48,21 @@ public:
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="body">Pet object that needs to be added to the store</param>
|
/// <param name="body">Pet object that needs to be added to the store</param>
|
||||||
pplx::task<void> addPet(std::shared_ptr<Pet> body);
|
pplx::task<void> addPet(
|
||||||
|
std::shared_ptr<Pet> body
|
||||||
|
);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deletes a pet
|
/// Deletes a pet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="petId">Pet id to delete</param>/// <param name="apiKey"> (optional)</param>
|
/// <param name="petId">Pet id to delete</param>
|
||||||
pplx::task<void> deletePet(int64_t petId, utility::string_t apiKey);
|
/// <param name="apiKey"> (optional)</param>
|
||||||
|
pplx::task<void> deletePet(
|
||||||
|
int64_t petId,
|
||||||
|
boost::optional<utility::string_t> apiKey
|
||||||
|
);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Finds Pets by status
|
/// Finds Pets by status
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -62,7 +70,9 @@ public:
|
|||||||
/// Multiple status values can be provided with comma separated strings
|
/// Multiple status values can be provided with comma separated strings
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="status">Status values that need to be considered for filter</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);
|
pplx::task<std::vector<std::shared_ptr<Pet>>> findPetsByStatus(
|
||||||
|
std::vector<utility::string_t> status
|
||||||
|
);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Finds Pets by tags
|
/// Finds Pets by tags
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -70,7 +80,9 @@ public:
|
|||||||
/// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
/// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="tags">Tags to filter by</param>
|
/// <param name="tags">Tags to filter by</param>
|
||||||
pplx::task<std::vector<std::shared_ptr<Pet>>> findPetsByTags(std::vector<utility::string_t> tags);
|
pplx::task<std::vector<std::shared_ptr<Pet>>> findPetsByTags(
|
||||||
|
std::vector<utility::string_t> tags
|
||||||
|
);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Find pet by ID
|
/// Find pet by ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -78,7 +90,9 @@ public:
|
|||||||
/// Returns a single pet
|
/// Returns a single pet
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="petId">ID of pet to return</param>
|
/// <param name="petId">ID of pet to return</param>
|
||||||
pplx::task<std::shared_ptr<Pet>> getPetById(int64_t petId);
|
pplx::task<std::shared_ptr<Pet>> getPetById(
|
||||||
|
int64_t petId
|
||||||
|
);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update an existing pet
|
/// Update an existing pet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -86,23 +100,37 @@ public:
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="body">Pet object that needs to be added to the store</param>
|
/// <param name="body">Pet object that needs to be added to the store</param>
|
||||||
pplx::task<void> updatePet(std::shared_ptr<Pet> body);
|
pplx::task<void> updatePet(
|
||||||
|
std::shared_ptr<Pet> body
|
||||||
|
);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates a pet in the store with form data
|
/// Updates a pet in the store with form data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
///
|
///
|
||||||
/// </remarks>
|
/// </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>
|
/// <param name="petId">ID of pet that needs to be updated</param>
|
||||||
pplx::task<void> updatePetWithForm(int64_t petId, utility::string_t name, utility::string_t status);
|
/// <param name="name">Updated name of the pet (optional)</param>
|
||||||
|
/// <param name="status">Updated status of the pet (optional)</param>
|
||||||
|
pplx::task<void> updatePetWithForm(
|
||||||
|
int64_t petId,
|
||||||
|
boost::optional<utility::string_t> name,
|
||||||
|
boost::optional<utility::string_t> status
|
||||||
|
);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// uploads an image
|
/// uploads an image
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
///
|
///
|
||||||
/// </remarks>
|
/// </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>
|
/// <param name="petId">ID of pet to update</param>
|
||||||
pplx::task<std::shared_ptr<ApiResponse>> uploadFile(int64_t petId, utility::string_t additionalMetadata, std::shared_ptr<HttpContent> file);
|
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
|
||||||
|
/// <param name="file">file to upload (optional)</param>
|
||||||
|
pplx::task<std::shared_ptr<ApiResponse>> uploadFile(
|
||||||
|
int64_t petId,
|
||||||
|
boost::optional<utility::string_t> additionalMetadata,
|
||||||
|
boost::optional<std::shared_ptr<HttpContent>> file
|
||||||
|
);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::shared_ptr<ApiClient> m_ApiClient;
|
std::shared_ptr<ApiClient> m_ApiClient;
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <cpprest/details/basic_types.h>
|
#include <cpprest/details/basic_types.h>
|
||||||
|
|
||||||
|
#include <boost/optional.hpp>
|
||||||
|
|
||||||
namespace io {
|
namespace io {
|
||||||
namespace swagger {
|
namespace swagger {
|
||||||
namespace client {
|
namespace client {
|
||||||
@ -45,15 +47,17 @@ public:
|
|||||||
/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="orderId">ID of the order that needs to be deleted</param>
|
/// <param name="orderId">ID of the order that needs to be deleted</param>
|
||||||
pplx::task<void> deleteOrder(utility::string_t orderId);
|
pplx::task<void> deleteOrder(
|
||||||
|
utility::string_t orderId
|
||||||
|
);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns pet inventories by status
|
/// Returns pet inventories by status
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Returns a map of status codes to quantities
|
/// Returns a map of status codes to quantities
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
pplx::task<std::map<utility::string_t, int32_t>> getInventory(
|
||||||
pplx::task<std::map<utility::string_t, int32_t>> getInventory();
|
);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Find purchase order by ID
|
/// Find purchase order by ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -61,7 +65,9 @@ public:
|
|||||||
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="orderId">ID of pet that needs to be fetched</param>
|
/// <param name="orderId">ID of pet that needs to be fetched</param>
|
||||||
pplx::task<std::shared_ptr<Order>> getOrderById(int64_t orderId);
|
pplx::task<std::shared_ptr<Order>> getOrderById(
|
||||||
|
int64_t orderId
|
||||||
|
);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Place an order for a pet
|
/// Place an order for a pet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -69,7 +75,9 @@ public:
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="body">order placed for purchasing the pet</param>
|
/// <param name="body">order placed for purchasing the pet</param>
|
||||||
pplx::task<std::shared_ptr<Order>> placeOrder(std::shared_ptr<Order> body);
|
pplx::task<std::shared_ptr<Order>> placeOrder(
|
||||||
|
std::shared_ptr<Order> body
|
||||||
|
);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::shared_ptr<ApiClient> m_ApiClient;
|
std::shared_ptr<ApiClient> m_ApiClient;
|
||||||
|
@ -654,11 +654,9 @@ pplx::task<utility::string_t> UserApi::loginUser(utility::string_t username, uti
|
|||||||
|
|
||||||
std::unordered_set<utility::string_t> consumeHttpContentTypes;
|
std::unordered_set<utility::string_t> consumeHttpContentTypes;
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
queryParams[utility::conversions::to_string_t("username")] = ApiClient::parameterToString(username);
|
queryParams[utility::conversions::to_string_t("username")] = ApiClient::parameterToString(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
queryParams[utility::conversions::to_string_t("password")] = ApiClient::parameterToString(password);
|
queryParams[utility::conversions::to_string_t("password")] = ApiClient::parameterToString(password);
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cpprest/details/basic_types.h>
|
#include <cpprest/details/basic_types.h>
|
||||||
|
|
||||||
|
#include <boost/optional.hpp>
|
||||||
|
|
||||||
namespace io {
|
namespace io {
|
||||||
namespace swagger {
|
namespace swagger {
|
||||||
namespace client {
|
namespace client {
|
||||||
@ -45,7 +47,9 @@ public:
|
|||||||
/// This can only be done by the logged in user.
|
/// This can only be done by the logged in user.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="body">Created user object</param>
|
/// <param name="body">Created user object</param>
|
||||||
pplx::task<void> createUser(std::shared_ptr<User> body);
|
pplx::task<void> createUser(
|
||||||
|
std::shared_ptr<User> body
|
||||||
|
);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates list of users with given input array
|
/// Creates list of users with given input array
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -53,7 +57,9 @@ public:
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="body">List of user object</param>
|
/// <param name="body">List of user object</param>
|
||||||
pplx::task<void> createUsersWithArrayInput(std::vector<std::shared_ptr<User>> body);
|
pplx::task<void> createUsersWithArrayInput(
|
||||||
|
std::vector<std::shared_ptr<User>> body
|
||||||
|
);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates list of users with given input array
|
/// Creates list of users with given input array
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -61,7 +67,9 @@ public:
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="body">List of user object</param>
|
/// <param name="body">List of user object</param>
|
||||||
pplx::task<void> createUsersWithListInput(std::vector<std::shared_ptr<User>> body);
|
pplx::task<void> createUsersWithListInput(
|
||||||
|
std::vector<std::shared_ptr<User>> body
|
||||||
|
);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delete user
|
/// Delete user
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -69,7 +77,9 @@ public:
|
|||||||
/// This can only be done by the logged in user.
|
/// This can only be done by the logged in user.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="username">The name that needs to be deleted</param>
|
/// <param name="username">The name that needs to be deleted</param>
|
||||||
pplx::task<void> deleteUser(utility::string_t username);
|
pplx::task<void> deleteUser(
|
||||||
|
utility::string_t username
|
||||||
|
);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get user by user name
|
/// Get user by user name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -77,31 +87,41 @@ public:
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="username">The name that needs to be fetched. Use user1 for testing. </param>
|
/// <param name="username">The name that needs to be fetched. Use user1 for testing. </param>
|
||||||
pplx::task<std::shared_ptr<User>> getUserByName(utility::string_t username);
|
pplx::task<std::shared_ptr<User>> getUserByName(
|
||||||
|
utility::string_t username
|
||||||
|
);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logs user into the system
|
/// Logs user into the system
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="username">The user name for login</param>/// <param name="password">The password for login in clear text</param>
|
/// <param name="username">The user name for login</param>
|
||||||
pplx::task<utility::string_t> loginUser(utility::string_t username, utility::string_t password);
|
/// <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>
|
/// <summary>
|
||||||
/// Logs out current logged in user session
|
/// Logs out current logged in user session
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
pplx::task<void> logoutUser(
|
||||||
pplx::task<void> logoutUser();
|
);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updated user
|
/// Updated user
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// This can only be done by the logged in user.
|
/// This can only be done by the logged in user.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="username">name that need to be deleted</param>/// <param name="body">Updated user object</param>
|
/// <param name="username">name that need to be deleted</param>
|
||||||
pplx::task<void> updateUser(utility::string_t username, std::shared_ptr<User> body);
|
/// <param name="body">Updated user object</param>
|
||||||
|
pplx::task<void> updateUser(
|
||||||
|
utility::string_t username,
|
||||||
|
std::shared_ptr<User> body
|
||||||
|
);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::shared_ptr<ApiClient> m_ApiClient;
|
std::shared_ptr<ApiClient> m_ApiClient;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user