DotNetDupe 4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Loading...
Searching...
No Matches
HttpClient.h
Go to the documentation of this file.
1
3
4#pragma once
5#include "Common.h"
6#include "System/Object.h"
7#include "System/String.h"
8#include "System/Uri.h"
10#include "System/IO/Stream.h"
16
17namespace DotNetDupe {
18 namespace System {
19 namespace Net {
20 namespace Sockets {
21 class TcpClient;
22 }
23 namespace Http {
24
33
40 class HttpClient : public Object {
41 public:
46
52
58
63 DOTNETDUPE_API HttpResponseMessagePtr Post(const String& requestUri, const HttpContentPtr& content);
64
69 DOTNETDUPE_API HttpResponseMessagePtr Post(const Uri& requestUri, const HttpContentPtr& content);
70
75 DOTNETDUPE_API HttpResponseMessagePtr Put(const String& requestUri, const HttpContentPtr& content);
76
81 DOTNETDUPE_API HttpResponseMessagePtr Put(const Uri& requestUri, const HttpContentPtr& content);
82
87
92
97
103
107 DOTNETDUPE_API String GetString(const String& requestUri);
108
112 DOTNETDUPE_API String GetString(const Uri& requestUri);
113
118
122 DOTNETDUPE_API Array<char> GetByteArray(const Uri& requestUri);
123
127
131
132 private:
133 struct Impl;
134 SmartPointer<Impl> m_pImpl;
135
136 };
137 }
138 }
139 }
140}
141
142
Defines common cross-platform macros, export decorators, and fundamental types.
#define DOTNETDUPE_API
Platform-specific linkage decoration for exporting or importing library symbols.
Definition Common.h:20
Represents an HTTP entity body and associated content headers.
Represents an HTTP request message adhering to RFC 9110 and RFC 9112.
Represents an HTTP response message adhering to RFC 9110 and RFC 9112.
Base object class for DotNetDupe mirroring .NET System.Object.
Provides reference-counted and weak pointer memory management primitives ensuring zero raw ownership.
High-performance UTF-8 / UTF-16 string manipulation class mirroring .NET System.String.
Provides client connections for TCP network services.
Provides an object representation of a Uniform Resource Identifier (URI) and easy access to its parts...
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition Array.h:29
Represents a collection of keys and values.
Definition Dictionary.h:66
HttpResponseMessagePtr Post(const String &requestUri, const HttpContentPtr &content)
Sends a POST request with content to the specified string Uri.
String GetString(const String &requestUri)
Sends a GET request to the specified URI and returns the response body as a string.
~HttpClient()
Releases unmanaged resources and destroys the HttpClient instance.
HttpClient()
Initializes a new instance of the HttpClient class.
HttpResponseMessagePtr Send(const HttpRequestMessagePtr &request)
Sends an HTTP request as an operation.
HttpResponseMessagePtr Delete(const String &requestUri)
Sends a DELETE request to the specified string Uri.
HttpResponseMessagePtr Get(const String &requestUri)
Sends a GET request to the specified string Uri.
Collections::Generic::Dictionary< String, String > & GetDefaultRequestHeaders()
Gets the headers which should be sent with each request.
Array< char > GetByteArray(const String &requestUri)
Sends a GET request to the specified URI and returns the response body as a byte array.
HttpResponseMessagePtr Put(const String &requestUri, const HttpContentPtr &content)
Sends a PUT request with content to the specified string Uri.
Provides client connections for TCP network services.
Definition TcpClient.h:25
Supports all classes in the DotNetDupe class hierarchy.
Definition Object.h:18
A unified smart pointer that supports both unique and shared ownership semantics.
Represents text as a sequence of UTF-8 code units with culture-invariant operations.
Definition String.h:74
Represents an object representation of a Uniform Resource Identifier (URI) and provides easy access t...
Definition Uri.h:21
SmartPointer< HttpResponseMessage > HttpResponseMessagePtr
Type alias for reference-counted SmartPointer to HttpResponseMessage.
HttpCompletionOption
Indicates if HttpClient operations should be considered completed as soon as headers are read,...
Definition HttpClient.h:27
@ ResponseContentRead
Operation should complete after reading the entire response including content.
Definition HttpClient.h:29
@ ResponseHeadersRead
Operation should complete as soon as a response is available and headers are read.
Definition HttpClient.h:31
SmartPointer< HttpContent > HttpContentPtr
Type alias for reference-counted SmartPointer to HttpContent.
Definition HttpContent.h:66
SmartPointer< HttpRequestMessage > HttpRequestMessagePtr
Type alias for reference-counted SmartPointer to HttpRequestMessage.