NamespaceSystemLibrary.Common.Framework.App.Extensions SystemLibrary.Common.Framework.Client.dll
StringExtensions
public static class StringExtensions
Inheritance
object
StringExtensions
Examples
Arguments
X
Methods
Send a HTTP DELETE request
public static ClientResponse<T> Delete<T>(this string url, object data, ContentType contentType = ContentType.Auto, IDictionary<string, string> headers = null, int timeout = 40001, JsonSerializerOptions jsonSerializerOptions = null, CancellationToken cancellationToken = default, Func<string, T> deserialize = null)
X
var deleteId = 1;
var response = new Client().Delete<string>("https://www.systemlibrary.com/delete", deleteId, ContentType.textplain, 2000);
X
Generic types
| Name | Description |
|---|---|
| T |
Methods arguments
| Type | Name | Description |
|---|---|---|
| string | url | |
| object | data | |
| contentType | ||
| IDictionary<string, string> | headers | |
| int | timeout | milliseconds |
| JsonSerializerOptions | jsonSerializerOptions | |
| CancellationToken | cancellationToken | |
| Func<string, T> | deserialize |
Send a HTTP GET request with a payload
public static ClientResponse<T> Get<T>(this string url, ContentType contentType = ContentType.Auto, IDictionary<string, string> headers = null, int timeout = 40001, JsonSerializerOptions jsonSerializerOptions = null, object payload = null, CancellationToken cancellationToken = default, Func<string, T> deserialize = null)
X
var data = new { hello: "world"};
var response = new Client().Get<string>("https://www.systemlibrary.com/get", data, ContentType.json, 2000);
X
Generic types
| Name | Description |
|---|---|
| T |
Methods arguments
| Type | Name | Description |
|---|---|---|
| string | url | |
| contentType | ||
| IDictionary<string, string> | headers | |
| int | timeout | milliseconds |
| JsonSerializerOptions | jsonSerializerOptions | |
| object | payload | |
| CancellationToken | cancellationToken | |
| Func<string, T> | deserialize |
Send a HTTP POST request
public static ClientResponse<T> Post<T>(this string url, object data = null, ContentType contentType = ContentType.Auto, IDictionary<string, string> headers = null, int timeout = 40001, JsonSerializerOptions jsonSerializerOptions = null, CancellationToken cancellationToken = default, Func<string, T> deserialize = null)
X
var postId = 1;
var response = new Client().Post<string>("https://www.systemlibrary.com/post", postId, ContentType.textplain, 2000);
X
Generic types
| Name | Description |
|---|---|
| T |
Methods arguments
| Type | Name | Description |
|---|---|---|
| string | url | |
| object | data | |
| contentType | ||
| IDictionary<string, string> | headers | |
| int | timeout | milliseconds |
| JsonSerializerOptions | jsonSerializerOptions | |
| CancellationToken | cancellationToken | |
| Func<string, T> | deserialize |
Send a HTTP PUT request
public static ClientResponse<T> Put<T>(this string url, object data, ContentType contentType = ContentType.Auto, IDictionary<string, string> headers = null, int timeout = 40001, JsonSerializerOptions jsonSerializerOptions = null, CancellationToken cancellationToken = default, Func<string, T> deserialize = null)
X
var putId = 1;
var response = new Client().Put<string>("https://www.systemlibrary.com/put", putId, ContentType.textplain, 2000);
X
Generic types
| Name | Description |
|---|---|
| T |
Methods arguments
| Type | Name | Description |
|---|---|---|
| string | url | |
| object | data | |
| contentType | ||
| IDictionary<string, string> | headers | |
| int | timeout | milliseconds |
| JsonSerializerOptions | jsonSerializerOptions | |
| CancellationToken | cancellationToken | |
| Func<string, T> | deserialize |
}