Skip to content

Commit ae3a0c4

Browse files
Merge pull request #133 from apivideo/csharp-1.5.0
Fix nuget package
2 parents f07db4d + 095735d commit ae3a0c4

13 files changed

+4343
-56
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Changelog
22
All changes to this project will be documented in this file.
33

4+
## [1.5.0] - 2024-07-19
5+
- fix nuget package (closes \#131)
6+
- add *Async() methods (closes \#132)
7+
48
## [1.4.0] - 2024-06-11
59
- .net 5.0 support
610

src/Api/AdvancedAuthenticationApi.cs

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using System.Collections.ObjectModel;
1313
using System.Linq;
1414
using System.Threading;
15+
using System.Threading.Tasks;
1516
using System.IO;
1617
using ApiVideo.Upload;
1718
using RestSharp;
@@ -39,6 +40,21 @@ public AdvancedAuthenticationApi(ApiClient apiClient)
3940
this.ApiClient = apiClient;
4041
}
4142

43+
/// <summary>
44+
/// Get Bearer Token Returns a bearer token that can be used to authenticate other endpoint. You can find the tutorial on using the disposable bearer token [here](https://docs.api.video/reference/disposable-bearer-token-authentication).
45+
/// </summary>
46+
/// <exception cref="ApiVideo.Client.ApiException">Thrown when fails to make API call</exception>
47+
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional)</param>
48+
/// <param name="authenticatePayload"></param>
49+
50+
/// <returns>AccessToken</returns>
51+
public Task<AccessToken> authenticateAsync(AuthenticatePayload authenticatePayload, CancellationToken cancellationToken = default)
52+
{
53+
Task<ApiResponse<AccessToken>> localVarResponse = authenticateWithHttpInfoAsync(authenticatePayload, cancellationToken);
54+
return localVarResponse.ContinueWith((Task<ApiResponse<AccessToken>> task) => task.Result.Data );
55+
56+
}
57+
4258
/// <summary>
4359
/// Get Bearer Token Returns a bearer token that can be used to authenticate other endpoint. You can find the tutorial on using the disposable bearer token [here](https://docs.api.video/reference/disposable-bearer-token-authentication).
4460
/// </summary>
@@ -52,6 +68,80 @@ public AccessToken authenticate(AuthenticatePayload authenticatePayload)
5268
return localVarResponse.Data;
5369
}
5470

71+
72+
/// <summary>
73+
/// Get Bearer Token Returns a bearer token that can be used to authenticate other endpoint. You can find the tutorial on using the disposable bearer token [here](https://docs.api.video/reference/disposable-bearer-token-authentication).
74+
/// </summary>
75+
/// <exception cref="ApiVideo.Client.ApiException">Thrown when fails to make API call</exception>
76+
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional)</param>
77+
/// <param name="authenticatePayload"></param>
78+
79+
/// <returns>ApiResponse of AccessToken</returns>
80+
public Task<ApiResponse<AccessToken>> authenticateWithHttpInfoAsync(AuthenticatePayload authenticatePayload, CancellationToken cancellationToken = default)
81+
{
82+
if (authenticatePayload == null)
83+
throw new ApiException(400,"Missing required parameter 'authenticatePayload' when calling AdvancedAuthenticationApi->authenticate");
84+
85+
if (authenticatePayload != null && authenticatePayload.apikey == null) {
86+
throw new ApiException(400,"Missing required parameter 'authenticatePayload.ApiKey' when calling AdvancedAuthenticationApi->authenticate");
87+
}
88+
89+
// verify the required parameter 'authenticatePayload' is set
90+
if (authenticatePayload == null)
91+
throw new ApiException(400, "Missing required parameter 'authenticatePayload' when calling AdvancedAuthenticationApi->authenticate");
92+
93+
94+
var localVarPath = "/auth/api-key";
95+
var localVarPathParams = new Dictionary<string, string>();
96+
var localVarQueryParams = new List<KeyValuePair<string, string>>();
97+
var localVarHeaderParams = new Dictionary<string, string>();
98+
var localVarFormParams = new Dictionary<string, string>();
99+
var localVarFileParams = new Dictionary<string, FileParameter>();
100+
Object localVarPostBody = null;
101+
102+
// to determine the Content-Type header
103+
string[] localVarContentTypes = new string[] {
104+
"application/json"
105+
};
106+
string localVarContentType = ApiClient.SelectHeaderContentType(localVarContentTypes);
107+
localVarHeaderParams.Add("Content-Type", localVarContentType);
108+
// to determine the Accept header
109+
string[] localVarHttpHeaderAccepts = new string[] {
110+
"application/json"
111+
};
112+
string localVarHttpHeaderAccept = ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
113+
if (localVarHttpHeaderAccept != null)
114+
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
115+
116+
if (authenticatePayload != null && authenticatePayload.GetType() != typeof(byte[]) && authenticatePayload.GetType() != typeof(string))
117+
{
118+
localVarPostBody = this.ApiClient.Serialize(authenticatePayload); // http body (model) parameter
119+
}
120+
else
121+
{
122+
localVarPostBody = authenticatePayload; // byte array
123+
}
124+
125+
126+
127+
128+
// make the HTTP request
129+
Task<RestResponse> localVarResponse = (Task<RestResponse>) this.ApiClient.CallApiAsync(localVarPath,
130+
Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
131+
localVarPathParams, localVarContentType, cancellationToken);
132+
133+
134+
return localVarResponse.ContinueWith((Task<RestResponse> task) =>
135+
{
136+
int localVarStatusCode = (int) task.Result.StatusCode;
137+
return new ApiResponse<AccessToken>(localVarStatusCode,
138+
task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
139+
(AccessToken) this.ApiClient.Deserialize(task.Result, typeof(AccessToken)));
140+
});
141+
142+
}
143+
144+
55145
/// <summary>
56146
/// Get Bearer Token Returns a bearer token that can be used to authenticate other endpoint. You can find the tutorial on using the disposable bearer token [here](https://docs.api.video/reference/disposable-bearer-token-authentication).
57147
/// </summary>
@@ -120,6 +210,21 @@ public ApiResponse<AccessToken> authenticateWithHttpInfo(AuthenticatePayload aut
120210
}
121211

122212

213+
/// <summary>
214+
/// Refresh Bearer Token Accepts the old bearer token and returns a new bearer token that can be used to authenticate other endpoint. You can find the tutorial on using the disposable bearer token [here](https://docs.api.video/reference/disposable-bearer-token-authentication).
215+
/// </summary>
216+
/// <exception cref="ApiVideo.Client.ApiException">Thrown when fails to make API call</exception>
217+
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional)</param>
218+
/// <param name="refreshTokenPayload"></param>
219+
220+
/// <returns>AccessToken</returns>
221+
public Task<AccessToken> refreshAsync(RefreshTokenPayload refreshTokenPayload, CancellationToken cancellationToken = default)
222+
{
223+
Task<ApiResponse<AccessToken>> localVarResponse = refreshWithHttpInfoAsync(refreshTokenPayload, cancellationToken);
224+
return localVarResponse.ContinueWith((Task<ApiResponse<AccessToken>> task) => task.Result.Data );
225+
226+
}
227+
123228
/// <summary>
124229
/// Refresh Bearer Token Accepts the old bearer token and returns a new bearer token that can be used to authenticate other endpoint. You can find the tutorial on using the disposable bearer token [here](https://docs.api.video/reference/disposable-bearer-token-authentication).
125230
/// </summary>
@@ -133,6 +238,80 @@ public AccessToken refresh(RefreshTokenPayload refreshTokenPayload)
133238
return localVarResponse.Data;
134239
}
135240

241+
242+
/// <summary>
243+
/// Refresh Bearer Token Accepts the old bearer token and returns a new bearer token that can be used to authenticate other endpoint. You can find the tutorial on using the disposable bearer token [here](https://docs.api.video/reference/disposable-bearer-token-authentication).
244+
/// </summary>
245+
/// <exception cref="ApiVideo.Client.ApiException">Thrown when fails to make API call</exception>
246+
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional)</param>
247+
/// <param name="refreshTokenPayload"></param>
248+
249+
/// <returns>ApiResponse of AccessToken</returns>
250+
public Task<ApiResponse<AccessToken>> refreshWithHttpInfoAsync(RefreshTokenPayload refreshTokenPayload, CancellationToken cancellationToken = default)
251+
{
252+
if (refreshTokenPayload == null)
253+
throw new ApiException(400,"Missing required parameter 'refreshTokenPayload' when calling AdvancedAuthenticationApi->refresh");
254+
255+
if (refreshTokenPayload != null && refreshTokenPayload.refreshtoken == null) {
256+
throw new ApiException(400,"Missing required parameter 'refreshTokenPayload.RefreshToken' when calling AdvancedAuthenticationApi->refresh");
257+
}
258+
259+
// verify the required parameter 'refreshTokenPayload' is set
260+
if (refreshTokenPayload == null)
261+
throw new ApiException(400, "Missing required parameter 'refreshTokenPayload' when calling AdvancedAuthenticationApi->refresh");
262+
263+
264+
var localVarPath = "/auth/refresh";
265+
var localVarPathParams = new Dictionary<string, string>();
266+
var localVarQueryParams = new List<KeyValuePair<string, string>>();
267+
var localVarHeaderParams = new Dictionary<string, string>();
268+
var localVarFormParams = new Dictionary<string, string>();
269+
var localVarFileParams = new Dictionary<string, FileParameter>();
270+
Object localVarPostBody = null;
271+
272+
// to determine the Content-Type header
273+
string[] localVarContentTypes = new string[] {
274+
"application/json"
275+
};
276+
string localVarContentType = ApiClient.SelectHeaderContentType(localVarContentTypes);
277+
localVarHeaderParams.Add("Content-Type", localVarContentType);
278+
// to determine the Accept header
279+
string[] localVarHttpHeaderAccepts = new string[] {
280+
"application/json"
281+
};
282+
string localVarHttpHeaderAccept = ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
283+
if (localVarHttpHeaderAccept != null)
284+
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
285+
286+
if (refreshTokenPayload != null && refreshTokenPayload.GetType() != typeof(byte[]) && refreshTokenPayload.GetType() != typeof(string))
287+
{
288+
localVarPostBody = this.ApiClient.Serialize(refreshTokenPayload); // http body (model) parameter
289+
}
290+
else
291+
{
292+
localVarPostBody = refreshTokenPayload; // byte array
293+
}
294+
295+
296+
297+
298+
// make the HTTP request
299+
Task<RestResponse> localVarResponse = (Task<RestResponse>) this.ApiClient.CallApiAsync(localVarPath,
300+
Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
301+
localVarPathParams, localVarContentType, cancellationToken);
302+
303+
304+
return localVarResponse.ContinueWith((Task<RestResponse> task) =>
305+
{
306+
int localVarStatusCode = (int) task.Result.StatusCode;
307+
return new ApiResponse<AccessToken>(localVarStatusCode,
308+
task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
309+
(AccessToken) this.ApiClient.Deserialize(task.Result, typeof(AccessToken)));
310+
});
311+
312+
}
313+
314+
136315
/// <summary>
137316
/// Refresh Bearer Token Accepts the old bearer token and returns a new bearer token that can be used to authenticate other endpoint. You can find the tutorial on using the disposable bearer token [here](https://docs.api.video/reference/disposable-bearer-token-authentication).
138317
/// </summary>

0 commit comments

Comments
 (0)