diff --git a/README.md b/README.md index 3e1248b..bc40539 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ - [ChaptersApi](#chaptersapi) - [LiveStreamsApi](#livestreamsapi) - [PlayerThemesApi](#playerthemesapi) + - [SummariesApi](#summariesapi) - [TagsApi](#tagsapi) - [UploadTokensApi](#uploadtokensapi) - [VideosApi](#videosapi) @@ -186,6 +187,17 @@ Method | Description | HTTP request [**deleteLogo()**](https://github.com/apivideo/api.video-php-client/blob/main/docs/Api/PlayerThemesApi.md#deleteLogo) | Delete logo | **DELETE** `/players/{playerId}/logo` +#### SummariesApi + +Method | Description | HTTP request +------------- | ------------- | ------------- +[**create()**](https://github.com/apivideo/api.video-php-client/blob/main/docs/Api/SummariesApi.md#create) | Generate video summary | **POST** `/summaries` +[**update()**](https://github.com/apivideo/api.video-php-client/blob/main/docs/Api/SummariesApi.md#update) | Update summary details | **PATCH** `/summaries/{summaryId}/source` +[**delete()**](https://github.com/apivideo/api.video-php-client/blob/main/docs/Api/SummariesApi.md#delete) | Delete video summary | **DELETE** `/summaries/{summaryId}` +[**list()**](https://github.com/apivideo/api.video-php-client/blob/main/docs/Api/SummariesApi.md#list) | List summaries | **GET** `/summaries` +[**getSummarySource()**](https://github.com/apivideo/api.video-php-client/blob/main/docs/Api/SummariesApi.md#getSummarySource) | Get summary details | **GET** `/summaries/{summaryId}/source` + + #### TagsApi Method | Description | HTTP request @@ -266,6 +278,7 @@ Method | Description | HTTP request - [CaptionsUpdatePayload](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/CaptionsUpdatePayload.md) - [Chapter](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/Chapter.md) - [ChaptersListResponse](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/ChaptersListResponse.md) + - [ConflictError](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/ConflictError.md) - [DiscardedVideoUpdatePayload](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/DiscardedVideoUpdatePayload.md) - [FilterBy](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/FilterBy.md) - [FilterBy1](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/FilterBy1.md) @@ -293,6 +306,11 @@ Method | Description | HTTP request - [RefreshTokenPayload](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/RefreshTokenPayload.md) - [RestreamsRequestObject](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/RestreamsRequestObject.md) - [RestreamsResponseObject](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/RestreamsResponseObject.md) + - [SummariesListResponse](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/SummariesListResponse.md) + - [Summary](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/Summary.md) + - [SummaryCreationPayload](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/SummaryCreationPayload.md) + - [SummarySource](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/SummarySource.md) + - [SummaryUpdatePayload](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/SummaryUpdatePayload.md) - [TokenCreationPayload](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/TokenCreationPayload.md) - [TokenListResponse](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/TokenListResponse.md) - [TooManyRequests](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/TooManyRequests.md) diff --git a/docs/Api/SummariesApi.md b/docs/Api/SummariesApi.md new file mode 100644 index 0000000..2c7aebd --- /dev/null +++ b/docs/Api/SummariesApi.md @@ -0,0 +1,150 @@ +# ApiVideo\Client\Api\SummariesApi + +All URIs are relative to https://ws.api.video. + +Method | Description | HTTP request +------------- | ------------- | ------------- +[**create()**](SummariesApi.md#create) | Generate video summary | **POST** /summaries +[**update()**](SummariesApi.md#update) | Update summary details | **PATCH** /summaries/{summaryId}/source +[**delete()**](SummariesApi.md#delete) | Delete video summary | **DELETE** /summaries/{summaryId} +[**list()**](SummariesApi.md#list) | List summaries | **GET** /summaries +[**getSummarySource()**](SummariesApi.md#getSummarySource) | Get summary details | **GET** /summaries/{summaryId}/source + + +## **`create()` - Generate video summary** + + + +Generate a title, abstract, and key takeaways for a video. + +### Arguments + + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + `summaryCreationPayload` | [**\ApiVideo\Client\Model\SummaryCreationPayload**](../Model/SummaryCreationPayload.md)| | + + + + +### Return type + +[**\ApiVideo\Client\Model\Summary**](../Model/Summary.md) + + + + + +## **`update()` - Update summary details** + + + +Update details for a summary. Note that this operation is only allowed for summary objects where `sourceStatus` is `missing`. + +### Arguments + + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + `summaryId` | **string**| The unique identifier of the summary source you want to update. | + `summaryUpdatePayload` | [**\ApiVideo\Client\Model\SummaryUpdatePayload**](../Model/SummaryUpdatePayload.md)| | + + + + +### Return type + +[**\ApiVideo\Client\Model\SummarySource**](../Model/SummarySource.md) + + + + + +## **`delete()` - Delete video summary** + + + +Delete a summary tied to a video. + +### Arguments + + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + `summaryId` | **string**| The unique identifier of the summary you want to delete. | + + + + +### Return type + +void (empty response body) + + + + + +## **`list()` - List summaries** + + + +List all summarries for your videos in a project. + +### Arguments + + + + + +Note: `queryParams` argument is an associative array with the keys listed below. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + `videoId` | **string**| Use this parameter to filter for a summary that belongs to a specific video. | [optional] + `origin` | **string**| Use this parameter to filter for summaries based on the way they were created: automatically or manually via the API. | [optional] + `sourceStatus` | **string**| Use this parameter to filter for summaries based on the current status of the summary source. These are the available statuses: `missing`: the input for a summary is not present. `waiting` : the input video is being processed and a summary will be generated. `failed`: a technical issue prevented summary generation. `completed`: the summary is generated. `unprocessable`: the API rules the source video to be unsuitable for summary generation. An example for this is an input video that has no audio. | [optional] + `sortBy` | **string**| Use this parameter to choose which field the API will use to sort the response data. The default is `value`. These are the available fields to sort by: - `createdAt`: Sorts the results based on date and timestamps when summaries were created. - `updatedAt`: Sorts the results based on date and timestamps when summaries were last updated. - `videoId`: Sorts the results based on video IDs. | [optional] + `sortOrder` | **string**| Use this parameter to sort results. `asc` is ascending and sorts from A to Z. `desc` is descending and sorts from Z to A. | [optional] + `currentPage` | **int**| Choose the number of search results to return per page. Minimum value: 1 | [optional] [default to 1] + `pageSize` | **int**| Results per page. Allowed values 1-100, default is 25. | [optional] [default to 25] + + + + + + +### Return type + +[**\ApiVideo\Client\Model\SummariesListResponse**](../Model/SummariesListResponse.md) + + + + + +## **`getSummarySource()` - Get summary details** + + + +Get all details for a summary. + +### Arguments + + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + `summaryId` | **string**| The unique identifier of the summary source you want to retrieve. | + + + + +### Return type + +[**\ApiVideo\Client\Model\SummarySource**](../Model/SummarySource.md) + + + + diff --git a/docs/Model/ConflictError.md b/docs/Model/ConflictError.md new file mode 100644 index 0000000..16b4fc7 --- /dev/null +++ b/docs/Model/ConflictError.md @@ -0,0 +1,13 @@ +# # ConflictError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | A link to the error documentation. | [optional] +**title** | **string** | A description of the error that occurred. | [optional] +**name** | **string** | The name of the parameter that caused the error. | [optional] +**status** | **int** | The HTTP status code. | [optional] +**detail** | **string** | A solution for the error. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/NotFound.md b/docs/Model/NotFound.md index f8b0a68..16ef209 100644 --- a/docs/Model/NotFound.md +++ b/docs/Model/NotFound.md @@ -4,9 +4,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**type** | **string** | | [optional] -**title** | **string** | | [optional] -**name** | **string** | | [optional] -**status** | **int** | | [optional] +**type** | **string** | A link to the error documentation. | [optional] +**title** | **string** | A description of the error that occurred. | [optional] +**name** | **string** | The name of the parameter that caused the error. | [optional] +**status** | **int** | The HTTP status code. | [optional] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SummariesListResponse.md b/docs/Model/SummariesListResponse.md new file mode 100644 index 0000000..a43d725 --- /dev/null +++ b/docs/Model/SummariesListResponse.md @@ -0,0 +1,10 @@ +# # SummariesListResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**\ApiVideo\Client\Model\Summary[]**](Summary.md) | An array of summary objects. | +**pagination** | [**\ApiVideo\Client\Model\Pagination**](Pagination.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Summary.md b/docs/Model/Summary.md new file mode 100644 index 0000000..59e3205 --- /dev/null +++ b/docs/Model/Summary.md @@ -0,0 +1,14 @@ +# # Summary + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**summaryId** | **string** | The unique identifier of the summary object. | [optional] +**createdAt** | [**\DateTime**](\DateTime.md) | Returns the date and time when the summary was created in ATOM date-time format. | [optional] +**updatedAt** | [**\DateTime**](\DateTime.md) | Returns the date and time when the summary was last updated in ATOM date-time format. | [optional] +**videoId** | **string** | The unique identifier of the video object. | [optional] +**origin** | **string** | Returns the origin of how the summary was created. - `api` means that no summary was generated automatically. You can add summary manually using the `PATCH /summaries/{summaryId}/source` endpoint operation. Until this happens, `sourceStatus` returns `missing`. - `auto` means that the API generated the summary automatically. | [optional] +**sourceStatus** | **string** | Returns the current status of summary generation. `missing`: the input for a summary is not present. `waiting` : the input video is being processed and a summary will be generated. `failed`: a technical issue prevented summary generation. `completed`: the summary is generated. `unprocessable`: the API rules the source video to be unsuitable for summary generation. An example for this is an input video that has no audio. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SummaryCreationPayload.md b/docs/Model/SummaryCreationPayload.md new file mode 100644 index 0000000..c9e2325 --- /dev/null +++ b/docs/Model/SummaryCreationPayload.md @@ -0,0 +1,10 @@ +# # SummaryCreationPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**videoId** | **string** | Create a summary of a video using the video ID. | +**origin** | **string** | Use this parameter to define how the API generates the summary. The only allowed value is `auto`, which means that the API generates a summary automatically. If you do not set this parameter, **the API will not generate a summary automatically**. In this case, `sourceStatus` will return `missing`, and you have to manually add a summary using the `PATCH /summaries/{summaryId}/source` endpoint operation. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SummarySource.md b/docs/Model/SummarySource.md new file mode 100644 index 0000000..f070e8c --- /dev/null +++ b/docs/Model/SummarySource.md @@ -0,0 +1,11 @@ +# # SummarySource + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | A video title, based on the contents of the video. | [optional] +**abstract** | **string** | A short outline of the contents of the video. The length of an `abstract` depends on the amount of content in a video that can be transcribed. The API condenses the contents into minimum 20, maximum 300 words. | [optional] +**takeaways** | **string[]** | A list of 3 key points from the video, in chronological order. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SummaryUpdatePayload.md b/docs/Model/SummaryUpdatePayload.md new file mode 100644 index 0000000..028ae53 --- /dev/null +++ b/docs/Model/SummaryUpdatePayload.md @@ -0,0 +1,11 @@ +# # SummaryUpdatePayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | A video title, based on the contents of the video. | [optional] +**abstract** | **string** | A short outline of the contents of the video. | [optional] +**takeaways** | **string[]** | A list of 3 key points from the video, in chronological order. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VideoCreationPayload.md b/docs/Model/VideoCreationPayload.md index 4ec104f..b3263d0 100644 --- a/docs/Model/VideoCreationPayload.md +++ b/docs/Model/VideoCreationPayload.md @@ -17,5 +17,6 @@ Name | Type | Description | Notes **watermark** | [**\ApiVideo\Client\Model\VideoWatermark**](VideoWatermark.md) | | [optional] **language** | **string** | Use this parameter to set the language of the video. When this parameter is set, the API creates a transcript of the video using the language you specify. You must use the [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. `language` is a permanent attribute of the video. You can update it to another language using the [`PATCH /videos/{videoId}`](https://docs.api.video/reference/api/Videos#update-a-video-object) operation. This triggers the API to generate a new transcript using a different language. | [optional] **transcript** | **bool** | Use this parameter to enable transcription. - When `true`, the API generates a transcript for the video. - The default value is `false`. - If you define a video language using the `language` parameter, the API uses that language to transcribe the video. If you do not define a language, the API detects it based on the video. - When the API generates a transcript, it will be available as a caption for the video. | [optional] +**transcriptSummary** | **bool** | Use this parameter to enable summarization. We recommend using this parameter together with `transcript: true`. - When `true`, the API generates a summary for the video, based on the transcription. - The default value is `false`. - If you define a video language using the `language` parameter, the API uses that language to summarize the video. If you do not define a language, the API detects it based on the video. | [optional] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VideoUpdatePayload.md b/docs/Model/VideoUpdatePayload.md index 48c352d..e23682d 100644 --- a/docs/Model/VideoUpdatePayload.md +++ b/docs/Model/VideoUpdatePayload.md @@ -14,5 +14,6 @@ Name | Type | Description | Notes **metadata** | [**\ApiVideo\Client\Model\Metadata[]**](Metadata.md) | A list (array) of dictionaries where each dictionary contains a key value pair that describes the video. As with tags, you must send the complete list of metadata you want as whatever you send here will overwrite the existing metadata for the video. | [optional] **language** | **string** | Use this parameter to set the language of the video. When this parameter is set, the API creates a transcript of the video using the language you specify. You must use the [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. `language` is a permanent attribute of the video. You can update it to another language using the [`PATCH /videos/{videoId}`](https://docs.api.video/reference/api/Videos#update-a-video-object) operation. This triggers the API to generate a new transcript using a different language. | [optional] **transcript** | **bool** | Use this parameter to enable transcription. - When `true`, the API generates a transcript for the video. - The default value is `false`. - If you define a video language using the `language` parameter, the API uses that language to transcribe the video. If you do not define a language, the API detects it based on the video. - When the API generates a transcript, it will be available as a caption for the video. | [optional] +**transcriptSummary** | **bool** | Use this parameter to enable summarization. - When `true`, the API generates a summary for the video, based on the transcription. - The default value is `false`. - If you define a video language using the `language` parameter, the API uses that language to summarize the video. If you do not define a language, the API detects it based on the video. | [optional] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/src/Api/SummariesApi.php b/src/Api/SummariesApi.php new file mode 100644 index 0000000..80b9b71 --- /dev/null +++ b/src/Api/SummariesApi.php @@ -0,0 +1,399 @@ +client = $client; + } + + /** + * Generate video summary + * + * @param \ApiVideo\Client\Model\SummaryCreationPayload $summaryCreationPayload summaryCreationPayload (required) + * + * @throws \ApiVideo\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \ApiVideo\Client\Model\Summary|\ApiVideo\Client\Model\ConflictError + */ + public function create(\ApiVideo\Client\Model\SummaryCreationPayload $summaryCreationPayload): \ApiVideo\Client\Model\Summary + { + $request = $this->buildCreateRequest($summaryCreationPayload); + + $model = new \ApiVideo\Client\Model\Summary($this->client->request($request)); + + return $model; + } + + /** + * Create request for operation 'create' + * + * @param \ApiVideo\Client\Model\SummaryCreationPayload $summaryCreationPayload (required) + * + * @throws \InvalidArgumentException + * @return Request + */ + private function buildCreateRequest(\ApiVideo\Client\Model\SummaryCreationPayload $summaryCreationPayload): Request + { + // verify the required parameter 'summaryCreationPayload' is set + if ($summaryCreationPayload === null || (is_array($summaryCreationPayload) && count($summaryCreationPayload) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $summaryCreationPayload when calling ' + ); + } + + $resourcePath = '/summaries'; + $formParams = []; + $queryParams = []; + $headers = []; + $httpBody = ''; + $multipart = false; + + + if ($summaryCreationPayload) { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($summaryCreationPayload)); + } + + + $query = \http_build_query($queryParams); + + return new Request( + 'POST', + $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + + /** + * Update summary details + * + * @param string $summaryId The unique identifier of the summary source you want to update. (required) + * @param \ApiVideo\Client\Model\SummaryUpdatePayload $summaryUpdatePayload summaryUpdatePayload (required) + * + * @throws \ApiVideo\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \ApiVideo\Client\Model\SummarySource|\ApiVideo\Client\Model\ConflictError + */ + public function update(string $summaryId, \ApiVideo\Client\Model\SummaryUpdatePayload $summaryUpdatePayload): \ApiVideo\Client\Model\SummarySource + { + $request = $this->buildUpdateRequest($summaryId, $summaryUpdatePayload); + + $model = new \ApiVideo\Client\Model\SummarySource($this->client->request($request)); + + return $model; + } + + /** + * Create request for operation 'update' + * + * @param string $summaryId The unique identifier of the summary source you want to update. (required) + * @param \ApiVideo\Client\Model\SummaryUpdatePayload $summaryUpdatePayload (required) + * + * @throws \InvalidArgumentException + * @return Request + */ + private function buildUpdateRequest(string $summaryId, \ApiVideo\Client\Model\SummaryUpdatePayload $summaryUpdatePayload): Request + { + // verify the required parameter 'summaryId' is set + if ($summaryId === null || (is_array($summaryId) && count($summaryId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $summaryId when calling ' + ); + } + // verify the required parameter 'summaryUpdatePayload' is set + if ($summaryUpdatePayload === null || (is_array($summaryUpdatePayload) && count($summaryUpdatePayload) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $summaryUpdatePayload when calling ' + ); + } + + $resourcePath = '/summaries/{summaryId}/source'; + $formParams = []; + $queryParams = []; + $headers = []; + $httpBody = ''; + $multipart = false; + + // path params + if ($summaryId !== null) { + $resourcePath = str_replace( + '{' . 'summaryId' . '}', + ObjectSerializer::toPathValue($summaryId), + $resourcePath + ); + } + + if ($summaryUpdatePayload) { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($summaryUpdatePayload)); + } + + + $query = \http_build_query($queryParams); + + return new Request( + 'PATCH', + $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + + /** + * Delete video summary + * + * @param string $summaryId The unique identifier of the summary you want to delete. (required) + * + * @throws \ApiVideo\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function delete(string $summaryId): void + { + $request = $this->buildDeleteRequest($summaryId); + + $this->client->request($request); + } + + /** + * Create request for operation 'delete' + * + * @param string $summaryId The unique identifier of the summary you want to delete. (required) + * + * @throws \InvalidArgumentException + * @return Request + */ + private function buildDeleteRequest(string $summaryId): Request + { + // verify the required parameter 'summaryId' is set + if ($summaryId === null || (is_array($summaryId) && count($summaryId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $summaryId when calling ' + ); + } + + $resourcePath = '/summaries/{summaryId}'; + $formParams = []; + $queryParams = []; + $headers = []; + $httpBody = ''; + $multipart = false; + + // path params + if ($summaryId !== null) { + $resourcePath = str_replace( + '{' . 'summaryId' . '}', + ObjectSerializer::toPathValue($summaryId), + $resourcePath + ); + } + + + + $query = \http_build_query($queryParams); + + return new Request( + 'DELETE', + $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + + /** + * List summaries + * + * @param array $queryParams + * + * @throws \ApiVideo\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \ApiVideo\Client\Model\SummariesListResponse + */ + public function list(array $queryParams = []): \ApiVideo\Client\Model\SummariesListResponse + { + $request = $this->buildListRequest($queryParams); + + $model = new \ApiVideo\Client\Model\SummariesListResponse($this->client->request($request)); + + return $model; + } + + /** + * Create request for operation 'list' + * + * @param array $queryParams + * + * @throws \InvalidArgumentException + * @return Request + */ + private function buildListRequest(array $queryParams = []): Request + { + // unbox the parameters from the associative array + $videoId = array_key_exists('videoId', $queryParams) ? $queryParams['videoId'] : null; + $origin = array_key_exists('origin', $queryParams) ? $queryParams['origin'] : null; + $sourceStatus = array_key_exists('sourceStatus', $queryParams) ? $queryParams['sourceStatus'] : null; + $sortBy = array_key_exists('sortBy', $queryParams) ? $queryParams['sortBy'] : null; + $sortOrder = array_key_exists('sortOrder', $queryParams) ? $queryParams['sortOrder'] : null; + $currentPage = array_key_exists('currentPage', $queryParams) ? $queryParams['currentPage'] : 1; + $pageSize = array_key_exists('pageSize', $queryParams) ? $queryParams['pageSize'] : 25; + + + $resourcePath = '/summaries'; + $formParams = []; + $queryParams = []; + $headers = []; + $httpBody = ''; + $multipart = false; + + // videoId query params + if ($videoId !== null) { + $queryParams['videoId'] = $videoId; + } + + // origin query params + if ($origin !== null) { + $queryParams['origin'] = $origin; + } + + // sourceStatus query params + if ($sourceStatus !== null) { + $queryParams['sourceStatus'] = $sourceStatus; + } + + // sortBy query params + if ($sortBy !== null) { + $queryParams['sortBy'] = $sortBy; + } + + // sortOrder query params + if ($sortOrder !== null) { + $queryParams['sortOrder'] = $sortOrder; + } + + // currentPage query params + if ($currentPage !== null) { + $queryParams['currentPage'] = $currentPage; + } + + // pageSize query params + if ($pageSize !== null) { + $queryParams['pageSize'] = $pageSize; + } + + + + + $query = \http_build_query($queryParams); + + return new Request( + 'GET', + $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + + /** + * Get summary details + * + * @param string $summaryId The unique identifier of the summary source you want to retrieve. (required) + * + * @throws \ApiVideo\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \ApiVideo\Client\Model\SummarySource|\ApiVideo\Client\Model\NotFound + */ + public function getSummarySource(string $summaryId): \ApiVideo\Client\Model\SummarySource + { + $request = $this->buildGetSummarySourceRequest($summaryId); + + $model = new \ApiVideo\Client\Model\SummarySource($this->client->request($request)); + + return $model; + } + + /** + * Create request for operation 'getSummarySource' + * + * @param string $summaryId The unique identifier of the summary source you want to retrieve. (required) + * + * @throws \InvalidArgumentException + * @return Request + */ + private function buildGetSummarySourceRequest(string $summaryId): Request + { + // verify the required parameter 'summaryId' is set + if ($summaryId === null || (is_array($summaryId) && count($summaryId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $summaryId when calling ' + ); + } + + $resourcePath = '/summaries/{summaryId}/source'; + $formParams = []; + $queryParams = []; + $headers = []; + $httpBody = ''; + $multipart = false; + + // path params + if ($summaryId !== null) { + $resourcePath = str_replace( + '{' . 'summaryId' . '}', + ObjectSerializer::toPathValue($summaryId), + $resourcePath + ); + } + + + + $query = \http_build_query($queryParams); + + return new Request( + 'GET', + $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + +} diff --git a/src/Api/VideosApi.php b/src/Api/VideosApi.php index 4d205c3..06e9abd 100644 --- a/src/Api/VideosApi.php +++ b/src/Api/VideosApi.php @@ -404,7 +404,7 @@ private function buildGetRequest(string $videoId): Request * * @throws \ApiVideo\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \ApiVideo\Client\Model\Video|\ApiVideo\Client\Model\BadRequest|\ApiVideo\Client\Model\NotFound|\ApiVideo\Client\Model\TooManyRequests + * @return \ApiVideo\Client\Model\Video|\ApiVideo\Client\Model\BadRequest|\ApiVideo\Client\Model\NotFound|\ApiVideo\Client\Model\ConflictError|\ApiVideo\Client\Model\TooManyRequests */ public function update(string $videoId, \ApiVideo\Client\Model\VideoUpdatePayload $videoUpdatePayload): \ApiVideo\Client\Model\Video { diff --git a/src/Client.php b/src/Client.php index 700a6c1..6e3917f 100644 --- a/src/Client.php +++ b/src/Client.php @@ -132,6 +132,18 @@ public function playerThemes(): \ApiVideo\Client\Api\PlayerThemesApi return $this->services['playerThemes']; } + /** + * @return \ApiVideo\Client\Api\SummariesApi + */ + public function summaries(): \ApiVideo\Client\Api\SummariesApi + { + if (!array_key_exists('summaries', $this->services)) { + $this->services['summaries'] = new \ApiVideo\Client\Api\SummariesApi($this->baseClient); + } + + return $this->services['summaries']; + } + /** * @return \ApiVideo\Client\Api\TagsApi */ diff --git a/src/Model/ConflictError.php b/src/Model/ConflictError.php new file mode 100644 index 0000000..94b4c87 --- /dev/null +++ b/src/Model/ConflictError.php @@ -0,0 +1,273 @@ + 'string', + 'title' => 'string', + 'name' => 'string', + 'status' => 'int', + 'detail' => 'string' + ], + [ + 'type' => null, + 'title' => null, + 'name' => null, + 'status' => null, + 'detail' => null + ], + [ + 'type' => 'type', + 'title' => 'title', + 'name' => 'name', + 'status' => 'status', + 'detail' => 'detail' + ], + [ + 'type' => 'setType', + 'title' => 'setTitle', + 'name' => 'setName', + 'status' => 'setStatus', + 'detail' => 'setDetail' + ], + [ + 'type' => 'getType', + 'title' => 'getTitle', + 'name' => 'getName', + 'status' => 'getStatus', + 'detail' => 'getDetail' + ], + [ + 'type' => null, + 'title' => null, + 'name' => null, + 'status' => null, + 'detail' => null + ], + null + ); + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['type'] = $data['type'] ?? null; + $this->container['title'] = $data['title'] ?? null; + $this->container['name'] = $data['name'] ?? null; + $this->container['status'] = $data['status'] ?? null; + $this->container['detail'] = $data['detail'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type A link to the error documentation. + * + * @return self + */ + public function setType($type) + { + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title A description of the error that occurred. + * + * @return self + */ + public function setTitle($title) + { + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The name of the parameter that caused the error. + * + * @return self + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets status + * + * @return int|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param int|null $status The HTTP status code. + * + * @return self + */ + public function setStatus($status) + { + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets detail + * + * @return string|null + */ + public function getDetail() + { + return $this->container['detail']; + } + + /** + * Sets detail + * + * @param string|null $detail A solution for the error. + * + * @return self + */ + public function setDetail($detail) + { + $this->container['detail'] = $detail; + + return $this; + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/src/Model/NotFound.php b/src/Model/NotFound.php index 9b72cc4..d486c45 100644 --- a/src/Model/NotFound.php +++ b/src/Model/NotFound.php @@ -129,7 +129,7 @@ public function getType() /** * Sets type * - * @param string|null $type type + * @param string|null $type A link to the error documentation. * * @return self */ @@ -153,7 +153,7 @@ public function getTitle() /** * Sets title * - * @param string|null $title title + * @param string|null $title A description of the error that occurred. * * @return self */ @@ -177,7 +177,7 @@ public function getName() /** * Sets name * - * @param string|null $name name + * @param string|null $name The name of the parameter that caused the error. * * @return self */ @@ -201,7 +201,7 @@ public function getStatus() /** * Sets status * - * @param int|null $status status + * @param int|null $status The HTTP status code. * * @return self */ diff --git a/src/Model/SummariesListResponse.php b/src/Model/SummariesListResponse.php new file mode 100644 index 0000000..22ac56a --- /dev/null +++ b/src/Model/SummariesListResponse.php @@ -0,0 +1,186 @@ + '\ApiVideo\Client\Model\Summary[]', + 'pagination' => '\ApiVideo\Client\Model\Pagination' + ], + [ + 'data' => null, + 'pagination' => null + ], + [ + 'data' => 'data', + 'pagination' => 'pagination' + ], + [ + 'data' => 'setData', + 'pagination' => 'setPagination' + ], + [ + 'data' => 'getData', + 'pagination' => 'getPagination' + ], + [ + 'data' => null, + 'pagination' => null + ], + null + ); + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['data'] = isset($data['data']) ? array_map(function(array $value): Summary { return new Summary($value); }, $data['data']) : null; + $this->container['pagination'] = isset($data['pagination']) ? new Pagination($data['pagination']) : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + if ($this->container['pagination'] === null) { + $invalidProperties[] = "'pagination' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets data + * + * @return \ApiVideo\Client\Model\Summary[] + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \ApiVideo\Client\Model\Summary[] $data An array of summary objects. + * + * @return self + */ + public function setData($data) + { + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets pagination + * + * @return \ApiVideo\Client\Model\Pagination + */ + public function getPagination() + { + return $this->container['pagination']; + } + + /** + * Sets pagination + * + * @param \ApiVideo\Client\Model\Pagination $pagination pagination + * + * @return self + */ + public function setPagination($pagination) + { + $this->container['pagination'] = $pagination; + + return $this; + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/src/Model/Summary.php b/src/Model/Summary.php new file mode 100644 index 0000000..66c7acb --- /dev/null +++ b/src/Model/Summary.php @@ -0,0 +1,378 @@ + 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'videoId' => 'string', + 'origin' => 'string', + 'sourceStatus' => 'string' + ], + [ + 'summaryId' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'videoId' => null, + 'origin' => null, + 'sourceStatus' => null + ], + [ + 'summaryId' => 'summaryId', + 'createdAt' => 'createdAt', + 'updatedAt' => 'updatedAt', + 'videoId' => 'videoId', + 'origin' => 'origin', + 'sourceStatus' => 'sourceStatus' + ], + [ + 'summaryId' => 'setSummaryId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'videoId' => 'setVideoId', + 'origin' => 'setOrigin', + 'sourceStatus' => 'setSourceStatus' + ], + [ + 'summaryId' => 'getSummaryId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'videoId' => 'getVideoId', + 'origin' => 'getOrigin', + 'sourceStatus' => 'getSourceStatus' + ], + [ + 'summaryId' => null, + 'createdAt' => null, + 'updatedAt' => null, + 'videoId' => null, + 'origin' => null, + 'sourceStatus' => null + ], + null + ); + } + + const ORIGIN_API = 'api'; + const ORIGIN_AUTO = 'auto'; + const SOURCE_STATUS_MISSING = 'missing'; + const SOURCE_STATUS_WAITING = 'waiting'; + const SOURCE_STATUS_FAILED = 'failed'; + const SOURCE_STATUS_COMPLETED = 'completed'; + const SOURCE_STATUS_UNPROCESSABLE = 'unprocessable'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getOriginAllowableValues() + { + return [ + self::ORIGIN_API, + self::ORIGIN_AUTO, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getSourceStatusAllowableValues() + { + return [ + self::SOURCE_STATUS_MISSING, + self::SOURCE_STATUS_WAITING, + self::SOURCE_STATUS_FAILED, + self::SOURCE_STATUS_COMPLETED, + self::SOURCE_STATUS_UNPROCESSABLE, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['summaryId'] = $data['summaryId'] ?? null; + $this->container['createdAt'] = isset($data['createdAt']) ? new \DateTime($data['createdAt']) : null; + $this->container['updatedAt'] = isset($data['updatedAt']) ? new \DateTime($data['updatedAt']) : null; + $this->container['videoId'] = $data['videoId'] ?? null; + $this->container['origin'] = $data['origin'] ?? null; + $this->container['sourceStatus'] = $data['sourceStatus'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getOriginAllowableValues(); + if (!is_null($this->container['origin']) && !in_array($this->container['origin'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'origin', must be one of '%s'", + $this->container['origin'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getSourceStatusAllowableValues(); + if (!is_null($this->container['sourceStatus']) && !in_array($this->container['sourceStatus'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'sourceStatus', must be one of '%s'", + $this->container['sourceStatus'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets summaryId + * + * @return string|null + */ + public function getSummaryId() + { + return $this->container['summaryId']; + } + + /** + * Sets summaryId + * + * @param string|null $summaryId The unique identifier of the summary object. + * + * @return self + */ + public function setSummaryId($summaryId) + { + $this->container['summaryId'] = $summaryId; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Returns the date and time when the summary was created in ATOM date-time format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Returns the date and time when the summary was last updated in ATOM date-time format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets videoId + * + * @return string|null + */ + public function getVideoId() + { + return $this->container['videoId']; + } + + /** + * Sets videoId + * + * @param string|null $videoId The unique identifier of the video object. + * + * @return self + */ + public function setVideoId($videoId) + { + $this->container['videoId'] = $videoId; + + return $this; + } + + /** + * Gets origin + * + * @return string|null + */ + public function getOrigin() + { + return $this->container['origin']; + } + + /** + * Sets origin + * + * @param string|null $origin Returns the origin of how the summary was created. - `api` means that no summary was generated automatically. You can add summary manually using the `PATCH /summaries/{summaryId}/source` endpoint operation. Until this happens, `sourceStatus` returns `missing`. - `auto` means that the API generated the summary automatically. + * + * @return self + */ + public function setOrigin($origin) + { + $allowedValues = $this->getOriginAllowableValues(); + if (!is_null($origin) && !in_array($origin, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'origin', must be one of '%s'", + $origin, + implode("', '", $allowedValues) + ) + ); + } + $this->container['origin'] = $origin; + + return $this; + } + + /** + * Gets sourceStatus + * + * @return string|null + */ + public function getSourceStatus() + { + return $this->container['sourceStatus']; + } + + /** + * Sets sourceStatus + * + * @param string|null $sourceStatus Returns the current status of summary generation. `missing`: the input for a summary is not present. `waiting` : the input video is being processed and a summary will be generated. `failed`: a technical issue prevented summary generation. `completed`: the summary is generated. `unprocessable`: the API rules the source video to be unsuitable for summary generation. An example for this is an input video that has no audio. + * + * @return self + */ + public function setSourceStatus($sourceStatus) + { + $allowedValues = $this->getSourceStatusAllowableValues(); + if (!is_null($sourceStatus) && !in_array($sourceStatus, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'sourceStatus', must be one of '%s'", + $sourceStatus, + implode("', '", $allowedValues) + ) + ); + } + $this->container['sourceStatus'] = $sourceStatus; + + return $this; + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/src/Model/SummaryCreationPayload.php b/src/Model/SummaryCreationPayload.php new file mode 100644 index 0000000..da6dd93 --- /dev/null +++ b/src/Model/SummaryCreationPayload.php @@ -0,0 +1,215 @@ + 'string', + 'origin' => 'string' + ], + [ + 'videoId' => null, + 'origin' => null + ], + [ + 'videoId' => 'videoId', + 'origin' => 'origin' + ], + [ + 'videoId' => 'setVideoId', + 'origin' => 'setOrigin' + ], + [ + 'videoId' => 'getVideoId', + 'origin' => 'getOrigin' + ], + [ + 'videoId' => null, + 'origin' => null + ], + null + ); + } + + const ORIGIN_AUTO = 'auto'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getOriginAllowableValues() + { + return [ + self::ORIGIN_AUTO, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['videoId'] = $data['videoId'] ?? null; + $this->container['origin'] = $data['origin'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['videoId'] === null) { + $invalidProperties[] = "'videoId' can't be null"; + } + $allowedValues = $this->getOriginAllowableValues(); + if (!is_null($this->container['origin']) && !in_array($this->container['origin'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'origin', must be one of '%s'", + $this->container['origin'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets videoId + * + * @return string + */ + public function getVideoId() + { + return $this->container['videoId']; + } + + /** + * Sets videoId + * + * @param string $videoId Create a summary of a video using the video ID. + * + * @return self + */ + public function setVideoId($videoId) + { + $this->container['videoId'] = $videoId; + + return $this; + } + + /** + * Gets origin + * + * @return string|null + */ + public function getOrigin() + { + return $this->container['origin']; + } + + /** + * Sets origin + * + * @param string|null $origin Use this parameter to define how the API generates the summary. The only allowed value is `auto`, which means that the API generates a summary automatically. If you do not set this parameter, **the API will not generate a summary automatically**. In this case, `sourceStatus` will return `missing`, and you have to manually add a summary using the `PATCH /summaries/{summaryId}/source` endpoint operation. + * + * @return self + */ + public function setOrigin($origin) + { + $allowedValues = $this->getOriginAllowableValues(); + if (!is_null($origin) && !in_array($origin, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'origin', must be one of '%s'", + $origin, + implode("', '", $allowedValues) + ) + ); + } + $this->container['origin'] = $origin; + + return $this; + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/src/Model/SummarySource.php b/src/Model/SummarySource.php new file mode 100644 index 0000000..d2fe0c2 --- /dev/null +++ b/src/Model/SummarySource.php @@ -0,0 +1,219 @@ + 'string', + 'abstract' => 'string', + 'takeaways' => 'string[]' + ], + [ + 'title' => null, + 'abstract' => null, + 'takeaways' => null + ], + [ + 'title' => 'title', + 'abstract' => 'abstract', + 'takeaways' => 'takeaways' + ], + [ + 'title' => 'setTitle', + 'abstract' => 'setAbstract', + 'takeaways' => 'setTakeaways' + ], + [ + 'title' => 'getTitle', + 'abstract' => 'getAbstract', + 'takeaways' => 'getTakeaways' + ], + [ + 'title' => null, + 'abstract' => null, + 'takeaways' => null + ], + null + ); + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['title'] = $data['title'] ?? null; + $this->container['abstract'] = $data['abstract'] ?? null; + $this->container['takeaways'] = $data['takeaways'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['takeaways']) && (count($this->container['takeaways']) > 3)) { + $invalidProperties[] = "invalid value for 'takeaways', number of items must be less than or equal to 3."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title A video title, based on the contents of the video. + * + * @return self + */ + public function setTitle($title) + { + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets abstract + * + * @return string|null + */ + public function getAbstract() + { + return $this->container['abstract']; + } + + /** + * Sets abstract + * + * @param string|null $abstract A short outline of the contents of the video. The length of an `abstract` depends on the amount of content in a video that can be transcribed. The API condenses the contents into minimum 20, maximum 300 words. + * + * @return self + */ + public function setAbstract($abstract) + { + $this->container['abstract'] = $abstract; + + return $this; + } + + /** + * Gets takeaways + * + * @return string[]|null + */ + public function getTakeaways() + { + return $this->container['takeaways']; + } + + /** + * Sets takeaways + * + * @param string[]|null $takeaways A list of 3 key points from the video, in chronological order. + * + * @return self + */ + public function setTakeaways($takeaways) + { + + if (!is_null($takeaways) && (count($takeaways) > 3)) { + throw new \InvalidArgumentException('invalid value for $takeaways when calling SummarySource., number of items must be less than or equal to 3.'); + } + $this->container['takeaways'] = $takeaways; + + return $this; + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/src/Model/SummaryUpdatePayload.php b/src/Model/SummaryUpdatePayload.php new file mode 100644 index 0000000..b74ac6e --- /dev/null +++ b/src/Model/SummaryUpdatePayload.php @@ -0,0 +1,219 @@ + 'string', + 'abstract' => 'string', + 'takeaways' => 'string[]' + ], + [ + 'title' => null, + 'abstract' => null, + 'takeaways' => null + ], + [ + 'title' => 'title', + 'abstract' => 'abstract', + 'takeaways' => 'takeaways' + ], + [ + 'title' => 'setTitle', + 'abstract' => 'setAbstract', + 'takeaways' => 'setTakeaways' + ], + [ + 'title' => 'getTitle', + 'abstract' => 'getAbstract', + 'takeaways' => 'getTakeaways' + ], + [ + 'title' => null, + 'abstract' => null, + 'takeaways' => null + ], + null + ); + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['title'] = $data['title'] ?? null; + $this->container['abstract'] = $data['abstract'] ?? null; + $this->container['takeaways'] = $data['takeaways'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['takeaways']) && (count($this->container['takeaways']) > 3)) { + $invalidProperties[] = "invalid value for 'takeaways', number of items must be less than or equal to 3."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title A video title, based on the contents of the video. + * + * @return self + */ + public function setTitle($title) + { + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets abstract + * + * @return string|null + */ + public function getAbstract() + { + return $this->container['abstract']; + } + + /** + * Sets abstract + * + * @param string|null $abstract A short outline of the contents of the video. + * + * @return self + */ + public function setAbstract($abstract) + { + $this->container['abstract'] = $abstract; + + return $this; + } + + /** + * Gets takeaways + * + * @return string[]|null + */ + public function getTakeaways() + { + return $this->container['takeaways']; + } + + /** + * Sets takeaways + * + * @param string[]|null $takeaways A list of 3 key points from the video, in chronological order. + * + * @return self + */ + public function setTakeaways($takeaways) + { + + if (!is_null($takeaways) && (count($takeaways) > 3)) { + throw new \InvalidArgumentException('invalid value for $takeaways when calling SummaryUpdatePayload., number of items must be less than or equal to 3.'); + } + $this->container['takeaways'] = $takeaways; + + return $this; + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/src/Model/VideoCreationPayload.php b/src/Model/VideoCreationPayload.php index cb0ead6..c3eb105 100644 --- a/src/Model/VideoCreationPayload.php +++ b/src/Model/VideoCreationPayload.php @@ -43,7 +43,8 @@ public static function getDefinition(): ModelDefinition 'clip' => '\ApiVideo\Client\Model\VideoClip', 'watermark' => '\ApiVideo\Client\Model\VideoWatermark', 'language' => 'string', - 'transcript' => 'bool' + 'transcript' => 'bool', + 'transcriptSummary' => 'bool' ], [ 'title' => null, @@ -58,7 +59,8 @@ public static function getDefinition(): ModelDefinition 'clip' => null, 'watermark' => null, 'language' => null, - 'transcript' => null + 'transcript' => null, + 'transcriptSummary' => null ], [ 'title' => 'title', @@ -73,7 +75,8 @@ public static function getDefinition(): ModelDefinition 'clip' => 'clip', 'watermark' => 'watermark', 'language' => 'language', - 'transcript' => 'transcript' + 'transcript' => 'transcript', + 'transcriptSummary' => 'transcriptSummary' ], [ 'title' => 'setTitle', @@ -88,7 +91,8 @@ public static function getDefinition(): ModelDefinition 'clip' => 'setClip', 'watermark' => 'setWatermark', 'language' => 'setLanguage', - 'transcript' => 'setTranscript' + 'transcript' => 'setTranscript', + 'transcriptSummary' => 'setTranscriptSummary' ], [ 'title' => 'getTitle', @@ -103,7 +107,8 @@ public static function getDefinition(): ModelDefinition 'clip' => 'getClip', 'watermark' => 'getWatermark', 'language' => 'getLanguage', - 'transcript' => 'getTranscript' + 'transcript' => 'getTranscript', + 'transcriptSummary' => 'getTranscriptSummary' ], [ 'title' => null, @@ -118,7 +123,8 @@ public static function getDefinition(): ModelDefinition 'clip' => null, 'watermark' => null, 'language' => null, - 'transcript' => null + 'transcript' => null, + 'transcriptSummary' => null ], null ); @@ -230,6 +236,7 @@ public function __construct(array $data = null) $this->container['watermark'] = isset($data['watermark']) ? new VideoWatermark($data['watermark']) : null; $this->container['language'] = $data['language'] ?? null; $this->container['transcript'] = $data['transcript'] ?? null; + $this->container['transcriptSummary'] = $data['transcriptSummary'] ?? null; } /** @@ -590,6 +597,30 @@ public function setTranscript($transcript) return $this; } + /** + * Gets transcriptSummary + * + * @return bool|null + */ + public function getTranscriptSummary() + { + return $this->container['transcriptSummary']; + } + + /** + * Sets transcriptSummary + * + * @param bool|null $transcriptSummary Use this parameter to enable summarization. We recommend using this parameter together with `transcript: true`. - When `true`, the API generates a summary for the video, based on the transcription. - The default value is `false`. - If you define a video language using the `language` parameter, the API uses that language to summarize the video. If you do not define a language, the API detects it based on the video. + * + * @return self + */ + public function setTranscriptSummary($transcriptSummary) + { + $this->container['transcriptSummary'] = $transcriptSummary; + + return $this; + } + /** * Serializes the object to a value that can be serialized natively by json_encode(). * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php diff --git a/src/Model/VideoUpdatePayload.php b/src/Model/VideoUpdatePayload.php index 83a2771..57e6fa8 100644 --- a/src/Model/VideoUpdatePayload.php +++ b/src/Model/VideoUpdatePayload.php @@ -40,7 +40,8 @@ public static function getDefinition(): ModelDefinition 'tags' => 'string[]', 'metadata' => '\ApiVideo\Client\Model\Metadata[]', 'language' => 'string', - 'transcript' => 'bool' + 'transcript' => 'bool', + 'transcriptSummary' => 'bool' ], [ 'playerId' => null, @@ -52,7 +53,8 @@ public static function getDefinition(): ModelDefinition 'tags' => null, 'metadata' => null, 'language' => null, - 'transcript' => null + 'transcript' => null, + 'transcriptSummary' => null ], [ 'playerId' => 'playerId', @@ -64,7 +66,8 @@ public static function getDefinition(): ModelDefinition 'tags' => 'tags', 'metadata' => 'metadata', 'language' => 'language', - 'transcript' => 'transcript' + 'transcript' => 'transcript', + 'transcriptSummary' => 'transcriptSummary' ], [ 'playerId' => 'setPlayerId', @@ -76,7 +79,8 @@ public static function getDefinition(): ModelDefinition 'tags' => 'setTags', 'metadata' => 'setMetadata', 'language' => 'setLanguage', - 'transcript' => 'setTranscript' + 'transcript' => 'setTranscript', + 'transcriptSummary' => 'setTranscriptSummary' ], [ 'playerId' => 'getPlayerId', @@ -88,7 +92,8 @@ public static function getDefinition(): ModelDefinition 'tags' => 'getTags', 'metadata' => 'getMetadata', 'language' => 'getLanguage', - 'transcript' => 'getTranscript' + 'transcript' => 'getTranscript', + 'transcriptSummary' => 'getTranscriptSummary' ], [ 'playerId' => 'isPlayerIdDefined', @@ -100,7 +105,8 @@ public static function getDefinition(): ModelDefinition 'tags' => null, 'metadata' => null, 'language' => null, - 'transcript' => null + 'transcript' => null, + 'transcriptSummary' => null ], null ); @@ -209,6 +215,7 @@ public function __construct(array $data = null) $this->container['metadata'] = isset($data['metadata']) ? array_map(function(array $value): Metadata { return new Metadata($value); }, $data['metadata']) : null; $this->container['language'] = $data['language'] ?? null; $this->container['transcript'] = $data['transcript'] ?? null; + $this->container['transcriptSummary'] = $data['transcriptSummary'] ?? null; } /** @@ -504,6 +511,30 @@ public function setTranscript($transcript) return $this; } + /** + * Gets transcriptSummary + * + * @return bool|null + */ + public function getTranscriptSummary() + { + return $this->container['transcriptSummary']; + } + + /** + * Sets transcriptSummary + * + * @param bool|null $transcriptSummary Use this parameter to enable summarization. - When `true`, the API generates a summary for the video, based on the transcription. - The default value is `false`. - If you define a video language using the `language` parameter, the API uses that language to summarize the video. If you do not define a language, the API detects it based on the video. + * + * @return self + */ + public function setTranscriptSummary($transcriptSummary) + { + $this->container['transcriptSummary'] = $transcriptSummary; + + return $this; + } + /** * Serializes the object to a value that can be serialized natively by json_encode(). * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php