diff --git a/doc/api/AuthenticationApi.md b/doc/api/AuthenticationApi.md index f1e83a4..b94e76f 100644 --- a/doc/api/AuthenticationApi.md +++ b/doc/api/AuthenticationApi.md @@ -2,95 +2,81 @@ All URIs are relative to *https://ws.api.video* -Method | HTTP request | Description -------------- | ------------- | ------------- -[**authenticate**](AuthenticationApi.md#authenticate) | **POST** /auth/api-key | Authenticate -[**refresh**](AuthenticationApi.md#refresh) | **POST** /auth/refresh | Refresh token +| Method | Description | HTTP request | +| ------------- | ------------- | ------------- | +| [**authenticate**](AuthenticationApi.md#authenticate) | Authenticate | **POST** /auth/api-key | +| [**refresh**](AuthenticationApi.md#refresh) | Refresh token | **POST** /auth/refresh | -## **authenticate** +## **`authenticate` - Authenticate** -### Example -```js -(async () => { - try { - const client = new ApiVideoClient(); - - const authenticatePayload = { - apiKey: "apiKey_example", // Your account API key. You can use your sandbox API key, or you can use your production API key. - }; - - // AccessToken - const result = await client.authentication.authenticate(authenticatePayload); - console.log(result); - } catch (e) { - console.error(e); - } -})(); -``` +To get started, submit your API key in the body of your request. api.video returns an access token that is valid for one hour (3600 seconds). A refresh token is also returned. View a [tutorial](https://api.video/blog/tutorials/authentication-tutorial) on authentication. +All tutorials using the [authentication endpoint](https://api.video/blog/endpoints/authenticate) ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **authenticatePayload** | [**AuthenticatePayload**](../model/AuthenticatePayload.md)| | +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **authenticatePayload** | [**AuthenticatePayload**](../model/AuthenticatePayload.md)| | + ### Return type -[**AccessToken**](../model/AccessToken.md) -### HTTP request headers +Promise<[**AccessToken**](../model/AccessToken.md)>. + + +### Example +```js +//With the api.video API clients, authentication is taken care of with each client created. +// You get to skip this step! +``` + - - **Content-Type**: application/json - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | -**400** | Bad Request | - | +| **200** | Success | - | +| **400** | Bad Request | - | + + +--- -## **refresh** +## **`refresh` - Refresh token** -### Example -```js -(async () => { - try { - const client = new ApiVideoClient(); - - const refreshTokenPayload = { - refreshToken: "refreshToken_example", // The refresh token is either the first refresh token you received when you authenticated with the auth/api-key endpoint, or it's the refresh token from the last time you used the auth/refresh endpoint. Place this in the body of your request to obtain a new access token (which is valid for an hour) and a new refresh token. - }; - - // AccessToken - const result = await client.authentication.refresh(refreshTokenPayload); - console.log(result); - } catch (e) { - console.error(e); - } -})(); -``` +Use the refresh endpoint with the refresh token you received when you first authenticated using the api-key endpoint. Send the refresh token in the body of your request. The api.video API returns a new access token that is valid for one hour (3600 seconds) and a new refresh token. + ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **refreshTokenPayload** | [**RefreshTokenPayload**](../model/RefreshTokenPayload.md)| | +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **refreshTokenPayload** | [**RefreshTokenPayload**](../model/RefreshTokenPayload.md)| | + ### Return type -[**AccessToken**](../model/AccessToken.md) -### HTTP request headers +Promise<[**AccessToken**](../model/AccessToken.md)>. + + +### Example +```js +//With the api.video API clients, authentication is taken care of with each client created. +// You get to skip this step! +``` + - - **Content-Type**: application/json - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | -**400** | Bad Request | - | +| **200** | Success | - | +| **400** | Bad Request | - | + + +--- diff --git a/doc/api/CaptionsApi.md b/doc/api/CaptionsApi.md index fd34290..a9329ba 100644 --- a/doc/api/CaptionsApi.md +++ b/doc/api/CaptionsApi.md @@ -2,21 +2,39 @@ All URIs are relative to *https://ws.api.video* -Method | HTTP request | Description -------------- | ------------- | ------------- -[**delete**](CaptionsApi.md#delete) | **DELETE** /videos/{videoId}/captions/{language} | Delete a caption -[**list**](CaptionsApi.md#list) | **GET** /videos/{videoId}/captions | List video captions -[**get**](CaptionsApi.md#get) | **GET** /videos/{videoId}/captions/{language} | Show a caption -[**update**](CaptionsApi.md#update) | **PATCH** /videos/{videoId}/captions/{language} | Update caption -[**upload**](CaptionsApi.md#upload) | **POST** /videos/{videoId}/captions/{language} | Upload a caption +| Method | Description | HTTP request | +| ------------- | ------------- | ------------- | +| [**delete**](CaptionsApi.md#delete) | Delete a caption | **DELETE** /videos/{videoId}/captions/{language} | +| [**list**](CaptionsApi.md#list) | List video captions | **GET** /videos/{videoId}/captions | +| [**get**](CaptionsApi.md#get) | Show a caption | **GET** /videos/{videoId}/captions/{language} | +| [**update**](CaptionsApi.md#update) | Update caption | **PATCH** /videos/{videoId}/captions/{language} | +| [**upload**](CaptionsApi.md#upload) | Upload a caption | **POST** /videos/{videoId}/captions/{language} | -## **delete** +## **`delete` - Delete a caption** + + +Delete a caption in a specific language by providing the video ID for the video you want to delete the caption from and the language the caption is in. + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **videoId** | **string**| The unique identifier for the video you want to delete a caption from. | + | **language** | **string**| A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation. | + + +### Return type + +Promise<[**void**](../model/.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); @@ -33,43 +51,51 @@ Method | HTTP request | Description })(); ``` -### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **videoId** | **string**| The unique identifier for the video you want to delete a caption from. | [default to undefined] - **language** | **string**| A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation. | [default to undefined] - -### Return type -[**void**](../model/.md) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**204** | No Content | - | -**404** | Not Found | - | +| **204** | No Content | - | +| **404** | Not Found | - | + + +--- -## **list** +## **`list` - List video captions** + + +Retrieve a list of available captions for the videoId you provide. + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **videoId** | **string**| The unique identifier for the video you want to retrieve a list of captions for. | + | **currentPage** | **number**| Choose the number of search results to return per page. Minimum value: 1 | + | **pageSize** | **number**| Results per page. Allowed values 1-100, default is 25. | + + +### Return type + +Promise<[**CaptionsListResponse**](../model/CaptionsListResponse.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); - const videoId = 'vi4k0jvEUuaTdRAEjQ4Prklg'; // The unique identifier for the video you want to retrieve a list of captions for. - const currentPage = '2'; // Choose the number of search results to return per page. Minimum value: 1 - const pageSize = '30'; // Results per page. Allowed values 1-100, default is 25. + const videoId = 'vi4k0jvEUuaTdRAEjQ4Prklg'; // The unique identifier for the video you want captions for. + const language = 'en'; // A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation - // CaptionsListResponse - const result = await client.captions.list({ videoId, currentPage, pageSize }) + // Caption + const result = await client.captions.get(videoId, language); console.log(result); } catch (e) { console.error(e); @@ -77,34 +103,42 @@ Name | Type | Description | Notes })(); ``` -### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **videoId** | **string**| The unique identifier for the video you want to retrieve a list of captions for. | [default to undefined] - **currentPage** | **number**| Choose the number of search results to return per page. Minimum value: 1 | [optional] [default to 1] - **pageSize** | **number**| Results per page. Allowed values 1-100, default is 25. | [optional] [default to 25] - -### Return type -[**CaptionsListResponse**](../model/CaptionsListResponse.md) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | -**404** | Not Found | - | +| **200** | Success | - | +| **404** | Not Found | - | + + +--- -## **get** +## **`get` - Show a caption** + + +Display a caption for a video in a specific language. If the language is available, the caption is returned. Otherwise, you will get a response indicating the caption was not found. +Tutorials that use the [captions endpoint](https://api.video/blog/endpoints/captions). + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **videoId** | **string**| The unique identifier for the video you want captions for. | + | **language** | **string**| A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation | + + +### Return type + +Promise<[**Caption**](../model/Caption.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); @@ -121,33 +155,42 @@ Name | Type | Description | Notes })(); ``` -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **videoId** | **string**| The unique identifier for the video you want captions for. | [default to undefined] - **language** | **string**| A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation | [default to undefined] -### Return type -[**Caption**](../model/Caption.md) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | -**404** | Not Found | - | +| **200** | Success | - | +| **404** | Not Found | - | + + +--- -## **update** +## **`update` - Update caption** + + +To have the captions on automatically, use this PATCH to set default: true. + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **videoId** | **string**| The unique identifier for the video you want to have automatic captions for. | + | **language** | **string**| A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation. | + | **captionsUpdatePayload** | [**CaptionsUpdatePayload**](../model/CaptionsUpdatePayload.md)| | + + +### Return type + +Promise<[**Caption**](../model/Caption.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); @@ -155,8 +198,8 @@ Name | Type | Description | Notes const videoId = 'vi4k0jvEUuaTdRAEjQ4Prklg'; // The unique identifier for the video you want to have automatic captions for. const language = 'en'; // A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation. const captionsUpdatePayload = { - _default: true, - }; + _default: true, + }; // Caption const result = await client.captions.update(videoId, language, captionsUpdatePayload); @@ -167,35 +210,44 @@ Name | Type | Description | Notes })(); ``` -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **videoId** | **string**| The unique identifier for the video you want to have automatic captions for. | [default to undefined] - **language** | **string**| A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation. | [default to undefined] - **captionsUpdatePayload** | [**CaptionsUpdatePayload**](../model/CaptionsUpdatePayload.md)| | -### Return type -[**Caption**](../model/Caption.md) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | -**400** | Bad Request | - | -**404** | Not Found | - | +| **200** | Success | - | +| **400** | Bad Request | - | +| **404** | Not Found | - | + + +--- -## **upload** +## **`upload` - Upload a caption** + + +Upload a VTT file to add captions to your video. + Read our [captioning tutorial](https://api.video/blog/tutorials/adding-captions) for more details. + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **videoId** | **string**| The unique identifier for the video you want to add a caption to. | + | **language** | **string**| A valid BCP 47 language representation. | + | **file** | **string**| The video text track (VTT) you want to upload. | + + +### Return type + +Promise<[**Caption**](../model/Caption.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); @@ -213,26 +265,15 @@ Name | Type | Description | Notes })(); ``` -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **videoId** | **string**| The unique identifier for the video you want to add a caption to. | [default to undefined] - **language** | **string**| A valid BCP 47 language representation. | [default to undefined] - **file** | **string**| The video text track (VTT) you want to upload. | [default to undefined] -### Return type -[**Caption**](../model/Caption.md) - -### HTTP request headers - - - **Content-Type**: multipart/form-data - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | -**400** | Bad Request | - | -**404** | Not Found | - | +| **200** | Success | - | +| **400** | Bad Request | - | +| **404** | Not Found | - | + + +--- diff --git a/doc/api/ChaptersApi.md b/doc/api/ChaptersApi.md index c5ce7c2..af5a2df 100644 --- a/doc/api/ChaptersApi.md +++ b/doc/api/ChaptersApi.md @@ -2,20 +2,36 @@ All URIs are relative to *https://ws.api.video* -Method | HTTP request | Description -------------- | ------------- | ------------- -[**delete**](ChaptersApi.md#delete) | **DELETE** /videos/{videoId}/chapters/{language} | Delete a chapter -[**list**](ChaptersApi.md#list) | **GET** /videos/{videoId}/chapters | List video chapters -[**get**](ChaptersApi.md#get) | **GET** /videos/{videoId}/chapters/{language} | Show a chapter -[**upload**](ChaptersApi.md#upload) | **POST** /videos/{videoId}/chapters/{language} | Upload a chapter +| Method | Description | HTTP request | +| ------------- | ------------- | ------------- | +| [**delete**](ChaptersApi.md#delete) | Delete a chapter | **DELETE** /videos/{videoId}/chapters/{language} | +| [**list**](ChaptersApi.md#list) | List video chapters | **GET** /videos/{videoId}/chapters | +| [**get**](ChaptersApi.md#get) | Show a chapter | **GET** /videos/{videoId}/chapters/{language} | +| [**upload**](ChaptersApi.md#upload) | Upload a chapter | **POST** /videos/{videoId}/chapters/{language} | -## **delete** +## **`delete` - Delete a chapter** + + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **videoId** | **string**| The unique identifier for the video you want to delete a chapter from. | + | **language** | **string**| A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation. | + + +### Return type + +Promise<[**void**](../model/.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); @@ -32,43 +48,51 @@ Method | HTTP request | Description })(); ``` -### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **videoId** | **string**| The unique identifier for the video you want to delete a chapter from. | [default to undefined] - **language** | **string**| A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation. | [default to undefined] - -### Return type -[**void**](../model/.md) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**204** | No Content | - | -**404** | Not Found | - | +| **204** | No Content | - | +| **404** | Not Found | - | + + +--- -## **list** +## **`list` - List video chapters** + + +Retrieve a list of all chapters for a specified video. + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **videoId** | **string**| The unique identifier for the video you want to retrieve a list of chapters for. | + | **currentPage** | **number**| Choose the number of search results to return per page. Minimum value: 1 | + | **pageSize** | **number**| Results per page. Allowed values 1-100, default is 25. | + + +### Return type + +Promise<[**ChaptersListResponse**](../model/ChaptersListResponse.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); - const videoId = 'vi4k0jvEUuaTdRAEjQ4Jfrgz'; // The unique identifier for the video you want to retrieve a list of chapters for. - const currentPage = '2'; // Choose the number of search results to return per page. Minimum value: 1 - const pageSize = '30'; // Results per page. Allowed values 1-100, default is 25. + const videoId = 'vi4k0jvEUuaTdRAEjQ4Jfrgz'; // The unique identifier for the video you want to show a chapter for. + const language = 'en'; // A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation. - // ChaptersListResponse - const result = await client.chapters.list({ videoId, currentPage, pageSize }) + // Chapter + const result = await client.chapters.get(videoId, language); console.log(result); } catch (e) { console.error(e); @@ -76,34 +100,41 @@ Name | Type | Description | Notes })(); ``` -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **videoId** | **string**| The unique identifier for the video you want to retrieve a list of chapters for. | [default to undefined] - **currentPage** | **number**| Choose the number of search results to return per page. Minimum value: 1 | [optional] [default to 1] - **pageSize** | **number**| Results per page. Allowed values 1-100, default is 25. | [optional] [default to 25] -### Return type -[**ChaptersListResponse**](../model/ChaptersListResponse.md) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | -**404** | Not Found | - | +| **200** | Success | - | +| **404** | Not Found | - | + + +--- -## **get** +## **`get` - Show a chapter** + + +Chapters help your viewers find the sections of the video they are most interested in viewing. Tutorials that use the [chapters endpoint](https://api.video/blog/endpoints/chapters). + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **videoId** | **string**| The unique identifier for the video you want to show a chapter for. | + | **language** | **string**| A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation. | + + +### Return type + +Promise<[**Chapter**](../model/Chapter.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); @@ -120,33 +151,42 @@ Name | Type | Description | Notes })(); ``` -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **videoId** | **string**| The unique identifier for the video you want to show a chapter for. | [default to undefined] - **language** | **string**| A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation. | [default to undefined] - -### Return type -[**Chapter**](../model/Chapter.md) - -### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | -**404** | Not Found | - | +| **200** | Success | - | +| **404** | Not Found | - | + + +--- -## **upload** +## **`upload` - Upload a chapter** + + +Chapters help break the video into sections. Read our [tutorial](https://api.video/blog/tutorials/adding-chapters-to-your-videos) for more details. + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **videoId** | **string**| The unique identifier for the video you want to upload a chapter for. | + | **language** | **string**| A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation. | + | **file** | **string**| The VTT file describing the chapters you want to upload. | + + +### Return type + +Promise<[**Chapter**](../model/Chapter.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); @@ -164,26 +204,15 @@ Name | Type | Description | Notes })(); ``` -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **videoId** | **string**| The unique identifier for the video you want to upload a chapter for. | [default to undefined] - **language** | **string**| A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation. | [default to undefined] - **file** | **string**| The VTT file describing the chapters you want to upload. | [default to undefined] - -### Return type -[**Chapter**](../model/Chapter.md) - -### HTTP request headers - - **Content-Type**: multipart/form-data - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | -**400** | Bad Request | - | -**404** | Not Found | - | +| **200** | Success | - | +| **400** | Bad Request | - | +| **404** | Not Found | - | + + +--- diff --git a/doc/api/LiveStreamsApi.md b/doc/api/LiveStreamsApi.md index b6f000f..2ab72dc 100644 --- a/doc/api/LiveStreamsApi.md +++ b/doc/api/LiveStreamsApi.md @@ -2,23 +2,38 @@ All URIs are relative to *https://ws.api.video* -Method | HTTP request | Description -------------- | ------------- | ------------- -[**delete**](LiveStreamsApi.md#delete) | **DELETE** /live-streams/{liveStreamId} | Delete a live stream -[**deleteThumbnail**](LiveStreamsApi.md#deleteThumbnail) | **DELETE** /live-streams/{liveStreamId}/thumbnail | Delete a thumbnail -[**list**](LiveStreamsApi.md#list) | **GET** /live-streams | List all live streams -[**get**](LiveStreamsApi.md#get) | **GET** /live-streams/{liveStreamId} | Show live stream -[**update**](LiveStreamsApi.md#update) | **PATCH** /live-streams/{liveStreamId} | Update a live stream -[**create**](LiveStreamsApi.md#create) | **POST** /live-streams | Create live stream -[**uploadThumbnail**](LiveStreamsApi.md#uploadThumbnail) | **POST** /live-streams/{liveStreamId}/thumbnail | Upload a thumbnail +| Method | Description | HTTP request | +| ------------- | ------------- | ------------- | +| [**delete**](LiveStreamsApi.md#delete) | Delete a live stream | **DELETE** /live-streams/{liveStreamId} | +| [**deleteThumbnail**](LiveStreamsApi.md#deleteThumbnail) | Delete a thumbnail | **DELETE** /live-streams/{liveStreamId}/thumbnail | +| [**list**](LiveStreamsApi.md#list) | List all live streams | **GET** /live-streams | +| [**get**](LiveStreamsApi.md#get) | Show live stream | **GET** /live-streams/{liveStreamId} | +| [**update**](LiveStreamsApi.md#update) | Update a live stream | **PATCH** /live-streams/{liveStreamId} | +| [**create**](LiveStreamsApi.md#create) | Create live stream | **POST** /live-streams | +| [**uploadThumbnail**](LiveStreamsApi.md#uploadThumbnail) | Upload a thumbnail | **POST** /live-streams/{liveStreamId}/thumbnail | -## **delete** +## **`delete` - Delete a live stream** + + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **liveStreamId** | **string**| The unique ID for the live stream that you want to remove. | + + +### Return type + +Promise<[**void**](../model/.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); @@ -34,31 +49,39 @@ Method | HTTP request | Description })(); ``` -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **liveStreamId** | **string**| The unique ID for the live stream that you want to remove. | [default to undefined] -### Return type -[**void**](../model/.md) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**204** | No Content | - | +| **204** | No Content | - | + + +--- -## **deleteThumbnail** +## **`deleteThumbnail` - Delete a thumbnail** + + +Send the unique identifier for a live stream to delete it from the system. + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **liveStreamId** | **string**| The unique identifier for the live stream you want to delete. | + + +### Return type + +Promise<[**LiveStream**](../model/LiveStream.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); @@ -74,32 +97,45 @@ Name | Type | Description | Notes })(); ``` -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **liveStreamId** | **string**| The unique identifier for the live stream you want to delete. | [default to undefined] - -### Return type -[**LiveStream**](../model/LiveStream.md) - -### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | -**404** | Not Found | - | +| **200** | Success | - | +| **404** | Not Found | - | + + +--- -## **list** +## **`list` - List all live streams** + + +With no parameters added to the url, this will return all livestreams. Query by name or key to limit the list. + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **streamKey** | **string**| The unique stream key that allows you to stream videos. | + | **name** | **string**| You can filter live streams by their name or a part of their name. | + | **sortBy** | **string**| Allowed: createdAt, publishedAt, name. createdAt - the time a livestream was created using the specified streamKey. publishedAt - the time a livestream was published using the specified streamKey. name - the name of the livestream. If you choose one of the time based options, the time is presented in ISO-8601 format. | + | **sortOrder** | **'asc' | 'desc'**| Allowed: asc, desc. Ascending for date and time means that earlier values precede later ones. Descending means that later values preced earlier ones. For title, it is 0-9 and A-Z ascending and Z-A, 9-0 descending. | + | **currentPage** | **number**| Choose the number of search results to return per page. Minimum value: 1 | + | **pageSize** | **number**| Results per page. Allowed values 1-100, default is 25. | + + +### Return type + +Promise<[**LiveStreamListResponse**](../model/LiveStreamListResponse.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); @@ -120,36 +156,39 @@ Name | Type | Description | Notes })(); ``` -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **streamKey** | **string**| The unique stream key that allows you to stream videos. | [optional] [default to undefined] - **name** | **string**| You can filter live streams by their name or a part of their name. | [optional] [default to undefined] - **sortBy** | **string**| Allowed: createdAt, publishedAt, name. createdAt - the time a livestream was created using the specified streamKey. publishedAt - the time a livestream was published using the specified streamKey. name - the name of the livestream. If you choose one of the time based options, the time is presented in ISO-8601 format. | [optional] [default to undefined] - **sortOrder** | **'asc' | 'desc'**| Allowed: asc, desc. Ascending for date and time means that earlier values precede later ones. Descending means that later values preced earlier ones. For title, it is 0-9 and A-Z ascending and Z-A, 9-0 descending. | [optional] [default to undefined] [enum: asc, desc] - **currentPage** | **number**| Choose the number of search results to return per page. Minimum value: 1 | [optional] [default to 1] - **pageSize** | **number**| Results per page. Allowed values 1-100, default is 25. | [optional] [default to 25] -### Return type -[**LiveStreamListResponse**](../model/LiveStreamListResponse.md) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | +| **200** | Success | - | + + +--- -## **get** +## **`get` - Show live stream** + + +Supply a LivestreamId, and you'll get all the details for streaming into, and watching the livestream. Tutorials that use the [show livestream endpoint](https://api.video/blog/endpoints/live-stream-status). + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **liveStreamId** | **string**| The unique ID for the live stream you want to watch. | + + +### Return type + +Promise<[**LiveStream**](../model/LiveStream.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); @@ -165,42 +204,51 @@ Name | Type | Description | Notes })(); ``` -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **liveStreamId** | **string**| The unique ID for the live stream you want to watch. | [default to undefined] - -### Return type -[**LiveStream**](../model/LiveStream.md) -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | +| **200** | Success | - | + + +--- -## **update** +## **`update` - Update a live stream** + + +Use this endpoint to update the player, or to turn recording on/off (saving a copy of the livestream). NOTE: If the livestream is actively streaming, changing the recording status will only affect the NEXT stream. The public=false 'private livestream' is available as a BETA feature, and should be limited to livestreams of 3,000 viewers or fewer. + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **liveStreamId** | **string**| The unique ID for the live stream that you want to update information for such as player details, or whether you want the recording on or off. | + | **liveStreamUpdatePayload** | [**LiveStreamUpdatePayload**](../model/LiveStreamUpdatePayload.md)| | + + +### Return type + +Promise<[**LiveStream**](../model/LiveStream.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); const liveStreamId = 'li400mYKSgQ6xs7taUeSaEKr'; // The unique ID for the live stream that you want to update information for such as player details, or whether you want the recording on or off. const liveStreamUpdatePayload = { - name: "My Live Stream Video", // The name you want to use for your live stream. - _public: true, // BETA FEATURE Please limit all public = false (\"private\") livestreams to 3,000 users. Whether your video can be viewed by everyone, or requires authentication to see it. A setting of false will require a unique token for each view. - record: true, // Use this to indicate whether you want the recording on or off. On is true, off is false. - playerId: "pl45KFKdlddgk654dspkze", // The unique ID for the player associated with a live stream that you want to update. - }; + name: "My Live Stream Video", // The name you want to use for your live stream. + _public: true, // BETA FEATURE Please limit all public = false ("private") livestreams to 3,000 users. Whether your video can be viewed by everyone, or requires authentication to see it. A setting of false will require a unique token for each view. + record: true, // Use this to indicate whether you want the recording on or off. On is true, off is false. + playerId: "pl45KFKdlddgk654dspkze", // The unique ID for the player associated with a live stream that you want to update. + }; // LiveStream const result = await client.liveStreams.update(liveStreamId, liveStreamUpdatePayload); @@ -211,43 +259,51 @@ Name | Type | Description | Notes })(); ``` -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **liveStreamId** | **string**| The unique ID for the live stream that you want to update information for such as player details, or whether you want the recording on or off. | [default to undefined] - **liveStreamUpdatePayload** | [**LiveStreamUpdatePayload**](../model/LiveStreamUpdatePayload.md)| | - -### Return type -[**LiveStream**](../model/LiveStream.md) - -### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | -**400** | Bad Request | - | +| **200** | Success | - | +| **400** | Bad Request | - | + + +--- -## **create** +## **`create` - Create live stream** + + +A live stream will give you the 'connection point' to RTMP your video stream to api.video. It will also give you the details for viewers to watch the same livestream. The public=false 'private livestream' is available as a BETA feature, and should be limited to livestreams of 3,000 viewers or fewer. See our [Live Stream Tutorial](https://api.video/blog/tutorials/live-stream-tutorial) for a walkthrough of this API with OBS. Your RTMP endpoint for the livestream is rtmp://broadcast.api.video/s/{streamKey} +Tutorials that [create live streams](https://api.video/blog/endpoints/live-create). + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **liveStreamCreationPayload** | [**LiveStreamCreationPayload**](../model/LiveStreamCreationPayload.md)| | + + +### Return type + +Promise<[**LiveStream**](../model/LiveStream.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); const liveStreamCreationPayload = { - name: "My Live Stream Video", // Add a name for your live stream here. - record: true, // Whether you are recording or not. True for record, false for not record. - _public: true, // BETA FEATURE Please limit all public = false (\"private\") livestreams to 3,000 users. Whether your video can be viewed by everyone, or requires authentication to see it. A setting of false will require a unique token for each view. - playerId: "pl4f4ferf5erfr5zed4fsdd", // The unique identifier for the player. - }; + name: "My Live Stream Video", // Add a name for your live stream here. + record: true, // Whether you are recording or not. True for record, false for not record. + _public: true, // BETA FEATURE Please limit all public = false ("private") livestreams to 3,000 users. Whether your video can be viewed by everyone, or requires authentication to see it. A setting of false will require a unique token for each view. + playerId: "pl4f4ferf5erfr5zed4fsdd", // The unique identifier for the player. + }; // LiveStream const result = await client.liveStreams.create(liveStreamCreationPayload); @@ -258,38 +314,47 @@ Name | Type | Description | Notes })(); ``` -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **liveStreamCreationPayload** | [**LiveStreamCreationPayload**](../model/LiveStreamCreationPayload.md)| | - -### Return type -[**LiveStream**](../model/LiveStream.md) - -### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | -**400** | Bad Request | - | +| **200** | Success | - | +| **400** | Bad Request | - | + + +--- -## **uploadThumbnail** +## **`uploadThumbnail` - Upload a thumbnail** + + +Upload an image to use as a backdrop for your livestream. Tutorials that [update live stream thumbnails](https://api.video/blog/endpoints/live-upload-a-thumbnail). + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **liveStreamId** | **string**| The unique ID for the live stream you want to upload. | + | **file** | **string**| The image to be added as a thumbnail. The mime type should be image/jpeg, image/png or image/webp. The max allowed size is 8 MiB. | + + +### Return type + +Promise<[**LiveStream**](../model/LiveStream.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); const liveStreamId = 'vi4k0jvEUuaTdRAEjQ4Jfrgz'; // The unique ID for the live stream you want to upload. - const file = 'BINARY_DATA_HERE'; // The image to be added as a thumbnail. The mime type should be image/jpeg, image/png or image/webp. The max allowed size is 8 MiB. + const file = 'BINARY_DATA_HERE'; // The image to be added as a thumbnail. // LiveStream const result = await client.liveStreams.uploadThumbnail(liveStreamId, file); @@ -300,25 +365,15 @@ Name | Type | Description | Notes })(); ``` -### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **liveStreamId** | **string**| The unique ID for the live stream you want to upload. | [default to undefined] - **file** | **string**| The image to be added as a thumbnail. The mime type should be image/jpeg, image/png or image/webp. The max allowed size is 8 MiB. | [default to undefined] - -### Return type -[**LiveStream**](../model/LiveStream.md) - -### HTTP request headers - - - **Content-Type**: multipart/form-data - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**201** | Created | - | -**400** | Bad Request | - | -**404** | Not Found | - | +| **201** | Created | - | +| **400** | Bad Request | - | +| **404** | Not Found | - | + + +--- diff --git a/doc/api/PlayerThemesApi.md b/doc/api/PlayerThemesApi.md index 3c6b6c0..90b322d 100644 --- a/doc/api/PlayerThemesApi.md +++ b/doc/api/PlayerThemesApi.md @@ -2,23 +2,40 @@ All URIs are relative to *https://ws.api.video* -Method | HTTP request | Description -------------- | ------------- | ------------- -[**delete**](PlayerThemesApi.md#delete) | **DELETE** /players/{playerId} | Delete a player -[**deleteLogo**](PlayerThemesApi.md#deleteLogo) | **DELETE** /players/{playerId}/logo | Delete logo -[**list**](PlayerThemesApi.md#list) | **GET** /players | List all player themes -[**get**](PlayerThemesApi.md#get) | **GET** /players/{playerId} | Show a player -[**update**](PlayerThemesApi.md#update) | **PATCH** /players/{playerId} | Update a player -[**create**](PlayerThemesApi.md#create) | **POST** /players | Create a player -[**uploadLogo**](PlayerThemesApi.md#uploadLogo) | **POST** /players/{playerId}/logo | Upload a logo +| Method | Description | HTTP request | +| ------------- | ------------- | ------------- | +| [**delete**](PlayerThemesApi.md#delete) | Delete a player | **DELETE** /players/{playerId} | +| [**deleteLogo**](PlayerThemesApi.md#deleteLogo) | Delete logo | **DELETE** /players/{playerId}/logo | +| [**list**](PlayerThemesApi.md#list) | List all player themes | **GET** /players | +| [**get**](PlayerThemesApi.md#get) | Show a player | **GET** /players/{playerId} | +| [**update**](PlayerThemesApi.md#update) | Update a player | **PATCH** /players/{playerId} | +| [**create**](PlayerThemesApi.md#create) | Create a player | **POST** /players | +| [**uploadLogo**](PlayerThemesApi.md#uploadLogo) | Upload a logo | **POST** /players/{playerId}/logo | -## **delete** +## **`delete` - Delete a player** + + +Delete a player if you no longer need it. You can delete any player that you have the player ID for. + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **playerId** | **string**| The unique identifier for the player you want to delete. | + + +### Return type + +Promise<[**void**](../model/.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); @@ -34,32 +51,38 @@ Method | HTTP request | Description })(); ``` -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **playerId** | **string**| The unique identifier for the player you want to delete. | [default to undefined] - -### Return type -[**void**](../model/.md) - -### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**204** | No Content | - | -**404** | Not Found | - | +| **204** | No Content | - | +| **404** | Not Found | - | + + +--- -## **deleteLogo** +## **`deleteLogo` - Delete logo** + + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **playerId** | **string**| The unique identifier for the player. | + + +### Return type + +Promise<[**void**](../model/.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); @@ -75,32 +98,44 @@ Name | Type | Description | Notes })(); ``` -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **playerId** | **string**| The unique identifier for the player. | [default to undefined] - -### Return type -[**void**](../model/.md) - -### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**204** | No Content | - | -**404** | Not Found | - | +| **204** | No Content | - | +| **404** | Not Found | - | + + +--- -## **list** +## **`list` - List all player themes** + + +Retrieve a list of all the player themes you created, as well as details about each one. +Tutorials that use the [player endpoint](https://api.video/blog/endpoints/player). + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **sortBy** | **'name' | 'createdAt' | 'updatedAt'**| createdAt is the time the player was created. updatedAt is the time the player was last updated. The time is presented in ISO-8601 format. | + | **sortOrder** | **'asc' | 'desc'**| Allowed: asc, desc. Ascending for date and time means that earlier values precede later ones. Descending means that later values preced earlier ones. | + | **currentPage** | **number**| Choose the number of search results to return per page. Minimum value: 1 | + | **pageSize** | **number**| Results per page. Allowed values 1-100, default is 25. | + + +### Return type + +Promise<[**PlayerThemesListResponse**](../model/PlayerThemesListResponse.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); @@ -119,35 +154,40 @@ Name | Type | Description | Notes })(); ``` -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **sortBy** | **'name' | 'createdAt' | 'updatedAt'**| createdAt is the time the player was created. updatedAt is the time the player was last updated. The time is presented in ISO-8601 format. | [optional] [default to undefined] [enum: name, createdAt, updatedAt] - **sortOrder** | **'asc' | 'desc'**| Allowed: asc, desc. Ascending for date and time means that earlier values precede later ones. Descending means that later values preced earlier ones. | [optional] [default to undefined] [enum: asc, desc] - **currentPage** | **number**| Choose the number of search results to return per page. Minimum value: 1 | [optional] [default to 1] - **pageSize** | **number**| Results per page. Allowed values 1-100, default is 25. | [optional] [default to 25] -### Return type -[**PlayerThemesListResponse**](../model/PlayerThemesListResponse.md) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | -**400** | Bad Request | - | +| **200** | Success | - | +| **400** | Bad Request | - | + + +--- -## **get** +## **`get` - Show a player** + + +Use a player ID to retrieve details about the player and display it for viewers. + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **playerId** | **string**| The unique identifier for the player you want to retrieve. | + + +### Return type + +Promise<[**PlayerTheme**](../model/PlayerTheme.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); @@ -163,55 +203,62 @@ Name | Type | Description | Notes })(); ``` -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **playerId** | **string**| The unique identifier for the player you want to retrieve. | [default to undefined] - -### Return type -[**PlayerTheme**](../model/PlayerTheme.md) -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | -**404** | Not Found | - | +| **200** | Success | - | +| **404** | Not Found | - | + + +--- -## **update** +## **`update` - Update a player** + + +Use a player ID to update specific details for a player. NOTE: It may take up to 10 min before the new player configuration is available from our CDN. + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **playerId** | **string**| The unique identifier for the player. | + | **playerThemeUpdatePayload** | [**PlayerThemeUpdatePayload**](../model/PlayerThemeUpdatePayload.md)| | + + +### Return type + +Promise<[**PlayerTheme**](../model/PlayerTheme.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); const playerId = 'pl45d5vFFGrfdsdsd156dGhh'; // The unique identifier for the player. const playerThemeUpdatePayload = { - name: "name_example", // Add a name for your player theme here. - text: "text_example", // RGBA color for timer text. Default: rgba(255, 255, 255, 1) - link: "link_example", // RGBA color for all controls. Default: rgba(255, 255, 255, 1) - linkHover: "linkHover_example", // RGBA color for all controls when hovered. Default: rgba(255, 255, 255, 1) - linkActive: "linkActive_example", // RGBA color for the play button when hovered. - trackPlayed: "trackPlayed_example", // RGBA color playback bar: played content. Default: rgba(88, 131, 255, .95) - trackUnplayed: "trackUnplayed_example", // RGBA color playback bar: downloaded but unplayed (buffered) content. Default: rgba(255, 255, 255, .35) - trackBackground: "trackBackground_example", // RGBA color playback bar: background. Default: rgba(255, 255, 255, .2) - backgroundTop: "backgroundTop_example", // RGBA color: top 50% of background. Default: rgba(0, 0, 0, .7) - backgroundBottom: "backgroundBottom_example", // RGBA color: bottom 50% of background. Default: rgba(0, 0, 0, .7) - backgroundText: "backgroundText_example", // RGBA color for title text. Default: rgba(255, 255, 255, 1) - enableApi: true, // enable/disable player SDK access. Default: true - enableControls: true, // enable/disable player controls. Default: true - forceAutoplay: true, // enable/disable player autoplay. Default: false - hideTitle: true, // enable/disable title. Default: false - forceLoop: true, // enable/disable looping. Default: false - }; + text: "text_example", // RGBA color for timer text. Default: rgba(255, 255, 255, 1) + link: "link_example", // RGBA color for all controls. Default: rgba(255, 255, 255, 1) + linkHover: "linkHover_example", // RGBA color for all controls when hovered. Default: rgba(255, 255, 255, 1) + trackPlayed: "trackPlayed_example", // RGBA color playback bar: played content. Default: rgba(88, 131, 255, .95) + trackUnplayed: "trackUnplayed_example", // RGBA color playback bar: downloaded but unplayed (buffered) content. Default: rgba(255, 255, 255, .35) + trackBackground: "trackBackground_example", // RGBA color playback bar: background. Default: rgba(255, 255, 255, .2) + backgroundTop: "backgroundTop_example", // RGBA color: top 50% of background. Default: rgba(0, 0, 0, .7) + backgroundBottom: "backgroundBottom_example", // RGBA color: bottom 50% of background. Default: rgba(0, 0, 0, .7) + backgroundText: "backgroundText_example", // RGBA color for title text. Default: rgba(255, 255, 255, 1) + enableApi: true, // enable/disable player SDK access. Default: true + enableControls: true, // enable/disable player controls. Default: true + forceAutoplay: true, // enable/disable player autoplay. Default: false + hideTitle: true, // enable/disable title. Default: false + forceLoop: true, // enable/disable looping. Default: false + }; // PlayerTheme const result = await client.playerThemes.update(playerId, playerThemeUpdatePayload); @@ -222,55 +269,60 @@ Name | Type | Description | Notes })(); ``` -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **playerId** | **string**| The unique identifier for the player. | [default to undefined] - **playerThemeUpdatePayload** | [**PlayerThemeUpdatePayload**](../model/PlayerThemeUpdatePayload.md)| | - -### Return type -[**PlayerTheme**](../model/PlayerTheme.md) - -### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | -**404** | Not Found | - | +| **200** | Success | - | +| **404** | Not Found | - | + + +--- -## **create** +## **`create` - Create a player** + + +Create a player for your video, and customise it. + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **playerThemeCreationPayload** | [**PlayerThemeCreationPayload**](../model/PlayerThemeCreationPayload.md)| | + + +### Return type + +Promise<[**PlayerTheme**](../model/PlayerTheme.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); const playerThemeCreationPayload = { - name: "name_example", // Add a name for your player theme here. - text: "text_example", // RGBA color for timer text. Default: rgba(255, 255, 255, 1) - link: "link_example", // RGBA color for all controls. Default: rgba(255, 255, 255, 1) - linkHover: "linkHover_example", // RGBA color for all controls when hovered. Default: rgba(255, 255, 255, 1) - linkActive: "linkActive_example", // RGBA color for the play button when hovered. - trackPlayed: "trackPlayed_example", // RGBA color playback bar: played content. Default: rgba(88, 131, 255, .95) - trackUnplayed: "trackUnplayed_example", // RGBA color playback bar: downloaded but unplayed (buffered) content. Default: rgba(255, 255, 255, .35) - trackBackground: "trackBackground_example", // RGBA color playback bar: background. Default: rgba(255, 255, 255, .2) - backgroundTop: "backgroundTop_example", // RGBA color: top 50% of background. Default: rgba(0, 0, 0, .7) - backgroundBottom: "backgroundBottom_example", // RGBA color: bottom 50% of background. Default: rgba(0, 0, 0, .7) - backgroundText: "backgroundText_example", // RGBA color for title text. Default: rgba(255, 255, 255, 1) - enableApi: true, // enable/disable player SDK access. Default: true - enableControls: true, // enable/disable player controls. Default: true - forceAutoplay: true, // enable/disable player autoplay. Default: false - hideTitle: true, // enable/disable title. Default: false - forceLoop: true, // enable/disable looping. Default: false - }; + text: "text_example", // RGBA color for timer text. Default: rgba(255, 255, 255, 1) + link: "link_example", // RGBA color for all controls. Default: rgba(255, 255, 255, 1) + linkHover: "linkHover_example", // RGBA color for all controls when hovered. Default: rgba(255, 255, 255, 1) + trackPlayed: "trackPlayed_example", // RGBA color playback bar: played content. Default: rgba(88, 131, 255, .95) + trackUnplayed: "trackUnplayed_example", // RGBA color playback bar: downloaded but unplayed (buffered) content. Default: rgba(255, 255, 255, .35) + trackBackground: "trackBackground_example", // RGBA color playback bar: background. Default: rgba(255, 255, 255, .2) + backgroundTop: "backgroundTop_example", // RGBA color: top 50% of background. Default: rgba(0, 0, 0, .7) + backgroundBottom: "backgroundBottom_example", // RGBA color: bottom 50% of background. Default: rgba(0, 0, 0, .7) + backgroundText: "backgroundText_example", // RGBA color for title text. Default: rgba(255, 255, 255, 1) + enableApi: true, // enable/disable player SDK access. Default: true + enableControls: true, // enable/disable player controls. Default: true + forceAutoplay: true, // enable/disable player autoplay. Default: false + hideTitle: true, // enable/disable title. Default: false + forceLoop: true, // enable/disable looping. Default: false + }; // PlayerTheme const result = await client.playerThemes.create(playerThemeCreationPayload); @@ -281,31 +333,41 @@ Name | Type | Description | Notes })(); ``` -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **playerThemeCreationPayload** | [**PlayerThemeCreationPayload**](../model/PlayerThemeCreationPayload.md)| | - -### Return type -[**PlayerTheme**](../model/PlayerTheme.md) - -### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**201** | Created | - | +| **201** | Created | - | + + +--- -## **uploadLogo** +## **`uploadLogo` - Upload a logo** + + +The uploaded image maximum size should be 200x100 and its weight should be 100KB. It will be scaled down to 30px height and converted to PNG to be displayed in the player. + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **playerId** | **string**| The unique identifier for the player. | + | **file** | **string**| The name of the file you want to use for your logo. | + | **link** | **string**| A public link that you want to advertise in your player. For example, you could add a link to your company. When a viewer clicks on your logo, they will be taken to this address. | + + +### Return type + +Promise<[**PlayerTheme**](../model/PlayerTheme.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); @@ -323,26 +385,15 @@ Name | Type | Description | Notes })(); ``` -### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **playerId** | **string**| The unique identifier for the player. | [default to undefined] - **file** | **string**| The name of the file you want to use for your logo. | [default to undefined] - **link** | **string**| A public link that you want to advertise in your player. For example, you could add a link to your company. When a viewer clicks on your logo, they will be taken to this address. | [optional] [default to undefined] - -### Return type -[**PlayerTheme**](../model/PlayerTheme.md) - -### HTTP request headers - - - **Content-Type**: multipart/form-data - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**201** | Created | - | -**400** | Bad Request | - | -**404** | Not Found | - | +| **201** | Created | - | +| **400** | Bad Request | - | +| **404** | Not Found | - | + + +--- diff --git a/doc/api/RawStatisticsApi.md b/doc/api/RawStatisticsApi.md index 1f3fbb7..3d52fe3 100644 --- a/doc/api/RawStatisticsApi.md +++ b/doc/api/RawStatisticsApi.md @@ -2,25 +2,43 @@ All URIs are relative to *https://ws.api.video* -Method | HTTP request | Description -------------- | ------------- | ------------- -[**listLiveStreamSessions**](RawStatisticsApi.md#listLiveStreamSessions) | **GET** /analytics/live-streams/{liveStreamId} | List live stream player sessions -[**listSessionEvents**](RawStatisticsApi.md#listSessionEvents) | **GET** /analytics/sessions/{sessionId}/events | List player session events -[**listVideoSessions**](RawStatisticsApi.md#listVideoSessions) | **GET** /analytics/videos/{videoId} | List video player sessions +| Method | Description | HTTP request | +| ------------- | ------------- | ------------- | +| [**listLiveStreamSessions**](RawStatisticsApi.md#listLiveStreamSessions) | List live stream player sessions | **GET** /analytics/live-streams/{liveStreamId} | +| [**listSessionEvents**](RawStatisticsApi.md#listSessionEvents) | List player session events | **GET** /analytics/sessions/{sessionId}/events | +| [**listVideoSessions**](RawStatisticsApi.md#listVideoSessions) | List video player sessions | **GET** /analytics/videos/{videoId} | -## **listLiveStreamSessions** +## **`listLiveStreamSessions` - List live stream player sessions** + + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **liveStreamId** | **string**| The unique identifier for the live stream you want to retrieve analytics for. | + | **period** | **string**| Period must have one of the following formats: - For a day : \"2018-01-01\", - For a week: \"2018-W01\", - For a month: \"2018-01\" - For a year: \"2018\" For a range period: - Date range: \"2018-01-01/2018-01-15\" | + | **currentPage** | **number**| Choose the number of search results to return per page. Minimum value: 1 | + | **pageSize** | **number**| Results per page. Allowed values 1-100, default is 25. | + + +### Return type + +Promise<[**RawStatisticsListLiveStreamAnalyticsResponse**](../model/RawStatisticsListLiveStreamAnalyticsResponse.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); const liveStreamId = 'vi4k0jvEUuaTdRAEjQ4Jfrgz'; // The unique identifier for the live stream you want to retrieve analytics for. - const period = '2019-01-01'; // Period must have one of the following formats: - For a day : \"2018-01-01\", - For a week: \"2018-W01\", - For a month: \"2018-01\" - For a year: \"2018\" For a range period: - Date range: \"2018-01-01/2018-01-15\" + const period = '2019-01-01'; // Period must have one of the following formats: - For a day : "2018-01-01", - For a week: "2018-W01", - For a month: "2018-01" - For a year: "2018" For a range period: - Date range: "2018-01-01/2018-01-15" const currentPage = '2'; // Choose the number of search results to return per page. Minimum value: 1 const pageSize = '30'; // Results per page. Allowed values 1-100, default is 25. @@ -33,35 +51,42 @@ Method | HTTP request | Description })(); ``` -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **liveStreamId** | **string**| The unique identifier for the live stream you want to retrieve analytics for. | [default to undefined] - **period** | **string**| Period must have one of the following formats: - For a day : \"2018-01-01\", - For a week: \"2018-W01\", - For a month: \"2018-01\" - For a year: \"2018\" For a range period: - Date range: \"2018-01-01/2018-01-15\" | [optional] [default to undefined] - **currentPage** | **number**| Choose the number of search results to return per page. Minimum value: 1 | [optional] [default to 1] - **pageSize** | **number**| Results per page. Allowed values 1-100, default is 25. | [optional] [default to 25] - -### Return type -[**RawStatisticsListLiveStreamAnalyticsResponse**](../model/RawStatisticsListLiveStreamAnalyticsResponse.md) - -### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | -**404** | Not Found | - | +| **200** | Success | - | +| **404** | Not Found | - | + + +--- -## **listSessionEvents** +## **`listSessionEvents` - List player session events** + + +Useful to track and measure video's engagement. + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **sessionId** | **string**| A unique identifier you can use to reference and track a session with. | + | **currentPage** | **number**| Choose the number of search results to return per page. Minimum value: 1 | + | **pageSize** | **number**| Results per page. Allowed values 1-100, default is 25. | + + +### Return type + +Promise<[**RawStatisticsListPlayerSessionEventsResponse**](../model/RawStatisticsListPlayerSessionEventsResponse.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); @@ -79,41 +104,51 @@ Name | Type | Description | Notes })(); ``` -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **sessionId** | **string**| A unique identifier you can use to reference and track a session with. | [default to undefined] - **currentPage** | **number**| Choose the number of search results to return per page. Minimum value: 1 | [optional] [default to 1] - **pageSize** | **number**| Results per page. Allowed values 1-100, default is 25. | [optional] [default to 25] - -### Return type -[**RawStatisticsListPlayerSessionEventsResponse**](../model/RawStatisticsListPlayerSessionEventsResponse.md) - -### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | -**404** | Not Found | - | +| **200** | Success | - | +| **404** | Not Found | - | + + +--- -## **listVideoSessions** +## **`listVideoSessions` - List video player sessions** + + +Retrieve all available user sessions for a specific video. Tutorials that use the [analytics endpoint](https://api.video/blog/endpoints/analytics). + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **videoId** | **string**| The unique identifier for the video you want to retrieve session information for. | + | **period** | **string**| Period must have one of the following formats: - For a day : 2018-01-01, - For a week: 2018-W01, - For a month: 2018-01 - For a year: 2018 For a range period: - Date range: 2018-01-01/2018-01-15 | + | **metadata** | **{ [key: string]: string; }**| Metadata and [Dynamic Metadata](https://api.video/blog/endpoints/dynamic-metadata) filter. Send an array of key value pairs you want to filter sessios with. | + | **currentPage** | **number**| Choose the number of search results to return per page. Minimum value: 1 | + | **pageSize** | **number**| Results per page. Allowed values 1-100, default is 25. | + + +### Return type + +Promise<[**RawStatisticsListSessionsResponse**](../model/RawStatisticsListSessionsResponse.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); const videoId = 'vi4k0jvEUuaTdRAEjQ4Prklg'; // The unique identifier for the video you want to retrieve session information for. - const period = 'period_example'; // Period must have one of the following formats: - For a day : 2018-01-01, - For a week: 2018-W01, - For a month: 2018-01 - For a year: 2018 For a range period: - Date range: 2018-01-01/2018-01-15 - const metadata = 'metadata[Author]=John Doe&metadata[Format]=Tutorial'; // Metadata and [Dynamic Metadata](https://api.video/blog/endpoints/dynamic-metadata) filter. Send an array of key value pairs you want to filter sessios with. + const period = 'period_example'; // Period must have one of the following formats: - For a day : 2018-01-01, - For a week: 2018-W01, - For a month: 2018-01 - For a year: 2018 For a range period: - Date range: 2018-01-01/2018-01-15 + const metadata = 'metadata[Author]=John Doe&metadata[Format]=Tutorial'; // Metadata and Dynamic Metadata filter. Send an array of key value pairs you want to filter sessios with. const currentPage = '2'; // Choose the number of search results to return per page. Minimum value: 1 const pageSize = '30'; // Results per page. Allowed values 1-100, default is 25. @@ -126,27 +161,14 @@ Name | Type | Description | Notes })(); ``` -### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **videoId** | **string**| The unique identifier for the video you want to retrieve session information for. | [default to undefined] - **period** | **string**| Period must have one of the following formats: - For a day : 2018-01-01, - For a week: 2018-W01, - For a month: 2018-01 - For a year: 2018 For a range period: - Date range: 2018-01-01/2018-01-15 | [optional] [default to undefined] - **metadata** | **{ [key: string]: string; }**| Metadata and [Dynamic Metadata](https://api.video/blog/endpoints/dynamic-metadata) filter. Send an array of key value pairs you want to filter sessios with. | [optional] - **currentPage** | **number**| Choose the number of search results to return per page. Minimum value: 1 | [optional] [default to 1] - **pageSize** | **number**| Results per page. Allowed values 1-100, default is 25. | [optional] [default to 25] - -### Return type -[**RawStatisticsListSessionsResponse**](../model/RawStatisticsListSessionsResponse.md) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | -**404** | Not Found | - | +| **200** | Success | - | +| **404** | Not Found | - | + + +--- diff --git a/doc/api/UploadTokensApi.md b/doc/api/UploadTokensApi.md index 78f6542..684a4bd 100644 --- a/doc/api/UploadTokensApi.md +++ b/doc/api/UploadTokensApi.md @@ -2,182 +2,171 @@ All URIs are relative to *https://ws.api.video* -Method | HTTP request | Description -------------- | ------------- | ------------- -[**deleteToken**](UploadTokensApi.md#deleteToken) | **DELETE** /upload-tokens/{uploadToken} | Delete an upload token -[**list**](UploadTokensApi.md#list) | **GET** /upload-tokens | List all active upload tokens. -[**getToken**](UploadTokensApi.md#getToken) | **GET** /upload-tokens/{uploadToken} | Show upload token -[**createToken**](UploadTokensApi.md#createToken) | **POST** /upload-tokens | Generate an upload token +| Method | Description | HTTP request | +| ------------- | ------------- | ------------- | +| [**deleteToken**](UploadTokensApi.md#deleteToken) | Delete an upload token | **DELETE** /upload-tokens/{uploadToken} | +| [**list**](UploadTokensApi.md#list) | List all active upload tokens. | **GET** /upload-tokens | +| [**getToken**](UploadTokensApi.md#getToken) | Show upload token | **GET** /upload-tokens/{uploadToken} | +| [**createToken**](UploadTokensApi.md#createToken) | Generate an upload token | **POST** /upload-tokens | -## **deleteToken** +## **`deleteToken` - Delete an upload token** -### Example -```js -(async () => { - try { - const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); - - const uploadToken = 'to1tcmSFHeYY5KzyhOqVKMKb'; // The unique identifier for the upload token you want to delete. Deleting a token will make it so the token can no longer be used for authentication. - - // void - const result = await client.uploadTokens.deleteToken(uploadToken); - console.log(result); - } catch (e) { - console.error(e); - } -})(); -``` +Delete an existing upload token. This is especially useful for tokens you may have created that do not expire. ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **uploadToken** | **string**| The unique identifier for the upload token you want to delete. Deleting a token will make it so the token can no longer be used for authentication. | [default to undefined] +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **uploadToken** | **string**| The unique identifier for the upload token you want to delete. Deleting a token will make it so the token can no longer be used for authentication. | + ### Return type -[**void**](../model/.md) -### HTTP request headers +Promise<[**void**](../model/.md)>. + + +### Example +```js +// instantiate the client +const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); + +const uploadToken = 'to1tcmSFHeYY5KzyhOqVKMKb'; // The unique identifier for the upload token you want to delete. Deleting a token will make it so the token can no longer be used for authentication. + +await client.uploadTokens.deleteToken(uploadToken); +``` + - - **Content-Type**: Not defined - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**204** | No Content | - | -**404** | Not Found | - | +| **204** | No Content | - | +| **404** | Not Found | - | + + +--- -## **list** +## **`list` - List all active upload tokens.** -### Example -```js -(async () => { - try { - const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); - - const sortBy = 'ttl'; // Allowed: createdAt, ttl. You can use these to sort by when a token was created, or how much longer the token will be active (ttl - time to live). Date and time is presented in ISO-8601 format. - const sortOrder = 'asc'; // Allowed: asc, desc. Ascending is 0-9 or A-Z. Descending is 9-0 or Z-A. - const currentPage = '2'; // Choose the number of search results to return per page. Minimum value: 1 - const pageSize = '30'; // Results per page. Allowed values 1-100, default is 25. - - // TokenListResponse - const result = await client.uploadTokens.list({ sortBy, sortOrder, currentPage, pageSize }) - console.log(result); - } catch (e) { - console.error(e); - } -})(); -``` +A delegated token is used to allow secure uploads without exposing your API key. Use this endpoint to retrieve a list of all currently active delegated tokens. +Tutorials using [delegated upload](https://api.video/blog/endpoints/delegated-upload). ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **sortBy** | **'createdAt' | 'ttl'**| Allowed: createdAt, ttl. You can use these to sort by when a token was created, or how much longer the token will be active (ttl - time to live). Date and time is presented in ISO-8601 format. | [optional] [default to undefined] [enum: createdAt, ttl] - **sortOrder** | **'asc' | 'desc'**| Allowed: asc, desc. Ascending is 0-9 or A-Z. Descending is 9-0 or Z-A. | [optional] [default to undefined] [enum: asc, desc] - **currentPage** | **number**| Choose the number of search results to return per page. Minimum value: 1 | [optional] [default to 1] - **pageSize** | **number**| Results per page. Allowed values 1-100, default is 25. | [optional] [default to 25] +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **sortBy** | **'createdAt' | 'ttl'**| Allowed: createdAt, ttl. You can use these to sort by when a token was created, or how much longer the token will be active (ttl - time to live). Date and time is presented in ISO-8601 format. | + | **sortOrder** | **'asc' | 'desc'**| Allowed: asc, desc. Ascending is 0-9 or A-Z. Descending is 9-0 or Z-A. | + | **currentPage** | **number**| Choose the number of search results to return per page. Minimum value: 1 | + | **pageSize** | **number**| Results per page. Allowed values 1-100, default is 25. | + ### Return type -[**TokenListResponse**](../model/TokenListResponse.md) -### HTTP request headers +Promise<[**TokenListResponse**](../model/TokenListResponse.md)>. + + +### Example +```js +// instantiate the client +const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); + +const uploadTokens = await client.uploadTokens.list(); + +``` + - - **Content-Type**: Not defined - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | +| **200** | Success | - | + + +--- -## **getToken** +## **`getToken` - Show upload token** -### Example -```js -(async () => { - try { - const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); - - const uploadToken = 'to1tcmSFHeYY5KzyhOqVKMKb'; // The unique identifier for the token you want information about. - - // UploadToken - const result = await client.uploadTokens.getToken(uploadToken); - console.log(result); - } catch (e) { - console.error(e); - } -})(); -``` +You can retrieve details about a specific upload token if you have the unique identifier for the upload token. Add it in the path of the endpoint. Details include time-to-live (ttl), when the token was created, and when it will expire. ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **uploadToken** | **string**| The unique identifier for the token you want information about. | [default to undefined] +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **uploadToken** | **string**| The unique identifier for the token you want information about. | + ### Return type -[**UploadToken**](../model/UploadToken.md) -### HTTP request headers +Promise<[**UploadToken**](../model/UploadToken.md)>. + + +### Example +```js +// instantiate the client +const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); + +const uploadTokenId = 'to1tcmSFHeYY5KzyhOqVKMKb'; // The unique identifier for the token you want information about. + +const uploadToken = await client.uploadTokens.getToken(uploadTokenId); +``` + - - **Content-Type**: Not defined - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | -**404** | Not Found | - | +| **200** | Success | - | +| **404** | Not Found | - | + + +--- -## **createToken** +## **`createToken` - Generate an upload token** -### Example -```js -(async () => { - try { - const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); - - const tokenCreationPayload = { - ttl: 56, // Time in seconds that the token will be active. A value of 0 means that the token has no exipration date. The default is to have no expiration. - }; - - // UploadToken - const result = await client.uploadTokens.createToken(tokenCreationPayload); - console.log(result); - } catch (e) { - console.error(e); - } -})(); -``` +Use this endpoint to generate an upload token. You can use this token to authenticate video uploads while keeping your API key safe. Tutorials using [delegated upload](https://api.video/blog/endpoints/delegated-upload). ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **tokenCreationPayload** | [**TokenCreationPayload**](../model/TokenCreationPayload.md)| | +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **tokenCreationPayload** | [**TokenCreationPayload**](../model/TokenCreationPayload.md)| | + ### Return type -[**UploadToken**](../model/UploadToken.md) -### HTTP request headers +Promise<[**UploadToken**](../model/UploadToken.md)>. + + +### Example +```js +// instantiate the client +const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); + +const tokenCreationPayload = { + ttl: 56, // Time in seconds that the token will be active. A value of 0 means that the token has no expiration date. The default is to have no expiration. +}; + +const uploadToken = await client.uploadTokens.createToken(tokenCreationPayload); +``` + - - **Content-Type**: application/json - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | -**400** | Bad Request | - | +| **200** | Success | - | +| **400** | Bad Request | - | + + +--- diff --git a/doc/api/VideosApi.md b/doc/api/VideosApi.md index 76e4f4f..c8fc32f 100644 --- a/doc/api/VideosApi.md +++ b/doc/api/VideosApi.md @@ -2,337 +2,341 @@ All URIs are relative to *https://ws.api.video* -Method | HTTP request | Description -------------- | ------------- | ------------- -[**delete**](VideosApi.md#delete) | **DELETE** /videos/{videoId} | Delete a video -[**get**](VideosApi.md#get) | **GET** /videos/{videoId} | Show a video -[**getStatus**](VideosApi.md#getStatus) | **GET** /videos/{videoId}/status | Show video status -[**list**](VideosApi.md#list) | **GET** /videos | List all videos -[**update**](VideosApi.md#update) | **PATCH** /videos/{videoId} | Update a video -[**pickThumbnail**](VideosApi.md#pickThumbnail) | **PATCH** /videos/{videoId}/thumbnail | Pick a thumbnail -[**uploadWithUploadToken**](VideosApi.md#uploadWithUploadToken) | **POST** /upload | Upload with an upload token -[**create**](VideosApi.md#create) | **POST** /videos | Create a video -[**upload**](VideosApi.md#upload) | **POST** /videos/{videoId}/source | Upload a video -[**uploadThumbnail**](VideosApi.md#uploadThumbnail) | **POST** /videos/{videoId}/thumbnail | Upload a thumbnail +| Method | Description | HTTP request | +| ------------- | ------------- | ------------- | +| [**delete**](VideosApi.md#delete) | Delete a video | **DELETE** /videos/{videoId} | +| [**get**](VideosApi.md#get) | Show a video | **GET** /videos/{videoId} | +| [**getStatus**](VideosApi.md#getStatus) | Show video status | **GET** /videos/{videoId}/status | +| [**list**](VideosApi.md#list) | List all videos | **GET** /videos | +| [**update**](VideosApi.md#update) | Update a video | **PATCH** /videos/{videoId} | +| [**pickThumbnail**](VideosApi.md#pickThumbnail) | Pick a thumbnail | **PATCH** /videos/{videoId}/thumbnail | +| [**uploadWithUploadToken**](VideosApi.md#uploadWithUploadToken) | Upload with an upload token | **POST** /upload | +| [**create**](VideosApi.md#create) | Create a video | **POST** /videos | +| [**upload**](VideosApi.md#upload) | Upload a video | **POST** /videos/{videoId}/source | +| [**uploadThumbnail**](VideosApi.md#uploadThumbnail) | Upload a thumbnail | **POST** /videos/{videoId}/thumbnail | -## **delete** +## **`delete` - Delete a video** -### Example -```js -(async () => { - try { - const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); - - const videoId = 'vi4k0jvEUuaTdRAEjQ4Jfrgz'; // The video ID for the video you want to delete. - - // void - const result = await client.videos.delete(videoId); - console.log(result); - } catch (e) { - console.error(e); - } -})(); -``` +If you do not need a video any longer, you can send a request to delete it. All you need is the videoId. ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **videoId** | **string**| The video ID for the video you want to delete. | [default to undefined] +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **videoId** | **string**| The video ID for the video you want to delete. | + ### Return type -[**void**](../model/.md) -### HTTP request headers +Promise<[**void**](../model/.md)>. + + +### Example +```js +// instantiate the client +const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); + +const videoId = 'vi4k0jvEUuaTdRAEjQ4Jfrgz'; // the id of the video to delete +await client.videos.delete(videoId); +``` + - - **Content-Type**: Not defined - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**204** | No Content | - | -**404** | Not Found | - | +| **204** | No Content | - | +| **404** | Not Found | - | + + +--- -## **get** +## **`get` - Show a video** -### Example -```js -(async () => { - try { - const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); - - const videoId = 'videoId_example'; // The unique identifier for the video you want details about. - - // Video - const result = await client.videos.get(videoId); - console.log(result); - } catch (e) { - console.error(e); - } -})(); -``` +This call provides the same information provided on video creation. For private videos, it will generate a unique token url. Use this to retrieve any details you need about a video, or set up a private viewing URL. ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **videoId** | **string**| The unique identifier for the video you want details about. | [default to undefined] +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **videoId** | **string**| The unique identifier for the video you want details about. | + ### Return type -[**Video**](../model/Video.md) -### HTTP request headers +Promise<[**Video**](../model/Video.md)>. + + +### Example +```js +// instantiate the client +const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); + +const videoId = 'vi4k0jvEUuaTdRAEjQ4Jfrgz'; // The unique identifier for the video you want the status for. +const result = await client.videos.getStatus(videoId); +``` + - - **Content-Type**: Not defined - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | -**404** | Not Found | - | +| **200** | Success | - | +| **404** | Not Found | - | + + +--- -## **getStatus** +## **`getStatus` - Show video status** -### Example -```js -(async () => { - try { - const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); - - const videoId = 'vi4k0jvEUuaTdRAEjQ4Jfrgz'; // The unique identifier for the video you want the status for. - - // VideoStatus - const result = await client.videos.getStatus(videoId); - console.log(result); - } catch (e) { - console.error(e); - } -})(); -``` +This method provides upload status & encoding status to determine when the video is uploaded or ready to playback. Once encoding is completed, the response also lists the available stream qualities. ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **videoId** | **string**| The unique identifier for the video you want the status for. | [default to undefined] +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **videoId** | **string**| The unique identifier for the video you want the status for. | + ### Return type -[**VideoStatus**](../model/VideoStatus.md) -### HTTP request headers +Promise<[**VideoStatus**](../model/VideoStatus.md)>. + + +### Example +```js +// instantiate the client +const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); + +const videoId = 'vi4k0jvEUuaTdRAEjQ4Jfrgz'; // The unique identifier for the video you want the status for. +const result = await client.videos.getStatus(videoId); +``` + - - **Content-Type**: Not defined - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | -**404** | Not Found | - | +| **200** | Success | - | +| **404** | Not Found | - | + + +--- -## **list** +## **`list` - List all videos** -### Example -```js -(async () => { - try { - const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); - - const title = 'My Video.mp4'; // The title of a specific video you want to find. The search will match exactly to what term you provide and return any videos that contain the same term as part of their titles. - const tags = '["captions", "dialogue"]'; // A tag is a category you create and apply to videos. You can search for videos with particular tags by listing one or more here. Only videos that have all the tags you list will be returned. - const metadata = 'metadata[Author]=John Doe&metadata[Format]=Tutorial'; // Videos can be tagged with metadata tags in key:value pairs. You can search for videos with specific key value pairs using this parameter. [Dynamic Metadata](https://api.video/blog/endpoints/dynamic-metadata) allows you to define a key that allows any value pair. - const description = 'New Zealand'; // If you described a video with a term or sentence, you can add it here to return videos containing this string. - const liveStreamId = 'li400mYKSgQ6xs7taUeSaEKr'; // If you know the ID for a live stream, you can retrieve the stream by adding the ID for it here. - const sortBy = 'publishedAt'; // Allowed: publishedAt, title. You can search by the time videos were published at, or by title. - const sortOrder = 'asc'; // Allowed: asc, desc. asc is ascending and sorts from A to Z. desc is descending and sorts from Z to A. - const currentPage = '2'; // Choose the number of search results to return per page. Minimum value: 1 - const pageSize = '30'; // Results per page. Allowed values 1-100, default is 25. - - // VideosListResponse - const result = await client.videos.list({ title, tags, metadata, description, liveStreamId, sortBy, sortOrder, currentPage, pageSize }) - console.log(result); - } catch (e) { - console.error(e); - } -})(); -``` +This method returns a list of your videos (with all their details). With no parameters added, the API returns the first page of all videos. You can filter videos using the parameters described below. ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **title** | **string**| The title of a specific video you want to find. The search will match exactly to what term you provide and return any videos that contain the same term as part of their titles. | [optional] [default to undefined] - **tags** | **Array<string>**| A tag is a category you create and apply to videos. You can search for videos with particular tags by listing one or more here. Only videos that have all the tags you list will be returned. | [optional] - **metadata** | **{ [key: string]: string; }**| Videos can be tagged with metadata tags in key:value pairs. You can search for videos with specific key value pairs using this parameter. [Dynamic Metadata](https://api.video/blog/endpoints/dynamic-metadata) allows you to define a key that allows any value pair. | [optional] - **description** | **string**| If you described a video with a term or sentence, you can add it here to return videos containing this string. | [optional] [default to undefined] - **liveStreamId** | **string**| If you know the ID for a live stream, you can retrieve the stream by adding the ID for it here. | [optional] [default to undefined] - **sortBy** | **string**| Allowed: publishedAt, title. You can search by the time videos were published at, or by title. | [optional] [default to undefined] - **sortOrder** | **string**| Allowed: asc, desc. asc is ascending and sorts from A to Z. desc is descending and sorts from Z to A. | [optional] [default to undefined] - **currentPage** | **number**| Choose the number of search results to return per page. Minimum value: 1 | [optional] [default to 1] - **pageSize** | **number**| Results per page. Allowed values 1-100, default is 25. | [optional] [default to 25] +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **title** | **string**| The title of a specific video you want to find. The search will match exactly to what term you provide and return any videos that contain the same term as part of their titles. | + | **tags** | **Array<string>**| A tag is a category you create and apply to videos. You can search for videos with particular tags by listing one or more here. Only videos that have all the tags you list will be returned. | + | **metadata** | **{ [key: string]: string; }**| Videos can be tagged with metadata tags in key:value pairs. You can search for videos with specific key value pairs using this parameter. [Dynamic Metadata](https://api.video/blog/endpoints/dynamic-metadata) allows you to define a key that allows any value pair. | + | **description** | **string**| If you described a video with a term or sentence, you can add it here to return videos containing this string. | + | **liveStreamId** | **string**| If you know the ID for a live stream, you can retrieve the stream by adding the ID for it here. | + | **sortBy** | **string**| Allowed: publishedAt, title. You can search by the time videos were published at, or by title. | + | **sortOrder** | **string**| Allowed: asc, desc. asc is ascending and sorts from A to Z. desc is descending and sorts from Z to A. | + | **currentPage** | **number**| Choose the number of search results to return per page. Minimum value: 1 | + | **pageSize** | **number**| Results per page. Allowed values 1-100, default is 25. | + ### Return type -[**VideosListResponse**](../model/VideosListResponse.md) -### HTTP request headers +Promise<[**VideosListResponse**](../model/VideosListResponse.md)>. + + +### Example +```js +// instantiate the client +const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); + +// list all videos (all pages) +let allVideos = []; +for(let currentPage=1 ; ; currentPage++) { + const res = await client.videos.list({ currentPage }); + allVideos = [...allVideos, ...res.data]; + if(currentPage >= res.pagination.pagesTotal) { + break; + } +} + +// list videos that have all the given tags (only first results page) +const videosWithTags = await client.videos.list({ tags: ["tag1", "tag2"] }); + +// list videos that have all the given metadata values (only first results page) +const videosWithMetadata = await client.videos.list({ metadata: { "key1": "value1", "key2": "value2" } }) +``` + - - **Content-Type**: Not defined - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | -**400** | Bad Request | - | +| **200** | Success | - | +| **400** | Bad Request | - | + + +--- -## **update** +## **`update` - Update a video** -### Example -```js -(async () => { - try { - const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); - - const videoId = 'vi4k0jvEUuaTdRAEjQ4Jfrgz'; // The video ID for the video you want to delete. - const videoUpdatePayload = { - playerId: "pl4k0jvEUuaTdRAEjQ4Jfrgz", // The unique ID for the player you want to associate with your video. - title: "title_example", // The title you want to use for your video. - description: "A film about good books.", // A brief description of the video. - _public: true, // Whether the video is publicly available or not. False means it is set to private. Default is true. Tutorials on [private videos](https://api.video/blog/endpoints/private-videos). - panoramic: false, // Whether the video is a 360 degree or immersive video. - mp4Support: true, // Whether the player supports the mp4 format. - tags: ["maths", "string theory", "video"], // A list of terms or words you want to tag the video with. Make sure the list includes all the tags you want as whatever you send in this list will overwrite the existing list for the video. - metadata: null, // 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. [Dynamic Metadata](https://api.video/blog/endpoints/dynamic-metadata) allows you to define a key that allows any value pair. - }; - - // Video - const result = await client.videos.update(videoId, videoUpdatePayload); - console.log(result); - } catch (e) { - console.error(e); - } -})(); -``` +Updates the parameters associated with your video. The video you are updating is determined by the video ID you provide. + +NOTE: If you are updating an array, you must provide the entire array as what you provide here overwrites what is in the system rather than appending to it. + ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **videoId** | **string**| The video ID for the video you want to delete. | [default to undefined] - **videoUpdatePayload** | [**VideoUpdatePayload**](../model/VideoUpdatePayload.md)| | +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **videoId** | **string**| The video ID for the video you want to delete. | + | **videoUpdatePayload** | [**VideoUpdatePayload**](../model/VideoUpdatePayload.md)| | + ### Return type -[**Video**](../model/Video.md) -### HTTP request headers +Promise<[**Video**](../model/Video.md)>. + + +### Example +```js +// instantiate the client +const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); + +const videoId = 'vi4k0jvEUuaTdRAEjQ4Jfrgz'; // The video ID for the video you want to update. + +// define the value you want to update +const videoUpdatePayload = { + playerId: "pl4k0jvEUuaTdRAEjQ4Jfrgz", // The unique ID for the player you want to associate with your video. + title: "title_example", // The title you want to use for your video. + description: "A film about good books.", // A brief description of the video. + _public: true, // Whether the video is publicly available or not. False means it is set to private. + panoramic: false, // Whether the video is a 360 degree or immersive video. + mp4Support: true, // Whether the player supports the mp4 format. + tags: ["maths", "string theory", "video"], // A list of terms or words you want to tag the video with. Make sure the list includes all the tags you want as whatever you send in this list will overwrite the existing list for the video. + metadata: [{"key": "Author", "value": "John Doe"}], // 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. +}; + + +const updatedVideo = await client.videos.update(videoId, videoUpdatePayload); +``` + - - **Content-Type**: application/json - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | -**400** | Bad Request | - | -**404** | Not Found | - | +| **200** | Success | - | +| **400** | Bad Request | - | +| **404** | Not Found | - | + + +--- -## **pickThumbnail** +## **`pickThumbnail` - Pick a thumbnail** -### Example -```js -(async () => { - try { - const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); - - const videoId = 'vi4k0jvEUuaTdRAEjQ4Jfrgz'; // Unique identifier of the video you want to add a thumbnail to, where you use a section of your video as the thumbnail. - const videoThumbnailPickPayload = { - timecode: "timecode_example", // Frame in video to be used as a placeholder before the video plays. Example: '\"00:01:00.000\" for 1 minute into the video.' Valid Patterns: \"hh:mm:ss.ms\" \"hh:mm:ss:frameNumber\" \"124\" (integer value is reported as seconds) If selection is out of range, \"00:00:00.00\" will be chosen. - }; - - // Video - const result = await client.videos.pickThumbnail(videoId, videoThumbnailPickPayload); - console.log(result); - } catch (e) { - console.error(e); - } -})(); -``` +Pick a thumbnail from the given time code. + +If you'd like to upload an image for your thumbnail, use the dedicated [method](#uploadThumbnail). + +There may be a short delay for the thumbnail to update. + ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **videoId** | **string**| Unique identifier of the video you want to add a thumbnail to, where you use a section of your video as the thumbnail. | [default to undefined] - **videoThumbnailPickPayload** | [**VideoThumbnailPickPayload**](../model/VideoThumbnailPickPayload.md)| | +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **videoId** | **string**| Unique identifier of the video you want to add a thumbnail to, where you use a section of your video as the thumbnail. | + | **videoThumbnailPickPayload** | [**VideoThumbnailPickPayload**](../model/VideoThumbnailPickPayload.md)| | + ### Return type -[**Video**](../model/Video.md) -### HTTP request headers +Promise<[**Video**](../model/Video.md)>. + + +### Example +```js +// instantiate the client +const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); + +const videoId = 'vi4k0jvEUuaTdRAEjQ4Jfrgz'; // Unique identifier of the video you want to add a thumbnail to, where you use a section of your video as the thumbnail. +const videoThumbnailPickPayload = { + timecode: "00:01:00.000", // Frame in video to be used as a placeholder before the video plays. +}; + +const video = await client.videos.pickThumbnail(videoId, videoThumbnailPickPayload); +``` + - - **Content-Type**: application/json - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | -**404** | Not Found | - | +| **200** | Success | - | +| **404** | Not Found | - | + + +--- -## **uploadWithUploadToken** +## **`uploadWithUploadToken` - Upload with an upload token** + + +This method allows you to send a video using an upload token. Upload tokens are especially useful when the upload is done from the client side. If you want to upload a video from your server-side application, you'd better use the [standard upload method](#upload). + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **token** | **string**| The unique identifier for the token you want to use to upload a video. | + | **file** | **string**| The path to the video you want to upload. | +| **progressListener?** | **(event: UploadProgressEvent) => void \| undefined** | Optional upload progress listener | + +### Return type + +Promise<[**Video**](../model/Video.md)>. ### Example ```js -(async () => { - try { - const client = new ApiVideoClient(); - - const token = 'to1tcmSFHeYY5KzyhOqVKMKb'; // The unique identifier for the token you want to use to upload a video. - const file = 'BINARY_DATA_HERE'; // The path to the video you want to upload. - - // Video - const result = await client.videos.uploadWithUploadToken(token, file); - console.log(result); - } catch (e) { - console.error(e); - } -})(); -``` +// NOTE: Upload tokens are especially useful when the upload is done from the client side. +// The following example show how to do it from the backend, but you should rather use the standard upload method in this case. -### Parameters +// instantiate the client +const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); + +const token = 'to4k0jvEUuaTdRAEjQ4Jfrgz'; // Enter the unique identifier for the token you want to use to upload a video. +const file = './my-video.mp4'; // The path to the video you would like to upload. The path must be local. If you want to use a video from an online source, you must use the "/videos" endpoint and add the "source" parameter when you create a new video. + +const video = await client.videos.uploadWithUploadToken(token, file); +``` -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **token** | **string**| The unique identifier for the token you want to use to upload a video. | [default to undefined] - **file** | **string**| The path to the video you want to upload. | [default to undefined] -**progressListener?** | **(event: UploadProgressEvent) => void \| undefined** | Optional upload progress listener | [default to undefined] ### Upload chunks Large files are broken into chunks for upload. You can control the size of the chunks using the `chunkSize` parameter when you instanciate the ApiVideoClient: ```js - const client = new ApiVideoClient({ - apiKey: "YOUR_API_TOKEN", - chunkSize: 50 * 1024 * 1024, // 50mb chunks - }); +const client = new ApiVideoClient({ + apiKey: "YOUR_API_TOKEN", + chunkSize: 50 * 1024 * 1024, // 50mb chunks +}); ``` ### Progressive uploads @@ -341,131 +345,159 @@ Progressive uploads make it possible to upload a video source "progressively," i The last chunk is sent by calling a different method, so api.video knows that it is time to reassemble the different chunks that were received. ```js -(async () => { -try { - const client = new ApiVideoClient(); - const token = 'to1tcmSFHeYY5KzyhOqVKMKb'; // The unique identifier for the token you want to use to upload a video. - - const uploadSession = client.createUploadWithUploadTokenProgressiveSession(token); - - await uploadSession.uploadPart('test/data/10m.mp4.part.a'); - await uploadSession.uploadPart('test/data/10m.mp4.part.b'); - const res = await uploadSession.uploadLastPart('test/data/10m.mp4.part.c'); // Video - - console.log(result); - } catch (e) { - console.error(e); - } -})(); -``` +const client = new ApiVideoClient(); -### Return type -[**Video**](../model/Video.md) +const token = 'to1tcmSFHeYY5KzyhOqVKMKb'; // The unique identifier for the token you want to use to upload a video. + +const uploadSession = client.createUploadWithUploadTokenProgressiveSession(token); -### HTTP request headers +await uploadSession.uploadPart('test/data/10m.mp4.part.a'); +await uploadSession.uploadPart('test/data/10m.mp4.part.b'); +const res = await uploadSession.uploadLastPart('test/data/10m.mp4.part.c'); // Video - - **Content-Type**: multipart/form-data - - **Accept**: application/json +console.log(result); +``` ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**201** | Created | - | -**400** | Bad Request | - | +| **201** | Created | - | +| **400** | Bad Request | - | + + +--- -## **create** +## **`create` - Create a video** -### Example -```js -(async () => { - try { - const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); - - const videoCreationPayload = { - title: "Maths video", // The title of your new video. - description: "A video about string theory.", // A brief description of your video. - source: "https://www.myvideo.url.com/video.mp4 OR vi4k0jvEUuaTdRAEjQ4JfOyl", // You can either add a video already on the web, by entering the URL of the video, or you can also enter the `videoId` of one of the videos you already have on your api.video acccount, and this will generate a copy of your video. Creating a copy of a video can be especially useful if you want to keep your original video and trim or apply a watermark onto the copy you would create. - _public: true, // Whether your video can be viewed by everyone, or requires authentication to see it. A setting of false will require a unique token for each view. Default is true. Tutorials on [private videos](https://api.video/blog/endpoints/private-videos). - panoramic: false, // Indicates if your video is a 360/immersive video. - mp4Support: true, // Enables mp4 version in addition to streamed version. - playerId: "pl45KFKdlddgk654dspkze", // The unique identification number for your video player. - tags: ["maths", "string theory", "video"], // A list of tags you want to use to describe your video. - metadata: [{"key": "Author", "value": "John Doe"}], // A list of key value pairs that you use to provide metadata for your video. These pairs can be made dynamic, allowing you to segment your audience. Read more on [dynamic metadata](https://api.video/blog/endpoints/dynamic-metadata). - clip: null, - watermark: null, - }; - - // Video - const result = await client.videos.create(videoCreationPayload); - console.log(result); - } catch (e) { - console.error(e); - } -})(); -``` +We have tutorials on: +* [Creating and uploading videos](https://api.video/blog/tutorials/video-upload-tutorial) +* [Uploading large videos](https://api.video/blog/tutorials/video-upload-tutorial-large-videos) +* [Using tags with videos](https://api.video/blog/tutorials/video-tagging-best-practices) +* [Private videos](https://api.video/blog/tutorials/tutorial-private-videos) +* [Using Dynamic Metadata](https://api.video/blog/tutorials/dynamic-metadata) + +* Full list of [tutorials](https://api.video/blog/endpoints/video-create) that demonstrate this endpoint. + ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **videoCreationPayload** | [**VideoCreationPayload**](../model/VideoCreationPayload.md)| video to create | +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **videoCreationPayload** | [**VideoCreationPayload**](../model/VideoCreationPayload.md)| video to create | + ### Return type -[**Video**](../model/Video.md) -### HTTP request headers +Promise<[**Video**](../model/Video.md)>. + + +### Example +```js +// instantiate the client +const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); + +// create a simple video +const video = await client.videos.create({ title: "Maths video" }); + +// create a video using an existing source +const existingSourceVideo = await client.videos.create({ + title: "Video using an existing source", + source: "https://www.myvideo.url.com/video.mp4", +}); + +// create a private video +const privateVideo = await client.videos.create({ + title: "Video using an existing source", + _public: false, +}); + +// create a video using all available attributes +const video = await client.videos.create({ + title: "Maths video", // The title of your new video. + description: "A video about string theory.", // A brief description of your video. + source: "https://www.myvideo.url.com/video.mp4", // If you add a video already on the web, this is where you enter the url for the video. + _public: true, // Whether your video can be viewed by everyone, or requires authentication to see it. A setting of false will require a unique token for each view. + panoramic: false, // Indicates if your video is a 360/immersive video. + mp4Support: true, // Enables mp4 version in addition to streamed version. + playerId: "pl45KFKdlddgk654dspkze", // The unique identification number for your video player. + tags: ["maths", "string theory", "video"], // A list of tags you want to use to describe your video. + metadata: [{"key": "Author", "value": "John Doe"}], // A list of key value pairs that you use to provide metadata for your video. These pairs can be made dynamic, allowing you to segment your audience. You can also just use the pairs as another way to tag and categorize your videos. +}); +``` + - - **Content-Type**: application/json - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**201** | Created | - | -**202** | Accepted | - | -**400** | Bad Request | - | +| **201** | Created | - | +| **202** | Accepted | - | +| **400** | Bad Request | - | + + +--- -## **upload** +## **`upload` - Upload a video** + + +To upload a video to the videoId you created. You can only upload your video to the videoId once. + +We offer 2 types of upload: +* Regular upload +* Progressive upload +The latter allows you to split a video source into X chunks and send those chunks independently (concurrently or sequentially). The 2 main goals for our users are to + * allow the upload of video sources > 200 MiB (200 MiB = the max. allowed file size for regular upload) + * allow to send a video source "progressively", i.e., before before knowing the total size of the video. + Once all chunks have been sent, they are reaggregated to one source file. The video source is considered as "completely sent" when the "last" chunk is sent (i.e., the chunk that "completes" the upload). + + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **videoId** | **string**| Enter the videoId you want to use to upload your video. | + | **file** | **string**| The path to the video you would like to upload. The path must be local. If you want to use a video from an online source, you must use the \\\"/videos\\\" endpoint and add the \\\"source\\\" parameter when you create a new video. | +| **progressListener?** | **(event: UploadProgressEvent) => void \| undefined** | Optional upload progress listener | + +### Return type + +Promise<[**Video**](../model/Video.md)>. ### Example ```js -(async () => { - try { - const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); - - const videoId = 'vi4k0jvEUuaTdRAEjQ4Jfrgz'; // Enter the videoId you want to use to upload your video. - const file = 'BINARY_DATA_HERE'; // The path to the video you would like to upload. The path must be local. If you want to use a video from an online source, you must use the \\\"/videos\\\" endpoint and add the \\\"source\\\" parameter when you create a new video. - - // Video - const result = await client.videos.upload(videoId, file); - console.log(result); - } catch (e) { - console.error(e); - } -})(); +// instantiate the client +const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); + +const videoId = 'vi4k0jvEUuaTdRAEjQ4Jfrgz'; // Enter the videoId you want to use to upload your video. +const file = './my-video.mp4'; // The path to the video you would like to upload. The path must be local. If you want to use a video from an online source, you must use the "/videos" endpoint and add the "source" parameter when you create a new video. + +const video = await client.videos.upload(videoId, file); + +// if needed you can define an upload progress listener: +const video2 = await client.videos.upload(videoId, file, (event) => { + console.log("uploadedBytes: " + event.uploadedBytes); + console.log("totalBytes: " + event.totalBytes); + console.log("chunksCount: " + event.chunksCount); + console.log("currentChunk: " + event.currentChunk); + console.log("currentChunkTotalBytes: " + event.currentChunkTotalBytes); + console.log("currentChunkUploadedBytes: " + event.currentChunkUploadedBytes); +}); ``` -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **videoId** | **string**| Enter the videoId you want to use to upload your video. | [default to undefined] - **file** | **string**| The path to the video you would like to upload. The path must be local. If you want to use a video from an online source, you must use the \\\"/videos\\\" endpoint and add the \\\"source\\\" parameter when you create a new video. | [default to undefined] -**progressListener?** | **(event: UploadProgressEvent) => void \| undefined** | Optional upload progress listener | [default to undefined] ### Upload chunks Large files are broken into chunks for upload. You can control the size of the chunks using the `chunkSize` parameter when you instanciate the ApiVideoClient: ```js - const client = new ApiVideoClient({ - apiKey: "YOUR_API_TOKEN", - chunkSize: 50 * 1024 * 1024, // 50mb chunks - }); +const client = new ApiVideoClient({ + apiKey: "YOUR_API_TOKEN", + chunkSize: 50 * 1024 * 1024, // 50mb chunks +}); ``` ### Progressive uploads @@ -474,82 +506,74 @@ Progressive uploads make it possible to upload a video source "progressively," i The last chunk is sent by calling a different method, so api.video knows that it is time to reassemble the different chunks that were received. ```js -(async () => { -try { - - const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); - - const videoId = 'vi4k0jvEUuaTdRAEjQ4Jfrgz'; // Enter the videoId you want to use to upload your video. - - const uploadSession = client.createUploadProgressiveSession(videoId); - - await uploadSession.uploadPart('test/data/10m.mp4.part.a'); - await uploadSession.uploadPart('test/data/10m.mp4.part.b'); - const res = await uploadSession.uploadLastPart('test/data/10m.mp4.part.c'); // Video - - console.log(result); - } catch (e) { - console.error(e); - } -})(); -``` +const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); -### Return type -[**Video**](../model/Video.md) +const videoId = 'vi4k0jvEUuaTdRAEjQ4Jfrgz'; // Enter the videoId you want to use to upload your video. -### HTTP request headers +const uploadSession = client.createUploadProgressiveSession(videoId); - - **Content-Type**: multipart/form-data - - **Accept**: application/json +await uploadSession.uploadPart('test/data/10m.mp4.part.a'); +await uploadSession.uploadPart('test/data/10m.mp4.part.b'); +const res = await uploadSession.uploadLastPart('test/data/10m.mp4.part.c'); // Video + +console.log(result); +``` ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**201** | Created | - | -**400** | Bad Request | - | -**404** | Not Found | - | +| **201** | Created | - | +| **400** | Bad Request | - | +| **404** | Not Found | - | + + +--- -## **uploadThumbnail** +## **`uploadThumbnail` - Upload a thumbnail** -### Example -```js -(async () => { - try { - const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); - - const videoId = 'videoId_example'; // Unique identifier of the chosen video - const file = 'BINARY_DATA_HERE'; // The image to be added as a thumbnail. The mime type should be image/jpeg, image/png or image/webp. The max allowed size is 8 MiB. - - // Video - const result = await client.videos.uploadThumbnail(videoId, file); - console.log(result); - } catch (e) { - console.error(e); - } -})(); -``` +The thumbnail is the poster that appears in the player window before video playback begins. + +This endpoint allows you to upload an image for the thumbnail. + +To select a still frame from the video using a time stamp, use the [dedicated method](#pickThumbnail) to pick a time in the video. + +Note: There may be a short delay before the new thumbnail is delivered to our CDN. ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **videoId** | **string**| Unique identifier of the chosen video | [default to undefined] - **file** | **string**| The image to be added as a thumbnail. The mime type should be image/jpeg, image/png or image/webp. The max allowed size is 8 MiB. | [default to undefined] +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **videoId** | **string**| Unique identifier of the chosen video | + | **file** | **string**| The image to be added as a thumbnail. The mime type should be image/jpeg, image/png or image/webp. The max allowed size is 8 MiB. | + ### Return type -[**Video**](../model/Video.md) -### HTTP request headers +Promise<[**Video**](../model/Video.md)>. + + +### Example +```js +// instantiate the client +const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); + +const videoId = 'videoId_example'; // Unique identifier of the chosen video +const file = './thumbnail.jpg'; // The image to be added as a thumbnail. + +const video = await client.videos.uploadThumbnail(videoId, file); +``` + - - **Content-Type**: multipart/form-data - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | -**400** | Bad Request | - | -**404** | Not Found | - | +| **200** | Success | - | +| **400** | Bad Request | - | +| **404** | Not Found | - | + + +--- diff --git a/doc/api/WatermarksApi.md b/doc/api/WatermarksApi.md index fa9214e..8edaaec 100644 --- a/doc/api/WatermarksApi.md +++ b/doc/api/WatermarksApi.md @@ -2,139 +2,144 @@ All URIs are relative to *https://ws.api.video* -Method | HTTP request | Description -------------- | ------------- | ------------- -[**delete**](WatermarksApi.md#delete) | **DELETE** /watermarks/{watermarkId} | Delete a watermark -[**list**](WatermarksApi.md#list) | **GET** /watermarks | List all watermarks -[**upload**](WatermarksApi.md#upload) | **POST** /watermarks | Upload a watermark +| Method | Description | HTTP request | +| ------------- | ------------- | ------------- | +| [**delete**](WatermarksApi.md#delete) | Delete a watermark | **DELETE** /watermarks/{watermarkId} | +| [**list**](WatermarksApi.md#list) | List all watermarks | **GET** /watermarks | +| [**upload**](WatermarksApi.md#upload) | Upload a watermark | **POST** /watermarks | -## **delete** +## **`delete` - Delete a watermark** -### Example -```js -(async () => { - try { - const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); - - const watermarkId = 'watermark_1BWr2L5MTQwxGkuxKjzh6i'; // The watermark ID for the watermark you want to delete. - - // void - const result = await client.watermarks.delete(watermarkId); - console.log(result); - } catch (e) { - console.error(e); - } -})(); -``` +Delete a watermark. A watermark is a static image, directly burnt-into a video. ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **watermarkId** | **string**| The watermark ID for the watermark you want to delete. | [default to undefined] +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **watermarkId** | **string**| The watermark ID for the watermark you want to delete. | + ### Return type -[**void**](../model/.md) -### HTTP request headers +Promise<[**void**](../model/.md)>. + + +### Example +```js +// instantiate the client +const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); + +const watermarkId = 'watermark_1Bji68oeAAwR44dAb5ZhML'; // The watermark ID for the watermark you want to delete. + +client.watermarks.delete(watermarkId); +``` + - - **Content-Type**: Not defined - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**204** | No Content | - | -**404** | Not Found | - | +| **204** | No Content | - | +| **404** | Not Found | - | + + +--- -## **list** +## **`list` - List all watermarks** -### Example -```js -(async () => { - try { - const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); - - const sortBy = 'createdAt'; // Allowed: createdAt. You can search by the time watermark were created at. - const sortOrder = 'asc'; // Allowed: asc, desc. asc is ascending and sorts from A to Z. desc is descending and sorts from Z to A. - const currentPage = '2'; // Choose the number of search results to return per page. Minimum value: 1 - const pageSize = '30'; // Results per page. Allowed values 1-100, default is 25. - - // WatermarksListResponse - const result = await client.watermarks.list({ sortBy, sortOrder, currentPage, pageSize }) - console.log(result); - } catch (e) { - console.error(e); - } -})(); -``` +List all watermarks. A watermark is a static image, directly burnt into a video. After you have created your watermark, you can define its placement and aspect when you [create a video](https://docs.api.video/reference/post-video). ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **sortBy** | **string**| Allowed: createdAt. You can search by the time watermark were created at. | [optional] [default to undefined] - **sortOrder** | **string**| Allowed: asc, desc. asc is ascending and sorts from A to Z. desc is descending and sorts from Z to A. | [optional] [default to undefined] - **currentPage** | **number**| Choose the number of search results to return per page. Minimum value: 1 | [optional] [default to 1] - **pageSize** | **number**| Results per page. Allowed values 1-100, default is 25. | [optional] [default to 25] +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **sortBy** | **string**| Allowed: createdAt. You can search by the time watermark were created at. | + | **sortOrder** | **string**| Allowed: asc, desc. asc is ascending and sorts from A to Z. desc is descending and sorts from Z to A. | + | **currentPage** | **number**| Choose the number of search results to return per page. Minimum value: 1 | + | **pageSize** | **number**| Results per page. Allowed values 1-100, default is 25. | + ### Return type -[**WatermarksListResponse**](../model/WatermarksListResponse.md) -### HTTP request headers +Promise<[**WatermarksListResponse**](../model/WatermarksListResponse.md)>. + + +### Example +```js +// instantiate the client +const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); + +// retrieve the first page of all watermarks +const watermarks = await client.watermarks.list({}); + +// retrieve the 5 first watermarks, ordered by creation date +const watermarks2 = await client.watermarks.list({}); +createdAt +``` + - - **Content-Type**: Not defined - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | -**400** | Bad Request | - | +| **200** | Success | - | +| **400** | Bad Request | - | + + +--- -## **upload** +## **`upload` - Upload a watermark** -### Example -```js -(async () => { - try { - const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); - - const file = 'BINARY_DATA_HERE'; // The `.jpg` or `.png` image to be added as a watermark. - - // Watermark - const result = await client.watermarks.upload(file); - console.log(result); - } catch (e) { - console.error(e); - } -})(); -``` +Create a new watermark by uploading a `JPG` or a `PNG` image. A watermark is a static image, directly burnt into a video. After you have created your watermark, you can define its placement and aspect when you [create a video](https://docs.api.video/reference/post-video). ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **file** | **string**| The `.jpg` or `.png` image to be added as a watermark. | [default to undefined] +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **file** | **string**| The `.jpg` or `.png` image to be added as a watermark. | + ### Return type -[**Watermark**](../model/Watermark.md) -### HTTP request headers +Promise<[**Watermark**](../model/Watermark.md)>. + + +### Example +```js +// instantiate the client +const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); + +// Upload a watermark +const watermark = await client.watermarks.upload('test/data/test.jpg'); + +// create a video with watermark +const watermarkVideo = await client.videos.create({ + title: 'Nodejs - watermark', + watermark: { + id: watermark.watermarkId, + top: '0px', + left: '0px', + width: '100px', + height: '100px', + }, +}); +``` + - - **Content-Type**: multipart/form-data - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | -**400** | Bad Request | - | +| **200** | Success | - | +| **400** | Bad Request | - | + + +--- diff --git a/doc/api/WebhooksApi.md b/doc/api/WebhooksApi.md index b643cb3..678bdc4 100644 --- a/doc/api/WebhooksApi.md +++ b/doc/api/WebhooksApi.md @@ -2,20 +2,37 @@ All URIs are relative to *https://ws.api.video* -Method | HTTP request | Description -------------- | ------------- | ------------- -[**delete**](WebhooksApi.md#delete) | **DELETE** /webhooks/{webhookId} | Delete a Webhook -[**get**](WebhooksApi.md#get) | **GET** /webhooks/{webhookId} | Show Webhook details -[**list**](WebhooksApi.md#list) | **GET** /webhooks | List all webhooks -[**create**](WebhooksApi.md#create) | **POST** /webhooks | Create Webhook +| Method | Description | HTTP request | +| ------------- | ------------- | ------------- | +| [**delete**](WebhooksApi.md#delete) | Delete a Webhook | **DELETE** /webhooks/{webhookId} | +| [**get**](WebhooksApi.md#get) | Show Webhook details | **GET** /webhooks/{webhookId} | +| [**list**](WebhooksApi.md#list) | List all webhooks | **GET** /webhooks | +| [**create**](WebhooksApi.md#create) | Create Webhook | **POST** /webhooks | -## **delete** +## **`delete` - Delete a Webhook** + + +This endpoint will delete the indicated webhook. + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **webhookId** | **string**| The webhook you wish to delete. | + + +### Return type + +Promise<[**void**](../model/.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); @@ -31,32 +48,40 @@ Method | HTTP request | Description })(); ``` -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **webhookId** | **string**| The webhook you wish to delete. | [default to undefined] - -### Return type -[**void**](../model/.md) - -### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**204** | No Content | - | -**404** | Not Found | - | +| **204** | No Content | - | +| **404** | Not Found | - | + + +--- -## **get** +## **`get` - Show Webhook details** + + +This call provides the same JSON information provided on Webjhook creation. + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **webhookId** | **string**| The unique webhook you wish to retreive details on. | + + +### Return type + +Promise<[**Webhook**](../model/Webhook.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); @@ -72,31 +97,41 @@ Name | Type | Description | Notes })(); ``` -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **webhookId** | **string**| The unique webhook you wish to retreive details on. | [default to undefined] - -### Return type -[**Webhook**](../model/Webhook.md) - -### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | +| **200** | Success | - | + + +--- -## **list** +## **`list` - List all webhooks** + + +Requests to this endpoint return a list of your webhooks (with all their details). You can filter what the webhook list that the API returns using the parameters described below. + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **events** | **string**| The webhook event that you wish to filter on. | + | **currentPage** | **number**| Choose the number of search results to return per page. Minimum value: 1 | + | **pageSize** | **number**| Results per page. Allowed values 1-100, default is 25. | + + +### Return type + +Promise<[**WebhooksListResponse**](../model/WebhooksListResponse.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); @@ -114,41 +149,51 @@ Name | Type | Description | Notes })(); ``` -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **events** | **string**| The webhook event that you wish to filter on. | [optional] [default to undefined] - **currentPage** | **number**| Choose the number of search results to return per page. Minimum value: 1 | [optional] [default to 1] - **pageSize** | **number**| Results per page. Allowed values 1-100, default is 25. | [optional] [default to 25] - -### Return type -[**WebhooksListResponse**](../model/WebhooksListResponse.md) - -### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Success | - | +| **200** | Success | - | + + +--- -## **create** +## **`create` - Create Webhook** + + +Webhooks can push notifications to your server, rather than polling api.video for changes. We currently offer four events: +* ```video.encoding.quality.completed``` Occurs when a new video is uploaded into your account, it will be encoded into several different HLS and mp4 qualities. When each version is encoded, your webhook will get a notification. It will look like ```{ \"type\": \"video.encoding.quality.completed\", \"emittedAt\": \"2021-01-29T16:46:25.217+01:00\", \"videoId\": \"viXXXXXXXX\", \"encoding\": \"hls\", \"quality\": \"720p\"} ```. This request says that the 720p HLS encoding was completed. +* ```live-stream.broadcast.started``` When a live stream begins broadcasting, the broadcasting parameter changes from false to true, and this webhook fires. +* ```live-stream.broadcast.ended``` This event fires when the live stream has finished broadcasting, and the broadcasting parameter flips from false to true. +* ```video.source.recorded``` This event occurs when a live stream is recorded and submitted for encoding. + +### Parameters + +| Name | Type | Description | +| ------------- | ------------- | ------------- | + | **webhooksCreationPayload** | [**WebhooksCreationPayload**](../model/WebhooksCreationPayload.md)| | + + +### Return type + +Promise<[**Webhook**](../model/Webhook.md)>. ### Example ```js +//install the module with npm or yarn +//npm install @api.video/nodejs-client --save +//yarn add @api.video/nodejs-client (async () => { try { const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" }); const webhooksCreationPayload = { - events: ["video.encoding.quality.completed"], // A list of the webhooks that you are subscribing to. There are Currently four webhook options: * ```video.encoding.quality.completed``` When a new video is uploaded into your account, it will be encoded into several different HLS sizes/bitrates. When each version is encoded, your webhook will get a notification. It will look like ```{ \\\"type\\\": \\\"video.encoding.quality.completed\\\", \\\"emittedAt\\\": \\\"2021-01-29T16:46:25.217+01:00\\\", \\\"videoId\\\": \\\"viXXXXXXXX\\\", \\\"encoding\\\": \\\"hls\\\", \\\"quality\\\": \\\"720p\\\"} ```. This request says that the 720p HLS encoding was completed. * ```live-stream.broadcast.started``` When a livestream begins broadcasting, the broadcasting parameter changes from false to true, and this webhook fires. * ```live-stream.broadcast.ended``` This event fores when the livestream has finished broadcasting, and the broadcasting parameter flips from false to true. * ```video.source.recorded``` This event is similar to ```video.encoding.quality.completed```, but tells you if a livestream has been recorded as a VOD. - url: "https://example.com/webhooks", // The the url to which HTTP notifications are sent. It could be any http or https URL. - }; + events: ["video.encoding.quality.completed"], // A list of the webhooks that you are subscribing to. There are Currently four webhook options: * ```video.encoding.quality.completed``` Occurs when a new video is uploaded into your account, it will be encoded into several different HLS and mp4 qualities. When each version is encoded, your webhook will get a notification. It will look like ```{ "type": "video.encoding.quality.completed", "emittedAt": "2021-01-29T16:46:25.217+01:00", "videoId": "viXXXXXXXX", "encoding": "hls", "quality": "720p"} ```. This request says that the 720p HLS encoding was completed. * ```live-stream.broadcast.started``` When a lives tream begins broadcasting, the broadcasting parameter changes from false to true, and this webhook fires. * ```live-stream.broadcast.ended``` This event fires when the live stream has finished broadcasting, and the broadcasting parameter flips from false to true. * ```video.source.recorded``` Occurs when a live stream is recorded and submitted for encoding. + url: "https://example.com/webhooks", // The url to which HTTP notifications are sent. It could be any http or https URL. + }; // Webhook const result = await client.webhooks.create(webhooksCreationPayload); @@ -159,23 +204,14 @@ Name | Type | Description | Notes })(); ``` -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **webhooksCreationPayload** | [**WebhooksCreationPayload**](../model/WebhooksCreationPayload.md)| | - -### Return type -[**Webhook**](../model/Webhook.md) - -### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**201** | Created | - | -**400** | Bad Request | - | +| **201** | Created | - | +| **400** | Bad Request | - | + + +--- diff --git a/doc/model/WebhooksCreationPayload.md b/doc/model/WebhooksCreationPayload.md index 637af29..4d3a409 100644 --- a/doc/model/WebhooksCreationPayload.md +++ b/doc/model/WebhooksCreationPayload.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**events** | **Array<string>** | A list of the webhooks that you are subscribing to. There are Currently four webhook options: * ```video.encoding.quality.completed``` When a new video is uploaded into your account, it will be encoded into several different HLS sizes/bitrates. When each version is encoded, your webhook will get a notification. It will look like ```{ \\\"type\\\": \\\"video.encoding.quality.completed\\\", \\\"emittedAt\\\": \\\"2021-01-29T16:46:25.217+01:00\\\", \\\"videoId\\\": \\\"viXXXXXXXX\\\", \\\"encoding\\\": \\\"hls\\\", \\\"quality\\\": \\\"720p\\\"} ```. This request says that the 720p HLS encoding was completed. * ```live-stream.broadcast.started``` When a livestream begins broadcasting, the broadcasting parameter changes from false to true, and this webhook fires. * ```live-stream.broadcast.ended``` This event fores when the livestream has finished broadcasting, and the broadcasting parameter flips from false to true. * ```video.source.recorded``` This event is similar to ```video.encoding.quality.completed```, but tells you if a livestream has been recorded as a VOD. | +**events** | **Array<string>** | A list of the webhooks that you are subscribing to. There are Currently four webhook options: * ```video.encoding.quality.completed``` Occurs when a new video is uploaded into your account, it will be encoded into several different HLS and mp4 qualities. When each version is encoded, your webhook will get a notification. It will look like ```{ \\\"type\\\": \\\"video.encoding.quality.completed\\\", \\\"emittedAt\\\": \\\"2021-01-29T16:46:25.217+01:00\\\", \\\"videoId\\\": \\\"viXXXXXXXX\\\", \\\"encoding\\\": \\\"hls\\\", \\\"quality\\\": \\\"720p\\\"} ```. This request says that the 720p HLS encoding was completed. * ```live-stream.broadcast.started``` When a live stream begins broadcasting, the broadcasting parameter changes from false to true, and this webhook fires. * ```live-stream.broadcast.ended``` This event fires when the live stream has finished broadcasting, and the broadcasting parameter flips from false to true. * ```video.source.recorded``` Occurs when a live stream is recorded and submitted for encoding. | **url** | **string** | The the url to which HTTP notifications are sent. It could be any http or https URL. | diff --git a/package-lock.json b/package-lock.json index fcc0699..6af4ec6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -294,9 +294,9 @@ "integrity": "sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==" }, "node_modules/@types/json-schema": { - "version": "7.0.10", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.10.tgz", - "integrity": "sha512-BLO9bBq59vW3fxCpD4o0N4U+DXsvwvIcl+jofw0frQo/GrBFC+/jRZj1E7kgp6dvTyNmA4y6JCV5Id/r3mNP5A==", + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", "dev": true }, "node_modules/@types/json5": { @@ -1905,13 +1905,13 @@ } }, "node_modules/micromatch": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", - "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", "dev": true, "dependencies": { - "braces": "^3.0.1", - "picomatch": "^2.2.3" + "braces": "^3.0.2", + "picomatch": "^2.3.1" }, "engines": { "node": ">=8.6" @@ -2265,9 +2265,9 @@ } }, "node_modules/prettier": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.6.0.tgz", - "integrity": "sha512-m2FgJibYrBGGgQXNzfd0PuDGShJgRavjUoRCw1mZERIWVSXF0iLzLm+aOqTAbLnC3n6JzUhAA8uZnFVghHJ86A==", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.6.1.tgz", + "integrity": "sha512-8UVbTBYGwN37Bs9LERmxCPjdvPxlEowx2urIL6urHzdb3SDq4B/Z6xLFCblrSnE4iKWcS6ziJ3aOYrc1kz/E2A==", "dev": true, "bin": { "prettier": "bin-prettier.js" @@ -3180,9 +3180,9 @@ "integrity": "sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==" }, "@types/json-schema": { - "version": "7.0.10", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.10.tgz", - "integrity": "sha512-BLO9bBq59vW3fxCpD4o0N4U+DXsvwvIcl+jofw0frQo/GrBFC+/jRZj1E7kgp6dvTyNmA4y6JCV5Id/r3mNP5A==", + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", "dev": true }, "@types/json5": { @@ -4352,13 +4352,13 @@ "dev": true }, "micromatch": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", - "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", "dev": true, "requires": { - "braces": "^3.0.1", - "picomatch": "^2.2.3" + "braces": "^3.0.2", + "picomatch": "^2.3.1" } }, "mime-db": { @@ -4610,9 +4610,9 @@ "dev": true }, "prettier": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.6.0.tgz", - "integrity": "sha512-m2FgJibYrBGGgQXNzfd0PuDGShJgRavjUoRCw1mZERIWVSXF0iLzLm+aOqTAbLnC3n6JzUhAA8uZnFVghHJ86A==", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.6.1.tgz", + "integrity": "sha512-8UVbTBYGwN37Bs9LERmxCPjdvPxlEowx2urIL6urHzdb3SDq4B/Z6xLFCblrSnE4iKWcS6ziJ3aOYrc1kz/E2A==", "dev": true }, "prettier-linter-helpers": { diff --git a/src/api/VideosApi.ts b/src/api/VideosApi.ts index 5948c3d..e673c75 100644 --- a/src/api/VideosApi.ts +++ b/src/api/VideosApi.ts @@ -45,7 +45,7 @@ export default class VideosApi { } /** - * If you do not need a video any longer, you can send a request to delete it. All you need is the videoId. Tutorials using [video deletion](https://api.video/blog/endpoints/video-delete). + * If you do not need a video any longer, you can send a request to delete it. All you need is the videoId. * Delete a video * @param videoId The video ID for the video you want to delete. */ @@ -80,7 +80,7 @@ export default class VideosApi { } /** - * This call provides the same JSON information provided on video creation. For private videos, it will generate a unique token url. Use this to retrieve any details you need about a video, or set up a private viewing URL. Tutorials using [video GET](https://api.video/blog/endpoints/video-get). + * This call provides the same information provided on video creation. For private videos, it will generate a unique token url. Use this to retrieve any details you need about a video, or set up a private viewing URL. * Show a video * @param videoId The unique identifier for the video you want details about. */ @@ -115,7 +115,7 @@ export default class VideosApi { } /** - * This API provides upload status & encoding status to determine when the video is uploaded or ready to playback. Once encoding is completed, the response also lists the available stream qualities. Tutorials using [video status](https://api.video/blog/endpoints/video-status). + * This method provides upload status & encoding status to determine when the video is uploaded or ready to playback. Once encoding is completed, the response also lists the available stream qualities. * Show video status * @param videoId The unique identifier for the video you want the status for. */ @@ -150,7 +150,7 @@ export default class VideosApi { } /** - * Requests to this endpoint return a list of your videos (with all their details). With no parameters added to this query, the API returns all videos. You can filter what videos the API returns using the parameters described below. We have [several tutorials](https://api.video/blog/endpoints/video-list) that demonstrate this endpoint. + * This method returns a list of your videos (with all their details). With no parameters added, the API returns the first page of all videos. You can filter videos using the parameters described below. * List all videos * @param {Object} searchParams * @param { string } searchParams.title The title of a specific video you want to find. The search will match exactly to what term you provide and return any videos that contain the same term as part of their titles. @@ -276,10 +276,13 @@ export default class VideosApi { } /** - * Use this endpoint to update the parameters associated with your video. The video you are updating is determined by the video ID you provide in the path. For each parameter you want to update, include the update in the request body. NOTE: If you are updating an array, you must provide the entire array as what you provide here overwrites what is in the system rather than appending to it. Tutorials using [video update](https://api.video/blog/endpoints/video-update). + * Updates the parameters associated with your video. The video you are updating is determined by the video ID you provide. + +NOTE: If you are updating an array, you must provide the entire array as what you provide here overwrites what is in the system rather than appending to it. + * Update a video * @param videoId The video ID for the video you want to delete. - * @param videoUpdatePayload + * @param videoUpdatePayload */ public async update( videoId: string, @@ -331,10 +334,15 @@ export default class VideosApi { } /** - * Pick a thumbnail from the given time code. If you'd like to upload an image for your thumbnail, use the [Upload a Thumbnail](https://docs.api.video/reference#post_videos-videoid-thumbnail) endpoint. There may be a short delay for the thumbnail to update. Tutorials using [Thumbnail picking](https://api.video/blog/endpoints/video-pick-a-thumbnail). + * Pick a thumbnail from the given time code. + +If you'd like to upload an image for your thumbnail, use the dedicated [method](#uploadThumbnail). + +There may be a short delay for the thumbnail to update. + * Pick a thumbnail * @param videoId Unique identifier of the video you want to add a thumbnail to, where you use a section of your video as the thumbnail. - * @param videoThumbnailPickPayload + * @param videoThumbnailPickPayload */ public async pickThumbnail( videoId: string, @@ -507,7 +515,7 @@ export default class VideosApi { return new UploadWithUploadTokenProgressiveSession