Class HttpHelper
Assembly: SoCore.dll
Syntax
Constructors
HttpHelper()
Declaration
Methods
GenerateToken(HttpServiceJwtConfig)
Declaration
public static string GenerateToken(HttpHelper.HttpServiceJwtConfig config)
Parameters
Returns
GetObjectFromHttpAsync<T>(string, HttpServiceJwtConfig, RequestType, object, bool, CancellationToken)
Returns an object from given type. Calls url and deserializes HttpResponseMessage body to object
Declaration
public static Task<T> GetObjectFromHttpAsync<T>(string url, HttpHelper.HttpServiceJwtConfig config, HttpHelper.RequestType requestType = RequestType.GET, object @object = null, bool respectConfiguredTimeout = false, CancellationToken cancellationToken = default)
Parameters
Returns
Type |
Description |
Task<T> |
Does return what is specified in T
|
Type Parameters
Name |
Description |
T |
To be defined return value
|
GetObjectFromHttpSyncWithContentAsync<T>(string, HttpServiceJwtConfig, RequestType, HttpContent, bool, CancellationToken)
Declaration
public static Task<T> GetObjectFromHttpSyncWithContentAsync<T>(string url, HttpHelper.HttpServiceJwtConfig config, HttpHelper.RequestType requestType, HttpContent content, bool respectConfiguredTimeout = false, CancellationToken cancellationToken = default)
Parameters
Returns
Type Parameters
GetObjectFromHttpSyncWithContentAsync<T>(string, RequestType, HttpContent, bool, CancellationToken)
Declaration
public static Task<T> GetObjectFromHttpSyncWithContentAsync<T>(string url, HttpHelper.RequestType requestType, HttpContent content, bool respectConfiguredTimeout = false, CancellationToken cancellationToken = default)
Parameters
Returns
Type Parameters
GetResponseAsync(string, HttpServiceJwtConfig, RequestType, object, string, bool, CancellationToken)
Returns HttpResponseMessage from a HTTP call to an url
Declaration
public static Task<HttpResponseMessage> GetResponseAsync(string url, HttpHelper.HttpServiceJwtConfig config, HttpHelper.RequestType requestType = RequestType.GET, object @object = null, string bearerToken = null, bool respectConfiguredTimeout = false, CancellationToken cancellationToken = default)
Parameters
Returns
GetResponseBodyAsync(string, HttpServiceJwtConfig, RequestType, object, bool, CancellationToken)
Returns the Body from an HTTPResponseMessage from a HTTP call to an url as string
Declaration
public static Task<string> GetResponseBodyAsync(string url, HttpHelper.HttpServiceJwtConfig config, HttpHelper.RequestType requestType = RequestType.GET, object @object = null, bool respectConfiguredTimeout = false, CancellationToken cancellationToken = default)
Parameters
Returns
GetResponseWithContentAsync(string, HttpServiceJwtConfig, RequestType, HttpContent, string, string, bool, CancellationToken)
Declaration
public static Task<HttpResponseMessage> GetResponseWithContentAsync(string url, HttpHelper.HttpServiceJwtConfig config, HttpHelper.RequestType requestType, HttpContent content, string bearerToken = null, string apiKey = null, bool respectConfiguredTimeout = false, CancellationToken cancellationToken = default)
Parameters
Returns
IsAdmin()
Declaration
public static bool IsAdmin()
Returns
Extension Methods