|
10Duke Scale C++ Client
|
#include <AbstractAPIRequestMixin.h>
Abstract base-class with generic implementation for 10Duke Scale API requests.
This class implements a generic framework for simple API requests, mostly GET-requests. In most cases it is enough for the concrete request to implement JSON deserialization and URL-building.
| T | type of the response |
Public Member Functions | |
| AbstractAPIRequestMixin (const ::tenduke::net::URL &baseUrl, const std::shared_ptr< const ::tenduke::http::HTTPClient > &httpClient, const std::shared_ptr< const ::tenduke::http::HTTPRequestAuthenticator > &httpRequestAuthenticator, const std::shared_ptr< const ::tenduke::http::HTTPResponseToException > &throwException, const std::shared_ptr< const ::tenduke::json::JSONParser > &jsonParser) | |
| Constructs a new instance. | |
Protected Member Functions | |
| virtual T | executeRequest () |
| Executes the request. | |
| virtual T | fromJSON (const std::string &responseBody) const =0 |
| Converts the response body from JSON to the response type. | |
| virtual void | buildUrl (::tenduke::net::URLBuilder &urlBuilder) const |
| Builds the request URL. | |
| virtual::tenduke::http::HTTPRequestBuilder & | setHeaders (::tenduke::http::HTTPRequestBuilder &request) const |
| Sets additional headers. | |
Protected Attributes | |
| const ::tenduke::net::URL | baseUrl |
| Base-URL for the request. | |
| const std::shared_ptr< const ::tenduke::http::HTTPClient > | http |
| HTTP-client to execute the request. | |
| const std::shared_ptr< const ::tenduke::http::HTTPRequestAuthenticator > | httpRequestAuthenticator |
| For authenticating the request. | |
| const std::shared_ptr< const ::tenduke::http::HTTPResponseToException > | throwException |
| Service to throw exceptions based on HTTP status codes. | |
| const std::shared_ptr< const ::tenduke::json::JSONParser > | parseJSON |
| For parsing the response payload. | |
|
inline |
Constructs a new instance.
| baseUrl | - |
| httpClient | - |
| httpRequestAuthenticator | - |
| throwException | - |
| jsonParser | - |
|
inlineprotectedvirtual |
Builds the request URL.
| urlBuilder | - |
Reimplemented in DefaultDescribeLicenseConsumerClientBindingsRequest, DefaultDescribeLicenseConsumerLicenseesRequest, DefaultDescribeLicenseConsumerLicensesRequest, DefaultDescribeLicenseKeyRequest, tenduke::se::licensing::rest::DefaultDescribeLicenseConsumerClientBindingsRequest, tenduke::se::licensing::rest::DefaultDescribeLicenseConsumerLicenseesRequest, tenduke::se::licensing::rest::DefaultDescribeLicenseConsumerLicensesRequest, and tenduke::se::licensing::rest::DefaultDescribeLicenseKeyRequest.
|
inlineprotectedvirtual |
Executes the request.
|
protectedpure virtual |
Converts the response body from JSON to the response type.
| responseBody | - |
Implemented in DefaultDescribeLicenseConsumerClientBindingsRequest, DefaultDescribeLicenseConsumerLicenseesRequest, DefaultDescribeLicenseConsumerLicensesRequest, DefaultDescribeLicenseKeyRequest, tenduke::se::licensing::rest::DefaultDescribeLicenseConsumerClientBindingsRequest, tenduke::se::licensing::rest::DefaultDescribeLicenseConsumerLicenseesRequest, tenduke::se::licensing::rest::DefaultDescribeLicenseConsumerLicensesRequest, and tenduke::se::licensing::rest::DefaultDescribeLicenseKeyRequest.
|
inlineprotected |
Sets additional headers.
| request | - |
|
protected |
Base-URL for the request.
The implementation may add e.g. query parameters to this.
|
protected |
For authenticating the request.
Optional.