From 851a6a1609285280d6331843f3c6bced80b9618d Mon Sep 17 00:00:00 2001 From: olivierapivideo Date: Fri, 27 Sep 2024 12:40:47 +0000 Subject: [PATCH] Add video tags endpoint --- CHANGELOG.md | 3 + README.md | 27 +- api/openapi.yaml | 203 +++++++++ build.gradle | 2 +- docs/ListTagsResponse.md | 18 + docs/ListTagsResponseData.md | 18 + docs/TagsApi.md | 86 ++++ pom.xml | 2 +- .../java/video/api/client/ApiVideoClient.java | 11 + .../java/video/api/client/api/ApiClient.java | 2 +- .../video/api/client/api/clients/TagsApi.java | 403 ++++++++++++++++++ .../client/api/models/ListTagsResponse.java | 133 ++++++ .../api/models/ListTagsResponseData.java | 121 ++++++ .../api/client/api/clients/TagsApiTest.java | 10 + .../payloads/tags/list/responses/200.json | 26 ++ .../payloads/tags/list/responses/429.json | 5 + 16 files changed, 1064 insertions(+), 6 deletions(-) create mode 100644 docs/ListTagsResponse.md create mode 100644 docs/ListTagsResponseData.md create mode 100644 docs/TagsApi.md create mode 100644 src/main/java/video/api/client/api/clients/TagsApi.java create mode 100644 src/main/java/video/api/client/api/models/ListTagsResponse.java create mode 100644 src/main/java/video/api/client/api/models/ListTagsResponseData.java create mode 100644 src/test/java/video/api/client/api/clients/TagsApiTest.java create mode 100644 src/test/resources/payloads/tags/list/responses/200.json create mode 100644 src/test/resources/payloads/tags/list/responses/429.json diff --git a/CHANGELOG.md b/CHANGELOG.md index e1a1d67..c48fc20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog All changes to this project will be documented in this file. +## [1.4.3] - 2024-09-30 +- Add /tags API endpoint + ## [1.4.2] - 2024-09-16 - Add discarded video endpoints diff --git a/README.md b/README.md index 5b73bdf..dbf34cb 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ - [ChaptersApi](#chaptersapi) - [LiveStreamsApi](#livestreamsapi) - [PlayerThemesApi](#playerthemesapi) + - [TagsApi](#tagsapi) - [UploadTokensApi](#uploadtokensapi) - [VideosApi](#videosapi) - [WatermarksApi](#watermarksapi) @@ -68,7 +69,7 @@ Add this dependency to your project's POM: video.api java-api-client - 1.4.2 + 1.4.3 compile ``` @@ -78,7 +79,7 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -implementation "video.api:java-api-client:1.4.2" +implementation "video.api:java-api-client:1.4.3" ``` #### Others @@ -91,7 +92,7 @@ mvn clean package Then manually install the following JARs: -* `target/java-api-client-1.4.2.jar` +* `target/java-api-client-1.4.3.jar` * `target/lib/*.jar` ### Code sample @@ -248,6 +249,24 @@ Method | HTTP request | Description [**deleteLogo**](https://github.com/apivideo/api.video-java-client/blob/main/docs/PlayerThemesApi.md#deleteLogo) | **DELETE** `/players/{playerId}/logo` | Delete logo +### TagsApi + + +#### Retrieve an instance of TagsApi: +```java +ApiVideoClient client = new ApiVideoClient("YOUR_API_KEY"); +TagsApi tags = client.tags() +``` + + + +#### Endpoints + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**list**](https://github.com/apivideo/api.video-java-client/blob/main/docs/TagsApi.md#list) | **GET** `/tags` | List all video tags + + ### UploadTokensApi @@ -370,6 +389,8 @@ Method | HTTP request | Description - [FilterBy1](https://github.com/apivideo/api.video-java-client/blob/main/docs/FilterBy1.md) - [FilterBy2](https://github.com/apivideo/api.video-java-client/blob/main/docs/FilterBy2.md) - [Link](https://github.com/apivideo/api.video-java-client/blob/main/docs/Link.md) + - [ListTagsResponse](https://github.com/apivideo/api.video-java-client/blob/main/docs/ListTagsResponse.md) + - [ListTagsResponseData](https://github.com/apivideo/api.video-java-client/blob/main/docs/ListTagsResponseData.md) - [LiveStream](https://github.com/apivideo/api.video-java-client/blob/main/docs/LiveStream.md) - [LiveStreamAssets](https://github.com/apivideo/api.video-java-client/blob/main/docs/LiveStreamAssets.md) - [LiveStreamCreationPayload](https://github.com/apivideo/api.video-java-client/blob/main/docs/LiveStreamCreationPayload.md) diff --git a/api/openapi.yaml b/api/openapi.yaml index eb5442d..e292573 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -981,6 +981,162 @@ paths: // Documentation: https://github.com/apivideo/api.video-swift-client/blob/main/docs/VideosAPI.md#create x-contentType: application/json x-accepts: application/json + /tags: + get: + description: This endpoint enables you to search for video tags in a project + and see how many videos are tagged with them. If you do not define any query + parameters, the endpoint lists all video tags and the numbers of times they + are used in a project. + operationId: LIST-tags + parameters: + - description: | + Use this parameter to search for specific video tags. The API filters results even on partial values, and ignores accents, uppercase, and lowercase. + explode: true + in: query + name: value + required: false + schema: + type: string + style: form + - description: | + Use this parameter to choose which field the API will use to sort the response data. The default is `value`. + + These are the available fields to sort by: + + - `value`: Sorts the results based on tag values in alphabetic order. + - `videoCount`: Sorts the results based on the number of times a video tag is used. + example: value + explode: true + in: query + name: sortBy + required: false + schema: + enum: + - value + - videoCount + type: string + style: form + - description: Use this parameter to sort results. `asc` is ascending and sorts + from A to Z. `desc` is descending and sorts from Z to A. + example: asc + explode: true + in: query + name: sortOrder + required: false + schema: + enum: + - asc + - desc + type: string + style: form + - description: 'Choose the number of search results to return per page. Minimum + value: 1' + example: 2 + explode: true + in: query + name: currentPage + required: false + schema: + default: 1 + type: integer + style: form + - description: Results per page. Allowed values 1-100, default is 25. + example: 30 + explode: true + in: query + name: pageSize + required: false + schema: + default: 25 + type: integer + style: form + responses: + "200": + content: + application/json: + examples: + response: + value: + data: + - value: maths + videoCount: "33" + - value: tutorials + videoCount: "10" + pagination: + currentPage: 1 + pageSize: 25 + pagesTotal: 1 + itemsTotal: 2 + currentPageItems: 2 + links: + - rel: self + uri: https://ws.api.video/watermarks?currentPage=1 + - rel: first + uri: https://ws.api.video/watermarks?currentPage=1 + - rel: last + uri: https://ws.api.video/watermarks?currentPage=1 + schema: + $ref: '#/components/schemas/list-tags-response' + description: Success + headers: + X-RateLimit-Limit: + description: The request limit per minute. + explode: false + schema: + type: integer + style: simple + X-RateLimit-Remaining: + description: The number of available requests left for the current time + window. + explode: false + schema: + type: integer + style: simple + X-RateLimit-Retry-After: + description: The number of seconds left until the current rate limit + window resets. + explode: false + schema: + type: integer + style: simple + "429": + content: + application/json: + examples: + Too many requests: + value: + type: https://docs.api.video/reference/too-many-requests + title: Too many requests. + status: 429 + schema: + $ref: '#/components/schemas/too-many-requests' + description: Too Many Requests + headers: + X-RateLimit-Limit: + description: The request limit per minute. + explode: false + schema: + type: integer + style: simple + X-RateLimit-Remaining: + description: The number of available requests left for the current time + window. + explode: false + schema: + type: integer + style: simple + X-RateLimit-Retry-After: + description: The number of seconds left until the current rate limit + window resets. + explode: false + schema: + type: integer + style: simple + summary: List all video tags + tags: + - Tags + x-client-action: list + x-accepts: application/json /videos/{videoId}/source: post: description: Ingest a video from a source or file. @@ -14839,6 +14995,41 @@ components: - videoId title: Video type: object + list-tags-response: + example: + pagination: + itemsTotal: 123 + pagesTotal: 7 + pageSize: 20 + currentPage: 3 + currentPageItems: 20 + links: + first: + rel: first + uri: /videos/search?currentPage=1&pageSize=20 + previous: + rel: previous + uri: /videos/search?currentPage=2&pageSize=20 + next: + rel: next + uri: /videos/search?currentPage=4&pageSize=20 + last: + rel: last + uri: /videos/search?currentPage=6&pageSize=20 + data: + - videoCount: 0 + value: value + - videoCount: 0 + value: value + properties: + data: + items: + $ref: '#/components/schemas/list_tags_response_data' + type: array + pagination: + $ref: '#/components/schemas/pagination' + title: Tags + type: object watermark: example: watermarkId: watermark_1BWr2L5MTQwxGkuxKjzh6i @@ -16977,6 +17168,18 @@ components: type: string type: object x-is-deep-object: true + list_tags_response_data: + example: + videoCount: 0 + value: value + properties: + value: + description: Returns the value of a video tag used in your project. + type: string + videoCount: + description: Returns the number of times a video tag is used. + type: integer + type: object player_theme_assets: example: link: path/to/my/logo/mylogo.jpg diff --git a/build.gradle b/build.gradle index 47207b1..47eaa74 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ apply plugin: 'com.diffplug.spotless' apply plugin: 'maven-publish' group = 'video.api' -version = '1.4.2' +version = '1.4.3' buildscript { repositories { diff --git a/docs/ListTagsResponse.md b/docs/ListTagsResponse.md new file mode 100644 index 0000000..9ca1ed5 --- /dev/null +++ b/docs/ListTagsResponse.md @@ -0,0 +1,18 @@ + + +# ListTagsResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**List<ListTagsResponseData>**](ListTagsResponseData.md) | | [optional] +**pagination** | [**Pagination**](Pagination.md) | | [optional] + + +## Implemented Interfaces + +* Serializable +* DeepObject + + diff --git a/docs/ListTagsResponseData.md b/docs/ListTagsResponseData.md new file mode 100644 index 0000000..ab1251c --- /dev/null +++ b/docs/ListTagsResponseData.md @@ -0,0 +1,18 @@ + + +# ListTagsResponseData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**value** | **String** | Returns the value of a video tag used in your project. | [optional] +**videoCount** | **Integer** | Returns the number of times a video tag is used. | [optional] + + +## Implemented Interfaces + +* Serializable +* DeepObject + + diff --git a/docs/TagsApi.md b/docs/TagsApi.md new file mode 100644 index 0000000..14e48ba --- /dev/null +++ b/docs/TagsApi.md @@ -0,0 +1,86 @@ +# TagsApi + +All URIs are relative to *https://ws.api.video* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**list**](TagsApi.md#list) | **GET** /tags | List all video tags + + + +# **list** +> ListTagsResponse list(value, sortBy, sortOrder, currentPage, pageSize) +> okhttp3.Call listAsync(value, sortBy, sortOrder, currentPage, pageSize, callback) +> ApiResponse listWithHttpInfo(value, sortBy, sortOrder, currentPage, pageSize) + +List all video tags + +This endpoint enables you to search for video tags in a project and see how many videos are tagged with them. If you do not define any query parameters, the endpoint lists all video tags and the numbers of times they are used in a project. + +### Example +```java +// Import classes: +import video.api.client.ApiVideoClient; +import video.api.client.api.ApiException; +import video.api.client.api.models.*; +import video.api.client.api.clients.TagsApi; +import java.util.*; + +public class Example { + public static void main(String[] args) { + ApiVideoClient client = new ApiVideoClient(); + // if you rather like to use the sandbox environment: + // ApiVideoClient client = new ApiVideoClient(Environment.SANDBOX); + + TagsApi apiInstance = client.tags(); + + String value = "value_example"; // Use this parameter to search for specific video tags. The API filters results even on partial values, and ignores accents, uppercase, and lowercase. + String sortBy = "value"; // Use this parameter to choose which field the API will use to sort the response data. The default is `value`. These are the available fields to sort by: - `value`: Sorts the results based on tag values in alphabetic order. - `videoCount`: Sorts the results based on the number of times a video tag is used. + String sortOrder = "asc"; // Use this parameter to sort results. `asc` is ascending and sorts from A to Z. `desc` is descending and sorts from Z to A. + Integer currentPage = 1; // Choose the number of search results to return per page. Minimum value: 1 + Integer pageSize = 25; // Results per page. Allowed values 1-100, default is 25. + + try { + ListTagsResponse result = apiInstance.list(value, sortBy, sortOrder, currentPage, pageSize); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TagsApi#list"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getMessage()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **value** | **String**| Use this parameter to search for specific video tags. The API filters results even on partial values, and ignores accents, uppercase, and lowercase. | [optional] + **sortBy** | **String**| Use this parameter to choose which field the API will use to sort the response data. The default is `value`. These are the available fields to sort by: - `value`: Sorts the results based on tag values in alphabetic order. - `videoCount`: Sorts the results based on the number of times a video tag is used. | [optional] [enum: value, videoCount] + **sortOrder** | **String**| Use this parameter to sort results. `asc` is ascending and sorts from A to Z. `desc` is descending and sorts from Z to A. | [optional] [enum: asc, desc] + **currentPage** | **Integer**| Choose the number of search results to return per page. Minimum value: 1 | [optional] [default to 1] + **pageSize** | **Integer**| Results per page. Allowed values 1-100, default is 25. | [optional] [default to 25] + +### Return type + + +[**ListTagsResponse**](ListTagsResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Success | * X-RateLimit-Limit - The request limit per minute.
* X-RateLimit-Remaining - The number of available requests left for the current time window.
* X-RateLimit-Retry-After - The number of seconds left until the current rate limit window resets.
| +**429** | Too Many Requests | * X-RateLimit-Limit - The request limit per minute.
* X-RateLimit-Remaining - The number of available requests left for the current time window.
* X-RateLimit-Retry-After - The number of seconds left until the current rate limit window resets.
| + diff --git a/pom.xml b/pom.xml index 013b871..bc3691a 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ java-api-client jar ${project.groupId}:${project.artifactId} - 1.4.2 + 1.4.3 https://github.com/apivideo/api.video-java-client api.video Java API client diff --git a/src/main/java/video/api/client/ApiVideoClient.java b/src/main/java/video/api/client/ApiVideoClient.java index c5dfef9..29db65b 100644 --- a/src/main/java/video/api/client/ApiVideoClient.java +++ b/src/main/java/video/api/client/ApiVideoClient.java @@ -13,6 +13,7 @@ public class ApiVideoClient { private final ChaptersApi chapters; private final LiveStreamsApi liveStreams; private final PlayerThemesApi playerThemes; + private final TagsApi tags; private final UploadTokensApi uploadTokens; private final VideosApi videos; private final WatermarksApi watermarks; @@ -87,6 +88,7 @@ public ApiVideoClient(ApiClient apiClient) { this.chapters = new ChaptersApi(this.apiClient); this.liveStreams = new LiveStreamsApi(this.apiClient); this.playerThemes = new PlayerThemesApi(this.apiClient); + this.tags = new TagsApi(this.apiClient); this.uploadTokens = new UploadTokensApi(this.apiClient); this.videos = new VideosApi(this.apiClient); this.watermarks = new WatermarksApi(this.apiClient); @@ -138,6 +140,15 @@ public PlayerThemesApi playerThemes() { return this.playerThemes; } + /** + * Get an TagsApi instance + * + * @return TagsApi + */ + public TagsApi tags() { + return this.tags; + } + /** * Get an UploadTokensApi instance * diff --git a/src/main/java/video/api/client/api/ApiClient.java b/src/main/java/video/api/client/api/ApiClient.java index 7374740..33ca591 100644 --- a/src/main/java/video/api/client/api/ApiClient.java +++ b/src/main/java/video/api/client/api/ApiClient.java @@ -120,7 +120,7 @@ private OkHttpClient initHttpClient(List interceptors) { private void init() { verifyingSsl = true; json = new JSON(); - addDefaultHeader("AV-Origin-Client", "java:1.4.2"); + addDefaultHeader("AV-Origin-Client", "java:1.4.3"); } private boolean isValid(String regex, String field) { diff --git a/src/main/java/video/api/client/api/clients/TagsApi.java b/src/main/java/video/api/client/api/clients/TagsApi.java new file mode 100644 index 0000000..b87a776 --- /dev/null +++ b/src/main/java/video/api/client/api/clients/TagsApi.java @@ -0,0 +1,403 @@ +/* + * api.video Java API client + * api.video is an API that encodes on the go to facilitate immediate playback, enhancing viewer streaming experiences across multiple devices and platforms. You can stream live or on-demand online videos within minutes. + * + * The version of the OpenAPI document: 1 + * Contact: ecosystem@api.video + * + * NOTE: This class is auto generated. + * Do not edit the class manually. + */ + +package video.api.client.api.clients; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + +import video.api.client.api.models.ListTagsResponse; +import video.api.client.api.models.TooManyRequests; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import video.api.client.api.models.*; +import video.api.client.api.upload.*; +import video.api.client.api.*; + +public class TagsApi { + private ApiClient localVarApiClient; + + public TagsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + /** + * Constructor for TagsApi production environment where API key is not required. + */ + public TagsApi() { + this.localVarApiClient = new ApiClient(Environment.PRODUCTION.basePath); + } + + /** + * Constructor for TagsApi with custom API base path where API key is not required. + * + * @param basePath + * the api base path. Expected Environment.PRODUCTION.basePath (default) or Environment.SANDBOX.basePath. + */ + public TagsApi(String basePath) { + this.localVarApiClient = new ApiClient(basePath); + } + + /** + * Constructor for TagsApi with custom API base path where API key is not required. + * + * @param environment + * the target environment. Expected Environment.PRODUCTION (default) or Environment.SANDBOX. + */ + public TagsApi(Environment environment) { + this.localVarApiClient = new ApiClient(environment.basePath); + } + + /** + * Constructor for TagsApi with custom API base path + * + * @param apiKey + * the api key to use to authenticate to the API + * @param basePath + * the api base path. Expected Environment.PRODUCTION.basePath (default) or Environment.SANDBOX.basePath. + */ + public TagsApi(String apiKey, String basePath) { + this.localVarApiClient = new ApiClient(apiKey, basePath); + } + + /** + * Constructor for TagsApi with custom API base path + * + * @param apiKey + * the api key to use to authenticate to the API + * @param environment + * the target environment. Expected Environment.PRODUCTION (default) or Environment.SANDBOX. + */ + public TagsApi(String apiKey, Environment environment) { + this.localVarApiClient = new ApiClient(apiKey, environment.basePath); + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + /** + * Build call for list + * + * @param value + * Use this parameter to search for specific video tags. The API filters results even on partial values, + * and ignores accents, uppercase, and lowercase. (optional) + * @param sortBy + * Use this parameter to choose which field the API will use to sort the response data. The default is + * `value`. These are the available fields to sort by: - `value`: Sorts the results + * based on tag values in alphabetic order. - `videoCount`: Sorts the results based on the + * number of times a video tag is used. (optional) + * @param sortOrder + * Use this parameter to sort results. `asc` is ascending and sorts from A to Z. + * `desc` is descending and sorts from Z to A. (optional) + * @param currentPage + * Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1) + * @param pageSize + * Results per page. Allowed values 1-100, default is 25. (optional, default to 25) + * @param _callback + * Callback for upload/download progress + * + * @return Call to execute + * + * @throws ApiException + * If fail to serialize the request body object + * + * @http.response.details + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Status CodeDescriptionResponse Headers
200Success* X-RateLimit-Limit - The request limit per minute.
+ * * X-RateLimit-Remaining - The number of available requests left for the current time + * window.
+ * * X-RateLimit-Retry-After - The number of seconds left until the current rate limit window + * resets.
+ *
429Too Many Requests* X-RateLimit-Limit - The request limit per minute.
+ * * X-RateLimit-Remaining - The number of available requests left for the current time + * window.
+ * * X-RateLimit-Retry-After - The number of seconds left until the current rate limit window + * resets.
+ *
+ */ + private okhttp3.Call listCall(String value, String sortBy, String sortOrder, Integer currentPage, Integer pageSize, + final ApiCallback _callback) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/tags"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (value != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("value", value)); + } + + if (sortBy != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sortBy", sortBy)); + } + + if (sortOrder != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sortOrder", sortOrder)); + } + + if (currentPage != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("currentPage", currentPage)); + } + + if (pageSize != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("pageSize", pageSize)); + } + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, + localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listValidateBeforeCall(String value, String sortBy, String sortOrder, Integer currentPage, + Integer pageSize, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = listCall(value, sortBy, sortOrder, currentPage, pageSize, _callback); + return localVarCall; + } + + /** + * List all video tags + * + * This endpoint enables you to search for video tags in a project and see how many videos are tagged with them. If + * you do not define any query parameters, the endpoint lists all video tags and the numbers of times they are used + * in a project. + * + * @param value + * Use this parameter to search for specific video tags. The API filters results even on partial values, + * and ignores accents, uppercase, and lowercase. (optional) + * @param sortBy + * Use this parameter to choose which field the API will use to sort the response data. The default is + * `value`. These are the available fields to sort by: - `value`: Sorts the results + * based on tag values in alphabetic order. - `videoCount`: Sorts the results based on the + * number of times a video tag is used. (optional) + * @param sortOrder + * Use this parameter to sort results. `asc` is ascending and sorts from A to Z. + * `desc` is descending and sorts from Z to A. (optional) + * @param currentPage + * Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1) + * @param pageSize + * Results per page. Allowed values 1-100, default is 25. (optional, default to 25) + * + * @return ListTagsResponse + * + * @throws ApiException + * If fail to call the API, e.g. server error or cannot deserialize the response body + * + * @http.response.details + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Status CodeDescriptionResponse Headers
200Success* X-RateLimit-Limit - The request limit per minute.
+ * * X-RateLimit-Remaining - The number of available requests left for the current time + * window.
+ * * X-RateLimit-Retry-After - The number of seconds left until the current rate limit window + * resets.
+ *
429Too Many Requests* X-RateLimit-Limit - The request limit per minute.
+ * * X-RateLimit-Remaining - The number of available requests left for the current time + * window.
+ * * X-RateLimit-Retry-After - The number of seconds left until the current rate limit window + * resets.
+ *
+ */ + public ListTagsResponse list(String value, String sortBy, String sortOrder, Integer currentPage, Integer pageSize) + throws ApiException { + ApiResponse localVarResp = listWithHttpInfo(value, sortBy, sortOrder, currentPage, pageSize); + return localVarResp.getData(); + } + + /** + * List all video tags + * + * This endpoint enables you to search for video tags in a project and see how many videos are tagged with them. If + * you do not define any query parameters, the endpoint lists all video tags and the numbers of times they are used + * in a project. + * + * @param value + * Use this parameter to search for specific video tags. The API filters results even on partial values, + * and ignores accents, uppercase, and lowercase. (optional) + * @param sortBy + * Use this parameter to choose which field the API will use to sort the response data. The default is + * `value`. These are the available fields to sort by: - `value`: Sorts the results + * based on tag values in alphabetic order. - `videoCount`: Sorts the results based on the + * number of times a video tag is used. (optional) + * @param sortOrder + * Use this parameter to sort results. `asc` is ascending and sorts from A to Z. + * `desc` is descending and sorts from Z to A. (optional) + * @param currentPage + * Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1) + * @param pageSize + * Results per page. Allowed values 1-100, default is 25. (optional, default to 25) + * + * @return ApiResponse<ListTagsResponse> + * + * @throws ApiException + * If fail to call the API, e.g. server error or cannot deserialize the response body + * + * @http.response.details + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Status CodeDescriptionResponse Headers
200Success* X-RateLimit-Limit - The request limit per minute.
+ * * X-RateLimit-Remaining - The number of available requests left for the current time + * window.
+ * * X-RateLimit-Retry-After - The number of seconds left until the current rate limit window + * resets.
+ *
429Too Many Requests* X-RateLimit-Limit - The request limit per minute.
+ * * X-RateLimit-Remaining - The number of available requests left for the current time + * window.
+ * * X-RateLimit-Retry-After - The number of seconds left until the current rate limit window + * resets.
+ *
+ */ + public ApiResponse listWithHttpInfo(String value, String sortBy, String sortOrder, + Integer currentPage, Integer pageSize) throws ApiException { + okhttp3.Call localVarCall = listValidateBeforeCall(value, sortBy, sortOrder, currentPage, pageSize, null); + Type localVarReturnType = new TypeToken() { + }.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all video tags (asynchronously) This endpoint enables you to search for video tags in a project and see how + * many videos are tagged with them. If you do not define any query parameters, the endpoint lists all video tags + * and the numbers of times they are used in a project. + * + * @param value + * Use this parameter to search for specific video tags. The API filters results even on partial values, + * and ignores accents, uppercase, and lowercase. (optional) + * @param sortBy + * Use this parameter to choose which field the API will use to sort the response data. The default is + * `value`. These are the available fields to sort by: - `value`: Sorts the results + * based on tag values in alphabetic order. - `videoCount`: Sorts the results based on the + * number of times a video tag is used. (optional) + * @param sortOrder + * Use this parameter to sort results. `asc` is ascending and sorts from A to Z. + * `desc` is descending and sorts from Z to A. (optional) + * @param currentPage + * Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1) + * @param pageSize + * Results per page. Allowed values 1-100, default is 25. (optional, default to 25) + * @param _callback + * The callback to be executed when the API call finishes + * + * @return The request call + * + * @throws ApiException + * If fail to process the API call, e.g. serializing the request body object + * + * @http.response.details + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Status CodeDescriptionResponse Headers
200Success* X-RateLimit-Limit - The request limit per minute.
+ * * X-RateLimit-Remaining - The number of available requests left for the current time + * window.
+ * * X-RateLimit-Retry-After - The number of seconds left until the current rate limit window + * resets.
+ *
429Too Many Requests* X-RateLimit-Limit - The request limit per minute.
+ * * X-RateLimit-Remaining - The number of available requests left for the current time + * window.
+ * * X-RateLimit-Retry-After - The number of seconds left until the current rate limit window + * resets.
+ *
+ */ + public okhttp3.Call listAsync(String value, String sortBy, String sortOrder, Integer currentPage, Integer pageSize, + final ApiCallback _callback) throws ApiException { + okhttp3.Call localVarCall = listValidateBeforeCall(value, sortBy, sortOrder, currentPage, pageSize, _callback); + Type localVarReturnType = new TypeToken() { + }.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + +} diff --git a/src/main/java/video/api/client/api/models/ListTagsResponse.java b/src/main/java/video/api/client/api/models/ListTagsResponse.java new file mode 100644 index 0000000..f472246 --- /dev/null +++ b/src/main/java/video/api/client/api/models/ListTagsResponse.java @@ -0,0 +1,133 @@ +/* + * api.video Java API client + * api.video is an API that encodes on the go to facilitate immediate playback, enhancing viewer streaming experiences across multiple devices and platforms. You can stream live or on-demand online videos within minutes. + * + * The version of the OpenAPI document: 1 + * Contact: ecosystem@api.video + * + * NOTE: This class is auto generated. + * Do not edit the class manually. + */ + +package video.api.client.api.models; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import video.api.client.api.models.ListTagsResponseData; +import video.api.client.api.models.Pagination; +import java.io.Serializable; + +/** + * ListTagsResponse + */ + +public class ListTagsResponse implements Serializable, DeepObject { + private static final long serialVersionUID = 1L; + + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data = null; + + public static final String SERIALIZED_NAME_PAGINATION = "pagination"; + @SerializedName(SERIALIZED_NAME_PAGINATION) + private Pagination pagination; + + public ListTagsResponse data(List data) { + this.data = data; + return this; + } + + public ListTagsResponse addDataItem(ListTagsResponseData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * + * @return data + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public ListTagsResponse pagination(Pagination pagination) { + this.pagination = pagination; + return this; + } + + /** + * Get pagination + * + * @return pagination + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Pagination getPagination() { + return pagination; + } + + public void setPagination(Pagination pagination) { + this.pagination = pagination; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListTagsResponse listTagsResponse = (ListTagsResponse) o; + return Objects.equals(this.data, listTagsResponse.data) + && Objects.equals(this.pagination, listTagsResponse.pagination); + } + + @Override + public int hashCode() { + return Objects.hash(data, pagination); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListTagsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" pagination: ").append(toIndentedString(pagination)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/src/main/java/video/api/client/api/models/ListTagsResponseData.java b/src/main/java/video/api/client/api/models/ListTagsResponseData.java new file mode 100644 index 0000000..2c1c394 --- /dev/null +++ b/src/main/java/video/api/client/api/models/ListTagsResponseData.java @@ -0,0 +1,121 @@ +/* + * api.video Java API client + * api.video is an API that encodes on the go to facilitate immediate playback, enhancing viewer streaming experiences across multiple devices and platforms. You can stream live or on-demand online videos within minutes. + * + * The version of the OpenAPI document: 1 + * Contact: ecosystem@api.video + * + * NOTE: This class is auto generated. + * Do not edit the class manually. + */ + +package video.api.client.api.models; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.io.Serializable; + +/** + * ListTagsResponseData + */ + +public class ListTagsResponseData implements Serializable, DeepObject { + private static final long serialVersionUID = 1L; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + private String value; + + public static final String SERIALIZED_NAME_VIDEO_COUNT = "videoCount"; + @SerializedName(SERIALIZED_NAME_VIDEO_COUNT) + private Integer videoCount; + + public ListTagsResponseData value(String value) { + this.value = value; + return this; + } + + /** + * Returns the value of a video tag used in your project. + * + * @return value + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Returns the value of a video tag used in your project.") + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public ListTagsResponseData videoCount(Integer videoCount) { + this.videoCount = videoCount; + return this; + } + + /** + * Returns the number of times a video tag is used. + * + * @return videoCount + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Returns the number of times a video tag is used.") + + public Integer getVideoCount() { + return videoCount; + } + + public void setVideoCount(Integer videoCount) { + this.videoCount = videoCount; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListTagsResponseData listTagsResponseData = (ListTagsResponseData) o; + return Objects.equals(this.value, listTagsResponseData.value) + && Objects.equals(this.videoCount, listTagsResponseData.videoCount); + } + + @Override + public int hashCode() { + return Objects.hash(value, videoCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListTagsResponseData {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" videoCount: ").append(toIndentedString(videoCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/src/test/java/video/api/client/api/clients/TagsApiTest.java b/src/test/java/video/api/client/api/clients/TagsApiTest.java new file mode 100644 index 0000000..4f53307 --- /dev/null +++ b/src/test/java/video/api/client/api/clients/TagsApiTest.java @@ -0,0 +1,10 @@ +package video.api.client.api.clients; + +import org.junit.jupiter.api.DisplayName; + +/** + * API tests for TagsApi + */ +@DisplayName("TagsApi") +public class TagsApiTest extends AbstractApiTest { +} diff --git a/src/test/resources/payloads/tags/list/responses/200.json b/src/test/resources/payloads/tags/list/responses/200.json new file mode 100644 index 0000000..fd895e6 --- /dev/null +++ b/src/test/resources/payloads/tags/list/responses/200.json @@ -0,0 +1,26 @@ +{ + "data" : [ { + "value" : "maths", + "videoCount" : "33" + }, { + "value" : "tutorials", + "videoCount" : "10" + } ], + "pagination" : { + "currentPage" : 1, + "pageSize" : 25, + "pagesTotal" : 1, + "itemsTotal" : 2, + "currentPageItems" : 2, + "links" : [ { + "rel" : "self", + "uri" : "https://ws.api.video/watermarks?currentPage=1" + }, { + "rel" : "first", + "uri" : "https://ws.api.video/watermarks?currentPage=1" + }, { + "rel" : "last", + "uri" : "https://ws.api.video/watermarks?currentPage=1" + } ] + } +} \ No newline at end of file diff --git a/src/test/resources/payloads/tags/list/responses/429.json b/src/test/resources/payloads/tags/list/responses/429.json new file mode 100644 index 0000000..d312e2b --- /dev/null +++ b/src/test/resources/payloads/tags/list/responses/429.json @@ -0,0 +1,5 @@ +{ + "type" : "https://docs.api.video/reference/too-many-requests", + "title" : "Too many requests.", + "status" : 429 +} \ No newline at end of file