Class ApiConfiguration
Represents a set of api configuration settings
Implements
Inherited Members
Namespace: Unity.Services.Apis
Assembly: Unity.Services.Apis.dll
Syntax
public class ApiConfiguration : IApiConfiguration
Constructors
ApiConfiguration()
Initializes a new instance of the Configuration class
Declaration
public ApiConfiguration()
ApiConfiguration(IDictionary<string, string>, IDictionary<string, string>, IDictionary<string, string>, string)
Initializes a new instance of the Configuration class
Declaration
public ApiConfiguration(IDictionary<string, string> defaultHeaders, IDictionary<string, string> apiKey, IDictionary<string, string> apiKeyPrefix, string basePath)
Parameters
Type | Name | Description |
---|---|---|
IDictionary<string, string> | defaultHeaders | The default headers to apply. |
IDictionary<string, string> | apiKey | The api key to apply. |
IDictionary<string, string> | apiKeyPrefix | The api key prefix to apply. |
string | basePath | The base path to apply. |
Fields
ISO8601_DATETIME_FORMAT
Identifier for ISO 8601 DateTime Format
Declaration
public const string ISO8601_DATETIME_FORMAT = "o"
Field Value
Type | Description |
---|---|
string |
Properties
AccessToken
Gets or sets the access token for OAuth2 authentication.
This helper property simplifies code generation.
Declaration
public virtual string AccessToken { get; set; }
Property Value
Type | Description |
---|---|
string | The access token. |
ApiKey
Gets or sets the API key based on the authentication name.
Declaration
public virtual IDictionary<string, string> ApiKey { get; set; }
Property Value
Type | Description |
---|---|
IDictionary<string, string> | The API key. |
ApiKeyPrefix
Gets or sets the prefix (e.g. Token) of the API key based on the authentication name.
Whatever you set here will be prepended to the value defined in AddApiKey.
An example invocation here might be: ApiKeyPrefix["Authorization"] = "Bearer"; … where ApiKey["Authorization"] would then be used to set the value of your bearer token.
Declaration
public virtual IDictionary<string, string> ApiKeyPrefix { get; set; }
Property Value
Type | Description |
---|---|
IDictionary<string, string> | The prefix of the API key. |
BasePath
Gets or sets the base path for API access.
Declaration
public virtual string BasePath { get; set; }
Property Value
Type | Description |
---|---|
string |
DateTimeFormat
Gets or sets the date time format used when serializing in the ApiClient By default, it's set to ISO 8601 - "o", for others see: https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx No validation is done to ensure that the string you're providing is valid
Declaration
public virtual string DateTimeFormat { get; set; }
Property Value
Type | Description |
---|---|
string | The DateTimeFormat string |
DefaultHeaders
Gets or sets the default headers.
Declaration
public virtual IDictionary<string, string> DefaultHeaders { get; set; }
Property Value
Type | Description |
---|---|
IDictionary<string, string> |
Password
Gets or sets the password (HTTP basic authentication).
Declaration
public virtual string Password { get; set; }
Property Value
Type | Description |
---|---|
string | The password. |
Timeout
Gets or sets the HTTP timeout in seconds for the ApiClient. Default to 10 seconds.
Declaration
public virtual int Timeout { get; set; }
Property Value
Type | Description |
---|---|
int |
UserAgent
Gets or sets the HTTP user agent.
Declaration
public virtual string UserAgent { get; set; }
Property Value
Type | Description |
---|---|
string | Http user agent. |
Username
Gets or sets the username (HTTP basic authentication).
Declaration
public virtual string Username { get; set; }
Property Value
Type | Description |
---|---|
string | The username. |
Methods
AddApiKey(string, string)
Add Api Key Header.
Declaration
public void AddApiKey(string key, string value)
Parameters
AddApiKeyPrefix(string, string)
Sets the API key prefix.
Declaration
public void AddApiKeyPrefix(string key, string value)
Parameters
GetApiKeyWithPrefix(string)
Gets the API key with prefix.
Declaration
public string GetApiKeyWithPrefix(string apiKeyIdentifier)
Parameters
Type | Name | Description |
---|---|---|
string | apiKeyIdentifier | API key identifier (authentication scheme). |
Returns
Type | Description |
---|---|
string | API key with prefix. |