10Duke Scale C++ Client
Loading...
Searching...
No Matches
AbstractLicenseRequest.h
1#ifndef TENDUKE_SE_LICENSING_REST_ABSTRACTLICENSEREQUEST_H
2#define TENDUKE_SE_LICENSING_REST_ABSTRACTLICENSEREQUEST_H
3
4#include "../../../config/BackendConfiguration.h"
5#include "../../../config/ClientProperties.h"
6#include "http/HTTPClient.h"
7#include "http/HTTPRequestAuthenticator.h"
8#include "http/HTTPResponseToException.h"
9#include "json/JSONParser.h"
10
11#include <memory>
12
13
14namespace tenduke { namespace se { namespace licensing { namespace rest {
15
20{
21public:
23 static const std::string NO_LICENSE_KEY;
24
26 static const bool METERED;
28 static const bool NON_METERED;
29
30public:
43 std::string licenseKey,
44 bool metered,
45 const std::shared_ptr<const ::tenduke::se::ClientProperties> &clientProperties,
46 const std::shared_ptr<const ::tenduke::se::BackendConfiguration> &configuration,
47 const std::shared_ptr<const ::tenduke::http::HTTPClient> &httpClient,
48 const std::shared_ptr<const ::tenduke::http::HTTPRequestAuthenticator> &httpRequestAuthenticator,
49 const std::shared_ptr<const ::tenduke::http::HTTPResponseToException> &throwException,
50 const std::shared_ptr<const ::tenduke::json::JSONParser> &jsonParser
51 );
52
53protected:
58 std::string getLicenseKey() const;
59
64 bool hasLicenseKey() const;
65
67 bool isMetered() const;
68
69private:
70 // parameters
71 const std::string licenseKey; // If empty, then this is non-licensekey request
72 const bool metered; // metered or not
73
74protected:
75 // configuration
77 const std::shared_ptr<const ::tenduke::se::ClientProperties> clientProperties;
79 const std::shared_ptr<const ::tenduke::se::BackendConfiguration> configuration;
80
81 // services required
83 const std::shared_ptr<const ::tenduke::http::HTTPClient> http;
85 const std::shared_ptr<const ::tenduke::http::HTTPRequestAuthenticator> httpRequestAuthenticator;
87 const std::shared_ptr<const ::tenduke::http::HTTPResponseToException> throwException;
89 const std::shared_ptr<const ::tenduke::json::JSONParser> parseJSON;
90};
91
92}}}}
93
94#endif //TENDUKE_SE_LICENSING_REST_ABSTRACTLICENSEREQUEST_H
Abstract base class for license-related requests.
Definition AbstractLicenseRequest.h:20
static const bool NON_METERED
Magic value to indicate that this is normal (not metered) license request.
Definition AbstractLicenseRequest.h:28
static const std::string NO_LICENSE_KEY
Magic value to indicate that this is not a license key request.
Definition AbstractLicenseRequest.h:23
static const bool METERED
Magic value to indicate that this is metered license request.
Definition AbstractLicenseRequest.h:26
const std::shared_ptr< const ::tenduke::http::HTTPClient > http
HTTP-client.
Definition AbstractLicenseRequest.h:83
const std::shared_ptr< const ::tenduke::http::HTTPRequestAuthenticator > httpRequestAuthenticator
HTTP-request authenticator.
Definition AbstractLicenseRequest.h:85
const std::shared_ptr< const ::tenduke::http::HTTPResponseToException > throwException
Throw-exception.
Definition AbstractLicenseRequest.h:87
bool isMetered() const
Checks if this metered-request.
std::string getLicenseKey() const
Returns license key.
Definition AbstractLicenseRequest.cpp:14
bool hasLicenseKey() const
Checks if this is license-key request.
Definition AbstractLicenseRequest.cpp:20
const std::shared_ptr< const ::tenduke::se::ClientProperties > clientProperties
Client properties.
Definition AbstractLicenseRequest.h:77
const std::shared_ptr< const ::tenduke::se::BackendConfiguration > configuration
Config.
Definition AbstractLicenseRequest.h:79
const std::shared_ptr< const ::tenduke::json::JSONParser > parseJSON
Parses JSON.
Definition AbstractLicenseRequest.h:89
Root for classes, functions and globals of 10Duke C++ Client.
Definition BackendConfiguration.h:7