|
| 1 | +/** |
| 2 | + * @api.video/nodejs-client |
| 3 | + * 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. |
| 4 | + * |
| 5 | + * The version of the OpenAPI document: 1 |
| 6 | + * |
| 7 | + * |
| 8 | + * NOTE: This class is auto generated. |
| 9 | + * Do not edit the class manually. |
| 10 | + */ |
| 11 | + |
| 12 | +import { URLSearchParams } from 'url'; |
| 13 | +import ObjectSerializer from '../ObjectSerializer'; |
| 14 | +import HttpClient, { QueryOptions, ApiResponseHeaders } from '../HttpClient'; |
| 15 | +import ListTagsResponse from '../model/ListTagsResponse'; |
| 16 | + |
| 17 | +/** |
| 18 | + * no description |
| 19 | + */ |
| 20 | +export default class TagsApi { |
| 21 | + private httpClient: HttpClient; |
| 22 | + |
| 23 | + constructor(httpClient: HttpClient) { |
| 24 | + this.httpClient = httpClient; |
| 25 | + } |
| 26 | + |
| 27 | + /** |
| 28 | + * 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. |
| 29 | + * List all video tags |
| 30 | + * @param {Object} searchParams |
| 31 | + * @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. |
| 32 | + * @param { 'value' | 'videoCount' } searchParams.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. |
| 33 | + * @param { 'asc' | 'desc' } searchParams.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. |
| 34 | + * @param { number } searchParams.currentPage Choose the number of search results to return per page. Minimum value: 1 |
| 35 | + * @param { number } searchParams.pageSize Results per page. Allowed values 1-100, default is 25. |
| 36 | + */ |
| 37 | + public async list(args: { |
| 38 | + value?: string; |
| 39 | + sortBy?: 'value' | 'videoCount'; |
| 40 | + sortOrder?: 'asc' | 'desc'; |
| 41 | + currentPage?: number; |
| 42 | + pageSize?: number; |
| 43 | + }): Promise<ListTagsResponse> { |
| 44 | + return this.listWithResponseHeaders(args).then((res) => res.body); |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * 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. |
| 49 | + * List all video tags |
| 50 | + * @param {Object} searchParams |
| 51 | + * @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. |
| 52 | + * @param { 'value' | 'videoCount' } searchParams.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. |
| 53 | + * @param { 'asc' | 'desc' } searchParams.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. |
| 54 | + * @param { number } searchParams.currentPage Choose the number of search results to return per page. Minimum value: 1 |
| 55 | + * @param { number } searchParams.pageSize Results per page. Allowed values 1-100, default is 25. |
| 56 | + */ |
| 57 | + public async listWithResponseHeaders({ |
| 58 | + value, |
| 59 | + sortBy, |
| 60 | + sortOrder, |
| 61 | + currentPage, |
| 62 | + pageSize, |
| 63 | + }: { |
| 64 | + value?: string; |
| 65 | + sortBy?: 'value' | 'videoCount'; |
| 66 | + sortOrder?: 'asc' | 'desc'; |
| 67 | + currentPage?: number; |
| 68 | + pageSize?: number; |
| 69 | + }): Promise<{ headers: ApiResponseHeaders; body: ListTagsResponse }> { |
| 70 | + const queryParams: QueryOptions = {}; |
| 71 | + queryParams.headers = {}; |
| 72 | + // Path Params |
| 73 | + const localVarPath = '/tags'.substring(1); |
| 74 | + |
| 75 | + // Query Params |
| 76 | + const urlSearchParams = new URLSearchParams(); |
| 77 | + |
| 78 | + if (value !== undefined) { |
| 79 | + urlSearchParams.append( |
| 80 | + 'value', |
| 81 | + ObjectSerializer.serialize(value, 'string', '') |
| 82 | + ); |
| 83 | + } |
| 84 | + if (sortBy !== undefined) { |
| 85 | + urlSearchParams.append( |
| 86 | + 'sortBy', |
| 87 | + ObjectSerializer.serialize(sortBy, "'value' | 'videoCount'", '') |
| 88 | + ); |
| 89 | + } |
| 90 | + if (sortOrder !== undefined) { |
| 91 | + urlSearchParams.append( |
| 92 | + 'sortOrder', |
| 93 | + ObjectSerializer.serialize(sortOrder, "'asc' | 'desc'", '') |
| 94 | + ); |
| 95 | + } |
| 96 | + if (currentPage !== undefined) { |
| 97 | + urlSearchParams.append( |
| 98 | + 'currentPage', |
| 99 | + ObjectSerializer.serialize(currentPage, 'number', '') |
| 100 | + ); |
| 101 | + } |
| 102 | + if (pageSize !== undefined) { |
| 103 | + urlSearchParams.append( |
| 104 | + 'pageSize', |
| 105 | + ObjectSerializer.serialize(pageSize, 'number', '') |
| 106 | + ); |
| 107 | + } |
| 108 | + |
| 109 | + queryParams.searchParams = urlSearchParams; |
| 110 | + |
| 111 | + queryParams.method = 'GET'; |
| 112 | + |
| 113 | + return this.httpClient.call(localVarPath, queryParams).then((response) => { |
| 114 | + return { |
| 115 | + headers: response.headers, |
| 116 | + body: ObjectSerializer.deserialize( |
| 117 | + ObjectSerializer.parse( |
| 118 | + response.body, |
| 119 | + response.headers['content-type'] |
| 120 | + ), |
| 121 | + 'ListTagsResponse', |
| 122 | + '' |
| 123 | + ) as ListTagsResponse, |
| 124 | + }; |
| 125 | + }); |
| 126 | + } |
| 127 | +} |
0 commit comments