Skip to content

Commit

Permalink
Add video tags endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
olivierapivideo authored Oct 2, 2024
1 parent 5e74aa0 commit 6200083
Show file tree
Hide file tree
Showing 16 changed files with 338 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog
All changes to this project will be documented in this file.

## [2.6.3] - 2024-09-30
- Add /tags API endpoint

## [2.6.2] - 2024-09-16
- Add discarded video endpoints

Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- [ChaptersApi](#chaptersapi)
- [LiveStreamsApi](#livestreamsapi)
- [PlayerThemesApi](#playerthemesapi)
- [TagsApi](#tagsapi)
- [UploadTokensApi](#uploadtokensapi)
- [VideosApi](#videosapi)
- [WatermarksApi](#watermarksapi)
Expand Down Expand Up @@ -161,6 +162,13 @@ Method | Description | HTTP request
[**deleteLogo()**](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/api/PlayerThemesApi.md#deleteLogo) | Delete logo | **DELETE** `/players/{playerId}/logo`


#### TagsApi

Method | Description | HTTP request
------------- | ------------- | -------------
[**list()**](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/api/TagsApi.md#list) | List all video tags | **GET** `/tags`


#### UploadTokensApi

Method | Description | HTTP request
Expand Down Expand Up @@ -239,6 +247,8 @@ Method | Description | HTTP request
- [FilterBy1](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/model/FilterBy1.md)
- [FilterBy2](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/model/FilterBy2.md)
- [Link](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/model/Link.md)
- [ListTagsResponse](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/model/ListTagsResponse.md)
- [ListTagsResponseData](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/model/ListTagsResponseData.md)
- [LiveStream](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/model/LiveStream.md)
- [LiveStreamAssets](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/model/LiveStreamAssets.md)
- [LiveStreamCreationPayload](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/model/LiveStreamCreationPayload.md)
Expand Down
35 changes: 35 additions & 0 deletions docs/api/TagsApi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# TagsApi

All URIs are relative to *https://ws.api.video*

| Method | Description | HTTP request |
| ------------- | ------------- | ------------- |
| [**list()**](TagsApi.md#list) | List all video tags | **GET** /tags |


<a name="list"></a>
## **`list()` - 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.

### Parameters

| Name | Type | Required | Description |
| ------------- | ------------- | ------------- | ------------- |
| **value** | **string**| no| Use this parameter to search for specific video tags. The API filters results even on partial values, and ignores accents, uppercase, and lowercase. |
| **sortBy** | **&#39;value&#39; \| &#39;videoCount&#39;**| no| Use this parameter to choose which field the API will use to sort the response data. The default is &#x60;value&#x60;. These are the available fields to sort by: - &#x60;value&#x60;: Sorts the results based on tag values in alphabetic order. - &#x60;videoCount&#x60;: Sorts the results based on the number of times a video tag is used. |
| **sortOrder** | **&#39;asc&#39; \| &#39;desc&#39;**| no| Use this parameter to sort results. &#x60;asc&#x60; is ascending and sorts from A to Z. &#x60;desc&#x60; is descending and sorts from Z to A. |
| **currentPage** | **number**| no| Choose the number of search results to return per page. Minimum value: 1 |
| **pageSize** | **number**| no| Results per page. Allowed values 1-100, default is 25. |


### Return type

Promise<[**ListTagsResponse**](../model/ListTagsResponse.md)>.




---

12 changes: 12 additions & 0 deletions docs/model/ListTagsResponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

# ListTagsResponse

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**data** | [**Array&lt;ListTagsResponseData&gt;**](ListTagsResponseData.md) | | [optional]
**pagination** | [**Pagination**](Pagination.md) | | [optional]



12 changes: 12 additions & 0 deletions docs/model/ListTagsResponseData.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

# ListTagsResponseData

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | **string** | Returns the value of a video tag used in your project. | [optional]
**videoCount** | **number** | Returns the number of times a video tag is used. | [optional]



2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@api.video/nodejs-client",
"version": "2.6.2",
"version": "2.6.3",
"description": "api.video nodejs API client",
"keywords": [
"api.video",
Expand Down
2 changes: 1 addition & 1 deletion src/HttpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default class HttpClient {
this.chunkSize = params.chunkSize;
this.headers = new AxiosHeaders({
Accept: 'application/json, */*;q=0.8',
'AV-Origin-Client': 'nodejs:2.6.2',
'AV-Origin-Client': 'nodejs:2.6.3',
Authorization: this.apiKey ? `Basic ${encode(`${this.apiKey}:`)}` : '',
...(params.applicationName && params.applicationVersion
? {
Expand Down
4 changes: 4 additions & 0 deletions src/ObjectSerializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ import FilterBy from './model/FilterBy';
import FilterBy1 from './model/FilterBy1';
import FilterBy2 from './model/FilterBy2';
import Link from './model/Link';
import ListTagsResponse from './model/ListTagsResponse';
import ListTagsResponseData from './model/ListTagsResponseData';
import LiveStream from './model/LiveStream';
import LiveStreamAssets from './model/LiveStreamAssets';
import LiveStreamCreationPayload from './model/LiveStreamCreationPayload';
Expand Down Expand Up @@ -152,6 +154,8 @@ const typeMap: { [index: string]: any } = {
FilterBy1: FilterBy1,
FilterBy2: FilterBy2,
Link: Link,
ListTagsResponse: ListTagsResponse,
ListTagsResponseData: ListTagsResponseData,
LiveStream: LiveStream,
LiveStreamAssets: LiveStreamAssets,
LiveStreamCreationPayload: LiveStreamCreationPayload,
Expand Down
127 changes: 127 additions & 0 deletions src/api/TagsApi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
/**
* @api.video/nodejs-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
*
*
* NOTE: This class is auto generated.
* Do not edit the class manually.
*/

import { URLSearchParams } from 'url';
import ObjectSerializer from '../ObjectSerializer';
import HttpClient, { QueryOptions, ApiResponseHeaders } from '../HttpClient';
import ListTagsResponse from '../model/ListTagsResponse';

/**
* no description
*/
export default class TagsApi {
private httpClient: HttpClient;

constructor(httpClient: HttpClient) {
this.httpClient = httpClient;
}

/**
* 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.
* List all video tags
* @param {Object} searchParams
* @param { string } searchParams.value Use this parameter to search for specific video tags. The API filters results even on partial values, and ignores accents, uppercase, and lowercase.
* @param { &#39;value&#39; | &#39;videoCount&#39; } searchParams.sortBy Use this parameter to choose which field the API will use to sort the response data. The default is &#x60;value&#x60;. These are the available fields to sort by: - &#x60;value&#x60;: Sorts the results based on tag values in alphabetic order. - &#x60;videoCount&#x60;: Sorts the results based on the number of times a video tag is used.
* @param { &#39;asc&#39; | &#39;desc&#39; } searchParams.sortOrder Use this parameter to sort results. &#x60;asc&#x60; is ascending and sorts from A to Z. &#x60;desc&#x60; is descending and sorts from Z to A.
* @param { number } searchParams.currentPage Choose the number of search results to return per page. Minimum value: 1
* @param { number } searchParams.pageSize Results per page. Allowed values 1-100, default is 25.
*/
public async list(args: {
value?: string;
sortBy?: 'value' | 'videoCount';
sortOrder?: 'asc' | 'desc';
currentPage?: number;
pageSize?: number;
}): Promise<ListTagsResponse> {
return this.listWithResponseHeaders(args).then((res) => res.body);
}

/**
* 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.
* List all video tags
* @param {Object} searchParams
* @param { string } searchParams.value Use this parameter to search for specific video tags. The API filters results even on partial values, and ignores accents, uppercase, and lowercase.
* @param { &#39;value&#39; | &#39;videoCount&#39; } searchParams.sortBy Use this parameter to choose which field the API will use to sort the response data. The default is &#x60;value&#x60;. These are the available fields to sort by: - &#x60;value&#x60;: Sorts the results based on tag values in alphabetic order. - &#x60;videoCount&#x60;: Sorts the results based on the number of times a video tag is used.
* @param { &#39;asc&#39; | &#39;desc&#39; } searchParams.sortOrder Use this parameter to sort results. &#x60;asc&#x60; is ascending and sorts from A to Z. &#x60;desc&#x60; is descending and sorts from Z to A.
* @param { number } searchParams.currentPage Choose the number of search results to return per page. Minimum value: 1
* @param { number } searchParams.pageSize Results per page. Allowed values 1-100, default is 25.
*/
public async listWithResponseHeaders({
value,
sortBy,
sortOrder,
currentPage,
pageSize,
}: {
value?: string;
sortBy?: 'value' | 'videoCount';
sortOrder?: 'asc' | 'desc';
currentPage?: number;
pageSize?: number;
}): Promise<{ headers: ApiResponseHeaders; body: ListTagsResponse }> {
const queryParams: QueryOptions = {};
queryParams.headers = {};
// Path Params
const localVarPath = '/tags'.substring(1);

// Query Params
const urlSearchParams = new URLSearchParams();

if (value !== undefined) {
urlSearchParams.append(
'value',
ObjectSerializer.serialize(value, 'string', '')
);
}
if (sortBy !== undefined) {
urlSearchParams.append(
'sortBy',
ObjectSerializer.serialize(sortBy, "'value' | 'videoCount'", '')
);
}
if (sortOrder !== undefined) {
urlSearchParams.append(
'sortOrder',
ObjectSerializer.serialize(sortOrder, "'asc' | 'desc'", '')
);
}
if (currentPage !== undefined) {
urlSearchParams.append(
'currentPage',
ObjectSerializer.serialize(currentPage, 'number', '')
);
}
if (pageSize !== undefined) {
urlSearchParams.append(
'pageSize',
ObjectSerializer.serialize(pageSize, 'number', '')
);
}

queryParams.searchParams = urlSearchParams;

queryParams.method = 'GET';

return this.httpClient.call(localVarPath, queryParams).then((response) => {
return {
headers: response.headers,
body: ObjectSerializer.deserialize(
ObjectSerializer.parse(
response.body,
response.headers['content-type']
),
'ListTagsResponse',
''
) as ListTagsResponse,
};
});
}
}
11 changes: 11 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import CaptionsApi from './api/CaptionsApi';
import ChaptersApi from './api/ChaptersApi';
import LiveStreamsApi from './api/LiveStreamsApi';
import PlayerThemesApi from './api/PlayerThemesApi';
import TagsApi from './api/TagsApi';
import UploadTokensApi from './api/UploadTokensApi';
import VideosApi from './api/VideosApi';
import WatermarksApi from './api/WatermarksApi';
Expand All @@ -35,6 +36,7 @@ class ApiVideoClient {
private _chapters: ChaptersApi;
private _liveStreams: LiveStreamsApi;
private _playerThemes: PlayerThemesApi;
private _tags: TagsApi;
private _uploadTokens: UploadTokensApi;
private _videos: VideosApi;
private _watermarks: WatermarksApi;
Expand Down Expand Up @@ -81,6 +83,7 @@ class ApiVideoClient {
this._chapters = new ChaptersApi(this.httpClient);
this._liveStreams = new LiveStreamsApi(this.httpClient);
this._playerThemes = new PlayerThemesApi(this.httpClient);
this._tags = new TagsApi(this.httpClient);
this._uploadTokens = new UploadTokensApi(this.httpClient);
this._videos = new VideosApi(this.httpClient);
this._watermarks = new WatermarksApi(this.httpClient);
Expand Down Expand Up @@ -131,6 +134,14 @@ class ApiVideoClient {
return this._playerThemes;
}

/**
* Get an TagsApi instance
* @return TagsApi
*/
public get tags(): TagsApi {
return this._tags;
}

/**
* Get an UploadTokensApi instance
* @return UploadTokensApi
Expand Down
40 changes: 40 additions & 0 deletions src/model/ListTagsResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* @api.video/nodejs-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
*
*
* NOTE: This class is auto generated.
* Do not edit the class manually.
*/

import AttributeType from './AttributeType.js';
import ListTagsResponseData from './ListTagsResponseData.js';
import Pagination from './Pagination.js';

export default class ListTagsResponse {
'data'?: Array<ListTagsResponseData>;
'pagination'?: Pagination;

static readonly discriminator?: string = undefined;

static readonly attributeTypeMap: Array<AttributeType> = [
{
name: 'data',
baseName: 'data',
type: 'Array<ListTagsResponseData>',
format: '',
},
{
name: 'pagination',
baseName: 'pagination',
type: 'Pagination',
format: '',
},
];

static getAttributeTypeMap(): Array<AttributeType> {
return ListTagsResponse.attributeTypeMap;
}
}
44 changes: 44 additions & 0 deletions src/model/ListTagsResponseData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* @api.video/nodejs-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
*
*
* NOTE: This class is auto generated.
* Do not edit the class manually.
*/

import AttributeType from './AttributeType.js';

export default class ListTagsResponseData {
/**
* Returns the value of a video tag used in your project.
*/
'value'?: string;
/**
* Returns the number of times a video tag is used.
*/
'videoCount'?: number;

static readonly discriminator?: string = undefined;

static readonly attributeTypeMap: Array<AttributeType> = [
{
name: 'value',
baseName: 'value',
type: 'string',
format: '',
},
{
name: 'videoCount',
baseName: 'videoCount',
type: 'number',
format: '',
},
];

static getAttributeTypeMap(): Array<AttributeType> {
return ListTagsResponseData.attributeTypeMap;
}
}
Loading

0 comments on commit 6200083

Please sign in to comment.