C++ Server-Side SDK
LaunchDarkly SDK
endpoints_builder.hpp
1 #pragma once
2 
3 #include <launchdarkly/config/shared/built/service_endpoints.hpp>
4 #include <launchdarkly/error.hpp>
5 
6 #include "tl/expected.hpp"
7 
8 #include <memory>
9 #include <optional>
10 #include <string>
11 
12 namespace launchdarkly::config::shared::builders {
13 
14 template <typename SDK>
15 class EndpointsBuilder;
16 
17 template <typename SDK>
18 bool operator==(EndpointsBuilder<SDK> const& lhs,
19  EndpointsBuilder<SDK> const& rhs);
20 
27 template <typename SDK>
29  public:
30  friend bool operator==<SDK>(EndpointsBuilder<SDK> const& lhs,
31  EndpointsBuilder<SDK> const& rhs);
35  EndpointsBuilder() = default;
36 
42  EndpointsBuilder& PollingBaseUrl(std::string url);
43 
49  EndpointsBuilder& StreamingBaseUrl(std::string url);
50 
56  EndpointsBuilder& EventsBaseUrl(std::string url);
57 
64  EndpointsBuilder& RelayProxyBaseURL(std::string const& url);
65 
72  [[nodiscard]] tl::expected<built::ServiceEndpoints, Error> Build() const;
73 
74  private:
75  std::optional<std::string> polling_base_url_;
76  std::optional<std::string> streaming_base_url_;
77  std::optional<std::string> events_base_url_;
78 };
79 
80 } // namespace launchdarkly::config::shared::builders
EndpointsBuilder & StreamingBaseUrl(std::string url)
Definition: endpoints_builder.cpp:14
EndpointsBuilder & EventsBaseUrl(std::string url)
Definition: endpoints_builder.cpp:20
tl::expected< built::ServiceEndpoints, Error > Build() const
Definition: endpoints_builder.cpp:46
EndpointsBuilder & PollingBaseUrl(std::string url)
Definition: endpoints_builder.cpp:9
EndpointsBuilder & RelayProxyBaseURL(std::string const &url)
Definition: endpoints_builder.cpp:26