Show / Hide Table of Contents

Class HttpHelper

Inheritance
object
HttpHelper
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: SuperOffice.Util
Assembly: SoCore.dll
Syntax
public class HttpHelper

Constructors

HttpHelper()

Declaration
public HttpHelper()

Methods

GenerateToken(HttpServiceJwtConfig)

Declaration
public static string GenerateToken(HttpHelper.HttpServiceJwtConfig config)
Parameters
Type Name Description
HttpHelper.HttpServiceJwtConfig config
Returns
Type Description
string

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
Type Name Description
string url

Address to send to

HttpHelper.HttpServiceJwtConfig config
HttpHelper.RequestType requestType

GET, POST, PUT, DELETE

object object

Custom referencetype to be JSON serialized

bool respectConfiguredTimeout
CancellationToken cancellationToken
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
Type Name Description
string url
HttpHelper.HttpServiceJwtConfig config
HttpHelper.RequestType requestType
HttpContent content
bool respectConfiguredTimeout
CancellationToken cancellationToken
Returns
Type Description
Task<T>
Type Parameters
Name Description
T

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
Type Name Description
string url
HttpHelper.RequestType requestType
HttpContent content
bool respectConfiguredTimeout
CancellationToken cancellationToken
Returns
Type Description
Task<T>
Type Parameters
Name Description
T

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
Type Name Description
string url

Address to send to

HttpHelper.HttpServiceJwtConfig config
HttpHelper.RequestType requestType

GET, POST, PUT, DELETE

object object

Custom referencetype to be JSON serialized

string bearerToken
bool respectConfiguredTimeout
CancellationToken cancellationToken
Returns
Type Description
Task<HttpResponseMessage>

HttpResponseMessage

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
Type Name Description
string url

Address to send to

HttpHelper.HttpServiceJwtConfig config
HttpHelper.RequestType requestType

GET, POST, PUT, DELETE

object object

Custom referencetype to be JSON serialized

bool respectConfiguredTimeout
CancellationToken cancellationToken
Returns
Type Description
Task<string>

String

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
Type Name Description
string url
HttpHelper.HttpServiceJwtConfig config
HttpHelper.RequestType requestType
HttpContent content
string bearerToken
string apiKey
bool respectConfiguredTimeout
CancellationToken cancellationToken
Returns
Type Description
Task<HttpResponseMessage>

IsAdmin()

Declaration
public static bool IsAdmin()
Returns
Type Description
bool

Extension Methods

EnumUtil.MapEnums<From, To>(From)
Converters.MapEnums<From, To>(From)
ObjectExtensions.AssignByReflection<T>(T, T)
ObjectExtensions.GraphCopy<T>(T)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top