From 86dcd1ff719d2c6028d0d740d22a4bd791b01aa9 Mon Sep 17 00:00:00 2001 From: olivierapivideo Date: Mon, 21 Oct 2024 13:19:40 +0000 Subject: [PATCH] Add summary feature --- CHANGELOG.md | 3 + README.md | 18 + docs/api/SummariesApi.md | 130 ++++++ docs/model/ConflictError.md | 15 + docs/model/NotFound.md | 8 +- docs/model/SummariesListResponse.md | 12 + docs/model/Summary.md | 37 ++ docs/model/SummaryCreationPayload.md | 20 + docs/model/SummarySource.md | 13 + docs/model/SummaryUpdatePayload.md | 13 + docs/model/VideoCreationPayload.md | 1 + docs/model/VideoUpdatePayload.md | 1 + package.json | 2 +- src/HttpClient.ts | 2 +- src/ObjectSerializer.ts | 15 + src/api/SummariesApi.ts | 405 ++++++++++++++++++ src/index.ts | 11 + src/model/ConflictError.ts | 74 ++++ src/model/NotFound.ts | 12 + src/model/SummariesListResponse.ts | 43 ++ src/model/Summary.ts | 92 ++++ src/model/SummaryCreationPayload.ts | 46 ++ src/model/SummarySource.ts | 54 +++ src/model/SummaryUpdatePayload.ts | 54 +++ src/model/VideoCreationPayload.ts | 10 + src/model/VideoUpdatePayload.ts | 10 + test/client.spec.ts | 5 + .../summaries/create/responses201.json | 8 + .../summaries/create/responses409.json | 7 + .../getSummarySource/responses404.json | 6 + .../payloads/summaries/list/responses200.json | 34 ++ .../summaries/update/responses409.json | 6 + test/payloads/videos/update/responses409.json | 7 + 33 files changed, 1168 insertions(+), 6 deletions(-) create mode 100644 docs/api/SummariesApi.md create mode 100644 docs/model/ConflictError.md create mode 100644 docs/model/SummariesListResponse.md create mode 100644 docs/model/Summary.md create mode 100644 docs/model/SummaryCreationPayload.md create mode 100644 docs/model/SummarySource.md create mode 100644 docs/model/SummaryUpdatePayload.md create mode 100644 src/api/SummariesApi.ts create mode 100644 src/model/ConflictError.ts create mode 100644 src/model/SummariesListResponse.ts create mode 100644 src/model/Summary.ts create mode 100644 src/model/SummaryCreationPayload.ts create mode 100644 src/model/SummarySource.ts create mode 100644 src/model/SummaryUpdatePayload.ts create mode 100644 test/payloads/summaries/create/responses201.json create mode 100644 test/payloads/summaries/create/responses409.json create mode 100644 test/payloads/summaries/getSummarySource/responses404.json create mode 100644 test/payloads/summaries/list/responses200.json create mode 100644 test/payloads/summaries/update/responses409.json create mode 100644 test/payloads/videos/update/responses409.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c29c74..ff81482 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog All changes to this project will be documented in this file. +## [2.6.6] - 2024-10-21 +- Add summary feature + ## [2.6.5] - 2024-10-17 - Fix postinstall script diff --git a/README.md b/README.md index 02f47af..cc76483 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ - [ChaptersApi](#chaptersapi) - [LiveStreamsApi](#livestreamsapi) - [PlayerThemesApi](#playerthemesapi) + - [SummariesApi](#summariesapi) - [TagsApi](#tagsapi) - [UploadTokensApi](#uploadtokensapi) - [VideosApi](#videosapi) @@ -162,6 +163,17 @@ 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` +#### SummariesApi + +Method | Description | HTTP request +------------- | ------------- | ------------- +[**create()**](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/api/SummariesApi.md#create) | Generate video summary | **POST** `/summaries` +[**update()**](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/api/SummariesApi.md#update) | Update summary details | **PATCH** `/summaries/{summaryId}/source` +[**delete()**](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/api/SummariesApi.md#delete) | Delete video summary | **DELETE** `/summaries/{summaryId}` +[**list()**](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/api/SummariesApi.md#list) | List summaries | **GET** `/summaries` +[**getSummarySource()**](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/api/SummariesApi.md#getSummarySource) | Get summary details | **GET** `/summaries/{summaryId}/source` + + #### TagsApi Method | Description | HTTP request @@ -242,6 +254,7 @@ Method | Description | HTTP request - [CaptionsUpdatePayload](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/model/CaptionsUpdatePayload.md) - [Chapter](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/model/Chapter.md) - [ChaptersListResponse](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/model/ChaptersListResponse.md) + - [ConflictError](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/model/ConflictError.md) - [DiscardedVideoUpdatePayload](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/model/DiscardedVideoUpdatePayload.md) - [FilterBy](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/model/FilterBy.md) - [FilterBy1](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/model/FilterBy1.md) @@ -269,6 +282,11 @@ Method | Description | HTTP request - [RefreshTokenPayload](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/model/RefreshTokenPayload.md) - [RestreamsRequestObject](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/model/RestreamsRequestObject.md) - [RestreamsResponseObject](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/model/RestreamsResponseObject.md) + - [SummariesListResponse](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/model/SummariesListResponse.md) + - [Summary](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/model/Summary.md) + - [SummaryCreationPayload](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/model/SummaryCreationPayload.md) + - [SummarySource](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/model/SummarySource.md) + - [SummaryUpdatePayload](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/model/SummaryUpdatePayload.md) - [TokenCreationPayload](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/model/TokenCreationPayload.md) - [TokenListResponse](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/model/TokenListResponse.md) - [TooManyRequests](https://github.com/apivideo/api.video-nodejs-client/blob/main/docs/model/TooManyRequests.md) diff --git a/docs/api/SummariesApi.md b/docs/api/SummariesApi.md new file mode 100644 index 0000000..c37e0f4 --- /dev/null +++ b/docs/api/SummariesApi.md @@ -0,0 +1,130 @@ +# SummariesApi + +All URIs are relative to *https://ws.api.video* + +| Method | Description | HTTP request | +| ------------- | ------------- | ------------- | +| [**create()**](SummariesApi.md#create) | Generate video summary | **POST** /summaries | +| [**update()**](SummariesApi.md#update) | Update summary details | **PATCH** /summaries/{summaryId}/source | +| [**delete()**](SummariesApi.md#delete) | Delete video summary | **DELETE** /summaries/{summaryId} | +| [**list()**](SummariesApi.md#list) | List summaries | **GET** /summaries | +| [**getSummarySource()**](SummariesApi.md#getSummarySource) | Get summary details | **GET** /summaries/{summaryId}/source | + + + +## **`create()` - Generate video summary** + + +Generate a title, abstract, and key takeaways for a video. + +### Parameters + +| Name | Type | Required | Description | +| ------------- | ------------- | ------------- | ------------- | + | **summaryCreationPayload** | [**SummaryCreationPayload**](../model/SummaryCreationPayload.md)| **yes**| | + + +### Return type + +Promise<[**Summary**](../model/Summary.md)>. + + + + +--- + + +## **`update()` - Update summary details** + + +Update details for a summary. Note that this operation is only allowed for summary objects where `sourceStatus` is `missing`. + +### Parameters + +| Name | Type | Required | Description | +| ------------- | ------------- | ------------- | ------------- | + | **summaryId** | **string**| **yes**| The unique identifier of the summary source you want to update. | + | **summaryUpdatePayload** | [**SummaryUpdatePayload**](../model/SummaryUpdatePayload.md)| **yes**| | + + +### Return type + +Promise<[**SummarySource**](../model/SummarySource.md)>. + + + + +--- + + +## **`delete()` - Delete video summary** + + +Delete a summary tied to a video. + +### Parameters + +| Name | Type | Required | Description | +| ------------- | ------------- | ------------- | ------------- | + | **summaryId** | **string**| **yes**| The unique identifier of the summary you want to delete. | + + +### Return type + +Promise<[**void**](../model/.md)>. + + + + +--- + + +## **`list()` - List summaries** + + +List all summarries for your videos in a project. + +### Parameters + +| Name | Type | Required | Description | +| ------------- | ------------- | ------------- | ------------- | + | **videoId** | **string**| no| Use this parameter to filter for a summary that belongs to a specific video. | + | **origin** | **'auto' \| 'api'**| no| Use this parameter to filter for summaries based on the way they were created: automatically or manually via the API. | + | **sourceStatus** | **'missing' \| 'waiting' \| 'failed' \| 'completed' \| 'unprocessable'**| no| Use this parameter to filter for summaries based on the current status of the summary source. These are the available statuses: `missing`: the input for a summary is not present. `waiting` : the input video is being processed and a summary will be generated. `failed`: a technical issue prevented summary generation. `completed`: the summary is generated. `unprocessable`: the API rules the source video to be unsuitable for summary generation. An example for this is an input video that has no audio. | + | **sortBy** | **'createdAt' \| 'updatedAt' \| 'videoId'**| no| 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: - `createdAt`: Sorts the results based on date and timestamps when summaries were created. - `updatedAt`: Sorts the results based on date and timestamps when summaries were last updated. - `videoId`: Sorts the results based on video IDs. | + | **sortOrder** | **'asc' \| 'desc'**| no| Use this parameter to sort results. `asc` is ascending and sorts from A to Z. `desc` 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<[**SummariesListResponse**](../model/SummariesListResponse.md)>. + + + + +--- + + +## **`getSummarySource()` - Get summary details** + + +Get all details for a summary. + +### Parameters + +| Name | Type | Required | Description | +| ------------- | ------------- | ------------- | ------------- | + | **summaryId** | **string**| **yes**| The unique identifier of the summary source you want to retrieve. | + + +### Return type + +Promise<[**SummarySource**](../model/SummarySource.md)>. + + + + +--- + diff --git a/docs/model/ConflictError.md b/docs/model/ConflictError.md new file mode 100644 index 0000000..b29da91 --- /dev/null +++ b/docs/model/ConflictError.md @@ -0,0 +1,15 @@ + +# ConflictError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | A link to the error documentation. | [optional] +**title** | **string** | A description of the error that occurred. | [optional] +**name** | **string** | The name of the parameter that caused the error. | [optional] +**status** | **number** | The HTTP status code. | [optional] +**detail** | **string** | A solution for the error. | [optional] + + + diff --git a/docs/model/NotFound.md b/docs/model/NotFound.md index 7b8862c..83818c1 100644 --- a/docs/model/NotFound.md +++ b/docs/model/NotFound.md @@ -5,10 +5,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**type** | **string** | | [optional] -**title** | **string** | | [optional] -**name** | **string** | | [optional] -**status** | **number** | | [optional] +**type** | **string** | A link to the error documentation. | [optional] +**title** | **string** | A description of the error that occurred. | [optional] +**name** | **string** | The name of the parameter that caused the error. | [optional] +**status** | **number** | The HTTP status code. | [optional] diff --git a/docs/model/SummariesListResponse.md b/docs/model/SummariesListResponse.md new file mode 100644 index 0000000..7d012db --- /dev/null +++ b/docs/model/SummariesListResponse.md @@ -0,0 +1,12 @@ + +# SummariesListResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**Array<Summary>**](Summary.md) | An array of summary objects. | +**pagination** | [**Pagination**](Pagination.md) | | + + + diff --git a/docs/model/Summary.md b/docs/model/Summary.md new file mode 100644 index 0000000..cec233d --- /dev/null +++ b/docs/model/Summary.md @@ -0,0 +1,37 @@ + +# Summary + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**summaryId** | **string** | The unique identifier of the summary object. | [optional] +**createdAt** | **Date** | Returns the date and time when the summary was created in ATOM date-time format. | [optional] +**updatedAt** | **Date** | Returns the date and time when the summary was last updated in ATOM date-time format. | [optional] +**videoId** | **string** | The unique identifier of the video object. | [optional] +**origin** | [**SummaryOriginEnum**](#SummaryOriginEnum) | Returns the origin of how the summary was created. - `api` means that no summary was generated automatically. You can add summary manually using the `PATCH /summaries/{summaryId}/source` endpoint operation. Until this happens, `sourceStatus` returns `missing`. - `auto` means that the API generated the summary automatically. | [optional] +**sourceStatus** | [**SummarySourceStatusEnum**](#SummarySourceStatusEnum) | Returns the current status of summary generation. `missing`: the input for a summary is not present. `waiting` : the input video is being processed and a summary will be generated. `failed`: a technical issue prevented summary generation. `completed`: the summary is generated. `unprocessable`: the API rules the source video to be unsuitable for summary generation. An example for this is an input video that has no audio. | [optional] + + + +## Enum: SummaryOriginEnum + +Name | Value +---- | ----- +Api | 'api' +Auto | 'auto' + + + +## Enum: SummarySourceStatusEnum + +Name | Value +---- | ----- +Missing | 'missing' +Waiting | 'waiting' +Failed | 'failed' +Completed | 'completed' +Unprocessable | 'unprocessable' + + + diff --git a/docs/model/SummaryCreationPayload.md b/docs/model/SummaryCreationPayload.md new file mode 100644 index 0000000..852d30b --- /dev/null +++ b/docs/model/SummaryCreationPayload.md @@ -0,0 +1,20 @@ + +# SummaryCreationPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**videoId** | **string** | Create a summary of a video using the video ID. | +**origin** | [**SummaryCreationPayloadOriginEnum**](#SummaryCreationPayloadOriginEnum) | Use this parameter to define how the API generates the summary. The only allowed value is `auto`, which means that the API generates a summary automatically. If you do not set this parameter, **the API will not generate a summary automatically**. In this case, `sourceStatus` will return `missing`, and you have to manually add a summary using the `PATCH /summaries/{summaryId}/source` endpoint operation. | [optional] + + + +## Enum: SummaryCreationPayloadOriginEnum + +Name | Value +---- | ----- +Auto | 'auto' + + + diff --git a/docs/model/SummarySource.md b/docs/model/SummarySource.md new file mode 100644 index 0000000..c242ddd --- /dev/null +++ b/docs/model/SummarySource.md @@ -0,0 +1,13 @@ + +# SummarySource + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | A video title, based on the contents of the video. | [optional] +**_abstract** | **string** | A short outline of the contents of the video. The length of an `abstract` depends on the amount of content in a video that can be transcribed. The API condenses the contents into minimum 20, maximum 300 words. | [optional] +**takeaways** | **Array<string>** | A list of 3 key points from the video, in chronological order. | [optional] + + + diff --git a/docs/model/SummaryUpdatePayload.md b/docs/model/SummaryUpdatePayload.md new file mode 100644 index 0000000..ca2ff80 --- /dev/null +++ b/docs/model/SummaryUpdatePayload.md @@ -0,0 +1,13 @@ + +# SummaryUpdatePayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | A video title, based on the contents of the video. | [optional] +**_abstract** | **string** | A short outline of the contents of the video. | [optional] +**takeaways** | **Array<string>** | A list of 3 key points from the video, in chronological order. | [optional] + + + diff --git a/docs/model/VideoCreationPayload.md b/docs/model/VideoCreationPayload.md index 9c6fc5b..5659914 100644 --- a/docs/model/VideoCreationPayload.md +++ b/docs/model/VideoCreationPayload.md @@ -18,6 +18,7 @@ Name | Type | Description | Notes **watermark** | [**VideoWatermark**](VideoWatermark.md) | | [optional] **language** | [**VideoCreationPayloadLanguageEnum**](#VideoCreationPayloadLanguageEnum) | Use this parameter to set the language of the video. When this parameter is set, the API creates a transcript of the video using the language you specify. You must use the [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. `language` is a permanent attribute of the video. You can update it to another language using the [`PATCH /videos/{videoId}`](https://docs.api.video/reference/api/Videos#update-a-video-object) operation. This triggers the API to generate a new transcript using a different language. | [optional] **transcript** | **boolean** | Use this parameter to enable transcription. - When `true`, the API generates a transcript for the video. - The default value is `false`. - If you define a video language using the `language` parameter, the API uses that language to transcribe the video. If you do not define a language, the API detects it based on the video. - When the API generates a transcript, it will be available as a caption for the video. | [optional] +**transcriptSummary** | **boolean** | Use this parameter to enable summarization. We recommend using this parameter together with `transcript: true`. - When `true`, the API generates a summary for the video, based on the transcription. - The default value is `false`. - If you define a video language using the `language` parameter, the API uses that language to summarize the video. If you do not define a language, the API detects it based on the video. | [optional] diff --git a/docs/model/VideoUpdatePayload.md b/docs/model/VideoUpdatePayload.md index 4178d35..ea75053 100644 --- a/docs/model/VideoUpdatePayload.md +++ b/docs/model/VideoUpdatePayload.md @@ -15,6 +15,7 @@ Name | Type | Description | Notes **metadata** | [**Array<Metadata>**](Metadata.md) | A list (array) of dictionaries where each dictionary contains a key value pair that describes the video. As with tags, you must send the complete list of metadata you want as whatever you send here will overwrite the existing metadata for the video. | [optional] **language** | [**VideoUpdatePayloadLanguageEnum**](#VideoUpdatePayloadLanguageEnum) | Use this parameter to set the language of the video. When this parameter is set, the API creates a transcript of the video using the language you specify. You must use the [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. `language` is a permanent attribute of the video. You can update it to another language using the [`PATCH /videos/{videoId}`](https://docs.api.video/reference/api/Videos#update-a-video-object) operation. This triggers the API to generate a new transcript using a different language. | [optional] **transcript** | **boolean** | Use this parameter to enable transcription. - When `true`, the API generates a transcript for the video. - The default value is `false`. - If you define a video language using the `language` parameter, the API uses that language to transcribe the video. If you do not define a language, the API detects it based on the video. - When the API generates a transcript, it will be available as a caption for the video. | [optional] +**transcriptSummary** | **boolean** | Use this parameter to enable summarization. - When `true`, the API generates a summary for the video, based on the transcription. - The default value is `false`. - If you define a video language using the `language` parameter, the API uses that language to summarize the video. If you do not define a language, the API detects it based on the video. | [optional] diff --git a/package.json b/package.json index b3ff0e4..d7c87a3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@api.video/nodejs-client", - "version": "2.6.5", + "version": "2.6.6", "description": "api.video nodejs API client", "keywords": [ "api.video", diff --git a/src/HttpClient.ts b/src/HttpClient.ts index 0fba0fa..d6ef8bc 100644 --- a/src/HttpClient.ts +++ b/src/HttpClient.ts @@ -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.5', + 'AV-Origin-Client': 'nodejs:2.6.6', Authorization: this.apiKey ? `Basic ${encode(`${this.apiKey}:`)}` : '', ...(params.applicationName && params.applicationVersion ? { diff --git a/src/ObjectSerializer.ts b/src/ObjectSerializer.ts index 037fd7a..55b0313 100644 --- a/src/ObjectSerializer.ts +++ b/src/ObjectSerializer.ts @@ -32,6 +32,7 @@ import CaptionsListResponse from './model/CaptionsListResponse'; import CaptionsUpdatePayload from './model/CaptionsUpdatePayload'; import Chapter from './model/Chapter'; import ChaptersListResponse from './model/ChaptersListResponse'; +import ConflictError from './model/ConflictError'; import DiscardedVideoUpdatePayload from './model/DiscardedVideoUpdatePayload'; import FilterBy from './model/FilterBy'; import FilterBy1 from './model/FilterBy1'; @@ -59,6 +60,11 @@ import Quality from './model/Quality'; import RefreshTokenPayload from './model/RefreshTokenPayload'; import RestreamsRequestObject from './model/RestreamsRequestObject'; import RestreamsResponseObject from './model/RestreamsResponseObject'; +import SummariesListResponse from './model/SummariesListResponse'; +import Summary from './model/Summary'; +import SummaryCreationPayload from './model/SummaryCreationPayload'; +import SummarySource from './model/SummarySource'; +import SummaryUpdatePayload from './model/SummaryUpdatePayload'; import TokenCreationPayload from './model/TokenCreationPayload'; import TokenListResponse from './model/TokenListResponse'; import TooManyRequests from './model/TooManyRequests'; @@ -119,6 +125,9 @@ const enumsMap: Set = new Set([ 'QualityTypeEnum', 'QualityQualityEnum', 'QualityStatusEnum', + 'SummaryOriginEnum', + 'SummarySourceStatusEnum', + 'SummaryCreationPayloadOriginEnum', 'VideoLanguageOriginEnum', 'VideoCreationPayloadLanguageEnum', 'VideoStatusIngestStatusEnum', @@ -152,6 +161,7 @@ const typeMap: { [index: string]: any } = { CaptionsUpdatePayload: CaptionsUpdatePayload, Chapter: Chapter, ChaptersListResponse: ChaptersListResponse, + ConflictError: ConflictError, DiscardedVideoUpdatePayload: DiscardedVideoUpdatePayload, FilterBy: FilterBy, FilterBy1: FilterBy1, @@ -179,6 +189,11 @@ const typeMap: { [index: string]: any } = { RefreshTokenPayload: RefreshTokenPayload, RestreamsRequestObject: RestreamsRequestObject, RestreamsResponseObject: RestreamsResponseObject, + SummariesListResponse: SummariesListResponse, + Summary: Summary, + SummaryCreationPayload: SummaryCreationPayload, + SummarySource: SummarySource, + SummaryUpdatePayload: SummaryUpdatePayload, TokenCreationPayload: TokenCreationPayload, TokenListResponse: TokenListResponse, TooManyRequests: TooManyRequests, diff --git a/src/api/SummariesApi.ts b/src/api/SummariesApi.ts new file mode 100644 index 0000000..fa7a42c --- /dev/null +++ b/src/api/SummariesApi.ts @@ -0,0 +1,405 @@ +/** + * @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 SummariesListResponse from '../model/SummariesListResponse'; +import Summary from '../model/Summary'; +import SummaryCreationPayload from '../model/SummaryCreationPayload'; +import SummarySource from '../model/SummarySource'; +import SummaryUpdatePayload from '../model/SummaryUpdatePayload'; + +/** + * no description + */ +export default class SummariesApi { + private httpClient: HttpClient; + + constructor(httpClient: HttpClient) { + this.httpClient = httpClient; + } + + /** + * Generate a title, abstract, and key takeaways for a video. + * Generate video summary + * @param summaryCreationPayload + */ + public async create( + summaryCreationPayload: SummaryCreationPayload + ): Promise { + return this.createWithResponseHeaders(summaryCreationPayload).then( + (res) => res.body + ); + } + + /** + * Generate a title, abstract, and key takeaways for a video. + * Generate video summary + * @param summaryCreationPayload + */ + public async createWithResponseHeaders( + summaryCreationPayload: SummaryCreationPayload + ): Promise<{ headers: ApiResponseHeaders; body: Summary }> { + const queryParams: QueryOptions = {}; + queryParams.headers = {}; + if ( + summaryCreationPayload === null || + summaryCreationPayload === undefined + ) { + throw new Error( + 'Required parameter summaryCreationPayload was null or undefined when calling create.' + ); + } + // Path Params + const localVarPath = '/summaries'.substring(1); + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + 'application/json', + ]); + queryParams.headers['Content-Type'] = contentType; + + queryParams.body = ObjectSerializer.stringify( + ObjectSerializer.serialize( + summaryCreationPayload, + 'SummaryCreationPayload', + '' + ), + contentType + ); + + queryParams.method = 'POST'; + + return this.httpClient.call(localVarPath, queryParams).then((response) => { + return { + headers: response.headers, + body: ObjectSerializer.deserialize( + ObjectSerializer.parse( + response.body, + response.headers['content-type'] + ), + 'Summary', + '' + ) as Summary, + }; + }); + } + + /** + * Update details for a summary. Note that this operation is only allowed for summary objects where `sourceStatus` is `missing`. + * Update summary details + * @param summaryId The unique identifier of the summary source you want to update. + * @param summaryUpdatePayload + */ + public async update( + summaryId: string, + summaryUpdatePayload: SummaryUpdatePayload = {} + ): Promise { + return this.updateWithResponseHeaders(summaryId, summaryUpdatePayload).then( + (res) => res.body + ); + } + + /** + * Update details for a summary. Note that this operation is only allowed for summary objects where `sourceStatus` is `missing`. + * Update summary details + * @param summaryId The unique identifier of the summary source you want to update. + * @param summaryUpdatePayload + */ + public async updateWithResponseHeaders( + summaryId: string, + summaryUpdatePayload: SummaryUpdatePayload = {} + ): Promise<{ headers: ApiResponseHeaders; body: SummarySource }> { + const queryParams: QueryOptions = {}; + queryParams.headers = {}; + if (summaryId === null || summaryId === undefined) { + throw new Error( + 'Required parameter summaryId was null or undefined when calling update.' + ); + } + if (summaryUpdatePayload === null || summaryUpdatePayload === undefined) { + throw new Error( + 'Required parameter summaryUpdatePayload was null or undefined when calling update.' + ); + } + // Path Params + const localVarPath = '/summaries/{summaryId}/source' + .substring(1) + .replace('{' + 'summaryId' + '}', encodeURIComponent(String(summaryId))); + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + 'application/json', + ]); + queryParams.headers['Content-Type'] = contentType; + + queryParams.body = ObjectSerializer.stringify( + ObjectSerializer.serialize( + summaryUpdatePayload, + 'SummaryUpdatePayload', + '' + ), + contentType + ); + + queryParams.method = 'PATCH'; + + return this.httpClient.call(localVarPath, queryParams).then((response) => { + return { + headers: response.headers, + body: ObjectSerializer.deserialize( + ObjectSerializer.parse( + response.body, + response.headers['content-type'] + ), + 'SummarySource', + '' + ) as SummarySource, + }; + }); + } + + /** + * Delete a summary tied to a video. + * Delete video summary + * @param summaryId The unique identifier of the summary you want to delete. + */ + public async delete(summaryId: string): Promise { + return this.deleteWithResponseHeaders(summaryId).then((res) => res.body); + } + + /** + * Delete a summary tied to a video. + * Delete video summary + * @param summaryId The unique identifier of the summary you want to delete. + */ + public async deleteWithResponseHeaders( + summaryId: string + ): Promise<{ headers: ApiResponseHeaders; body: void }> { + const queryParams: QueryOptions = {}; + queryParams.headers = {}; + if (summaryId === null || summaryId === undefined) { + throw new Error( + 'Required parameter summaryId was null or undefined when calling delete.' + ); + } + // Path Params + const localVarPath = '/summaries/{summaryId}' + .substring(1) + .replace('{' + 'summaryId' + '}', encodeURIComponent(String(summaryId))); + + queryParams.method = 'DELETE'; + + return this.httpClient.call(localVarPath, queryParams).then((response) => { + return { + headers: response.headers, + body: ObjectSerializer.deserialize( + ObjectSerializer.parse( + response.body, + response.headers['content-type'] + ), + 'void', + '' + ) as void, + }; + }); + } + + /** + * List all summarries for your videos in a project. + * List summaries + * @param {Object} searchParams + * @param { string } searchParams.videoId Use this parameter to filter for a summary that belongs to a specific video. + * @param { 'auto' | 'api' } searchParams.origin Use this parameter to filter for summaries based on the way they were created: automatically or manually via the API. + * @param { 'missing' | 'waiting' | 'failed' | 'completed' | 'unprocessable' } searchParams.sourceStatus Use this parameter to filter for summaries based on the current status of the summary source. These are the available statuses: `missing`: the input for a summary is not present. `waiting` : the input video is being processed and a summary will be generated. `failed`: a technical issue prevented summary generation. `completed`: the summary is generated. `unprocessable`: the API rules the source video to be unsuitable for summary generation. An example for this is an input video that has no audio. + * @param { 'createdAt' | 'updatedAt' | 'videoId' } 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: - `createdAt`: Sorts the results based on date and timestamps when summaries were created. - `updatedAt`: Sorts the results based on date and timestamps when summaries were last updated. - `videoId`: Sorts the results based on video IDs. + * @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. + * @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: { + videoId?: string; + origin?: 'auto' | 'api'; + sourceStatus?: + | 'missing' + | 'waiting' + | 'failed' + | 'completed' + | 'unprocessable'; + sortBy?: 'createdAt' | 'updatedAt' | 'videoId'; + sortOrder?: 'asc' | 'desc'; + currentPage?: number; + pageSize?: number; + }): Promise { + return this.listWithResponseHeaders(args).then((res) => res.body); + } + + /** + * List all summarries for your videos in a project. + * List summaries + * @param {Object} searchParams + * @param { string } searchParams.videoId Use this parameter to filter for a summary that belongs to a specific video. + * @param { 'auto' | 'api' } searchParams.origin Use this parameter to filter for summaries based on the way they were created: automatically or manually via the API. + * @param { 'missing' | 'waiting' | 'failed' | 'completed' | 'unprocessable' } searchParams.sourceStatus Use this parameter to filter for summaries based on the current status of the summary source. These are the available statuses: `missing`: the input for a summary is not present. `waiting` : the input video is being processed and a summary will be generated. `failed`: a technical issue prevented summary generation. `completed`: the summary is generated. `unprocessable`: the API rules the source video to be unsuitable for summary generation. An example for this is an input video that has no audio. + * @param { 'createdAt' | 'updatedAt' | 'videoId' } 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: - `createdAt`: Sorts the results based on date and timestamps when summaries were created. - `updatedAt`: Sorts the results based on date and timestamps when summaries were last updated. - `videoId`: Sorts the results based on video IDs. + * @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. + * @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({ + videoId, + origin, + sourceStatus, + sortBy, + sortOrder, + currentPage, + pageSize, + }: { + videoId?: string; + origin?: 'auto' | 'api'; + sourceStatus?: + | 'missing' + | 'waiting' + | 'failed' + | 'completed' + | 'unprocessable'; + sortBy?: 'createdAt' | 'updatedAt' | 'videoId'; + sortOrder?: 'asc' | 'desc'; + currentPage?: number; + pageSize?: number; + }): Promise<{ headers: ApiResponseHeaders; body: SummariesListResponse }> { + const queryParams: QueryOptions = {}; + queryParams.headers = {}; + // Path Params + const localVarPath = '/summaries'.substring(1); + + // Query Params + const urlSearchParams = new URLSearchParams(); + + if (videoId !== undefined) { + urlSearchParams.append( + 'videoId', + ObjectSerializer.serialize(videoId, 'string', '') + ); + } + if (origin !== undefined) { + urlSearchParams.append( + 'origin', + ObjectSerializer.serialize(origin, "'auto' | 'api'", '') + ); + } + if (sourceStatus !== undefined) { + urlSearchParams.append( + 'sourceStatus', + ObjectSerializer.serialize( + sourceStatus, + "'missing' | 'waiting' | 'failed' | 'completed' | 'unprocessable'", + '' + ) + ); + } + if (sortBy !== undefined) { + urlSearchParams.append( + 'sortBy', + ObjectSerializer.serialize( + sortBy, + "'createdAt' | 'updatedAt' | 'videoId'", + '' + ) + ); + } + 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'] + ), + 'SummariesListResponse', + '' + ) as SummariesListResponse, + }; + }); + } + + /** + * Get all details for a summary. + * Get summary details + * @param summaryId The unique identifier of the summary source you want to retrieve. + */ + public async getSummarySource(summaryId: string): Promise { + return this.getSummarySourceWithResponseHeaders(summaryId).then( + (res) => res.body + ); + } + + /** + * Get all details for a summary. + * Get summary details + * @param summaryId The unique identifier of the summary source you want to retrieve. + */ + public async getSummarySourceWithResponseHeaders( + summaryId: string + ): Promise<{ headers: ApiResponseHeaders; body: SummarySource }> { + const queryParams: QueryOptions = {}; + queryParams.headers = {}; + if (summaryId === null || summaryId === undefined) { + throw new Error( + 'Required parameter summaryId was null or undefined when calling getSummarySource.' + ); + } + // Path Params + const localVarPath = '/summaries/{summaryId}/source' + .substring(1) + .replace('{' + 'summaryId' + '}', encodeURIComponent(String(summaryId))); + + 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'] + ), + 'SummarySource', + '' + ) as SummarySource, + }; + }); + } +} diff --git a/src/index.ts b/src/index.ts index 88a45a1..7df5f78 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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 SummariesApi from './api/SummariesApi'; import TagsApi from './api/TagsApi'; import UploadTokensApi from './api/UploadTokensApi'; import VideosApi from './api/VideosApi'; @@ -36,6 +37,7 @@ class ApiVideoClient { private _chapters: ChaptersApi; private _liveStreams: LiveStreamsApi; private _playerThemes: PlayerThemesApi; + private _summaries: SummariesApi; private _tags: TagsApi; private _uploadTokens: UploadTokensApi; private _videos: VideosApi; @@ -83,6 +85,7 @@ class ApiVideoClient { this._chapters = new ChaptersApi(this.httpClient); this._liveStreams = new LiveStreamsApi(this.httpClient); this._playerThemes = new PlayerThemesApi(this.httpClient); + this._summaries = new SummariesApi(this.httpClient); this._tags = new TagsApi(this.httpClient); this._uploadTokens = new UploadTokensApi(this.httpClient); this._videos = new VideosApi(this.httpClient); @@ -134,6 +137,14 @@ class ApiVideoClient { return this._playerThemes; } + /** + * Get an SummariesApi instance + * @return SummariesApi + */ + public get summaries(): SummariesApi { + return this._summaries; + } + /** * Get an TagsApi instance * @return TagsApi diff --git a/src/model/ConflictError.ts b/src/model/ConflictError.ts new file mode 100644 index 0000000..8e82d91 --- /dev/null +++ b/src/model/ConflictError.ts @@ -0,0 +1,74 @@ +/** + * @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 ConflictError { + /** + * A link to the error documentation. + */ + 'type'?: string; + /** + * A description of the error that occurred. + */ + 'title'?: string; + /** + * The name of the parameter that caused the error. + */ + 'name'?: string; + /** + * The HTTP status code. + */ + 'status'?: number; + /** + * A solution for the error. + */ + 'detail'?: string; + + static readonly discriminator?: string = undefined; + + static readonly attributeTypeMap: Array = [ + { + name: 'type', + baseName: 'type', + type: 'string', + format: '', + }, + { + name: 'title', + baseName: 'title', + type: 'string', + format: '', + }, + { + name: 'name', + baseName: 'name', + type: 'string', + format: '', + }, + { + name: 'status', + baseName: 'status', + type: 'number', + format: '', + }, + { + name: 'detail', + baseName: 'detail', + type: 'string', + format: '', + }, + ]; + + static getAttributeTypeMap(): Array { + return ConflictError.attributeTypeMap; + } +} diff --git a/src/model/NotFound.ts b/src/model/NotFound.ts index 265348e..838c0b2 100644 --- a/src/model/NotFound.ts +++ b/src/model/NotFound.ts @@ -12,9 +12,21 @@ import AttributeType from './AttributeType.js'; export default class NotFound { + /** + * A link to the error documentation. + */ 'type'?: string; + /** + * A description of the error that occurred. + */ 'title'?: string; + /** + * The name of the parameter that caused the error. + */ 'name'?: string; + /** + * The HTTP status code. + */ 'status'?: number; static readonly discriminator?: string = undefined; diff --git a/src/model/SummariesListResponse.ts b/src/model/SummariesListResponse.ts new file mode 100644 index 0000000..429b0e7 --- /dev/null +++ b/src/model/SummariesListResponse.ts @@ -0,0 +1,43 @@ +/** + * @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 Pagination from './Pagination.js'; +import Summary from './Summary.js'; + +export default class SummariesListResponse { + /** + * An array of summary objects. + */ + 'data': Array; + 'pagination': Pagination; + + static readonly discriminator?: string = undefined; + + static readonly attributeTypeMap: Array = [ + { + name: 'data', + baseName: 'data', + type: 'Array', + format: '', + }, + { + name: 'pagination', + baseName: 'pagination', + type: 'Pagination', + format: '', + }, + ]; + + static getAttributeTypeMap(): Array { + return SummariesListResponse.attributeTypeMap; + } +} diff --git a/src/model/Summary.ts b/src/model/Summary.ts new file mode 100644 index 0000000..b0a779c --- /dev/null +++ b/src/model/Summary.ts @@ -0,0 +1,92 @@ +/** + * @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 Summary { + /** + * The unique identifier of the summary object. + */ + 'summaryId'?: string; + /** + * Returns the date and time when the summary was created in ATOM date-time format. + */ + 'createdAt'?: Date; + /** + * Returns the date and time when the summary was last updated in ATOM date-time format. + */ + 'updatedAt'?: Date; + /** + * The unique identifier of the video object. + */ + 'videoId'?: string; + /** + * Returns the origin of how the summary was created. - `api` means that no summary was generated automatically. You can add summary manually using the `PATCH /summaries/{summaryId}/source` endpoint operation. Until this happens, `sourceStatus` returns `missing`. - `auto` means that the API generated the summary automatically. + */ + 'origin'?: SummaryOriginEnum; + /** + * Returns the current status of summary generation. `missing`: the input for a summary is not present. `waiting` : the input video is being processed and a summary will be generated. `failed`: a technical issue prevented summary generation. `completed`: the summary is generated. `unprocessable`: the API rules the source video to be unsuitable for summary generation. An example for this is an input video that has no audio. + */ + 'sourceStatus'?: SummarySourceStatusEnum; + + static readonly discriminator?: string = undefined; + + static readonly attributeTypeMap: Array = [ + { + name: 'summaryId', + baseName: 'summaryId', + type: 'string', + format: '', + }, + { + name: 'createdAt', + baseName: 'createdAt', + type: 'Date', + format: 'date-time', + }, + { + name: 'updatedAt', + baseName: 'updatedAt', + type: 'Date', + format: 'date-time', + }, + { + name: 'videoId', + baseName: 'videoId', + type: 'string', + format: '', + }, + { + name: 'origin', + baseName: 'origin', + type: 'SummaryOriginEnum', + format: '', + }, + { + name: 'sourceStatus', + baseName: 'sourceStatus', + type: 'SummarySourceStatusEnum', + format: '', + }, + ]; + + static getAttributeTypeMap(): Array { + return Summary.attributeTypeMap; + } +} + +export type SummaryOriginEnum = 'api' | 'auto'; +export type SummarySourceStatusEnum = + | 'missing' + | 'waiting' + | 'failed' + | 'completed' + | 'unprocessable'; diff --git a/src/model/SummaryCreationPayload.ts b/src/model/SummaryCreationPayload.ts new file mode 100644 index 0000000..0a733f3 --- /dev/null +++ b/src/model/SummaryCreationPayload.ts @@ -0,0 +1,46 @@ +/** + * @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 SummaryCreationPayload { + /** + * Create a summary of a video using the video ID. + */ + 'videoId': string; + /** + * Use this parameter to define how the API generates the summary. The only allowed value is `auto`, which means that the API generates a summary automatically. If you do not set this parameter, **the API will not generate a summary automatically**. In this case, `sourceStatus` will return `missing`, and you have to manually add a summary using the `PATCH /summaries/{summaryId}/source` endpoint operation. + */ + 'origin'?: SummaryCreationPayloadOriginEnum; + + static readonly discriminator?: string = undefined; + + static readonly attributeTypeMap: Array = [ + { + name: 'videoId', + baseName: 'videoId', + type: 'string', + format: '', + }, + { + name: 'origin', + baseName: 'origin', + type: 'SummaryCreationPayloadOriginEnum', + format: '', + }, + ]; + + static getAttributeTypeMap(): Array { + return SummaryCreationPayload.attributeTypeMap; + } +} + +export type SummaryCreationPayloadOriginEnum = 'auto'; diff --git a/src/model/SummarySource.ts b/src/model/SummarySource.ts new file mode 100644 index 0000000..b2582cd --- /dev/null +++ b/src/model/SummarySource.ts @@ -0,0 +1,54 @@ +/** + * @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 SummarySource { + /** + * A video title, based on the contents of the video. + */ + 'title'?: string; + /** + * A short outline of the contents of the video. The length of an `abstract` depends on the amount of content in a video that can be transcribed. The API condenses the contents into minimum 20, maximum 300 words. + */ + '_abstract'?: string; + /** + * A list of 3 key points from the video, in chronological order. + */ + 'takeaways'?: Array; + + static readonly discriminator?: string = undefined; + + static readonly attributeTypeMap: Array = [ + { + name: 'title', + baseName: 'title', + type: 'string', + format: '', + }, + { + name: '_abstract', + baseName: 'abstract', + type: 'string', + format: '', + }, + { + name: 'takeaways', + baseName: 'takeaways', + type: 'Array', + format: '', + }, + ]; + + static getAttributeTypeMap(): Array { + return SummarySource.attributeTypeMap; + } +} diff --git a/src/model/SummaryUpdatePayload.ts b/src/model/SummaryUpdatePayload.ts new file mode 100644 index 0000000..6417787 --- /dev/null +++ b/src/model/SummaryUpdatePayload.ts @@ -0,0 +1,54 @@ +/** + * @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 SummaryUpdatePayload { + /** + * A video title, based on the contents of the video. + */ + 'title'?: string; + /** + * A short outline of the contents of the video. + */ + '_abstract'?: string; + /** + * A list of 3 key points from the video, in chronological order. + */ + 'takeaways'?: Array; + + static readonly discriminator?: string = undefined; + + static readonly attributeTypeMap: Array = [ + { + name: 'title', + baseName: 'title', + type: 'string', + format: '', + }, + { + name: '_abstract', + baseName: 'abstract', + type: 'string', + format: '', + }, + { + name: 'takeaways', + baseName: 'takeaways', + type: 'Array', + format: '', + }, + ]; + + static getAttributeTypeMap(): Array { + return SummaryUpdatePayload.attributeTypeMap; + } +} diff --git a/src/model/VideoCreationPayload.ts b/src/model/VideoCreationPayload.ts index 2595e05..67795bb 100644 --- a/src/model/VideoCreationPayload.ts +++ b/src/model/VideoCreationPayload.ts @@ -61,6 +61,10 @@ export default class VideoCreationPayload { * Use this parameter to enable transcription. - When `true`, the API generates a transcript for the video. - The default value is `false`. - If you define a video language using the `language` parameter, the API uses that language to transcribe the video. If you do not define a language, the API detects it based on the video. - When the API generates a transcript, it will be available as a caption for the video. */ 'transcript'?: boolean; + /** + * Use this parameter to enable summarization. We recommend using this parameter together with `transcript: true`. - When `true`, the API generates a summary for the video, based on the transcription. - The default value is `false`. - If you define a video language using the `language` parameter, the API uses that language to summarize the video. If you do not define a language, the API detects it based on the video. + */ + 'transcriptSummary'?: boolean; static readonly discriminator?: string = undefined; @@ -143,6 +147,12 @@ export default class VideoCreationPayload { type: 'boolean', format: '', }, + { + name: 'transcriptSummary', + baseName: 'transcriptSummary', + type: 'boolean', + format: '', + }, ]; static getAttributeTypeMap(): Array { diff --git a/src/model/VideoUpdatePayload.ts b/src/model/VideoUpdatePayload.ts index 5d7ab1e..cebef93 100644 --- a/src/model/VideoUpdatePayload.ts +++ b/src/model/VideoUpdatePayload.ts @@ -53,6 +53,10 @@ export default class VideoUpdatePayload { * Use this parameter to enable transcription. - When `true`, the API generates a transcript for the video. - The default value is `false`. - If you define a video language using the `language` parameter, the API uses that language to transcribe the video. If you do not define a language, the API detects it based on the video. - When the API generates a transcript, it will be available as a caption for the video. */ 'transcript'?: boolean; + /** + * Use this parameter to enable summarization. - When `true`, the API generates a summary for the video, based on the transcription. - The default value is `false`. - If you define a video language using the `language` parameter, the API uses that language to summarize the video. If you do not define a language, the API detects it based on the video. + */ + 'transcriptSummary'?: boolean; static readonly discriminator?: string = undefined; @@ -117,6 +121,12 @@ export default class VideoUpdatePayload { type: 'boolean', format: '', }, + { + name: 'transcriptSummary', + baseName: 'transcriptSummary', + type: 'boolean', + format: '', + }, ]; static getAttributeTypeMap(): Array { diff --git a/test/client.spec.ts b/test/client.spec.ts index 6e853cc..31ef416 100644 --- a/test/client.spec.ts +++ b/test/client.spec.ts @@ -4,6 +4,7 @@ import CaptionsApi from '../src/api/CaptionsApi'; import ChaptersApi from '../src/api/ChaptersApi'; import LiveStreamsApi from '../src/api/LiveStreamsApi'; import PlayerThemesApi from '../src/api/PlayerThemesApi'; +import SummariesApi from '../src/api/SummariesApi'; import TagsApi from '../src/api/TagsApi'; import UploadTokensApi from '../src/api/UploadTokensApi'; import VideosApi from '../src/api/VideosApi'; @@ -31,6 +32,10 @@ describe('ApiVideoClient', () => { const client = new ApiVideoClient({ apiKey: 'test' }); expect(client.playerThemes).toBeInstanceOf(PlayerThemesApi); }); + it('should use the SummariesApi class', () => { + const client = new ApiVideoClient({ apiKey: 'test' }); + expect(client.summaries).toBeInstanceOf(SummariesApi); + }); it('should use the TagsApi class', () => { const client = new ApiVideoClient({ apiKey: 'test' }); expect(client.tags).toBeInstanceOf(TagsApi); diff --git a/test/payloads/summaries/create/responses201.json b/test/payloads/summaries/create/responses201.json new file mode 100644 index 0000000..4144fc4 --- /dev/null +++ b/test/payloads/summaries/create/responses201.json @@ -0,0 +1,8 @@ +{ + "summaryId" : "summary_1CGHWuXjhxmeH4WiZ51234", + "createdAt" : "2024-07-14T23:36:07+00:00", + "updatedAt" : "2024-07-14T23:36:07+00:00", + "videoId" : "vilkR8K3N7yrRcxcMt91234", + "origin" : "auto", + "sourceStatus" : "completed" +} \ No newline at end of file diff --git a/test/payloads/summaries/create/responses409.json b/test/payloads/summaries/create/responses409.json new file mode 100644 index 0000000..8d8965e --- /dev/null +++ b/test/payloads/summaries/create/responses409.json @@ -0,0 +1,7 @@ +{ + "type" : "https://docs.api.video/reference/summary-already-exists", + "title" : "A summary already exists or is being created on this video.", + "status" : 409, + "detail" : "You can delete the existing summary and generate a new one.", + "name" : "videoId" +} \ No newline at end of file diff --git a/test/payloads/summaries/getSummarySource/responses404.json b/test/payloads/summaries/getSummarySource/responses404.json new file mode 100644 index 0000000..01e6e6d --- /dev/null +++ b/test/payloads/summaries/getSummarySource/responses404.json @@ -0,0 +1,6 @@ +{ + "type" : "https://docs.api.video/reference/resource-not-found", + "title" : "The requested resource was not found.", + "name" : "summaryId", + "status" : 404 +} \ No newline at end of file diff --git a/test/payloads/summaries/list/responses200.json b/test/payloads/summaries/list/responses200.json new file mode 100644 index 0000000..e057a94 --- /dev/null +++ b/test/payloads/summaries/list/responses200.json @@ -0,0 +1,34 @@ +{ + "data" : [ { + "summaryId" : "summary_1CGHWuXjhxmeH4WiZ51234", + "createdAt" : "2024-07-14T23:36:07+00:00", + "updatedAt" : "2024-07-14T23:36:07+00:00", + "videoId" : "vilkR8K3N7yrRcxcMt91234", + "origin" : "auto", + "sourceStatus" : "completed" + }, { + "summaryId" : "summary_123HWuXjhxmeH4WiZ55678", + "createdAt" : "2024-07-15T23:36:07+00:00", + "updatedAt" : "2024-07-15T23:36:07+00:00", + "videoId" : "vibaBXK3N7yrRcxcMt95678", + "origin" : "auto", + "sourceStatus" : "waiting" + } ], + "pagination" : { + "currentPage" : 1, + "pageSize" : 25, + "pagesTotal" : 1, + "itemsTotal" : 11, + "currentPageItems" : 11, + "links" : [ { + "rel" : "self", + "uri" : "https://ws.api.video/summaries?currentPage=1" + }, { + "rel" : "first", + "uri" : "https://ws.api.video/summaries?currentPage=1" + }, { + "rel" : "last", + "uri" : "https://ws.api.video/summaries?currentPage=1" + } ] + } +} \ No newline at end of file diff --git a/test/payloads/summaries/update/responses409.json b/test/payloads/summaries/update/responses409.json new file mode 100644 index 0000000..5ad057e --- /dev/null +++ b/test/payloads/summaries/update/responses409.json @@ -0,0 +1,6 @@ +{ + "type" : "https://docs.api.video/reference/summary-already-exists", + "title" : "A summary already exists or is being created on this video.", + "status" : 409, + "detail" : "You can delete the existing summary and generate a new one." +} \ No newline at end of file diff --git a/test/payloads/videos/update/responses409.json b/test/payloads/videos/update/responses409.json new file mode 100644 index 0000000..93fe9b8 --- /dev/null +++ b/test/payloads/videos/update/responses409.json @@ -0,0 +1,7 @@ +{ + "type" : "https://docs.api.video/reference/summary-already-exists", + "title" : "A summary already exists or is being created on this video.", + "status" : 409, + "detail" : "You can delete the existing summary and generate a new one.", + "name" : "transcriptSummary" +} \ No newline at end of file