Skip to content

Commit 8c9f516

Browse files
committed
Update cpprest client sample
1 parent 8722a53 commit 8c9f516

40 files changed

+66
-44
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.4.3-SNAPSHOT
1+
2.4.11-SNAPSHOT

samples/client/petstore/cpprest/ApiClient.cpp

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* OpenAPI spec version: 1.0.0
66
* Contact: [email protected]
77
*
8-
* NOTE: This class is auto generated by the swagger code generator 2.4.3-SNAPSHOT.
8+
* NOTE: This class is auto generated by the swagger code generator 2.4.11-SNAPSHOT.
99
* https://github.com/swagger-api/swagger-codegen.git
1010
* Do not edit the class manually.
1111
*/
@@ -43,6 +43,14 @@ utility::string_t ApiClient::parameterToString(utility::string_t value)
4343
{
4444
return value;
4545
}
46+
47+
utility::string_t ApiClient::parameterToString(bool value)
48+
{
49+
std::stringstream valueAsStringStream;
50+
valueAsStringStream << (value ? "true" : "false");
51+
return utility::conversions::to_string_t(valueAsStringStream.str());
52+
}
53+
4654
utility::string_t ApiClient::parameterToString(int64_t value)
4755
{
4856
std::stringstream valueAsStringStream;
@@ -144,7 +152,20 @@ pplx::task<web::http::http_response> ApiClient::callApi(
144152
if (!formParams.empty())
145153
{
146154
request.set_body(body_data);
147-
}
155+
}
156+
}
157+
else if (contentType == utility::conversions::to_string_t("multipart/form-data"))
158+
{
159+
MultipartFormData uploadData;
160+
for (auto& kvp : formParams)
161+
{
162+
uploadData.add(ModelBase::toHttpContent(kvp.first, kvp.second));
163+
}
164+
std::stringstream data;
165+
uploadData.writeTo(data);
166+
auto bodyString = data.str();
167+
auto length = bodyString.size();
168+
request.set_body(concurrency::streams::bytestream::open_istream(std::move(bodyString)), length, utility::conversions::to_string_t("multipart/form-data; boundary=") + uploadData.getBoundary());
148169
}
149170
else
150171
{

samples/client/petstore/cpprest/ApiClient.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* OpenAPI spec version: 1.0.0
66
* Contact: [email protected]
77
*
8-
* NOTE: This class is auto generated by the swagger code generator 2.4.3-SNAPSHOT.
8+
* NOTE: This class is auto generated by the swagger code generator 2.4.11-SNAPSHOT.
99
* https://github.com/swagger-api/swagger-codegen.git
1010
* Do not edit the class manually.
1111
*/
@@ -48,6 +48,7 @@ class ApiClient
4848
void setConfiguration(std::shared_ptr<ApiConfiguration> configuration);
4949

5050
static utility::string_t parameterToString(utility::string_t value);
51+
static utility::string_t parameterToString(bool value);
5152
static utility::string_t parameterToString(int32_t value);
5253
static utility::string_t parameterToString(int64_t value);
5354
static utility::string_t parameterToString(float value);

samples/client/petstore/cpprest/ApiConfiguration.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* OpenAPI spec version: 1.0.0
66
* Contact: [email protected]
77
*
8-
* NOTE: This class is auto generated by the swagger code generator 2.4.3-SNAPSHOT.
8+
* NOTE: This class is auto generated by the swagger code generator 2.4.11-SNAPSHOT.
99
* https://github.com/swagger-api/swagger-codegen.git
1010
* Do not edit the class manually.
1111
*/

samples/client/petstore/cpprest/ApiConfiguration.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* OpenAPI spec version: 1.0.0
66
* Contact: [email protected]
77
*
8-
* NOTE: This class is auto generated by the swagger code generator 2.4.3-SNAPSHOT.
8+
* NOTE: This class is auto generated by the swagger code generator 2.4.11-SNAPSHOT.
99
* https://github.com/swagger-api/swagger-codegen.git
1010
* Do not edit the class manually.
1111
*/

samples/client/petstore/cpprest/ApiException.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* OpenAPI spec version: 1.0.0
66
* Contact: [email protected]
77
*
8-
* NOTE: This class is auto generated by the swagger code generator 2.4.3-SNAPSHOT.
8+
* NOTE: This class is auto generated by the swagger code generator 2.4.11-SNAPSHOT.
99
* https://github.com/swagger-api/swagger-codegen.git
1010
* Do not edit the class manually.
1111
*/

samples/client/petstore/cpprest/ApiException.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* OpenAPI spec version: 1.0.0
66
* Contact: [email protected]
77
*
8-
* NOTE: This class is auto generated by the swagger code generator 2.4.3-SNAPSHOT.
8+
* NOTE: This class is auto generated by the swagger code generator 2.4.11-SNAPSHOT.
99
* https://github.com/swagger-api/swagger-codegen.git
1010
* Do not edit the class manually.
1111
*/

samples/client/petstore/cpprest/HttpContent.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* OpenAPI spec version: 1.0.0
66
* Contact: [email protected]
77
*
8-
* NOTE: This class is auto generated by the swagger code generator 2.4.3-SNAPSHOT.
8+
* NOTE: This class is auto generated by the swagger code generator 2.4.11-SNAPSHOT.
99
* https://github.com/swagger-api/swagger-codegen.git
1010
* Do not edit the class manually.
1111
*/

samples/client/petstore/cpprest/HttpContent.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* OpenAPI spec version: 1.0.0
66
* Contact: [email protected]
77
*
8-
* NOTE: This class is auto generated by the swagger code generator 2.4.3-SNAPSHOT.
8+
* NOTE: This class is auto generated by the swagger code generator 2.4.11-SNAPSHOT.
99
* https://github.com/swagger-api/swagger-codegen.git
1010
* Do not edit the class manually.
1111
*/

samples/client/petstore/cpprest/IHttpBody.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* OpenAPI spec version: 1.0.0
66
* Contact: [email protected]
77
*
8-
* NOTE: This class is auto generated by the swagger code generator 2.4.3-SNAPSHOT.
8+
* NOTE: This class is auto generated by the swagger code generator 2.4.11-SNAPSHOT.
99
* https://github.com/swagger-api/swagger-codegen.git
1010
* Do not edit the class manually.
1111
*/

0 commit comments

Comments
 (0)