diff --git a/CHANGELOG.md b/CHANGELOG.md index 97742cf..c47cd13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/Api/AdvancedAuthenticationApi.cs b/src/Api/AdvancedAuthenticationApi.cs index e04d5b3..60b461b 100644 --- a/src/Api/AdvancedAuthenticationApi.cs +++ b/src/Api/AdvancedAuthenticationApi.cs @@ -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; @@ -39,6 +40,21 @@ public AdvancedAuthenticationApi(ApiClient apiClient) this.ApiClient = apiClient; } + /// + /// 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). + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// + + /// AccessToken + public Task authenticateAsync(AuthenticatePayload authenticatePayload, CancellationToken cancellationToken = default) + { + Task> localVarResponse = authenticateWithHttpInfoAsync(authenticatePayload, cancellationToken); + return localVarResponse.ContinueWith((Task> task) => task.Result.Data ); + + } + /// /// 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). /// @@ -52,6 +68,80 @@ public AccessToken authenticate(AuthenticatePayload authenticatePayload) return localVarResponse.Data; } + + /// + /// 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). + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// + + /// ApiResponse of AccessToken + public Task> 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(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + 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 localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (AccessToken) this.ApiClient.Deserialize(task.Result, typeof(AccessToken))); + }); + + } + + /// /// 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). /// @@ -120,6 +210,21 @@ public ApiResponse authenticateWithHttpInfo(AuthenticatePayload aut } + /// + /// 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). + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// + + /// AccessToken + public Task refreshAsync(RefreshTokenPayload refreshTokenPayload, CancellationToken cancellationToken = default) + { + Task> localVarResponse = refreshWithHttpInfoAsync(refreshTokenPayload, cancellationToken); + return localVarResponse.ContinueWith((Task> task) => task.Result.Data ); + + } + /// /// 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). /// @@ -133,6 +238,80 @@ public AccessToken refresh(RefreshTokenPayload refreshTokenPayload) return localVarResponse.Data; } + + /// + /// 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). + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// + + /// ApiResponse of AccessToken + public Task> 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(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + 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 localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (AccessToken) this.ApiClient.Deserialize(task.Result, typeof(AccessToken))); + }); + + } + + /// /// 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). /// diff --git a/src/Api/AnalyticsApi.cs b/src/Api/AnalyticsApi.cs index 10fc689..4f57dbd 100644 --- a/src/Api/AnalyticsApi.cs +++ b/src/Api/AnalyticsApi.cs @@ -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; @@ -39,6 +40,26 @@ public AnalyticsApi(ApiClient apiClient) this.ApiClient = apiClient; } + /// + /// Get play events for live stream Retrieve filtered analytics about the number of plays for your live streams in a project. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// Use this query parameter to set the start date for the time period that you want analytics for. - The API returns analytics data including the day you set in `from`. - The date you set must be **within the last 30 days**. - The value you provide must follow the `YYYY-MM-DD` format. +/// Use this query parameter to define the dimension that you want analytics for. - `liveStreamId`: Returns analytics based on the public live stream identifiers. - `emittedAt`: Returns analytics based on the times of the play events. The API returns data in specific interval groups. When the date period you set in `from` and `to` is less than or equals to 2 days, the response for this dimension is grouped in hourly intervals. Otherwise, it is grouped in daily intervals. - `country`: Returns analytics based on the viewers' country. The list of supported country names are based on the [GeoNames public database](https://www.geonames.org/countries/). - `deviceType`: Returns analytics based on the type of device used by the viewers during the play event. Possible response values are: `computer`, `phone`, `tablet`, `tv`, `console`, `wearable`, `unknown`. - `operatingSystem`: Returns analytics based on the operating system used by the viewers during the play event. Response values include `windows`, `mac osx`, `android`, `ios`, `linux`. - `browser`: Returns analytics based on the browser used by the viewers during the play event. Response values include `chrome`, `firefox`, `edge`, `opera`. +/// Use this optional query parameter to set the end date for the time period that you want analytics for. - If you do not specify a `to` date, the API returns analytics data starting from the `from` date up until today, and excluding today. - The date you set must be **within the last 30 days**. - The value you provide must follow the `YYYY-MM-DD` format. (optional) +/// Use this query parameter to filter your results to a specific live stream in a project that you want analytics for. You must use the `liveStreamId:` prefix when specifying a live stream ID. (optional) +/// Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1) +/// Results per page. Allowed values 1-100, default is 25. (optional, default to 25) + + /// AnalyticsPlaysResponse + public Task getLiveStreamsPlaysAsync(DateTime from, string dimension, DateTime? to = default, string filter = default, int? currentPage = default, int? pageSize = default, CancellationToken cancellationToken = default) + { + Task> localVarResponse = getLiveStreamsPlaysWithHttpInfoAsync(from, dimension, to, filter, currentPage, pageSize, cancellationToken); + return localVarResponse.ContinueWith((Task> task) => task.Result.Data ); + + } + /// /// Get play events for live stream Retrieve filtered analytics about the number of plays for your live streams in a project. /// @@ -57,6 +78,84 @@ public AnalyticsPlaysResponse getLiveStreamsPlays(DateTime from, string dimensio return localVarResponse.Data; } + + /// + /// Get play events for live stream Retrieve filtered analytics about the number of plays for your live streams in a project. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// Use this query parameter to set the start date for the time period that you want analytics for. - The API returns analytics data including the day you set in `from`. - The date you set must be **within the last 30 days**. - The value you provide must follow the `YYYY-MM-DD` format. +/// Use this query parameter to define the dimension that you want analytics for. - `liveStreamId`: Returns analytics based on the public live stream identifiers. - `emittedAt`: Returns analytics based on the times of the play events. The API returns data in specific interval groups. When the date period you set in `from` and `to` is less than or equals to 2 days, the response for this dimension is grouped in hourly intervals. Otherwise, it is grouped in daily intervals. - `country`: Returns analytics based on the viewers' country. The list of supported country names are based on the [GeoNames public database](https://www.geonames.org/countries/). - `deviceType`: Returns analytics based on the type of device used by the viewers during the play event. Possible response values are: `computer`, `phone`, `tablet`, `tv`, `console`, `wearable`, `unknown`. - `operatingSystem`: Returns analytics based on the operating system used by the viewers during the play event. Response values include `windows`, `mac osx`, `android`, `ios`, `linux`. - `browser`: Returns analytics based on the browser used by the viewers during the play event. Response values include `chrome`, `firefox`, `edge`, `opera`. +/// Use this optional query parameter to set the end date for the time period that you want analytics for. - If you do not specify a `to` date, the API returns analytics data starting from the `from` date up until today, and excluding today. - The date you set must be **within the last 30 days**. - The value you provide must follow the `YYYY-MM-DD` format. (optional) +/// Use this query parameter to filter your results to a specific live stream in a project that you want analytics for. You must use the `liveStreamId:` prefix when specifying a live stream ID. (optional) +/// Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1) +/// Results per page. Allowed values 1-100, default is 25. (optional, default to 25) + + /// ApiResponse of AnalyticsPlaysResponse + public Task> getLiveStreamsPlaysWithHttpInfoAsync(DateTime from, string dimension, DateTime? to = default, string filter = default, int? currentPage = default, int? pageSize = default, CancellationToken cancellationToken = default) + { + + + + + + + // verify the required parameter 'from' is set + if (from == null) + throw new ApiException(400, "Missing required parameter 'from' when calling AnalyticsApi->getLiveStreamsPlays"); + // verify the required parameter 'dimension' is set + if (dimension == null) + throw new ApiException(400, "Missing required parameter 'dimension' when calling AnalyticsApi->getLiveStreamsPlays"); + + + var localVarPath = "/analytics/live-streams/plays"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + string[] localVarContentTypes = new string[] { + }; + 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 (from != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "from", from)); // query parameter + if (to != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "to", to)); // query parameter + if (dimension != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "dimension", dimension)); // query parameter + if (filter != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "filter", filter)); // query parameter + if (currentPage != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "currentPage", currentPage)); // query parameter + if (pageSize != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "pageSize", pageSize)); // query parameter + + + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (AnalyticsPlaysResponse) this.ApiClient.Deserialize(task.Result, typeof(AnalyticsPlaysResponse))); + }); + + } + + /// /// Get play events for live stream Retrieve filtered analytics about the number of plays for your live streams in a project. /// @@ -230,6 +329,26 @@ private APIgetLiveStreamsPlaysRequest copy() { return copy; } } + /// + /// Get play events for video Retrieve filtered analytics about the number of plays for your videos in a project. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// Use this query parameter to set the start date for the time period that you want analytics for. - The API returns analytics data including the day you set in `from`. - The date you set must be **within the last 30 days**. - The value you provide must follow the `YYYY-MM-DD` format. +/// Use this query parameter to define the dimension that you want analytics for. - `videoId`: Returns analytics based on the public video identifiers. - `emittedAt`: Returns analytics based on the times of the play events. The API returns data in specific interval groups. When the date period you set in `from` and `to` is less than or equals to 2 days, the response for this dimension is grouped in hourly intervals. Otherwise, it is grouped in daily intervals. - `country`: Returns analytics based on the viewers' country. The list of supported country names are based on the [GeoNames public database](https://www.geonames.org/countries/). - `deviceType`: Returns analytics based on the type of device used by the viewers during the play event. Possible response values are: `computer`, `phone`, `tablet`, `tv`, `console`, `wearable`, `unknown`. - `operatingSystem`: Returns analytics based on the operating system used by the viewers during the play event. Response values include `windows`, `mac osx`, `android`, `ios`, `linux`. - `browser`: Returns analytics based on the browser used by the viewers during the play event. Response values include `chrome`, `firefox`, `edge`, `opera`. +/// Use this optional query parameter to set the end date for the time period that you want analytics for. - If you do not specify a `to` date, the API returns analytics data starting from the `from` date up until today, and excluding today. - The date you set must be **within the last 30 days**. - The value you provide must follow the `YYYY-MM-DD` format. (optional) +/// Use this query parameter to filter your results to a specific video in a project that you want analytics for. You must use the `videoId:` prefix when specifying a video ID. (optional) +/// Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1) +/// Results per page. Allowed values 1-100, default is 25. (optional, default to 25) + + /// AnalyticsPlaysResponse + public Task getVideosPlaysAsync(DateTime from, string dimension, DateTime? to = default, string filter = default, int? currentPage = default, int? pageSize = default, CancellationToken cancellationToken = default) + { + Task> localVarResponse = getVideosPlaysWithHttpInfoAsync(from, dimension, to, filter, currentPage, pageSize, cancellationToken); + return localVarResponse.ContinueWith((Task> task) => task.Result.Data ); + + } + /// /// Get play events for video Retrieve filtered analytics about the number of plays for your videos in a project. /// @@ -248,6 +367,84 @@ public AnalyticsPlaysResponse getVideosPlays(DateTime from, string dimension, Da return localVarResponse.Data; } + + /// + /// Get play events for video Retrieve filtered analytics about the number of plays for your videos in a project. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// Use this query parameter to set the start date for the time period that you want analytics for. - The API returns analytics data including the day you set in `from`. - The date you set must be **within the last 30 days**. - The value you provide must follow the `YYYY-MM-DD` format. +/// Use this query parameter to define the dimension that you want analytics for. - `videoId`: Returns analytics based on the public video identifiers. - `emittedAt`: Returns analytics based on the times of the play events. The API returns data in specific interval groups. When the date period you set in `from` and `to` is less than or equals to 2 days, the response for this dimension is grouped in hourly intervals. Otherwise, it is grouped in daily intervals. - `country`: Returns analytics based on the viewers' country. The list of supported country names are based on the [GeoNames public database](https://www.geonames.org/countries/). - `deviceType`: Returns analytics based on the type of device used by the viewers during the play event. Possible response values are: `computer`, `phone`, `tablet`, `tv`, `console`, `wearable`, `unknown`. - `operatingSystem`: Returns analytics based on the operating system used by the viewers during the play event. Response values include `windows`, `mac osx`, `android`, `ios`, `linux`. - `browser`: Returns analytics based on the browser used by the viewers during the play event. Response values include `chrome`, `firefox`, `edge`, `opera`. +/// Use this optional query parameter to set the end date for the time period that you want analytics for. - If you do not specify a `to` date, the API returns analytics data starting from the `from` date up until today, and excluding today. - The date you set must be **within the last 30 days**. - The value you provide must follow the `YYYY-MM-DD` format. (optional) +/// Use this query parameter to filter your results to a specific video in a project that you want analytics for. You must use the `videoId:` prefix when specifying a video ID. (optional) +/// Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1) +/// Results per page. Allowed values 1-100, default is 25. (optional, default to 25) + + /// ApiResponse of AnalyticsPlaysResponse + public Task> getVideosPlaysWithHttpInfoAsync(DateTime from, string dimension, DateTime? to = default, string filter = default, int? currentPage = default, int? pageSize = default, CancellationToken cancellationToken = default) + { + + + + + + + // verify the required parameter 'from' is set + if (from == null) + throw new ApiException(400, "Missing required parameter 'from' when calling AnalyticsApi->getVideosPlays"); + // verify the required parameter 'dimension' is set + if (dimension == null) + throw new ApiException(400, "Missing required parameter 'dimension' when calling AnalyticsApi->getVideosPlays"); + + + var localVarPath = "/analytics/videos/plays"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + string[] localVarContentTypes = new string[] { + }; + 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 (from != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "from", from)); // query parameter + if (to != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "to", to)); // query parameter + if (dimension != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "dimension", dimension)); // query parameter + if (filter != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "filter", filter)); // query parameter + if (currentPage != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "currentPage", currentPage)); // query parameter + if (pageSize != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "pageSize", pageSize)); // query parameter + + + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (AnalyticsPlaysResponse) this.ApiClient.Deserialize(task.Result, typeof(AnalyticsPlaysResponse))); + }); + + } + + /// /// Get play events for video Retrieve filtered analytics about the number of plays for your videos in a project. /// diff --git a/src/Api/CaptionsApi.cs b/src/Api/CaptionsApi.cs index 472f33e..6720ab6 100644 --- a/src/Api/CaptionsApi.cs +++ b/src/Api/CaptionsApi.cs @@ -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; @@ -39,6 +40,23 @@ public CaptionsApi(ApiClient apiClient) this.ApiClient = apiClient; } + /// + /// Upload a caption Upload a VTT file to add captions to your video. More information can be found [here](https://docs.api.video/vod/add-captions) + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the video you want to add a caption to. +/// A valid language identifier using IETF language tags. You can use primary subtags like `en` (English), extended subtags like `fr-CA` (French, Canada), or region subtags like `zh-Hans-CN` (Simplified Chinese used in the PRC). - This parameter **only accepts dashes for separators**, for example `fr-CA`. If you use a different separator in your request, the API returns an error. - When the value in your request does not match any covered language, the API returns an error. - You can find the list of supported tags [here](https://docs.api.video/vod/add-captions#supported-caption-language-tags). +/// The video text track (VTT) you want to upload. + + /// Caption + public Task uploadAsync(string videoId, string language, System.IO.Stream file, CancellationToken cancellationToken = default) + { + Task> localVarResponse = uploadWithHttpInfoAsync(videoId, language, file, cancellationToken); + return localVarResponse.ContinueWith((Task> task) => task.Result.Data ); + + } + /// /// Upload a caption Upload a VTT file to add captions to your video. More information can be found [here](https://docs.api.video/vod/add-captions) /// @@ -54,6 +72,82 @@ public Caption upload(string videoId, string language, System.IO.Stream file) return localVarResponse.Data; } + + /// + /// Upload a caption Upload a VTT file to add captions to your video. More information can be found [here](https://docs.api.video/vod/add-captions) + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the video you want to add a caption to. +/// A valid language identifier using IETF language tags. You can use primary subtags like `en` (English), extended subtags like `fr-CA` (French, Canada), or region subtags like `zh-Hans-CN` (Simplified Chinese used in the PRC). - This parameter **only accepts dashes for separators**, for example `fr-CA`. If you use a different separator in your request, the API returns an error. - When the value in your request does not match any covered language, the API returns an error. - You can find the list of supported tags [here](https://docs.api.video/vod/add-captions#supported-caption-language-tags). +/// The video text track (VTT) you want to upload. + + /// ApiResponse of Caption + public Task> uploadWithHttpInfoAsync(string videoId, string language, System.IO.Stream file, CancellationToken cancellationToken = default) + { + + + + // verify the required parameter 'videoId' is set + if (videoId == null) + throw new ApiException(400, "Missing required parameter 'videoId' when calling CaptionsApi->upload"); + // verify the required parameter 'language' is set + if (language == null) + throw new ApiException(400, "Missing required parameter 'language' when calling CaptionsApi->upload"); + // verify the required parameter 'file' is set + if (file == null) + throw new ApiException(400, "Missing required parameter 'file' when calling CaptionsApi->upload"); + + + var localVarPath = "/videos/{videoId}/captions/{language}"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + string[] localVarContentTypes = new string[] { + "multipart/form-data" + }; + 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 (videoId != null) localVarPathParams.Add("videoId", this.ApiClient.ParameterToString(videoId)); // path parameter + if (language != null) localVarPathParams.Add("language", this.ApiClient.ParameterToString(language)); // path parameter + + + + + if (file != null) + localVarFileParams.Add("file", this.ApiClient.ParameterToFile("file", file)); + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (Caption) this.ApiClient.Deserialize(task.Result, typeof(Caption))); + }); + + } + + /// /// Upload a caption Upload a VTT file to add captions to your video. More information can be found [here](https://docs.api.video/vod/add-captions) /// @@ -124,6 +218,24 @@ public ApiResponse uploadWithHttpInfo(string videoId, string language, } + /// + /// Retrieve a caption Retrieve a caption for a video in a specific language. If the language is available, the caption is returned. Otherwise, you will get a error indicating the caption was not found. + /// + /// Tutorials that use the [captions endpoint](https://api.video/blog/endpoints/captions). + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the video you want captions for. +/// A valid language identifier using IETF language tags. You can use primary subtags like `en` (English), extended subtags like `fr-CA` (French, Canada), or region subtags like `zh-Hans-CN` (Simplified Chinese used in the PRC). - This parameter **only accepts dashes for separators**, for example `fr-CA`. If you use a different separator in your request, the API returns an error. - When the value in your request does not match any covered language, the API returns an error. - You can find the list of supported tags [here](https://docs.api.video/vod/add-captions#supported-caption-language-tags). + + /// Caption + public Task getAsync(string videoId, string language, CancellationToken cancellationToken = default) + { + Task> localVarResponse = getWithHttpInfoAsync(videoId, language, cancellationToken); + return localVarResponse.ContinueWith((Task> task) => task.Result.Data ); + + } + /// /// Retrieve a caption Retrieve a caption for a video in a specific language. If the language is available, the caption is returned. Otherwise, you will get a error indicating the caption was not found. /// @@ -140,6 +252,74 @@ public Caption get(string videoId, string language) return localVarResponse.Data; } + + /// + /// Retrieve a caption Retrieve a caption for a video in a specific language. If the language is available, the caption is returned. Otherwise, you will get a error indicating the caption was not found. + /// + /// Tutorials that use the [captions endpoint](https://api.video/blog/endpoints/captions). + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the video you want captions for. +/// A valid language identifier using IETF language tags. You can use primary subtags like `en` (English), extended subtags like `fr-CA` (French, Canada), or region subtags like `zh-Hans-CN` (Simplified Chinese used in the PRC). - This parameter **only accepts dashes for separators**, for example `fr-CA`. If you use a different separator in your request, the API returns an error. - When the value in your request does not match any covered language, the API returns an error. - You can find the list of supported tags [here](https://docs.api.video/vod/add-captions#supported-caption-language-tags). + + /// ApiResponse of Caption + public Task> getWithHttpInfoAsync(string videoId, string language, CancellationToken cancellationToken = default) + { + + + // verify the required parameter 'videoId' is set + if (videoId == null) + throw new ApiException(400, "Missing required parameter 'videoId' when calling CaptionsApi->get"); + // verify the required parameter 'language' is set + if (language == null) + throw new ApiException(400, "Missing required parameter 'language' when calling CaptionsApi->get"); + + + var localVarPath = "/videos/{videoId}/captions/{language}"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + string[] localVarContentTypes = new string[] { + }; + 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 (videoId != null) localVarPathParams.Add("videoId", this.ApiClient.ParameterToString(videoId)); // path parameter + if (language != null) localVarPathParams.Add("language", this.ApiClient.ParameterToString(language)); // path parameter + + + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (Caption) this.ApiClient.Deserialize(task.Result, typeof(Caption))); + }); + + } + + /// /// Retrieve a caption Retrieve a caption for a video in a specific language. If the language is available, the caption is returned. Otherwise, you will get a error indicating the caption was not found. /// @@ -202,6 +382,23 @@ public ApiResponse getWithHttpInfo(string videoId, string language) } + /// + /// Update a caption To have the captions on automatically, use this method to set default: true. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the video you want to have automatic captions for. +/// A valid language identifier using IETF language tags. You can use primary subtags like `en` (English), extended subtags like `fr-CA` (French, Canada), or region subtags like `zh-Hans-CN` (Simplified Chinese used in the PRC). - This parameter **only accepts dashes for separators**, for example `fr-CA`. If you use a different separator in your request, the API returns an error. - When the value in your request does not match any covered language, the API returns an error. - You can find the list of supported tags [here](https://docs.api.video/vod/add-captions#supported-caption-language-tags). +/// + + /// Caption + public Task updateAsync(string videoId, string language, CaptionsUpdatePayload captionsUpdatePayload, CancellationToken cancellationToken = default) + { + Task> localVarResponse = updateWithHttpInfoAsync(videoId, language, captionsUpdatePayload, cancellationToken); + return localVarResponse.ContinueWith((Task> task) => task.Result.Data ); + + } + /// /// Update a caption To have the captions on automatically, use this method to set default: true. /// @@ -217,6 +414,95 @@ public Caption update(string videoId, string language, CaptionsUpdatePayload cap return localVarResponse.Data; } + + /// + /// Update a caption To have the captions on automatically, use this method to set default: true. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the video you want to have automatic captions for. +/// A valid language identifier using IETF language tags. You can use primary subtags like `en` (English), extended subtags like `fr-CA` (French, Canada), or region subtags like `zh-Hans-CN` (Simplified Chinese used in the PRC). - This parameter **only accepts dashes for separators**, for example `fr-CA`. If you use a different separator in your request, the API returns an error. - When the value in your request does not match any covered language, the API returns an error. - You can find the list of supported tags [here](https://docs.api.video/vod/add-captions#supported-caption-language-tags). +/// + + /// ApiResponse of Caption + public Task> updateWithHttpInfoAsync(string videoId, string language, CaptionsUpdatePayload captionsUpdatePayload, CancellationToken cancellationToken = default) + { + if (captionsUpdatePayload == null) + throw new ApiException(400,"Missing required parameter 'captionsUpdatePayload' when calling CaptionsApi->update"); + + + if (captionsUpdatePayload == null) + throw new ApiException(400,"Missing required parameter 'captionsUpdatePayload' when calling CaptionsApi->update"); + + + if (captionsUpdatePayload == null) + throw new ApiException(400,"Missing required parameter 'captionsUpdatePayload' when calling CaptionsApi->update"); + + + // verify the required parameter 'videoId' is set + if (videoId == null) + throw new ApiException(400, "Missing required parameter 'videoId' when calling CaptionsApi->update"); + // verify the required parameter 'language' is set + if (language == null) + throw new ApiException(400, "Missing required parameter 'language' when calling CaptionsApi->update"); + // verify the required parameter 'captionsUpdatePayload' is set + if (captionsUpdatePayload == null) + throw new ApiException(400, "Missing required parameter 'captionsUpdatePayload' when calling CaptionsApi->update"); + + + var localVarPath = "/videos/{videoId}/captions/{language}"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + 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 (videoId != null) localVarPathParams.Add("videoId", this.ApiClient.ParameterToString(videoId)); // path parameter + if (language != null) localVarPathParams.Add("language", this.ApiClient.ParameterToString(language)); // path parameter + if (captionsUpdatePayload != null && captionsUpdatePayload.GetType() != typeof(byte[]) && captionsUpdatePayload.GetType() != typeof(string)) + { + localVarPostBody = this.ApiClient.Serialize(captionsUpdatePayload); // http body (model) parameter + } + else + { + localVarPostBody = captionsUpdatePayload; // byte array + } + + + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Patch, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (Caption) this.ApiClient.Deserialize(task.Result, typeof(Caption))); + }); + + } + + /// /// Update a caption To have the captions on automatically, use this method to set default: true. /// @@ -300,6 +586,20 @@ public ApiResponse updateWithHttpInfo(string videoId, string language, } + /// + /// Delete a caption Delete a caption in a specific language by by video id. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the video you want to delete a caption from. +/// A valid language identifier using IETF language tags. You can use primary subtags like `en` (English), extended subtags like `fr-CA` (French, Canada), or region subtags like `zh-Hans-CN` (Simplified Chinese used in the PRC). - This parameter **only accepts dashes for separators**, for example `fr-CA`. If you use a different separator in your request, the API returns an error. - When the value in your request does not match any covered language, the API returns an error. - You can find the list of supported tags [here](https://docs.api.video/vod/add-captions#supported-caption-language-tags). + + /// + public void deleteAsync(string videoId, string language, CancellationToken cancellationToken = default) + { + deleteWithHttpInfoAsync(videoId, language, cancellationToken); + } + /// /// Delete a caption Delete a caption in a specific language by by video id. /// @@ -313,6 +613,71 @@ public void delete(string videoId, string language) deleteWithHttpInfo(videoId, language); } + + /// + /// Delete a caption Delete a caption in a specific language by by video id. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the video you want to delete a caption from. +/// A valid language identifier using IETF language tags. You can use primary subtags like `en` (English), extended subtags like `fr-CA` (French, Canada), or region subtags like `zh-Hans-CN` (Simplified Chinese used in the PRC). - This parameter **only accepts dashes for separators**, for example `fr-CA`. If you use a different separator in your request, the API returns an error. - When the value in your request does not match any covered language, the API returns an error. - You can find the list of supported tags [here](https://docs.api.video/vod/add-captions#supported-caption-language-tags). + + /// ApiResponse of Object(void) + public Task> deleteWithHttpInfoAsync(string videoId, string language, CancellationToken cancellationToken = default) + { + + + // verify the required parameter 'videoId' is set + if (videoId == null) + throw new ApiException(400, "Missing required parameter 'videoId' when calling CaptionsApi->delete"); + // verify the required parameter 'language' is set + if (language == null) + throw new ApiException(400, "Missing required parameter 'language' when calling CaptionsApi->delete"); + + + var localVarPath = "/videos/{videoId}/captions/{language}"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + string[] localVarContentTypes = new string[] { + }; + 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 (videoId != null) localVarPathParams.Add("videoId", this.ApiClient.ParameterToString(videoId)); // path parameter + if (language != null) localVarPathParams.Add("language", this.ApiClient.ParameterToString(language)); // path parameter + + + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Delete, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + }); + + } + + /// /// Delete a caption Delete a caption in a specific language by by video id. /// @@ -373,6 +738,23 @@ public ApiResponse deleteWithHttpInfo(string videoId, string language) } + /// + /// List video captions Retrieve a list of available captions by video id. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the video you want to retrieve a list of captions for. +/// Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1) +/// Results per page. Allowed values 1-100, default is 25. (optional, default to 25) + + /// CaptionsListResponse + public Task listAsync(string videoId, int? currentPage = default, int? pageSize = default, CancellationToken cancellationToken = default) + { + Task> localVarResponse = listWithHttpInfoAsync(videoId, currentPage, pageSize, cancellationToken); + return localVarResponse.ContinueWith((Task> task) => task.Result.Data ); + + } + /// /// List video captions Retrieve a list of available captions by video id. /// @@ -388,6 +770,72 @@ public CaptionsListResponse list(string videoId, int? currentPage = default, int return localVarResponse.Data; } + + /// + /// List video captions Retrieve a list of available captions by video id. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the video you want to retrieve a list of captions for. +/// Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1) +/// Results per page. Allowed values 1-100, default is 25. (optional, default to 25) + + /// ApiResponse of CaptionsListResponse + public Task> listWithHttpInfoAsync(string videoId, int? currentPage = default, int? pageSize = default, CancellationToken cancellationToken = default) + { + + + + // verify the required parameter 'videoId' is set + if (videoId == null) + throw new ApiException(400, "Missing required parameter 'videoId' when calling CaptionsApi->list"); + + + var localVarPath = "/videos/{videoId}/captions"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + string[] localVarContentTypes = new string[] { + }; + 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 (videoId != null) localVarPathParams.Add("videoId", this.ApiClient.ParameterToString(videoId)); // path parameter + if (currentPage != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "currentPage", currentPage)); // query parameter + if (pageSize != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "pageSize", pageSize)); // query parameter + + + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (CaptionsListResponse) this.ApiClient.Deserialize(task.Result, typeof(CaptionsListResponse))); + }); + + } + + /// /// List video captions Retrieve a list of available captions by video id. /// diff --git a/src/Api/ChaptersApi.cs b/src/Api/ChaptersApi.cs index 9b37b8d..0e116be 100644 --- a/src/Api/ChaptersApi.cs +++ b/src/Api/ChaptersApi.cs @@ -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; @@ -39,6 +40,23 @@ public ChaptersApi(ApiClient apiClient) this.ApiClient = apiClient; } + /// + /// Upload a chapter Upload a VTT file to add chapters to your video. Chapters help break the video into sections. Read our [tutorial](https://api.video/blog/tutorials/adding-chapters-to-your-videos/) for more details. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the video you want to upload a chapter for. +/// A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation. +/// The VTT file describing the chapters you want to upload. + + /// Chapter + public Task uploadAsync(string videoId, string language, System.IO.Stream file, CancellationToken cancellationToken = default) + { + Task> localVarResponse = uploadWithHttpInfoAsync(videoId, language, file, cancellationToken); + return localVarResponse.ContinueWith((Task> task) => task.Result.Data ); + + } + /// /// Upload a chapter Upload a VTT file to add chapters to your video. Chapters help break the video into sections. Read our [tutorial](https://api.video/blog/tutorials/adding-chapters-to-your-videos/) for more details. /// @@ -54,6 +72,82 @@ public Chapter upload(string videoId, string language, System.IO.Stream file) return localVarResponse.Data; } + + /// + /// Upload a chapter Upload a VTT file to add chapters to your video. Chapters help break the video into sections. Read our [tutorial](https://api.video/blog/tutorials/adding-chapters-to-your-videos/) for more details. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the video you want to upload a chapter for. +/// A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation. +/// The VTT file describing the chapters you want to upload. + + /// ApiResponse of Chapter + public Task> uploadWithHttpInfoAsync(string videoId, string language, System.IO.Stream file, CancellationToken cancellationToken = default) + { + + + + // verify the required parameter 'videoId' is set + if (videoId == null) + throw new ApiException(400, "Missing required parameter 'videoId' when calling ChaptersApi->upload"); + // verify the required parameter 'language' is set + if (language == null) + throw new ApiException(400, "Missing required parameter 'language' when calling ChaptersApi->upload"); + // verify the required parameter 'file' is set + if (file == null) + throw new ApiException(400, "Missing required parameter 'file' when calling ChaptersApi->upload"); + + + var localVarPath = "/videos/{videoId}/chapters/{language}"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + string[] localVarContentTypes = new string[] { + "multipart/form-data" + }; + 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 (videoId != null) localVarPathParams.Add("videoId", this.ApiClient.ParameterToString(videoId)); // path parameter + if (language != null) localVarPathParams.Add("language", this.ApiClient.ParameterToString(language)); // path parameter + + + + + if (file != null) + localVarFileParams.Add("file", this.ApiClient.ParameterToFile("file", file)); + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (Chapter) this.ApiClient.Deserialize(task.Result, typeof(Chapter))); + }); + + } + + /// /// Upload a chapter Upload a VTT file to add chapters to your video. Chapters help break the video into sections. Read our [tutorial](https://api.video/blog/tutorials/adding-chapters-to-your-videos/) for more details. /// @@ -124,6 +218,22 @@ public ApiResponse uploadWithHttpInfo(string videoId, string language, } + /// + /// Retrieve a chapter Retrieve a chapter for by video id in a specific language. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the video you want to show a chapter for. +/// A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation. + + /// Chapter + public Task getAsync(string videoId, string language, CancellationToken cancellationToken = default) + { + Task> localVarResponse = getWithHttpInfoAsync(videoId, language, cancellationToken); + return localVarResponse.ContinueWith((Task> task) => task.Result.Data ); + + } + /// /// Retrieve a chapter Retrieve a chapter for by video id in a specific language. /// @@ -138,6 +248,72 @@ public Chapter get(string videoId, string language) return localVarResponse.Data; } + + /// + /// Retrieve a chapter Retrieve a chapter for by video id in a specific language. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the video you want to show a chapter for. +/// A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation. + + /// ApiResponse of Chapter + public Task> getWithHttpInfoAsync(string videoId, string language, CancellationToken cancellationToken = default) + { + + + // verify the required parameter 'videoId' is set + if (videoId == null) + throw new ApiException(400, "Missing required parameter 'videoId' when calling ChaptersApi->get"); + // verify the required parameter 'language' is set + if (language == null) + throw new ApiException(400, "Missing required parameter 'language' when calling ChaptersApi->get"); + + + var localVarPath = "/videos/{videoId}/chapters/{language}"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + string[] localVarContentTypes = new string[] { + }; + 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 (videoId != null) localVarPathParams.Add("videoId", this.ApiClient.ParameterToString(videoId)); // path parameter + if (language != null) localVarPathParams.Add("language", this.ApiClient.ParameterToString(language)); // path parameter + + + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (Chapter) this.ApiClient.Deserialize(task.Result, typeof(Chapter))); + }); + + } + + /// /// Retrieve a chapter Retrieve a chapter for by video id in a specific language. /// @@ -198,6 +374,20 @@ public ApiResponse getWithHttpInfo(string videoId, string language) } + /// + /// Delete a chapter Delete a chapter in a specific language by providing the video ID for the video you want to delete the chapter from and the language the chapter is in. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the video you want to delete a chapter from. +/// A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation. + + /// + public void deleteAsync(string videoId, string language, CancellationToken cancellationToken = default) + { + deleteWithHttpInfoAsync(videoId, language, cancellationToken); + } + /// /// Delete a chapter Delete a chapter in a specific language by providing the video ID for the video you want to delete the chapter from and the language the chapter is in. /// @@ -211,6 +401,71 @@ public void delete(string videoId, string language) deleteWithHttpInfo(videoId, language); } + + /// + /// Delete a chapter Delete a chapter in a specific language by providing the video ID for the video you want to delete the chapter from and the language the chapter is in. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the video you want to delete a chapter from. +/// A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation. + + /// ApiResponse of Object(void) + public Task> deleteWithHttpInfoAsync(string videoId, string language, CancellationToken cancellationToken = default) + { + + + // verify the required parameter 'videoId' is set + if (videoId == null) + throw new ApiException(400, "Missing required parameter 'videoId' when calling ChaptersApi->delete"); + // verify the required parameter 'language' is set + if (language == null) + throw new ApiException(400, "Missing required parameter 'language' when calling ChaptersApi->delete"); + + + var localVarPath = "/videos/{videoId}/chapters/{language}"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + string[] localVarContentTypes = new string[] { + }; + 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 (videoId != null) localVarPathParams.Add("videoId", this.ApiClient.ParameterToString(videoId)); // path parameter + if (language != null) localVarPathParams.Add("language", this.ApiClient.ParameterToString(language)); // path parameter + + + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Delete, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + }); + + } + + /// /// Delete a chapter Delete a chapter in a specific language by providing the video ID for the video you want to delete the chapter from and the language the chapter is in. /// @@ -271,6 +526,23 @@ public ApiResponse deleteWithHttpInfo(string videoId, string language) } + /// + /// List video chapters Retrieve a list of all chapters for by video id. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the video you want to retrieve a list of chapters for. +/// Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1) +/// Results per page. Allowed values 1-100, default is 25. (optional, default to 25) + + /// ChaptersListResponse + public Task listAsync(string videoId, int? currentPage = default, int? pageSize = default, CancellationToken cancellationToken = default) + { + Task> localVarResponse = listWithHttpInfoAsync(videoId, currentPage, pageSize, cancellationToken); + return localVarResponse.ContinueWith((Task> task) => task.Result.Data ); + + } + /// /// List video chapters Retrieve a list of all chapters for by video id. /// @@ -286,6 +558,72 @@ public ChaptersListResponse list(string videoId, int? currentPage = default, int return localVarResponse.Data; } + + /// + /// List video chapters Retrieve a list of all chapters for by video id. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the video you want to retrieve a list of chapters for. +/// Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1) +/// Results per page. Allowed values 1-100, default is 25. (optional, default to 25) + + /// ApiResponse of ChaptersListResponse + public Task> listWithHttpInfoAsync(string videoId, int? currentPage = default, int? pageSize = default, CancellationToken cancellationToken = default) + { + + + + // verify the required parameter 'videoId' is set + if (videoId == null) + throw new ApiException(400, "Missing required parameter 'videoId' when calling ChaptersApi->list"); + + + var localVarPath = "/videos/{videoId}/chapters"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + string[] localVarContentTypes = new string[] { + }; + 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 (videoId != null) localVarPathParams.Add("videoId", this.ApiClient.ParameterToString(videoId)); // path parameter + if (currentPage != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "currentPage", currentPage)); // query parameter + if (pageSize != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "pageSize", pageSize)); // query parameter + + + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (ChaptersListResponse) this.ApiClient.Deserialize(task.Result, typeof(ChaptersListResponse))); + }); + + } + + /// /// List video chapters Retrieve a list of all chapters for by video id. /// diff --git a/src/Api/LiveStreamsApi.cs b/src/Api/LiveStreamsApi.cs index 1b0be32..b6087de 100644 --- a/src/Api/LiveStreamsApi.cs +++ b/src/Api/LiveStreamsApi.cs @@ -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; @@ -39,6 +40,21 @@ public LiveStreamsApi(ApiClient apiClient) this.ApiClient = apiClient; } + /// + /// Create live stream Creates a livestream object. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// + + /// LiveStream + public Task createAsync(LiveStreamCreationPayload liveStreamCreationPayload, CancellationToken cancellationToken = default) + { + Task> localVarResponse = createWithHttpInfoAsync(liveStreamCreationPayload, cancellationToken); + return localVarResponse.ContinueWith((Task> task) => task.Result.Data ); + + } + /// /// Create live stream Creates a livestream object. /// @@ -52,6 +68,80 @@ public LiveStream create(LiveStreamCreationPayload liveStreamCreationPayload) return localVarResponse.Data; } + + /// + /// Create live stream Creates a livestream object. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// + + /// ApiResponse of LiveStream + public Task> createWithHttpInfoAsync(LiveStreamCreationPayload liveStreamCreationPayload, CancellationToken cancellationToken = default) + { + if (liveStreamCreationPayload == null) + throw new ApiException(400,"Missing required parameter 'liveStreamCreationPayload' when calling LiveStreamsApi->create"); + + if (liveStreamCreationPayload != null && liveStreamCreationPayload.name == null) { + throw new ApiException(400,"Missing required parameter 'liveStreamCreationPayload.Name' when calling LiveStreamsApi->create"); + } + + // verify the required parameter 'liveStreamCreationPayload' is set + if (liveStreamCreationPayload == null) + throw new ApiException(400, "Missing required parameter 'liveStreamCreationPayload' when calling LiveStreamsApi->create"); + + + var localVarPath = "/live-streams"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + 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 (liveStreamCreationPayload != null && liveStreamCreationPayload.GetType() != typeof(byte[]) && liveStreamCreationPayload.GetType() != typeof(string)) + { + localVarPostBody = this.ApiClient.Serialize(liveStreamCreationPayload); // http body (model) parameter + } + else + { + localVarPostBody = liveStreamCreationPayload; // byte array + } + + + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (LiveStream) this.ApiClient.Deserialize(task.Result, typeof(LiveStream))); + }); + + } + + /// /// Create live stream Creates a livestream object. /// @@ -120,6 +210,21 @@ public ApiResponse createWithHttpInfo(LiveStreamCreationPayload live } + /// + /// Retrieve live stream Get a livestream by id. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique ID for the live stream you want to watch. + + /// LiveStream + public Task getAsync(string liveStreamId, CancellationToken cancellationToken = default) + { + Task> localVarResponse = getWithHttpInfoAsync(liveStreamId, cancellationToken); + return localVarResponse.ContinueWith((Task> task) => task.Result.Data ); + + } + /// /// Retrieve live stream Get a livestream by id. /// @@ -133,6 +238,66 @@ public LiveStream get(string liveStreamId) return localVarResponse.Data; } + + /// + /// Retrieve live stream Get a livestream by id. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique ID for the live stream you want to watch. + + /// ApiResponse of LiveStream + public Task> getWithHttpInfoAsync(string liveStreamId, CancellationToken cancellationToken = default) + { + + // verify the required parameter 'liveStreamId' is set + if (liveStreamId == null) + throw new ApiException(400, "Missing required parameter 'liveStreamId' when calling LiveStreamsApi->get"); + + + var localVarPath = "/live-streams/{liveStreamId}"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + string[] localVarContentTypes = new string[] { + }; + 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 (liveStreamId != null) localVarPathParams.Add("liveStreamId", this.ApiClient.ParameterToString(liveStreamId)); // path parameter + + + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (LiveStream) this.ApiClient.Deserialize(task.Result, typeof(LiveStream))); + }); + + } + + /// /// Retrieve live stream Get a livestream by id. /// @@ -187,6 +352,22 @@ public ApiResponse getWithHttpInfo(string liveStreamId) } + /// + /// Update a live stream Updates the livestream object. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique ID for the live stream that you want to update information for such as player details. +/// + + /// LiveStream + public Task updateAsync(string liveStreamId, LiveStreamUpdatePayload liveStreamUpdatePayload, CancellationToken cancellationToken = default) + { + Task> localVarResponse = updateWithHttpInfoAsync(liveStreamId, liveStreamUpdatePayload, cancellationToken); + return localVarResponse.ContinueWith((Task> task) => task.Result.Data ); + + } + /// /// Update a live stream Updates the livestream object. /// @@ -201,6 +382,86 @@ public LiveStream update(string liveStreamId, LiveStreamUpdatePayload liveStream return localVarResponse.Data; } + + /// + /// Update a live stream Updates the livestream object. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique ID for the live stream that you want to update information for such as player details. +/// + + /// ApiResponse of LiveStream + public Task> updateWithHttpInfoAsync(string liveStreamId, LiveStreamUpdatePayload liveStreamUpdatePayload, CancellationToken cancellationToken = default) + { + if (liveStreamUpdatePayload == null) + throw new ApiException(400,"Missing required parameter 'liveStreamUpdatePayload' when calling LiveStreamsApi->update"); + + + if (liveStreamUpdatePayload == null) + throw new ApiException(400,"Missing required parameter 'liveStreamUpdatePayload' when calling LiveStreamsApi->update"); + + + // verify the required parameter 'liveStreamId' is set + if (liveStreamId == null) + throw new ApiException(400, "Missing required parameter 'liveStreamId' when calling LiveStreamsApi->update"); + // verify the required parameter 'liveStreamUpdatePayload' is set + if (liveStreamUpdatePayload == null) + throw new ApiException(400, "Missing required parameter 'liveStreamUpdatePayload' when calling LiveStreamsApi->update"); + + + var localVarPath = "/live-streams/{liveStreamId}"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + 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 (liveStreamId != null) localVarPathParams.Add("liveStreamId", this.ApiClient.ParameterToString(liveStreamId)); // path parameter + if (liveStreamUpdatePayload != null && liveStreamUpdatePayload.GetType() != typeof(byte[]) && liveStreamUpdatePayload.GetType() != typeof(string)) + { + localVarPostBody = this.ApiClient.Serialize(liveStreamUpdatePayload); // http body (model) parameter + } + else + { + localVarPostBody = liveStreamUpdatePayload; // byte array + } + + + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Patch, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (LiveStream) this.ApiClient.Deserialize(task.Result, typeof(LiveStream))); + }); + + } + + /// /// Update a live stream Updates the livestream object. /// @@ -275,6 +536,19 @@ public ApiResponse updateWithHttpInfo(string liveStreamId, LiveStrea } + /// + /// Delete a live stream If you do not need a live stream any longer, you can send a request to delete it. All you need is the liveStreamId. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique ID for the live stream that you want to remove. + + /// + public void deleteAsync(string liveStreamId, CancellationToken cancellationToken = default) + { + deleteWithHttpInfoAsync(liveStreamId, cancellationToken); + } + /// /// Delete a live stream If you do not need a live stream any longer, you can send a request to delete it. All you need is the liveStreamId. /// @@ -287,6 +561,65 @@ public void delete(string liveStreamId) deleteWithHttpInfo(liveStreamId); } + + /// + /// Delete a live stream If you do not need a live stream any longer, you can send a request to delete it. All you need is the liveStreamId. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique ID for the live stream that you want to remove. + + /// ApiResponse of Object(void) + public Task> deleteWithHttpInfoAsync(string liveStreamId, CancellationToken cancellationToken = default) + { + + // verify the required parameter 'liveStreamId' is set + if (liveStreamId == null) + throw new ApiException(400, "Missing required parameter 'liveStreamId' when calling LiveStreamsApi->delete"); + + + var localVarPath = "/live-streams/{liveStreamId}"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + string[] localVarContentTypes = new string[] { + }; + 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 (liveStreamId != null) localVarPathParams.Add("liveStreamId", this.ApiClient.ParameterToString(liveStreamId)); // path parameter + + + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Delete, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + }); + + } + + /// /// Delete a live stream If you do not need a live stream any longer, you can send a request to delete it. All you need is the liveStreamId. /// @@ -341,6 +674,26 @@ public ApiResponse deleteWithHttpInfo(string liveStreamId) } + /// + /// List all live streams Get the list of livestreams on the workspace. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique stream key that allows you to stream videos. (optional) +/// You can filter live streams by their name or a part of their name. (optional) +/// Enables you to sort live stream results. Allowed attributes: `name`, `createdAt`, `updatedAt`. `name` - the name of the live stream. `createdAt` - the time a live stream was created. `updatedAt` - the time a live stream was last updated. When using `createdAt` or `updatedAt`, the API sorts the results based on the ISO-8601 time format. (optional) +/// Allowed: asc, desc. Ascending for date and time means that earlier values precede later ones. Descending means that later values preced earlier ones. For title, it is 0-9 and A-Z ascending and Z-A, 9-0 descending. (optional) +/// Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1) +/// Results per page. Allowed values 1-100, default is 25. (optional, default to 25) + + /// LiveStreamListResponse + public Task listAsync(string streamKey = default, string name = default, string sortBy = default, string sortOrder = default, int? currentPage = default, int? pageSize = default, CancellationToken cancellationToken = default) + { + Task> localVarResponse = listWithHttpInfoAsync(streamKey, name, sortBy, sortOrder, currentPage, pageSize, cancellationToken); + return localVarResponse.ContinueWith((Task> task) => task.Result.Data ); + + } + /// /// List all live streams Get the list of livestreams on the workspace. /// @@ -359,6 +712,78 @@ public LiveStreamListResponse list(string streamKey = default, string name = def return localVarResponse.Data; } + + /// + /// List all live streams Get the list of livestreams on the workspace. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique stream key that allows you to stream videos. (optional) +/// You can filter live streams by their name or a part of their name. (optional) +/// Enables you to sort live stream results. Allowed attributes: `name`, `createdAt`, `updatedAt`. `name` - the name of the live stream. `createdAt` - the time a live stream was created. `updatedAt` - the time a live stream was last updated. When using `createdAt` or `updatedAt`, the API sorts the results based on the ISO-8601 time format. (optional) +/// Allowed: asc, desc. Ascending for date and time means that earlier values precede later ones. Descending means that later values preced earlier ones. For title, it is 0-9 and A-Z ascending and Z-A, 9-0 descending. (optional) +/// Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1) +/// Results per page. Allowed values 1-100, default is 25. (optional, default to 25) + + /// ApiResponse of LiveStreamListResponse + public Task> listWithHttpInfoAsync(string streamKey = default, string name = default, string sortBy = default, string sortOrder = default, int? currentPage = default, int? pageSize = default, CancellationToken cancellationToken = default) + { + + + + + + + + + var localVarPath = "/live-streams"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + string[] localVarContentTypes = new string[] { + }; + 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 (streamKey != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "streamKey", streamKey)); // query parameter + if (name != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "name", name)); // query parameter + if (sortBy != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "sortBy", sortBy)); // query parameter + if (sortOrder != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "sortOrder", sortOrder)); // query parameter + if (currentPage != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "currentPage", currentPage)); // query parameter + if (pageSize != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "pageSize", pageSize)); // query parameter + + + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (LiveStreamListResponse) this.ApiClient.Deserialize(task.Result, typeof(LiveStreamListResponse))); + }); + + } + + /// /// List all live streams Get the list of livestreams on the workspace. /// @@ -542,6 +967,22 @@ private APIlistRequest copy() { return copy; } } + /// + /// Upload a thumbnail Upload the thumbnail for the livestream. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique ID for the live stream you want to upload. +/// The image to be added as a thumbnail. The mime type should be image/jpeg, image/png or image/webp. The max allowed size is 8 MiB. + + /// LiveStream + public Task uploadThumbnailAsync(string liveStreamId, System.IO.Stream file, CancellationToken cancellationToken = default) + { + Task> localVarResponse = uploadThumbnailWithHttpInfoAsync(liveStreamId, file, cancellationToken); + return localVarResponse.ContinueWith((Task> task) => task.Result.Data ); + + } + /// /// Upload a thumbnail Upload the thumbnail for the livestream. /// @@ -556,6 +997,76 @@ public LiveStream uploadThumbnail(string liveStreamId, System.IO.Stream file) return localVarResponse.Data; } + + /// + /// Upload a thumbnail Upload the thumbnail for the livestream. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique ID for the live stream you want to upload. +/// The image to be added as a thumbnail. The mime type should be image/jpeg, image/png or image/webp. The max allowed size is 8 MiB. + + /// ApiResponse of LiveStream + public Task> uploadThumbnailWithHttpInfoAsync(string liveStreamId, System.IO.Stream file, CancellationToken cancellationToken = default) + { + + + // verify the required parameter 'liveStreamId' is set + if (liveStreamId == null) + throw new ApiException(400, "Missing required parameter 'liveStreamId' when calling LiveStreamsApi->uploadThumbnail"); + // verify the required parameter 'file' is set + if (file == null) + throw new ApiException(400, "Missing required parameter 'file' when calling LiveStreamsApi->uploadThumbnail"); + + + var localVarPath = "/live-streams/{liveStreamId}/thumbnail"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + string[] localVarContentTypes = new string[] { + "multipart/form-data" + }; + 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 (liveStreamId != null) localVarPathParams.Add("liveStreamId", this.ApiClient.ParameterToString(liveStreamId)); // path parameter + + + + + if (file != null) + localVarFileParams.Add("file", this.ApiClient.ParameterToFile("file", file)); + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (LiveStream) this.ApiClient.Deserialize(task.Result, typeof(LiveStream))); + }); + + } + + /// /// Upload a thumbnail Upload the thumbnail for the livestream. /// @@ -620,6 +1131,21 @@ public ApiResponse uploadThumbnailWithHttpInfo(string liveStreamId, } + /// + /// Delete a thumbnail Send the unique identifier for a live stream to delete its thumbnail. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier of the live stream whose thumbnail you want to delete. + + /// LiveStream + public Task deleteThumbnailAsync(string liveStreamId, CancellationToken cancellationToken = default) + { + Task> localVarResponse = deleteThumbnailWithHttpInfoAsync(liveStreamId, cancellationToken); + return localVarResponse.ContinueWith((Task> task) => task.Result.Data ); + + } + /// /// Delete a thumbnail Send the unique identifier for a live stream to delete its thumbnail. /// @@ -633,6 +1159,66 @@ public LiveStream deleteThumbnail(string liveStreamId) return localVarResponse.Data; } + + /// + /// Delete a thumbnail Send the unique identifier for a live stream to delete its thumbnail. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier of the live stream whose thumbnail you want to delete. + + /// ApiResponse of LiveStream + public Task> deleteThumbnailWithHttpInfoAsync(string liveStreamId, CancellationToken cancellationToken = default) + { + + // verify the required parameter 'liveStreamId' is set + if (liveStreamId == null) + throw new ApiException(400, "Missing required parameter 'liveStreamId' when calling LiveStreamsApi->deleteThumbnail"); + + + var localVarPath = "/live-streams/{liveStreamId}/thumbnail"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + string[] localVarContentTypes = new string[] { + }; + 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 (liveStreamId != null) localVarPathParams.Add("liveStreamId", this.ApiClient.ParameterToString(liveStreamId)); // path parameter + + + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Delete, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (LiveStream) this.ApiClient.Deserialize(task.Result, typeof(LiveStream))); + }); + + } + + /// /// Delete a thumbnail Send the unique identifier for a live stream to delete its thumbnail. /// diff --git a/src/Api/PlayerThemesApi.cs b/src/Api/PlayerThemesApi.cs index a9b8529..c4c4f0e 100644 --- a/src/Api/PlayerThemesApi.cs +++ b/src/Api/PlayerThemesApi.cs @@ -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; @@ -39,6 +40,21 @@ public PlayerThemesApi(ApiClient apiClient) this.ApiClient = apiClient; } + /// + /// Create a player Create a player for your video, and customise it. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// + + /// PlayerTheme + public Task createAsync(PlayerThemeCreationPayload playerThemeCreationPayload, CancellationToken cancellationToken = default) + { + Task> localVarResponse = createWithHttpInfoAsync(playerThemeCreationPayload, cancellationToken); + return localVarResponse.ContinueWith((Task> task) => task.Result.Data ); + + } + /// /// Create a player Create a player for your video, and customise it. /// @@ -52,6 +68,77 @@ public PlayerTheme create(PlayerThemeCreationPayload playerThemeCreationPayload) return localVarResponse.Data; } + + /// + /// Create a player Create a player for your video, and customise it. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// + + /// ApiResponse of PlayerTheme + public Task> createWithHttpInfoAsync(PlayerThemeCreationPayload playerThemeCreationPayload, CancellationToken cancellationToken = default) + { + if (playerThemeCreationPayload == null) + throw new ApiException(400,"Missing required parameter 'playerThemeCreationPayload' when calling PlayerThemesApi->create"); + + + // verify the required parameter 'playerThemeCreationPayload' is set + if (playerThemeCreationPayload == null) + throw new ApiException(400, "Missing required parameter 'playerThemeCreationPayload' when calling PlayerThemesApi->create"); + + + var localVarPath = "/players"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + 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 (playerThemeCreationPayload != null && playerThemeCreationPayload.GetType() != typeof(byte[]) && playerThemeCreationPayload.GetType() != typeof(string)) + { + localVarPostBody = this.ApiClient.Serialize(playerThemeCreationPayload); // http body (model) parameter + } + else + { + localVarPostBody = playerThemeCreationPayload; // byte array + } + + + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (PlayerTheme) this.ApiClient.Deserialize(task.Result, typeof(PlayerTheme))); + }); + + } + + /// /// Create a player Create a player for your video, and customise it. /// @@ -117,6 +204,21 @@ public ApiResponse createWithHttpInfo(PlayerThemeCreationPayload pl } + /// + /// Retrieve a player Retreive a player theme by player id. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the player you want to retrieve. + + /// PlayerTheme + public Task getAsync(string playerId, CancellationToken cancellationToken = default) + { + Task> localVarResponse = getWithHttpInfoAsync(playerId, cancellationToken); + return localVarResponse.ContinueWith((Task> task) => task.Result.Data ); + + } + /// /// Retrieve a player Retreive a player theme by player id. /// @@ -130,6 +232,66 @@ public PlayerTheme get(string playerId) return localVarResponse.Data; } + + /// + /// Retrieve a player Retreive a player theme by player id. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the player you want to retrieve. + + /// ApiResponse of PlayerTheme + public Task> getWithHttpInfoAsync(string playerId, CancellationToken cancellationToken = default) + { + + // verify the required parameter 'playerId' is set + if (playerId == null) + throw new ApiException(400, "Missing required parameter 'playerId' when calling PlayerThemesApi->get"); + + + var localVarPath = "/players/{playerId}"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + string[] localVarContentTypes = new string[] { + }; + 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 (playerId != null) localVarPathParams.Add("playerId", this.ApiClient.ParameterToString(playerId)); // path parameter + + + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (PlayerTheme) this.ApiClient.Deserialize(task.Result, typeof(PlayerTheme))); + }); + + } + + /// /// Retrieve a player Retreive a player theme by player id. /// @@ -184,6 +346,22 @@ public ApiResponse getWithHttpInfo(string playerId) } + /// + /// Update a player Use a player ID to update specific details for a player. NOTE: It may take up to 10 min before the new player configuration is available from our CDN. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the player. +/// + + /// PlayerTheme + public Task updateAsync(string playerId, PlayerThemeUpdatePayload playerThemeUpdatePayload, CancellationToken cancellationToken = default) + { + Task> localVarResponse = updateWithHttpInfoAsync(playerId, playerThemeUpdatePayload, cancellationToken); + return localVarResponse.ContinueWith((Task> task) => task.Result.Data ); + + } + /// /// Update a player Use a player ID to update specific details for a player. NOTE: It may take up to 10 min before the new player configuration is available from our CDN. /// @@ -198,6 +376,86 @@ public PlayerTheme update(string playerId, PlayerThemeUpdatePayload playerThemeU return localVarResponse.Data; } + + /// + /// Update a player Use a player ID to update specific details for a player. NOTE: It may take up to 10 min before the new player configuration is available from our CDN. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the player. +/// + + /// ApiResponse of PlayerTheme + public Task> updateWithHttpInfoAsync(string playerId, PlayerThemeUpdatePayload playerThemeUpdatePayload, CancellationToken cancellationToken = default) + { + if (playerThemeUpdatePayload == null) + throw new ApiException(400,"Missing required parameter 'playerThemeUpdatePayload' when calling PlayerThemesApi->update"); + + + if (playerThemeUpdatePayload == null) + throw new ApiException(400,"Missing required parameter 'playerThemeUpdatePayload' when calling PlayerThemesApi->update"); + + + // verify the required parameter 'playerId' is set + if (playerId == null) + throw new ApiException(400, "Missing required parameter 'playerId' when calling PlayerThemesApi->update"); + // verify the required parameter 'playerThemeUpdatePayload' is set + if (playerThemeUpdatePayload == null) + throw new ApiException(400, "Missing required parameter 'playerThemeUpdatePayload' when calling PlayerThemesApi->update"); + + + var localVarPath = "/players/{playerId}"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + 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 (playerId != null) localVarPathParams.Add("playerId", this.ApiClient.ParameterToString(playerId)); // path parameter + if (playerThemeUpdatePayload != null && playerThemeUpdatePayload.GetType() != typeof(byte[]) && playerThemeUpdatePayload.GetType() != typeof(string)) + { + localVarPostBody = this.ApiClient.Serialize(playerThemeUpdatePayload); // http body (model) parameter + } + else + { + localVarPostBody = playerThemeUpdatePayload; // byte array + } + + + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Patch, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (PlayerTheme) this.ApiClient.Deserialize(task.Result, typeof(PlayerTheme))); + }); + + } + + /// /// Update a player Use a player ID to update specific details for a player. NOTE: It may take up to 10 min before the new player configuration is available from our CDN. /// @@ -272,6 +530,19 @@ public ApiResponse updateWithHttpInfo(string playerId, PlayerThemeU } + /// + /// Delete a player Delete a player if you no longer need it. You can delete any player that you have the player ID for. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the player you want to delete. + + /// + public void deleteAsync(string playerId, CancellationToken cancellationToken = default) + { + deleteWithHttpInfoAsync(playerId, cancellationToken); + } + /// /// Delete a player Delete a player if you no longer need it. You can delete any player that you have the player ID for. /// @@ -284,6 +555,65 @@ public void delete(string playerId) deleteWithHttpInfo(playerId); } + + /// + /// Delete a player Delete a player if you no longer need it. You can delete any player that you have the player ID for. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the player you want to delete. + + /// ApiResponse of Object(void) + public Task> deleteWithHttpInfoAsync(string playerId, CancellationToken cancellationToken = default) + { + + // verify the required parameter 'playerId' is set + if (playerId == null) + throw new ApiException(400, "Missing required parameter 'playerId' when calling PlayerThemesApi->delete"); + + + var localVarPath = "/players/{playerId}"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + string[] localVarContentTypes = new string[] { + }; + 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 (playerId != null) localVarPathParams.Add("playerId", this.ApiClient.ParameterToString(playerId)); // path parameter + + + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Delete, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + }); + + } + + /// /// Delete a player Delete a player if you no longer need it. You can delete any player that you have the player ID for. /// @@ -338,6 +668,24 @@ public ApiResponse deleteWithHttpInfo(string playerId) } + /// + /// List all player themes Retrieve a list of all the player themes you created, as well as details about each one. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// createdAt is the time the player was created. updatedAt is the time the player was last updated. The time is presented in ISO-8601 format. (optional) +/// Allowed: asc, desc. Ascending for date and time means that earlier values precede later ones. Descending means that later values preced earlier ones. (optional) +/// Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1) +/// Results per page. Allowed values 1-100, default is 25. (optional, default to 25) + + /// PlayerThemesListResponse + public Task listAsync(string sortBy = default, string sortOrder = default, int? currentPage = default, int? pageSize = default, CancellationToken cancellationToken = default) + { + Task> localVarResponse = listWithHttpInfoAsync(sortBy, sortOrder, currentPage, pageSize, cancellationToken); + return localVarResponse.ContinueWith((Task> task) => task.Result.Data ); + + } + /// /// List all player themes Retrieve a list of all the player themes you created, as well as details about each one. /// @@ -354,6 +702,72 @@ public PlayerThemesListResponse list(string sortBy = default, string sortOrder = return localVarResponse.Data; } + + /// + /// List all player themes Retrieve a list of all the player themes you created, as well as details about each one. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// createdAt is the time the player was created. updatedAt is the time the player was last updated. The time is presented in ISO-8601 format. (optional) +/// Allowed: asc, desc. Ascending for date and time means that earlier values precede later ones. Descending means that later values preced earlier ones. (optional) +/// Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1) +/// Results per page. Allowed values 1-100, default is 25. (optional, default to 25) + + /// ApiResponse of PlayerThemesListResponse + public Task> listWithHttpInfoAsync(string sortBy = default, string sortOrder = default, int? currentPage = default, int? pageSize = default, CancellationToken cancellationToken = default) + { + + + + + + + var localVarPath = "/players"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + string[] localVarContentTypes = new string[] { + }; + 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 (sortBy != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "sortBy", sortBy)); // query parameter + if (sortOrder != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "sortOrder", sortOrder)); // query parameter + if (currentPage != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "currentPage", currentPage)); // query parameter + if (pageSize != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "pageSize", pageSize)); // query parameter + + + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (PlayerThemesListResponse) this.ApiClient.Deserialize(task.Result, typeof(PlayerThemesListResponse))); + }); + + } + + /// /// List all player themes Retrieve a list of all the player themes you created, as well as details about each one. /// @@ -507,6 +921,23 @@ private APIlistRequest copy() { return copy; } } + /// + /// Upload a logo Upload an image file as a logo for your player. The image should fit within these constraints: - The image mime type must be `image/jpeg` or `image/png`. api.video recommends using `png` images with transparent background. - The image size should be a maximum of 200px width x 100px. - The file size should be a maximum of 100 KiB. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the player. +/// The name of the file you want to use for your logo. +/// A public link that you want to advertise in your player. For example, you could add a link to your company. When a viewer clicks on your logo, they will be taken to this address. (optional) + + /// PlayerTheme + public Task uploadLogoAsync(string playerId, System.IO.Stream file, string link = default, CancellationToken cancellationToken = default) + { + Task> localVarResponse = uploadLogoWithHttpInfoAsync(playerId, file, link, cancellationToken); + return localVarResponse.ContinueWith((Task> task) => task.Result.Data ); + + } + /// /// Upload a logo Upload an image file as a logo for your player. The image should fit within these constraints: - The image mime type must be `image/jpeg` or `image/png`. api.video recommends using `png` images with transparent background. - The image size should be a maximum of 200px width x 100px. - The file size should be a maximum of 100 KiB. /// @@ -522,6 +953,81 @@ public PlayerTheme uploadLogo(string playerId, System.IO.Stream file, string lin return localVarResponse.Data; } + + /// + /// Upload a logo Upload an image file as a logo for your player. The image should fit within these constraints: - The image mime type must be `image/jpeg` or `image/png`. api.video recommends using `png` images with transparent background. - The image size should be a maximum of 200px width x 100px. - The file size should be a maximum of 100 KiB. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the player. +/// The name of the file you want to use for your logo. +/// A public link that you want to advertise in your player. For example, you could add a link to your company. When a viewer clicks on your logo, they will be taken to this address. (optional) + + /// ApiResponse of PlayerTheme + public Task> uploadLogoWithHttpInfoAsync(string playerId, System.IO.Stream file, string link = default, CancellationToken cancellationToken = default) + { + + + + // verify the required parameter 'playerId' is set + if (playerId == null) + throw new ApiException(400, "Missing required parameter 'playerId' when calling PlayerThemesApi->uploadLogo"); + // verify the required parameter 'file' is set + if (file == null) + throw new ApiException(400, "Missing required parameter 'file' when calling PlayerThemesApi->uploadLogo"); + + + var localVarPath = "/players/{playerId}/logo"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + string[] localVarContentTypes = new string[] { + "multipart/form-data" + }; + 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 (playerId != null) localVarPathParams.Add("playerId", this.ApiClient.ParameterToString(playerId)); // path parameter + + if (link != null) + localVarFormParams.Add("link", this.ApiClient.ParameterToString(link)); // form parameter + + + + if (file != null) + localVarFileParams.Add("file", this.ApiClient.ParameterToFile("file", file)); + + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (PlayerTheme) this.ApiClient.Deserialize(task.Result, typeof(PlayerTheme))); + }); + + } + + /// /// Upload a logo Upload an image file as a logo for your player. The image should fit within these constraints: - The image mime type must be `image/jpeg` or `image/png`. api.video recommends using `png` images with transparent background. - The image size should be a maximum of 200px width x 100px. - The file size should be a maximum of 100 KiB. /// @@ -591,6 +1097,19 @@ public ApiResponse uploadLogoWithHttpInfo(string playerId, System.I } + /// + /// Delete logo Delete the logo associated to a player. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the player. + + /// + public void deleteLogoAsync(string playerId, CancellationToken cancellationToken = default) + { + deleteLogoWithHttpInfoAsync(playerId, cancellationToken); + } + /// /// Delete logo Delete the logo associated to a player. /// @@ -603,6 +1122,65 @@ public void deleteLogo(string playerId) deleteLogoWithHttpInfo(playerId); } + + /// + /// Delete logo Delete the logo associated to a player. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the player. + + /// ApiResponse of Object(void) + public Task> deleteLogoWithHttpInfoAsync(string playerId, CancellationToken cancellationToken = default) + { + + // verify the required parameter 'playerId' is set + if (playerId == null) + throw new ApiException(400, "Missing required parameter 'playerId' when calling PlayerThemesApi->deleteLogo"); + + + var localVarPath = "/players/{playerId}/logo"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + string[] localVarContentTypes = new string[] { + }; + 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 (playerId != null) localVarPathParams.Add("playerId", this.ApiClient.ParameterToString(playerId)); // path parameter + + + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Delete, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + }); + + } + + /// /// Delete logo Delete the logo associated to a player. /// diff --git a/src/Api/UploadTokensApi.cs b/src/Api/UploadTokensApi.cs index 2996860..7775404 100644 --- a/src/Api/UploadTokensApi.cs +++ b/src/Api/UploadTokensApi.cs @@ -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; @@ -39,6 +40,21 @@ public UploadTokensApi(ApiClient apiClient) this.ApiClient = apiClient; } + /// + /// Generate an upload token Generates an upload token that can be used to replace the API Key. More information can be found [here](https://docs.api.video/vod/delegated-upload-tokens) + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// + + /// UploadToken + public Task createTokenAsync(TokenCreationPayload tokenCreationPayload, CancellationToken cancellationToken = default) + { + Task> localVarResponse = createTokenWithHttpInfoAsync(tokenCreationPayload, cancellationToken); + return localVarResponse.ContinueWith((Task> task) => task.Result.Data ); + + } + /// /// Generate an upload token Generates an upload token that can be used to replace the API Key. More information can be found [here](https://docs.api.video/vod/delegated-upload-tokens) /// @@ -52,6 +68,77 @@ public UploadToken createToken(TokenCreationPayload tokenCreationPayload) return localVarResponse.Data; } + + /// + /// Generate an upload token Generates an upload token that can be used to replace the API Key. More information can be found [here](https://docs.api.video/vod/delegated-upload-tokens) + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// + + /// ApiResponse of UploadToken + public Task> createTokenWithHttpInfoAsync(TokenCreationPayload tokenCreationPayload, CancellationToken cancellationToken = default) + { + if (tokenCreationPayload == null) + throw new ApiException(400,"Missing required parameter 'tokenCreationPayload' when calling UploadTokensApi->createToken"); + + + // verify the required parameter 'tokenCreationPayload' is set + if (tokenCreationPayload == null) + throw new ApiException(400, "Missing required parameter 'tokenCreationPayload' when calling UploadTokensApi->createToken"); + + + var localVarPath = "/upload-tokens"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + 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 (tokenCreationPayload != null && tokenCreationPayload.GetType() != typeof(byte[]) && tokenCreationPayload.GetType() != typeof(string)) + { + localVarPostBody = this.ApiClient.Serialize(tokenCreationPayload); // http body (model) parameter + } + else + { + localVarPostBody = tokenCreationPayload; // byte array + } + + + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (UploadToken) this.ApiClient.Deserialize(task.Result, typeof(UploadToken))); + }); + + } + + /// /// Generate an upload token Generates an upload token that can be used to replace the API Key. More information can be found [here](https://docs.api.video/vod/delegated-upload-tokens) /// @@ -117,6 +204,21 @@ public ApiResponse createTokenWithHttpInfo(TokenCreationPayload tok } + /// + /// Retrieve upload token Retrieve details about a specific upload token by id. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the token you want information about. + + /// UploadToken + public Task getTokenAsync(string uploadToken, CancellationToken cancellationToken = default) + { + Task> localVarResponse = getTokenWithHttpInfoAsync(uploadToken, cancellationToken); + return localVarResponse.ContinueWith((Task> task) => task.Result.Data ); + + } + /// /// Retrieve upload token Retrieve details about a specific upload token by id. /// @@ -130,6 +232,66 @@ public UploadToken getToken(string uploadToken) return localVarResponse.Data; } + + /// + /// Retrieve upload token Retrieve details about a specific upload token by id. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the token you want information about. + + /// ApiResponse of UploadToken + public Task> getTokenWithHttpInfoAsync(string uploadToken, CancellationToken cancellationToken = default) + { + + // verify the required parameter 'uploadToken' is set + if (uploadToken == null) + throw new ApiException(400, "Missing required parameter 'uploadToken' when calling UploadTokensApi->getToken"); + + + var localVarPath = "/upload-tokens/{uploadToken}"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + string[] localVarContentTypes = new string[] { + }; + 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 (uploadToken != null) localVarPathParams.Add("uploadToken", this.ApiClient.ParameterToString(uploadToken)); // path parameter + + + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (UploadToken) this.ApiClient.Deserialize(task.Result, typeof(UploadToken))); + }); + + } + + /// /// Retrieve upload token Retrieve details about a specific upload token by id. /// @@ -184,6 +346,19 @@ public ApiResponse getTokenWithHttpInfo(string uploadToken) } + /// + /// Delete an upload token Delete an existing upload token. This is especially useful for tokens you may have created that do not expire. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the upload token you want to delete. Deleting a token will make it so the token can no longer be used for authentication. + + /// + public void deleteTokenAsync(string uploadToken, CancellationToken cancellationToken = default) + { + deleteTokenWithHttpInfoAsync(uploadToken, cancellationToken); + } + /// /// Delete an upload token Delete an existing upload token. This is especially useful for tokens you may have created that do not expire. /// @@ -196,6 +371,65 @@ public void deleteToken(string uploadToken) deleteTokenWithHttpInfo(uploadToken); } + + /// + /// Delete an upload token Delete an existing upload token. This is especially useful for tokens you may have created that do not expire. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// The unique identifier for the upload token you want to delete. Deleting a token will make it so the token can no longer be used for authentication. + + /// ApiResponse of Object(void) + public Task> deleteTokenWithHttpInfoAsync(string uploadToken, CancellationToken cancellationToken = default) + { + + // verify the required parameter 'uploadToken' is set + if (uploadToken == null) + throw new ApiException(400, "Missing required parameter 'uploadToken' when calling UploadTokensApi->deleteToken"); + + + var localVarPath = "/upload-tokens/{uploadToken}"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + string[] localVarContentTypes = new string[] { + }; + 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 (uploadToken != null) localVarPathParams.Add("uploadToken", this.ApiClient.ParameterToString(uploadToken)); // path parameter + + + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Delete, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + }); + + } + + /// /// Delete an upload token Delete an existing upload token. This is especially useful for tokens you may have created that do not expire. /// @@ -250,6 +484,24 @@ public ApiResponse deleteTokenWithHttpInfo(string uploadToken) } + /// + /// List all active upload tokens Retrieve a list of all currently active delegated tokens. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// Allowed: createdAt, ttl. You can use these to sort by when a token was created, or how much longer the token will be active (ttl - time to live). Date and time is presented in ISO-8601 format. (optional) +/// Allowed: asc, desc. Ascending is 0-9 or A-Z. Descending is 9-0 or Z-A. (optional) +/// Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1) +/// Results per page. Allowed values 1-100, default is 25. (optional, default to 25) + + /// TokenListResponse + public Task listAsync(string sortBy = default, string sortOrder = default, int? currentPage = default, int? pageSize = default, CancellationToken cancellationToken = default) + { + Task> localVarResponse = listWithHttpInfoAsync(sortBy, sortOrder, currentPage, pageSize, cancellationToken); + return localVarResponse.ContinueWith((Task> task) => task.Result.Data ); + + } + /// /// List all active upload tokens Retrieve a list of all currently active delegated tokens. /// @@ -266,6 +518,72 @@ public TokenListResponse list(string sortBy = default, string sortOrder = defaul return localVarResponse.Data; } + + /// + /// List all active upload tokens Retrieve a list of all currently active delegated tokens. + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// Allowed: createdAt, ttl. You can use these to sort by when a token was created, or how much longer the token will be active (ttl - time to live). Date and time is presented in ISO-8601 format. (optional) +/// Allowed: asc, desc. Ascending is 0-9 or A-Z. Descending is 9-0 or Z-A. (optional) +/// Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1) +/// Results per page. Allowed values 1-100, default is 25. (optional, default to 25) + + /// ApiResponse of TokenListResponse + public Task> listWithHttpInfoAsync(string sortBy = default, string sortOrder = default, int? currentPage = default, int? pageSize = default, CancellationToken cancellationToken = default) + { + + + + + + + var localVarPath = "/upload-tokens"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + string[] localVarContentTypes = new string[] { + }; + 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 (sortBy != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "sortBy", sortBy)); // query parameter + if (sortOrder != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "sortOrder", sortOrder)); // query parameter + if (currentPage != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "currentPage", currentPage)); // query parameter + if (pageSize != null) localVarQueryParams.AddRange(this.ApiClient.ParameterToKeyValuePairs("", "pageSize", pageSize)); // query parameter + + + + + // make the HTTP request + Task localVarResponse = (Task) this.ApiClient.CallApiAsync(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarContentType, cancellationToken); + + + return localVarResponse.ContinueWith((Task task) => + { + int localVarStatusCode = (int) task.Result.StatusCode; + return new ApiResponse(localVarStatusCode, + task.Result.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (TokenListResponse) this.ApiClient.Deserialize(task.Result, typeof(TokenListResponse))); + }); + + } + + /// /// List all active upload tokens Retrieve a list of all currently active delegated tokens. /// diff --git a/src/Api/VideosApi.cs b/src/Api/VideosApi.cs index 66413c3..1dbad05 100644 --- a/src/Api/VideosApi.cs +++ b/src/Api/VideosApi.cs @@ -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; @@ -39,6 +40,21 @@ public VideosApi(ApiClient apiClient) this.ApiClient = apiClient; } + /// + /// Create a video object Creates a video object. More information on video objects can be found [here](https://docs.api.video/reference/api/Videos). + /// + /// Thrown when fails to make API call + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. (optional) + /// video to create + + /// Video + public Task