diff --git a/CHANGELOG.md b/CHANGELOG.md index 3610a1a..8f93468 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog All changes to this project will be documented in this file. +## [1.4.5] - 2024-10-21 +- Add summary feature + ## [1.4.4] - 2024-10-08 - Add transcript feature diff --git a/README.md b/README.md index 926285f..425d4b5 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ - [ChaptersApi](#) - [LiveStreamsApi](#) - [PlayerThemesApi](#) + - [SummariesApi](#) - [TagsApi](#) - [UploadTokensApi](#) - [VideosApi](#) @@ -177,6 +178,18 @@ Method | HTTP request | Description [**delete_logo**](https://github.com/apivideo/api.video-python-client/blob/main/docs/PlayerThemesApi.md#delete_logo) | **DELETE** `/players/{playerId}/logo` | Delete logo +### SummariesApi + + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create**](https://github.com/apivideo/api.video-python-client/blob/main/docs/SummariesApi.md#create) | **POST** `/summaries` | Generate video summary +[**update**](https://github.com/apivideo/api.video-python-client/blob/main/docs/SummariesApi.md#update) | **PATCH** `/summaries/{summaryId}/source` | Update summary details +[**delete**](https://github.com/apivideo/api.video-python-client/blob/main/docs/SummariesApi.md#delete) | **DELETE** `/summaries/{summaryId}` | Delete video summary +[**list**](https://github.com/apivideo/api.video-python-client/blob/main/docs/SummariesApi.md#list) | **GET** `/summaries` | List summaries +[**get_summary_source**](https://github.com/apivideo/api.video-python-client/blob/main/docs/SummariesApi.md#get_summary_source) | **GET** `/summaries/{summaryId}/source` | Get summary details + + ### TagsApi @@ -263,6 +276,7 @@ Method | HTTP request | Description - [CaptionsUpdatePayload](https://github.com/apivideo/api.video-python-client/blob/main/docs/CaptionsUpdatePayload.md) - [Chapter](https://github.com/apivideo/api.video-python-client/blob/main/docs/Chapter.md) - [ChaptersListResponse](https://github.com/apivideo/api.video-python-client/blob/main/docs/ChaptersListResponse.md) + - [ConflictError](https://github.com/apivideo/api.video-python-client/blob/main/docs/ConflictError.md) - [DiscardedVideoUpdatePayload](https://github.com/apivideo/api.video-python-client/blob/main/docs/DiscardedVideoUpdatePayload.md) - [FilterBy](https://github.com/apivideo/api.video-python-client/blob/main/docs/FilterBy.md) - [FilterBy1](https://github.com/apivideo/api.video-python-client/blob/main/docs/FilterBy1.md) @@ -290,6 +304,11 @@ Method | HTTP request | Description - [RefreshTokenPayload](https://github.com/apivideo/api.video-python-client/blob/main/docs/RefreshTokenPayload.md) - [RestreamsRequestObject](https://github.com/apivideo/api.video-python-client/blob/main/docs/RestreamsRequestObject.md) - [RestreamsResponseObject](https://github.com/apivideo/api.video-python-client/blob/main/docs/RestreamsResponseObject.md) + - [SummariesListResponse](https://github.com/apivideo/api.video-python-client/blob/main/docs/SummariesListResponse.md) + - [Summary](https://github.com/apivideo/api.video-python-client/blob/main/docs/Summary.md) + - [SummaryCreationPayload](https://github.com/apivideo/api.video-python-client/blob/main/docs/SummaryCreationPayload.md) + - [SummarySource](https://github.com/apivideo/api.video-python-client/blob/main/docs/SummarySource.md) + - [SummaryUpdatePayload](https://github.com/apivideo/api.video-python-client/blob/main/docs/SummaryUpdatePayload.md) - [TokenCreationPayload](https://github.com/apivideo/api.video-python-client/blob/main/docs/TokenCreationPayload.md) - [TokenListResponse](https://github.com/apivideo/api.video-python-client/blob/main/docs/TokenListResponse.md) - [TooManyRequests](https://github.com/apivideo/api.video-python-client/blob/main/docs/TooManyRequests.md) diff --git a/apivideo/__init__.py b/apivideo/__init__.py index 37ba0d7..7e70ea4 100644 --- a/apivideo/__init__.py +++ b/apivideo/__init__.py @@ -9,7 +9,7 @@ """ -__version__ = "1.4.4" +__version__ = "1.4.5" # import ApiVideoClient from apivideo.auth_api_client import AuthenticatedApiClient diff --git a/apivideo/api/summaries_api.py b/apivideo/api/summaries_api.py new file mode 100644 index 0000000..71d67ee --- /dev/null +++ b/apivideo/api/summaries_api.py @@ -0,0 +1,744 @@ +""" + api.video + + api.video is an API that encodes on the go to facilitate immediate playback, enhancing viewer streaming experiences across multiple devices and platforms. You can stream live or on-demand online videos within minutes. # noqa: E501 + + Contact: ecosystem@api.video +""" + +import os # noqa: F401 +import re # noqa: F401 +import sys # noqa: F401 +from types import MethodType +from types import FunctionType + +from apivideo.api_client import ApiClient +from apivideo.endpoint import EndPoint as _EndPoint, ChunkIO +from apivideo.model.video_id import VideoId +from apivideo.model_utils import ( # noqa: F401 + check_allowed_values, + check_validations, + date, + datetime, + file_type, + none_type, + validate_and_convert_types +) +from apivideo.exceptions import ApiTypeError, ApiValueError +from apivideo.model.conflict_error import ConflictError +from apivideo.model.not_found import NotFound +from apivideo.model.summaries_list_response import SummariesListResponse +from apivideo.model.summary import Summary +from apivideo.model.summary_creation_payload import SummaryCreationPayload +from apivideo.model.summary_source import SummarySource +from apivideo.model.summary_update_payload import SummaryUpdatePayload + + +class SummariesApi(_EndPoint): + + def create( + self, + summary_creation_payload, + **kwargs + ): + """Generate video summary # noqa: E501 + + Generate a title, abstract, and key takeaways for a video. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.create(summary_creation_payload, async_req=True) + >>> result = thread.get() + + Args: + summary_creation_payload (SummaryCreationPayload): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (float/tuple): timeout setting for this request. If one + number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + async_req (bool): execute request asynchronously + + Returns: + Summary + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['summary_creation_payload'] = \ + summary_creation_payload + + params_map = { + 'all': [ + 'summary_creation_payload', + 'async_req', + '_preload_content', + '_request_timeout', + '_return_http_data_only' + ], + 'required': [ + 'summary_creation_payload', + ], + 'nullable': [ + '_request_timeout' + ], + 'enum': [ + ], + 'validation': [ + ] + } + validations = { + } + allowed_values = { + } + openapi_types = { + 'summary_creation_payload': + (SummaryCreationPayload,), + 'async_req': (bool,), + '_preload_content': (bool,), + '_request_timeout': (none_type, int, (int,), [int]), + '_return_http_data_only': (bool,) + } + attribute_map = { + } + location_map = { + 'summary_creation_payload': 'body', + } + collection_format_map = { + } + + for key, value in kwargs.items(): + if key not in params_map['all']: + raise ApiTypeError( + "Got an unexpected parameter '%s'" + " to method `create`" % + (key, ) + ) + if (key not in params_map['nullable'] and value is None): + raise ApiValueError( + "Value may not be None for non-nullable parameter `%s`" + " when calling `create`" % + (key, ) + ) + + for key in params_map['required']: + if key not in kwargs.keys(): + raise ApiValueError( + "Missing the required parameter `%s` when calling " + "`create`" % (key, ) + ) + + self._validate_inputs(kwargs, params_map, allowed_values, validations, openapi_types) + params = self._gather_params(kwargs, location_map, attribute_map, openapi_types, collection_format_map) + return self.api_client.call_api( + "/summaries", + "POST", + params['path'], + params['query'], + params['header'], + body=params['body'], + post_params=params['form'], + files=params['file'], + response_type=(Summary,), + async_req=kwargs['async_req'], + _return_http_data_only=kwargs['_return_http_data_only'], + _preload_content=kwargs['_preload_content'], + _request_timeout=kwargs['_request_timeout'], + collection_formats=params['collection_format']) + + def update( + self, + summary_id, + summary_update_payload, + **kwargs + ): + """Update summary details # noqa: E501 + + Update details for a summary. Note that this operation is only allowed for summary objects where `sourceStatus` is `missing`. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.update(summary_id, summary_update_payload, async_req=True) + >>> result = thread.get() + + Args: + summary_id (str): The unique identifier of the summary source you want to update. + summary_update_payload (SummaryUpdatePayload): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (float/tuple): timeout setting for this request. If one + number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + async_req (bool): execute request asynchronously + + Returns: + SummarySource + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['summary_id'] = \ + summary_id + kwargs['summary_update_payload'] = \ + summary_update_payload + + params_map = { + 'all': [ + 'summary_id', + 'summary_update_payload', + 'async_req', + '_preload_content', + '_request_timeout', + '_return_http_data_only' + ], + 'required': [ + 'summary_id', + 'summary_update_payload', + ], + 'nullable': [ + '_request_timeout' + ], + 'enum': [ + ], + 'validation': [ + ] + } + validations = { + } + allowed_values = { + } + openapi_types = { + 'summary_id': + (str,), + 'summary_update_payload': + (SummaryUpdatePayload,), + 'async_req': (bool,), + '_preload_content': (bool,), + '_request_timeout': (none_type, int, (int,), [int]), + '_return_http_data_only': (bool,) + } + attribute_map = { + 'summary_id': 'summaryId', + } + location_map = { + 'summary_id': 'path', + 'summary_update_payload': 'body', + } + collection_format_map = { + } + + for key, value in kwargs.items(): + if key not in params_map['all']: + raise ApiTypeError( + "Got an unexpected parameter '%s'" + " to method `update`" % + (key, ) + ) + if (key not in params_map['nullable'] and value is None): + raise ApiValueError( + "Value may not be None for non-nullable parameter `%s`" + " when calling `update`" % + (key, ) + ) + + for key in params_map['required']: + if key not in kwargs.keys(): + raise ApiValueError( + "Missing the required parameter `%s` when calling " + "`update`" % (key, ) + ) + + self._validate_inputs(kwargs, params_map, allowed_values, validations, openapi_types) + params = self._gather_params(kwargs, location_map, attribute_map, openapi_types, collection_format_map) + return self.api_client.call_api( + "/summaries/{summaryId}/source", + "PATCH", + params['path'], + params['query'], + params['header'], + body=params['body'], + post_params=params['form'], + files=params['file'], + response_type=(SummarySource,), + async_req=kwargs['async_req'], + _return_http_data_only=kwargs['_return_http_data_only'], + _preload_content=kwargs['_preload_content'], + _request_timeout=kwargs['_request_timeout'], + collection_formats=params['collection_format']) + + def delete( + self, + summary_id, + **kwargs + ): + """Delete video summary # noqa: E501 + + Delete a summary tied to a video. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.delete(summary_id, async_req=True) + >>> result = thread.get() + + Args: + summary_id (str): The unique identifier of the summary you want to delete. + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (float/tuple): timeout setting for this request. If one + number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + async_req (bool): execute request asynchronously + + Returns: + None + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['summary_id'] = \ + summary_id + + params_map = { + 'all': [ + 'summary_id', + 'async_req', + '_preload_content', + '_request_timeout', + '_return_http_data_only' + ], + 'required': [ + 'summary_id', + ], + 'nullable': [ + '_request_timeout' + ], + 'enum': [ + ], + 'validation': [ + ] + } + validations = { + } + allowed_values = { + } + openapi_types = { + 'summary_id': + (str,), + 'async_req': (bool,), + '_preload_content': (bool,), + '_request_timeout': (none_type, int, (int,), [int]), + '_return_http_data_only': (bool,) + } + attribute_map = { + 'summary_id': 'summaryId', + } + location_map = { + 'summary_id': 'path', + } + collection_format_map = { + } + + for key, value in kwargs.items(): + if key not in params_map['all']: + raise ApiTypeError( + "Got an unexpected parameter '%s'" + " to method `delete`" % + (key, ) + ) + if (key not in params_map['nullable'] and value is None): + raise ApiValueError( + "Value may not be None for non-nullable parameter `%s`" + " when calling `delete`" % + (key, ) + ) + + for key in params_map['required']: + if key not in kwargs.keys(): + raise ApiValueError( + "Missing the required parameter `%s` when calling " + "`delete`" % (key, ) + ) + + self._validate_inputs(kwargs, params_map, allowed_values, validations, openapi_types) + params = self._gather_params(kwargs, location_map, attribute_map, openapi_types, collection_format_map) + return self.api_client.call_api( + "/summaries/{summaryId}", + "DELETE", + params['path'], + params['query'], + params['header'], + body=params['body'], + post_params=params['form'], + files=params['file'], + response_type=None, + async_req=kwargs['async_req'], + _return_http_data_only=kwargs['_return_http_data_only'], + _preload_content=kwargs['_preload_content'], + _request_timeout=kwargs['_request_timeout'], + collection_formats=params['collection_format']) + + def list( + self, + **kwargs + ): + """List summaries # noqa: E501 + + List all summarries for your videos in a project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.list(async_req=True) + >>> result = thread.get() + + + Keyword Args: + video_id (str): Use this parameter to filter for a summary that belongs to a specific video.. [optional] + origin (str): Use this parameter to filter for summaries based on the way they were created: automatically or manually via the API.. [optional] + source_status (str): 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] + sort_by (str): 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] + sort_order (str): 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] + current_page (int): Choose the number of search results to return per page. Minimum value: 1. [optional] if omitted the server will use the default value of 1 + page_size (int): Results per page. Allowed values 1-100, default is 25.. [optional] if omitted the server will use the default value of 25 + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (float/tuple): timeout setting for this request. If one + number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + async_req (bool): execute request asynchronously + + Returns: + SummariesListResponse + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + + params_map = { + 'all': [ + 'video_id', + 'origin', + 'source_status', + 'sort_by', + 'sort_order', + 'current_page', + 'page_size', + 'async_req', + '_preload_content', + '_request_timeout', + '_return_http_data_only' + ], + 'required': [], + 'nullable': [ + '_request_timeout' + ], + 'enum': [ + 'origin', + 'source_status', + 'sort_by', + 'sort_order', + ], + 'validation': [ + ] + } + validations = { + } + allowed_values = { + ('origin',): { + + "AUTO": "auto", + "API": "api" + }, + ('source_status',): { + + "MISSING": "missing", + "WAITING": "waiting", + "FAILED": "failed", + "COMPLETED": "completed", + "UNPROCESSABLE": "unprocessable" + }, + ('sort_by',): { + + "CREATEDAT": "createdAt", + "UPDATEDAT": "updatedAt", + "VIDEOID": "videoId" + }, + ('sort_order',): { + + "ASC": "asc", + "DESC": "desc" + }, + } + openapi_types = { + 'video_id': + (str,), + 'origin': + (str,), + 'source_status': + (str,), + 'sort_by': + (str,), + 'sort_order': + (str,), + 'current_page': + (int,), + 'page_size': + (int,), + 'async_req': (bool,), + '_preload_content': (bool,), + '_request_timeout': (none_type, int, (int,), [int]), + '_return_http_data_only': (bool,) + } + attribute_map = { + 'video_id': 'videoId', + 'origin': 'origin', + 'source_status': 'sourceStatus', + 'sort_by': 'sortBy', + 'sort_order': 'sortOrder', + 'current_page': 'currentPage', + 'page_size': 'pageSize', + } + location_map = { + 'video_id': 'query', + 'origin': 'query', + 'source_status': 'query', + 'sort_by': 'query', + 'sort_order': 'query', + 'current_page': 'query', + 'page_size': 'query', + } + collection_format_map = { + } + + for key, value in kwargs.items(): + if key not in params_map['all']: + raise ApiTypeError( + "Got an unexpected parameter '%s'" + " to method `list`" % + (key, ) + ) + if (key not in params_map['nullable'] and value is None): + raise ApiValueError( + "Value may not be None for non-nullable parameter `%s`" + " when calling `list`" % + (key, ) + ) + + for key in params_map['required']: + if key not in kwargs.keys(): + raise ApiValueError( + "Missing the required parameter `%s` when calling " + "`list`" % (key, ) + ) + + self._validate_inputs(kwargs, params_map, allowed_values, validations, openapi_types) + params = self._gather_params(kwargs, location_map, attribute_map, openapi_types, collection_format_map) + return self.api_client.call_api( + "/summaries", + "GET", + params['path'], + params['query'], + params['header'], + body=params['body'], + post_params=params['form'], + files=params['file'], + response_type=(SummariesListResponse,), + async_req=kwargs['async_req'], + _return_http_data_only=kwargs['_return_http_data_only'], + _preload_content=kwargs['_preload_content'], + _request_timeout=kwargs['_request_timeout'], + collection_formats=params['collection_format']) + + def get_summary_source( + self, + summary_id, + **kwargs + ): + """Get summary details # noqa: E501 + + Get all details for a summary. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_summary_source(summary_id, async_req=True) + >>> result = thread.get() + + Args: + summary_id (str): The unique identifier of the summary source you want to retrieve. + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (float/tuple): timeout setting for this request. If one + number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + async_req (bool): execute request asynchronously + + Returns: + SummarySource + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['summary_id'] = \ + summary_id + + params_map = { + 'all': [ + 'summary_id', + 'async_req', + '_preload_content', + '_request_timeout', + '_return_http_data_only' + ], + 'required': [ + 'summary_id', + ], + 'nullable': [ + '_request_timeout' + ], + 'enum': [ + ], + 'validation': [ + ] + } + validations = { + } + allowed_values = { + } + openapi_types = { + 'summary_id': + (str,), + 'async_req': (bool,), + '_preload_content': (bool,), + '_request_timeout': (none_type, int, (int,), [int]), + '_return_http_data_only': (bool,) + } + attribute_map = { + 'summary_id': 'summaryId', + } + location_map = { + 'summary_id': 'path', + } + collection_format_map = { + } + + for key, value in kwargs.items(): + if key not in params_map['all']: + raise ApiTypeError( + "Got an unexpected parameter '%s'" + " to method `get_summary_source`" % + (key, ) + ) + if (key not in params_map['nullable'] and value is None): + raise ApiValueError( + "Value may not be None for non-nullable parameter `%s`" + " when calling `get_summary_source`" % + (key, ) + ) + + for key in params_map['required']: + if key not in kwargs.keys(): + raise ApiValueError( + "Missing the required parameter `%s` when calling " + "`get_summary_source`" % (key, ) + ) + + self._validate_inputs(kwargs, params_map, allowed_values, validations, openapi_types) + params = self._gather_params(kwargs, location_map, attribute_map, openapi_types, collection_format_map) + return self.api_client.call_api( + "/summaries/{summaryId}/source", + "GET", + params['path'], + params['query'], + params['header'], + body=params['body'], + post_params=params['form'], + files=params['file'], + response_type=(SummarySource,), + async_req=kwargs['async_req'], + _return_http_data_only=kwargs['_return_http_data_only'], + _preload_content=kwargs['_preload_content'], + _request_timeout=kwargs['_request_timeout'], + collection_formats=params['collection_format']) + diff --git a/apivideo/api/videos_api.py b/apivideo/api/videos_api.py index 282e7fe..9010292 100644 --- a/apivideo/api/videos_api.py +++ b/apivideo/api/videos_api.py @@ -26,6 +26,7 @@ ) from apivideo.exceptions import ApiTypeError, ApiValueError from apivideo.model.bad_request import BadRequest +from apivideo.model.conflict_error import ConflictError from apivideo.model.discarded_video_update_payload import DiscardedVideoUpdatePayload from apivideo.model.not_found import NotFound from apivideo.model.too_many_requests import TooManyRequests diff --git a/apivideo/api_client.py b/apivideo/api_client.py index e1e34dc..7ad50cb 100644 --- a/apivideo/api_client.py +++ b/apivideo/api_client.py @@ -75,7 +75,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None, self.default_headers[header_name] = header_value self.cookie = cookie - self.default_headers['AV-Origin-Client'] = "python:1.4.4" + self.default_headers['AV-Origin-Client'] = "python:1.4.5" def __enter__(self): return self diff --git a/apivideo/apis/__init__.py b/apivideo/apis/__init__.py index ee624e0..d0571af 100644 --- a/apivideo/apis/__init__.py +++ b/apivideo/apis/__init__.py @@ -19,6 +19,7 @@ from apivideo.api.chapters_api import ChaptersApi from apivideo.api.live_streams_api import LiveStreamsApi from apivideo.api.player_themes_api import PlayerThemesApi +from apivideo.api.summaries_api import SummariesApi from apivideo.api.tags_api import TagsApi from apivideo.api.upload_tokens_api import UploadTokensApi from apivideo.api.videos_api import VideosApi diff --git a/apivideo/configuration.py b/apivideo/configuration.py index f17217d..bd85c32 100644 --- a/apivideo/configuration.py +++ b/apivideo/configuration.py @@ -391,7 +391,7 @@ def to_debug_report(self): "OS: {env}\n"\ "Python Version: {pyversion}\n"\ "Version of the API: 1\n"\ - "SDK Package Version: 1.4.4".\ + "SDK Package Version: 1.4.5".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self): diff --git a/apivideo/model/conflict_error.py b/apivideo/model/conflict_error.py new file mode 100644 index 0000000..d42d775 --- /dev/null +++ b/apivideo/model/conflict_error.py @@ -0,0 +1,177 @@ +""" + api.video + + api.video is an API that encodes on the go to facilitate immediate playback, enhancing viewer streaming experiences across multiple devices and platforms. You can stream live or on-demand online videos within minutes. # noqa: E501 + + Contact: ecosystem@api.video +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from apivideo.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) + + +class ConflictError(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + additional_properties_type = None + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'type': (str,), # noqa: E501 + 'title': (str,), # noqa: E501 + 'name': (str,), # noqa: E501 + 'status': (int,), # noqa: E501 + 'detail': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'type': 'type', # noqa: E501 + 'title': 'title', # noqa: E501 + 'name': 'name', # noqa: E501 + 'status': 'status', # noqa: E501 + 'detail': 'detail', # noqa: E501 + } + + _composed_schemas = {} + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): # noqa: E501 + """ConflictError - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + type (str): A link to the error documentation.. [optional] # noqa: E501 + title (str): A description of the error that occurred.. [optional] # noqa: E501 + name (str): The name of the parameter that caused the error.. [optional] # noqa: E501 + status (int): The HTTP status code.. [optional] # noqa: E501 + detail (str): A solution for the error.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) diff --git a/apivideo/model/not_found.py b/apivideo/model/not_found.py index aadc99d..8f6bdc6 100644 --- a/apivideo/model/not_found.py +++ b/apivideo/model/not_found.py @@ -135,10 +135,10 @@ def __init__(self, *args, **kwargs): # noqa: E501 Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - type (str): [optional] # noqa: E501 - title (str): [optional] # noqa: E501 - name (str): [optional] # noqa: E501 - status (int): [optional] # noqa: E501 + type (str): A link to the error documentation.. [optional] # noqa: E501 + title (str): A description of the error that occurred.. [optional] # noqa: E501 + name (str): The name of the parameter that caused the error.. [optional] # noqa: E501 + status (int): The HTTP status code.. [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) diff --git a/apivideo/model/summaries_list_response.py b/apivideo/model/summaries_list_response.py new file mode 100644 index 0000000..449cfac --- /dev/null +++ b/apivideo/model/summaries_list_response.py @@ -0,0 +1,179 @@ +""" + api.video + + api.video is an API that encodes on the go to facilitate immediate playback, enhancing viewer streaming experiences across multiple devices and platforms. You can stream live or on-demand online videos within minutes. # noqa: E501 + + Contact: ecosystem@api.video +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from apivideo.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) + +def lazy_import(): + from apivideo.model.pagination import Pagination + from apivideo.model.summary import Summary + globals()['Pagination'] = Pagination + globals()['Summary'] = Summary + + +class SummariesListResponse(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + additional_properties_type = None + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'data': ([Summary],), # noqa: E501 + 'pagination': (Pagination,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'data': 'data', # noqa: E501 + 'pagination': 'pagination', # noqa: E501 + } + + _composed_schemas = {} + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, data, pagination, *args, **kwargs): # noqa: E501 + """SummariesListResponse - a model defined in OpenAPI + + Args: + data ([Summary]): An array of summary objects. + pagination (Pagination): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.data = data + self.pagination = pagination + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) diff --git a/apivideo/model/summary.py b/apivideo/model/summary.py new file mode 100644 index 0000000..ba592a1 --- /dev/null +++ b/apivideo/model/summary.py @@ -0,0 +1,191 @@ +""" + api.video + + api.video is an API that encodes on the go to facilitate immediate playback, enhancing viewer streaming experiences across multiple devices and platforms. You can stream live or on-demand online videos within minutes. # noqa: E501 + + Contact: ecosystem@api.video +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from apivideo.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) + + +class Summary(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ('origin',): { + 'API': "api", + 'AUTO': "auto", + }, + ('source_status',): { + 'MISSING': "missing", + 'WAITING': "waiting", + 'FAILED': "failed", + 'COMPLETED': "completed", + 'UNPROCESSABLE': "unprocessable", + }, + } + + validations = { + } + + additional_properties_type = None + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'summary_id': (str,), # noqa: E501 + 'created_at': (datetime,), # noqa: E501 + 'updated_at': (datetime,), # noqa: E501 + 'video_id': (str,), # noqa: E501 + 'origin': (str,), # noqa: E501 + 'source_status': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'summary_id': 'summaryId', # noqa: E501 + 'created_at': 'createdAt', # noqa: E501 + 'updated_at': 'updatedAt', # noqa: E501 + 'video_id': 'videoId', # noqa: E501 + 'origin': 'origin', # noqa: E501 + 'source_status': 'sourceStatus', # noqa: E501 + } + + _composed_schemas = {} + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): # noqa: E501 + """Summary - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + summary_id (str): The unique identifier of the summary object.. [optional] # noqa: E501 + created_at (datetime): Returns the date and time when the summary was created in ATOM date-time format.. [optional] # noqa: E501 + updated_at (datetime): Returns the date and time when the summary was last updated in ATOM date-time format.. [optional] # noqa: E501 + video_id (str): The unique identifier of the video object.. [optional] # noqa: E501 + origin (str): 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] # noqa: E501 + source_status (str): 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] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) diff --git a/apivideo/model/summary_creation_payload.py b/apivideo/model/summary_creation_payload.py new file mode 100644 index 0000000..530268e --- /dev/null +++ b/apivideo/model/summary_creation_payload.py @@ -0,0 +1,174 @@ +""" + api.video + + api.video is an API that encodes on the go to facilitate immediate playback, enhancing viewer streaming experiences across multiple devices and platforms. You can stream live or on-demand online videos within minutes. # noqa: E501 + + Contact: ecosystem@api.video +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from apivideo.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) + + +class SummaryCreationPayload(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ('origin',): { + 'AUTO': "auto", + }, + } + + validations = { + } + + additional_properties_type = None + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'video_id': (str,), # noqa: E501 + 'origin': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'video_id': 'videoId', # noqa: E501 + 'origin': 'origin', # noqa: E501 + } + + _composed_schemas = {} + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, video_id, *args, **kwargs): # noqa: E501 + """SummaryCreationPayload - a model defined in OpenAPI + + Args: + video_id (str): Create a summary of a video using the video ID. + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + origin (str): 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] if omitted the server will use the default value of "auto" # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.video_id = video_id + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) diff --git a/apivideo/model/summary_source.py b/apivideo/model/summary_source.py new file mode 100644 index 0000000..add9c3c --- /dev/null +++ b/apivideo/model/summary_source.py @@ -0,0 +1,174 @@ +""" + api.video + + api.video is an API that encodes on the go to facilitate immediate playback, enhancing viewer streaming experiences across multiple devices and platforms. You can stream live or on-demand online videos within minutes. # noqa: E501 + + Contact: ecosystem@api.video +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from apivideo.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) + + +class SummarySource(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('takeaways',): { + 'max_items': 3, + }, + } + + additional_properties_type = None + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'title': (str,), # noqa: E501 + 'abstract': (str,), # noqa: E501 + 'takeaways': ([str],), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'title': 'title', # noqa: E501 + 'abstract': 'abstract', # noqa: E501 + 'takeaways': 'takeaways', # noqa: E501 + } + + _composed_schemas = {} + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): # noqa: E501 + """SummarySource - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + title (str): A video title, based on the contents of the video.. [optional] # noqa: E501 + abstract (str): 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] # noqa: E501 + takeaways ([str]): A list of 3 key points from the video, in chronological order.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) diff --git a/apivideo/model/summary_update_payload.py b/apivideo/model/summary_update_payload.py new file mode 100644 index 0000000..6a8fe2f --- /dev/null +++ b/apivideo/model/summary_update_payload.py @@ -0,0 +1,174 @@ +""" + api.video + + api.video is an API that encodes on the go to facilitate immediate playback, enhancing viewer streaming experiences across multiple devices and platforms. You can stream live or on-demand online videos within minutes. # noqa: E501 + + Contact: ecosystem@api.video +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from apivideo.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) + + +class SummaryUpdatePayload(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('takeaways',): { + 'max_items': 3, + }, + } + + additional_properties_type = None + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'title': (str,), # noqa: E501 + 'abstract': (str,), # noqa: E501 + 'takeaways': ([str],), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'title': 'title', # noqa: E501 + 'abstract': 'abstract', # noqa: E501 + 'takeaways': 'takeaways', # noqa: E501 + } + + _composed_schemas = {} + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): # noqa: E501 + """SummaryUpdatePayload - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + title (str): A video title, based on the contents of the video.. [optional] # noqa: E501 + abstract (str): A short outline of the contents of the video.. [optional] # noqa: E501 + takeaways ([str]): A list of 3 key points from the video, in chronological order.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) diff --git a/apivideo/model/video_creation_payload.py b/apivideo/model/video_creation_payload.py index bed7a80..9dfbfd4 100644 --- a/apivideo/model/video_creation_payload.py +++ b/apivideo/model/video_creation_payload.py @@ -129,6 +129,7 @@ def openapi_types(): 'watermark': (VideoWatermark,), # noqa: E501 'language': (str, none_type,), # noqa: E501 'transcript': (bool,), # noqa: E501 + 'transcript_summary': (bool,), # noqa: E501 } @cached_property @@ -150,6 +151,7 @@ def discriminator(): 'watermark': 'watermark', # noqa: E501 'language': 'language', # noqa: E501 'transcript': 'transcript', # noqa: E501 + 'transcript_summary': 'transcriptSummary', # noqa: E501 } _composed_schemas = {} @@ -213,6 +215,7 @@ def __init__(self, title, *args, **kwargs): # noqa: E501 watermark (VideoWatermark): [optional] # noqa: E501 language (str, none_type): 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] # noqa: E501 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] # noqa: E501 + transcript_summary (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] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) diff --git a/apivideo/model/video_update_payload.py b/apivideo/model/video_update_payload.py index 5ca6a3c..1a3e1c7 100644 --- a/apivideo/model/video_update_payload.py +++ b/apivideo/model/video_update_payload.py @@ -122,6 +122,7 @@ def openapi_types(): 'metadata': ([Metadata],), # noqa: E501 'language': (str, none_type,), # noqa: E501 'transcript': (bool,), # noqa: E501 + 'transcript_summary': (bool,), # noqa: E501 } @cached_property @@ -140,6 +141,7 @@ def discriminator(): 'metadata': 'metadata', # noqa: E501 'language': 'language', # noqa: E501 'transcript': 'transcript', # noqa: E501 + 'transcript_summary': 'transcriptSummary', # noqa: E501 } _composed_schemas = {} @@ -198,6 +200,7 @@ def __init__(self, *args, **kwargs): # noqa: E501 metadata ([Metadata]): 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] # noqa: E501 language (str, none_type): 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] # noqa: E501 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] # noqa: E501 + transcript_summary (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] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) diff --git a/docs/ConflictError.md b/docs/ConflictError.md new file mode 100644 index 0000000..ecc3295 --- /dev/null +++ b/docs/ConflictError.md @@ -0,0 +1,14 @@ +# ConflictError + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | A link to the error documentation. | [optional] +**title** | **str** | A description of the error that occurred. | [optional] +**name** | **str** | The name of the parameter that caused the error. | [optional] +**status** | **int** | The HTTP status code. | [optional] +**detail** | **str** | A solution for the error. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/NotFound.md b/docs/NotFound.md index c3e1a9f..326450f 100644 --- a/docs/NotFound.md +++ b/docs/NotFound.md @@ -3,10 +3,10 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**type** | **str** | | [optional] -**title** | **str** | | [optional] -**name** | **str** | | [optional] -**status** | **int** | | [optional] +**type** | **str** | A link to the error documentation. | [optional] +**title** | **str** | A description of the error that occurred. | [optional] +**name** | **str** | The name of the parameter that caused the error. | [optional] +**status** | **int** | The HTTP status code. | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/SummariesApi.md b/docs/SummariesApi.md new file mode 100644 index 0000000..0a0e570 --- /dev/null +++ b/docs/SummariesApi.md @@ -0,0 +1,316 @@ +# apivideo.SummariesApi + +All URIs are relative to *https://ws.api.video* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create**](SummariesApi.md#create) | **POST** /summaries | Generate video summary +[**update**](SummariesApi.md#update) | **PATCH** /summaries/{summaryId}/source | Update summary details +[**delete**](SummariesApi.md#delete) | **DELETE** /summaries/{summaryId} | Delete video summary +[**list**](SummariesApi.md#list) | **GET** /summaries | List summaries +[**get_summary_source**](SummariesApi.md#get_summary_source) | **GET** /summaries/{summaryId}/source | Get summary details + + +# **create** +> Summary create(summary_creation_payload) + +Generate video summary + +Generate a title, abstract, and key takeaways for a video. + +### Example + +```python +import apivideo +from apivideo.api import summaries_api +from apivideo.model.conflict_error import ConflictError +from apivideo.model.summary_creation_payload import SummaryCreationPayload +from apivideo.model.summary import Summary +from pprint import pprint + +# Enter a context with an instance of the API client +with apivideo.AuthenticatedApiClient(__API_KEY__) as api_client: + # Create an instance of the API class + api_instance = summaries_api.SummariesApi(api_client) + summary_creation_payload = SummaryCreationPayload( + video_id="vi4k0jvEUuaTdRAEjQ4Jfrgz", + origin="auto", + ) # SummaryCreationPayload | + + # example passing only required values which don't have defaults set + try: + # Generate video summary + api_response = api_instance.create(summary_creation_payload) + pprint(api_response) + except apivideo.ApiException as e: + print("Exception when calling SummariesApi->create: %s\n" % e) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **summary_creation_payload** | [**SummaryCreationPayload**](SummaryCreationPayload.md)| | + +### Return type + +[**Summary**](Summary.md) + + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**201** | Created | * X-RateLimit-Limit - The request limit per minute.
* X-RateLimit-Remaining - The number of available requests left for the current time window.
* X-RateLimit-Retry-After - The number of seconds left until the current rate limit window resets.
| +**409** | Conflict | * X-RateLimit-Limit - The request limit per minute.
* X-RateLimit-Remaining - The number of available requests left for the current time window.
* X-RateLimit-Retry-After - The number of seconds left until the current rate limit window resets.
| + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **update** +> SummarySource update(summary_id, summary_update_payload) + +Update summary details + +Update details for a summary. Note that this operation is only allowed for summary objects where `sourceStatus` is `missing`. + +### Example + +```python +import apivideo +from apivideo.api import summaries_api +from apivideo.model.conflict_error import ConflictError +from apivideo.model.summary_source import SummarySource +from apivideo.model.summary_update_payload import SummaryUpdatePayload +from pprint import pprint + +# Enter a context with an instance of the API client +with apivideo.AuthenticatedApiClient(__API_KEY__) as api_client: + # Create an instance of the API class + api_instance = summaries_api.SummariesApi(api_client) + summary_id = "summary_1CGHWuXjhxmeH4WiZ51234" # str | The unique identifier of the summary source you want to update. + summary_update_payload = SummaryUpdatePayload( + title="A short lecture on quantum theory", + abstract="In this lecture, we discuss how complicated quantum theory is, using the famous example of Schrödingers cat. We also discuss practical applications like quantum computing.", + takeaways=["Quantum theory is complicated.","Schrödinger's cat is neither dead, nor alive.","Quantum computers are super cool."], + ) # SummaryUpdatePayload | + + # example passing only required values which don't have defaults set + try: + # Update summary details + api_response = api_instance.update(summary_id, summary_update_payload) + pprint(api_response) + except apivideo.ApiException as e: + print("Exception when calling SummariesApi->update: %s\n" % e) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **summary_id** | **str**| The unique identifier of the summary source you want to update. | + **summary_update_payload** | [**SummaryUpdatePayload**](SummaryUpdatePayload.md)| | + +### Return type + +[**SummarySource**](SummarySource.md) + + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**201** | Created | * X-RateLimit-Limit - The request limit per minute.
* X-RateLimit-Remaining - The number of available requests left for the current time window.
* X-RateLimit-Retry-After - The number of seconds left until the current rate limit window resets.
| +**409** | Conflict | * X-RateLimit-Limit - The request limit per minute.
* X-RateLimit-Remaining - The number of available requests left for the current time window.
* X-RateLimit-Retry-After - The number of seconds left until the current rate limit window resets.
| + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **delete** +> delete(summary_id) + +Delete video summary + +Delete a summary tied to a video. + +### Example + +```python +import apivideo +from apivideo.api import summaries_api +from pprint import pprint + +# Enter a context with an instance of the API client +with apivideo.AuthenticatedApiClient(__API_KEY__) as api_client: + # Create an instance of the API class + api_instance = summaries_api.SummariesApi(api_client) + summary_id = "summary_1CGHWuXjhxmeH4WiZ51234" # str | The unique identifier of the summary you want to delete. + + # example passing only required values which don't have defaults set + try: + # Delete video summary + api_instance.delete(summary_id) + except apivideo.ApiException as e: + print("Exception when calling SummariesApi->delete: %s\n" % e) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **summary_id** | **str**| The unique identifier of the summary you want to delete. | + +### Return type + +void (empty response body) + + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | No Content | * X-RateLimit-Limit - The request limit per minute.
* X-RateLimit-Remaining - The number of available requests left for the current time window.
* X-RateLimit-Retry-After - The number of seconds left until the current rate limit window resets.
| + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **list** +> SummariesListResponse list() + +List summaries + +List all summarries for your videos in a project. + +### Example + +```python +import apivideo +from apivideo.api import summaries_api +from apivideo.model.summaries_list_response import SummariesListResponse +from pprint import pprint + +# Enter a context with an instance of the API client +with apivideo.AuthenticatedApiClient(__API_KEY__) as api_client: + # Create an instance of the API class + api_instance = summaries_api.SummariesApi(api_client) + video_id = "vilkR8K3N7yrRcxcMt91234" # str | Use this parameter to filter for a summary that belongs to a specific video. (optional) + origin = "auto" # str | Use this parameter to filter for summaries based on the way they were created: automatically or manually via the API. (optional) + source_status = "auto" # str | 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) + sort_by = "createdAt" # str | 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) + sort_order = "asc" # str | 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) + current_page = 2 # int | Choose the number of search results to return per page. Minimum value: 1 (optional) if omitted the server will use the default value of 1 + page_size = 30 # int | Results per page. Allowed values 1-100, default is 25. (optional) if omitted the server will use the default value of 25 + + # example passing only required values which don't have defaults set + # and optional values + try: + # List summaries + api_response = api_instance.list(video_id=video_id, origin=origin, source_status=source_status, sort_by=sort_by, sort_order=sort_order, current_page=current_page, page_size=page_size) + pprint(api_response) + except apivideo.ApiException as e: + print("Exception when calling SummariesApi->list: %s\n" % e) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **video_id** | **str**| Use this parameter to filter for a summary that belongs to a specific video. | [optional] + **origin** | **str**| Use this parameter to filter for summaries based on the way they were created: automatically or manually via the API. | [optional] + **source_status** | **str**| 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] + **sort_by** | **str**| 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] + **sort_order** | **str**| 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] + **current_page** | **int**| Choose the number of search results to return per page. Minimum value: 1 | [optional] if omitted the server will use the default value of 1 + **page_size** | **int**| Results per page. Allowed values 1-100, default is 25. | [optional] if omitted the server will use the default value of 25 + +### Return type + +[**SummariesListResponse**](SummariesListResponse.md) + + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Created | * X-RateLimit-Limit - The request limit per minute.
* X-RateLimit-Remaining - The number of available requests left for the current time window.
* X-RateLimit-Retry-After - The number of seconds left until the current rate limit window resets.
| + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_summary_source** +> SummarySource get_summary_source(summary_id) + +Get summary details + +Get all details for a summary. + +### Example + +```python +import apivideo +from apivideo.api import summaries_api +from apivideo.model.summary_source import SummarySource +from apivideo.model.not_found import NotFound +from pprint import pprint + +# Enter a context with an instance of the API client +with apivideo.AuthenticatedApiClient(__API_KEY__) as api_client: + # Create an instance of the API class + api_instance = summaries_api.SummariesApi(api_client) + summary_id = "summary_1CGHWuXjhxmeH4WiZ51234" # str | The unique identifier of the summary source you want to retrieve. + + # example passing only required values which don't have defaults set + try: + # Get summary details + api_response = api_instance.get_summary_source(summary_id) + pprint(api_response) + except apivideo.ApiException as e: + print("Exception when calling SummariesApi->get_summary_source: %s\n" % e) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **summary_id** | **str**| The unique identifier of the summary source you want to retrieve. | + +### Return type + +[**SummarySource**](SummarySource.md) + + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Success | * X-RateLimit-Limit - The request limit per minute.
* X-RateLimit-Remaining - The number of available requests left for the current time window.
* X-RateLimit-Retry-After - The number of seconds left until the current rate limit window resets.
| +**404** | Not Found | * X-RateLimit-Limit - The request limit per minute.
* X-RateLimit-Remaining - The number of available requests left for the current time window.
* X-RateLimit-Retry-After - The number of seconds left until the current rate limit window resets.
| + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/SummariesListResponse.md b/docs/SummariesListResponse.md new file mode 100644 index 0000000..3a729e3 --- /dev/null +++ b/docs/SummariesListResponse.md @@ -0,0 +1,11 @@ +# SummariesListResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**[Summary]**](Summary.md) | An array of summary objects. | +**pagination** | [**Pagination**](Pagination.md) | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Summary.md b/docs/Summary.md new file mode 100644 index 0000000..be65f2a --- /dev/null +++ b/docs/Summary.md @@ -0,0 +1,15 @@ +# Summary + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**summary_id** | **str** | The unique identifier of the summary object. | [optional] +**created_at** | **datetime** | Returns the date and time when the summary was created in ATOM date-time format. | [optional] +**updated_at** | **datetime** | Returns the date and time when the summary was last updated in ATOM date-time format. | [optional] +**video_id** | **str** | The unique identifier of the video object. | [optional] +**origin** | **str** | 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] +**source_status** | **str** | 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#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SummaryCreationPayload.md b/docs/SummaryCreationPayload.md new file mode 100644 index 0000000..eee492d --- /dev/null +++ b/docs/SummaryCreationPayload.md @@ -0,0 +1,11 @@ +# SummaryCreationPayload + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**video_id** | **str** | Create a summary of a video using the video ID. | +**origin** | **str** | 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] if omitted the server will use the default value of "auto" + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SummarySource.md b/docs/SummarySource.md new file mode 100644 index 0000000..2bee81d --- /dev/null +++ b/docs/SummarySource.md @@ -0,0 +1,12 @@ +# SummarySource + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **str** | A video title, based on the contents of the video. | [optional] +**abstract** | **str** | 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** | **[str]** | A list of 3 key points from the video, in chronological order. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SummaryUpdatePayload.md b/docs/SummaryUpdatePayload.md new file mode 100644 index 0000000..e422d65 --- /dev/null +++ b/docs/SummaryUpdatePayload.md @@ -0,0 +1,12 @@ +# SummaryUpdatePayload + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **str** | A video title, based on the contents of the video. | [optional] +**abstract** | **str** | A short outline of the contents of the video. | [optional] +**takeaways** | **[str]** | A list of 3 key points from the video, in chronological order. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/VideoCreationPayload.md b/docs/VideoCreationPayload.md index 634c7f0..a5612ef 100644 --- a/docs/VideoCreationPayload.md +++ b/docs/VideoCreationPayload.md @@ -16,6 +16,7 @@ Name | Type | Description | Notes **watermark** | [**VideoWatermark**](VideoWatermark.md) | | [optional] **language** | **str, none_type** | 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] +**transcript_summary** | **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#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/VideoUpdatePayload.md b/docs/VideoUpdatePayload.md index 9a4bedf..c9c1008 100644 --- a/docs/VideoUpdatePayload.md +++ b/docs/VideoUpdatePayload.md @@ -13,6 +13,7 @@ Name | Type | Description | Notes **metadata** | [**[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** | **str, none_type** | 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] +**transcript_summary** | **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#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/VideosApi.md b/docs/VideosApi.md index a91b3ef..4c5e3c6 100644 --- a/docs/VideosApi.md +++ b/docs/VideosApi.md @@ -72,6 +72,7 @@ with apivideo.AuthenticatedApiClient(__API_KEY__) as api_client: ), language="fr", transcript=True, + transcript_summary=True, ) # VideoCreationPayload | video to create # example passing only required values which don't have defaults set @@ -397,6 +398,7 @@ NOTE: If you are updating an array, you must provide the entire array as what yo ```python import apivideo from apivideo.api import videos_api +from apivideo.model.conflict_error import ConflictError from apivideo.model.too_many_requests import TooManyRequests from apivideo.model.video_update_payload import VideoUpdatePayload from apivideo.model.bad_request import BadRequest @@ -425,6 +427,7 @@ with apivideo.AuthenticatedApiClient(__API_KEY__) as api_client: ], language="fr", transcript=True, + transcript_summary=True, ) # VideoUpdatePayload | # example passing only required values which don't have defaults set @@ -461,6 +464,7 @@ Name | Type | Description | Notes **200** | Success | * X-RateLimit-Limit - The request limit per minute.
* X-RateLimit-Remaining - The number of available requests left for the current time window.
* X-RateLimit-Retry-After - The number of seconds left until the current rate limit window resets.
| **400** | Bad Request | * X-RateLimit-Limit - The request limit per minute.
* X-RateLimit-Remaining - The number of available requests left for the current time window.
* X-RateLimit-Retry-After - The number of seconds left until the current rate limit window resets.
| **404** | Not Found | * X-RateLimit-Limit - The request limit per minute.
* X-RateLimit-Remaining - The number of available requests left for the current time window.
* X-RateLimit-Retry-After - The number of seconds left until the current rate limit window resets.
| +**409** | Conflict | * X-RateLimit-Limit - The request limit per minute.
* X-RateLimit-Remaining - The number of available requests left for the current time window.
* X-RateLimit-Retry-After - The number of seconds left until the current rate limit window resets.
| **429** | Too Many Requests | * X-RateLimit-Limit - The request limit per minute.
* X-RateLimit-Remaining - The number of available requests left for the current time window.
* X-RateLimit-Retry-After - The number of seconds left until the current rate limit window resets.
| [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/setup.py b/setup.py index e6a4231..cd57e7f 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ from setuptools import setup, find_packages # noqa: H301 NAME = "api.video" -VERSION = "1.4.4" +VERSION = "1.4.5" # To install the library, run the following # # python setup.py install diff --git a/test/payloads/summaries/create/responses/201.json b/test/payloads/summaries/create/responses/201.json new file mode 100644 index 0000000..4144fc4 --- /dev/null +++ b/test/payloads/summaries/create/responses/201.json @@ -0,0 +1,8 @@ +{ + "summaryId" : "summary_1CGHWuXjhxmeH4WiZ51234", + "createdAt" : "2024-07-14T23:36:07+00:00", + "updatedAt" : "2024-07-14T23:36:07+00:00", + "videoId" : "vilkR8K3N7yrRcxcMt91234", + "origin" : "auto", + "sourceStatus" : "completed" +} \ No newline at end of file diff --git a/test/payloads/summaries/create/responses/409.json b/test/payloads/summaries/create/responses/409.json new file mode 100644 index 0000000..8d8965e --- /dev/null +++ b/test/payloads/summaries/create/responses/409.json @@ -0,0 +1,7 @@ +{ + "type" : "https://docs.api.video/reference/summary-already-exists", + "title" : "A summary already exists or is being created on this video.", + "status" : 409, + "detail" : "You can delete the existing summary and generate a new one.", + "name" : "videoId" +} \ No newline at end of file diff --git a/test/payloads/summaries/get_summary_source/responses/404.json b/test/payloads/summaries/get_summary_source/responses/404.json new file mode 100644 index 0000000..01e6e6d --- /dev/null +++ b/test/payloads/summaries/get_summary_source/responses/404.json @@ -0,0 +1,6 @@ +{ + "type" : "https://docs.api.video/reference/resource-not-found", + "title" : "The requested resource was not found.", + "name" : "summaryId", + "status" : 404 +} \ No newline at end of file diff --git a/test/payloads/summaries/list/responses/200.json b/test/payloads/summaries/list/responses/200.json new file mode 100644 index 0000000..e057a94 --- /dev/null +++ b/test/payloads/summaries/list/responses/200.json @@ -0,0 +1,34 @@ +{ + "data" : [ { + "summaryId" : "summary_1CGHWuXjhxmeH4WiZ51234", + "createdAt" : "2024-07-14T23:36:07+00:00", + "updatedAt" : "2024-07-14T23:36:07+00:00", + "videoId" : "vilkR8K3N7yrRcxcMt91234", + "origin" : "auto", + "sourceStatus" : "completed" + }, { + "summaryId" : "summary_123HWuXjhxmeH4WiZ55678", + "createdAt" : "2024-07-15T23:36:07+00:00", + "updatedAt" : "2024-07-15T23:36:07+00:00", + "videoId" : "vibaBXK3N7yrRcxcMt95678", + "origin" : "auto", + "sourceStatus" : "waiting" + } ], + "pagination" : { + "currentPage" : 1, + "pageSize" : 25, + "pagesTotal" : 1, + "itemsTotal" : 11, + "currentPageItems" : 11, + "links" : [ { + "rel" : "self", + "uri" : "https://ws.api.video/summaries?currentPage=1" + }, { + "rel" : "first", + "uri" : "https://ws.api.video/summaries?currentPage=1" + }, { + "rel" : "last", + "uri" : "https://ws.api.video/summaries?currentPage=1" + } ] + } +} \ No newline at end of file diff --git a/test/payloads/summaries/update/responses/409.json b/test/payloads/summaries/update/responses/409.json new file mode 100644 index 0000000..5ad057e --- /dev/null +++ b/test/payloads/summaries/update/responses/409.json @@ -0,0 +1,6 @@ +{ + "type" : "https://docs.api.video/reference/summary-already-exists", + "title" : "A summary already exists or is being created on this video.", + "status" : 409, + "detail" : "You can delete the existing summary and generate a new one." +} \ No newline at end of file diff --git a/test/payloads/videos/update/responses/409.json b/test/payloads/videos/update/responses/409.json new file mode 100644 index 0000000..93fe9b8 --- /dev/null +++ b/test/payloads/videos/update/responses/409.json @@ -0,0 +1,7 @@ +{ + "type" : "https://docs.api.video/reference/summary-already-exists", + "title" : "A summary already exists or is being created on this video.", + "status" : 409, + "detail" : "You can delete the existing summary and generate a new one.", + "name" : "transcriptSummary" +} \ No newline at end of file diff --git a/test/test_summaries_api.py b/test/test_summaries_api.py new file mode 100644 index 0000000..ffdfa8c --- /dev/null +++ b/test/test_summaries_api.py @@ -0,0 +1,115 @@ +""" + api.video + + api.video is an API that encodes on the go to facilitate immediate playback, enhancing viewer streaming experiences across multiple devices and platforms. You can stream live or on-demand online videos within minutes. # noqa: E501 + + Contact: ecosystem@api.video +""" + +from dateutil.parser import parse as dateutil_parser +from urllib3_mock import Responses + +from apivideo.api.summaries_api import SummariesApi # noqa: E501 +from apivideo.exceptions import ApiException, NotFoundException +from apivideo.model.metadata import Metadata +from apivideo.model.video_clip import VideoClip +from apivideo.model.video_watermark import VideoWatermark +from apivideo.model.restreams_request_object import RestreamsRequestObject + +from apivideo.model.conflict_error import ConflictError +from apivideo.model.not_found import NotFound +from apivideo.model.summaries_list_response import SummariesListResponse +from apivideo.model.summary import Summary +from apivideo.model.summary_creation_payload import SummaryCreationPayload +from apivideo.model.summary_source import SummarySource +from apivideo.model.summary_update_payload import SummaryUpdatePayload + +from helper import MainTest + + +responses = Responses() + + +class TestSummariesApi(MainTest): + """SummariesApi unit test""" + + def setUp(self): + super().setUp() + self.api = SummariesApi(self.client) # noqa: E501 + + @responses.activate + def test_create(self): + """Test case for create + + Generate video summary # noqa: E501 + """ + for file_name, json in self.load_json('summaries', 'create'): + status = file_name.split("-")[0] + responses.reset() + + kwargs = { + 'summary_creation_payload': SummaryCreationPayload( + video_id="vi4k0jvEUuaTdRAEjQ4Jfrgz", + origin="auto", + ), + } + url = '/summaries'.format(**kwargs) + + responses.add('POST', url, body=json, status=int(status), content_type='application/json') + + if status[0] == '4': + with self.assertRaises(ApiException) as context: + self.api.create(**kwargs) + if status == '404': + self.assertIsInstance(context.exception, NotFoundException) + else: + self.api.create(**kwargs) + + @responses.activate + def test_update(self): + """Test case for update + + Update summary details # noqa: E501 + """ + pass + + @responses.activate + def test_delete(self): + """Test case for delete + + Delete video summary # noqa: E501 + """ + pass + + @responses.activate + def test_list(self): + """Test case for list + + List summaries # noqa: E501 + """ + for file_name, json in self.load_json('summaries', 'list'): + status = file_name.split("-")[0] + responses.reset() + + kwargs = { + } + url = '/summaries'.format(**kwargs) + + responses.add('GET', url, body=json, status=int(status), content_type='application/json') + + if status[0] == '4': + with self.assertRaises(ApiException) as context: + self.api.list(**kwargs) + if status == '404': + self.assertIsInstance(context.exception, NotFoundException) + else: + self.api.list(**kwargs) + + @responses.activate + def test_get_summary_source(self): + """Test case for get_summary_source + + Get summary details # noqa: E501 + """ + pass + diff --git a/test/test_videos_api.py b/test/test_videos_api.py index 4c846ba..f7051d9 100644 --- a/test/test_videos_api.py +++ b/test/test_videos_api.py @@ -17,6 +17,7 @@ from apivideo.model.restreams_request_object import RestreamsRequestObject from apivideo.model.bad_request import BadRequest +from apivideo.model.conflict_error import ConflictError from apivideo.model.discarded_video_update_payload import DiscardedVideoUpdatePayload from apivideo.model.not_found import NotFound from apivideo.model.too_many_requests import TooManyRequests @@ -82,6 +83,7 @@ def test_create(self): ), language="fr", transcript=True, + transcript_summary=True, ), } url = '/videos'.format(**kwargs) @@ -201,6 +203,7 @@ def test_update(self): ], language="fr", transcript=True, + transcript_summary=True, ), } url = '/videos/{video_id}'.format(**kwargs)