/** * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI-Generator unset. * https://openapi-generator.tech * Do not edit the class manually. */ /* * StoreApi.h * * */ #ifndef StoreApi_H_ #define StoreApi_H_ #include #include #include #include #include #include #include #include #include "Order.h" #include #include namespace org { namespace openapitools { namespace server { namespace api { using namespace org::openapitools::server::model; /// /// Exception to flag problems in the handlers /// class StoreApiException: public std::exception { public: StoreApiException(int status_code, std::string what); int getStatus() const; const char* what() const noexcept override; private: int m_status; std::string m_what; }; /// /// Delete purchase order by ID /// /// /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors /// class StoreApiStoreOrderOrderIdResource: public restbed::Resource { public: StoreApiStoreOrderOrderIdResource(const std::string& context = "/v2"); virtual ~StoreApiStoreOrderOrderIdResource(); protected: ////////////////////////////////////////////////////////// // Override these to implement the server functionality // ////////////////////////////////////////////////////////// virtual int handler_DELETE( std::string const & orderId); virtual std::pair> handler_GET( int64_t const & orderId); protected: ////////////////////////////////////// // Override these for customization // ////////////////////////////////////// virtual std::string extractBodyContent(const std::shared_ptr& session); virtual std::string getPathParam_orderId(const std::shared_ptr& request) { return request->get_path_parameter("orderId", ""); } virtual int64_t getPathParam_orderId_x_extension(const std::shared_ptr& request) { return request->get_path_parameter("orderId", 0L); } virtual std::pair handleStoreApiException(const StoreApiException& e); virtual std::pair handleStdException(const std::exception& e); virtual std::pair handleUnspecifiedException(); virtual void setResponseHeader(const std::shared_ptr& session, const std::string& header); virtual void returnResponse(const std::shared_ptr& session, const int status, const std::string& result, const std::string& contentType); virtual void defaultSessionClose(const std::shared_ptr& session, const int status, const std::string& result); private: void handler_DELETE_internal(const std::shared_ptr session); void handler_GET_internal(const std::shared_ptr session); }; /// /// Returns pet inventories by status /// /// /// Returns a map of status codes to quantities /// class StoreApiStoreInventoryResource: public restbed::Resource { public: StoreApiStoreInventoryResource(const std::string& context = "/v2"); virtual ~StoreApiStoreInventoryResource(); protected: ////////////////////////////////////////////////////////// // Override these to implement the server functionality // ////////////////////////////////////////////////////////// virtual std::pair> handler_GET( ); protected: ////////////////////////////////////// // Override these for customization // ////////////////////////////////////// virtual std::string extractBodyContent(const std::shared_ptr& session); virtual std::pair handleStoreApiException(const StoreApiException& e); virtual std::pair handleStdException(const std::exception& e); virtual std::pair handleUnspecifiedException(); virtual void setResponseHeader(const std::shared_ptr& session, const std::string& header); virtual void returnResponse(const std::shared_ptr& session, const int status, const std::string& result, const std::string& contentType); virtual void defaultSessionClose(const std::shared_ptr& session, const int status, const std::string& result); private: void handler_GET_internal(const std::shared_ptr session); }; /// /// Place an order for a pet /// /// /// /// class StoreApiStoreOrderResource: public restbed::Resource { public: StoreApiStoreOrderResource(const std::string& context = "/v2"); virtual ~StoreApiStoreOrderResource(); protected: ////////////////////////////////////////////////////////// // Override these to implement the server functionality // ////////////////////////////////////////////////////////// virtual std::pair> handler_POST( std::shared_ptr const & body); protected: ////////////////////////////////////// // Override these for customization // ////////////////////////////////////// virtual std::string extractBodyContent(const std::shared_ptr& session); virtual std::pair handleStoreApiException(const StoreApiException& e); virtual std::pair handleStdException(const std::exception& e); virtual std::pair handleUnspecifiedException(); virtual void setResponseHeader(const std::shared_ptr& session, const std::string& header); virtual void returnResponse(const std::shared_ptr& session, const int status, const std::string& result, const std::string& contentType); virtual void defaultSessionClose(const std::shared_ptr& session, const int status, const std::string& result); private: void handler_POST_internal(const std::shared_ptr session); }; // // The restbed service to actually implement the REST server // class StoreApi { public: explicit StoreApi(std::shared_ptr const& restbedService); virtual ~StoreApi(); virtual void setStoreApiStoreOrderOrderIdResource(std::shared_ptr spStoreApiStoreOrderOrderIdResource); virtual void setStoreApiStoreInventoryResource(std::shared_ptr spStoreApiStoreInventoryResource); virtual void setStoreApiStoreOrderResource(std::shared_ptr spStoreApiStoreOrderResource); virtual void publishDefaultResources(); virtual std::shared_ptr service(); protected: std::shared_ptr m_spStoreApiStoreOrderOrderIdResource; std::shared_ptr m_spStoreApiStoreInventoryResource; std::shared_ptr m_spStoreApiStoreOrderResource; private: std::shared_ptr m_service; }; } } } } #endif /* StoreApi_H_ */