A class to assist in APIs.
public class Api(string apiUrl)
Post the API call.
The object type of the data being sent.
The endpoint to call. This is appended to the base URL.
The data to send.
Post the API call and return an object of type Response.
An ApiResponse object containing success and failure metadata.
The object type of the data being returned.
The object type of the data being sent.
The endpoint to call. This is appended to the base URL.
The data to send.
A class to assist in API responses.
Is true when the call is successful.
Error information.
Inner exception information if it exists.
The reason phrase returned by the httpClient call.
The status code returned by the httpClient call.
The typed object returned from the call.
var myData = new SendType("My text to send");var api = new Api("https://api.example.com");var response = api.ApiCallAsync<SendType, ResponseType>("getsomething", myData);if (response.Success) ... do something