2974 lines
143 KiB
Python
2974 lines
143 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
|
|
from typing import List, Optional, Union
|
|
from typing_extensions import Annotated
|
|
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_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 VideoUploadApi:
|
|
"""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 import_video(
|
|
self,
|
|
name: Annotated[str, Field(min_length=3, strict=True, max_length=120, description="Video name")],
|
|
channel_id: Annotated[int, Field(strict=True, ge=1, description="Channel id that will contain this video")],
|
|
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:
|
|
"""Import a video
|
|
|
|
Import a torrent or magnetURI or HTTP resource (if enabled by the instance administrator)
|
|
|
|
:param name: Video name (required)
|
|
:type name: str
|
|
:param channel_id: Channel id that will contain this video (required)
|
|
: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._import_video_serialize(
|
|
name=name,
|
|
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",
|
|
'400': None,
|
|
'403': None,
|
|
'409': 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 import_video_with_http_info(
|
|
self,
|
|
name: Annotated[str, Field(min_length=3, strict=True, max_length=120, description="Video name")],
|
|
channel_id: Annotated[int, Field(strict=True, ge=1, description="Channel id that will contain this video")],
|
|
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]:
|
|
"""Import a video
|
|
|
|
Import a torrent or magnetURI or HTTP resource (if enabled by the instance administrator)
|
|
|
|
:param name: Video name (required)
|
|
:type name: str
|
|
:param channel_id: Channel id that will contain this video (required)
|
|
: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._import_video_serialize(
|
|
name=name,
|
|
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",
|
|
'400': None,
|
|
'403': None,
|
|
'409': 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 import_video_without_preload_content(
|
|
self,
|
|
name: Annotated[str, Field(min_length=3, strict=True, max_length=120, description="Video name")],
|
|
channel_id: Annotated[int, Field(strict=True, ge=1, description="Channel id that will contain this video")],
|
|
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:
|
|
"""Import a video
|
|
|
|
Import a torrent or magnetURI or HTTP resource (if enabled by the instance administrator)
|
|
|
|
:param name: Video name (required)
|
|
:type name: str
|
|
:param channel_id: Channel id that will contain this video (required)
|
|
: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._import_video_serialize(
|
|
name=name,
|
|
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",
|
|
'400': None,
|
|
'403': None,
|
|
'409': None,
|
|
}
|
|
response_data = self.api_client.call_api(
|
|
*_param,
|
|
_request_timeout=_request_timeout
|
|
)
|
|
return response_data.response
|
|
|
|
|
|
def _import_video_serialize(
|
|
self,
|
|
name,
|
|
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))
|
|
# 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/imports',
|
|
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 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
|
|
)
|
|
|
|
|