10Duke Scale C++ Client
Loading...
Searching...
No Matches
FluentHeartbeatBuilder.h
1#ifndef TENDUKE_SE_LICENSING_FLUENTHEARTBEATBUILDER_H
2#define TENDUKE_SE_LICENSING_FLUENTHEARTBEATBUILDER_H
3
4#include "../../Lease.h"
5#include "./LicenseHeartbeatArguments.h"
6
7#include <cstdint>
8#include <string>
9#include <utility>
10#include <vector>
11
12namespace tenduke { namespace se { namespace licensing {
13
14class LicensingClient;
15
20template <typename Builder>
22{
23public:
28 explicit FluentHeartbeatBuilder(std::string licenseKey = "")
29 : licenseKey(std::move(licenseKey))
30 {}
31
32public:
38 Builder & lease(const ::tenduke::se::licensing::Lease & lease)
39 {
40 return this->lease(lease.leaseId, lease.clientVersion);
41 }
42
48 Builder & leases(const std::vector<::tenduke::se::licensing::Lease> & licenses)
49 {
50 for (auto const &leaseToHeartbeat : licenses) {
51 lease(leaseToHeartbeat);
52 }
53 return static_cast<Builder &>(*this);
54 }
55
65 Builder & lease(
66 const std::string &leaseId,
67 std::string clientVersion = ""
68 )
69 {
70 return lease(leaseId, 1, false, std::move(clientVersion));
71 }
72
87 Builder & lease(
88 const std::string &leaseId,
89 std::int64_t usedQty,
90 bool treatAsIncrementalQty = false,
91 std::string clientVersion = ""
92 ) {
93 arguments.emplace_back(
94 leaseId,
95 treatAsIncrementalQty,
96 usedQty,
97 std::move(clientVersion)
98 );
99 return static_cast<Builder &>(*this);
100 }
101
102protected:
104 const std::string licenseKey;
105
107 std::vector<::tenduke::se::licensing::LicenseHeartbeatArguments> arguments;
108};
109
110}}}
111
112#endif //TENDUKE_SE_LICENSING_FLUENTHEARTBEATBUILDER_H
FluentHeartbeatBuilder(std::string licenseKey="")
Constructs new instance.
Definition FluentHeartbeatBuilder.h:28
Builder & leases(const std::vector<::tenduke::se::licensing::Lease > &licenses)
Adds multiple leases to heartbeat.
Definition FluentHeartbeatBuilder.h:48
Builder & lease(const std::string &leaseId, std::int64_t usedQty, bool treatAsIncrementalQty=false, std::string clientVersion="")
Adds a lease id to heartbeat updating usage.
Definition FluentHeartbeatBuilder.h:87
Builder & lease(const ::tenduke::se::licensing::Lease &lease)
Adds a lease to heartbeat.
Definition FluentHeartbeatBuilder.h:38
Builder & lease(const std::string &leaseId, std::string clientVersion="")
Adds a lease id to heart beat.
Definition FluentHeartbeatBuilder.h:65
FluentHeartbeatBuilder(std::string licenseKey="")
Constructs new instance.
Definition FluentHeartbeatBuilder.h:28
const std::string licenseKey
Licensekey.
Definition FluentHeartbeatBuilder.h:104
std::vector<::tenduke::se::licensing::LicenseHeartbeatArguments > arguments
The individual arguments.
Definition FluentHeartbeatBuilder.h:107
Client for licensing operations.
Definition LicensingClient.h:72
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