diff options
Diffstat (limited to 'src/zenhttp/include')
| -rw-r--r-- | src/zenhttp/include/zenhttp/httpclient.h | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/zenhttp/include/zenhttp/httpclient.h b/src/zenhttp/include/zenhttp/httpclient.h index ec06aa229..aae7b94e5 100644 --- a/src/zenhttp/include/zenhttp/httpclient.h +++ b/src/zenhttp/include/zenhttp/httpclient.h @@ -108,6 +108,8 @@ private: const HttpResponseCode m_ResponseCode = HttpResponseCode::ImATeapot; }; +class HttpClientBase; + class HttpClient { public: @@ -191,6 +193,11 @@ public: std::string ErrorMessage(std::string_view Prefix) const; }; + static std::pair<std::string_view, std::string_view> Accept(ZenContentType ContentType) + { + return std::make_pair("Accept", MapContentTypeToString(ContentType)); + } + [[nodiscard]] Response Put(std::string_view Url, const IoBuffer& Payload, const KeyValueMap& AdditionalHeader = {}); [[nodiscard]] Response Put(std::string_view Url, const KeyValueMap& Parameters = {}); [[nodiscard]] Response Get(std::string_view Url, const KeyValueMap& AdditionalHeader = {}, const KeyValueMap& Parameters = {}); @@ -220,27 +227,19 @@ public: [[nodiscard]] Response TransactPackage(std::string_view Url, CbPackage Package, const KeyValueMap& AdditionalHeader = {}); - static std::pair<std::string_view, std::string_view> Accept(ZenContentType ContentType) - { - return std::make_pair("Accept", MapContentTypeToString(ContentType)); - } - - LoggerRef Logger() { return m_Log; } + LoggerRef Log() { return m_Log; } std::string_view GetBaseUri() const { return m_BaseUri; } - bool Authenticate(); std::string_view GetSessionId() const { return m_SessionId; } + bool Authenticate(); + private: - const std::optional<HttpClientAccessToken> GetAccessToken(); - struct Impl; + HttpClientBase* m_Inner; LoggerRef m_Log; std::string m_BaseUri; std::string m_SessionId; const HttpClientSettings m_ConnectionSettings; - RwLock m_AccessTokenLock; - HttpClientAccessToken m_CachedAccessToken; - Ref<Impl> m_Impl; }; void httpclient_forcelink(); // internal |