The generated code uses the Newtonsoft Json.NET NuGet Package. If the automatic NuGet package restore is enabled, these dependencies will be installed automatically. Therefore, you will need internet access for build.
- Open the solution (SimpleCalculator.sln) file.
Invoke the build process using Ctrl + Shift + B shortcut key or using the Build menu as shown below.
The build process generates a portable class library, which can be used like a normal class library. The generated library is compatible with Windows Forms, Windows RT, Windows Phone 8, Silverlight 5, Xamarin iOS, Xamarin Android and Mono. More information on how to use can be found at the MSDN Portable Class Libraries documentation.
The following section explains how to use the SimpleCalculator.Standard library in a new project.
For starting a new project, right click on the current solution from the solution explorer and choose Add -> New Project.
Next, choose Console Application, provide TestConsoleProject as the project name and click OK.
The new console project is the entry point for the eventual execution. This requires us to set the TestConsoleProject as the start-up project. To do this, right-click on the TestConsoleProject and choose Set as StartUp Project form the context menu.
In order to use the Tester library in the new project, first we must add a project reference to the TestConsoleProject. First, right click on the References node in the solution explorer and click Add Reference...
Next, a window will be displayed where we must set the checkbox on Tester.Tests and click OK. By doing this, we have added a reference of the Tester.Tests project into the new TestConsoleProject.
Once the TestConsoleProject is created, a file named Program.cs will be visible in the solution explorer with an empty Main method. This is the entry point for the execution of the entire solution. Here, you can add code to initialize the client library and acquire the instance of a Controller class. Sample code to initialize the client library and using Controller methods is given in the subsequent sections.
The following parameters are configurable for the API Client:
| Parameter | Type | Description |
|---|---|---|
Timeout |
TimeSpan |
Http client timeout. Default: TimeSpan.FromSeconds(100) |
The API client can be initialized as follows:
SimpleCalculator.Standard.SimpleCalculatorClient client = new SimpleCalculator.Standard.SimpleCalculatorClient();Parameters for retries can be configured through the HttpClientConfiguration in the API Client:
| Parameters | Type | Description |
|---|---|---|
Timeout |
TimeSpan |
Http client timeout. Default: TimeSpan.FromSeconds(100) |
NumberOfRetries |
int |
Number of times the request is retried. Default: 0 |
BackoffFactor |
int |
Exponential backoff factor for duration between retry calls. Default: 2 |
RetryInterval |
double |
The time interval between the endpoint calls. Default: 1 |
BackoffMax |
TimeSpan |
The maximum back off time. Default: TimeSpan.FromSeconds(0) |
StatusCodesToRetry |
IList<int> |
List of Http status codes to invoke retry. Default: new List<int> { 408, 413, 429, 500, 502, 503, 504, 521, 522, 524, } |
RequestMethodsToRetry |
IList<HttpMethod> |
List of Http request methods to invoke retry. Default: new List<string> { "GET", "PUT", }.Select(val => new HttpMethod(val)) |
The gateway for the SDK. This class acts as a factory for the Controllers and also holds the configuration of the SDK.
| Name | Description |
|---|---|
| SimpleCalculatorController | Gets SimpleCalculatorController controller. |
| Name | Description | Type |
|---|---|---|
| HttpClientConfiguration | Gets the configuration of the Http Client associated with this client. | IHttpClientConfiguration |
| Timeout | Http client timeout. | TimeSpan |
| Environment | Current API environment. | Environment |
| Name | Description | Return Type |
|---|---|---|
GetBaseUri(Server alias = Server.Default) |
Gets the URL for a particular alias in the current environment and appends it with template parameters. | string |
ToBuilder() |
Creates an object of the Simple CalculatorClient using the values provided for the builder. | Builder |
Class to build instances of Simple CalculatorClient.
| Name | Description | Return Type |
|---|---|---|
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
DefaultHost(string defaultHost) |
DefaultHost value. | Builder |
Auth(AuthManager auth) |
Gets the AuthManager. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
Auth(AuthManager auth) |
Gets the AuthManager. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
DefaultHost(string defaultHost) |
DefaultHost value. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
DefaultHost(string defaultHost) |
DefaultHost value. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
DefaultHost(string defaultHost) |
DefaultHost value. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
DefaultHost(string defaultHost) |
DefaultHost value. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
DefaultHost(string defaultHost) |
DefaultHost value. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
DefaultHost(string defaultHost) |
DefaultHost value. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
DefaultHost(string defaultHost) |
DefaultHost value. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
DefaultHost(string defaultHost) |
DefaultHost value. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
DefaultHost(string defaultHost) |
DefaultHost value. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
DefaultHost(string defaultHost) |
DefaultHost value. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
Auth(AuthManager auth) |
Gets the AuthManager. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
Auth(AuthManager auth) |
Gets the AuthManager. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
Default(string mDefault) |
Default value. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
AccessTokenCredentials(IAccessTokenCredentials accessTokenCredentials) |
Gets the access token to use with OAuth 2 authentication. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
DefaultHost(string defaultHost) |
DefaultHost value. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
DefaultHost(string defaultHost) |
DefaultHost value. | Builder |
Auth(AuthManager auth) |
Gets the AuthManager. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
Basepath(string basepath) |
Base path of the Dropbox API server | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
Auth(AuthManager auth) |
Gets the AuthManager. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
Basepath(string basepath) |
Base path of the Dropbox API server | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
AccessTokenCredentials(IAccessTokenCredentials accessTokenCredentials) |
Gets the access token to use with OAuth 2 authentication. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
Auth(AuthManager auth) |
Gets the AuthManager. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
Auth(AuthManager auth) |
Gets the AuthManager. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
Auth(AuthManager auth) |
Gets the AuthManager. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
Auth(AuthManager auth) |
Gets the AuthManager. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
Auth(AuthManager auth) |
Gets the AuthManager. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
Auth(AuthManager auth) |
Gets the AuthManager. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
Auth(AuthManager auth) |
Gets the AuthManager. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
AadTenantDomain(string aadTenantDomain) |
AadTenantDomain value. | Builder |
AccessTokenCredentials(IAccessTokenCredentials accessTokenCredentials) |
Gets the access token to use with OAuth 2 authentication. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
Auth(AuthManager auth) |
Gets the AuthManager. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
Auth(AuthManager auth) |
Gets the AuthManager. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
Auth(AuthManager auth) |
Gets the AuthManager. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
AccessTokenCredentials(IAccessTokenCredentials accessTokenCredentials) |
Gets the access token to use with OAuth 2 authentication. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
AccessTokenCredentials(IAccessTokenCredentials accessTokenCredentials) |
Gets the access token to use with OAuth 2 authentication. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
AccessTokenCredentials(IAccessTokenCredentials accessTokenCredentials) |
Gets the access token to use with OAuth 2 authentication. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
HttpClientConfiguration(Action<HttpClientConfiguration.Builder> action) |
Gets the configuration of the Http Client associated with this client. | Builder |
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
Environment(Environment environment) |
Current API environment. | Builder |
An instance of the SimpleCalculatorController class can be accessed from the API Client.
SimpleCalculatorController simpleCalculatorController = client.SimpleCalculatorController;
Calculates the expression using specified operation.
ℹ️ Note This endpoint does not require authentication.
CalculateAsync(
Models.OperationTypeEnum operation,
double x,
double y)| Parameter | Type | Tags | Description |
|---|---|---|---|
operation |
Models.OperationTypeEnum |
Template, Required | The operator to apply on the variables |
x |
double |
Query, Required | This is LHS value |
y |
double |
Query, Required | This is RHS value |
Task<double>
OperationTypeEnum operation = OperationTypeEnum.SUM;
double x = 222.14;
double y = 165.14;
try
{
double? result = await simpleCalculatorController.CalculateAsync(operation, x, y);
}
catch (ApiException e){};Possible operators are sum and subtract
OperationTypeEnum
| Name | Description |
|---|---|
SUM |
Represents the sum operator |
SUBTRACT |
Represents the subract operator |
HttpRequest stores necessary information about the http request.
| Name | Description | Type |
|---|---|---|
| HttpMethod | The HTTP verb to use for this request. | HttpMethod |
| QueryUrl | The query url for the http request. | string |
| QueryParameters | Query parameters collection for the current http request. | Dictionary<string, object> |
| Headers | Headers collection for the current http request. | Dictionary<string, string> |
| FormParameters | Form parameters for the current http request. | List<KeyValuePair<string, object>> |
| Body | Optional raw string to send as request body. | object |
| Username | Optional username for Basic Auth. | string |
| Password | Optional password for Basic Auth. | string |
| Name | Description | Return Type |
|---|---|---|
DeepCloneObject<T>(T obj) |
Creates a deep clone of an object by serializing it into a json string and then deserializing back into an object. | T |
JsonSerialize(object obj, JsonConverter converter = null) |
JSON Serialization of a given object. | string |
JsonDeserialize<T>(string json, JsonConverter converter = null) |
JSON Deserialization of the given json string. | T |
HttpResponse stores necessary information about the http response.
| Name | Description | Type |
|---|---|---|
| StatusCode | Gets the HTTP Status code of the http response. | int |
| Headers | Gets the headers of the http response. | Dictionary<string, string> |
| RawBody | Gets the stream of the body. | Stream |
| Name | Description |
|---|---|
HttpRequest(HttpMethod method, string queryUrl) |
Constructor to initialize the http request object. |
HttpRequest(HttpMethod method, string queryUrl, Dictionary<string, string> headers, string username, string password, Dictionary<string, object> queryParameters = null) |
Constructor to initialize the http request with headers and optional Basic auth params. |
HttpRequest(HttpMethod method, string queryUrl, Dictionary<string, string> headers, object body, string username, string password, Dictionary<string, object> queryParameters = null) |
Constructor to initialize the http request with headers, body and optional Basic auth params. |
HttpRequest(HttpMethod method, string queryUrl, Dictionary<string, string> headers, List<KeyValuePair<string, Object>> formParameters, string username, string password, Dictionary<string, object> queryParameters = null) |
Constructor to initialize the http request with headers, form parameters and optional Basic auth params. |
| Name | Description | Return Type |
|---|---|---|
AddHeaders(Dictionary<string, string> HeadersToAdd) |
Concatenate values from a Dictionary to this object. | Dictionary<string, string> |
AddQueryParameters(Dictionary<string, object> queryParamaters) |
Concatenate values from a Dictionary to query parameters dictionary. | void |
HttpResponse stores necessary information about the http response.
| Name | Description | Type |
|---|---|---|
| StatusCode | Gets the HTTP Status code of the http response. | int |
| Headers | Gets the headers of the http response. | Dictionary<string, string> |
| RawBody | Gets the stream of the body. | Stream |
| Name | Description |
|---|---|
HttpResponse(int statusCode, Dictionary<string, string> headers, Stream rawBody) |
Initializes a new instance of the class. |
HttpStringResponse inherits from HttpResponse and has additional property of string body.
| Name | Description | Type |
|---|---|---|
| StatusCode | Gets the HTTP Status code of the http response. | int |
| Headers | Gets the headers of the http response. | Dictionary<string, string> |
| Body | Gets the raw string body of the http response. | string |
| Name | Description |
|---|---|
HttpStringResponse(int statusCode, Dictionary<string, string> headers, Stream rawBody, string body) : base(statusCode, headers, rawBody) |
Initializes a new instance of the class. |
Represents the contextual information of HTTP request and response.
| Name | Description | Type |
|---|---|---|
| Request | Gets the http request in the current context. | HttpRequest |
| Response | Gets the http response in the current context. | HttpResponse |
| Name | Description |
|---|---|
HttpContext(HttpRequest request, HttpResponse response) |
Initializes a new instance of the class. |
HttpClientConfiguration represents the current state of the Http Client.
| Name | Description | Type |
|---|---|---|
| Timeout | Http client timeout. | TimeSpan |
| NumberOfRetries | Number of times the request is retried. | int |
| BackoffFactor | Exponential backoff factor for duration between retry calls. | int |
| RetryInterval | The time interval between the endpoint calls. | double |
| BackoffMax | The maximum back off time. | TimeSpan |
| StatusCodesToRetry | List of Http status codes to invoke retry. | IList<int> |
| RequestMethodsToRetry | List of Http request methods to invoke retry. | IList<HttpMethod> |
| Name | Description | Return Type |
|---|---|---|
ToBuilder() |
Creates an object of the HttpClientConfiguration using the values provided for the builder. | Builder |
Class to build instances of HttpClientConfiguration.
| Name | Description | Return Type |
|---|---|---|
Timeout(TimeSpan timeout) |
Http client timeout. | Builder |
NumberOfRetries(int numberOfRetries) |
Number of times the request is retried. | Builder |
BackoffFactor(int backoffFactor) |
Exponential backoff factor for duration between retry calls. | Builder |
RetryInterval(double retryInterval) |
The time interval between the endpoint calls. | Builder |
BackoffMax(TimeSpan backoffMax) |
The maximum back off time. | Builder |
StatusCodesToRetry(IList<int> statusCodesToRetry) |
List of Http status codes to invoke retry. | Builder |
RequestMethodsToRetry(IList<HttpMethod> requestMethodsToRetry) |
List of Http request methods to invoke retry. | Builder |
Build() |
Builds a new HttpClientConfiguration object using the set fields. | HttpClientConfiguration |
IAuthManager adds the authenticaion layer to the http calls.
| Name | Description | Return Type |
|---|---|---|
Apply(HttpRequest httpRequest) |
Add authentication information to the HTTP Request. | HttpRequest |
ApplyAsync(HttpRequest httpRequest) |
Asynchronously add authentication information to the HTTP Request. | Task<HttpRequest> |
This is the base class for all exceptions that represent an error response from the server.
| Name | Description | Type |
|---|---|---|
| ResponseCode | Gets the HTTP response code from the API request. | int |
| HttpContext | Gets or sets the HttpContext for the request and response. | HttpContext |
| Name | Description |
|---|---|
ApiException(string reason, HttpContext context) |
Initializes a new instance of the class. |