Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
IApiQueryParamsBuilder.hpp
Go to the documentation of this file.
1#ifndef IAPIQUERYPARAMSBUILDER_HPP
2#define IAPIQUERYPARAMSBUILDER_HPP
3
4#include <optional>
5#include <string>
6#include <set>
7#include <unordered_map>
8
9namespace iv::comms::api
10{
11
13{
14public:
15 virtual ~IApiQueryParamsBuilder() = default;
16
17 [[nodiscard]] virtual std::optional<std::string> getChannelId() const = 0;
18 [[nodiscard]] virtual std::unordered_map<std::string_view, std::string> build() const = 0;
19
20protected:
26 static std::string parseStringList(const std::set<std::string> &stringValues)
27 {
28 std::string parsedSource {};
29 bool isFirst {true};
30
31 for (const auto &stringValue: stringValues)
32 {
33 if (isFirst)
34 {
35 isFirst = false;
36 }
37 else
38 {
39 parsedSource += ",";
40 }
41
42 parsedSource += stringValue;
43 }
44
45 return parsedSource;
46 }
47};
48
49}// namespace iv::comms::api
50
51#endif//IAPIQUERYPARAMSBUILDER_HPP
Definition IApiQueryParamsBuilder.hpp:13
static std::string parseStringList(const std::set< std::string > &stringValues)
Parse a set of string values into a single string.
Definition IApiQueryParamsBuilder.hpp:26
virtual std::unordered_map< std::string_view, std::string > build() const =0
virtual std::optional< std::string > getChannelId() const =0
Definition ApiCommunicationController.cpp:12