Class SDKBuilder<T>
Class SDKBuilder. Used to build an instance of a ISDK.
Inheritance
Namespace: VpnSDK
Assembly: cs.temp.dll.dll
Syntax
public class SDKBuilder<T>
where T : ISDK
Type Parameters
| Name | Description |
|---|---|
| T | ISDK type. |
Methods
Create()
Creates an ISDK based off the parameters chained before the call.
Declaration
public T Create()
Returns
| Type | Description |
|---|---|
| T | An instance of ISDK. |
SetApiBaseUrl(String[])
Sets the API base URL.
Declaration
public SDKBuilder<T> SetApiBaseUrl(params string[] value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String[] | value | The API base URLs. |
Returns
| Type | Description |
|---|---|
| SDKBuilder<T> | a builder instance. |
SetApiKey(String)
Sets the SDK API key.
Declaration
public SDKBuilder<T> SetApiKey(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | the API key. |
Returns
| Type | Description |
|---|---|
| SDKBuilder<T> | a builder instance. |
SetApplicationName(String)
Sets the name of the application.
Declaration
public SDKBuilder<T> SetApplicationName(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The value. |
Returns
| Type | Description |
|---|---|
| SDKBuilder<T> | a builder instance. |
SetAuthenticationToken(String)
Sets the authentication token.
Declaration
public SDKBuilder<T> SetAuthenticationToken(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The value. |
Returns
| Type | Description |
|---|---|
| SDKBuilder<T> | a builder instance. |
SetAutomaticRefreshTokenHandling(Boolean)
Sets the automatic refresh token hanlding.
Declaration
public SDKBuilder<T> SetAutomaticRefreshTokenHandling(bool automaticallyRefresh)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | automaticallyRefresh | If set to true, SDK will automatically update OAuth Refresh Token. |
Returns
| Type | Description |
|---|---|
| SDKBuilder<T> | a builder instance. |
SetBrandingKey(String)
Sets the Branding key. If this value is specified, providing API Key and Authentication Token is not required. If this value specified, you have to use Login(String, String, String) for logging in a user.
Declaration
public SDKBuilder<T> SetBrandingKey(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | the branding key. |
Returns
| Type | Description |
|---|---|
| SDKBuilder<T> | a builder instance. |
SetBuildMockup(Boolean)
Declaration
public SDKBuilder<T> SetBuildMockup(bool value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | value |
Returns
| Type | Description |
|---|---|
| SDKBuilder<T> |
SetCalloutDriverName(String)
Sets the callout driver service name.
Declaration
public SDKBuilder<T> SetCalloutDriverName(string calloutDriverName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | calloutDriverName | The callout driver service name.The maximum string length is 256 characters. Allowed characters are "a-z", "A-Z", "0-9", "_", and "-". The service name case is preserved, but service name comparisons are always case insensitive. |
Returns
| Type | Description |
|---|---|
| SDKBuilder<T> | a builder instance. |
SetOpenVpnConfiguration(OpenVpnConfiguration)
Sets the configuration for the Open VPN connection type.
Declaration
public SDKBuilder<T> SetOpenVpnConfiguration(OpenVpnConfiguration value)
Parameters
| Type | Name | Description |
|---|---|---|
| OpenVpnConfiguration | value | The OpenVPN configuration. |
Returns
| Type | Description |
|---|---|
| SDKBuilder<T> | The current builder instance. |
SetRasConfiguration(RasConfiguration)
Sets the RAS Configuration.
Declaration
public SDKBuilder<T> SetRasConfiguration(RasConfiguration value)
Parameters
| Type | Name | Description |
|---|---|---|
| RasConfiguration | value | the configuration. |
Returns
| Type | Description |
|---|---|
| SDKBuilder<T> | a builder instance. |
SetRunInUserspace(Boolean)
Sets run in user space mode. This will disable OpenVPN and WFP.
Declaration
public SDKBuilder<T> SetRunInUserspace(bool runInUserspace)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | runInUserspace | True if you want SDK to run in user space. |
Returns
| Type | Description |
|---|---|
| SDKBuilder<T> | a builder instance. |
SetServerListCache(Nullable<TimeSpan>)
Sets the time interval for server list data cache. If not set, SDK wont cache the data.
Declaration
public SDKBuilder<T> SetServerListCache(TimeSpan? time)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Nullable<TimeSpan> | time | Time interval. |
Returns
| Type | Description |
|---|---|
| SDKBuilder<T> | a builder instance. |
SetSynchronizationContext(SynchronizationContext)
Sets synchronization context.
Declaration
public SDKBuilder<T> SetSynchronizationContext(SynchronizationContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| SynchronizationContext | context |
Returns
| Type | Description |
|---|---|
| SDKBuilder<T> | a builder instance. |
SetTokenBasedAuthentication(Boolean)
Sets whether the SDK should use token-based authentication.
Declaration
public SDKBuilder<T> SetTokenBasedAuthentication(bool useTokenAuthentication)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | useTokenAuthentication | True means token based authentication will be performed otherwise user credentials will be used. |
Returns
| Type | Description |
|---|---|
| SDKBuilder<T> | a builder instance. |
SetWireguardConfiguration(WireguardConfiguration)
Sets the configuration for the WireGuard® connection type.
Declaration
public SDKBuilder<T> SetWireguardConfiguration(WireguardConfiguration value)
Parameters
| Type | Name | Description |
|---|---|---|
| WireguardConfiguration | value | The WireGuard® configuration. |
Returns
| Type | Description |
|---|---|
| SDKBuilder<T> | a builder instance. |
Validate()
Validates the configuration before creating the SDK instance. The validation done depends on the type of client.
Declaration
public void Validate()
Exceptions
| Type | Condition |
|---|---|
| InvalidConfigurationException | Either the API Key, application name or authentication token were not set. |
| EmptyAvailableVpnProtocolsException | No VPN protocols were configured. |