update cpp-restsdk to use 3.0 petstore spec (#18670)

This commit is contained in:
William Cheng 2024-05-14 17:15:36 +08:00 committed by GitHub
parent 09be19cef7
commit cc5c50b227
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 896 additions and 62 deletions

View File

@ -1,6 +1,6 @@
generatorName: cpp-restsdk generatorName: cpp-restsdk
outputDir: samples/client/petstore/cpp-restsdk/client outputDir: samples/client/petstore/cpp-restsdk/client
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml inputSpec: modules/openapi-generator/src/test/resources/3_0/cpp-restsdk/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/cpp-rest-sdk-client templateDir: modules/openapi-generator/src/main/resources/cpp-rest-sdk-client
additionalProperties: additionalProperties:
packageName: CppRestPetstoreClient packageName: CppRestPetstoreClient

View File

@ -0,0 +1,741 @@
openapi: 3.0.0
servers:
- url: 'http://petstore.swagger.io/v2'
info:
description: >-
This is a sample server Petstore server. For this sample, you can use the api key
`special-key` to test the authorization filters.
version: 1.0.0
title: OpenAPI Petstore
license:
name: Apache-2.0
url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
tags:
- name: pet
description: Everything about your Pets
- name: store
description: Access to Petstore orders
- name: user
description: Operations about user
paths:
/pet:
post:
tags:
- pet
summary: Add a new pet to the store
description: ''
operationId: addPet
responses:
'200':
description: successful operation
content:
application/xml:
schema:
$ref: '#/components/schemas/Pet'
application/json:
schema:
$ref: '#/components/schemas/Pet'
'405':
description: Invalid input
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
requestBody:
$ref: '#/components/requestBodies/Pet'
put:
tags:
- pet
summary: Update an existing pet
description: ''
operationId: updatePet
externalDocs:
url: "http://petstore.swagger.io/v2/doc/updatePet"
description: "API documentation for the updatePet operation"
responses:
'200':
description: successful operation
content:
application/xml:
schema:
$ref: '#/components/schemas/Pet'
application/json:
schema:
$ref: '#/components/schemas/Pet'
'400':
description: Invalid ID supplied
'404':
description: Pet not found
'405':
description: Validation exception
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
requestBody:
$ref: '#/components/requestBodies/Pet'
/pet/findByStatus:
get:
tags:
- pet
summary: Finds Pets by status
description: Multiple status values can be provided with comma separated strings
operationId: findPetsByStatus
parameters:
- name: status
in: query
description: Status values that need to be considered for filter
required: true
style: form
explode: false
deprecated: true
schema:
type: array
items:
type: string
enum:
- available
- pending
- sold
default: available
responses:
'200':
description: successful operation
content:
application/xml:
schema:
type: array
items:
$ref: '#/components/schemas/Pet'
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Pet'
'400':
description: Invalid status value
security:
- petstore_auth:
- 'read:pets'
/pet/findByTags:
get:
tags:
- pet
summary: Finds Pets by tags
description: >-
Multiple tags can be provided with comma separated strings. Use tag1,
tag2, tag3 for testing.
operationId: findPetsByTags
parameters:
- name: tags
in: query
description: Tags to filter by
required: true
style: form
explode: false
schema:
type: array
items:
type: string
responses:
'200':
description: successful operation
content:
application/xml:
schema:
type: array
items:
$ref: '#/components/schemas/Pet'
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Pet'
'400':
description: Invalid tag value
security:
- petstore_auth:
- 'read:pets'
deprecated: true
'/pet/{petId}':
get:
tags:
- pet
summary: Find pet by ID
description: Returns a single pet
operationId: getPetById
parameters:
- name: petId
in: path
description: ID of pet to return
required: true
schema:
type: integer
format: int64
responses:
'200':
description: successful operation
content:
application/xml:
schema:
$ref: '#/components/schemas/Pet'
application/json:
schema:
$ref: '#/components/schemas/Pet'
'400':
description: Invalid ID supplied
'404':
description: Pet not found
security:
- api_key: []
post:
tags:
- pet
summary: Updates a pet in the store with form data
description: ''
operationId: updatePetWithForm
parameters:
- name: petId
in: path
description: ID of pet that needs to be updated
required: true
schema:
type: integer
format: int64
responses:
'405':
description: Invalid input
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
name:
description: Updated name of the pet
type: string
status:
description: Updated status of the pet
type: string
delete:
tags:
- pet
summary: Deletes a pet
description: ''
operationId: deletePet
parameters:
- name: api_key
in: header
required: false
schema:
type: string
- name: petId
in: path
description: Pet id to delete
required: true
schema:
type: integer
format: int64
responses:
'400':
description: Invalid pet value
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
'/pet/{petId}/uploadImage':
post:
tags:
- pet
summary: uploads an image
description: ''
operationId: uploadFile
parameters:
- name: petId
in: path
description: ID of pet to update
required: true
schema:
type: integer
format: int64
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
additionalMetadata:
description: Additional data to pass to server
type: string
file:
description: file to upload
type: string
format: binary
/store/inventory:
get:
tags:
- store
summary: Returns pet inventories by status
description: Returns a map of status codes to quantities
operationId: getInventory
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
additionalProperties:
type: integer
format: int32
security:
- api_key: []
/store/order:
post:
tags:
- store
summary: Place an order for a pet
description: ''
operationId: placeOrder
responses:
'200':
description: successful operation
content:
application/xml:
schema:
$ref: '#/components/schemas/Order'
application/json:
schema:
$ref: '#/components/schemas/Order'
'400':
description: Invalid Order
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Order'
description: order placed for purchasing the pet
required: true
'/store/order/{orderId}':
get:
tags:
- store
summary: Find purchase order by ID
description: >-
For valid response try integer IDs with value <= 5 or > 10. Other values
will generate exceptions
operationId: getOrderById
parameters:
- name: orderId
in: path
description: ID of pet that needs to be fetched
required: true
schema:
type: integer
format: int64
minimum: 1
maximum: 5
responses:
'200':
description: successful operation
content:
application/xml:
schema:
$ref: '#/components/schemas/Order'
application/json:
schema:
$ref: '#/components/schemas/Order'
'400':
description: Invalid ID supplied
'404':
description: Order not found
delete:
tags:
- store
summary: Delete purchase order by ID
description: >-
For valid response try integer IDs with value < 1000. Anything above
1000 or nonintegers will generate API errors
operationId: deleteOrder
parameters:
- name: orderId
in: path
description: ID of the order that needs to be deleted
required: true
schema:
type: string
responses:
'400':
description: Invalid ID supplied
'404':
description: Order not found
/user:
post:
tags:
- user
summary: Create user
description: This can only be done by the logged in user.
operationId: createUser
responses:
default:
description: successful operation
security:
- api_key: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/User'
description: Created user object
required: true
/user/createWithArray:
post:
tags:
- user
summary: Creates list of users with given input array
description: ''
operationId: createUsersWithArrayInput
responses:
default:
description: successful operation
security:
- api_key: []
requestBody:
$ref: '#/components/requestBodies/UserArray'
/user/createWithList:
post:
tags:
- user
summary: Creates list of users with given input array
description: ''
operationId: createUsersWithListInput
responses:
default:
description: successful operation
security:
- api_key: []
requestBody:
$ref: '#/components/requestBodies/UserArray'
/user/login:
get:
tags:
- user
summary: Logs user into the system
description: ''
operationId: loginUser
parameters:
- name: username
in: query
description: The user name for login
required: true
schema:
type: string
pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$'
- name: password
in: query
description: The password for login in clear text
required: true
schema:
type: string
responses:
'200':
description: successful operation
headers:
Set-Cookie:
description: >-
Cookie authentication key for use with the `api_key`
apiKey authentication.
schema:
type: string
example: AUTH_KEY=abcde12345; Path=/; HttpOnly
X-Rate-Limit:
description: calls per hour allowed by the user
schema:
type: integer
format: int32
X-Expires-After:
description: date in UTC when token expires
schema:
type: string
format: date-time
content:
application/xml:
schema:
type: string
application/json:
schema:
type: string
'400':
description: Invalid username/password supplied
/user/logout:
get:
tags:
- user
summary: Logs out current logged in user session
description: ''
operationId: logoutUser
responses:
default:
description: successful operation
security:
- api_key: []
'/user/{username}':
get:
tags:
- user
summary: Get user by user name
description: ''
operationId: getUserByName
parameters:
- name: username
in: path
description: The name that needs to be fetched. Use user1 for testing.
required: true
schema:
type: string
responses:
'200':
description: successful operation
content:
application/xml:
schema:
$ref: '#/components/schemas/User'
application/json:
schema:
$ref: '#/components/schemas/User'
'400':
description: Invalid username supplied
'404':
description: User not found
put:
tags:
- user
summary: Updated user
description: This can only be done by the logged in user.
operationId: updateUser
parameters:
- name: username
in: path
description: name that need to be deleted
required: true
schema:
type: string
responses:
'400':
description: Invalid user supplied
'404':
description: User not found
security:
- api_key: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/User'
description: Updated user object
required: true
delete:
tags:
- user
summary: Delete user
description: This can only be done by the logged in user.
operationId: deleteUser
parameters:
- name: username
in: path
description: The name that needs to be deleted
required: true
schema:
type: string
responses:
'400':
description: Invalid username supplied
'404':
description: User not found
security:
- api_key: []
externalDocs:
description: Find out more about Swagger
url: 'http://swagger.io'
components:
requestBodies:
UserArray:
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/User'
description: List of user object
required: true
Pet:
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
application/xml:
schema:
$ref: '#/components/schemas/Pet'
description: Pet object that needs to be added to the store
required: true
securitySchemes:
petstore_auth:
type: oauth2
flows:
implicit:
authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog'
scopes:
'write:pets': modify pets in your account
'read:pets': read your pets
api_key:
type: apiKey
name: api_key
in: header
schemas:
Order:
title: Pet Order
description: An order for a pets from the pet store
type: object
properties:
id:
type: integer
format: int64
petId:
type: integer
format: int64
quantity:
type: integer
format: int32
shipDate:
type: string
format: date-time
status:
type: string
description: Order Status
enum:
- placed
- approved
- delivered
complete:
type: boolean
default: false
xml:
name: Order
Category:
title: Pet category
description: A category for a pet
type: object
properties:
id:
type: integer
format: int64
name:
type: string
pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$'
xml:
name: Category
User:
title: a User
description: A User who is purchasing from the pet store
type: object
properties:
id:
type: integer
format: int64
username:
type: string
firstName:
type: string
lastName:
type: string
email:
type: string
password:
type: string
phone:
type: string
userStatus:
type: integer
format: int32
description: User Status
xml:
name: User
Tag:
title: Pet Tag
description: A tag for a pet
type: object
properties:
id:
type: integer
format: int64
name:
type: string
xml:
name: Tag
Pet:
title: a Pet
description: A pet for sale in the pet store
type: object
required:
- name
- photoUrls
properties:
id:
type: integer
format: int64
category:
$ref: '#/components/schemas/Category'
name:
type: string
example: doggie
photoUrls:
type: array
xml:
name: photoUrl
wrapped: true
items:
type: string
tags:
type: array
xml:
name: tag
wrapped: true
items:
$ref: '#/components/schemas/Tag'
status:
type: string
description: pet status in the store
deprecated: true
enum:
- available
- pending
- sold
xml:
name: Pet
ApiResponse:
title: An uploaded response
description: Describes the result of uploading an image resource
type: object
properties:
code:
type: integer
format: int32
type:
type: string
message:
type: string

View File

@ -52,9 +52,9 @@ public:
/// <remarks> /// <remarks>
/// ///
/// </remarks> /// </remarks>
/// <param name="body">Pet object that needs to be added to the store</param> /// <param name="pet">Pet object that needs to be added to the store</param>
pplx::task<void> addPet( pplx::task<std::shared_ptr<Pet>> addPet(
std::shared_ptr<Pet> body std::shared_ptr<Pet> pet
) const; ) const;
/// <summary> /// <summary>
/// Deletes a pet /// Deletes a pet
@ -104,9 +104,9 @@ public:
/// <remarks> /// <remarks>
/// ///
/// </remarks> /// </remarks>
/// <param name="body">Pet object that needs to be added to the store</param> /// <param name="pet">Pet object that needs to be added to the store</param>
pplx::task<void> updatePet( pplx::task<std::shared_ptr<Pet>> updatePet(
std::shared_ptr<Pet> body std::shared_ptr<Pet> pet
) const; ) const;
/// <summary> /// <summary>
/// Updates a pet in the store with form data /// Updates a pet in the store with form data

View File

@ -78,9 +78,9 @@ public:
/// <remarks> /// <remarks>
/// ///
/// </remarks> /// </remarks>
/// <param name="body">order placed for purchasing the pet</param> /// <param name="order">order placed for purchasing the pet</param>
pplx::task<std::shared_ptr<Order>> placeOrder( pplx::task<std::shared_ptr<Order>> placeOrder(
std::shared_ptr<Order> body std::shared_ptr<Order> order
) const; ) const;
protected: protected:

View File

@ -50,9 +50,9 @@ public:
/// <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="body">Created user object</param> /// <param name="user">Created user object</param>
pplx::task<void> createUser( pplx::task<void> createUser(
std::shared_ptr<User> body std::shared_ptr<User> user
) const; ) const;
/// <summary> /// <summary>
/// Creates list of users with given input array /// Creates list of users with given input array
@ -60,9 +60,9 @@ public:
/// <remarks> /// <remarks>
/// ///
/// </remarks> /// </remarks>
/// <param name="body">List of user object</param> /// <param name="user">List of user object</param>
pplx::task<void> createUsersWithArrayInput( pplx::task<void> createUsersWithArrayInput(
std::vector<std::shared_ptr<User>> body std::vector<std::shared_ptr<User>> user
) const; ) const;
/// <summary> /// <summary>
/// Creates list of users with given input array /// Creates list of users with given input array
@ -70,9 +70,9 @@ public:
/// <remarks> /// <remarks>
/// ///
/// </remarks> /// </remarks>
/// <param name="body">List of user object</param> /// <param name="user">List of user object</param>
pplx::task<void> createUsersWithListInput( pplx::task<void> createUsersWithListInput(
std::vector<std::shared_ptr<User>> body std::vector<std::shared_ptr<User>> user
) const; ) const;
/// <summary> /// <summary>
/// Delete user /// Delete user
@ -121,10 +121,10 @@ 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">name that need to be deleted</param> /// <param name="username">name that need to be deleted</param>
/// <param name="body">Updated user object</param> /// <param name="user">Updated user object</param>
pplx::task<void> updateUser( pplx::task<void> updateUser(
utility::string_t username, utility::string_t username,
std::shared_ptr<User> body std::shared_ptr<User> user
) const; ) const;
protected: protected:

View File

@ -35,13 +35,13 @@ PetApi::~PetApi()
{ {
} }
pplx::task<void> PetApi::addPet(std::shared_ptr<Pet> body) const pplx::task<std::shared_ptr<Pet>> PetApi::addPet(std::shared_ptr<Pet> pet) const
{ {
// verify the required parameter 'body' is set // verify the required parameter 'pet' is set
if (body == nullptr) if (pet == nullptr)
{ {
throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'body' when calling PetApi->addPet")); throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'pet' when calling PetApi->addPet"));
} }
@ -54,6 +54,8 @@ pplx::task<void> PetApi::addPet(std::shared_ptr<Pet> body) const
std::map<utility::string_t, std::shared_ptr<HttpContent>> localVarFileParams; std::map<utility::string_t, std::shared_ptr<HttpContent>> localVarFileParams;
std::unordered_set<utility::string_t> localVarResponseHttpContentTypes; std::unordered_set<utility::string_t> localVarResponseHttpContentTypes;
localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/xml") );
localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") );
utility::string_t localVarResponseHttpContentType; utility::string_t localVarResponseHttpContentType;
@ -93,7 +95,7 @@ pplx::task<void> PetApi::addPet(std::shared_ptr<Pet> body) const
localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); localVarRequestHttpContentType = utility::conversions::to_string_t("application/json");
web::json::value localVarJson; web::json::value localVarJson;
localVarJson = ModelBase::toJson(body); localVarJson = ModelBase::toJson(pet);
localVarHttpBody = std::shared_ptr<IHttpBody>( new JsonBody( localVarJson ) ); localVarHttpBody = std::shared_ptr<IHttpBody>( new JsonBody( localVarJson ) );
@ -104,9 +106,9 @@ pplx::task<void> PetApi::addPet(std::shared_ptr<Pet> body) const
localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data");
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData); std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
if(body.get()) if(pet.get())
{ {
body->toMultipart(localVarMultipart, utility::conversions::to_string_t("body")); pet->toMultipart(localVarMultipart, utility::conversions::to_string_t("pet"));
} }
@ -161,7 +163,25 @@ pplx::task<void> PetApi::addPet(std::shared_ptr<Pet> body) const
}) })
.then([=](utility::string_t localVarResponse) .then([=](utility::string_t localVarResponse)
{ {
return void(); std::shared_ptr<Pet> localVarResult(new Pet());
if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data"))
// {
// TODO multipart response parsing
// }
else
{
throw ApiException(500
, utility::conversions::to_string_t("error calling addPet: unsupported response type"));
}
return localVarResult;
}); });
} }
pplx::task<void> PetApi::deletePet(int64_t petId, boost::optional<utility::string_t> apiKey) const pplx::task<void> PetApi::deletePet(int64_t petId, boost::optional<utility::string_t> apiKey) const
@ -670,13 +690,13 @@ pplx::task<std::shared_ptr<Pet>> PetApi::getPetById(int64_t petId) const
return localVarResult; return localVarResult;
}); });
} }
pplx::task<void> PetApi::updatePet(std::shared_ptr<Pet> body) const pplx::task<std::shared_ptr<Pet>> PetApi::updatePet(std::shared_ptr<Pet> pet) const
{ {
// verify the required parameter 'body' is set // verify the required parameter 'pet' is set
if (body == nullptr) if (pet == nullptr)
{ {
throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'body' when calling PetApi->updatePet")); throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'pet' when calling PetApi->updatePet"));
} }
@ -689,6 +709,8 @@ pplx::task<void> PetApi::updatePet(std::shared_ptr<Pet> body) const
std::map<utility::string_t, std::shared_ptr<HttpContent>> localVarFileParams; std::map<utility::string_t, std::shared_ptr<HttpContent>> localVarFileParams;
std::unordered_set<utility::string_t> localVarResponseHttpContentTypes; std::unordered_set<utility::string_t> localVarResponseHttpContentTypes;
localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/xml") );
localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") );
utility::string_t localVarResponseHttpContentType; utility::string_t localVarResponseHttpContentType;
@ -728,7 +750,7 @@ pplx::task<void> PetApi::updatePet(std::shared_ptr<Pet> body) const
localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); localVarRequestHttpContentType = utility::conversions::to_string_t("application/json");
web::json::value localVarJson; web::json::value localVarJson;
localVarJson = ModelBase::toJson(body); localVarJson = ModelBase::toJson(pet);
localVarHttpBody = std::shared_ptr<IHttpBody>( new JsonBody( localVarJson ) ); localVarHttpBody = std::shared_ptr<IHttpBody>( new JsonBody( localVarJson ) );
@ -739,9 +761,9 @@ pplx::task<void> PetApi::updatePet(std::shared_ptr<Pet> body) const
localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data");
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData); std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
if(body.get()) if(pet.get())
{ {
body->toMultipart(localVarMultipart, utility::conversions::to_string_t("body")); pet->toMultipart(localVarMultipart, utility::conversions::to_string_t("pet"));
} }
@ -796,7 +818,25 @@ pplx::task<void> PetApi::updatePet(std::shared_ptr<Pet> body) const
}) })
.then([=](utility::string_t localVarResponse) .then([=](utility::string_t localVarResponse)
{ {
return void(); std::shared_ptr<Pet> localVarResult(new Pet());
if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data"))
// {
// TODO multipart response parsing
// }
else
{
throw ApiException(500
, utility::conversions::to_string_t("error calling updatePet: unsupported response type"));
}
return localVarResult;
}); });
} }
pplx::task<void> PetApi::updatePetWithForm(int64_t petId, boost::optional<utility::string_t> name, boost::optional<utility::string_t> status) const pplx::task<void> PetApi::updatePetWithForm(int64_t petId, boost::optional<utility::string_t> name, boost::optional<utility::string_t> status) const

View File

@ -398,13 +398,13 @@ pplx::task<std::shared_ptr<Order>> StoreApi::getOrderById(int64_t orderId) const
return localVarResult; return localVarResult;
}); });
} }
pplx::task<std::shared_ptr<Order>> StoreApi::placeOrder(std::shared_ptr<Order> body) const pplx::task<std::shared_ptr<Order>> StoreApi::placeOrder(std::shared_ptr<Order> order) const
{ {
// verify the required parameter 'body' is set // verify the required parameter 'order' is set
if (body == nullptr) if (order == nullptr)
{ {
throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'body' when calling StoreApi->placeOrder")); throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'order' when calling StoreApi->placeOrder"));
} }
@ -445,6 +445,7 @@ pplx::task<std::shared_ptr<Order>> StoreApi::placeOrder(std::shared_ptr<Order> b
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes; std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") );
std::shared_ptr<IHttpBody> localVarHttpBody; std::shared_ptr<IHttpBody> localVarHttpBody;
@ -456,7 +457,7 @@ pplx::task<std::shared_ptr<Order>> StoreApi::placeOrder(std::shared_ptr<Order> b
localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); localVarRequestHttpContentType = utility::conversions::to_string_t("application/json");
web::json::value localVarJson; web::json::value localVarJson;
localVarJson = ModelBase::toJson(body); localVarJson = ModelBase::toJson(order);
localVarHttpBody = std::shared_ptr<IHttpBody>( new JsonBody( localVarJson ) ); localVarHttpBody = std::shared_ptr<IHttpBody>( new JsonBody( localVarJson ) );
@ -467,9 +468,9 @@ pplx::task<std::shared_ptr<Order>> StoreApi::placeOrder(std::shared_ptr<Order> b
localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data");
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData); std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
if(body.get()) if(order.get())
{ {
body->toMultipart(localVarMultipart, utility::conversions::to_string_t("body")); order->toMultipart(localVarMultipart, utility::conversions::to_string_t("order"));
} }

View File

@ -35,13 +35,13 @@ UserApi::~UserApi()
{ {
} }
pplx::task<void> UserApi::createUser(std::shared_ptr<User> body) const pplx::task<void> UserApi::createUser(std::shared_ptr<User> user) const
{ {
// verify the required parameter 'body' is set // verify the required parameter 'user' is set
if (body == nullptr) if (user == nullptr)
{ {
throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'body' when calling UserApi->createUser")); throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'user' when calling UserApi->createUser"));
} }
@ -80,6 +80,7 @@ pplx::task<void> UserApi::createUser(std::shared_ptr<User> body) const
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes; std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") );
std::shared_ptr<IHttpBody> localVarHttpBody; std::shared_ptr<IHttpBody> localVarHttpBody;
@ -91,7 +92,7 @@ pplx::task<void> UserApi::createUser(std::shared_ptr<User> body) const
localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); localVarRequestHttpContentType = utility::conversions::to_string_t("application/json");
web::json::value localVarJson; web::json::value localVarJson;
localVarJson = ModelBase::toJson(body); localVarJson = ModelBase::toJson(user);
localVarHttpBody = std::shared_ptr<IHttpBody>( new JsonBody( localVarJson ) ); localVarHttpBody = std::shared_ptr<IHttpBody>( new JsonBody( localVarJson ) );
@ -102,9 +103,9 @@ pplx::task<void> UserApi::createUser(std::shared_ptr<User> body) const
localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data");
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData); std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
if(body.get()) if(user.get())
{ {
body->toMultipart(localVarMultipart, utility::conversions::to_string_t("body")); user->toMultipart(localVarMultipart, utility::conversions::to_string_t("user"));
} }
@ -120,6 +121,14 @@ pplx::task<void> UserApi::createUser(std::shared_ptr<User> body) const
throw ApiException(415, utility::conversions::to_string_t("UserApi->createUser does not consume any supported media type")); throw ApiException(415, utility::conversions::to_string_t("UserApi->createUser does not consume any supported media type"));
} }
// authentication (api_key) required
{
utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("api_key"));
if ( localVarApiKey.size() > 0 )
{
localVarHeaderParams[utility::conversions::to_string_t("api_key")] = localVarApiKey;
}
}
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=](web::http::http_response localVarResponse) .then([=](web::http::http_response localVarResponse)
@ -160,7 +169,7 @@ pplx::task<void> UserApi::createUser(std::shared_ptr<User> body) const
return void(); return void();
}); });
} }
pplx::task<void> UserApi::createUsersWithArrayInput(std::vector<std::shared_ptr<User>> body) const pplx::task<void> UserApi::createUsersWithArrayInput(std::vector<std::shared_ptr<User>> user) const
{ {
@ -199,6 +208,7 @@ pplx::task<void> UserApi::createUsersWithArrayInput(std::vector<std::shared_ptr<
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes; std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") );
std::shared_ptr<IHttpBody> localVarHttpBody; std::shared_ptr<IHttpBody> localVarHttpBody;
@ -212,7 +222,7 @@ pplx::task<void> UserApi::createUsersWithArrayInput(std::vector<std::shared_ptr<
{ {
std::vector<web::json::value> localVarJsonArray; std::vector<web::json::value> localVarJsonArray;
for( auto& localVarItem : body ) for( auto& localVarItem : user )
{ {
localVarJsonArray.push_back( localVarItem.get() ? localVarItem->toJson() : web::json::value::null() ); localVarJsonArray.push_back( localVarItem.get() ? localVarItem->toJson() : web::json::value::null() );
@ -230,11 +240,11 @@ pplx::task<void> UserApi::createUsersWithArrayInput(std::vector<std::shared_ptr<
{ {
std::vector<web::json::value> localVarJsonArray; std::vector<web::json::value> localVarJsonArray;
for( auto& localVarItem : body ) for( auto& localVarItem : user )
{ {
localVarJsonArray.push_back(ModelBase::toJson(localVarItem)); localVarJsonArray.push_back(ModelBase::toJson(localVarItem));
} }
localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("body"), localVarJsonArray, utility::conversions::to_string_t("application/json"))); localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("user"), localVarJsonArray, utility::conversions::to_string_t("application/json")));
} }
@ -250,6 +260,14 @@ pplx::task<void> UserApi::createUsersWithArrayInput(std::vector<std::shared_ptr<
throw ApiException(415, utility::conversions::to_string_t("UserApi->createUsersWithArrayInput does not consume any supported media type")); throw ApiException(415, utility::conversions::to_string_t("UserApi->createUsersWithArrayInput does not consume any supported media type"));
} }
// authentication (api_key) required
{
utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("api_key"));
if ( localVarApiKey.size() > 0 )
{
localVarHeaderParams[utility::conversions::to_string_t("api_key")] = localVarApiKey;
}
}
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=](web::http::http_response localVarResponse) .then([=](web::http::http_response localVarResponse)
@ -290,7 +308,7 @@ pplx::task<void> UserApi::createUsersWithArrayInput(std::vector<std::shared_ptr<
return void(); return void();
}); });
} }
pplx::task<void> UserApi::createUsersWithListInput(std::vector<std::shared_ptr<User>> body) const pplx::task<void> UserApi::createUsersWithListInput(std::vector<std::shared_ptr<User>> user) const
{ {
@ -329,6 +347,7 @@ pplx::task<void> UserApi::createUsersWithListInput(std::vector<std::shared_ptr<U
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes; std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") );
std::shared_ptr<IHttpBody> localVarHttpBody; std::shared_ptr<IHttpBody> localVarHttpBody;
@ -342,7 +361,7 @@ pplx::task<void> UserApi::createUsersWithListInput(std::vector<std::shared_ptr<U
{ {
std::vector<web::json::value> localVarJsonArray; std::vector<web::json::value> localVarJsonArray;
for( auto& localVarItem : body ) for( auto& localVarItem : user )
{ {
localVarJsonArray.push_back( localVarItem.get() ? localVarItem->toJson() : web::json::value::null() ); localVarJsonArray.push_back( localVarItem.get() ? localVarItem->toJson() : web::json::value::null() );
@ -360,11 +379,11 @@ pplx::task<void> UserApi::createUsersWithListInput(std::vector<std::shared_ptr<U
{ {
std::vector<web::json::value> localVarJsonArray; std::vector<web::json::value> localVarJsonArray;
for( auto& localVarItem : body ) for( auto& localVarItem : user )
{ {
localVarJsonArray.push_back(ModelBase::toJson(localVarItem)); localVarJsonArray.push_back(ModelBase::toJson(localVarItem));
} }
localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("body"), localVarJsonArray, utility::conversions::to_string_t("application/json"))); localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("user"), localVarJsonArray, utility::conversions::to_string_t("application/json")));
} }
@ -380,6 +399,14 @@ pplx::task<void> UserApi::createUsersWithListInput(std::vector<std::shared_ptr<U
throw ApiException(415, utility::conversions::to_string_t("UserApi->createUsersWithListInput does not consume any supported media type")); throw ApiException(415, utility::conversions::to_string_t("UserApi->createUsersWithListInput does not consume any supported media type"));
} }
// authentication (api_key) required
{
utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("api_key"));
if ( localVarApiKey.size() > 0 )
{
localVarHeaderParams[utility::conversions::to_string_t("api_key")] = localVarApiKey;
}
}
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=](web::http::http_response localVarResponse) .then([=](web::http::http_response localVarResponse)
@ -484,6 +511,14 @@ pplx::task<void> UserApi::deleteUser(utility::string_t username) const
throw ApiException(415, utility::conversions::to_string_t("UserApi->deleteUser does not consume any supported media type")); throw ApiException(415, utility::conversions::to_string_t("UserApi->deleteUser does not consume any supported media type"));
} }
// authentication (api_key) required
{
utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("api_key"));
if ( localVarApiKey.size() > 0 )
{
localVarHeaderParams[utility::conversions::to_string_t("api_key")] = localVarApiKey;
}
}
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("DELETE"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("DELETE"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=](web::http::http_response localVarResponse) .then([=](web::http::http_response localVarResponse)
@ -849,6 +884,14 @@ pplx::task<void> UserApi::logoutUser() const
throw ApiException(415, utility::conversions::to_string_t("UserApi->logoutUser does not consume any supported media type")); throw ApiException(415, utility::conversions::to_string_t("UserApi->logoutUser does not consume any supported media type"));
} }
// authentication (api_key) required
{
utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("api_key"));
if ( localVarApiKey.size() > 0 )
{
localVarHeaderParams[utility::conversions::to_string_t("api_key")] = localVarApiKey;
}
}
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=](web::http::http_response localVarResponse) .then([=](web::http::http_response localVarResponse)
@ -889,13 +932,13 @@ pplx::task<void> UserApi::logoutUser() const
return void(); return void();
}); });
} }
pplx::task<void> UserApi::updateUser(utility::string_t username, std::shared_ptr<User> body) const pplx::task<void> UserApi::updateUser(utility::string_t username, std::shared_ptr<User> user) const
{ {
// verify the required parameter 'body' is set // verify the required parameter 'user' is set
if (body == nullptr) if (user == nullptr)
{ {
throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'body' when calling UserApi->updateUser")); throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'user' when calling UserApi->updateUser"));
} }
@ -935,6 +978,7 @@ pplx::task<void> UserApi::updateUser(utility::string_t username, std::shared_ptr
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes; std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") );
std::shared_ptr<IHttpBody> localVarHttpBody; std::shared_ptr<IHttpBody> localVarHttpBody;
@ -946,7 +990,7 @@ pplx::task<void> UserApi::updateUser(utility::string_t username, std::shared_ptr
localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); localVarRequestHttpContentType = utility::conversions::to_string_t("application/json");
web::json::value localVarJson; web::json::value localVarJson;
localVarJson = ModelBase::toJson(body); localVarJson = ModelBase::toJson(user);
localVarHttpBody = std::shared_ptr<IHttpBody>( new JsonBody( localVarJson ) ); localVarHttpBody = std::shared_ptr<IHttpBody>( new JsonBody( localVarJson ) );
@ -957,9 +1001,9 @@ pplx::task<void> UserApi::updateUser(utility::string_t username, std::shared_ptr
localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data");
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData); std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
if(body.get()) if(user.get())
{ {
body->toMultipart(localVarMultipart, utility::conversions::to_string_t("body")); user->toMultipart(localVarMultipart, utility::conversions::to_string_t("user"));
} }
@ -975,6 +1019,14 @@ pplx::task<void> UserApi::updateUser(utility::string_t username, std::shared_ptr
throw ApiException(415, utility::conversions::to_string_t("UserApi->updateUser does not consume any supported media type")); throw ApiException(415, utility::conversions::to_string_t("UserApi->updateUser does not consume any supported media type"));
} }
// authentication (api_key) required
{
utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("api_key"));
if ( localVarApiKey.size() > 0 )
{
localVarHeaderParams[utility::conversions::to_string_t("api_key")] = localVarApiKey;
}
}
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("PUT"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("PUT"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=](web::http::http_response localVarResponse) .then([=](web::http::http_response localVarResponse)