[CppRest] Support optional parameters (#6959)

* Use boost::optional for parameters that are not required.

* Update sample petstore client.
This commit is contained in:
François Rosé
2017-11-22 05:13:05 +01:00
committed by William Cheng
parent 803f337d24
commit d9cea0f97e
7 changed files with 134 additions and 55 deletions

View File

@@ -26,6 +26,8 @@
#include <map>
#include <cpprest/details/basic_types.h>
#include <boost/optional.hpp>
namespace io {
namespace swagger {
namespace client {
@@ -45,15 +47,17 @@ public:
/// For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
/// </remarks>
/// <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>
/// Returns pet inventories by status
/// </summary>
/// <remarks>
/// Returns a map of status codes to quantities
/// </remarks>
pplx::task<std::map<utility::string_t, int32_t>> getInventory();
pplx::task<std::map<utility::string_t, int32_t>> getInventory(
);
/// <summary>
/// Find purchase order by ID
/// </summary>
@@ -61,7 +65,9 @@ public:
/// For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 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(int64_t orderId);
pplx::task<std::shared_ptr<Order>> getOrderById(
int64_t orderId
);
/// <summary>
/// Place an order for a pet
/// </summary>
@@ -69,7 +75,9 @@ public:
///
/// </remarks>
/// <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:
std::shared_ptr<ApiClient> m_ApiClient;