예제 #1
0
    def create(self, webhooks_creation_payload, **kwargs):
        """Create Webhook  # noqa: E501

            Webhooks can push notifications to your server, rather than polling api.video for changes. We currently offer one event, the ```video.encoding.quality.completed``` event.  When a new video is uploaded into your account, it will be encoded into several different HLS sizes/bitrates.  When each version is encoded, your webhook will get a notification.  It will look like ```{ \\\"type\\\": \\\"video.encoding.quality.completed\\\", \\\"emittedAt\\\": \\\"2021-01-29T16:46:25.217+01:00\\\", \\\"videoId\\\": \\\"viXXXXXXXX\\\", \\\"encoding\\\": \\\"hls\\\", \\\"quality\\\": \\\"720p\\\"} ```. This request says that the 720p HLS encoding was completed.  # 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(webhooks_creation_payload, async_req=True)
            >>> result = thread.get()

            Args:
                webhooks_creation_payload (WebhooksCreationPayload):

            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.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                async_req (bool): execute request asynchronously

            Returns:
                Webhook
                    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['_check_input_type'] = kwargs.get('_check_input_type', True)
        kwargs['_check_return_type'] = kwargs.get('_check_return_type', True)
        kwargs['webhooks_creation_payload'] = \
            webhooks_creation_payload

        params_map = {
            'all': [
                'webhooks_creation_payload', 'async_req', '_preload_content',
                '_request_timeout', '_return_http_data_only',
                '_check_input_type', '_check_return_type'
            ],
            'required': [
                'webhooks_creation_payload',
            ],
            'nullable': ['_request_timeout'],
            'enum': [],
            'validation': []
        }
        validations = {}
        allowed_values = {}
        openapi_types = {
            'webhooks_creation_payload': (WebhooksCreationPayload, ),
            'async_req': (bool, ),
            '_preload_content': (bool, ),
            '_request_timeout': (none_type, int, (int, ), [int]),
            '_return_http_data_only': (bool, ),
            '_check_input_type': (bool, ),
            '_check_return_type': (bool, )
        }
        attribute_map = {}
        location_map = {
            'webhooks_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, ))
            # only throw this nullable ApiValueError if _check_input_type
            # is False, if _check_input_type==True we catch this case
            # in self.__validate_inputs
            if (key not in params_map['nullable'] and value is None
                    and kwargs['_check_input_type'] is False):
                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(
            "/webhooks",
            "POST",
            params['path'],
            params['query'],
            params['header'],
            body=params['body'],
            post_params=params['form'],
            files=params['file'],
            response_type=(Webhook, ),
            async_req=kwargs['async_req'],
            _check_type=kwargs['_check_return_type'],
            _return_http_data_only=kwargs['_return_http_data_only'],
            _preload_content=kwargs['_preload_content'],
            _request_timeout=kwargs['_request_timeout'],
            collection_formats=params['collection_format'])
예제 #2
0
    def list(self, **kwargs):
        """List all webhooks  # noqa: E501

            Requests to this endpoint return a list of your webhooks (with all their details). You can filter what the webhook list that the API returns using the parameters described below.  # 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:
                events (str): The webhook event that you wish to filter on.. [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.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                async_req (bool): execute request asynchronously

            Returns:
                WebhooksListResponse
                    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['_check_input_type'] = kwargs.get('_check_input_type', True)
        kwargs['_check_return_type'] = kwargs.get('_check_return_type', True)

        params_map = {
            'all': [
                'events', 'current_page', 'page_size', 'async_req',
                '_preload_content', '_request_timeout',
                '_return_http_data_only', '_check_input_type',
                '_check_return_type'
            ],
            'required': [],
            'nullable': ['_request_timeout'],
            'enum': [],
            'validation': []
        }
        validations = {}
        allowed_values = {}
        openapi_types = {
            'events': (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, ),
            '_check_input_type': (bool, ),
            '_check_return_type': (bool, )
        }
        attribute_map = {
            'events': 'events',
            'current_page': 'currentPage',
            'page_size': 'pageSize',
        }
        location_map = {
            'events': '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, ))
            # only throw this nullable ApiValueError if _check_input_type
            # is False, if _check_input_type==True we catch this case
            # in self.__validate_inputs
            if (key not in params_map['nullable'] and value is None
                    and kwargs['_check_input_type'] is False):
                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(
            "/webhooks",
            "GET",
            params['path'],
            params['query'],
            params['header'],
            body=params['body'],
            post_params=params['form'],
            files=params['file'],
            response_type=(WebhooksListResponse, ),
            async_req=kwargs['async_req'],
            _check_type=kwargs['_check_return_type'],
            _return_http_data_only=kwargs['_return_http_data_only'],
            _preload_content=kwargs['_preload_content'],
            _request_timeout=kwargs['_request_timeout'],
            collection_formats=params['collection_format'])
예제 #3
0
    def delete(self, webhook_id, **kwargs):
        """Delete a Webhook  # noqa: E501

            This endpoint will delete the indicated webhook.  # 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(webhook_id, async_req=True)
            >>> result = thread.get()

            Args:
                webhook_id (str): The webhook you wish 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.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                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['_check_input_type'] = kwargs.get('_check_input_type', True)
        kwargs['_check_return_type'] = kwargs.get('_check_return_type', True)
        kwargs['webhook_id'] = \
            webhook_id

        params_map = {
            'all': [
                'webhook_id', 'async_req', '_preload_content',
                '_request_timeout', '_return_http_data_only',
                '_check_input_type', '_check_return_type'
            ],
            'required': [
                'webhook_id',
            ],
            'nullable': ['_request_timeout'],
            'enum': [],
            'validation': []
        }
        validations = {}
        allowed_values = {}
        openapi_types = {
            'webhook_id': (str, ),
            'async_req': (bool, ),
            '_preload_content': (bool, ),
            '_request_timeout': (none_type, int, (int, ), [int]),
            '_return_http_data_only': (bool, ),
            '_check_input_type': (bool, ),
            '_check_return_type': (bool, )
        }
        attribute_map = {
            'webhook_id': 'webhookId',
        }
        location_map = {
            'webhook_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, ))
            # only throw this nullable ApiValueError if _check_input_type
            # is False, if _check_input_type==True we catch this case
            # in self.__validate_inputs
            if (key not in params_map['nullable'] and value is None
                    and kwargs['_check_input_type'] is False):
                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(
            "/webhooks/{webhookId}",
            "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'],
            _check_type=kwargs['_check_return_type'],
            _return_http_data_only=kwargs['_return_http_data_only'],
            _preload_content=kwargs['_preload_content'],
            _request_timeout=kwargs['_request_timeout'],
            collection_formats=params['collection_format'])
예제 #4
0
    def update(self, live_stream_id, live_stream_update_payload, **kwargs):
        """Update a live stream  # noqa: E501

            Use this endpoint to update the player, or to turn recording on/off (saving a copy of the livestream). NOTE: If the livestream is actively streaming, changing the recording status will only affect the NEXT stream.    The public=false 'private livestream' is available as a BETA feature, and should be limited to livestreams of 3,000 viewers or fewer.  # 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(live_stream_id, live_stream_update_payload, async_req=True)
            >>> result = thread.get()

            Args:
                live_stream_id (str): The unique ID for the live stream that you want to update information for such as player details, or whether you want the recording on or off.
                live_stream_update_payload (LiveStreamUpdatePayload):

            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.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                async_req (bool): execute request asynchronously

            Returns:
                LiveStream
                    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['_check_input_type'] = kwargs.get('_check_input_type', True)
        kwargs['_check_return_type'] = kwargs.get('_check_return_type', True)
        kwargs['live_stream_id'] = \
            live_stream_id
        kwargs['live_stream_update_payload'] = \
            live_stream_update_payload

        params_map = {
            'all': [
                'live_stream_id', 'live_stream_update_payload', 'async_req',
                '_preload_content', '_request_timeout',
                '_return_http_data_only', '_check_input_type',
                '_check_return_type'
            ],
            'required': [
                'live_stream_id',
                'live_stream_update_payload',
            ],
            'nullable': ['_request_timeout'],
            'enum': [],
            'validation': []
        }
        validations = {}
        allowed_values = {}
        openapi_types = {
            'live_stream_id': (str, ),
            'live_stream_update_payload': (LiveStreamUpdatePayload, ),
            'async_req': (bool, ),
            '_preload_content': (bool, ),
            '_request_timeout': (none_type, int, (int, ), [int]),
            '_return_http_data_only': (bool, ),
            '_check_input_type': (bool, ),
            '_check_return_type': (bool, )
        }
        attribute_map = {
            'live_stream_id': 'liveStreamId',
        }
        location_map = {
            'live_stream_id': 'path',
            'live_stream_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, ))
            # only throw this nullable ApiValueError if _check_input_type
            # is False, if _check_input_type==True we catch this case
            # in self.__validate_inputs
            if (key not in params_map['nullable'] and value is None
                    and kwargs['_check_input_type'] is False):
                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(
            "/live-streams/{liveStreamId}",
            "PATCH",
            params['path'],
            params['query'],
            params['header'],
            body=params['body'],
            post_params=params['form'],
            files=params['file'],
            response_type=(LiveStream, ),
            async_req=kwargs['async_req'],
            _check_type=kwargs['_check_return_type'],
            _return_http_data_only=kwargs['_return_http_data_only'],
            _preload_content=kwargs['_preload_content'],
            _request_timeout=kwargs['_request_timeout'],
            collection_formats=params['collection_format'])
예제 #5
0
    def create(self, live_stream_creation_payload, **kwargs):
        """Create live stream  # noqa: E501

            A live stream will give you the 'connection point' to RTMP your video stream to api.video. It will also give you the details for viewers to watch the same livestream.  The public=false 'private livestream' is available as a BETA feature, and should be limited to livestreams of 3,000 viewers or fewer.  See our [Live Stream Tutorial](https://api.video/blog/tutorials/live-stream-tutorial) for a walkthrough of this API with OBS. Your RTMP endpoint for the livestream is rtmp://broadcast.api.video/s/{streamKey}  # 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(live_stream_creation_payload, async_req=True)
            >>> result = thread.get()

            Args:
                live_stream_creation_payload (LiveStreamCreationPayload):

            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.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                async_req (bool): execute request asynchronously

            Returns:
                LiveStream
                    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['_check_input_type'] = kwargs.get('_check_input_type', True)
        kwargs['_check_return_type'] = kwargs.get('_check_return_type', True)
        kwargs['live_stream_creation_payload'] = \
            live_stream_creation_payload

        params_map = {
            'all': [
                'live_stream_creation_payload', 'async_req',
                '_preload_content', '_request_timeout',
                '_return_http_data_only', '_check_input_type',
                '_check_return_type'
            ],
            'required': [
                'live_stream_creation_payload',
            ],
            'nullable': ['_request_timeout'],
            'enum': [],
            'validation': []
        }
        validations = {}
        allowed_values = {}
        openapi_types = {
            'live_stream_creation_payload': (LiveStreamCreationPayload, ),
            'async_req': (bool, ),
            '_preload_content': (bool, ),
            '_request_timeout': (none_type, int, (int, ), [int]),
            '_return_http_data_only': (bool, ),
            '_check_input_type': (bool, ),
            '_check_return_type': (bool, )
        }
        attribute_map = {}
        location_map = {
            'live_stream_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, ))
            # only throw this nullable ApiValueError if _check_input_type
            # is False, if _check_input_type==True we catch this case
            # in self.__validate_inputs
            if (key not in params_map['nullable'] and value is None
                    and kwargs['_check_input_type'] is False):
                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(
            "/live-streams",
            "POST",
            params['path'],
            params['query'],
            params['header'],
            body=params['body'],
            post_params=params['form'],
            files=params['file'],
            response_type=(LiveStream, ),
            async_req=kwargs['async_req'],
            _check_type=kwargs['_check_return_type'],
            _return_http_data_only=kwargs['_return_http_data_only'],
            _preload_content=kwargs['_preload_content'],
            _request_timeout=kwargs['_request_timeout'],
            collection_formats=params['collection_format'])
예제 #6
0
    def list(self, **kwargs):
        """List all live streams  # noqa: E501

            With no parameters added to the url, this will return all livestreams. Query by name or key to limit the list.  # 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:
                stream_key (str): The unique stream key that allows you to stream videos.. [optional]
                name (str): You can filter live streams by their name or a part of their name.. [optional]
                sort_by (str): Allowed: createdAt, publishedAt, name. createdAt - the time a livestream was created using the specified streamKey. publishedAt - the time a livestream was published using the specified streamKey. name - the name of the livestream. If you choose one of the time based options, the time is presented in ISO-8601 format.. [optional]
                sort_order (str): Allowed: asc, desc. Ascending for date and time means that earlier values precede later ones. Descending means that later values preced earlier ones. For title, it is 0-9 and A-Z ascending and Z-A, 9-0 descending.. [optional]
                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.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                async_req (bool): execute request asynchronously

            Returns:
                LiveStreamListResponse
                    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['_check_input_type'] = kwargs.get('_check_input_type', True)
        kwargs['_check_return_type'] = kwargs.get('_check_return_type', True)

        params_map = {
            'all': [
                'stream_key', 'name', 'sort_by', 'sort_order', 'current_page',
                'page_size', 'async_req', '_preload_content',
                '_request_timeout', '_return_http_data_only',
                '_check_input_type', '_check_return_type'
            ],
            'required': [],
            'nullable': ['_request_timeout'],
            'enum': [
                'sort_order',
            ],
            'validation': []
        }
        validations = {}
        allowed_values = {
            ('sort_order', ): {
                "ASC": "asc",
                "DESC": "desc"
            },
        }
        openapi_types = {
            'stream_key': (str, ),
            'name': (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, ),
            '_check_input_type': (bool, ),
            '_check_return_type': (bool, )
        }
        attribute_map = {
            'stream_key': 'streamKey',
            'name': 'name',
            'sort_by': 'sortBy',
            'sort_order': 'sortOrder',
            'current_page': 'currentPage',
            'page_size': 'pageSize',
        }
        location_map = {
            'stream_key': 'query',
            'name': '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, ))
            # only throw this nullable ApiValueError if _check_input_type
            # is False, if _check_input_type==True we catch this case
            # in self.__validate_inputs
            if (key not in params_map['nullable'] and value is None
                    and kwargs['_check_input_type'] is False):
                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(
            "/live-streams",
            "GET",
            params['path'],
            params['query'],
            params['header'],
            body=params['body'],
            post_params=params['form'],
            files=params['file'],
            response_type=(LiveStreamListResponse, ),
            async_req=kwargs['async_req'],
            _check_type=kwargs['_check_return_type'],
            _return_http_data_only=kwargs['_return_http_data_only'],
            _preload_content=kwargs['_preload_content'],
            _request_timeout=kwargs['_request_timeout'],
            collection_formats=params['collection_format'])
예제 #7
0
    def upload(self, video_id, language, file, **kwargs):
        """Upload a caption  # noqa: E501

            Upload a VTT file to add captions to your video.  Read our [captioning tutorial](https://api.video/blog/tutorials/adding-captions) for more details.  # noqa: E501
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.upload(video_id, language, file, async_req=True)
            >>> result = thread.get()

            Args:
                video_id (str): The unique identifier for the video you want to add a caption to.
                language (str): A valid BCP 47 language representation.
                file (file_type): The video text track (VTT) you want to upload.

            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.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                async_req (bool): execute request asynchronously

            Returns:
                Caption
                    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['_check_input_type'] = kwargs.get('_check_input_type', True)
        kwargs['_check_return_type'] = kwargs.get('_check_return_type', True)
        kwargs['video_id'] = \
            video_id
        kwargs['language'] = \
            language
        kwargs['file'] = \
            file

        params_map = {
            'all': [
                'video_id', 'language', 'file', 'async_req',
                '_preload_content', '_request_timeout',
                '_return_http_data_only', '_check_input_type',
                '_check_return_type'
            ],
            'required': [
                'video_id',
                'language',
                'file',
            ],
            'nullable': ['_request_timeout'],
            'enum': [],
            'validation': []
        }
        validations = {}
        allowed_values = {}
        openapi_types = {
            'video_id': (str, ),
            'language': (str, ),
            'file': (file_type, ),
            'async_req': (bool, ),
            '_preload_content': (bool, ),
            '_request_timeout': (none_type, int, (int, ), [int]),
            '_return_http_data_only': (bool, ),
            '_check_input_type': (bool, ),
            '_check_return_type': (bool, )
        }
        attribute_map = {
            'video_id': 'videoId',
            'language': 'language',
            'file': 'file',
        }
        location_map = {
            'video_id': 'path',
            'language': 'path',
            'file': 'form',
        }
        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 `upload`" % (key, ))
            # only throw this nullable ApiValueError if _check_input_type
            # is False, if _check_input_type==True we catch this case
            # in self.__validate_inputs
            if (key not in params_map['nullable'] and value is None
                    and kwargs['_check_input_type'] is False):
                raise ApiValueError(
                    "Value may not be None for non-nullable parameter `%s`"
                    " when calling `upload`" % (key, ))

        for key in params_map['required']:
            if key not in kwargs.keys():
                raise ApiValueError(
                    "Missing the required parameter `%s` when calling "
                    "`upload`" % (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(
            "/videos/{videoId}/captions/{language}",
            "POST",
            params['path'],
            params['query'],
            params['header'],
            body=params['body'],
            post_params=params['form'],
            files=params['file'],
            response_type=(Caption, ),
            async_req=kwargs['async_req'],
            _check_type=kwargs['_check_return_type'],
            _return_http_data_only=kwargs['_return_http_data_only'],
            _preload_content=kwargs['_preload_content'],
            _request_timeout=kwargs['_request_timeout'],
            collection_formats=params['collection_format'])
예제 #8
0
    def list_video_sessions(
            self,
            video_id,
            **kwargs
        ):
            """List video player sessions  # noqa: E501

            Retrieve all available user sessions for a specific 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.list_video_sessions(video_id, async_req=True)
            >>> result = thread.get()

            Args:
                video_id (str): The unique identifier for the video you want to retrieve session information for.

            Keyword Args:
                period (str): Period must have one of the following formats:   - For a day : 2018-01-01, - For a week: 2018-W01,  - For a month: 2018-01 - For a year: 2018  For a range period:  -  Date range: 2018-01-01/2018-01-15 . [optional]
                metadata ([str]): Metadata and Dynamic Metadata filter. Send an array of key value pairs you want to filter sessios with.. [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.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                async_req (bool): execute request asynchronously

            Returns:
                RawStatisticsListSessionsResponse
                    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['_check_input_type'] = kwargs.get(
                '_check_input_type', True
            )
            kwargs['_check_return_type'] = kwargs.get(
                '_check_return_type', True
            )
            kwargs['video_id'] = \
                video_id

            params_map = {
                'all': [
                    'video_id',
                    'period',
                    'metadata',
                    'current_page',
                    'page_size',
                    'async_req',
                    '_preload_content',
                    '_request_timeout',
                    '_return_http_data_only',
                    '_check_input_type',
                    '_check_return_type'
                ],
                'required': [
                    'video_id',
                ],
                'nullable': [
                    '_request_timeout'
                ],
                'enum': [
                ],
                'validation': [
                ]
            }
            validations = {
            }
            allowed_values = {
            }
            openapi_types = {
                'video_id':
                    (str,),
                'period':
                    (str,),
                'metadata':
                    ([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,),
                '_check_input_type': (bool,),
                '_check_return_type': (bool,)
            }
            attribute_map = {
                'video_id': 'videoId',
                'period': 'period',
                'metadata': 'metadata',
                'current_page': 'currentPage',
                'page_size': 'pageSize',
            }
            location_map = {
                'video_id': 'path',
                'period': 'query',
                'metadata': 'query',
                'current_page': 'query',
                'page_size': 'query',
            }
            collection_format_map = {
                'metadata': 'multi',
            }

            for key, value in kwargs.items():
                if key not in params_map['all']:
                    raise ApiTypeError(
                        "Got an unexpected parameter '%s'"
                        " to method `list_video_sessions`" %
                        (key, )
                    )
                # only throw this nullable ApiValueError if _check_input_type
                # is False, if _check_input_type==True we catch this case
                # in self.__validate_inputs
                if (key not in params_map['nullable'] and value is None
                        and kwargs['_check_input_type'] is False):
                    raise ApiValueError(
                        "Value may not be None for non-nullable parameter `%s`"
                        " when calling `list_video_sessions`" %
                        (key, )
                    )

            for key in params_map['required']:
                if key not in kwargs.keys():
                    raise ApiValueError(
                        "Missing the required parameter `%s` when calling "
                        "`list_video_sessions`" % (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(
                "/analytics/videos/{videoId}",
                "GET",
                params['path'],
                params['query'],
                params['header'],
                body=params['body'],
                post_params=params['form'],
                files=params['file'],
                response_type=(RawStatisticsListSessionsResponse,),
                async_req=kwargs['async_req'],
                _check_type=kwargs['_check_return_type'],
                _return_http_data_only=kwargs['_return_http_data_only'],
                _preload_content=kwargs['_preload_content'],
                _request_timeout=kwargs['_request_timeout'],
                collection_formats=params['collection_format'])
예제 #9
0
    def upload_logo(self, player_id, file, **kwargs):
        """Upload a logo  # noqa: E501

            The uploaded image maximum size should be 200x100 and its weight should be 200KB.  It will be scaled down to 30px height and converted to PNG to be displayed in the player.  # noqa: E501
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.upload_logo(player_id, file, async_req=True)
            >>> result = thread.get()

            Args:
                player_id (str): The unique identifier for the player.
                file (file_type): The name of the file you want to use for your logo.

            Keyword Args:
                link (str): A public link that you want to advertise in your player. For example, you could add a link to your company. When a viewer clicks on your logo, they will be taken to this address.. [optional]
                _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.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                async_req (bool): execute request asynchronously

            Returns:
                PlayerTheme
                    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['_check_input_type'] = kwargs.get('_check_input_type', True)
        kwargs['_check_return_type'] = kwargs.get('_check_return_type', True)
        kwargs['player_id'] = \
            player_id
        kwargs['file'] = \
            file

        params_map = {
            'all': [
                'player_id', 'file', 'link', 'async_req', '_preload_content',
                '_request_timeout', '_return_http_data_only',
                '_check_input_type', '_check_return_type'
            ],
            'required': [
                'player_id',
                'file',
            ],
            'nullable': ['_request_timeout'],
            'enum': [],
            'validation': []
        }
        validations = {}
        allowed_values = {}
        openapi_types = {
            'player_id': (str, ),
            'file': (file_type, ),
            'link': (str, ),
            'async_req': (bool, ),
            '_preload_content': (bool, ),
            '_request_timeout': (none_type, int, (int, ), [int]),
            '_return_http_data_only': (bool, ),
            '_check_input_type': (bool, ),
            '_check_return_type': (bool, )
        }
        attribute_map = {
            'player_id': 'playerId',
            'file': 'file',
            'link': 'link',
        }
        location_map = {
            'player_id': 'path',
            'file': 'form',
            'link': 'form',
        }
        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 `upload_logo`" % (key, ))
            # only throw this nullable ApiValueError if _check_input_type
            # is False, if _check_input_type==True we catch this case
            # in self.__validate_inputs
            if (key not in params_map['nullable'] and value is None
                    and kwargs['_check_input_type'] is False):
                raise ApiValueError(
                    "Value may not be None for non-nullable parameter `%s`"
                    " when calling `upload_logo`" % (key, ))

        for key in params_map['required']:
            if key not in kwargs.keys():
                raise ApiValueError(
                    "Missing the required parameter `%s` when calling "
                    "`upload_logo`" % (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(
            "/players/{playerId}/logo",
            "POST",
            params['path'],
            params['query'],
            params['header'],
            body=params['body'],
            post_params=params['form'],
            files=params['file'],
            response_type=(PlayerTheme, ),
            async_req=kwargs['async_req'],
            _check_type=kwargs['_check_return_type'],
            _return_http_data_only=kwargs['_return_http_data_only'],
            _preload_content=kwargs['_preload_content'],
            _request_timeout=kwargs['_request_timeout'],
            collection_formats=params['collection_format'])
예제 #10
0
    def update(self, player_id, player_theme_update_payload, **kwargs):
        """Update a player  # noqa: E501

            Use a player ID to update specific details for a player. NOTE: It may take up to 10 min before the new player configuration is available from our CDN.  # 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(player_id, player_theme_update_payload, async_req=True)
            >>> result = thread.get()

            Args:
                player_id (str): The unique identifier for the player.
                player_theme_update_payload (PlayerThemeUpdatePayload):

            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.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                async_req (bool): execute request asynchronously

            Returns:
                PlayerTheme
                    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['_check_input_type'] = kwargs.get('_check_input_type', True)
        kwargs['_check_return_type'] = kwargs.get('_check_return_type', True)
        kwargs['player_id'] = \
            player_id
        kwargs['player_theme_update_payload'] = \
            player_theme_update_payload

        params_map = {
            'all': [
                'player_id', 'player_theme_update_payload', 'async_req',
                '_preload_content', '_request_timeout',
                '_return_http_data_only', '_check_input_type',
                '_check_return_type'
            ],
            'required': [
                'player_id',
                'player_theme_update_payload',
            ],
            'nullable': ['_request_timeout'],
            'enum': [],
            'validation': []
        }
        validations = {}
        allowed_values = {}
        openapi_types = {
            'player_id': (str, ),
            'player_theme_update_payload': (PlayerThemeUpdatePayload, ),
            'async_req': (bool, ),
            '_preload_content': (bool, ),
            '_request_timeout': (none_type, int, (int, ), [int]),
            '_return_http_data_only': (bool, ),
            '_check_input_type': (bool, ),
            '_check_return_type': (bool, )
        }
        attribute_map = {
            'player_id': 'playerId',
        }
        location_map = {
            'player_id': 'path',
            'player_theme_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, ))
            # only throw this nullable ApiValueError if _check_input_type
            # is False, if _check_input_type==True we catch this case
            # in self.__validate_inputs
            if (key not in params_map['nullable'] and value is None
                    and kwargs['_check_input_type'] is False):
                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(
            "/players/{playerId}",
            "PATCH",
            params['path'],
            params['query'],
            params['header'],
            body=params['body'],
            post_params=params['form'],
            files=params['file'],
            response_type=(PlayerTheme, ),
            async_req=kwargs['async_req'],
            _check_type=kwargs['_check_return_type'],
            _return_http_data_only=kwargs['_return_http_data_only'],
            _preload_content=kwargs['_preload_content'],
            _request_timeout=kwargs['_request_timeout'],
            collection_formats=params['collection_format'])