diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 990ff7e..cc7e7cc 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -15,6 +15,8 @@ jobs:
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
BW_USERNAME: ${{ secrets.BW_USERNAME }}
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
+ BW_CLIENT_ID: ${{ secrets.BW_CLIENT_ID }}
+ BW_CLIENT_SECRET: ${{ secrets.BW_CLIENT_SECRET }}
BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN}}
BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN}}
BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }}
diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml
index 127c565..ac1cae6 100644
--- a/.github/workflows/test-pr.yml
+++ b/.github/workflows/test-pr.yml
@@ -13,6 +13,8 @@ env:
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
BW_USERNAME: ${{ secrets.BW_USERNAME }}
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
+ BW_CLIENT_ID: ${{ secrets.BW_CLIENT_ID }}
+ BW_CLIENT_SECRET: ${{ secrets.BW_CLIENT_SECRET }}
BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN}}
BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN}}
BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }}
diff --git a/.github/workflows/test-smoke.yml b/.github/workflows/test-smoke.yml
index 900be41..6cfac2d 100644
--- a/.github/workflows/test-smoke.yml
+++ b/.github/workflows/test-smoke.yml
@@ -15,6 +15,8 @@ concurrency:
env:
BW_USERNAME: ${{ secrets.BW_USERNAME }}
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
+ BW_CLIENT_ID: ${{ secrets.BW_CLIENT_ID }}
+ BW_CLIENT_SECRET: ${{ secrets.BW_CLIENT_SECRET }}
BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN }}
BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN }}
USER_NUMBER: ${{ secrets.USER_NUMBER }}
diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES
index 2450528..032bb40 100644
--- a/.openapi-generator/FILES
+++ b/.openapi-generator/FILES
@@ -202,6 +202,9 @@ src/Bandwidth.Standard/Api/TranscriptionsApi.cs
src/Bandwidth.Standard/Client/ApiClient.cs
src/Bandwidth.Standard/Client/ApiException.cs
src/Bandwidth.Standard/Client/ApiResponse.cs
+src/Bandwidth.Standard/Client/Auth/OAuthAuthenticator.cs
+src/Bandwidth.Standard/Client/Auth/OAuthFlow.cs
+src/Bandwidth.Standard/Client/Auth/TokenResponse.cs
src/Bandwidth.Standard/Client/ClientUtils.cs
src/Bandwidth.Standard/Client/Configuration.cs
src/Bandwidth.Standard/Client/ExceptionFactory.cs
diff --git a/Bandwidth.Standard.sln b/Bandwidth.Standard.sln
index a681fdd..154356c 100644
--- a/Bandwidth.Standard.sln
+++ b/Bandwidth.Standard.sln
@@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bandwidth.Standard", "src\Bandwidth.Standard\Bandwidth.Standard.csproj", "{90963038-62D5-4C4E-931F-91B8A5342BAC}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bandwidth.Standard", "src\Bandwidth.Standard\Bandwidth.Standard.csproj", "{F953FB82-C495-4E6B-9AAA-9DEA798F76D9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bandwidth.Standard.Test", "src\Bandwidth.Standard.Test\Bandwidth.Standard.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}"
EndProject
@@ -12,10 +12,10 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {90963038-62D5-4C4E-931F-91B8A5342BAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {90963038-62D5-4C4E-931F-91B8A5342BAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {90963038-62D5-4C4E-931F-91B8A5342BAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {90963038-62D5-4C4E-931F-91B8A5342BAC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F953FB82-C495-4E6B-9AAA-9DEA798F76D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F953FB82-C495-4E6B-9AAA-9DEA798F76D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F953FB82-C495-4E6B-9AAA-9DEA798F76D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F953FB82-C495-4E6B-9AAA-9DEA798F76D9}.Release|Any CPU.Build.0 = Release|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU
diff --git a/README.md b/README.md
index 00b0a95..13a912a 100644
--- a/README.md
+++ b/README.md
@@ -19,7 +19,7 @@ This C# SDK is automatically generated by the [OpenAPI Generator](https://openap
## Dependencies
-- [RestSharp](https://www.nuget.org/packages/RestSharp) - 106.13.0 or later
+- [RestSharp](https://www.nuget.org/packages/RestSharp) - 112.0.0 or later
- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 13.0.2 or later
- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.8.0 or later
- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 5.0.0 or later
@@ -78,6 +78,11 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
+ // Or use clientId/clientSecret for OAuth2 authorization
+ config.OAuthClientId = "YOUR_CLIENT_ID";
+ config.OAuthClientSecret = "YOUR_CLIENT_SECRET";
var apiInstance = new CallsApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -349,3 +354,11 @@ Authentication schemes defined for the API:
- **Type**: HTTP basic authentication
+
+### OAuth2
+
+- **Type**: OAuth
+- **Flow**: application
+- **Authorization URL**: https://api.bandwidth.com/api/v1/oauth2/token
+- **Scopes**: N/A
+
diff --git a/api/openapi.yaml b/api/openapi.yaml
index cfdbd76..7113704 100644
--- a/api/openapi.yaml
+++ b/api/openapi.yaml
@@ -11,6 +11,7 @@ servers:
- url: /
security:
- Basic: []
+- OAuth2: []
tags:
- name: Messages
- name: Media
@@ -14800,4 +14801,10 @@ components:
- Example: `Authorization: Basic ZGVtbZpwQDU1dzByZA==`
scheme: basic
type: http
+ OAuth2:
+ flows:
+ clientCredentials:
+ scopes: {}
+ tokenUrl: https://api.bandwidth.com/api/v1/oauth2/token
+ type: oauth2
diff --git a/bandwidth.yml b/bandwidth.yml
index 6ee15ae..9ab77fd 100644
--- a/bandwidth.yml
+++ b/bandwidth.yml
@@ -9,6 +9,7 @@ info:
version: 1.0.0
security:
- Basic: []
+ - OAuth2: []
tags:
- name: Messages
- name: Media
@@ -8427,6 +8428,12 @@ components:
- Example: `Authorization: Basic ZGVtbZpwQDU1dzByZA==`
+ OAuth2:
+ type: oauth2
+ flows:
+ clientCredentials:
+ tokenUrl: https://api.bandwidth.com/api/v1/oauth2/token
+ scopes: {}
callbacks:
inboundCallback:
'{inboundCallbackUrl}':
diff --git a/custom_templates/Configuration.mustache b/custom_templates/Configuration.mustache
new file mode 100644
index 0000000..d6f5642
--- /dev/null
+++ b/custom_templates/Configuration.mustache
@@ -0,0 +1,736 @@
+{{>partial_header}}
+
+using System;
+{{^net35}}
+using System.Collections.Concurrent;
+{{/net35}}
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Reflection;
+using System.Security.Cryptography.X509Certificates;
+using System.Text;
+using System.Net.Http;
+using System.Net.Security;
+{{#useRestSharp}}
+{{#hasOAuthMethods}}using {{packageName}}.Client.Auth;
+{{/hasOAuthMethods}}
+{{/useRestSharp}}
+
+namespace {{packageName}}.Client
+{
+ ///
+ /// Represents a set of configuration settings
+ ///
+ {{>visibility}} class Configuration : IReadableConfiguration
+ {
+ #region Constants
+
+ ///
+ /// Version of the package.
+ ///
+ /// Version of the package.
+ public const string Version = "{{packageVersion}}";
+
+ ///
+ /// Identifier for ISO 8601 DateTime Format
+ ///
+ /// See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information.
+ // ReSharper disable once InconsistentNaming
+ public const string ISO8601_DATETIME_FORMAT = "o";
+
+ #endregion Constants
+
+ #region Static Members
+
+ ///
+ /// Default creation of exceptions for a given method name and response object
+ ///
+ public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) =>
+ {
+ var status = (int)response.StatusCode;
+ if (status >= 400)
+ {
+ return new ApiException(status,
+ string.Format("Error calling {0}: {1}", methodName, response.RawContent),
+ response.RawContent, response.Headers);
+ }
+ {{^netStandard}}
+ if (status == 0)
+ {
+ return new ApiException(status,
+ string.Format("Error calling {0}: {1}", methodName, response.ErrorText), response.ErrorText);
+ }
+ {{/netStandard}}
+ return null;
+ };
+
+ #endregion Static Members
+
+ #region Private Members
+
+ ///
+ /// Defines the base path of the target API server.
+ /// Example: http://localhost:3000/v1/
+ ///
+ private string _basePath;
+
+ private bool _useDefaultCredentials = false;
+
+ ///
+ /// Gets or sets the API key based on the authentication name.
+ /// This is the key and value comprising the "secret" for accessing an API.
+ ///
+ /// The API key.
+ private IDictionary _apiKey;
+
+ ///
+ /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name.
+ ///
+ /// The prefix of the API key.
+ private IDictionary _apiKeyPrefix;
+
+ private string _dateTimeFormat = ISO8601_DATETIME_FORMAT;
+ private string _tempFolderPath = Path.GetTempPath();
+ {{#servers.0}}
+
+ ///
+ /// Gets or sets the servers defined in the OpenAPI spec.
+ ///
+ /// The servers
+ private IList> _servers;
+ {{/servers.0}}
+
+ ///
+ /// Gets or sets the operation servers defined in the OpenAPI spec.
+ ///
+ /// The operation servers
+ private IReadOnlyDictionary>> _operationServers;
+
+ {{#hasHttpSignatureMethods}}
+
+ ///
+ /// HttpSigning configuration
+ ///
+ private HttpSigningConfiguration _HttpSigningConfiguration = null;
+ {{/hasHttpSignatureMethods}}
+ #endregion Private Members
+
+ #region Constructors
+
+ ///
+ /// Initializes a new instance of the class
+ ///
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")]
+ public Configuration()
+ {
+ Proxy = null;
+ UserAgent = WebUtility.UrlEncode("{{httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{packageVersion}}/csharp{{/httpUserAgent}}");
+ BasePath = "{{{basePath}}}";
+ {{#authMethods}}
+ {{#isOAuth}}
+ OAuthFlow = Auth.OAuthFlow.APPLICATION;
+ OAuthTokenUrl = "{{tokenUrl}}";
+ {{/isOAuth}}
+ {{/authMethods}}
+ DefaultHeaders = new {{^net35}}Concurrent{{/net35}}Dictionary();
+ ApiKey = new {{^net35}}Concurrent{{/net35}}Dictionary();
+ ApiKeyPrefix = new {{^net35}}Concurrent{{/net35}}Dictionary();
+ {{#servers}}
+ {{#-first}}
+ Servers = new List>()
+ {
+ {{/-first}}
+ {
+ new Dictionary {
+ {"url", "{{{url}}}"},
+ {"description", "{{{description}}}{{^description}}No description provided{{/description}}"},
+ {{#variables}}
+ {{#-first}}
+ {
+ "variables", new Dictionary {
+ {{/-first}}
+ {
+ "{{{name}}}", new Dictionary {
+ {"description", "{{{description}}}{{^description}}No description provided{{/description}}"},
+ {"default_value", {{#isString}}{{^isEnum}}@{{/isEnum}}{{/isString}}"{{{defaultValue}}}"},
+ {{#enumValues}}
+ {{#-first}}
+ {
+ "enum_values", new List() {
+ {{/-first}}
+ "{{{.}}}"{{^-last}},{{/-last}}
+ {{#-last}}
+ }
+ }
+ {{/-last}}
+ {{/enumValues}}
+ }
+ }{{^-last}},{{/-last}}
+ {{#-last}}
+ }
+ }
+ {{/-last}}
+ {{/variables}}
+ }
+ }{{^-last}},{{/-last}}
+ {{#-last}}
+ };
+ {{/-last}}
+ {{/servers}}
+ OperationServers = new Dictionary>>()
+ {
+ {{#apiInfo}}
+ {{#apis}}
+ {{#operations}}
+ {{#operation}}
+ {{#servers.0}}
+ {
+ "{{{classname}}}.{{{nickname}}}", new List>
+ {
+ {{#servers}}
+ {
+ new Dictionary
+ {
+ {"url", "{{{url}}}"},
+ {"description", "{{{description}}}{{^description}}No description provided{{/description}}"}
+ }
+ },
+ {{/servers}}
+ }
+ },
+ {{/servers.0}}
+ {{/operation}}
+ {{/operations}}
+ {{/apis}}
+ {{/apiInfo}}
+ };
+
+ // Setting Timeout has side effects (forces ApiClient creation).
+ Timeout = 100000;
+ }
+
+ ///
+ /// Initializes a new instance of the class
+ ///
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")]
+ public Configuration(
+ IDictionary defaultHeaders,
+ IDictionary apiKey,
+ IDictionary apiKeyPrefix,
+ string basePath = "{{{basePath}}}") : this()
+ {
+ if (string.{{^net35}}IsNullOrWhiteSpace{{/net35}}{{#net35}}IsNullOrEmpty{{/net35}}(basePath))
+ throw new ArgumentException("The provided basePath is invalid.", "basePath");
+ if (defaultHeaders == null)
+ throw new ArgumentNullException("defaultHeaders");
+ if (apiKey == null)
+ throw new ArgumentNullException("apiKey");
+ if (apiKeyPrefix == null)
+ throw new ArgumentNullException("apiKeyPrefix");
+
+ BasePath = basePath;
+
+ foreach (var keyValuePair in defaultHeaders)
+ {
+ DefaultHeaders.Add(keyValuePair);
+ }
+
+ foreach (var keyValuePair in apiKey)
+ {
+ ApiKey.Add(keyValuePair);
+ }
+
+ foreach (var keyValuePair in apiKeyPrefix)
+ {
+ ApiKeyPrefix.Add(keyValuePair);
+ }
+ }
+
+ #endregion Constructors
+
+ #region Properties
+
+ ///
+ /// Gets or sets the base path for API access.
+ ///
+ public virtual string BasePath
+ {
+ get { return _basePath; }
+ set { _basePath = value; }
+ }
+
+ ///
+ /// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false.
+ ///
+ public virtual bool UseDefaultCredentials
+ {
+ get { return _useDefaultCredentials; }
+ set { _useDefaultCredentials = value; }
+ }
+
+ ///
+ /// Gets or sets the default header.
+ ///
+ [Obsolete("Use DefaultHeaders instead.")]
+ public virtual IDictionary DefaultHeader
+ {
+ get
+ {
+ return DefaultHeaders;
+ }
+ set
+ {
+ DefaultHeaders = value;
+ }
+ }
+
+ ///
+ /// Gets or sets the default headers.
+ ///
+ public virtual IDictionary DefaultHeaders { get; set; }
+
+ ///
+ /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds.
+ ///
+ public virtual int Timeout { get; set; }
+
+ ///
+ /// Gets or sets the proxy
+ ///
+ /// Proxy.
+ public virtual WebProxy Proxy { get; set; }
+
+ ///
+ /// Gets or sets the HTTP user agent.
+ ///
+ /// Http user agent.
+ public virtual string UserAgent { get; set; }
+
+ ///
+ /// Gets or sets the username (HTTP basic authentication).
+ ///
+ /// The username.
+ public virtual string Username { get; set; }
+
+ ///
+ /// Gets or sets the password (HTTP basic authentication).
+ ///
+ /// The password.
+ public virtual string Password { get; set; }
+
+ ///
+ /// Gets the API key with prefix.
+ ///
+ /// API key identifier (authentication scheme).
+ /// API key with prefix.
+ public string GetApiKeyWithPrefix(string apiKeyIdentifier)
+ {
+ string apiKeyValue;
+ ApiKey.TryGetValue(apiKeyIdentifier, out apiKeyValue);
+ string apiKeyPrefix;
+ if (ApiKeyPrefix.TryGetValue(apiKeyIdentifier, out apiKeyPrefix))
+ {
+ return apiKeyPrefix + " " + apiKeyValue;
+ }
+
+ return apiKeyValue;
+ }
+
+ ///
+ /// Gets or sets certificate collection to be sent with requests.
+ ///
+ /// X509 Certificate collection.
+ public X509CertificateCollection ClientCertificates { get; set; }
+
+ ///
+ /// Gets or sets the access token for OAuth2 authentication.
+ ///
+ /// This helper property simplifies code generation.
+ ///
+ /// The access token.
+ public virtual string AccessToken { get; set; }
+
+ {{#useRestSharp}}
+ {{#hasOAuthMethods}}
+ ///
+ /// Gets or sets the token URL for OAuth2 authentication.
+ ///
+ /// The OAuth Token URL.
+ public virtual string OAuthTokenUrl { get; set; }
+
+ ///
+ /// Gets or sets the client ID for OAuth2 authentication.
+ ///
+ /// The OAuth Client ID.
+ public virtual string OAuthClientId { get; set; }
+
+ ///
+ /// Gets or sets the client secret for OAuth2 authentication.
+ ///
+ /// The OAuth Client Secret.
+ public virtual string OAuthClientSecret { get; set; }
+
+ ///
+ /// Gets or sets the flow for OAuth2 authentication.
+ ///
+ /// The OAuth Flow.
+ public virtual OAuthFlow? OAuthFlow { get; set; }
+
+ {{/hasOAuthMethods}}
+ {{/useRestSharp}}
+ ///
+ /// Gets or sets the temporary folder path to store the files downloaded from the server.
+ ///
+ /// Folder path.
+ public virtual string TempFolderPath
+ {
+ get { return _tempFolderPath; }
+
+ set
+ {
+ if (string.IsNullOrEmpty(value))
+ {
+ _tempFolderPath = Path.GetTempPath();
+ return;
+ }
+
+ // create the directory if it does not exist
+ if (!Directory.Exists(value))
+ {
+ Directory.CreateDirectory(value);
+ }
+
+ // check if the path contains directory separator at the end
+ if (value[value.Length - 1] == Path.DirectorySeparatorChar)
+ {
+ _tempFolderPath = value;
+ }
+ else
+ {
+ _tempFolderPath = value + Path.DirectorySeparatorChar;
+ }
+ }
+ }
+
+ ///
+ /// 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
+ ///
+ /// The DateTimeFormat string
+ public virtual string DateTimeFormat
+ {
+ get { return _dateTimeFormat; }
+ set
+ {
+ if (string.IsNullOrEmpty(value))
+ {
+ // Never allow a blank or null string, go back to the default
+ _dateTimeFormat = ISO8601_DATETIME_FORMAT;
+ return;
+ }
+
+ // Caution, no validation when you choose date time format other than ISO 8601
+ // Take a look at the above links
+ _dateTimeFormat = value;
+ }
+ }
+
+ ///
+ /// 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.
+ ///
+ ///
+ /// OAuth2 workflows should set tokens via AccessToken.
+ ///
+ ///
+ /// The prefix of the API key.
+ public virtual IDictionary ApiKeyPrefix
+ {
+ get { return _apiKeyPrefix; }
+ set
+ {
+ if (value == null)
+ {
+ throw new InvalidOperationException("ApiKeyPrefix collection may not be null.");
+ }
+ _apiKeyPrefix = value;
+ }
+ }
+
+ ///
+ /// Gets or sets the API key based on the authentication name.
+ ///
+ /// The API key.
+ public virtual IDictionary ApiKey
+ {
+ get { return _apiKey; }
+ set
+ {
+ if (value == null)
+ {
+ throw new InvalidOperationException("ApiKey collection may not be null.");
+ }
+ _apiKey = value;
+ }
+ }
+ {{#servers.0}}
+
+ ///
+ /// Gets or sets the servers.
+ ///
+ /// The servers.
+ public virtual IList> Servers
+ {
+ get { return _servers; }
+ set
+ {
+ if (value == null)
+ {
+ throw new InvalidOperationException("Servers may not be null.");
+ }
+ _servers = value;
+ }
+ }
+
+ ///
+ /// Gets or sets the operation servers.
+ ///
+ /// The operation servers.
+ public virtual IReadOnlyDictionary>> OperationServers
+ {
+ get { return _operationServers; }
+ set
+ {
+ if (value == null)
+ {
+ throw new InvalidOperationException("Operation servers may not be null.");
+ }
+ _operationServers = value;
+ }
+ }
+
+ ///
+ /// Returns URL based on server settings without providing values
+ /// for the variables
+ ///
+ /// Array index of the server settings.
+ /// The server URL.
+ public string GetServerUrl(int index)
+ {
+ return GetServerUrl(Servers, index, null);
+ }
+
+ ///
+ /// Returns URL based on server settings.
+ ///
+ /// Array index of the server settings.
+ /// Dictionary of the variables and the corresponding values.
+ /// The server URL.
+ public string GetServerUrl(int index, Dictionary inputVariables)
+ {
+ return GetServerUrl(Servers, index, inputVariables);
+ }
+
+ ///
+ /// Returns URL based on operation server settings.
+ ///
+ /// Operation associated with the request path.
+ /// Array index of the server settings.
+ /// The operation server URL.
+ public string GetOperationServerUrl(string operation, int index)
+ {
+ return GetOperationServerUrl(operation, index, null);
+ }
+
+ ///
+ /// Returns URL based on operation server settings.
+ ///
+ /// Operation associated with the request path.
+ /// Array index of the server settings.
+ /// Dictionary of the variables and the corresponding values.
+ /// The operation server URL.
+ public string GetOperationServerUrl(string operation, int index, Dictionary inputVariables)
+ {
+ if (operation != null && OperationServers.TryGetValue(operation, out var operationServer))
+ {
+ return GetServerUrl(operationServer, index, inputVariables);
+ }
+
+ return null;
+ }
+
+ ///
+ /// Returns URL based on server settings.
+ ///
+ /// Dictionary of server settings.
+ /// Array index of the server settings.
+ /// Dictionary of the variables and the corresponding values.
+ /// The server URL.
+ private string GetServerUrl(IList> servers, int index, Dictionary inputVariables)
+ {
+ if (index < 0 || index >= servers.Count)
+ {
+ throw new InvalidOperationException($"Invalid index {index} when selecting the server. Must be less than {servers.Count}.");
+ }
+
+ if (inputVariables == null)
+ {
+ inputVariables = new Dictionary();
+ }
+
+ IReadOnlyDictionary server = servers[index];
+ string url = (string)server["url"];
+
+ if (server.ContainsKey("variables"))
+ {
+ // go through each variable and assign a value
+ foreach (KeyValuePair variable in (IReadOnlyDictionary)server["variables"])
+ {
+
+ IReadOnlyDictionary serverVariables = (IReadOnlyDictionary)(variable.Value);
+
+ if (inputVariables.ContainsKey(variable.Key))
+ {
+ if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key]))
+ {
+ url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]);
+ }
+ else
+ {
+ throw new InvalidOperationException($"The variable `{variable.Key}` in the server URL has invalid value #{inputVariables[variable.Key]}. Must be {(List)serverVariables["enum_values"]}");
+ }
+ }
+ else
+ {
+ // use default value
+ url = url.Replace("{" + variable.Key + "}", (string)serverVariables["default_value"]);
+ }
+ }
+ }
+
+ return url;
+ }
+ {{/servers.0}}
+ {{#hasHttpSignatureMethods}}
+
+ ///
+ /// Gets and Sets the HttpSigningConfiguration
+ ///
+ public HttpSigningConfiguration HttpSigningConfiguration
+ {
+ get { return _HttpSigningConfiguration; }
+ set { _HttpSigningConfiguration = value; }
+ }
+ {{/hasHttpSignatureMethods}}
+
+ ///
+ /// Gets and Sets the RemoteCertificateValidationCallback
+ ///
+ public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; }
+
+ #endregion Properties
+
+ #region Methods
+
+ ///
+ /// Returns a string with essential information for debugging.
+ ///
+ public static string ToDebugReport()
+ {
+ string report = "C# SDK ({{{packageName}}}) Debug Report:\n";
+ report += " OS: " + System.Environment.OSVersion + "\n";
+ report += " .NET Framework Version: " + System.Environment.Version + "\n";
+ report += " Version of the API: {{{version}}}\n";
+ report += " SDK Package Version: {{{packageVersion}}}\n";
+
+ return report;
+ }
+
+ ///
+ /// Add Api Key Header.
+ ///
+ /// Api Key name.
+ /// Api Key value.
+ ///
+ public void AddApiKey(string key, string value)
+ {
+ ApiKey[key] = value;
+ }
+
+ ///
+ /// Sets the API key prefix.
+ ///
+ /// Api Key name.
+ /// Api Key value.
+ public void AddApiKeyPrefix(string key, string value)
+ {
+ ApiKeyPrefix[key] = value;
+ }
+
+ #endregion Methods
+
+ #region Static Members
+ ///
+ /// Merge configurations.
+ ///
+ /// First configuration.
+ /// Second configuration.
+ /// Merged configuration.
+ public static IReadableConfiguration MergeConfigurations(IReadableConfiguration first, IReadableConfiguration second)
+ {
+ if (second == null) return first ?? GlobalConfiguration.Instance;
+
+ Dictionary apiKey = first.ApiKey.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
+ Dictionary apiKeyPrefix = first.ApiKeyPrefix.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
+ Dictionary defaultHeaders = first.DefaultHeaders.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
+
+ foreach (var kvp in second.ApiKey) apiKey[kvp.Key] = kvp.Value;
+ foreach (var kvp in second.ApiKeyPrefix) apiKeyPrefix[kvp.Key] = kvp.Value;
+ foreach (var kvp in second.DefaultHeaders) defaultHeaders[kvp.Key] = kvp.Value;
+
+ var config = new Configuration
+ {
+ ApiKey = apiKey,
+ ApiKeyPrefix = apiKeyPrefix,
+ DefaultHeaders = defaultHeaders,
+ BasePath = second.BasePath ?? first.BasePath,
+ Timeout = second.Timeout,
+ Proxy = second.Proxy ?? first.Proxy,
+ UserAgent = second.UserAgent ?? first.UserAgent,
+ Username = second.Username ?? first.Username,
+ Password = second.Password ?? first.Password,
+ AccessToken = second.AccessToken ?? first.AccessToken,
+ {{#useRestSharp}}
+ {{#hasOAuthMethods}}
+ OAuthTokenUrl = second.OAuthTokenUrl ?? first.OAuthTokenUrl,
+ OAuthClientId = second.OAuthClientId ?? first.OAuthClientId,
+ OAuthClientSecret = second.OAuthClientSecret ?? first.OAuthClientSecret,
+ OAuthFlow = second.OAuthFlow ?? first.OAuthFlow,
+ {{/hasOAuthMethods}}
+ {{/useRestSharp}}
+ {{#hasHttpSignatureMethods}}
+ HttpSigningConfiguration = second.HttpSigningConfiguration ?? first.HttpSigningConfiguration,
+ {{/hasHttpSignatureMethods}}
+ TempFolderPath = second.TempFolderPath ?? first.TempFolderPath,
+ DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat,
+ ClientCertificates = second.ClientCertificates ?? first.ClientCertificates,
+ UseDefaultCredentials = second.UseDefaultCredentials,
+ RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback,
+ };
+ return config;
+ }
+ #endregion Static Members
+ }
+}
diff --git a/custom_templates/README.mustache b/custom_templates/README.mustache
new file mode 100644
index 0000000..9b6ffe7
--- /dev/null
+++ b/custom_templates/README.mustache
@@ -0,0 +1,270 @@
+# {{packageName}} - the C# library for the {{appName}}
+
+{{#appDescriptionWithNewLines}}
+{{{.}}}
+{{/appDescriptionWithNewLines}}
+
+This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
+
+- API version: {{appVersion}}
+- SDK version: {{packageVersion}}
+{{^hideGenerationTimestamp}}
+- Build date: {{generatedDate}}
+{{/hideGenerationTimestamp}}
+- Generator version: {{generatorVersion}}
+- Build package: {{generatorClass}}
+{{#infoUrl}}
+ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
+{{/infoUrl}}
+
+
+## Frameworks supported
+{{#netStandard}}
+- .NET Core >=1.0
+- .NET Framework >=4.6
+- Mono/Xamarin >=vNext
+{{/netStandard}}
+
+
+## Dependencies
+
+{{#useRestSharp}}
+- [RestSharp](https://www.nuget.org/packages/RestSharp) - 112.0.0 or later
+{{/useRestSharp}}
+- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 13.0.2 or later
+- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.8.0 or later
+{{#useCompareNetObjects}}
+- [CompareNETObjects](https://www.nuget.org/packages/CompareNETObjects) - 4.61.0 or later
+{{/useCompareNetObjects}}
+{{#validatable}}
+- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 5.0.0 or later
+{{/validatable}}
+
+The DLLs included in the package may not be the latest version. We recommend using [NuGet](https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages:
+```
+{{#useRestSharp}}
+Install-Package RestSharp
+{{/useRestSharp}}
+Install-Package Newtonsoft.Json
+Install-Package JsonSubTypes
+{{#validatable}}
+Install-Package System.ComponentModel.Annotations
+{{/validatable}}
+{{#useCompareNetObjects}}
+Install-Package CompareNETObjects
+{{/useCompareNetObjects}}
+```
+{{#useRestSharp}}
+
+NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742).
+NOTE: RestSharp for .Net Core creates a new socket for each api call, which can lead to a socket exhaustion problem. See [RestSharp#1406](https://github.com/restsharp/RestSharp/issues/1406).
+
+{{/useRestSharp}}
+
+## Installation
+{{#netStandard}}
+Generate the DLL using your preferred tool (e.g. `dotnet build`)
+{{/netStandard}}
+{{^netStandard}}
+Run the following command to generate the DLL
+- [Mac/Linux] `/bin/sh build.sh`
+- [Windows] `build.bat`
+{{/netStandard}}
+
+Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces:
+```csharp
+using {{packageName}}.{{apiPackage}};
+using {{packageName}}.Client;
+using {{packageName}}.{{modelPackage}};
+```
+{{^netStandard}}
+
+## Packaging
+
+A `.nuspec` is included with the project. You can follow the Nuget quickstart to [create](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package#create-the-package) and [publish](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package#publish-the-package) packages.
+
+This `.nuspec` uses placeholders from the `.csproj`, so build the `.csproj` directly:
+
+```
+nuget pack -Build -OutputDirectory out {{packageName}}.csproj
+```
+
+Then, publish to a [local feed](https://docs.microsoft.com/en-us/nuget/hosting-packages/local-feeds) or [other host](https://docs.microsoft.com/en-us/nuget/hosting-packages/overview) and consume the new package via Nuget as usual.
+
+{{/netStandard}}
+
+## Usage
+
+To use the API client with a HTTP proxy, setup a `System.Net.WebProxy`
+```csharp
+Configuration c = new Configuration();
+System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/");
+webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
+c.Proxy = webProxy;
+```
+{{#useHttpClient}}
+
+### Connections
+Each ApiClass (properly the ApiClient inside it) will create an instance of HttpClient. It will use that for the entire lifecycle and dispose it when called the Dispose method.
+
+To better manager the connections it's a common practice to reuse the HttpClient and HttpClientHandler (see [here](https://docs.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/use-httpclientfactory-to-implement-resilient-http-requests#issues-with-the-original-httpclient-class-available-in-net) for details). To use your own HttpClient instance just pass it to the ApiClass constructor.
+
+```csharp
+HttpClientHandler yourHandler = new HttpClientHandler();
+HttpClient yourHttpClient = new HttpClient(yourHandler);
+var api = new YourApiClass(yourHttpClient, yourHandler);
+```
+
+If you want to use an HttpClient and don't have access to the handler, for example in a DI context in Asp.net Core when using IHttpClientFactory.
+
+```csharp
+HttpClient yourHttpClient = new HttpClient();
+var api = new YourApiClass(yourHttpClient);
+```
+You'll loose some configuration settings, the features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. You need to either manually handle those in your setup of the HttpClient or they won't be available.
+
+Here an example of DI setup in a sample web project:
+
+```csharp
+services.AddHttpClient(httpClient =>
+ new PetApi(httpClient));
+```
+
+{{/useHttpClient}}
+
+
+## Getting Started
+
+```csharp
+using System.Collections.Generic;
+using System.Diagnostics;
+{{#useHttpClient}}
+using System.Net.Http;
+{{/useHttpClient}}
+using {{packageName}}.{{apiPackage}};
+using {{packageName}}.Client;
+using {{packageName}}.{{modelPackage}};
+
+namespace Example
+{
+ public class {{operationId}}Example
+ {
+ public static void Main()
+ {
+{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}
+ Configuration config = new Configuration();
+ config.BasePath = "{{{basePath}}}";
+ {{#hasAuthMethods}}
+ {{#authMethods}}
+ {{#isBasicBasic}}
+ // Configure HTTP basic authorization: {{{name}}}
+ config.Username = "YOUR_USERNAME";
+ config.Password = "YOUR_PASSWORD";
+ {{/isBasicBasic}}
+ {{#isBasicBearer}}
+ // Configure Bearer token for authorization: {{{name}}}
+ config.AccessToken = "YOUR_BEARER_TOKEN";
+ {{/isBasicBearer}}
+ {{#isApiKey}}
+ // Configure API key authorization: {{{name}}}
+ config.ApiKey.Add("{{{keyParamName}}}", "YOUR_API_KEY");
+ // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
+ // config.ApiKeyPrefix.Add("{{{keyParamName}}}", "Bearer");
+ {{/isApiKey}}
+ {{#isOAuth}}
+ // Configure OAuth2 access token for authorization: {{{name}}}
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
+ // Or use clientId/clientSecret for OAuth2 authorization
+ config.OAuthClientId = "YOUR_CLIENT_ID";
+ config.OAuthClientSecret = "YOUR_CLIENT_SECRET";
+ {{/isOAuth}}
+ {{/authMethods}}
+
+ {{/hasAuthMethods}}
+ {{#useHttpClient}}
+ // create instances of HttpClient, HttpClientHandler to be reused later with different Api classes
+ HttpClient httpClient = new HttpClient();
+ HttpClientHandler httpClientHandler = new HttpClientHandler();
+ var apiInstance = new {{classname}}(httpClient, config, httpClientHandler);
+ {{/useHttpClient}}
+ {{^useHttpClient}}
+ var apiInstance = new {{classname}}(config);
+ {{/useHttpClient}}
+ {{#allParams}}
+ {{#isPrimitiveType}}
+ var {{paramName}} = {{{example}}}; // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
+ {{/isPrimitiveType}}
+ {{^isPrimitiveType}}
+ var {{paramName}} = new {{{dataType}}}(); // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
+ {{/isPrimitiveType}}
+ {{/allParams}}
+
+ try
+ {
+ {{#summary}}
+ // {{{.}}}
+ {{/summary}}
+ {{#returnType}}{{{.}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}}
+ Debug.WriteLine(result);{{/returnType}}
+ }
+ catch (ApiException e)
+ {
+ Debug.Print("Exception when calling {{classname}}.{{operationId}}: " + e.Message );
+ Debug.Print("Status Code: "+ e.ErrorCode);
+ Debug.Print(e.StackTrace);
+ }
+{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
+ }
+ }
+}
+```
+
+
+## Documentation for API Endpoints
+
+All URIs are relative to *{{{basePath}}}*
+
+Class | Method | HTTP request | Description
+------------ | ------------- | ------------- | -------------
+{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{{summary}}}
+{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
+
+
+## Documentation for Models
+
+{{#modelPackage}}
+{{#models}}{{#model}} - [{{{modelPackage}}}.{{{classname}}}]({{modelDocPath}}{{{classname}}}.md)
+{{/model}}{{/models}}
+{{/modelPackage}}
+{{^modelPackage}}
+No model defined in this package
+{{/modelPackage}}
+
+
+## Documentation for Authorization
+
+{{^authMethods}}Endpoints do not require authorization.{{/authMethods}}
+{{#hasAuthMethods}}Authentication schemes defined for the API:{{/hasAuthMethods}}
+{{#authMethods}}
+
+### {{name}}
+
+{{#isApiKey}}- **Type**: API key
+- **API key parameter name**: {{keyParamName}}
+- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
+{{/isApiKey}}
+{{#isBasicBasic}}- **Type**: HTTP basic authentication
+{{/isBasicBasic}}
+{{#isBasicBearer}}- **Type**: Bearer Authentication
+{{/isBasicBearer}}
+{{#isHttpSignature}}- **Type**: HTTP signature authentication
+{{/isHttpSignature}}
+{{#isOAuth}}- **Type**: OAuth
+- **Flow**: {{flow}}
+- **Authorization URL**: {{tokenUrl}}
+- **Scopes**: {{^scopes}}N/A{{/scopes}}
+{{#scopes}} - {{scope}}: {{description}}
+{{/scopes}}
+{{/isOAuth}}
+
+{{/authMethods}}
diff --git a/custom_templates/auth/OAuthAuthenticator.mustache b/custom_templates/auth/OAuthAuthenticator.mustache
new file mode 100644
index 0000000..4faec1e
--- /dev/null
+++ b/custom_templates/auth/OAuthAuthenticator.mustache
@@ -0,0 +1,97 @@
+{{>partial_header}}
+
+using System;
+using System.Threading.Tasks;
+using Newtonsoft.Json;
+using RestSharp;
+using RestSharp.Authenticators;
+
+namespace {{packageName}}.Client.Auth
+{
+ ///
+ /// An authenticator for OAuth2 authentication flows
+ ///
+ public class OAuthAuthenticator : AuthenticatorBase
+ {
+ readonly string _tokenUrl;
+ readonly string _clientId;
+ readonly string _clientSecret;
+ readonly string _grantType;
+ readonly JsonSerializerSettings _serializerSettings;
+ readonly IReadableConfiguration _configuration;
+
+ ///
+ /// Initialize the OAuth2 Authenticator
+ ///
+ public OAuthAuthenticator(
+ string tokenUrl,
+ string clientId,
+ string clientSecret,
+ OAuthFlow? flow,
+ JsonSerializerSettings serializerSettings,
+ IReadableConfiguration configuration) : base("")
+ {
+ _tokenUrl = tokenUrl;
+ _clientId = clientId;
+ _clientSecret = clientSecret;
+ _serializerSettings = serializerSettings;
+ _configuration = configuration;
+
+ switch (flow)
+ {
+ /*case OAuthFlow.ACCESS_CODE:
+ _grantType = "authorization_code";
+ break;
+ case OAuthFlow.IMPLICIT:
+ _grantType = "implicit";
+ break;
+ case OAuthFlow.PASSWORD:
+ _grantType = "password";
+ break;*/
+ case OAuthFlow.APPLICATION:
+ _grantType = "client_credentials";
+ break;
+ default:
+ break;
+ }
+ }
+
+ ///
+ /// Creates an authentication parameter from an access token.
+ ///
+ /// Access token to create a parameter from.
+ /// An authentication parameter.
+ protected override async ValueTask GetAuthenticationParameter(string accessToken)
+ {
+ var token = string.IsNullOrEmpty(Token) ? await GetToken().ConfigureAwait(false) : Token;
+ return new HeaderParameter(KnownHeaders.Authorization, token);
+ }
+
+ ///
+ /// Gets the token from the OAuth2 server.
+ ///
+ /// An authentication token.
+ async Task GetToken()
+ {
+ var client = new RestClient(_tokenUrl,
+ configureSerialization: serializerConfig => serializerConfig.UseSerializer(() => new CustomJsonCodec(_serializerSettings, _configuration)));
+
+ var credentials = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes($"{_clientId}:{_clientSecret}"));
+ var request = new RestRequest()
+ .AddHeader("Authorization", $"Basic {credentials}")
+ .AddParameter("grant_type", _grantType, ParameterType.GetOrPost);
+ var response = await client.PostAsync(request).ConfigureAwait(false);
+
+ // RFC6749 - token_type is case insensitive.
+ // RFC6750 - In Authorization header Bearer should be capitalized.
+ // Fix the capitalization irrespective of token_type casing.
+ switch (response.TokenType?.ToLower())
+ {
+ case "bearer":
+ return $"Bearer {response.AccessToken}";
+ default:
+ return $"{response.TokenType} {response.AccessToken}";
+ }
+ }
+ }
+}
diff --git a/docs/CallsApi.md b/docs/CallsApi.md
index 05a24cf..0b466eb 100644
--- a/docs/CallsApi.md
+++ b/docs/CallsApi.md
@@ -37,6 +37,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new CallsApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -92,7 +94,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -142,6 +144,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new CallsApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -197,7 +201,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -247,6 +251,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new CallsApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -314,7 +320,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -364,6 +370,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new CallsApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -417,7 +425,7 @@ void (empty response body)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -468,6 +476,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new CallsApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -524,7 +534,7 @@ void (empty response body)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
diff --git a/docs/ConferencesApi.md b/docs/ConferencesApi.md
index 1d6da39..b956ad8 100644
--- a/docs/ConferencesApi.md
+++ b/docs/ConferencesApi.md
@@ -41,6 +41,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new ConferencesApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -98,7 +100,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -148,6 +150,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new ConferencesApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -203,7 +207,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -253,6 +257,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new ConferencesApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -310,7 +316,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -360,6 +366,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new ConferencesApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -417,7 +425,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -467,6 +475,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new ConferencesApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -522,7 +532,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -572,6 +582,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new ConferencesApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -635,7 +647,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -685,6 +697,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new ConferencesApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -738,7 +752,7 @@ void (empty response body)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -788,6 +802,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new ConferencesApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -844,7 +860,7 @@ void (empty response body)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -894,6 +910,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new ConferencesApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -949,7 +967,7 @@ void (empty response body)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
diff --git a/docs/MFAApi.md b/docs/MFAApi.md
index 525197a..c8d7e4a 100644
--- a/docs/MFAApi.md
+++ b/docs/MFAApi.md
@@ -35,6 +35,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new MFAApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -90,7 +92,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -136,6 +138,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new MFAApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -191,7 +195,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -237,6 +241,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new MFAApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -292,7 +298,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
diff --git a/docs/MediaApi.md b/docs/MediaApi.md
index da780d2..dc2862f 100644
--- a/docs/MediaApi.md
+++ b/docs/MediaApi.md
@@ -36,6 +36,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new MediaApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -87,7 +89,7 @@ void (empty response body)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -137,6 +139,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new MediaApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -192,7 +196,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -242,6 +246,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new MediaApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -297,7 +303,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -347,6 +353,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new MediaApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -404,7 +412,7 @@ void (empty response body)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
diff --git a/docs/MessagesApi.md b/docs/MessagesApi.md
index 52296ff..ddd281a 100644
--- a/docs/MessagesApi.md
+++ b/docs/MessagesApi.md
@@ -34,6 +34,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new MessagesApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -89,7 +91,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -140,6 +142,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new MessagesApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -247,7 +251,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
diff --git a/docs/MultiChannelApi.md b/docs/MultiChannelApi.md
index 9bef903..5df7ea1 100644
--- a/docs/MultiChannelApi.md
+++ b/docs/MultiChannelApi.md
@@ -33,6 +33,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new MultiChannelApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -88,7 +90,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
diff --git a/docs/PhoneNumberLookupApi.md b/docs/PhoneNumberLookupApi.md
index 14265b4..2df516d 100644
--- a/docs/PhoneNumberLookupApi.md
+++ b/docs/PhoneNumberLookupApi.md
@@ -35,6 +35,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new PhoneNumberLookupApi(config);
var accountId = 9900000; // string |
@@ -90,7 +92,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -133,6 +135,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new PhoneNumberLookupApi(config);
var accountId = 9900000; // string |
@@ -188,7 +192,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -231,6 +235,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new PhoneNumberLookupApi(config);
var accountId = 9900000; // string |
@@ -286,7 +292,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
diff --git a/docs/RecordingsApi.md b/docs/RecordingsApi.md
index ec1e1b3..21fdfb8 100644
--- a/docs/RecordingsApi.md
+++ b/docs/RecordingsApi.md
@@ -42,6 +42,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new RecordingsApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -95,7 +97,7 @@ void (empty response body)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -145,6 +147,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new RecordingsApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -198,7 +202,7 @@ void (empty response body)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -248,6 +252,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new RecordingsApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -301,7 +307,7 @@ void (empty response body)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -351,6 +357,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new RecordingsApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -408,7 +416,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -458,6 +466,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new RecordingsApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -515,7 +525,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -565,6 +575,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new RecordingsApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -622,7 +634,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -672,6 +684,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new RecordingsApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -733,7 +747,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -783,6 +797,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new RecordingsApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -838,7 +854,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -888,6 +904,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new RecordingsApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -943,7 +961,7 @@ void (empty response body)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -993,6 +1011,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new RecordingsApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -1046,7 +1066,7 @@ void (empty response body)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
diff --git a/docs/StatisticsApi.md b/docs/StatisticsApi.md
index 73aa157..075657f 100644
--- a/docs/StatisticsApi.md
+++ b/docs/StatisticsApi.md
@@ -33,6 +33,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new StatisticsApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -86,7 +88,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
diff --git a/docs/TollFreeVerificationApi.md b/docs/TollFreeVerificationApi.md
index 6915196..bb69f97 100644
--- a/docs/TollFreeVerificationApi.md
+++ b/docs/TollFreeVerificationApi.md
@@ -41,6 +41,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new TollFreeVerificationApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -96,7 +98,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -146,6 +148,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new TollFreeVerificationApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -197,7 +201,7 @@ void (empty response body)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -247,6 +251,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new TollFreeVerificationApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -298,7 +304,7 @@ void (empty response body)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -348,6 +354,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new TollFreeVerificationApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -403,7 +411,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -453,6 +461,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new TollFreeVerificationApi(config);
@@ -501,7 +511,7 @@ This endpoint does not need any parameter.
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -551,6 +561,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new TollFreeVerificationApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -604,7 +616,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -653,6 +665,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new TollFreeVerificationApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -704,7 +718,7 @@ void (empty response body)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -753,6 +767,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new TollFreeVerificationApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -806,7 +822,7 @@ void (empty response body)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -855,6 +871,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new TollFreeVerificationApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -912,7 +930,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
diff --git a/docs/TranscriptionsApi.md b/docs/TranscriptionsApi.md
index 577c33a..4cf6b66 100644
--- a/docs/TranscriptionsApi.md
+++ b/docs/TranscriptionsApi.md
@@ -35,6 +35,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new TranscriptionsApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -88,7 +90,7 @@ void (empty response body)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -138,6 +140,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new TranscriptionsApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -195,7 +199,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
@@ -245,6 +249,8 @@ namespace Example
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
+ // Configure OAuth2 access token for authorization: OAuth2
+ config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new TranscriptionsApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -300,7 +306,7 @@ catch (ApiException e)
### Authorization
-[Basic](../README.md#Basic)
+[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
### HTTP request headers
diff --git a/openapi-config.yml b/openapi-config.yml
index eb60951..819e9a4 100644
--- a/openapi-config.yml
+++ b/openapi-config.yml
@@ -2,3 +2,4 @@ apiName: Bandwidth
packageName: Bandwidth.Standard
packageTags: Bandwidth
targetFramework: netstandard2.0
+templateDir: custom_templates
diff --git a/src/Bandwidth.Standard.Test/Smoke/CallsIntegrationTests.cs b/src/Bandwidth.Standard.Test/Smoke/CallsIntegrationTests.cs
index 51d1bb1..07d4c8b 100644
--- a/src/Bandwidth.Standard.Test/Smoke/CallsIntegrationTests.cs
+++ b/src/Bandwidth.Standard.Test/Smoke/CallsIntegrationTests.cs
@@ -16,7 +16,9 @@ public class CallsSmokeTests : IDisposable
{
private string accountId;
private CreateCall createCallBody;
- private Configuration fakeConfiguration;
+ private Configuration configuration;
+ private Configuration unauthorizedConfiguration;
+ private Configuration forbiddenConfiguration;
private UpdateCall fakeUpdateCall;
private CallsApi forbiddenInstance;
private CallsApi instance;
@@ -31,21 +33,23 @@ public CallsSmokeTests()
testCallId = "testCallId";
// Authorized API Client
- fakeConfiguration = new Configuration();
- fakeConfiguration.BasePath = "https://voice.bandwidth.com/api/v2";
- fakeConfiguration.Username = Environment.GetEnvironmentVariable("BW_USERNAME");
- fakeConfiguration.Password = Environment.GetEnvironmentVariable("BW_PASSWORD");
- instance = new CallsApi(fakeConfiguration);
+ configuration = new Configuration();
+ configuration.BasePath = "https://voice.bandwidth.com/api/v2";
+ configuration.OAuthClientId = Environment.GetEnvironmentVariable("BW_CLIENT_ID");
+ configuration.OAuthClientSecret = Environment.GetEnvironmentVariable("BW_CLIENT_SECRET");
+ instance = new CallsApi(configuration);
// Unauthorized API Client
- fakeConfiguration.Username = "badUsername";
- fakeConfiguration.Password = "badPassword";
- unauthorizedInstance = new CallsApi(fakeConfiguration);
+ unauthorizedConfiguration = new Configuration();
+ unauthorizedConfiguration.Username = "badUsername";
+ unauthorizedConfiguration.Password = "badPassword";
+ unauthorizedInstance = new CallsApi(unauthorizedConfiguration);
// Forbidden API Client
- fakeConfiguration.Username = Environment.GetEnvironmentVariable("BW_USERNAME_FORBIDDEN");
- fakeConfiguration.Password = Environment.GetEnvironmentVariable("BW_PASSWORD_FORBIDDEN");
- forbiddenInstance = new CallsApi(fakeConfiguration);
+ forbiddenConfiguration = new Configuration();
+ forbiddenConfiguration.Username = Environment.GetEnvironmentVariable("BW_USERNAME_FORBIDDEN");
+ forbiddenConfiguration.Password = Environment.GetEnvironmentVariable("BW_PASSWORD_FORBIDDEN");
+ forbiddenInstance = new CallsApi(forbiddenConfiguration);
createCallBody = new CreateCall(
to: Environment.GetEnvironmentVariable("USER_NUMBER"),
@@ -114,9 +118,9 @@ public void Dispose()
///
/// Test successful CreateCall request
///
- [Fact]
+ [Fact]
public void CreateCallTest()
- {
+ {
ApiResponse response = instance.CreateCallWithHttpInfo(accountId, createCallBody);
Assert.Equal(HttpStatusCode.Created, response.StatusCode);
Assert.IsType(response.Data.CallId);
@@ -227,7 +231,7 @@ public void ListCallsUnauthorizedRequest()
{
ApiException Exception = Assert.Throws(() => unauthorizedInstance.ListCallsWithHttpInfo(accountId));
Assert.Equal(401, Exception.ErrorCode);
- }
+ }
///
/// Test ListCalls with a forbidden client
@@ -262,12 +266,12 @@ public void UpdateCallTest()
);
System.Threading.Thread.Sleep(testSleep);
-
+
ApiResponse