Skip to content

Commit c21b4c4

Browse files
band-swi-release-engineering[bot]DX-Bandwidthckoegel
authored
SWI-8857 Add Oauth (#168)
* Generate SDK with OpenAPI Generator Version * update oauth files to match request * update smoke tests * update smoke tests * update templates --------- Co-authored-by: DX-Bandwidth <[email protected]> Co-authored-by: ckoegel <[email protected]>
1 parent b0f6c10 commit c21b4c4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+3314
-211
lines changed

.github/workflows/deploy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
1616
BW_USERNAME: ${{ secrets.BW_USERNAME }}
1717
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
18+
BW_CLIENT_ID: ${{ secrets.BW_CLIENT_ID }}
19+
BW_CLIENT_SECRET: ${{ secrets.BW_CLIENT_SECRET }}
1820
BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN}}
1921
BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN}}
2022
BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }}

.github/workflows/test-pr.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ env:
1313
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
1414
BW_USERNAME: ${{ secrets.BW_USERNAME }}
1515
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
16+
BW_CLIENT_ID: ${{ secrets.BW_CLIENT_ID }}
17+
BW_CLIENT_SECRET: ${{ secrets.BW_CLIENT_SECRET }}
1618
BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN}}
1719
BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN}}
1820
BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }}

.github/workflows/test-smoke.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ concurrency:
1515
env:
1616
BW_USERNAME: ${{ secrets.BW_USERNAME }}
1717
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
18+
BW_CLIENT_ID: ${{ secrets.BW_CLIENT_ID }}
19+
BW_CLIENT_SECRET: ${{ secrets.BW_CLIENT_SECRET }}
1820
BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN }}
1921
BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN }}
2022
USER_NUMBER: ${{ secrets.USER_NUMBER }}

.openapi-generator/FILES

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ src/Bandwidth.Standard/Api/TranscriptionsApi.cs
202202
src/Bandwidth.Standard/Client/ApiClient.cs
203203
src/Bandwidth.Standard/Client/ApiException.cs
204204
src/Bandwidth.Standard/Client/ApiResponse.cs
205+
src/Bandwidth.Standard/Client/Auth/OAuthAuthenticator.cs
206+
src/Bandwidth.Standard/Client/Auth/OAuthFlow.cs
207+
src/Bandwidth.Standard/Client/Auth/TokenResponse.cs
205208
src/Bandwidth.Standard/Client/ClientUtils.cs
206209
src/Bandwidth.Standard/Client/Configuration.cs
207210
src/Bandwidth.Standard/Client/ExceptionFactory.cs

Bandwidth.Standard.sln

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
22
# Visual Studio 14
33
VisualStudioVersion = 14.0.25420.1
44
MinimumVisualStudioVersion = 10.0.40219.1
5-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bandwidth.Standard", "src\Bandwidth.Standard\Bandwidth.Standard.csproj", "{90963038-62D5-4C4E-931F-91B8A5342BAC}"
5+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bandwidth.Standard", "src\Bandwidth.Standard\Bandwidth.Standard.csproj", "{F953FB82-C495-4E6B-9AAA-9DEA798F76D9}"
66
EndProject
77
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bandwidth.Standard.Test", "src\Bandwidth.Standard.Test\Bandwidth.Standard.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}"
88
EndProject
@@ -12,10 +12,10 @@ Global
1212
Release|Any CPU = Release|Any CPU
1313
EndGlobalSection
1414
GlobalSection(ProjectConfigurationPlatforms) = postSolution
15-
{90963038-62D5-4C4E-931F-91B8A5342BAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
16-
{90963038-62D5-4C4E-931F-91B8A5342BAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
17-
{90963038-62D5-4C4E-931F-91B8A5342BAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
18-
{90963038-62D5-4C4E-931F-91B8A5342BAC}.Release|Any CPU.Build.0 = Release|Any CPU
15+
{F953FB82-C495-4E6B-9AAA-9DEA798F76D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
16+
{F953FB82-C495-4E6B-9AAA-9DEA798F76D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
17+
{F953FB82-C495-4E6B-9AAA-9DEA798F76D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
18+
{F953FB82-C495-4E6B-9AAA-9DEA798F76D9}.Release|Any CPU.Build.0 = Release|Any CPU
1919
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2020
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU
2121
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ This C# SDK is automatically generated by the [OpenAPI Generator](https://openap
1919
<a id="dependencies"></a>
2020
## Dependencies
2121

22-
- [RestSharp](https://www.nuget.org/packages/RestSharp) - 106.13.0 or later
22+
- [RestSharp](https://www.nuget.org/packages/RestSharp) - 112.0.0 or later
2323
- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 13.0.2 or later
2424
- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.8.0 or later
2525
- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 5.0.0 or later
@@ -78,6 +78,11 @@ namespace Example
7878
// Configure HTTP basic authorization: Basic
7979
config.Username = "YOUR_USERNAME";
8080
config.Password = "YOUR_PASSWORD";
81+
// Configure OAuth2 access token for authorization: OAuth2
82+
config.AccessToken = "YOUR_ACCESS_TOKEN";
83+
// Or use clientId/clientSecret for OAuth2 authorization
84+
config.OAuthClientId = "YOUR_CLIENT_ID";
85+
config.OAuthClientSecret = "YOUR_CLIENT_SECRET";
8186

8287
var apiInstance = new CallsApi(config);
8388
var accountId = 9900000; // string | Your Bandwidth Account ID.
@@ -349,3 +354,11 @@ Authentication schemes defined for the API:
349354

350355
- **Type**: HTTP basic authentication
351356

357+
<a id="OAuth2"></a>
358+
### OAuth2
359+
360+
- **Type**: OAuth
361+
- **Flow**: application
362+
- **Authorization URL**: https://api.bandwidth.com/api/v1/oauth2/token
363+
- **Scopes**: N/A
364+

api/openapi.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ servers:
1111
- url: /
1212
security:
1313
- Basic: []
14+
- OAuth2: []
1415
tags:
1516
- name: Messages
1617
- name: Media
@@ -14800,4 +14801,10 @@ components:
1480014801
- Example: `Authorization: Basic ZGVtbZpwQDU1dzByZA==`
1480114802
scheme: basic
1480214803
type: http
14804+
OAuth2:
14805+
flows:
14806+
clientCredentials:
14807+
scopes: {}
14808+
tokenUrl: https://api.bandwidth.com/api/v1/oauth2/token
14809+
type: oauth2
1480314810

bandwidth.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ info:
99
version: 1.0.0
1010
security:
1111
- Basic: []
12+
- OAuth2: []
1213
tags:
1314
- name: Messages
1415
- name: Media
@@ -8427,6 +8428,12 @@ components:
84278428
84288429
84298430
- Example: `Authorization: Basic ZGVtbZpwQDU1dzByZA==`
8431+
OAuth2:
8432+
type: oauth2
8433+
flows:
8434+
clientCredentials:
8435+
tokenUrl: https://api.bandwidth.com/api/v1/oauth2/token
8436+
scopes: {}
84308437
callbacks:
84318438
inboundCallback:
84328439
'{inboundCallbackUrl}':

0 commit comments

Comments
 (0)