Skip to content

Commit

Permalink
Merge pull request #133 from apivideo/csharp-1.5.0
Browse files Browse the repository at this point in the history
Fix nuget package
  • Loading branch information
bot-api-video authored Jul 19, 2024
2 parents f07db4d + 095735d commit ae3a0c4
Show file tree
Hide file tree
Showing 13 changed files with 4,343 additions and 56 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog
All changes to this project will be documented in this file.

## [1.5.0] - 2024-07-19
- fix nuget package (closes \#131)
- add *Async() methods (closes \#132)

## [1.4.0] - 2024-06-11
- .net 5.0 support

Expand Down
179 changes: 179 additions & 0 deletions src/Api/AdvancedAuthenticationApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.IO;
using ApiVideo.Upload;
using RestSharp;
Expand Down Expand Up @@ -39,6 +40,21 @@ public AdvancedAuthenticationApi(ApiClient apiClient)
this.ApiClient = apiClient;
}

/// <summary>
/// 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).
/// </summary>
/// <exception cref="ApiVideo.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional)</param>
/// <param name="authenticatePayload"></param>

/// <returns>AccessToken</returns>
public Task<AccessToken> authenticateAsync(AuthenticatePayload authenticatePayload, CancellationToken cancellationToken = default)
{
Task<ApiResponse<AccessToken>> localVarResponse = authenticateWithHttpInfoAsync(authenticatePayload, cancellationToken);
return localVarResponse.ContinueWith((Task<ApiResponse<AccessToken>> task) => task.Result.Data );

}

/// <summary>
/// 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).
/// </summary>
Expand All @@ -52,6 +68,80 @@ public AccessToken authenticate(AuthenticatePayload authenticatePayload)
return localVarResponse.Data;
}


/// <summary>
/// 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).
/// </summary>
/// <exception cref="ApiVideo.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional)</param>
/// <param name="authenticatePayload"></param>

/// <returns>ApiResponse of AccessToken</returns>
public Task<ApiResponse<AccessToken>> authenticateWithHttpInfoAsync(AuthenticatePayload authenticatePayload, CancellationToken cancellationToken = default)
{
if (authenticatePayload == null)
throw new ApiException(400,"Missing required parameter 'authenticatePayload' when calling AdvancedAuthenticationApi->authenticate");

if (authenticatePayload != null && authenticatePayload.apikey == null) {
throw new ApiException(400,"Missing required parameter 'authenticatePayload.ApiKey' when calling AdvancedAuthenticationApi->authenticate");
}

// verify the required parameter 'authenticatePayload' is set
if (authenticatePayload == null)
throw new ApiException(400, "Missing required parameter 'authenticatePayload' when calling AdvancedAuthenticationApi->authenticate");


var localVarPath = "/auth/api-key";
var localVarPathParams = new Dictionary<string, string>();
var localVarQueryParams = new List<KeyValuePair<string, string>>();
var localVarHeaderParams = new Dictionary<string, string>();
var localVarFormParams = new Dictionary<string, string>();
var localVarFileParams = new Dictionary<string, FileParameter>();
Object localVarPostBody = null;

// to determine the Content-Type header
string[] localVarContentTypes = new string[] {
"application/json"
};
string localVarContentType = ApiClient.SelectHeaderContentType(localVarContentTypes);
localVarHeaderParams.Add("Content-Type", localVarContentType);
// to determine the Accept header
string[] localVarHttpHeaderAccepts = new string[] {
"application/json"
};
string localVarHttpHeaderAccept = ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

if (authenticatePayload != null && authenticatePayload.GetType() != typeof(byte[]) && authenticatePayload.GetType() != typeof(string))
{
localVarPostBody = this.ApiClient.Serialize(authenticatePayload); // http body (model) parameter
}
else
{
localVarPostBody = authenticatePayload; // byte array
}




// make the HTTP request
Task<RestResponse> localVarResponse = (Task<RestResponse>) this.ApiClient.CallApiAsync(localVarPath,
Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarContentType, cancellationToken);


return localVarResponse.ContinueWith((Task<RestResponse> task) =>
{
int localVarStatusCode = (int) task.Result.StatusCode;
return new ApiResponse<AccessToken>(localVarStatusCode,
task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
(AccessToken) this.ApiClient.Deserialize(task.Result, typeof(AccessToken)));
});

}


/// <summary>
/// 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).
/// </summary>
Expand Down Expand Up @@ -120,6 +210,21 @@ public ApiResponse<AccessToken> authenticateWithHttpInfo(AuthenticatePayload aut
}


/// <summary>
/// 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).
/// </summary>
/// <exception cref="ApiVideo.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional)</param>
/// <param name="refreshTokenPayload"></param>

/// <returns>AccessToken</returns>
public Task<AccessToken> refreshAsync(RefreshTokenPayload refreshTokenPayload, CancellationToken cancellationToken = default)
{
Task<ApiResponse<AccessToken>> localVarResponse = refreshWithHttpInfoAsync(refreshTokenPayload, cancellationToken);
return localVarResponse.ContinueWith((Task<ApiResponse<AccessToken>> task) => task.Result.Data );

}

/// <summary>
/// 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).
/// </summary>
Expand All @@ -133,6 +238,80 @@ public AccessToken refresh(RefreshTokenPayload refreshTokenPayload)
return localVarResponse.Data;
}


/// <summary>
/// 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).
/// </summary>
/// <exception cref="ApiVideo.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional)</param>
/// <param name="refreshTokenPayload"></param>

/// <returns>ApiResponse of AccessToken</returns>
public Task<ApiResponse<AccessToken>> refreshWithHttpInfoAsync(RefreshTokenPayload refreshTokenPayload, CancellationToken cancellationToken = default)
{
if (refreshTokenPayload == null)
throw new ApiException(400,"Missing required parameter 'refreshTokenPayload' when calling AdvancedAuthenticationApi->refresh");

if (refreshTokenPayload != null && refreshTokenPayload.refreshtoken == null) {
throw new ApiException(400,"Missing required parameter 'refreshTokenPayload.RefreshToken' when calling AdvancedAuthenticationApi->refresh");
}

// verify the required parameter 'refreshTokenPayload' is set
if (refreshTokenPayload == null)
throw new ApiException(400, "Missing required parameter 'refreshTokenPayload' when calling AdvancedAuthenticationApi->refresh");


var localVarPath = "/auth/refresh";
var localVarPathParams = new Dictionary<string, string>();
var localVarQueryParams = new List<KeyValuePair<string, string>>();
var localVarHeaderParams = new Dictionary<string, string>();
var localVarFormParams = new Dictionary<string, string>();
var localVarFileParams = new Dictionary<string, FileParameter>();
Object localVarPostBody = null;

// to determine the Content-Type header
string[] localVarContentTypes = new string[] {
"application/json"
};
string localVarContentType = ApiClient.SelectHeaderContentType(localVarContentTypes);
localVarHeaderParams.Add("Content-Type", localVarContentType);
// to determine the Accept header
string[] localVarHttpHeaderAccepts = new string[] {
"application/json"
};
string localVarHttpHeaderAccept = ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

if (refreshTokenPayload != null && refreshTokenPayload.GetType() != typeof(byte[]) && refreshTokenPayload.GetType() != typeof(string))
{
localVarPostBody = this.ApiClient.Serialize(refreshTokenPayload); // http body (model) parameter
}
else
{
localVarPostBody = refreshTokenPayload; // byte array
}




// make the HTTP request
Task<RestResponse> localVarResponse = (Task<RestResponse>) this.ApiClient.CallApiAsync(localVarPath,
Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarContentType, cancellationToken);


return localVarResponse.ContinueWith((Task<RestResponse> task) =>
{
int localVarStatusCode = (int) task.Result.StatusCode;
return new ApiResponse<AccessToken>(localVarStatusCode,
task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
(AccessToken) this.ApiClient.Deserialize(task.Result, typeof(AccessToken)));
});

}


/// <summary>
/// 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).
/// </summary>
Expand Down
Loading

0 comments on commit ae3a0c4

Please sign in to comment.