Method ExecuteAPIRequest
ExecuteAPIRequest<T>(String, HttpMethod, Boolean, Boolean, String, Byte[], APIContentType, Boolean, List<KeyValuePair<String,String>>, Boolean)
Executes an API request in a standard way against a given API endpoint. This is a helper method that's put in place to simplify how the API calls are made because most requests against the Halo Infinite API are pretty repetitive.
Declaration
public System.Threading.Tasks.Task<Den.Dev.Grunt.Models.HaloApiResultContainer<T,Den.Dev.Grunt.Models.RawResponseContainer>> ExecuteAPIRequest<T> (string endpoint, System.Net.Http.HttpMethod method, bool useSpartanToken, bool useClearance, string textContent = "", byte[]? binaryContent = default, Den.Dev.Grunt.Models.APIContentType contentType = Den.Dev.Grunt.Models.APIContentType.Json, bool includeRawResponse = false, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<string,string>>? customHeaders = default, bool enforceSuccess = true);
Parameters
Type | Name | Description |
---|---|---|
System.String | endpoint | The API endpoint to which the request is sent. |
System.Net.Http.HttpMethod | method | HTTP method to be used for the request. |
System.Boolean | useSpartanToken | Determines whether a Spartan token needs to be applied to teh request. |
System.Boolean | useClearance | Determines whether a clearance/flight ID needs to be applied to the request. |
System.String | textContent | If the request contains data to be sent to the Halo Waypoint service, include it here. Expected format is JSON. |
System.Byte[] | binaryContent | Binary content to be passed to the API. Either this or textContent should be used, but not both. Binary content takes priority. |
APIContentType | contentType | Content type for POST requests. By default it's |
System.Boolean | includeRawResponse | Determines whether a raw response will be returned with the result. Disabled by default. |
System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String,System.String>> | customHeaders | A list of custom headers to append to the request. |
System.Boolean | enforceSuccess | Determines whether to try and serialize the response data even if the request returns an error code (that is - not HTTP 200 OK). Default is set to true. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<HaloApiResultContainer<T,RawResponseContainer>> | Response string in case of a successful request. Null if request failed. |
Type Parameters
Name | Description |
---|---|
T | Data type to return with the response metadata. |