10Duke Scale C++ Client
Loading...
Searching...
No Matches
AbstractPagingAPIRequest.h
1#ifndef TENDUKE_SE_LICENSING_ABSTRACTPAGINGAPIREQUEST_H
2#define TENDUKE_SE_LICENSING_ABSTRACTPAGINGAPIREQUEST_H
3
4#include <utility>
5
6#include "./AbstractAPIRequestMixin.h"
7#include "../Paging.h"
8
9namespace tenduke { namespace se { namespace licensing { namespace rest {
10
15template<class T>
17{
18public:
29 const ::tenduke::net::URL &baseUrl
30 , const std::shared_ptr<const ::tenduke::http::HTTPClient> &httpClient
31 , const std::shared_ptr<const ::tenduke::http::HTTPRequestAuthenticator> &httpRequestAuthenticator
32 , const std::shared_ptr<const ::tenduke::http::HTTPResponseToException> &throwException
33 , const std::shared_ptr<const ::tenduke::json::JSONParser> &jsonParser
37 , httpClient
40 , jsonParser
41 )
42 , paging(std::move(paging))
43 {}
44
45protected:
52 const override
53 {
54 if (paging.offset >= 0) {
55 request.header("offset", std::to_string(paging.offset));
56 }
57 if (paging.limit >= 0) {
58 request.header("limit", std::to_string(paging.limit));
59 }
60 request.header("order-by", (paging.orderBy));
61 if (paging.orderAsc) {
62 request.header("orderAsc", "true");
63 }
64 return request;
65 }
66
67private:
69};
70
71}}}}
72
73#endif //TENDUKE_SE_LICENSING_ABSTRACTPAGINGAPIREQUEST_H
AbstractPagingAPIRequest(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, ::tenduke::se::Paging paging)
Constructs a new instance.
Definition AbstractPagingAPIRequest.h:28
Builds HTTPRequest.
Definition HTTPRequestBuilder.h:23
HTTPRequestBuilder & header(const std::string &name, const std::string &value, bool skipIfValueEmpty=true)
Adds header to the request.
Definition HTTPRequestBuilder.cpp:129
Paging-ocnfiguration for the REST-API.
Definition Paging.h:13
Abstract base-class with generic implementation for 10Duke Scale API requests.
Definition AbstractAPIRequestMixin.h:23
const std::shared_ptr< const ::tenduke::http::HTTPResponseToException > throwException
Service to throw exceptions based on HTTP status codes.
Definition AbstractAPIRequestMixin.h:114
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.
Definition AbstractAPIRequestMixin.h:33
const std::shared_ptr< const ::tenduke::http::HTTPRequestAuthenticator > httpRequestAuthenticator
For authenticating the request.
Definition AbstractAPIRequestMixin.h:111
const ::tenduke::net::URL baseUrl
Base-URL for the request.
Definition AbstractAPIRequestMixin.h:105
::tenduke::http::HTTPRequestBuilder & setHeaders(::tenduke::http::HTTPRequestBuilder &request) const override
Sets the paging headers to the request.
Definition AbstractPagingAPIRequest.h:51
AbstractPagingAPIRequest(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, ::tenduke::se::Paging paging)
Constructs a new instance.
Definition AbstractPagingAPIRequest.h:28
Low-level services for performing licensing REST-requests.
Definition DefaultDescribeLicenseConsumerClientBindingsRequest.h:9
Licensing operations for 10Duke Scale.
Definition LicenseConsumerClientBindingStatus.h:8
Classes, functions and globals of 10Duke Scale C++ Client.
Definition AbstractClientFactory.h:16
Root for classes, functions and globals of 10Duke C++ Client.
Definition AbstractClientFactory.h:16