From 0700baa9419eb4ab6ee6b47ebaa0bb0e221eb960 Mon Sep 17 00:00:00 2001 From: olivierapivideo Date: Wed, 2 Oct 2024 12:58:04 +0000 Subject: [PATCH] Add video tags endpoint --- CHANGELOG.md | 3 + README.md | 27 +- api/openapi.yaml | 438 ++++++++++++++- build.gradle | 2 +- docs/ListTagsResponse.md | 18 + docs/ListTagsResponseData.md | 18 + docs/TagsApi.md | 92 ++++ docs/Webhook.md | 9 +- 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 | 510 ++++++++++++++++++ .../client/api/models/ListTagsResponse.java | 133 +++++ .../api/models/ListTagsResponseData.java | 121 +++++ .../video/api/client/api/models/Webhook.java | 49 +- .../api/client/api/clients/TagsApiTest.java | 49 ++ .../payloads/tags/list/responses/200.json | 26 + .../payloads/tags/list/responses/429.json | 5 + .../payloads/webhooks/list/responses/200.json | 10 +- 19 files changed, 1495 insertions(+), 30 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..755e8a4 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -981,6 +981,164 @@ 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: /tags?currentPage=1&pageSize=25 + - rel: first + uri: /tags?currentPage=1&pageSize=25 + - rel: last + uri: /tags?currentPage=1&pageSize=25 + 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-group-parameters: true + x-client-paginated: true + x-accepts: application/json /videos/{videoId}/source: post: description: Ingest a video from a source or file. @@ -13519,17 +13677,19 @@ paths: events: - video.encoding.quality.completed url: http://clientnotificationserver.com/notif?myquery=query + signatureSecret: sig_sec_Abcd12348RLP7VPLi7nYVh - webhookId: webhook_XXXXXXXXXYYYYYY createdAt: 2021-01-12T12:12:12+00:00 events: - video.encoding.quality.completed url: http://clientnotificationserver.com/notif?myquery=query2 + signatureSecret: sig_sec_Abcd12358RLP7VPLi7nYVy pagination: currentPage: 1 pageSize: 25 pagesTotal: 1 - itemsTotal: 11 - currentPageItems: 11 + itemsTotal: 2 + currentPageItems: 2 links: - rel: self uri: https://ws.api.video/webhooks?currentPage=1 @@ -14839,6 +14999,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 @@ -15287,26 +15482,33 @@ components: webhookId: webhook_XXXXXXXXXXXXXXX events: '["video.encoding.quality.completed"]' url: http://clientnotificationserver.com/notif?myquery=query + signatureSecret: signatureSecret properties: webhookId: - description: Unique identifier of the webhook + description: A unique identifier of the webhook you subscribed to. example: webhook_XXXXXXXXXXXXXXX type: string createdAt: - description: When an webhook was created, presented in ATOM UTC format. + description: The time and date when you created this webhook subscription, + in ATOM UTC format. example: 2019-06-24T11:45:01Z format: date-time type: string events: - description: A list of events that will trigger the webhook. + description: A list of events that you subscribed to. When these events + occur, the API triggers a webhook call to the URL you provided. example: '["video.encoding.quality.completed"]' items: type: string type: array url: - description: URL of the webhook + description: The URL where the API sends the webhook. example: http://clientnotificationserver.com/notif?myquery=query type: string + signatureSecret: + description: A secret key for the webhook you subscribed to. You can use + it to verify the origin of the webhook call that you receive. + type: string title: Webhook type: object video-status: @@ -16442,10 +16644,12 @@ components: webhookId: webhook_XXXXXXXXXXXXXXX events: '["video.encoding.quality.completed"]' url: http://clientnotificationserver.com/notif?myquery=query + signatureSecret: signatureSecret - createdAt: 2019-06-24T11:45:01Z webhookId: webhook_XXXXXXXXXXXXXXX events: '["video.encoding.quality.completed"]' url: http://clientnotificationserver.com/notif?myquery=query + signatureSecret: signatureSecret properties: data: items: @@ -16977,6 +17181,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 @@ -17174,4 +17390,214 @@ x-doctave: - node - php - python +x-webhooks: + live-stream.broadcast.started: + post: + tags: + - Webhooks + summary: Live stream started + description: This webhook triggers when a live stream broadcast is started. + operationId: POST-webhooks + parameters: + - in: header + name: X-Api-Video-WebhookID + schema: + type: string + description: The unique ID of your webhook. + required: true + - in: header + name: X-Api-Video-Signature + schema: + type: string + description: The webhook's body encrypted using the webhook's signature secret, + in HMAC SHA256. Use this hash to verify that api.video is the origin of + this webhook notification. + required: true + requestBody: + content: + application/json: + schema: + type: object + properties: + type: + type: string + description: The name of the webhook event that occured. + example: live-stream.broadcast.started + emittedAt: + description: Returns the date-time when the webhook event occurred. + type: string + format: date-time + example: 2024-08-151T10:18:47+00:00 + liveStreamId: + description: The ID of the live stream that started broadcasting. + type: string + example: li400mYKSgQ6xs7taUeSaEap + responses: + "202": + summary: Accepted + description: Your webhook server may return this response to api.video to + signal that the webhook is accepted. + live-stream.broadcast.ended: + post: + tags: + - Webhooks + summary: Live stream ended + description: This webhook triggers when a live stream broadcast is ended. + operationId: POST-webhooks + parameters: + - in: header + name: X-Api-Video-WebhookID + schema: + type: string + description: The unique ID of your webhook. + required: true + - in: header + name: X-Api-Video-Signature + schema: + type: string + description: The webhook's body encrypted using the webhook's signature secret, + in HMAC SHA256. Use this hash to verify that api.video is the origin of + this webhook notification. + required: true + requestBody: + content: + application/json: + schema: + type: object + properties: + type: + type: string + description: The name of the webhook event that occured. + example: live-stream.broadcast.ended + emittedAt: + description: Returns the date-time when the webhook event occurred. + type: string + format: date-time + example: 2024-08-151T10:18:47+00:00 + liveStreamId: + description: The ID of the live stream that ended broadcasting. + type: string + example: li400mYKSgQ6xs7taUeSaEap + responses: + "202": + summary: Accepted + description: Your webhook server may return this response to api.video to + signal that the webhook is accepted. + video.source.recorded: + post: + tags: + - Webhooks + summary: Video source recorded + description: This webhook triggers when a live stream broadcast is completed + and the recording of the stream is ready for transcoding. This means that + the video is in queue for transcoding. + operationId: POST-webhooks + parameters: + - in: header + name: X-Api-Video-WebhookID + schema: + type: string + description: The unique ID of your webhook. + required: true + - in: header + name: X-Api-Video-Signature + schema: + type: string + description: The webhook's body encrypted using the webhook's signature secret, + in HMAC SHA256. Use this hash to verify that api.video is the origin of + this webhook notification. + required: true + requestBody: + content: + application/json: + schema: + type: object + properties: + type: + type: string + description: The name of the webhook event that occured. + example: video.source.recorded + emittedAt: + description: Returns the date-time when the webhook event occurred. + type: string + format: date-time + example: 2024-08-151T10:18:47+00:00 + liveStreamId: + description: The ID of the live stream that ended broadcasting. + type: string + example: li400mYKSgQ6xs7taUeSaEap + videoId: + description: The video ID of the live stream recording. + type: string + example: vi4blUQJFrYWbaG44NChkH11 + responses: + "202": + summary: Accepted + description: Your webhook server may return this response to api.video to + signal that the webhook is accepted. + video.encoding.quality.completed: + post: + tags: + - Webhooks + summary: Video encoding completed + description: This webhook triggers when a new video is uploaded into your account, + and all HLS and mp4 quality versions are encoded. + operationId: POST-webhooks + parameters: + - in: header + name: X-Api-Video-WebhookID + schema: + type: string + description: The unique ID of your webhook. + required: true + - in: header + name: X-Api-Video-Signature + schema: + type: string + description: The webhook's body encrypted using the webhook's signature secret, + in HMAC SHA256. Use this hash to verify that api.video is the origin of + this webhook notification. + required: true + requestBody: + content: + application/json: + schema: + type: object + properties: + type: + type: string + description: The name of the webhook event that occured. + example: video.encoding.quality.completed + emittedAt: + description: Returns the date-time when the webhook event occurred. + type: string + format: date-time + example: 2024-08-151T10:18:47+00:00 + videoId: + description: The ID of the video where a certain quality version's + encoding is finished. + type: string + example: vi4blUQJFrYWbaG44NChkH11 + encoding: + description: The type of encoding that is finished. + type: string + enum: + - hls + - mp4 + example: hls + quality: + description: The quality version of encoding that is finished. + type: string + enum: + - 240p + - 360p + - 480p + - 720p + - 1080p + example: 1080p + responses: + "202": + summary: Accepted + description: Your webhook server may return this response to api.video to + signal that the webhook is accepted. 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..1d1fe24 --- /dev/null +++ b/docs/TagsApi.md @@ -0,0 +1,92 @@ +# 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(value).sortBy(sortBy).sortOrder(sortOrder).currentPage(currentPage).pageSize(pageSize).execute() +> okhttp3.Call executeAsync(callback) +> ApiResponse executeWithHttpInfo() + +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 { + Page result = apiInstance.list() + .value(value) + .sortBy(sortBy) + .sortOrder(sortOrder) + .currentPage(currentPage) + .pageSize(pageSize) + .execute(); + 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 + +[**Page**](pagination.md)<[**ListTagsResponseData**](ListTagsResponseData.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/docs/Webhook.md b/docs/Webhook.md index 197ba21..1aa8297 100644 --- a/docs/Webhook.md +++ b/docs/Webhook.md @@ -6,10 +6,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**webhookId** | **String** | Unique identifier of the webhook | [optional] -**createdAt** | **OffsetDateTime** | When an webhook was created, presented in ATOM UTC format. | [optional] -**events** | **List<String>** | A list of events that will trigger the webhook. | [optional] -**url** | **String** | URL of the webhook | [optional] +**webhookId** | **String** | A unique identifier of the webhook you subscribed to. | [optional] +**createdAt** | **OffsetDateTime** | The time and date when you created this webhook subscription, in ATOM UTC format. | [optional] +**events** | **List<String>** | A list of events that you subscribed to. When these events occur, the API triggers a webhook call to the URL you provided. | [optional] +**url** | **String** | The URL where the API sends the webhook. | [optional] +**signatureSecret** | **String** | A secret key for the webhook you subscribed to. You can use it to verify the origin of the webhook call that you receive. | [optional] ## Implemented Interfaces 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..429ea90 --- /dev/null +++ b/src/main/java/video/api/client/api/clients/TagsApi.java @@ -0,0 +1,510 @@ +/* + * 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; + } + + 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; + } + + private 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); + } + + private 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; + } + + public class APIlistRequest { + private String value; + private String sortBy; + private String sortOrder; + private Integer currentPage; + private Integer pageSize; + + private APIlistRequest() { + } + + /** + * Set value + * + * @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) + * + * @return APIlistRequest + */ + public APIlistRequest value(String value) { + this.value = value; + return this; + } + + /** + * Set sortBy + * + * @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) + * + * @return APIlistRequest + */ + public APIlistRequest sortBy(String sortBy) { + this.sortBy = sortBy; + return this; + } + + /** + * Set sortOrder + * + * @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) + * + * @return APIlistRequest + */ + public APIlistRequest sortOrder(String sortOrder) { + this.sortOrder = sortOrder; + return this; + } + + /** + * Set currentPage + * + * @param currentPage + * Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1) + * + * @return APIlistRequest + */ + public APIlistRequest currentPage(Integer currentPage) { + this.currentPage = currentPage; + return this; + } + + /** + * Set pageSize + * + * @param pageSize + * Results per page. Allowed values 1-100, default is 25. (optional, default to 25) + * + * @return APIlistRequest + */ + public APIlistRequest pageSize(Integer pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Build call for list + * + * @param _callback + * ApiCallback API callback + * + * @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.
+ *
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return listCall(value, sortBy, sortOrder, currentPage, pageSize, _callback); + } + + /** + * Execute list request + * + * @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 Page execute() throws ApiException { + ApiResponse localVarResp = listWithHttpInfo(value, sortBy, sortOrder, currentPage, + pageSize); + return new Page<>(localVarResp.getData().getData(), localVarResp.getData().getPagination(), () -> { + try { + return copy().currentPage((currentPage == null ? 1 : currentPage) + 1).execute(); + } catch (ApiException e) { + throw new RuntimeException(e); + } + }); // + } + + private APIlistRequest copy() { + APIlistRequest copy = new APIlistRequest(); + copy.value(value); + copy.sortBy(sortBy); + copy.sortOrder(sortOrder); + copy.currentPage(currentPage); + copy.pageSize(pageSize); + return copy; + } + + /** + * Execute list request with HTTP info returned + * + * @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 executeWithHttpInfo() throws ApiException { + return listWithHttpInfo(value, sortBy, sortOrder, currentPage, pageSize); + } + + /** + * Execute list request (asynchronously) + * + * @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 executeAsync(final ApiCallback> _callback) throws ApiException { + ApiCallback apiCallback = new ApiCallback() { + + @Override + public void onFailure(ApiException e, int statusCode, Map> responseHeaders) { + _callback.onFailure(e, statusCode, responseHeaders); + } + + @Override + public void onSuccess(ListTagsResponse result, int statusCode, + Map> responseHeaders) { + _callback.onSuccess(new Page<>(result.getData(), result.getPagination(), () -> { + try { + return copy().currentPage((currentPage == null ? 1 : currentPage) + 1).execute(); + } catch (ApiException e) { + throw new RuntimeException(e); + } + }), statusCode, responseHeaders); + } + + @Override + public void onUploadProgress(long bytesWritten, long contentLength, boolean done) { + _callback.onUploadProgress(bytesWritten, contentLength, done); + } + + @Override + public void onDownloadProgress(long bytesRead, long contentLength, boolean done) { + _callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + return listAsync(value, sortBy, sortOrder, currentPage, pageSize, apiCallback); + } + } + + /** + * 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. + * + * @return APIlistRequest + * + * @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 APIlistRequest list() { + return new APIlistRequest(); + } +} 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/main/java/video/api/client/api/models/Webhook.java b/src/main/java/video/api/client/api/models/Webhook.java index b16edd6..cbdfee7 100644 --- a/src/main/java/video/api/client/api/models/Webhook.java +++ b/src/main/java/video/api/client/api/models/Webhook.java @@ -49,18 +49,22 @@ public class Webhook implements Serializable, DeepObject { @SerializedName(SERIALIZED_NAME_URL) private String url; + public static final String SERIALIZED_NAME_SIGNATURE_SECRET = "signatureSecret"; + @SerializedName(SERIALIZED_NAME_SIGNATURE_SECRET) + private String signatureSecret; + public Webhook webhookId(String webhookId) { this.webhookId = webhookId; return this; } /** - * Unique identifier of the webhook + * A unique identifier of the webhook you subscribed to. * * @return webhookId **/ @javax.annotation.Nullable - @ApiModelProperty(example = "webhook_XXXXXXXXXXXXXXX", value = "Unique identifier of the webhook") + @ApiModelProperty(example = "webhook_XXXXXXXXXXXXXXX", value = "A unique identifier of the webhook you subscribed to.") public String getWebhookId() { return webhookId; @@ -76,12 +80,12 @@ public Webhook createdAt(OffsetDateTime createdAt) { } /** - * When an webhook was created, presented in ATOM UTC format. + * The time and date when you created this webhook subscription, in ATOM UTC format. * * @return createdAt **/ @javax.annotation.Nullable - @ApiModelProperty(example = "2019-06-24T11:45:01Z", value = "When an webhook was created, presented in ATOM UTC format.") + @ApiModelProperty(example = "2019-06-24T11:45:01Z", value = "The time and date when you created this webhook subscription, in ATOM UTC format.") public OffsetDateTime getCreatedAt() { return createdAt; @@ -105,12 +109,13 @@ public Webhook addEventsItem(String eventsItem) { } /** - * A list of events that will trigger the webhook. + * A list of events that you subscribed to. When these events occur, the API triggers a webhook call to the URL you + * provided. * * @return events **/ @javax.annotation.Nullable - @ApiModelProperty(example = "[\"video.encoding.quality.completed\"]", value = "A list of events that will trigger the webhook.") + @ApiModelProperty(example = "[\"video.encoding.quality.completed\"]", value = "A list of events that you subscribed to. When these events occur, the API triggers a webhook call to the URL you provided.") public List getEvents() { return events; @@ -126,12 +131,12 @@ public Webhook url(String url) { } /** - * URL of the webhook + * The URL where the API sends the webhook. * * @return url **/ @javax.annotation.Nullable - @ApiModelProperty(example = "http://clientnotificationserver.com/notif?myquery=query", value = "URL of the webhook") + @ApiModelProperty(example = "http://clientnotificationserver.com/notif?myquery=query", value = "The URL where the API sends the webhook.") public String getUrl() { return url; @@ -141,6 +146,28 @@ public void setUrl(String url) { this.url = url; } + public Webhook signatureSecret(String signatureSecret) { + this.signatureSecret = signatureSecret; + return this; + } + + /** + * A secret key for the webhook you subscribed to. You can use it to verify the origin of the webhook call that you + * receive. + * + * @return signatureSecret + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A secret key for the webhook you subscribed to. You can use it to verify the origin of the webhook call that you receive.") + + public String getSignatureSecret() { + return signatureSecret; + } + + public void setSignatureSecret(String signatureSecret) { + this.signatureSecret = signatureSecret; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -151,12 +178,13 @@ public boolean equals(Object o) { } Webhook webhook = (Webhook) o; return Objects.equals(this.webhookId, webhook.webhookId) && Objects.equals(this.createdAt, webhook.createdAt) - && Objects.equals(this.events, webhook.events) && Objects.equals(this.url, webhook.url); + && Objects.equals(this.events, webhook.events) && Objects.equals(this.url, webhook.url) + && Objects.equals(this.signatureSecret, webhook.signatureSecret); } @Override public int hashCode() { - return Objects.hash(webhookId, createdAt, events, url); + return Objects.hash(webhookId, createdAt, events, url, signatureSecret); } @Override @@ -167,6 +195,7 @@ public String toString() { sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); sb.append(" events: ").append(toIndentedString(events)).append("\n"); sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" signatureSecret: ").append(toIndentedString(signatureSecret)).append("\n"); sb.append("}"); return sb.toString(); } 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..835a2d0 --- /dev/null +++ b/src/test/java/video/api/client/api/clients/TagsApiTest.java @@ -0,0 +1,49 @@ +package video.api.client.api.clients; + +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import video.api.client.api.ApiException; +import video.api.client.api.models.ListTagsResponseData; +import video.api.client.api.models.Page; +import video.api.client.api.models.PaginationLink; + +import java.net.URI; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * API tests for TagsApi + */ +@DisplayName("TagsApi") +public class TagsApiTest extends AbstractApiTest { + private final TagsApi api = apiClientMock.tags(); + + @Nested + @DisplayName("list") + class listTags { + private static final String PAYLOADS_PATH = "/payloads/tags/list/"; + + @Test + @DisplayName("200 response") + public void responseWithStatus200Test() throws ApiException { + answerOnAnyRequest(200, readResourceFile(PAYLOADS_PATH + "responses/200.json")); + + Page res = api.list().execute(); + + assertThat(res.getCurrentPage()).isEqualTo(1); + assertThat(res.getPageSize()).isEqualTo(25); + assertThat(res.getPagesTotal()).isEqualTo(1); + assertThat(res.getCurrentPageItems()).isEqualTo(2); + assertThat(res.getLinks()).containsExactlyInAnyOrder( + new PaginationLink().rel("self").uri(URI.create("/tags?currentPage=1&pageSize=25")), + new PaginationLink().rel("first").uri(URI.create("/tags?currentPage=1&pageSize=25")), + new PaginationLink().rel("last").uri(URI.create("/tags?currentPage=1&pageSize=25"))); + + assertThat(res.getItems()).containsExactlyInAnyOrder( + new ListTagsResponseData().value("maths").videoCount(33), + new ListTagsResponseData().value("tutorials").videoCount(10)); + } + } + +} 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..3501e31 --- /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" : "/tags?currentPage=1&pageSize=25" + }, { + "rel" : "first", + "uri" : "/tags?currentPage=1&pageSize=25" + }, { + "rel" : "last", + "uri" : "/tags?currentPage=1&pageSize=25" + } ] + } +} \ 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 diff --git a/src/test/resources/payloads/webhooks/list/responses/200.json b/src/test/resources/payloads/webhooks/list/responses/200.json index c9490be..8c781b8 100644 --- a/src/test/resources/payloads/webhooks/list/responses/200.json +++ b/src/test/resources/payloads/webhooks/list/responses/200.json @@ -3,19 +3,21 @@ "webhookId" : "webhook_XXXXXXXXXXXXXXX", "createdAt" : "2021-01-08T14:12:18+00:00", "events" : [ "video.encoding.quality.completed" ], - "url" : "http://clientnotificationserver.com/notif?myquery=query" + "url" : "http://clientnotificationserver.com/notif?myquery=query", + "signatureSecret" : "sig_sec_Abcd12348RLP7VPLi7nYVh" }, { "webhookId" : "webhook_XXXXXXXXXYYYYYY", "createdAt" : "2021-01-12T12:12:12+00:00", "events" : [ "video.encoding.quality.completed" ], - "url" : "http://clientnotificationserver.com/notif?myquery=query2" + "url" : "http://clientnotificationserver.com/notif?myquery=query2", + "signatureSecret" : "sig_sec_Abcd12358RLP7VPLi7nYVy" } ], "pagination" : { "currentPage" : 1, "pageSize" : 25, "pagesTotal" : 1, - "itemsTotal" : 11, - "currentPageItems" : 11, + "itemsTotal" : 2, + "currentPageItems" : 2, "links" : [ { "rel" : "self", "uri" : "https://ws.api.video/webhooks?currentPage=1"