2024-01-14 12:30:33 +02:00

9017 lines
400 KiB
Python

# coding: utf-8
"""
PeerTube
The PeerTube API is built on HTTP(S) and is RESTful. You can use your favorite HTTP/REST library for your programming language to use PeerTube. The spec API is fully compatible with [openapi-generator](https://github.com/OpenAPITools/openapi-generator/wiki/API-client-generator-HOWTO) which generates a client SDK in the language of your choice - we generate some client SDKs automatically: - [Python](https://framagit.org/framasoft/peertube/clients/python) - [Go](https://framagit.org/framasoft/peertube/clients/go) - [Kotlin](https://framagit.org/framasoft/peertube/clients/kotlin) See the [REST API quick start](https://docs.joinpeertube.org/api/rest-getting-started) for a few examples of using the PeerTube API. # Authentication When you sign up for an account on a PeerTube instance, you are given the possibility to generate sessions on it, and authenticate there using an access token. Only __one access token can currently be used at a time__. ## Roles Accounts are given permissions based on their role. There are three roles on PeerTube: Administrator, Moderator, and User. See the [roles guide](https://docs.joinpeertube.org/admin/managing-users#roles) for a detail of their permissions. # Errors The API uses standard HTTP status codes to indicate the success or failure of the API call, completed by a [RFC7807-compliant](https://tools.ietf.org/html/rfc7807) response body. ``` HTTP 1.1 404 Not Found Content-Type: application/problem+json; charset=utf-8 { \"detail\": \"Video not found\", \"docs\": \"https://docs.joinpeertube.org/api-rest-reference.html#operation/getVideo\", \"status\": 404, \"title\": \"Not Found\", \"type\": \"about:blank\" } ``` We provide error `type` values for [a growing number of cases](https://github.com/Chocobozzz/PeerTube/blob/develop/packages/models/src/server/core-error-code.enum.ts), but it is still optional. Types are used to disambiguate errors that bear the same status code and are non-obvious: ``` HTTP 1.1 403 Forbidden Content-Type: application/problem+json; charset=utf-8 { \"detail\": \"Cannot get this video regarding follow constraints\", \"docs\": \"https://docs.joinpeertube.org/api-rest-reference.html#operation/getVideo\", \"status\": 403, \"title\": \"Forbidden\", \"type\": \"https://docs.joinpeertube.org/api-rest-reference.html#section/Errors/does_not_respect_follow_constraints\" } ``` Here a 403 error could otherwise mean that the video is private or blocklisted. ### Validation errors Each parameter is evaluated on its own against a set of rules before the route validator proceeds with potential testing involving parameter combinations. Errors coming from validation errors appear earlier and benefit from a more detailed error description: ``` HTTP 1.1 400 Bad Request Content-Type: application/problem+json; charset=utf-8 { \"detail\": \"Incorrect request parameters: id\", \"docs\": \"https://docs.joinpeertube.org/api-rest-reference.html#operation/getVideo\", \"instance\": \"/api/v1/videos/9c9de5e8-0a1e-484a-b099-e80766180\", \"invalid-params\": { \"id\": { \"location\": \"params\", \"msg\": \"Invalid value\", \"param\": \"id\", \"value\": \"9c9de5e8-0a1e-484a-b099-e80766180\" } }, \"status\": 400, \"title\": \"Bad Request\", \"type\": \"about:blank\" } ``` Where `id` is the name of the field concerned by the error, within the route definition. `invalid-params.<field>.location` can be either 'params', 'body', 'header', 'query' or 'cookies', and `invalid-params.<field>.value` reports the value that didn't pass validation whose `invalid-params.<field>.msg` is about. ### Deprecated error fields Some fields could be included with previous versions. They are still included but their use is deprecated: - `error`: superseded by `detail` - `code`: superseded by `type` (which is now an URI) # Rate limits We are rate-limiting all endpoints of PeerTube's API. Custom values can be set by administrators: | Endpoint (prefix: `/api/v1`) | Calls | Time frame | |------------------------------|---------------|--------------| | `/*` | 50 | 10 seconds | | `POST /users/token` | 15 | 5 minutes | | `POST /users/register` | 2<sup>*</sup> | 5 minutes | | `POST /users/ask-send-verify-email` | 3 | 5 minutes | Depending on the endpoint, <sup>*</sup>failed requests are not taken into account. A service limit is announced by a `429 Too Many Requests` status code. You can get details about the current state of your rate limit by reading the following headers: | Header | Description | |-------------------------|------------------------------------------------------------| | `X-RateLimit-Limit` | Number of max requests allowed in the current time period | | `X-RateLimit-Remaining` | Number of remaining requests in the current time period | | `X-RateLimit-Reset` | Timestamp of end of current time period as UNIX timestamp | | `Retry-After` | Seconds to delay after the first `429` is received | # CORS This API features [Cross-Origin Resource Sharing (CORS)](https://fetch.spec.whatwg.org/), allowing cross-domain communication from the browser for some routes: | Endpoint | |------------------------- ---| | `/api/*` | | `/download/*` | | `/lazy-static/*` | | `/.well-known/webfinger` | In addition, all routes serving ActivityPub are CORS-enabled for all origins.
The version of the OpenAPI document: 5.2.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated
from datetime import datetime
from pydantic import Field, StrictBool, StrictBytes, StrictFloat, StrictInt, StrictStr, field_validator
from typing import Any, List, Optional, Union
from typing_extensions import Annotated
from peertube.models.list_video_storyboards200_response import ListVideoStoryboards200Response
from peertube.models.live_video_latency_mode import LiveVideoLatencyMode
from peertube.models.live_video_replay_settings import LiveVideoReplaySettings
from peertube.models.live_video_response import LiveVideoResponse
from peertube.models.live_video_update import LiveVideoUpdate
from peertube.models.user_viewing_video import UserViewingVideo
from peertube.models.video_details import VideoDetails
from peertube.models.video_list_response import VideoListResponse
from peertube.models.video_privacy_set import VideoPrivacySet
from peertube.models.video_replace_source_request_resumable import VideoReplaceSourceRequestResumable
from peertube.models.video_scheduled_update import VideoScheduledUpdate
from peertube.models.video_source import VideoSource
from peertube.models.video_token_response import VideoTokenResponse
from peertube.models.video_upload_request_resumable import VideoUploadRequestResumable
from peertube.models.video_upload_response import VideoUploadResponse
from peertube.api_client import ApiClient, RequestSerialized
from peertube.api_response import ApiResponse
from peertube.rest import RESTResponseType
class VideoApi:
"""NOTE: This class is auto generated by OpenAPI Generator
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
def __init__(self, api_client=None) -> None:
if api_client is None:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_call
def add_live(
self,
channel_id: Annotated[StrictInt, Field(description="Channel id that will contain this live video")],
name: Annotated[str, Field(min_length=3, strict=True, max_length=120, description="Live video/replay name")],
save_replay: Optional[StrictBool] = None,
replay_settings: Optional[LiveVideoReplaySettings] = None,
permanent_live: Annotated[Optional[StrictBool], Field(description="User can stream multiple times in a permanent live")] = None,
latency_mode: Optional[LiveVideoLatencyMode] = None,
thumbnailfile: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="Live video/replay thumbnail file")] = None,
previewfile: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="Live video/replay preview file")] = None,
privacy: Optional[VideoPrivacySet] = None,
category: Annotated[Optional[StrictInt], Field(description="category id of the video (see [/videos/categories](#operation/getCategories))")] = None,
licence: Annotated[Optional[StrictInt], Field(description="licence id of the video (see [/videos/licences](#operation/getLicences))")] = None,
language: Annotated[Optional[StrictStr], Field(description="language id of the video (see [/videos/languages](#operation/getLanguages))")] = None,
description: Annotated[Optional[StrictStr], Field(description="Live video/replay description")] = None,
support: Annotated[Optional[StrictStr], Field(description="A text tell the audience how to support the creator")] = None,
nsfw: Annotated[Optional[StrictBool], Field(description="Whether or not this live video/replay contains sensitive content")] = None,
tags: Annotated[Optional[Annotated[List[Annotated[str, Field(min_length=2, strict=True, max_length=30)]], Field(min_length=1, max_length=5)]], Field(description="Live video/replay tags (maximum 5 tags each between 2 and 30 characters)")] = None,
comments_enabled: Annotated[Optional[StrictBool], Field(description="Enable or disable comments for this live video/replay")] = None,
download_enabled: Annotated[Optional[StrictBool], Field(description="Enable or disable downloading for the replay of this live video")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> VideoUploadResponse:
"""Create a live
:param channel_id: Channel id that will contain this live video (required)
:type channel_id: int
:param name: Live video/replay name (required)
:type name: str
:param save_replay:
:type save_replay: bool
:param replay_settings:
:type replay_settings: LiveVideoReplaySettings
:param permanent_live: User can stream multiple times in a permanent live
:type permanent_live: bool
:param latency_mode:
:type latency_mode: LiveVideoLatencyMode
:param thumbnailfile: Live video/replay thumbnail file
:type thumbnailfile: bytearray
:param previewfile: Live video/replay preview file
:type previewfile: bytearray
:param privacy:
:type privacy: VideoPrivacySet
:param category: category id of the video (see [/videos/categories](#operation/getCategories))
:type category: int
:param licence: licence id of the video (see [/videos/licences](#operation/getLicences))
:type licence: int
:param language: language id of the video (see [/videos/languages](#operation/getLanguages))
:type language: str
:param description: Live video/replay description
:type description: str
:param support: A text tell the audience how to support the creator
:type support: str
:param nsfw: Whether or not this live video/replay contains sensitive content
:type nsfw: bool
:param tags: Live video/replay tags (maximum 5 tags each between 2 and 30 characters)
:type tags: List[str]
:param comments_enabled: Enable or disable comments for this live video/replay
:type comments_enabled: bool
:param download_enabled: Enable or disable downloading for the replay of this live video
:type download_enabled: bool
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._add_live_serialize(
channel_id=channel_id,
name=name,
save_replay=save_replay,
replay_settings=replay_settings,
permanent_live=permanent_live,
latency_mode=latency_mode,
thumbnailfile=thumbnailfile,
previewfile=previewfile,
privacy=privacy,
category=category,
licence=licence,
language=language,
description=description,
support=support,
nsfw=nsfw,
tags=tags,
comments_enabled=comments_enabled,
download_enabled=download_enabled,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "VideoUploadResponse",
'400': None,
'403': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def add_live_with_http_info(
self,
channel_id: Annotated[StrictInt, Field(description="Channel id that will contain this live video")],
name: Annotated[str, Field(min_length=3, strict=True, max_length=120, description="Live video/replay name")],
save_replay: Optional[StrictBool] = None,
replay_settings: Optional[LiveVideoReplaySettings] = None,
permanent_live: Annotated[Optional[StrictBool], Field(description="User can stream multiple times in a permanent live")] = None,
latency_mode: Optional[LiveVideoLatencyMode] = None,
thumbnailfile: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="Live video/replay thumbnail file")] = None,
previewfile: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="Live video/replay preview file")] = None,
privacy: Optional[VideoPrivacySet] = None,
category: Annotated[Optional[StrictInt], Field(description="category id of the video (see [/videos/categories](#operation/getCategories))")] = None,
licence: Annotated[Optional[StrictInt], Field(description="licence id of the video (see [/videos/licences](#operation/getLicences))")] = None,
language: Annotated[Optional[StrictStr], Field(description="language id of the video (see [/videos/languages](#operation/getLanguages))")] = None,
description: Annotated[Optional[StrictStr], Field(description="Live video/replay description")] = None,
support: Annotated[Optional[StrictStr], Field(description="A text tell the audience how to support the creator")] = None,
nsfw: Annotated[Optional[StrictBool], Field(description="Whether or not this live video/replay contains sensitive content")] = None,
tags: Annotated[Optional[Annotated[List[Annotated[str, Field(min_length=2, strict=True, max_length=30)]], Field(min_length=1, max_length=5)]], Field(description="Live video/replay tags (maximum 5 tags each between 2 and 30 characters)")] = None,
comments_enabled: Annotated[Optional[StrictBool], Field(description="Enable or disable comments for this live video/replay")] = None,
download_enabled: Annotated[Optional[StrictBool], Field(description="Enable or disable downloading for the replay of this live video")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[VideoUploadResponse]:
"""Create a live
:param channel_id: Channel id that will contain this live video (required)
:type channel_id: int
:param name: Live video/replay name (required)
:type name: str
:param save_replay:
:type save_replay: bool
:param replay_settings:
:type replay_settings: LiveVideoReplaySettings
:param permanent_live: User can stream multiple times in a permanent live
:type permanent_live: bool
:param latency_mode:
:type latency_mode: LiveVideoLatencyMode
:param thumbnailfile: Live video/replay thumbnail file
:type thumbnailfile: bytearray
:param previewfile: Live video/replay preview file
:type previewfile: bytearray
:param privacy:
:type privacy: VideoPrivacySet
:param category: category id of the video (see [/videos/categories](#operation/getCategories))
:type category: int
:param licence: licence id of the video (see [/videos/licences](#operation/getLicences))
:type licence: int
:param language: language id of the video (see [/videos/languages](#operation/getLanguages))
:type language: str
:param description: Live video/replay description
:type description: str
:param support: A text tell the audience how to support the creator
:type support: str
:param nsfw: Whether or not this live video/replay contains sensitive content
:type nsfw: bool
:param tags: Live video/replay tags (maximum 5 tags each between 2 and 30 characters)
:type tags: List[str]
:param comments_enabled: Enable or disable comments for this live video/replay
:type comments_enabled: bool
:param download_enabled: Enable or disable downloading for the replay of this live video
:type download_enabled: bool
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._add_live_serialize(
channel_id=channel_id,
name=name,
save_replay=save_replay,
replay_settings=replay_settings,
permanent_live=permanent_live,
latency_mode=latency_mode,
thumbnailfile=thumbnailfile,
previewfile=previewfile,
privacy=privacy,
category=category,
licence=licence,
language=language,
description=description,
support=support,
nsfw=nsfw,
tags=tags,
comments_enabled=comments_enabled,
download_enabled=download_enabled,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "VideoUploadResponse",
'400': None,
'403': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def add_live_without_preload_content(
self,
channel_id: Annotated[StrictInt, Field(description="Channel id that will contain this live video")],
name: Annotated[str, Field(min_length=3, strict=True, max_length=120, description="Live video/replay name")],
save_replay: Optional[StrictBool] = None,
replay_settings: Optional[LiveVideoReplaySettings] = None,
permanent_live: Annotated[Optional[StrictBool], Field(description="User can stream multiple times in a permanent live")] = None,
latency_mode: Optional[LiveVideoLatencyMode] = None,
thumbnailfile: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="Live video/replay thumbnail file")] = None,
previewfile: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="Live video/replay preview file")] = None,
privacy: Optional[VideoPrivacySet] = None,
category: Annotated[Optional[StrictInt], Field(description="category id of the video (see [/videos/categories](#operation/getCategories))")] = None,
licence: Annotated[Optional[StrictInt], Field(description="licence id of the video (see [/videos/licences](#operation/getLicences))")] = None,
language: Annotated[Optional[StrictStr], Field(description="language id of the video (see [/videos/languages](#operation/getLanguages))")] = None,
description: Annotated[Optional[StrictStr], Field(description="Live video/replay description")] = None,
support: Annotated[Optional[StrictStr], Field(description="A text tell the audience how to support the creator")] = None,
nsfw: Annotated[Optional[StrictBool], Field(description="Whether or not this live video/replay contains sensitive content")] = None,
tags: Annotated[Optional[Annotated[List[Annotated[str, Field(min_length=2, strict=True, max_length=30)]], Field(min_length=1, max_length=5)]], Field(description="Live video/replay tags (maximum 5 tags each between 2 and 30 characters)")] = None,
comments_enabled: Annotated[Optional[StrictBool], Field(description="Enable or disable comments for this live video/replay")] = None,
download_enabled: Annotated[Optional[StrictBool], Field(description="Enable or disable downloading for the replay of this live video")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""Create a live
:param channel_id: Channel id that will contain this live video (required)
:type channel_id: int
:param name: Live video/replay name (required)
:type name: str
:param save_replay:
:type save_replay: bool
:param replay_settings:
:type replay_settings: LiveVideoReplaySettings
:param permanent_live: User can stream multiple times in a permanent live
:type permanent_live: bool
:param latency_mode:
:type latency_mode: LiveVideoLatencyMode
:param thumbnailfile: Live video/replay thumbnail file
:type thumbnailfile: bytearray
:param previewfile: Live video/replay preview file
:type previewfile: bytearray
:param privacy:
:type privacy: VideoPrivacySet
:param category: category id of the video (see [/videos/categories](#operation/getCategories))
:type category: int
:param licence: licence id of the video (see [/videos/licences](#operation/getLicences))
:type licence: int
:param language: language id of the video (see [/videos/languages](#operation/getLanguages))
:type language: str
:param description: Live video/replay description
:type description: str
:param support: A text tell the audience how to support the creator
:type support: str
:param nsfw: Whether or not this live video/replay contains sensitive content
:type nsfw: bool
:param tags: Live video/replay tags (maximum 5 tags each between 2 and 30 characters)
:type tags: List[str]
:param comments_enabled: Enable or disable comments for this live video/replay
:type comments_enabled: bool
:param download_enabled: Enable or disable downloading for the replay of this live video
:type download_enabled: bool
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._add_live_serialize(
channel_id=channel_id,
name=name,
save_replay=save_replay,
replay_settings=replay_settings,
permanent_live=permanent_live,
latency_mode=latency_mode,
thumbnailfile=thumbnailfile,
previewfile=previewfile,
privacy=privacy,
category=category,
licence=licence,
language=language,
description=description,
support=support,
nsfw=nsfw,
tags=tags,
comments_enabled=comments_enabled,
download_enabled=download_enabled,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "VideoUploadResponse",
'400': None,
'403': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _add_live_serialize(
self,
channel_id,
name,
save_replay,
replay_settings,
permanent_live,
latency_mode,
thumbnailfile,
previewfile,
privacy,
category,
licence,
language,
description,
support,
nsfw,
tags,
comments_enabled,
download_enabled,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
'tags': 'csv',
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
# process the query parameters
# process the header parameters
# process the form parameters
if channel_id is not None:
_form_params.append(('channelId', channel_id))
if save_replay is not None:
_form_params.append(('saveReplay', save_replay))
if replay_settings is not None:
_form_params.append(('replaySettings', replay_settings))
if permanent_live is not None:
_form_params.append(('permanentLive', permanent_live))
if latency_mode is not None:
_form_params.append(('latencyMode', latency_mode))
if thumbnailfile is not None:
_files['thumbnailfile'] = thumbnailfile
if previewfile is not None:
_files['previewfile'] = previewfile
if privacy is not None:
_form_params.append(('privacy', privacy))
if category is not None:
_form_params.append(('category', category))
if licence is not None:
_form_params.append(('licence', licence))
if language is not None:
_form_params.append(('language', language))
if description is not None:
_form_params.append(('description', description))
if support is not None:
_form_params.append(('support', support))
if nsfw is not None:
_form_params.append(('nsfw', nsfw))
if name is not None:
_form_params.append(('name', name))
if tags is not None:
_form_params.append(('tags', tags))
if comments_enabled is not None:
_form_params.append(('commentsEnabled', comments_enabled))
if download_enabled is not None:
_form_params.append(('downloadEnabled', download_enabled))
# process the body parameter
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# set the HTTP header `Content-Type`
if _content_type:
_header_params['Content-Type'] = _content_type
else:
_default_content_type = (
self.api_client.select_header_content_type(
[
'multipart/form-data'
]
)
)
if _default_content_type is not None:
_header_params['Content-Type'] = _default_content_type
# authentication setting
_auth_settings: List[str] = [
'OAuth2'
]
return self.api_client.param_serialize(
method='POST',
resource_path='/api/v1/videos/live',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def add_view(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
user_viewing_video: UserViewingVideo,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> None:
"""Notify user is watching a video
Call this endpoint regularly (every 5-10 seconds for example) to notify the server the user is watching the video. After a while, PeerTube will increase video's viewers counter. If the user is authenticated, PeerTube will also store the current player time.
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param user_viewing_video: (required)
:type user_viewing_video: UserViewingVideo
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._add_view_serialize(
id=id,
user_viewing_video=user_viewing_video,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def add_view_with_http_info(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
user_viewing_video: UserViewingVideo,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[None]:
"""Notify user is watching a video
Call this endpoint regularly (every 5-10 seconds for example) to notify the server the user is watching the video. After a while, PeerTube will increase video's viewers counter. If the user is authenticated, PeerTube will also store the current player time.
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param user_viewing_video: (required)
:type user_viewing_video: UserViewingVideo
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._add_view_serialize(
id=id,
user_viewing_video=user_viewing_video,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def add_view_without_preload_content(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
user_viewing_video: UserViewingVideo,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""Notify user is watching a video
Call this endpoint regularly (every 5-10 seconds for example) to notify the server the user is watching the video. After a while, PeerTube will increase video's viewers counter. If the user is authenticated, PeerTube will also store the current player time.
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param user_viewing_video: (required)
:type user_viewing_video: UserViewingVideo
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._add_view_serialize(
id=id,
user_viewing_video=user_viewing_video,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _add_view_serialize(
self,
id,
user_viewing_video,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if id is not None:
_path_params['id'] = id
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
if user_viewing_video is not None:
_body_params = user_viewing_video
# set the HTTP header `Content-Type`
if _content_type:
_header_params['Content-Type'] = _content_type
else:
_default_content_type = (
self.api_client.select_header_content_type(
[
'application/json'
]
)
)
if _default_content_type is not None:
_header_params['Content-Type'] = _default_content_type
# authentication setting
_auth_settings: List[str] = [
]
return self.api_client.param_serialize(
method='POST',
resource_path='/api/v1/videos/{id}/views',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def api_v1_videos_id_studio_edit_post(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> None:
"""Create a studio task
Create a task to edit a video (cut, add intro/outro etc)
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._api_v1_videos_id_studio_edit_post_serialize(
id=id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
'400': None,
'404': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def api_v1_videos_id_studio_edit_post_with_http_info(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[None]:
"""Create a studio task
Create a task to edit a video (cut, add intro/outro etc)
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._api_v1_videos_id_studio_edit_post_serialize(
id=id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
'400': None,
'404': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def api_v1_videos_id_studio_edit_post_without_preload_content(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""Create a studio task
Create a task to edit a video (cut, add intro/outro etc)
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._api_v1_videos_id_studio_edit_post_serialize(
id=id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
'400': None,
'404': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _api_v1_videos_id_studio_edit_post_serialize(
self,
id,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if id is not None:
_path_params['id'] = id
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Content-Type`
if _content_type:
_header_params['Content-Type'] = _content_type
else:
_default_content_type = (
self.api_client.select_header_content_type(
[
'application/x-www-form-urlencoded'
]
)
)
if _default_content_type is not None:
_header_params['Content-Type'] = _default_content_type
# authentication setting
_auth_settings: List[str] = [
'OAuth2'
]
return self.api_client.param_serialize(
method='POST',
resource_path='/api/v1/videos/{id}/studio/edit',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def api_v1_videos_id_watching_put(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
user_viewing_video: UserViewingVideo,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> None:
"""(Deprecated) Set watching progress of a video
This endpoint has been deprecated. Use `/videos/{id}/views` instead
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param user_viewing_video: (required)
:type user_viewing_video: UserViewingVideo
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
warnings.warn("PUT /api/v1/videos/{id}/watching is deprecated.", DeprecationWarning)
_param = self._api_v1_videos_id_watching_put_serialize(
id=id,
user_viewing_video=user_viewing_video,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def api_v1_videos_id_watching_put_with_http_info(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
user_viewing_video: UserViewingVideo,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[None]:
"""(Deprecated) Set watching progress of a video
This endpoint has been deprecated. Use `/videos/{id}/views` instead
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param user_viewing_video: (required)
:type user_viewing_video: UserViewingVideo
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
warnings.warn("PUT /api/v1/videos/{id}/watching is deprecated.", DeprecationWarning)
_param = self._api_v1_videos_id_watching_put_serialize(
id=id,
user_viewing_video=user_viewing_video,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def api_v1_videos_id_watching_put_without_preload_content(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
user_viewing_video: UserViewingVideo,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""(Deprecated) Set watching progress of a video
This endpoint has been deprecated. Use `/videos/{id}/views` instead
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param user_viewing_video: (required)
:type user_viewing_video: UserViewingVideo
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
warnings.warn("PUT /api/v1/videos/{id}/watching is deprecated.", DeprecationWarning)
_param = self._api_v1_videos_id_watching_put_serialize(
id=id,
user_viewing_video=user_viewing_video,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _api_v1_videos_id_watching_put_serialize(
self,
id,
user_viewing_video,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if id is not None:
_path_params['id'] = id
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
if user_viewing_video is not None:
_body_params = user_viewing_video
# set the HTTP header `Content-Type`
if _content_type:
_header_params['Content-Type'] = _content_type
else:
_default_content_type = (
self.api_client.select_header_content_type(
[
'application/json'
]
)
)
if _default_content_type is not None:
_header_params['Content-Type'] = _default_content_type
# authentication setting
_auth_settings: List[str] = [
'OAuth2'
]
return self.api_client.param_serialize(
method='PUT',
resource_path='/api/v1/videos/{id}/watching',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def del_video(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> None:
"""Delete a video
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._del_video_serialize(
id=id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def del_video_with_http_info(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[None]:
"""Delete a video
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._del_video_serialize(
id=id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def del_video_without_preload_content(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""Delete a video
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._del_video_serialize(
id=id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _del_video_serialize(
self,
id,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if id is not None:
_path_params['id'] = id
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
# authentication setting
_auth_settings: List[str] = [
'OAuth2'
]
return self.api_client.param_serialize(
method='DELETE',
resource_path='/api/v1/videos/{id}',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def get_account_videos(
self,
name: Annotated[StrictStr, Field(description="The username or handle of the account")],
category_one_of: Annotated[Optional[Any], Field(description="category id of the video (see [/videos/categories](#operation/getCategories))")] = None,
is_live: Annotated[Optional[StrictBool], Field(description="whether or not the video is a live")] = None,
tags_one_of: Annotated[Optional[Any], Field(description="tag(s) of the video")] = None,
tags_all_of: Annotated[Optional[Any], Field(description="tag(s) of the video, where all should be present in the video")] = None,
licence_one_of: Annotated[Optional[Any], Field(description="licence id of the video (see [/videos/licences](#operation/getLicences))")] = None,
language_one_of: Annotated[Optional[Any], Field(description="language id of the video (see [/videos/languages](#operation/getLanguages)). Use `_unknown` to filter on videos that don't have a video language")] = None,
nsfw: Annotated[Optional[StrictStr], Field(description="whether to include nsfw videos, if any")] = None,
is_local: Annotated[Optional[StrictBool], Field(description="**PeerTube >= 4.0** Display only local or remote videos")] = None,
include: Annotated[Optional[StrictInt], Field(description="**PeerTube >= 4.0** Include additional videos in results (can be combined using bitwise or operator) - `0` NONE - `1` NOT_PUBLISHED_STATE - `2` BLACKLISTED - `4` BLOCKED_OWNER - `8` FILES ")] = None,
privacy_one_of: Annotated[Optional[VideoPrivacySet], Field(description="**PeerTube >= 4.0** Display only videos in this specific privacy/privacies")] = None,
has_hls_files: Annotated[Optional[StrictBool], Field(description="**PeerTube >= 4.0** Display only videos that have HLS files")] = None,
has_web_video_files: Annotated[Optional[StrictBool], Field(description="**PeerTube >= 6.0** Display only videos that have Web Video files")] = None,
skip_count: Annotated[Optional[StrictStr], Field(description="if you don't need the `total` in the response")] = None,
start: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Offset used to paginate results")] = None,
count: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Number of items to return")] = None,
sort: Optional[StrictStr] = None,
exclude_already_watched: Annotated[Optional[StrictBool], Field(description="Whether or not to exclude videos that are in the user's video history")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> VideoListResponse:
"""List videos of an account
:param name: The username or handle of the account (required)
:type name: str
:param category_one_of: category id of the video (see [/videos/categories](#operation/getCategories))
:type category_one_of: GetAccountVideosCategoryOneOfParameter
:param is_live: whether or not the video is a live
:type is_live: bool
:param tags_one_of: tag(s) of the video
:type tags_one_of: GetAccountVideosTagsOneOfParameter
:param tags_all_of: tag(s) of the video, where all should be present in the video
:type tags_all_of: GetAccountVideosTagsAllOfParameter
:param licence_one_of: licence id of the video (see [/videos/licences](#operation/getLicences))
:type licence_one_of: GetAccountVideosLicenceOneOfParameter
:param language_one_of: language id of the video (see [/videos/languages](#operation/getLanguages)). Use `_unknown` to filter on videos that don't have a video language
:type language_one_of: GetAccountVideosLanguageOneOfParameter
:param nsfw: whether to include nsfw videos, if any
:type nsfw: str
:param is_local: **PeerTube >= 4.0** Display only local or remote videos
:type is_local: bool
:param include: **PeerTube >= 4.0** Include additional videos in results (can be combined using bitwise or operator) - `0` NONE - `1` NOT_PUBLISHED_STATE - `2` BLACKLISTED - `4` BLOCKED_OWNER - `8` FILES
:type include: int
:param privacy_one_of: **PeerTube >= 4.0** Display only videos in this specific privacy/privacies
:type privacy_one_of: VideoPrivacySet
:param has_hls_files: **PeerTube >= 4.0** Display only videos that have HLS files
:type has_hls_files: bool
:param has_web_video_files: **PeerTube >= 6.0** Display only videos that have Web Video files
:type has_web_video_files: bool
:param skip_count: if you don't need the `total` in the response
:type skip_count: str
:param start: Offset used to paginate results
:type start: int
:param count: Number of items to return
:type count: int
:param sort:
:type sort: str
:param exclude_already_watched: Whether or not to exclude videos that are in the user's video history
:type exclude_already_watched: bool
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_account_videos_serialize(
name=name,
category_one_of=category_one_of,
is_live=is_live,
tags_one_of=tags_one_of,
tags_all_of=tags_all_of,
licence_one_of=licence_one_of,
language_one_of=language_one_of,
nsfw=nsfw,
is_local=is_local,
include=include,
privacy_one_of=privacy_one_of,
has_hls_files=has_hls_files,
has_web_video_files=has_web_video_files,
skip_count=skip_count,
start=start,
count=count,
sort=sort,
exclude_already_watched=exclude_already_watched,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "VideoListResponse",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def get_account_videos_with_http_info(
self,
name: Annotated[StrictStr, Field(description="The username or handle of the account")],
category_one_of: Annotated[Optional[Any], Field(description="category id of the video (see [/videos/categories](#operation/getCategories))")] = None,
is_live: Annotated[Optional[StrictBool], Field(description="whether or not the video is a live")] = None,
tags_one_of: Annotated[Optional[Any], Field(description="tag(s) of the video")] = None,
tags_all_of: Annotated[Optional[Any], Field(description="tag(s) of the video, where all should be present in the video")] = None,
licence_one_of: Annotated[Optional[Any], Field(description="licence id of the video (see [/videos/licences](#operation/getLicences))")] = None,
language_one_of: Annotated[Optional[Any], Field(description="language id of the video (see [/videos/languages](#operation/getLanguages)). Use `_unknown` to filter on videos that don't have a video language")] = None,
nsfw: Annotated[Optional[StrictStr], Field(description="whether to include nsfw videos, if any")] = None,
is_local: Annotated[Optional[StrictBool], Field(description="**PeerTube >= 4.0** Display only local or remote videos")] = None,
include: Annotated[Optional[StrictInt], Field(description="**PeerTube >= 4.0** Include additional videos in results (can be combined using bitwise or operator) - `0` NONE - `1` NOT_PUBLISHED_STATE - `2` BLACKLISTED - `4` BLOCKED_OWNER - `8` FILES ")] = None,
privacy_one_of: Annotated[Optional[VideoPrivacySet], Field(description="**PeerTube >= 4.0** Display only videos in this specific privacy/privacies")] = None,
has_hls_files: Annotated[Optional[StrictBool], Field(description="**PeerTube >= 4.0** Display only videos that have HLS files")] = None,
has_web_video_files: Annotated[Optional[StrictBool], Field(description="**PeerTube >= 6.0** Display only videos that have Web Video files")] = None,
skip_count: Annotated[Optional[StrictStr], Field(description="if you don't need the `total` in the response")] = None,
start: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Offset used to paginate results")] = None,
count: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Number of items to return")] = None,
sort: Optional[StrictStr] = None,
exclude_already_watched: Annotated[Optional[StrictBool], Field(description="Whether or not to exclude videos that are in the user's video history")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[VideoListResponse]:
"""List videos of an account
:param name: The username or handle of the account (required)
:type name: str
:param category_one_of: category id of the video (see [/videos/categories](#operation/getCategories))
:type category_one_of: GetAccountVideosCategoryOneOfParameter
:param is_live: whether or not the video is a live
:type is_live: bool
:param tags_one_of: tag(s) of the video
:type tags_one_of: GetAccountVideosTagsOneOfParameter
:param tags_all_of: tag(s) of the video, where all should be present in the video
:type tags_all_of: GetAccountVideosTagsAllOfParameter
:param licence_one_of: licence id of the video (see [/videos/licences](#operation/getLicences))
:type licence_one_of: GetAccountVideosLicenceOneOfParameter
:param language_one_of: language id of the video (see [/videos/languages](#operation/getLanguages)). Use `_unknown` to filter on videos that don't have a video language
:type language_one_of: GetAccountVideosLanguageOneOfParameter
:param nsfw: whether to include nsfw videos, if any
:type nsfw: str
:param is_local: **PeerTube >= 4.0** Display only local or remote videos
:type is_local: bool
:param include: **PeerTube >= 4.0** Include additional videos in results (can be combined using bitwise or operator) - `0` NONE - `1` NOT_PUBLISHED_STATE - `2` BLACKLISTED - `4` BLOCKED_OWNER - `8` FILES
:type include: int
:param privacy_one_of: **PeerTube >= 4.0** Display only videos in this specific privacy/privacies
:type privacy_one_of: VideoPrivacySet
:param has_hls_files: **PeerTube >= 4.0** Display only videos that have HLS files
:type has_hls_files: bool
:param has_web_video_files: **PeerTube >= 6.0** Display only videos that have Web Video files
:type has_web_video_files: bool
:param skip_count: if you don't need the `total` in the response
:type skip_count: str
:param start: Offset used to paginate results
:type start: int
:param count: Number of items to return
:type count: int
:param sort:
:type sort: str
:param exclude_already_watched: Whether or not to exclude videos that are in the user's video history
:type exclude_already_watched: bool
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_account_videos_serialize(
name=name,
category_one_of=category_one_of,
is_live=is_live,
tags_one_of=tags_one_of,
tags_all_of=tags_all_of,
licence_one_of=licence_one_of,
language_one_of=language_one_of,
nsfw=nsfw,
is_local=is_local,
include=include,
privacy_one_of=privacy_one_of,
has_hls_files=has_hls_files,
has_web_video_files=has_web_video_files,
skip_count=skip_count,
start=start,
count=count,
sort=sort,
exclude_already_watched=exclude_already_watched,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "VideoListResponse",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def get_account_videos_without_preload_content(
self,
name: Annotated[StrictStr, Field(description="The username or handle of the account")],
category_one_of: Annotated[Optional[Any], Field(description="category id of the video (see [/videos/categories](#operation/getCategories))")] = None,
is_live: Annotated[Optional[StrictBool], Field(description="whether or not the video is a live")] = None,
tags_one_of: Annotated[Optional[Any], Field(description="tag(s) of the video")] = None,
tags_all_of: Annotated[Optional[Any], Field(description="tag(s) of the video, where all should be present in the video")] = None,
licence_one_of: Annotated[Optional[Any], Field(description="licence id of the video (see [/videos/licences](#operation/getLicences))")] = None,
language_one_of: Annotated[Optional[Any], Field(description="language id of the video (see [/videos/languages](#operation/getLanguages)). Use `_unknown` to filter on videos that don't have a video language")] = None,
nsfw: Annotated[Optional[StrictStr], Field(description="whether to include nsfw videos, if any")] = None,
is_local: Annotated[Optional[StrictBool], Field(description="**PeerTube >= 4.0** Display only local or remote videos")] = None,
include: Annotated[Optional[StrictInt], Field(description="**PeerTube >= 4.0** Include additional videos in results (can be combined using bitwise or operator) - `0` NONE - `1` NOT_PUBLISHED_STATE - `2` BLACKLISTED - `4` BLOCKED_OWNER - `8` FILES ")] = None,
privacy_one_of: Annotated[Optional[VideoPrivacySet], Field(description="**PeerTube >= 4.0** Display only videos in this specific privacy/privacies")] = None,
has_hls_files: Annotated[Optional[StrictBool], Field(description="**PeerTube >= 4.0** Display only videos that have HLS files")] = None,
has_web_video_files: Annotated[Optional[StrictBool], Field(description="**PeerTube >= 6.0** Display only videos that have Web Video files")] = None,
skip_count: Annotated[Optional[StrictStr], Field(description="if you don't need the `total` in the response")] = None,
start: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Offset used to paginate results")] = None,
count: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Number of items to return")] = None,
sort: Optional[StrictStr] = None,
exclude_already_watched: Annotated[Optional[StrictBool], Field(description="Whether or not to exclude videos that are in the user's video history")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""List videos of an account
:param name: The username or handle of the account (required)
:type name: str
:param category_one_of: category id of the video (see [/videos/categories](#operation/getCategories))
:type category_one_of: GetAccountVideosCategoryOneOfParameter
:param is_live: whether or not the video is a live
:type is_live: bool
:param tags_one_of: tag(s) of the video
:type tags_one_of: GetAccountVideosTagsOneOfParameter
:param tags_all_of: tag(s) of the video, where all should be present in the video
:type tags_all_of: GetAccountVideosTagsAllOfParameter
:param licence_one_of: licence id of the video (see [/videos/licences](#operation/getLicences))
:type licence_one_of: GetAccountVideosLicenceOneOfParameter
:param language_one_of: language id of the video (see [/videos/languages](#operation/getLanguages)). Use `_unknown` to filter on videos that don't have a video language
:type language_one_of: GetAccountVideosLanguageOneOfParameter
:param nsfw: whether to include nsfw videos, if any
:type nsfw: str
:param is_local: **PeerTube >= 4.0** Display only local or remote videos
:type is_local: bool
:param include: **PeerTube >= 4.0** Include additional videos in results (can be combined using bitwise or operator) - `0` NONE - `1` NOT_PUBLISHED_STATE - `2` BLACKLISTED - `4` BLOCKED_OWNER - `8` FILES
:type include: int
:param privacy_one_of: **PeerTube >= 4.0** Display only videos in this specific privacy/privacies
:type privacy_one_of: VideoPrivacySet
:param has_hls_files: **PeerTube >= 4.0** Display only videos that have HLS files
:type has_hls_files: bool
:param has_web_video_files: **PeerTube >= 6.0** Display only videos that have Web Video files
:type has_web_video_files: bool
:param skip_count: if you don't need the `total` in the response
:type skip_count: str
:param start: Offset used to paginate results
:type start: int
:param count: Number of items to return
:type count: int
:param sort:
:type sort: str
:param exclude_already_watched: Whether or not to exclude videos that are in the user's video history
:type exclude_already_watched: bool
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_account_videos_serialize(
name=name,
category_one_of=category_one_of,
is_live=is_live,
tags_one_of=tags_one_of,
tags_all_of=tags_all_of,
licence_one_of=licence_one_of,
language_one_of=language_one_of,
nsfw=nsfw,
is_local=is_local,
include=include,
privacy_one_of=privacy_one_of,
has_hls_files=has_hls_files,
has_web_video_files=has_web_video_files,
skip_count=skip_count,
start=start,
count=count,
sort=sort,
exclude_already_watched=exclude_already_watched,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "VideoListResponse",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _get_account_videos_serialize(
self,
name,
category_one_of,
is_live,
tags_one_of,
tags_all_of,
licence_one_of,
language_one_of,
nsfw,
is_local,
include,
privacy_one_of,
has_hls_files,
has_web_video_files,
skip_count,
start,
count,
sort,
exclude_already_watched,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if name is not None:
_path_params['name'] = name
# process the query parameters
if category_one_of is not None:
_query_params.append(('categoryOneOf', category_one_of))
if is_live is not None:
_query_params.append(('isLive', is_live))
if tags_one_of is not None:
_query_params.append(('tagsOneOf', tags_one_of))
if tags_all_of is not None:
_query_params.append(('tagsAllOf', tags_all_of))
if licence_one_of is not None:
_query_params.append(('licenceOneOf', licence_one_of))
if language_one_of is not None:
_query_params.append(('languageOneOf', language_one_of))
if nsfw is not None:
_query_params.append(('nsfw', nsfw))
if is_local is not None:
_query_params.append(('isLocal', is_local))
if include is not None:
_query_params.append(('include', include))
if privacy_one_of is not None:
_query_params.append(('privacyOneOf', privacy_one_of.value))
if has_hls_files is not None:
_query_params.append(('hasHLSFiles', has_hls_files))
if has_web_video_files is not None:
_query_params.append(('hasWebVideoFiles', has_web_video_files))
if skip_count is not None:
_query_params.append(('skipCount', skip_count))
if start is not None:
_query_params.append(('start', start))
if count is not None:
_query_params.append(('count', count))
if sort is not None:
_query_params.append(('sort', sort))
if exclude_already_watched is not None:
_query_params.append(('excludeAlreadyWatched', exclude_already_watched))
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
_auth_settings: List[str] = [
]
return self.api_client.param_serialize(
method='GET',
resource_path='/api/v1/accounts/{name}/videos',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def get_categories(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> List[str]:
"""List available video categories
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_categories_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "List[str]",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def get_categories_with_http_info(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[List[str]]:
"""List available video categories
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_categories_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "List[str]",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def get_categories_without_preload_content(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""List available video categories
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_categories_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "List[str]",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _get_categories_serialize(
self,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
_auth_settings: List[str] = [
]
return self.api_client.param_serialize(
method='GET',
resource_path='/api/v1/videos/categories',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def get_languages(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> List[str]:
"""List available video languages
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_languages_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "List[str]",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def get_languages_with_http_info(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[List[str]]:
"""List available video languages
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_languages_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "List[str]",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def get_languages_without_preload_content(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""List available video languages
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_languages_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "List[str]",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _get_languages_serialize(
self,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
_auth_settings: List[str] = [
]
return self.api_client.param_serialize(
method='GET',
resource_path='/api/v1/videos/languages',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def get_licences(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> List[str]:
"""List available video licences
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_licences_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "List[str]",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def get_licences_with_http_info(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[List[str]]:
"""List available video licences
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_licences_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "List[str]",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def get_licences_without_preload_content(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""List available video licences
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_licences_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "List[str]",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _get_licences_serialize(
self,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
_auth_settings: List[str] = [
]
return self.api_client.param_serialize(
method='GET',
resource_path='/api/v1/videos/licences',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def get_live_id(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> LiveVideoResponse:
"""Get information about a live
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_live_id_serialize(
id=id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "LiveVideoResponse",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def get_live_id_with_http_info(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[LiveVideoResponse]:
"""Get information about a live
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_live_id_serialize(
id=id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "LiveVideoResponse",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def get_live_id_without_preload_content(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""Get information about a live
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_live_id_serialize(
id=id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "LiveVideoResponse",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _get_live_id_serialize(
self,
id,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if id is not None:
_path_params['id'] = id
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
_auth_settings: List[str] = [
'OAuth2'
]
return self.api_client.param_serialize(
method='GET',
resource_path='/api/v1/videos/live/{id}',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def get_video(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
x_peertube_video_password: Annotated[Optional[StrictStr], Field(description="Required on password protected video")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> VideoDetails:
"""Get a video
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param x_peertube_video_password: Required on password protected video
:type x_peertube_video_password: str
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_video_serialize(
id=id,
x_peertube_video_password=x_peertube_video_password,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "VideoDetails",
'403': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def get_video_with_http_info(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
x_peertube_video_password: Annotated[Optional[StrictStr], Field(description="Required on password protected video")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[VideoDetails]:
"""Get a video
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param x_peertube_video_password: Required on password protected video
:type x_peertube_video_password: str
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_video_serialize(
id=id,
x_peertube_video_password=x_peertube_video_password,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "VideoDetails",
'403': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def get_video_without_preload_content(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
x_peertube_video_password: Annotated[Optional[StrictStr], Field(description="Required on password protected video")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""Get a video
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param x_peertube_video_password: Required on password protected video
:type x_peertube_video_password: str
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_video_serialize(
id=id,
x_peertube_video_password=x_peertube_video_password,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "VideoDetails",
'403': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _get_video_serialize(
self,
id,
x_peertube_video_password,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if id is not None:
_path_params['id'] = id
# process the query parameters
# process the header parameters
if x_peertube_video_password is not None:
_header_params['x-peertube-video-password'] = x_peertube_video_password
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
_auth_settings: List[str] = [
]
return self.api_client.param_serialize(
method='GET',
resource_path='/api/v1/videos/{id}',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def get_video_channel_videos(
self,
channel_handle: Annotated[StrictStr, Field(description="The video channel handle")],
category_one_of: Annotated[Optional[Any], Field(description="category id of the video (see [/videos/categories](#operation/getCategories))")] = None,
is_live: Annotated[Optional[StrictBool], Field(description="whether or not the video is a live")] = None,
tags_one_of: Annotated[Optional[Any], Field(description="tag(s) of the video")] = None,
tags_all_of: Annotated[Optional[Any], Field(description="tag(s) of the video, where all should be present in the video")] = None,
licence_one_of: Annotated[Optional[Any], Field(description="licence id of the video (see [/videos/licences](#operation/getLicences))")] = None,
language_one_of: Annotated[Optional[Any], Field(description="language id of the video (see [/videos/languages](#operation/getLanguages)). Use `_unknown` to filter on videos that don't have a video language")] = None,
nsfw: Annotated[Optional[StrictStr], Field(description="whether to include nsfw videos, if any")] = None,
is_local: Annotated[Optional[StrictBool], Field(description="**PeerTube >= 4.0** Display only local or remote videos")] = None,
include: Annotated[Optional[StrictInt], Field(description="**PeerTube >= 4.0** Include additional videos in results (can be combined using bitwise or operator) - `0` NONE - `1` NOT_PUBLISHED_STATE - `2` BLACKLISTED - `4` BLOCKED_OWNER - `8` FILES ")] = None,
privacy_one_of: Annotated[Optional[VideoPrivacySet], Field(description="**PeerTube >= 4.0** Display only videos in this specific privacy/privacies")] = None,
has_hls_files: Annotated[Optional[StrictBool], Field(description="**PeerTube >= 4.0** Display only videos that have HLS files")] = None,
has_web_video_files: Annotated[Optional[StrictBool], Field(description="**PeerTube >= 6.0** Display only videos that have Web Video files")] = None,
skip_count: Annotated[Optional[StrictStr], Field(description="if you don't need the `total` in the response")] = None,
start: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Offset used to paginate results")] = None,
count: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Number of items to return")] = None,
sort: Optional[StrictStr] = None,
exclude_already_watched: Annotated[Optional[StrictBool], Field(description="Whether or not to exclude videos that are in the user's video history")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> VideoListResponse:
"""List videos of a video channel
:param channel_handle: The video channel handle (required)
:type channel_handle: str
:param category_one_of: category id of the video (see [/videos/categories](#operation/getCategories))
:type category_one_of: GetAccountVideosCategoryOneOfParameter
:param is_live: whether or not the video is a live
:type is_live: bool
:param tags_one_of: tag(s) of the video
:type tags_one_of: GetAccountVideosTagsOneOfParameter
:param tags_all_of: tag(s) of the video, where all should be present in the video
:type tags_all_of: GetAccountVideosTagsAllOfParameter
:param licence_one_of: licence id of the video (see [/videos/licences](#operation/getLicences))
:type licence_one_of: GetAccountVideosLicenceOneOfParameter
:param language_one_of: language id of the video (see [/videos/languages](#operation/getLanguages)). Use `_unknown` to filter on videos that don't have a video language
:type language_one_of: GetAccountVideosLanguageOneOfParameter
:param nsfw: whether to include nsfw videos, if any
:type nsfw: str
:param is_local: **PeerTube >= 4.0** Display only local or remote videos
:type is_local: bool
:param include: **PeerTube >= 4.0** Include additional videos in results (can be combined using bitwise or operator) - `0` NONE - `1` NOT_PUBLISHED_STATE - `2` BLACKLISTED - `4` BLOCKED_OWNER - `8` FILES
:type include: int
:param privacy_one_of: **PeerTube >= 4.0** Display only videos in this specific privacy/privacies
:type privacy_one_of: VideoPrivacySet
:param has_hls_files: **PeerTube >= 4.0** Display only videos that have HLS files
:type has_hls_files: bool
:param has_web_video_files: **PeerTube >= 6.0** Display only videos that have Web Video files
:type has_web_video_files: bool
:param skip_count: if you don't need the `total` in the response
:type skip_count: str
:param start: Offset used to paginate results
:type start: int
:param count: Number of items to return
:type count: int
:param sort:
:type sort: str
:param exclude_already_watched: Whether or not to exclude videos that are in the user's video history
:type exclude_already_watched: bool
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_video_channel_videos_serialize(
channel_handle=channel_handle,
category_one_of=category_one_of,
is_live=is_live,
tags_one_of=tags_one_of,
tags_all_of=tags_all_of,
licence_one_of=licence_one_of,
language_one_of=language_one_of,
nsfw=nsfw,
is_local=is_local,
include=include,
privacy_one_of=privacy_one_of,
has_hls_files=has_hls_files,
has_web_video_files=has_web_video_files,
skip_count=skip_count,
start=start,
count=count,
sort=sort,
exclude_already_watched=exclude_already_watched,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "VideoListResponse",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def get_video_channel_videos_with_http_info(
self,
channel_handle: Annotated[StrictStr, Field(description="The video channel handle")],
category_one_of: Annotated[Optional[Any], Field(description="category id of the video (see [/videos/categories](#operation/getCategories))")] = None,
is_live: Annotated[Optional[StrictBool], Field(description="whether or not the video is a live")] = None,
tags_one_of: Annotated[Optional[Any], Field(description="tag(s) of the video")] = None,
tags_all_of: Annotated[Optional[Any], Field(description="tag(s) of the video, where all should be present in the video")] = None,
licence_one_of: Annotated[Optional[Any], Field(description="licence id of the video (see [/videos/licences](#operation/getLicences))")] = None,
language_one_of: Annotated[Optional[Any], Field(description="language id of the video (see [/videos/languages](#operation/getLanguages)). Use `_unknown` to filter on videos that don't have a video language")] = None,
nsfw: Annotated[Optional[StrictStr], Field(description="whether to include nsfw videos, if any")] = None,
is_local: Annotated[Optional[StrictBool], Field(description="**PeerTube >= 4.0** Display only local or remote videos")] = None,
include: Annotated[Optional[StrictInt], Field(description="**PeerTube >= 4.0** Include additional videos in results (can be combined using bitwise or operator) - `0` NONE - `1` NOT_PUBLISHED_STATE - `2` BLACKLISTED - `4` BLOCKED_OWNER - `8` FILES ")] = None,
privacy_one_of: Annotated[Optional[VideoPrivacySet], Field(description="**PeerTube >= 4.0** Display only videos in this specific privacy/privacies")] = None,
has_hls_files: Annotated[Optional[StrictBool], Field(description="**PeerTube >= 4.0** Display only videos that have HLS files")] = None,
has_web_video_files: Annotated[Optional[StrictBool], Field(description="**PeerTube >= 6.0** Display only videos that have Web Video files")] = None,
skip_count: Annotated[Optional[StrictStr], Field(description="if you don't need the `total` in the response")] = None,
start: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Offset used to paginate results")] = None,
count: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Number of items to return")] = None,
sort: Optional[StrictStr] = None,
exclude_already_watched: Annotated[Optional[StrictBool], Field(description="Whether or not to exclude videos that are in the user's video history")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[VideoListResponse]:
"""List videos of a video channel
:param channel_handle: The video channel handle (required)
:type channel_handle: str
:param category_one_of: category id of the video (see [/videos/categories](#operation/getCategories))
:type category_one_of: GetAccountVideosCategoryOneOfParameter
:param is_live: whether or not the video is a live
:type is_live: bool
:param tags_one_of: tag(s) of the video
:type tags_one_of: GetAccountVideosTagsOneOfParameter
:param tags_all_of: tag(s) of the video, where all should be present in the video
:type tags_all_of: GetAccountVideosTagsAllOfParameter
:param licence_one_of: licence id of the video (see [/videos/licences](#operation/getLicences))
:type licence_one_of: GetAccountVideosLicenceOneOfParameter
:param language_one_of: language id of the video (see [/videos/languages](#operation/getLanguages)). Use `_unknown` to filter on videos that don't have a video language
:type language_one_of: GetAccountVideosLanguageOneOfParameter
:param nsfw: whether to include nsfw videos, if any
:type nsfw: str
:param is_local: **PeerTube >= 4.0** Display only local or remote videos
:type is_local: bool
:param include: **PeerTube >= 4.0** Include additional videos in results (can be combined using bitwise or operator) - `0` NONE - `1` NOT_PUBLISHED_STATE - `2` BLACKLISTED - `4` BLOCKED_OWNER - `8` FILES
:type include: int
:param privacy_one_of: **PeerTube >= 4.0** Display only videos in this specific privacy/privacies
:type privacy_one_of: VideoPrivacySet
:param has_hls_files: **PeerTube >= 4.0** Display only videos that have HLS files
:type has_hls_files: bool
:param has_web_video_files: **PeerTube >= 6.0** Display only videos that have Web Video files
:type has_web_video_files: bool
:param skip_count: if you don't need the `total` in the response
:type skip_count: str
:param start: Offset used to paginate results
:type start: int
:param count: Number of items to return
:type count: int
:param sort:
:type sort: str
:param exclude_already_watched: Whether or not to exclude videos that are in the user's video history
:type exclude_already_watched: bool
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_video_channel_videos_serialize(
channel_handle=channel_handle,
category_one_of=category_one_of,
is_live=is_live,
tags_one_of=tags_one_of,
tags_all_of=tags_all_of,
licence_one_of=licence_one_of,
language_one_of=language_one_of,
nsfw=nsfw,
is_local=is_local,
include=include,
privacy_one_of=privacy_one_of,
has_hls_files=has_hls_files,
has_web_video_files=has_web_video_files,
skip_count=skip_count,
start=start,
count=count,
sort=sort,
exclude_already_watched=exclude_already_watched,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "VideoListResponse",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def get_video_channel_videos_without_preload_content(
self,
channel_handle: Annotated[StrictStr, Field(description="The video channel handle")],
category_one_of: Annotated[Optional[Any], Field(description="category id of the video (see [/videos/categories](#operation/getCategories))")] = None,
is_live: Annotated[Optional[StrictBool], Field(description="whether or not the video is a live")] = None,
tags_one_of: Annotated[Optional[Any], Field(description="tag(s) of the video")] = None,
tags_all_of: Annotated[Optional[Any], Field(description="tag(s) of the video, where all should be present in the video")] = None,
licence_one_of: Annotated[Optional[Any], Field(description="licence id of the video (see [/videos/licences](#operation/getLicences))")] = None,
language_one_of: Annotated[Optional[Any], Field(description="language id of the video (see [/videos/languages](#operation/getLanguages)). Use `_unknown` to filter on videos that don't have a video language")] = None,
nsfw: Annotated[Optional[StrictStr], Field(description="whether to include nsfw videos, if any")] = None,
is_local: Annotated[Optional[StrictBool], Field(description="**PeerTube >= 4.0** Display only local or remote videos")] = None,
include: Annotated[Optional[StrictInt], Field(description="**PeerTube >= 4.0** Include additional videos in results (can be combined using bitwise or operator) - `0` NONE - `1` NOT_PUBLISHED_STATE - `2` BLACKLISTED - `4` BLOCKED_OWNER - `8` FILES ")] = None,
privacy_one_of: Annotated[Optional[VideoPrivacySet], Field(description="**PeerTube >= 4.0** Display only videos in this specific privacy/privacies")] = None,
has_hls_files: Annotated[Optional[StrictBool], Field(description="**PeerTube >= 4.0** Display only videos that have HLS files")] = None,
has_web_video_files: Annotated[Optional[StrictBool], Field(description="**PeerTube >= 6.0** Display only videos that have Web Video files")] = None,
skip_count: Annotated[Optional[StrictStr], Field(description="if you don't need the `total` in the response")] = None,
start: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Offset used to paginate results")] = None,
count: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Number of items to return")] = None,
sort: Optional[StrictStr] = None,
exclude_already_watched: Annotated[Optional[StrictBool], Field(description="Whether or not to exclude videos that are in the user's video history")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""List videos of a video channel
:param channel_handle: The video channel handle (required)
:type channel_handle: str
:param category_one_of: category id of the video (see [/videos/categories](#operation/getCategories))
:type category_one_of: GetAccountVideosCategoryOneOfParameter
:param is_live: whether or not the video is a live
:type is_live: bool
:param tags_one_of: tag(s) of the video
:type tags_one_of: GetAccountVideosTagsOneOfParameter
:param tags_all_of: tag(s) of the video, where all should be present in the video
:type tags_all_of: GetAccountVideosTagsAllOfParameter
:param licence_one_of: licence id of the video (see [/videos/licences](#operation/getLicences))
:type licence_one_of: GetAccountVideosLicenceOneOfParameter
:param language_one_of: language id of the video (see [/videos/languages](#operation/getLanguages)). Use `_unknown` to filter on videos that don't have a video language
:type language_one_of: GetAccountVideosLanguageOneOfParameter
:param nsfw: whether to include nsfw videos, if any
:type nsfw: str
:param is_local: **PeerTube >= 4.0** Display only local or remote videos
:type is_local: bool
:param include: **PeerTube >= 4.0** Include additional videos in results (can be combined using bitwise or operator) - `0` NONE - `1` NOT_PUBLISHED_STATE - `2` BLACKLISTED - `4` BLOCKED_OWNER - `8` FILES
:type include: int
:param privacy_one_of: **PeerTube >= 4.0** Display only videos in this specific privacy/privacies
:type privacy_one_of: VideoPrivacySet
:param has_hls_files: **PeerTube >= 4.0** Display only videos that have HLS files
:type has_hls_files: bool
:param has_web_video_files: **PeerTube >= 6.0** Display only videos that have Web Video files
:type has_web_video_files: bool
:param skip_count: if you don't need the `total` in the response
:type skip_count: str
:param start: Offset used to paginate results
:type start: int
:param count: Number of items to return
:type count: int
:param sort:
:type sort: str
:param exclude_already_watched: Whether or not to exclude videos that are in the user's video history
:type exclude_already_watched: bool
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_video_channel_videos_serialize(
channel_handle=channel_handle,
category_one_of=category_one_of,
is_live=is_live,
tags_one_of=tags_one_of,
tags_all_of=tags_all_of,
licence_one_of=licence_one_of,
language_one_of=language_one_of,
nsfw=nsfw,
is_local=is_local,
include=include,
privacy_one_of=privacy_one_of,
has_hls_files=has_hls_files,
has_web_video_files=has_web_video_files,
skip_count=skip_count,
start=start,
count=count,
sort=sort,
exclude_already_watched=exclude_already_watched,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "VideoListResponse",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _get_video_channel_videos_serialize(
self,
channel_handle,
category_one_of,
is_live,
tags_one_of,
tags_all_of,
licence_one_of,
language_one_of,
nsfw,
is_local,
include,
privacy_one_of,
has_hls_files,
has_web_video_files,
skip_count,
start,
count,
sort,
exclude_already_watched,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if channel_handle is not None:
_path_params['channelHandle'] = channel_handle
# process the query parameters
if category_one_of is not None:
_query_params.append(('categoryOneOf', category_one_of))
if is_live is not None:
_query_params.append(('isLive', is_live))
if tags_one_of is not None:
_query_params.append(('tagsOneOf', tags_one_of))
if tags_all_of is not None:
_query_params.append(('tagsAllOf', tags_all_of))
if licence_one_of is not None:
_query_params.append(('licenceOneOf', licence_one_of))
if language_one_of is not None:
_query_params.append(('languageOneOf', language_one_of))
if nsfw is not None:
_query_params.append(('nsfw', nsfw))
if is_local is not None:
_query_params.append(('isLocal', is_local))
if include is not None:
_query_params.append(('include', include))
if privacy_one_of is not None:
_query_params.append(('privacyOneOf', privacy_one_of.value))
if has_hls_files is not None:
_query_params.append(('hasHLSFiles', has_hls_files))
if has_web_video_files is not None:
_query_params.append(('hasWebVideoFiles', has_web_video_files))
if skip_count is not None:
_query_params.append(('skipCount', skip_count))
if start is not None:
_query_params.append(('start', start))
if count is not None:
_query_params.append(('count', count))
if sort is not None:
_query_params.append(('sort', sort))
if exclude_already_watched is not None:
_query_params.append(('excludeAlreadyWatched', exclude_already_watched))
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
_auth_settings: List[str] = [
]
return self.api_client.param_serialize(
method='GET',
resource_path='/api/v1/video-channels/{channelHandle}/videos',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def get_video_desc(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
x_peertube_video_password: Annotated[Optional[StrictStr], Field(description="Required on password protected video")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> str:
"""Get complete video description
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param x_peertube_video_password: Required on password protected video
:type x_peertube_video_password: str
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_video_desc_serialize(
id=id,
x_peertube_video_password=x_peertube_video_password,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "str",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def get_video_desc_with_http_info(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
x_peertube_video_password: Annotated[Optional[StrictStr], Field(description="Required on password protected video")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[str]:
"""Get complete video description
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param x_peertube_video_password: Required on password protected video
:type x_peertube_video_password: str
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_video_desc_serialize(
id=id,
x_peertube_video_password=x_peertube_video_password,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "str",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def get_video_desc_without_preload_content(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
x_peertube_video_password: Annotated[Optional[StrictStr], Field(description="Required on password protected video")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""Get complete video description
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param x_peertube_video_password: Required on password protected video
:type x_peertube_video_password: str
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_video_desc_serialize(
id=id,
x_peertube_video_password=x_peertube_video_password,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "str",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _get_video_desc_serialize(
self,
id,
x_peertube_video_password,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if id is not None:
_path_params['id'] = id
# process the query parameters
# process the header parameters
if x_peertube_video_password is not None:
_header_params['x-peertube-video-password'] = x_peertube_video_password
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
_auth_settings: List[str] = [
]
return self.api_client.param_serialize(
method='GET',
resource_path='/api/v1/videos/{id}/description',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def get_video_privacy_policies(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> List[str]:
"""List available video privacy policies
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_video_privacy_policies_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "List[str]",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def get_video_privacy_policies_with_http_info(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[List[str]]:
"""List available video privacy policies
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_video_privacy_policies_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "List[str]",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def get_video_privacy_policies_without_preload_content(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""List available video privacy policies
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_video_privacy_policies_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "List[str]",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _get_video_privacy_policies_serialize(
self,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
_auth_settings: List[str] = [
]
return self.api_client.param_serialize(
method='GET',
resource_path='/api/v1/videos/privacies',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def get_video_source(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> VideoSource:
"""Get video source file metadata
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_video_source_serialize(
id=id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "VideoSource",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def get_video_source_with_http_info(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[VideoSource]:
"""Get video source file metadata
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_video_source_serialize(
id=id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "VideoSource",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def get_video_source_without_preload_content(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""Get video source file metadata
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_video_source_serialize(
id=id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "VideoSource",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _get_video_source_serialize(
self,
id,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if id is not None:
_path_params['id'] = id
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
_auth_settings: List[str] = [
]
return self.api_client.param_serialize(
method='GET',
resource_path='/api/v1/videos/{id}/source',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def get_videos(
self,
category_one_of: Annotated[Optional[Any], Field(description="category id of the video (see [/videos/categories](#operation/getCategories))")] = None,
is_live: Annotated[Optional[StrictBool], Field(description="whether or not the video is a live")] = None,
tags_one_of: Annotated[Optional[Any], Field(description="tag(s) of the video")] = None,
tags_all_of: Annotated[Optional[Any], Field(description="tag(s) of the video, where all should be present in the video")] = None,
licence_one_of: Annotated[Optional[Any], Field(description="licence id of the video (see [/videos/licences](#operation/getLicences))")] = None,
language_one_of: Annotated[Optional[Any], Field(description="language id of the video (see [/videos/languages](#operation/getLanguages)). Use `_unknown` to filter on videos that don't have a video language")] = None,
nsfw: Annotated[Optional[StrictStr], Field(description="whether to include nsfw videos, if any")] = None,
is_local: Annotated[Optional[StrictBool], Field(description="**PeerTube >= 4.0** Display only local or remote videos")] = None,
include: Annotated[Optional[StrictInt], Field(description="**PeerTube >= 4.0** Include additional videos in results (can be combined using bitwise or operator) - `0` NONE - `1` NOT_PUBLISHED_STATE - `2` BLACKLISTED - `4` BLOCKED_OWNER - `8` FILES ")] = None,
privacy_one_of: Annotated[Optional[VideoPrivacySet], Field(description="**PeerTube >= 4.0** Display only videos in this specific privacy/privacies")] = None,
has_hls_files: Annotated[Optional[StrictBool], Field(description="**PeerTube >= 4.0** Display only videos that have HLS files")] = None,
has_web_video_files: Annotated[Optional[StrictBool], Field(description="**PeerTube >= 6.0** Display only videos that have Web Video files")] = None,
skip_count: Annotated[Optional[StrictStr], Field(description="if you don't need the `total` in the response")] = None,
start: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Offset used to paginate results")] = None,
count: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Number of items to return")] = None,
sort: Optional[StrictStr] = None,
exclude_already_watched: Annotated[Optional[StrictBool], Field(description="Whether or not to exclude videos that are in the user's video history")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> VideoListResponse:
"""List videos
:param category_one_of: category id of the video (see [/videos/categories](#operation/getCategories))
:type category_one_of: GetAccountVideosCategoryOneOfParameter
:param is_live: whether or not the video is a live
:type is_live: bool
:param tags_one_of: tag(s) of the video
:type tags_one_of: GetAccountVideosTagsOneOfParameter
:param tags_all_of: tag(s) of the video, where all should be present in the video
:type tags_all_of: GetAccountVideosTagsAllOfParameter
:param licence_one_of: licence id of the video (see [/videos/licences](#operation/getLicences))
:type licence_one_of: GetAccountVideosLicenceOneOfParameter
:param language_one_of: language id of the video (see [/videos/languages](#operation/getLanguages)). Use `_unknown` to filter on videos that don't have a video language
:type language_one_of: GetAccountVideosLanguageOneOfParameter
:param nsfw: whether to include nsfw videos, if any
:type nsfw: str
:param is_local: **PeerTube >= 4.0** Display only local or remote videos
:type is_local: bool
:param include: **PeerTube >= 4.0** Include additional videos in results (can be combined using bitwise or operator) - `0` NONE - `1` NOT_PUBLISHED_STATE - `2` BLACKLISTED - `4` BLOCKED_OWNER - `8` FILES
:type include: int
:param privacy_one_of: **PeerTube >= 4.0** Display only videos in this specific privacy/privacies
:type privacy_one_of: VideoPrivacySet
:param has_hls_files: **PeerTube >= 4.0** Display only videos that have HLS files
:type has_hls_files: bool
:param has_web_video_files: **PeerTube >= 6.0** Display only videos that have Web Video files
:type has_web_video_files: bool
:param skip_count: if you don't need the `total` in the response
:type skip_count: str
:param start: Offset used to paginate results
:type start: int
:param count: Number of items to return
:type count: int
:param sort:
:type sort: str
:param exclude_already_watched: Whether or not to exclude videos that are in the user's video history
:type exclude_already_watched: bool
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_videos_serialize(
category_one_of=category_one_of,
is_live=is_live,
tags_one_of=tags_one_of,
tags_all_of=tags_all_of,
licence_one_of=licence_one_of,
language_one_of=language_one_of,
nsfw=nsfw,
is_local=is_local,
include=include,
privacy_one_of=privacy_one_of,
has_hls_files=has_hls_files,
has_web_video_files=has_web_video_files,
skip_count=skip_count,
start=start,
count=count,
sort=sort,
exclude_already_watched=exclude_already_watched,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "VideoListResponse",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def get_videos_with_http_info(
self,
category_one_of: Annotated[Optional[Any], Field(description="category id of the video (see [/videos/categories](#operation/getCategories))")] = None,
is_live: Annotated[Optional[StrictBool], Field(description="whether or not the video is a live")] = None,
tags_one_of: Annotated[Optional[Any], Field(description="tag(s) of the video")] = None,
tags_all_of: Annotated[Optional[Any], Field(description="tag(s) of the video, where all should be present in the video")] = None,
licence_one_of: Annotated[Optional[Any], Field(description="licence id of the video (see [/videos/licences](#operation/getLicences))")] = None,
language_one_of: Annotated[Optional[Any], Field(description="language id of the video (see [/videos/languages](#operation/getLanguages)). Use `_unknown` to filter on videos that don't have a video language")] = None,
nsfw: Annotated[Optional[StrictStr], Field(description="whether to include nsfw videos, if any")] = None,
is_local: Annotated[Optional[StrictBool], Field(description="**PeerTube >= 4.0** Display only local or remote videos")] = None,
include: Annotated[Optional[StrictInt], Field(description="**PeerTube >= 4.0** Include additional videos in results (can be combined using bitwise or operator) - `0` NONE - `1` NOT_PUBLISHED_STATE - `2` BLACKLISTED - `4` BLOCKED_OWNER - `8` FILES ")] = None,
privacy_one_of: Annotated[Optional[VideoPrivacySet], Field(description="**PeerTube >= 4.0** Display only videos in this specific privacy/privacies")] = None,
has_hls_files: Annotated[Optional[StrictBool], Field(description="**PeerTube >= 4.0** Display only videos that have HLS files")] = None,
has_web_video_files: Annotated[Optional[StrictBool], Field(description="**PeerTube >= 6.0** Display only videos that have Web Video files")] = None,
skip_count: Annotated[Optional[StrictStr], Field(description="if you don't need the `total` in the response")] = None,
start: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Offset used to paginate results")] = None,
count: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Number of items to return")] = None,
sort: Optional[StrictStr] = None,
exclude_already_watched: Annotated[Optional[StrictBool], Field(description="Whether or not to exclude videos that are in the user's video history")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[VideoListResponse]:
"""List videos
:param category_one_of: category id of the video (see [/videos/categories](#operation/getCategories))
:type category_one_of: GetAccountVideosCategoryOneOfParameter
:param is_live: whether or not the video is a live
:type is_live: bool
:param tags_one_of: tag(s) of the video
:type tags_one_of: GetAccountVideosTagsOneOfParameter
:param tags_all_of: tag(s) of the video, where all should be present in the video
:type tags_all_of: GetAccountVideosTagsAllOfParameter
:param licence_one_of: licence id of the video (see [/videos/licences](#operation/getLicences))
:type licence_one_of: GetAccountVideosLicenceOneOfParameter
:param language_one_of: language id of the video (see [/videos/languages](#operation/getLanguages)). Use `_unknown` to filter on videos that don't have a video language
:type language_one_of: GetAccountVideosLanguageOneOfParameter
:param nsfw: whether to include nsfw videos, if any
:type nsfw: str
:param is_local: **PeerTube >= 4.0** Display only local or remote videos
:type is_local: bool
:param include: **PeerTube >= 4.0** Include additional videos in results (can be combined using bitwise or operator) - `0` NONE - `1` NOT_PUBLISHED_STATE - `2` BLACKLISTED - `4` BLOCKED_OWNER - `8` FILES
:type include: int
:param privacy_one_of: **PeerTube >= 4.0** Display only videos in this specific privacy/privacies
:type privacy_one_of: VideoPrivacySet
:param has_hls_files: **PeerTube >= 4.0** Display only videos that have HLS files
:type has_hls_files: bool
:param has_web_video_files: **PeerTube >= 6.0** Display only videos that have Web Video files
:type has_web_video_files: bool
:param skip_count: if you don't need the `total` in the response
:type skip_count: str
:param start: Offset used to paginate results
:type start: int
:param count: Number of items to return
:type count: int
:param sort:
:type sort: str
:param exclude_already_watched: Whether or not to exclude videos that are in the user's video history
:type exclude_already_watched: bool
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_videos_serialize(
category_one_of=category_one_of,
is_live=is_live,
tags_one_of=tags_one_of,
tags_all_of=tags_all_of,
licence_one_of=licence_one_of,
language_one_of=language_one_of,
nsfw=nsfw,
is_local=is_local,
include=include,
privacy_one_of=privacy_one_of,
has_hls_files=has_hls_files,
has_web_video_files=has_web_video_files,
skip_count=skip_count,
start=start,
count=count,
sort=sort,
exclude_already_watched=exclude_already_watched,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "VideoListResponse",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def get_videos_without_preload_content(
self,
category_one_of: Annotated[Optional[Any], Field(description="category id of the video (see [/videos/categories](#operation/getCategories))")] = None,
is_live: Annotated[Optional[StrictBool], Field(description="whether or not the video is a live")] = None,
tags_one_of: Annotated[Optional[Any], Field(description="tag(s) of the video")] = None,
tags_all_of: Annotated[Optional[Any], Field(description="tag(s) of the video, where all should be present in the video")] = None,
licence_one_of: Annotated[Optional[Any], Field(description="licence id of the video (see [/videos/licences](#operation/getLicences))")] = None,
language_one_of: Annotated[Optional[Any], Field(description="language id of the video (see [/videos/languages](#operation/getLanguages)). Use `_unknown` to filter on videos that don't have a video language")] = None,
nsfw: Annotated[Optional[StrictStr], Field(description="whether to include nsfw videos, if any")] = None,
is_local: Annotated[Optional[StrictBool], Field(description="**PeerTube >= 4.0** Display only local or remote videos")] = None,
include: Annotated[Optional[StrictInt], Field(description="**PeerTube >= 4.0** Include additional videos in results (can be combined using bitwise or operator) - `0` NONE - `1` NOT_PUBLISHED_STATE - `2` BLACKLISTED - `4` BLOCKED_OWNER - `8` FILES ")] = None,
privacy_one_of: Annotated[Optional[VideoPrivacySet], Field(description="**PeerTube >= 4.0** Display only videos in this specific privacy/privacies")] = None,
has_hls_files: Annotated[Optional[StrictBool], Field(description="**PeerTube >= 4.0** Display only videos that have HLS files")] = None,
has_web_video_files: Annotated[Optional[StrictBool], Field(description="**PeerTube >= 6.0** Display only videos that have Web Video files")] = None,
skip_count: Annotated[Optional[StrictStr], Field(description="if you don't need the `total` in the response")] = None,
start: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Offset used to paginate results")] = None,
count: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Number of items to return")] = None,
sort: Optional[StrictStr] = None,
exclude_already_watched: Annotated[Optional[StrictBool], Field(description="Whether or not to exclude videos that are in the user's video history")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""List videos
:param category_one_of: category id of the video (see [/videos/categories](#operation/getCategories))
:type category_one_of: GetAccountVideosCategoryOneOfParameter
:param is_live: whether or not the video is a live
:type is_live: bool
:param tags_one_of: tag(s) of the video
:type tags_one_of: GetAccountVideosTagsOneOfParameter
:param tags_all_of: tag(s) of the video, where all should be present in the video
:type tags_all_of: GetAccountVideosTagsAllOfParameter
:param licence_one_of: licence id of the video (see [/videos/licences](#operation/getLicences))
:type licence_one_of: GetAccountVideosLicenceOneOfParameter
:param language_one_of: language id of the video (see [/videos/languages](#operation/getLanguages)). Use `_unknown` to filter on videos that don't have a video language
:type language_one_of: GetAccountVideosLanguageOneOfParameter
:param nsfw: whether to include nsfw videos, if any
:type nsfw: str
:param is_local: **PeerTube >= 4.0** Display only local or remote videos
:type is_local: bool
:param include: **PeerTube >= 4.0** Include additional videos in results (can be combined using bitwise or operator) - `0` NONE - `1` NOT_PUBLISHED_STATE - `2` BLACKLISTED - `4` BLOCKED_OWNER - `8` FILES
:type include: int
:param privacy_one_of: **PeerTube >= 4.0** Display only videos in this specific privacy/privacies
:type privacy_one_of: VideoPrivacySet
:param has_hls_files: **PeerTube >= 4.0** Display only videos that have HLS files
:type has_hls_files: bool
:param has_web_video_files: **PeerTube >= 6.0** Display only videos that have Web Video files
:type has_web_video_files: bool
:param skip_count: if you don't need the `total` in the response
:type skip_count: str
:param start: Offset used to paginate results
:type start: int
:param count: Number of items to return
:type count: int
:param sort:
:type sort: str
:param exclude_already_watched: Whether or not to exclude videos that are in the user's video history
:type exclude_already_watched: bool
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._get_videos_serialize(
category_one_of=category_one_of,
is_live=is_live,
tags_one_of=tags_one_of,
tags_all_of=tags_all_of,
licence_one_of=licence_one_of,
language_one_of=language_one_of,
nsfw=nsfw,
is_local=is_local,
include=include,
privacy_one_of=privacy_one_of,
has_hls_files=has_hls_files,
has_web_video_files=has_web_video_files,
skip_count=skip_count,
start=start,
count=count,
sort=sort,
exclude_already_watched=exclude_already_watched,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "VideoListResponse",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _get_videos_serialize(
self,
category_one_of,
is_live,
tags_one_of,
tags_all_of,
licence_one_of,
language_one_of,
nsfw,
is_local,
include,
privacy_one_of,
has_hls_files,
has_web_video_files,
skip_count,
start,
count,
sort,
exclude_already_watched,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
# process the query parameters
if category_one_of is not None:
_query_params.append(('categoryOneOf', category_one_of))
if is_live is not None:
_query_params.append(('isLive', is_live))
if tags_one_of is not None:
_query_params.append(('tagsOneOf', tags_one_of))
if tags_all_of is not None:
_query_params.append(('tagsAllOf', tags_all_of))
if licence_one_of is not None:
_query_params.append(('licenceOneOf', licence_one_of))
if language_one_of is not None:
_query_params.append(('languageOneOf', language_one_of))
if nsfw is not None:
_query_params.append(('nsfw', nsfw))
if is_local is not None:
_query_params.append(('isLocal', is_local))
if include is not None:
_query_params.append(('include', include))
if privacy_one_of is not None:
_query_params.append(('privacyOneOf', privacy_one_of.value))
if has_hls_files is not None:
_query_params.append(('hasHLSFiles', has_hls_files))
if has_web_video_files is not None:
_query_params.append(('hasWebVideoFiles', has_web_video_files))
if skip_count is not None:
_query_params.append(('skipCount', skip_count))
if start is not None:
_query_params.append(('start', start))
if count is not None:
_query_params.append(('count', count))
if sort is not None:
_query_params.append(('sort', sort))
if exclude_already_watched is not None:
_query_params.append(('excludeAlreadyWatched', exclude_already_watched))
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
_auth_settings: List[str] = [
]
return self.api_client.param_serialize(
method='GET',
resource_path='/api/v1/videos',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def list_video_storyboards(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ListVideoStoryboards200Response:
"""List storyboards of a video
**PeerTube** >= 6.0
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._list_video_storyboards_serialize(
id=id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "ListVideoStoryboards200Response",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def list_video_storyboards_with_http_info(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[ListVideoStoryboards200Response]:
"""List storyboards of a video
**PeerTube** >= 6.0
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._list_video_storyboards_serialize(
id=id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "ListVideoStoryboards200Response",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def list_video_storyboards_without_preload_content(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""List storyboards of a video
**PeerTube** >= 6.0
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._list_video_storyboards_serialize(
id=id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "ListVideoStoryboards200Response",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _list_video_storyboards_serialize(
self,
id,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if id is not None:
_path_params['id'] = id
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
_auth_settings: List[str] = [
]
return self.api_client.param_serialize(
method='GET',
resource_path='/api/v1/videos/{id}/storyboards',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def put_video(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
thumbnailfile: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="Video thumbnail file")] = None,
previewfile: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="Video preview file")] = None,
category: Annotated[Optional[StrictInt], Field(description="category id of the video (see [/videos/categories](#operation/getCategories))")] = None,
licence: Annotated[Optional[StrictInt], Field(description="licence id of the video (see [/videos/licences](#operation/getLicences))")] = None,
language: Annotated[Optional[StrictStr], Field(description="language id of the video (see [/videos/languages](#operation/getLanguages))")] = None,
privacy: Optional[VideoPrivacySet] = None,
description: Annotated[Optional[StrictStr], Field(description="Video description")] = None,
wait_transcoding: Annotated[Optional[StrictStr], Field(description="Whether or not we wait transcoding before publish the video")] = None,
support: Annotated[Optional[StrictStr], Field(description="A text tell the audience how to support the video creator")] = None,
nsfw: Annotated[Optional[StrictBool], Field(description="Whether or not this video contains sensitive content")] = None,
name: Annotated[Optional[Annotated[str, Field(min_length=3, strict=True, max_length=120)]], Field(description="Video name")] = None,
tags: Annotated[Optional[Annotated[List[Annotated[str, Field(min_length=2, strict=True, max_length=30)]], Field(min_length=1, max_length=5)]], Field(description="Video tags (maximum 5 tags each between 2 and 30 characters)")] = None,
comments_enabled: Annotated[Optional[StrictBool], Field(description="Enable or disable comments for this video")] = None,
download_enabled: Annotated[Optional[StrictBool], Field(description="Enable or disable downloading for this video")] = None,
originally_published_at: Annotated[Optional[datetime], Field(description="Date when the content was originally published")] = None,
schedule_update: Optional[VideoScheduledUpdate] = None,
video_passwords: Optional[List[Annotated[str, Field(min_length=6, strict=True, max_length=255)]]] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> None:
"""Update a video
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param thumbnailfile: Video thumbnail file
:type thumbnailfile: bytearray
:param previewfile: Video preview file
:type previewfile: bytearray
:param category: category id of the video (see [/videos/categories](#operation/getCategories))
:type category: int
:param licence: licence id of the video (see [/videos/licences](#operation/getLicences))
:type licence: int
:param language: language id of the video (see [/videos/languages](#operation/getLanguages))
:type language: str
:param privacy:
:type privacy: VideoPrivacySet
:param description: Video description
:type description: str
:param wait_transcoding: Whether or not we wait transcoding before publish the video
:type wait_transcoding: str
:param support: A text tell the audience how to support the video creator
:type support: str
:param nsfw: Whether or not this video contains sensitive content
:type nsfw: bool
:param name: Video name
:type name: str
:param tags: Video tags (maximum 5 tags each between 2 and 30 characters)
:type tags: List[str]
:param comments_enabled: Enable or disable comments for this video
:type comments_enabled: bool
:param download_enabled: Enable or disable downloading for this video
:type download_enabled: bool
:param originally_published_at: Date when the content was originally published
:type originally_published_at: datetime
:param schedule_update:
:type schedule_update: VideoScheduledUpdate
:param video_passwords:
:type video_passwords: List[str]
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._put_video_serialize(
id=id,
thumbnailfile=thumbnailfile,
previewfile=previewfile,
category=category,
licence=licence,
language=language,
privacy=privacy,
description=description,
wait_transcoding=wait_transcoding,
support=support,
nsfw=nsfw,
name=name,
tags=tags,
comments_enabled=comments_enabled,
download_enabled=download_enabled,
originally_published_at=originally_published_at,
schedule_update=schedule_update,
video_passwords=video_passwords,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def put_video_with_http_info(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
thumbnailfile: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="Video thumbnail file")] = None,
previewfile: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="Video preview file")] = None,
category: Annotated[Optional[StrictInt], Field(description="category id of the video (see [/videos/categories](#operation/getCategories))")] = None,
licence: Annotated[Optional[StrictInt], Field(description="licence id of the video (see [/videos/licences](#operation/getLicences))")] = None,
language: Annotated[Optional[StrictStr], Field(description="language id of the video (see [/videos/languages](#operation/getLanguages))")] = None,
privacy: Optional[VideoPrivacySet] = None,
description: Annotated[Optional[StrictStr], Field(description="Video description")] = None,
wait_transcoding: Annotated[Optional[StrictStr], Field(description="Whether or not we wait transcoding before publish the video")] = None,
support: Annotated[Optional[StrictStr], Field(description="A text tell the audience how to support the video creator")] = None,
nsfw: Annotated[Optional[StrictBool], Field(description="Whether or not this video contains sensitive content")] = None,
name: Annotated[Optional[Annotated[str, Field(min_length=3, strict=True, max_length=120)]], Field(description="Video name")] = None,
tags: Annotated[Optional[Annotated[List[Annotated[str, Field(min_length=2, strict=True, max_length=30)]], Field(min_length=1, max_length=5)]], Field(description="Video tags (maximum 5 tags each between 2 and 30 characters)")] = None,
comments_enabled: Annotated[Optional[StrictBool], Field(description="Enable or disable comments for this video")] = None,
download_enabled: Annotated[Optional[StrictBool], Field(description="Enable or disable downloading for this video")] = None,
originally_published_at: Annotated[Optional[datetime], Field(description="Date when the content was originally published")] = None,
schedule_update: Optional[VideoScheduledUpdate] = None,
video_passwords: Optional[List[Annotated[str, Field(min_length=6, strict=True, max_length=255)]]] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[None]:
"""Update a video
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param thumbnailfile: Video thumbnail file
:type thumbnailfile: bytearray
:param previewfile: Video preview file
:type previewfile: bytearray
:param category: category id of the video (see [/videos/categories](#operation/getCategories))
:type category: int
:param licence: licence id of the video (see [/videos/licences](#operation/getLicences))
:type licence: int
:param language: language id of the video (see [/videos/languages](#operation/getLanguages))
:type language: str
:param privacy:
:type privacy: VideoPrivacySet
:param description: Video description
:type description: str
:param wait_transcoding: Whether or not we wait transcoding before publish the video
:type wait_transcoding: str
:param support: A text tell the audience how to support the video creator
:type support: str
:param nsfw: Whether or not this video contains sensitive content
:type nsfw: bool
:param name: Video name
:type name: str
:param tags: Video tags (maximum 5 tags each between 2 and 30 characters)
:type tags: List[str]
:param comments_enabled: Enable or disable comments for this video
:type comments_enabled: bool
:param download_enabled: Enable or disable downloading for this video
:type download_enabled: bool
:param originally_published_at: Date when the content was originally published
:type originally_published_at: datetime
:param schedule_update:
:type schedule_update: VideoScheduledUpdate
:param video_passwords:
:type video_passwords: List[str]
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._put_video_serialize(
id=id,
thumbnailfile=thumbnailfile,
previewfile=previewfile,
category=category,
licence=licence,
language=language,
privacy=privacy,
description=description,
wait_transcoding=wait_transcoding,
support=support,
nsfw=nsfw,
name=name,
tags=tags,
comments_enabled=comments_enabled,
download_enabled=download_enabled,
originally_published_at=originally_published_at,
schedule_update=schedule_update,
video_passwords=video_passwords,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def put_video_without_preload_content(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
thumbnailfile: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="Video thumbnail file")] = None,
previewfile: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="Video preview file")] = None,
category: Annotated[Optional[StrictInt], Field(description="category id of the video (see [/videos/categories](#operation/getCategories))")] = None,
licence: Annotated[Optional[StrictInt], Field(description="licence id of the video (see [/videos/licences](#operation/getLicences))")] = None,
language: Annotated[Optional[StrictStr], Field(description="language id of the video (see [/videos/languages](#operation/getLanguages))")] = None,
privacy: Optional[VideoPrivacySet] = None,
description: Annotated[Optional[StrictStr], Field(description="Video description")] = None,
wait_transcoding: Annotated[Optional[StrictStr], Field(description="Whether or not we wait transcoding before publish the video")] = None,
support: Annotated[Optional[StrictStr], Field(description="A text tell the audience how to support the video creator")] = None,
nsfw: Annotated[Optional[StrictBool], Field(description="Whether or not this video contains sensitive content")] = None,
name: Annotated[Optional[Annotated[str, Field(min_length=3, strict=True, max_length=120)]], Field(description="Video name")] = None,
tags: Annotated[Optional[Annotated[List[Annotated[str, Field(min_length=2, strict=True, max_length=30)]], Field(min_length=1, max_length=5)]], Field(description="Video tags (maximum 5 tags each between 2 and 30 characters)")] = None,
comments_enabled: Annotated[Optional[StrictBool], Field(description="Enable or disable comments for this video")] = None,
download_enabled: Annotated[Optional[StrictBool], Field(description="Enable or disable downloading for this video")] = None,
originally_published_at: Annotated[Optional[datetime], Field(description="Date when the content was originally published")] = None,
schedule_update: Optional[VideoScheduledUpdate] = None,
video_passwords: Optional[List[Annotated[str, Field(min_length=6, strict=True, max_length=255)]]] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""Update a video
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param thumbnailfile: Video thumbnail file
:type thumbnailfile: bytearray
:param previewfile: Video preview file
:type previewfile: bytearray
:param category: category id of the video (see [/videos/categories](#operation/getCategories))
:type category: int
:param licence: licence id of the video (see [/videos/licences](#operation/getLicences))
:type licence: int
:param language: language id of the video (see [/videos/languages](#operation/getLanguages))
:type language: str
:param privacy:
:type privacy: VideoPrivacySet
:param description: Video description
:type description: str
:param wait_transcoding: Whether or not we wait transcoding before publish the video
:type wait_transcoding: str
:param support: A text tell the audience how to support the video creator
:type support: str
:param nsfw: Whether or not this video contains sensitive content
:type nsfw: bool
:param name: Video name
:type name: str
:param tags: Video tags (maximum 5 tags each between 2 and 30 characters)
:type tags: List[str]
:param comments_enabled: Enable or disable comments for this video
:type comments_enabled: bool
:param download_enabled: Enable or disable downloading for this video
:type download_enabled: bool
:param originally_published_at: Date when the content was originally published
:type originally_published_at: datetime
:param schedule_update:
:type schedule_update: VideoScheduledUpdate
:param video_passwords:
:type video_passwords: List[str]
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._put_video_serialize(
id=id,
thumbnailfile=thumbnailfile,
previewfile=previewfile,
category=category,
licence=licence,
language=language,
privacy=privacy,
description=description,
wait_transcoding=wait_transcoding,
support=support,
nsfw=nsfw,
name=name,
tags=tags,
comments_enabled=comments_enabled,
download_enabled=download_enabled,
originally_published_at=originally_published_at,
schedule_update=schedule_update,
video_passwords=video_passwords,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _put_video_serialize(
self,
id,
thumbnailfile,
previewfile,
category,
licence,
language,
privacy,
description,
wait_transcoding,
support,
nsfw,
name,
tags,
comments_enabled,
download_enabled,
originally_published_at,
schedule_update,
video_passwords,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
'tags': 'csv',
'videoPasswords': 'csv',
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if id is not None:
_path_params['id'] = id
# process the query parameters
# process the header parameters
# process the form parameters
if thumbnailfile is not None:
_files['thumbnailfile'] = thumbnailfile
if previewfile is not None:
_files['previewfile'] = previewfile
if category is not None:
_form_params.append(('category', category))
if licence is not None:
_form_params.append(('licence', licence))
if language is not None:
_form_params.append(('language', language))
if privacy is not None:
_form_params.append(('privacy', privacy))
if description is not None:
_form_params.append(('description', description))
if wait_transcoding is not None:
_form_params.append(('waitTranscoding', wait_transcoding))
if support is not None:
_form_params.append(('support', support))
if nsfw is not None:
_form_params.append(('nsfw', nsfw))
if name is not None:
_form_params.append(('name', name))
if tags is not None:
_form_params.append(('tags', tags))
if comments_enabled is not None:
_form_params.append(('commentsEnabled', comments_enabled))
if download_enabled is not None:
_form_params.append(('downloadEnabled', download_enabled))
if originally_published_at is not None:
_form_params.append(('originallyPublishedAt', originally_published_at))
if schedule_update is not None:
_form_params.append(('scheduleUpdate', schedule_update))
if video_passwords is not None:
_form_params.append(('videoPasswords', video_passwords))
# process the body parameter
# set the HTTP header `Content-Type`
if _content_type:
_header_params['Content-Type'] = _content_type
else:
_default_content_type = (
self.api_client.select_header_content_type(
[
'multipart/form-data'
]
)
)
if _default_content_type is not None:
_header_params['Content-Type'] = _default_content_type
# authentication setting
_auth_settings: List[str] = [
'OAuth2'
]
return self.api_client.param_serialize(
method='PUT',
resource_path='/api/v1/videos/{id}',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def replace_video_source_resumable(
self,
upload_id: Annotated[StrictStr, Field(description="Created session id to proceed with. If you didn't send chunks in the last hour, it is not valid anymore and you need to initialize a new upload. ")],
content_range: Annotated[StrictStr, Field(description="Specifies the bytes in the file that the request is uploading. For example, a value of `bytes 0-262143/1000000` shows that the request is sending the first 262144 bytes (256 x 1024) in a 2,469,036 byte file. ")],
content_length: Annotated[Union[StrictFloat, StrictInt], Field(description="Size of the chunk that the request is sending. Remember that larger chunks are more efficient. PeerTube's web client uses chunks varying from 1048576 bytes (~1MB) and increases or reduces size depending on connection health. ")],
body: Optional[Union[StrictBytes, StrictStr]] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> None:
"""Send chunk for the resumable replacement of a video
**PeerTube >= 6.0** Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to continue, pause or resume the replacement of a video
:param upload_id: Created session id to proceed with. If you didn't send chunks in the last hour, it is not valid anymore and you need to initialize a new upload. (required)
:type upload_id: str
:param content_range: Specifies the bytes in the file that the request is uploading. For example, a value of `bytes 0-262143/1000000` shows that the request is sending the first 262144 bytes (256 x 1024) in a 2,469,036 byte file. (required)
:type content_range: str
:param content_length: Size of the chunk that the request is sending. Remember that larger chunks are more efficient. PeerTube's web client uses chunks varying from 1048576 bytes (~1MB) and increases or reduces size depending on connection health. (required)
:type content_length: float
:param body:
:type body: bytearray
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._replace_video_source_resumable_serialize(
upload_id=upload_id,
content_range=content_range,
content_length=content_length,
body=body,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
'308': None,
'403': None,
'404': None,
'409': None,
'422': None,
'429': None,
'503': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def replace_video_source_resumable_with_http_info(
self,
upload_id: Annotated[StrictStr, Field(description="Created session id to proceed with. If you didn't send chunks in the last hour, it is not valid anymore and you need to initialize a new upload. ")],
content_range: Annotated[StrictStr, Field(description="Specifies the bytes in the file that the request is uploading. For example, a value of `bytes 0-262143/1000000` shows that the request is sending the first 262144 bytes (256 x 1024) in a 2,469,036 byte file. ")],
content_length: Annotated[Union[StrictFloat, StrictInt], Field(description="Size of the chunk that the request is sending. Remember that larger chunks are more efficient. PeerTube's web client uses chunks varying from 1048576 bytes (~1MB) and increases or reduces size depending on connection health. ")],
body: Optional[Union[StrictBytes, StrictStr]] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[None]:
"""Send chunk for the resumable replacement of a video
**PeerTube >= 6.0** Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to continue, pause or resume the replacement of a video
:param upload_id: Created session id to proceed with. If you didn't send chunks in the last hour, it is not valid anymore and you need to initialize a new upload. (required)
:type upload_id: str
:param content_range: Specifies the bytes in the file that the request is uploading. For example, a value of `bytes 0-262143/1000000` shows that the request is sending the first 262144 bytes (256 x 1024) in a 2,469,036 byte file. (required)
:type content_range: str
:param content_length: Size of the chunk that the request is sending. Remember that larger chunks are more efficient. PeerTube's web client uses chunks varying from 1048576 bytes (~1MB) and increases or reduces size depending on connection health. (required)
:type content_length: float
:param body:
:type body: bytearray
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._replace_video_source_resumable_serialize(
upload_id=upload_id,
content_range=content_range,
content_length=content_length,
body=body,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
'308': None,
'403': None,
'404': None,
'409': None,
'422': None,
'429': None,
'503': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def replace_video_source_resumable_without_preload_content(
self,
upload_id: Annotated[StrictStr, Field(description="Created session id to proceed with. If you didn't send chunks in the last hour, it is not valid anymore and you need to initialize a new upload. ")],
content_range: Annotated[StrictStr, Field(description="Specifies the bytes in the file that the request is uploading. For example, a value of `bytes 0-262143/1000000` shows that the request is sending the first 262144 bytes (256 x 1024) in a 2,469,036 byte file. ")],
content_length: Annotated[Union[StrictFloat, StrictInt], Field(description="Size of the chunk that the request is sending. Remember that larger chunks are more efficient. PeerTube's web client uses chunks varying from 1048576 bytes (~1MB) and increases or reduces size depending on connection health. ")],
body: Optional[Union[StrictBytes, StrictStr]] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""Send chunk for the resumable replacement of a video
**PeerTube >= 6.0** Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to continue, pause or resume the replacement of a video
:param upload_id: Created session id to proceed with. If you didn't send chunks in the last hour, it is not valid anymore and you need to initialize a new upload. (required)
:type upload_id: str
:param content_range: Specifies the bytes in the file that the request is uploading. For example, a value of `bytes 0-262143/1000000` shows that the request is sending the first 262144 bytes (256 x 1024) in a 2,469,036 byte file. (required)
:type content_range: str
:param content_length: Size of the chunk that the request is sending. Remember that larger chunks are more efficient. PeerTube's web client uses chunks varying from 1048576 bytes (~1MB) and increases or reduces size depending on connection health. (required)
:type content_length: float
:param body:
:type body: bytearray
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._replace_video_source_resumable_serialize(
upload_id=upload_id,
content_range=content_range,
content_length=content_length,
body=body,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
'308': None,
'403': None,
'404': None,
'409': None,
'422': None,
'429': None,
'503': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _replace_video_source_resumable_serialize(
self,
upload_id,
content_range,
content_length,
body,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
# process the query parameters
if upload_id is not None:
_query_params.append(('upload_id', upload_id))
# process the header parameters
if content_range is not None:
_header_params['Content-Range'] = content_range
if content_length is not None:
_header_params['Content-Length'] = content_length
# process the form parameters
# process the body parameter
if body is not None:
# convert to byte array if the input is a file name (str)
if isinstance(body, str):
with open(body, "rb") as _fp:
_body_params = _fp.read()
else:
_body_params = body
# set the HTTP header `Content-Type`
if _content_type:
_header_params['Content-Type'] = _content_type
else:
_default_content_type = (
self.api_client.select_header_content_type(
[
'application/octet-stream'
]
)
)
if _default_content_type is not None:
_header_params['Content-Type'] = _default_content_type
# authentication setting
_auth_settings: List[str] = [
'OAuth2'
]
return self.api_client.param_serialize(
method='PUT',
resource_path='/api/v1/videos/{id}/source/replace-resumable',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def replace_video_source_resumable_cancel(
self,
upload_id: Annotated[StrictStr, Field(description="Created session id to proceed with. If you didn't send chunks in the last hour, it is not valid anymore and you need to initialize a new upload. ")],
content_length: Union[StrictFloat, StrictInt],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> None:
"""Cancel the resumable replacement of a video
**PeerTube >= 6.0** Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to cancel the replacement of a video
:param upload_id: Created session id to proceed with. If you didn't send chunks in the last hour, it is not valid anymore and you need to initialize a new upload. (required)
:type upload_id: str
:param content_length: (required)
:type content_length: float
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._replace_video_source_resumable_cancel_serialize(
upload_id=upload_id,
content_length=content_length,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
'404': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def replace_video_source_resumable_cancel_with_http_info(
self,
upload_id: Annotated[StrictStr, Field(description="Created session id to proceed with. If you didn't send chunks in the last hour, it is not valid anymore and you need to initialize a new upload. ")],
content_length: Union[StrictFloat, StrictInt],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[None]:
"""Cancel the resumable replacement of a video
**PeerTube >= 6.0** Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to cancel the replacement of a video
:param upload_id: Created session id to proceed with. If you didn't send chunks in the last hour, it is not valid anymore and you need to initialize a new upload. (required)
:type upload_id: str
:param content_length: (required)
:type content_length: float
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._replace_video_source_resumable_cancel_serialize(
upload_id=upload_id,
content_length=content_length,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
'404': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def replace_video_source_resumable_cancel_without_preload_content(
self,
upload_id: Annotated[StrictStr, Field(description="Created session id to proceed with. If you didn't send chunks in the last hour, it is not valid anymore and you need to initialize a new upload. ")],
content_length: Union[StrictFloat, StrictInt],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""Cancel the resumable replacement of a video
**PeerTube >= 6.0** Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to cancel the replacement of a video
:param upload_id: Created session id to proceed with. If you didn't send chunks in the last hour, it is not valid anymore and you need to initialize a new upload. (required)
:type upload_id: str
:param content_length: (required)
:type content_length: float
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._replace_video_source_resumable_cancel_serialize(
upload_id=upload_id,
content_length=content_length,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
'404': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _replace_video_source_resumable_cancel_serialize(
self,
upload_id,
content_length,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
# process the query parameters
if upload_id is not None:
_query_params.append(('upload_id', upload_id))
# process the header parameters
if content_length is not None:
_header_params['Content-Length'] = content_length
# process the form parameters
# process the body parameter
# authentication setting
_auth_settings: List[str] = [
'OAuth2'
]
return self.api_client.param_serialize(
method='DELETE',
resource_path='/api/v1/videos/{id}/source/replace-resumable',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def replace_video_source_resumable_init(
self,
x_upload_content_length: Annotated[Union[StrictFloat, StrictInt], Field(description="Number of bytes that will be uploaded in subsequent requests. Set this value to the size of the file you are uploading.")],
x_upload_content_type: Annotated[StrictStr, Field(description="MIME type of the file that you are uploading. Depending on your instance settings, acceptable values might vary.")],
video_replace_source_request_resumable: Optional[VideoReplaceSourceRequestResumable] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> None:
"""Initialize the resumable replacement of a video
**PeerTube >= 6.0** Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to initialize the replacement of a video
:param x_upload_content_length: Number of bytes that will be uploaded in subsequent requests. Set this value to the size of the file you are uploading. (required)
:type x_upload_content_length: float
:param x_upload_content_type: MIME type of the file that you are uploading. Depending on your instance settings, acceptable values might vary. (required)
:type x_upload_content_type: str
:param video_replace_source_request_resumable:
:type video_replace_source_request_resumable: VideoReplaceSourceRequestResumable
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._replace_video_source_resumable_init_serialize(
x_upload_content_length=x_upload_content_length,
x_upload_content_type=x_upload_content_type,
video_replace_source_request_resumable=video_replace_source_request_resumable,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': None,
'201': None,
'413': None,
'415': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def replace_video_source_resumable_init_with_http_info(
self,
x_upload_content_length: Annotated[Union[StrictFloat, StrictInt], Field(description="Number of bytes that will be uploaded in subsequent requests. Set this value to the size of the file you are uploading.")],
x_upload_content_type: Annotated[StrictStr, Field(description="MIME type of the file that you are uploading. Depending on your instance settings, acceptable values might vary.")],
video_replace_source_request_resumable: Optional[VideoReplaceSourceRequestResumable] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[None]:
"""Initialize the resumable replacement of a video
**PeerTube >= 6.0** Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to initialize the replacement of a video
:param x_upload_content_length: Number of bytes that will be uploaded in subsequent requests. Set this value to the size of the file you are uploading. (required)
:type x_upload_content_length: float
:param x_upload_content_type: MIME type of the file that you are uploading. Depending on your instance settings, acceptable values might vary. (required)
:type x_upload_content_type: str
:param video_replace_source_request_resumable:
:type video_replace_source_request_resumable: VideoReplaceSourceRequestResumable
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._replace_video_source_resumable_init_serialize(
x_upload_content_length=x_upload_content_length,
x_upload_content_type=x_upload_content_type,
video_replace_source_request_resumable=video_replace_source_request_resumable,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': None,
'201': None,
'413': None,
'415': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def replace_video_source_resumable_init_without_preload_content(
self,
x_upload_content_length: Annotated[Union[StrictFloat, StrictInt], Field(description="Number of bytes that will be uploaded in subsequent requests. Set this value to the size of the file you are uploading.")],
x_upload_content_type: Annotated[StrictStr, Field(description="MIME type of the file that you are uploading. Depending on your instance settings, acceptable values might vary.")],
video_replace_source_request_resumable: Optional[VideoReplaceSourceRequestResumable] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""Initialize the resumable replacement of a video
**PeerTube >= 6.0** Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to initialize the replacement of a video
:param x_upload_content_length: Number of bytes that will be uploaded in subsequent requests. Set this value to the size of the file you are uploading. (required)
:type x_upload_content_length: float
:param x_upload_content_type: MIME type of the file that you are uploading. Depending on your instance settings, acceptable values might vary. (required)
:type x_upload_content_type: str
:param video_replace_source_request_resumable:
:type video_replace_source_request_resumable: VideoReplaceSourceRequestResumable
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._replace_video_source_resumable_init_serialize(
x_upload_content_length=x_upload_content_length,
x_upload_content_type=x_upload_content_type,
video_replace_source_request_resumable=video_replace_source_request_resumable,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': None,
'201': None,
'413': None,
'415': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _replace_video_source_resumable_init_serialize(
self,
x_upload_content_length,
x_upload_content_type,
video_replace_source_request_resumable,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
# process the query parameters
# process the header parameters
if x_upload_content_length is not None:
_header_params['X-Upload-Content-Length'] = x_upload_content_length
if x_upload_content_type is not None:
_header_params['X-Upload-Content-Type'] = x_upload_content_type
# process the form parameters
# process the body parameter
if video_replace_source_request_resumable is not None:
_body_params = video_replace_source_request_resumable
# set the HTTP header `Content-Type`
if _content_type:
_header_params['Content-Type'] = _content_type
else:
_default_content_type = (
self.api_client.select_header_content_type(
[
'application/json'
]
)
)
if _default_content_type is not None:
_header_params['Content-Type'] = _default_content_type
# authentication setting
_auth_settings: List[str] = [
'OAuth2'
]
return self.api_client.param_serialize(
method='POST',
resource_path='/api/v1/videos/{id}/source/replace-resumable',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def request_video_token(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
x_peertube_video_password: Annotated[Optional[StrictStr], Field(description="Required on password protected video")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> VideoTokenResponse:
"""Request video token
Request special tokens that expire quickly to use them in some context (like accessing private static files)
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param x_peertube_video_password: Required on password protected video
:type x_peertube_video_password: str
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._request_video_token_serialize(
id=id,
x_peertube_video_password=x_peertube_video_password,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "VideoTokenResponse",
'400': None,
'404': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def request_video_token_with_http_info(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
x_peertube_video_password: Annotated[Optional[StrictStr], Field(description="Required on password protected video")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[VideoTokenResponse]:
"""Request video token
Request special tokens that expire quickly to use them in some context (like accessing private static files)
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param x_peertube_video_password: Required on password protected video
:type x_peertube_video_password: str
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._request_video_token_serialize(
id=id,
x_peertube_video_password=x_peertube_video_password,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "VideoTokenResponse",
'400': None,
'404': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def request_video_token_without_preload_content(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
x_peertube_video_password: Annotated[Optional[StrictStr], Field(description="Required on password protected video")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""Request video token
Request special tokens that expire quickly to use them in some context (like accessing private static files)
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param x_peertube_video_password: Required on password protected video
:type x_peertube_video_password: str
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._request_video_token_serialize(
id=id,
x_peertube_video_password=x_peertube_video_password,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "VideoTokenResponse",
'400': None,
'404': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _request_video_token_serialize(
self,
id,
x_peertube_video_password,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if id is not None:
_path_params['id'] = id
# process the query parameters
# process the header parameters
if x_peertube_video_password is not None:
_header_params['x-peertube-video-password'] = x_peertube_video_password
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
_auth_settings: List[str] = [
'OAuth2'
]
return self.api_client.param_serialize(
method='POST',
resource_path='/api/v1/videos/{id}/token',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def update_live_id(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
live_video_update: Optional[LiveVideoUpdate] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> None:
"""Update information about a live
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param live_video_update:
:type live_video_update: LiveVideoUpdate
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._update_live_id_serialize(
id=id,
live_video_update=live_video_update,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
'400': None,
'403': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def update_live_id_with_http_info(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
live_video_update: Optional[LiveVideoUpdate] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[None]:
"""Update information about a live
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param live_video_update:
:type live_video_update: LiveVideoUpdate
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._update_live_id_serialize(
id=id,
live_video_update=live_video_update,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
'400': None,
'403': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def update_live_id_without_preload_content(
self,
id: Annotated[Any, Field(description="The object id, uuid or short uuid")],
live_video_update: Optional[LiveVideoUpdate] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""Update information about a live
:param id: The object id, uuid or short uuid (required)
:type id: ApiV1VideosOwnershipIdAcceptPostIdParameter
:param live_video_update:
:type live_video_update: LiveVideoUpdate
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._update_live_id_serialize(
id=id,
live_video_update=live_video_update,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
'400': None,
'403': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _update_live_id_serialize(
self,
id,
live_video_update,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if id is not None:
_path_params['id'] = id
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
if live_video_update is not None:
_body_params = live_video_update
# set the HTTP header `Content-Type`
if _content_type:
_header_params['Content-Type'] = _content_type
else:
_default_content_type = (
self.api_client.select_header_content_type(
[
'application/json'
]
)
)
if _default_content_type is not None:
_header_params['Content-Type'] = _default_content_type
# authentication setting
_auth_settings: List[str] = [
'OAuth2'
]
return self.api_client.param_serialize(
method='PUT',
resource_path='/api/v1/videos/live/{id}',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def upload_legacy(
self,
name: Annotated[str, Field(min_length=3, strict=True, max_length=120, description="Video name")],
videofile: Annotated[Union[StrictBytes, StrictStr], Field(description="Video file")],
channel_id: Annotated[Optional[Annotated[int, Field(strict=True, ge=1)]], Field(description="Channel id that will contain this video")] = None,
privacy: Optional[VideoPrivacySet] = None,
category: Annotated[Optional[StrictInt], Field(description="category id of the video (see [/videos/categories](#operation/getCategories))")] = None,
licence: Annotated[Optional[StrictInt], Field(description="licence id of the video (see [/videos/licences](#operation/getLicences))")] = None,
language: Annotated[Optional[StrictStr], Field(description="language id of the video (see [/videos/languages](#operation/getLanguages))")] = None,
description: Annotated[Optional[StrictStr], Field(description="Video description")] = None,
wait_transcoding: Annotated[Optional[StrictBool], Field(description="Whether or not we wait transcoding before publish the video")] = None,
support: Annotated[Optional[StrictStr], Field(description="A text tell the audience how to support the video creator")] = None,
nsfw: Annotated[Optional[StrictBool], Field(description="Whether or not this video contains sensitive content")] = None,
tags: Annotated[Optional[Annotated[List[Annotated[str, Field(min_length=2, strict=True, max_length=30)]], Field(min_length=1, max_length=5)]], Field(description="Video tags (maximum 5 tags each between 2 and 30 characters)")] = None,
comments_enabled: Annotated[Optional[StrictBool], Field(description="Enable or disable comments for this video")] = None,
download_enabled: Annotated[Optional[StrictBool], Field(description="Enable or disable downloading for this video")] = None,
originally_published_at: Annotated[Optional[datetime], Field(description="Date when the content was originally published")] = None,
schedule_update: Optional[VideoScheduledUpdate] = None,
thumbnailfile: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="Video thumbnail file")] = None,
previewfile: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="Video preview file")] = None,
video_passwords: Optional[List[Annotated[str, Field(min_length=6, strict=True, max_length=255)]]] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> VideoUploadResponse:
"""Upload a video
Uses a single request to upload a video.
:param name: Video name (required)
:type name: str
:param videofile: Video file (required)
:type videofile: bytearray
:param channel_id: Channel id that will contain this video
:type channel_id: int
:param privacy:
:type privacy: VideoPrivacySet
:param category: category id of the video (see [/videos/categories](#operation/getCategories))
:type category: int
:param licence: licence id of the video (see [/videos/licences](#operation/getLicences))
:type licence: int
:param language: language id of the video (see [/videos/languages](#operation/getLanguages))
:type language: str
:param description: Video description
:type description: str
:param wait_transcoding: Whether or not we wait transcoding before publish the video
:type wait_transcoding: bool
:param support: A text tell the audience how to support the video creator
:type support: str
:param nsfw: Whether or not this video contains sensitive content
:type nsfw: bool
:param tags: Video tags (maximum 5 tags each between 2 and 30 characters)
:type tags: List[str]
:param comments_enabled: Enable or disable comments for this video
:type comments_enabled: bool
:param download_enabled: Enable or disable downloading for this video
:type download_enabled: bool
:param originally_published_at: Date when the content was originally published
:type originally_published_at: datetime
:param schedule_update:
:type schedule_update: VideoScheduledUpdate
:param thumbnailfile: Video thumbnail file
:type thumbnailfile: bytearray
:param previewfile: Video preview file
:type previewfile: bytearray
:param video_passwords:
:type video_passwords: List[str]
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._upload_legacy_serialize(
name=name,
videofile=videofile,
channel_id=channel_id,
privacy=privacy,
category=category,
licence=licence,
language=language,
description=description,
wait_transcoding=wait_transcoding,
support=support,
nsfw=nsfw,
tags=tags,
comments_enabled=comments_enabled,
download_enabled=download_enabled,
originally_published_at=originally_published_at,
schedule_update=schedule_update,
thumbnailfile=thumbnailfile,
previewfile=previewfile,
video_passwords=video_passwords,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "VideoUploadResponse",
'403': None,
'408': None,
'413': None,
'415': None,
'422': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def upload_legacy_with_http_info(
self,
name: Annotated[str, Field(min_length=3, strict=True, max_length=120, description="Video name")],
videofile: Annotated[Union[StrictBytes, StrictStr], Field(description="Video file")],
channel_id: Annotated[Optional[Annotated[int, Field(strict=True, ge=1)]], Field(description="Channel id that will contain this video")] = None,
privacy: Optional[VideoPrivacySet] = None,
category: Annotated[Optional[StrictInt], Field(description="category id of the video (see [/videos/categories](#operation/getCategories))")] = None,
licence: Annotated[Optional[StrictInt], Field(description="licence id of the video (see [/videos/licences](#operation/getLicences))")] = None,
language: Annotated[Optional[StrictStr], Field(description="language id of the video (see [/videos/languages](#operation/getLanguages))")] = None,
description: Annotated[Optional[StrictStr], Field(description="Video description")] = None,
wait_transcoding: Annotated[Optional[StrictBool], Field(description="Whether or not we wait transcoding before publish the video")] = None,
support: Annotated[Optional[StrictStr], Field(description="A text tell the audience how to support the video creator")] = None,
nsfw: Annotated[Optional[StrictBool], Field(description="Whether or not this video contains sensitive content")] = None,
tags: Annotated[Optional[Annotated[List[Annotated[str, Field(min_length=2, strict=True, max_length=30)]], Field(min_length=1, max_length=5)]], Field(description="Video tags (maximum 5 tags each between 2 and 30 characters)")] = None,
comments_enabled: Annotated[Optional[StrictBool], Field(description="Enable or disable comments for this video")] = None,
download_enabled: Annotated[Optional[StrictBool], Field(description="Enable or disable downloading for this video")] = None,
originally_published_at: Annotated[Optional[datetime], Field(description="Date when the content was originally published")] = None,
schedule_update: Optional[VideoScheduledUpdate] = None,
thumbnailfile: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="Video thumbnail file")] = None,
previewfile: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="Video preview file")] = None,
video_passwords: Optional[List[Annotated[str, Field(min_length=6, strict=True, max_length=255)]]] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[VideoUploadResponse]:
"""Upload a video
Uses a single request to upload a video.
:param name: Video name (required)
:type name: str
:param videofile: Video file (required)
:type videofile: bytearray
:param channel_id: Channel id that will contain this video
:type channel_id: int
:param privacy:
:type privacy: VideoPrivacySet
:param category: category id of the video (see [/videos/categories](#operation/getCategories))
:type category: int
:param licence: licence id of the video (see [/videos/licences](#operation/getLicences))
:type licence: int
:param language: language id of the video (see [/videos/languages](#operation/getLanguages))
:type language: str
:param description: Video description
:type description: str
:param wait_transcoding: Whether or not we wait transcoding before publish the video
:type wait_transcoding: bool
:param support: A text tell the audience how to support the video creator
:type support: str
:param nsfw: Whether or not this video contains sensitive content
:type nsfw: bool
:param tags: Video tags (maximum 5 tags each between 2 and 30 characters)
:type tags: List[str]
:param comments_enabled: Enable or disable comments for this video
:type comments_enabled: bool
:param download_enabled: Enable or disable downloading for this video
:type download_enabled: bool
:param originally_published_at: Date when the content was originally published
:type originally_published_at: datetime
:param schedule_update:
:type schedule_update: VideoScheduledUpdate
:param thumbnailfile: Video thumbnail file
:type thumbnailfile: bytearray
:param previewfile: Video preview file
:type previewfile: bytearray
:param video_passwords:
:type video_passwords: List[str]
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._upload_legacy_serialize(
name=name,
videofile=videofile,
channel_id=channel_id,
privacy=privacy,
category=category,
licence=licence,
language=language,
description=description,
wait_transcoding=wait_transcoding,
support=support,
nsfw=nsfw,
tags=tags,
comments_enabled=comments_enabled,
download_enabled=download_enabled,
originally_published_at=originally_published_at,
schedule_update=schedule_update,
thumbnailfile=thumbnailfile,
previewfile=previewfile,
video_passwords=video_passwords,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "VideoUploadResponse",
'403': None,
'408': None,
'413': None,
'415': None,
'422': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def upload_legacy_without_preload_content(
self,
name: Annotated[str, Field(min_length=3, strict=True, max_length=120, description="Video name")],
videofile: Annotated[Union[StrictBytes, StrictStr], Field(description="Video file")],
channel_id: Annotated[Optional[Annotated[int, Field(strict=True, ge=1)]], Field(description="Channel id that will contain this video")] = None,
privacy: Optional[VideoPrivacySet] = None,
category: Annotated[Optional[StrictInt], Field(description="category id of the video (see [/videos/categories](#operation/getCategories))")] = None,
licence: Annotated[Optional[StrictInt], Field(description="licence id of the video (see [/videos/licences](#operation/getLicences))")] = None,
language: Annotated[Optional[StrictStr], Field(description="language id of the video (see [/videos/languages](#operation/getLanguages))")] = None,
description: Annotated[Optional[StrictStr], Field(description="Video description")] = None,
wait_transcoding: Annotated[Optional[StrictBool], Field(description="Whether or not we wait transcoding before publish the video")] = None,
support: Annotated[Optional[StrictStr], Field(description="A text tell the audience how to support the video creator")] = None,
nsfw: Annotated[Optional[StrictBool], Field(description="Whether or not this video contains sensitive content")] = None,
tags: Annotated[Optional[Annotated[List[Annotated[str, Field(min_length=2, strict=True, max_length=30)]], Field(min_length=1, max_length=5)]], Field(description="Video tags (maximum 5 tags each between 2 and 30 characters)")] = None,
comments_enabled: Annotated[Optional[StrictBool], Field(description="Enable or disable comments for this video")] = None,
download_enabled: Annotated[Optional[StrictBool], Field(description="Enable or disable downloading for this video")] = None,
originally_published_at: Annotated[Optional[datetime], Field(description="Date when the content was originally published")] = None,
schedule_update: Optional[VideoScheduledUpdate] = None,
thumbnailfile: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="Video thumbnail file")] = None,
previewfile: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="Video preview file")] = None,
video_passwords: Optional[List[Annotated[str, Field(min_length=6, strict=True, max_length=255)]]] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""Upload a video
Uses a single request to upload a video.
:param name: Video name (required)
:type name: str
:param videofile: Video file (required)
:type videofile: bytearray
:param channel_id: Channel id that will contain this video
:type channel_id: int
:param privacy:
:type privacy: VideoPrivacySet
:param category: category id of the video (see [/videos/categories](#operation/getCategories))
:type category: int
:param licence: licence id of the video (see [/videos/licences](#operation/getLicences))
:type licence: int
:param language: language id of the video (see [/videos/languages](#operation/getLanguages))
:type language: str
:param description: Video description
:type description: str
:param wait_transcoding: Whether or not we wait transcoding before publish the video
:type wait_transcoding: bool
:param support: A text tell the audience how to support the video creator
:type support: str
:param nsfw: Whether or not this video contains sensitive content
:type nsfw: bool
:param tags: Video tags (maximum 5 tags each between 2 and 30 characters)
:type tags: List[str]
:param comments_enabled: Enable or disable comments for this video
:type comments_enabled: bool
:param download_enabled: Enable or disable downloading for this video
:type download_enabled: bool
:param originally_published_at: Date when the content was originally published
:type originally_published_at: datetime
:param schedule_update:
:type schedule_update: VideoScheduledUpdate
:param thumbnailfile: Video thumbnail file
:type thumbnailfile: bytearray
:param previewfile: Video preview file
:type previewfile: bytearray
:param video_passwords:
:type video_passwords: List[str]
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._upload_legacy_serialize(
name=name,
videofile=videofile,
channel_id=channel_id,
privacy=privacy,
category=category,
licence=licence,
language=language,
description=description,
wait_transcoding=wait_transcoding,
support=support,
nsfw=nsfw,
tags=tags,
comments_enabled=comments_enabled,
download_enabled=download_enabled,
originally_published_at=originally_published_at,
schedule_update=schedule_update,
thumbnailfile=thumbnailfile,
previewfile=previewfile,
video_passwords=video_passwords,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "VideoUploadResponse",
'403': None,
'408': None,
'413': None,
'415': None,
'422': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _upload_legacy_serialize(
self,
name,
videofile,
channel_id,
privacy,
category,
licence,
language,
description,
wait_transcoding,
support,
nsfw,
tags,
comments_enabled,
download_enabled,
originally_published_at,
schedule_update,
thumbnailfile,
previewfile,
video_passwords,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
'tags': 'csv',
'videoPasswords': 'csv',
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
# process the query parameters
# process the header parameters
# process the form parameters
if name is not None:
_form_params.append(('name', name))
if channel_id is not None:
_form_params.append(('channelId', channel_id))
if privacy is not None:
_form_params.append(('privacy', privacy))
if category is not None:
_form_params.append(('category', category))
if licence is not None:
_form_params.append(('licence', licence))
if language is not None:
_form_params.append(('language', language))
if description is not None:
_form_params.append(('description', description))
if wait_transcoding is not None:
_form_params.append(('waitTranscoding', wait_transcoding))
if support is not None:
_form_params.append(('support', support))
if nsfw is not None:
_form_params.append(('nsfw', nsfw))
if tags is not None:
_form_params.append(('tags', tags))
if comments_enabled is not None:
_form_params.append(('commentsEnabled', comments_enabled))
if download_enabled is not None:
_form_params.append(('downloadEnabled', download_enabled))
if originally_published_at is not None:
_form_params.append(('originallyPublishedAt', originally_published_at))
if schedule_update is not None:
_form_params.append(('scheduleUpdate', schedule_update))
if thumbnailfile is not None:
_files['thumbnailfile'] = thumbnailfile
if previewfile is not None:
_files['previewfile'] = previewfile
if video_passwords is not None:
_form_params.append(('videoPasswords', video_passwords))
if videofile is not None:
_files['videofile'] = videofile
# process the body parameter
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# set the HTTP header `Content-Type`
if _content_type:
_header_params['Content-Type'] = _content_type
else:
_default_content_type = (
self.api_client.select_header_content_type(
[
'multipart/form-data'
]
)
)
if _default_content_type is not None:
_header_params['Content-Type'] = _default_content_type
# authentication setting
_auth_settings: List[str] = [
'OAuth2'
]
return self.api_client.param_serialize(
method='POST',
resource_path='/api/v1/videos/upload',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def upload_resumable(
self,
upload_id: Annotated[StrictStr, Field(description="Created session id to proceed with. If you didn't send chunks in the last hour, it is not valid anymore and you need to initialize a new upload. ")],
content_range: Annotated[StrictStr, Field(description="Specifies the bytes in the file that the request is uploading. For example, a value of `bytes 0-262143/1000000` shows that the request is sending the first 262144 bytes (256 x 1024) in a 2,469,036 byte file. ")],
content_length: Annotated[Union[StrictFloat, StrictInt], Field(description="Size of the chunk that the request is sending. Remember that larger chunks are more efficient. PeerTube's web client uses chunks varying from 1048576 bytes (~1MB) and increases or reduces size depending on connection health. ")],
body: Optional[Union[StrictBytes, StrictStr]] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> VideoUploadResponse:
"""Send chunk for the resumable upload of a video
Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to continue, pause or resume the upload of a video
:param upload_id: Created session id to proceed with. If you didn't send chunks in the last hour, it is not valid anymore and you need to initialize a new upload. (required)
:type upload_id: str
:param content_range: Specifies the bytes in the file that the request is uploading. For example, a value of `bytes 0-262143/1000000` shows that the request is sending the first 262144 bytes (256 x 1024) in a 2,469,036 byte file. (required)
:type content_range: str
:param content_length: Size of the chunk that the request is sending. Remember that larger chunks are more efficient. PeerTube's web client uses chunks varying from 1048576 bytes (~1MB) and increases or reduces size depending on connection health. (required)
:type content_length: float
:param body:
:type body: bytearray
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._upload_resumable_serialize(
upload_id=upload_id,
content_range=content_range,
content_length=content_length,
body=body,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "VideoUploadResponse",
'308': None,
'403': None,
'404': None,
'409': None,
'422': None,
'429': None,
'503': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def upload_resumable_with_http_info(
self,
upload_id: Annotated[StrictStr, Field(description="Created session id to proceed with. If you didn't send chunks in the last hour, it is not valid anymore and you need to initialize a new upload. ")],
content_range: Annotated[StrictStr, Field(description="Specifies the bytes in the file that the request is uploading. For example, a value of `bytes 0-262143/1000000` shows that the request is sending the first 262144 bytes (256 x 1024) in a 2,469,036 byte file. ")],
content_length: Annotated[Union[StrictFloat, StrictInt], Field(description="Size of the chunk that the request is sending. Remember that larger chunks are more efficient. PeerTube's web client uses chunks varying from 1048576 bytes (~1MB) and increases or reduces size depending on connection health. ")],
body: Optional[Union[StrictBytes, StrictStr]] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[VideoUploadResponse]:
"""Send chunk for the resumable upload of a video
Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to continue, pause or resume the upload of a video
:param upload_id: Created session id to proceed with. If you didn't send chunks in the last hour, it is not valid anymore and you need to initialize a new upload. (required)
:type upload_id: str
:param content_range: Specifies the bytes in the file that the request is uploading. For example, a value of `bytes 0-262143/1000000` shows that the request is sending the first 262144 bytes (256 x 1024) in a 2,469,036 byte file. (required)
:type content_range: str
:param content_length: Size of the chunk that the request is sending. Remember that larger chunks are more efficient. PeerTube's web client uses chunks varying from 1048576 bytes (~1MB) and increases or reduces size depending on connection health. (required)
:type content_length: float
:param body:
:type body: bytearray
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._upload_resumable_serialize(
upload_id=upload_id,
content_range=content_range,
content_length=content_length,
body=body,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "VideoUploadResponse",
'308': None,
'403': None,
'404': None,
'409': None,
'422': None,
'429': None,
'503': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def upload_resumable_without_preload_content(
self,
upload_id: Annotated[StrictStr, Field(description="Created session id to proceed with. If you didn't send chunks in the last hour, it is not valid anymore and you need to initialize a new upload. ")],
content_range: Annotated[StrictStr, Field(description="Specifies the bytes in the file that the request is uploading. For example, a value of `bytes 0-262143/1000000` shows that the request is sending the first 262144 bytes (256 x 1024) in a 2,469,036 byte file. ")],
content_length: Annotated[Union[StrictFloat, StrictInt], Field(description="Size of the chunk that the request is sending. Remember that larger chunks are more efficient. PeerTube's web client uses chunks varying from 1048576 bytes (~1MB) and increases or reduces size depending on connection health. ")],
body: Optional[Union[StrictBytes, StrictStr]] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""Send chunk for the resumable upload of a video
Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to continue, pause or resume the upload of a video
:param upload_id: Created session id to proceed with. If you didn't send chunks in the last hour, it is not valid anymore and you need to initialize a new upload. (required)
:type upload_id: str
:param content_range: Specifies the bytes in the file that the request is uploading. For example, a value of `bytes 0-262143/1000000` shows that the request is sending the first 262144 bytes (256 x 1024) in a 2,469,036 byte file. (required)
:type content_range: str
:param content_length: Size of the chunk that the request is sending. Remember that larger chunks are more efficient. PeerTube's web client uses chunks varying from 1048576 bytes (~1MB) and increases or reduces size depending on connection health. (required)
:type content_length: float
:param body:
:type body: bytearray
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._upload_resumable_serialize(
upload_id=upload_id,
content_range=content_range,
content_length=content_length,
body=body,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "VideoUploadResponse",
'308': None,
'403': None,
'404': None,
'409': None,
'422': None,
'429': None,
'503': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _upload_resumable_serialize(
self,
upload_id,
content_range,
content_length,
body,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
# process the query parameters
if upload_id is not None:
_query_params.append(('upload_id', upload_id))
# process the header parameters
if content_range is not None:
_header_params['Content-Range'] = content_range
if content_length is not None:
_header_params['Content-Length'] = content_length
# process the form parameters
# process the body parameter
if body is not None:
# convert to byte array if the input is a file name (str)
if isinstance(body, str):
with open(body, "rb") as _fp:
_body_params = _fp.read()
else:
_body_params = body
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# set the HTTP header `Content-Type`
if _content_type:
_header_params['Content-Type'] = _content_type
else:
_default_content_type = (
self.api_client.select_header_content_type(
[
'application/octet-stream'
]
)
)
if _default_content_type is not None:
_header_params['Content-Type'] = _default_content_type
# authentication setting
_auth_settings: List[str] = [
'OAuth2'
]
return self.api_client.param_serialize(
method='PUT',
resource_path='/api/v1/videos/upload-resumable',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def upload_resumable_cancel(
self,
upload_id: Annotated[StrictStr, Field(description="Created session id to proceed with. If you didn't send chunks in the last hour, it is not valid anymore and you need to initialize a new upload. ")],
content_length: Union[StrictFloat, StrictInt],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> None:
"""Cancel the resumable upload of a video, deleting any data uploaded so far
Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to cancel the upload of a video
:param upload_id: Created session id to proceed with. If you didn't send chunks in the last hour, it is not valid anymore and you need to initialize a new upload. (required)
:type upload_id: str
:param content_length: (required)
:type content_length: float
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._upload_resumable_cancel_serialize(
upload_id=upload_id,
content_length=content_length,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
'404': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def upload_resumable_cancel_with_http_info(
self,
upload_id: Annotated[StrictStr, Field(description="Created session id to proceed with. If you didn't send chunks in the last hour, it is not valid anymore and you need to initialize a new upload. ")],
content_length: Union[StrictFloat, StrictInt],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[None]:
"""Cancel the resumable upload of a video, deleting any data uploaded so far
Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to cancel the upload of a video
:param upload_id: Created session id to proceed with. If you didn't send chunks in the last hour, it is not valid anymore and you need to initialize a new upload. (required)
:type upload_id: str
:param content_length: (required)
:type content_length: float
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._upload_resumable_cancel_serialize(
upload_id=upload_id,
content_length=content_length,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
'404': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def upload_resumable_cancel_without_preload_content(
self,
upload_id: Annotated[StrictStr, Field(description="Created session id to proceed with. If you didn't send chunks in the last hour, it is not valid anymore and you need to initialize a new upload. ")],
content_length: Union[StrictFloat, StrictInt],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""Cancel the resumable upload of a video, deleting any data uploaded so far
Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to cancel the upload of a video
:param upload_id: Created session id to proceed with. If you didn't send chunks in the last hour, it is not valid anymore and you need to initialize a new upload. (required)
:type upload_id: str
:param content_length: (required)
:type content_length: float
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._upload_resumable_cancel_serialize(
upload_id=upload_id,
content_length=content_length,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
'404': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _upload_resumable_cancel_serialize(
self,
upload_id,
content_length,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
# process the query parameters
if upload_id is not None:
_query_params.append(('upload_id', upload_id))
# process the header parameters
if content_length is not None:
_header_params['Content-Length'] = content_length
# process the form parameters
# process the body parameter
# authentication setting
_auth_settings: List[str] = [
'OAuth2'
]
return self.api_client.param_serialize(
method='DELETE',
resource_path='/api/v1/videos/upload-resumable',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def upload_resumable_init(
self,
x_upload_content_length: Annotated[Union[StrictFloat, StrictInt], Field(description="Number of bytes that will be uploaded in subsequent requests. Set this value to the size of the file you are uploading.")],
x_upload_content_type: Annotated[StrictStr, Field(description="MIME type of the file that you are uploading. Depending on your instance settings, acceptable values might vary.")],
video_upload_request_resumable: Optional[VideoUploadRequestResumable] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> None:
"""Initialize the resumable upload of a video
Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to initialize the upload of a video
:param x_upload_content_length: Number of bytes that will be uploaded in subsequent requests. Set this value to the size of the file you are uploading. (required)
:type x_upload_content_length: float
:param x_upload_content_type: MIME type of the file that you are uploading. Depending on your instance settings, acceptable values might vary. (required)
:type x_upload_content_type: str
:param video_upload_request_resumable:
:type video_upload_request_resumable: VideoUploadRequestResumable
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._upload_resumable_init_serialize(
x_upload_content_length=x_upload_content_length,
x_upload_content_type=x_upload_content_type,
video_upload_request_resumable=video_upload_request_resumable,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': None,
'201': None,
'413': None,
'415': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def upload_resumable_init_with_http_info(
self,
x_upload_content_length: Annotated[Union[StrictFloat, StrictInt], Field(description="Number of bytes that will be uploaded in subsequent requests. Set this value to the size of the file you are uploading.")],
x_upload_content_type: Annotated[StrictStr, Field(description="MIME type of the file that you are uploading. Depending on your instance settings, acceptable values might vary.")],
video_upload_request_resumable: Optional[VideoUploadRequestResumable] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[None]:
"""Initialize the resumable upload of a video
Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to initialize the upload of a video
:param x_upload_content_length: Number of bytes that will be uploaded in subsequent requests. Set this value to the size of the file you are uploading. (required)
:type x_upload_content_length: float
:param x_upload_content_type: MIME type of the file that you are uploading. Depending on your instance settings, acceptable values might vary. (required)
:type x_upload_content_type: str
:param video_upload_request_resumable:
:type video_upload_request_resumable: VideoUploadRequestResumable
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._upload_resumable_init_serialize(
x_upload_content_length=x_upload_content_length,
x_upload_content_type=x_upload_content_type,
video_upload_request_resumable=video_upload_request_resumable,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': None,
'201': None,
'413': None,
'415': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def upload_resumable_init_without_preload_content(
self,
x_upload_content_length: Annotated[Union[StrictFloat, StrictInt], Field(description="Number of bytes that will be uploaded in subsequent requests. Set this value to the size of the file you are uploading.")],
x_upload_content_type: Annotated[StrictStr, Field(description="MIME type of the file that you are uploading. Depending on your instance settings, acceptable values might vary.")],
video_upload_request_resumable: Optional[VideoUploadRequestResumable] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""Initialize the resumable upload of a video
Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to initialize the upload of a video
:param x_upload_content_length: Number of bytes that will be uploaded in subsequent requests. Set this value to the size of the file you are uploading. (required)
:type x_upload_content_length: float
:param x_upload_content_type: MIME type of the file that you are uploading. Depending on your instance settings, acceptable values might vary. (required)
:type x_upload_content_type: str
:param video_upload_request_resumable:
:type video_upload_request_resumable: VideoUploadRequestResumable
:param _request_timeout: 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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._upload_resumable_init_serialize(
x_upload_content_length=x_upload_content_length,
x_upload_content_type=x_upload_content_type,
video_upload_request_resumable=video_upload_request_resumable,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': None,
'201': None,
'413': None,
'415': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _upload_resumable_init_serialize(
self,
x_upload_content_length,
x_upload_content_type,
video_upload_request_resumable,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
# process the query parameters
# process the header parameters
if x_upload_content_length is not None:
_header_params['X-Upload-Content-Length'] = x_upload_content_length
if x_upload_content_type is not None:
_header_params['X-Upload-Content-Type'] = x_upload_content_type
# process the form parameters
# process the body parameter
if video_upload_request_resumable is not None:
_body_params = video_upload_request_resumable
# set the HTTP header `Content-Type`
if _content_type:
_header_params['Content-Type'] = _content_type
else:
_default_content_type = (
self.api_client.select_header_content_type(
[
'application/json'
]
)
)
if _default_content_type is not None:
_header_params['Content-Type'] = _default_content_type
# authentication setting
_auth_settings: List[str] = [
'OAuth2'
]
return self.api_client.param_serialize(
method='POST',
resource_path='/api/v1/videos/upload-resumable',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)