Table of Contents

Class HttpApi

Namespace: Casewhere.Runtime.DSL.Api
Assembly: Casewhere.Runtime.dll

public class HttpApi : IHttpApi, IDslApi

Inheritance

objectHttpApi

Implements

IHttpApi, IDslApi

Inherited Members

object.ToString(), object.Equals(object), object.Equals(object, object), object.ReferenceEquals(object, object), object.GetHashCode(), object.GetType(), object.MemberwiseClone()

Extension Methods

ObjectExtension.ConvertToBsonValue(object), EnumExtensions.DeepClone<HttpApi>(HttpApi)

Constructors

HttpApi()

public HttpApi()

Methods

Get<TData, TError>(HttpApiGetRequest)

Make a GET request and return the data or error of the request

public HttpApiResponse<TData, TError> Get<TData, TError>(HttpApiGetRequest httpApiGetRequest)

Parameters

httpApiGetRequest HttpApiGetRequest

A GET request

Returns

HttpApiResponse<TData, TError>

Return a HttpApiResponse

Type Parameters

TData

The data type

TError

The error type

Examples

var httpApi = @apiFactory.Get<IHttpApi>();
var url = "https://login-demo.casewhere.com/admin/api/rest/v2/sharedconfigurablesettings";
var urlParameters = new Dictionary<string, string>();
urlParameters.Add("sortOrder", "Ascending");
var additionalHeaders = new Dictionary<string, string>();
additionalHeaders.Add("Authorization", "eyJhbGciOiJSUzI1NiIsImtpZCI6...");
var httpResponse = httpApi.Get<JObject, string>(HttpApiRequest.CreateGetRequest(url, urlParameters, additionalHeaders));
Log.Info("Response: {@response}", httpResponse);

Get<TData>(HttpApiGetRequest)

Make a GET request and return the data or error of the request

public HttpApiResponse<TData, string> Get<TData>(HttpApiGetRequest httpApiGetRequest)

Parameters

httpApiGetRequest HttpApiGetRequest

A GET request

Returns

HttpApiResponse<TData, string>

Return a HttpApiResponse

Type Parameters

TData

The data type

Examples

var httpApi = @apiFactory.Get<IHttpApi>();
var samlId = "_baed74d5-78b9-4ab5-93fd-f5bb61b10d03";
var url = "https://nemlogin.kk.dk/nemlogin/loggedInService/{samlId}";
var httpResponse = httpApi.Get<bool>(HttpApiRequest.CreateGetRequest(url));
Log.Info("Response: {@response}", httpResponse);
var newSessionStatus = httpResponse.Data;