peertube_python_api/docs/VideoCaptionsApi.md
2024-01-14 12:30:33 +02:00

228 lines
7.5 KiB
Markdown

# peertube.VideoCaptionsApi
All URIs are relative to *https://peertube2.cpy.re*
Method | HTTP request | Description
------------- | ------------- | -------------
[**add_video_caption**](VideoCaptionsApi.md#add_video_caption) | **PUT** /api/v1/videos/{id}/captions/{captionLanguage} | Add or replace a video caption
[**del_video_caption**](VideoCaptionsApi.md#del_video_caption) | **DELETE** /api/v1/videos/{id}/captions/{captionLanguage} | Delete a video caption
[**get_video_captions**](VideoCaptionsApi.md#get_video_captions) | **GET** /api/v1/videos/{id}/captions | List captions of a video
# **add_video_caption**
> add_video_caption(id, caption_language, captionfile=captionfile)
Add or replace a video caption
### Example
* OAuth Authentication (OAuth2):
```python
import peertube
from peertube.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://peertube2.cpy.re
# See configuration.py for a list of all supported configuration parameters.
configuration = peertube.Configuration(
host = "https://peertube2.cpy.re"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
configuration.access_token = os.environ["ACCESS_TOKEN"]
# Enter a context with an instance of the API client
with peertube.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = peertube.VideoCaptionsApi(api_client)
id = peertube.ApiV1VideosOwnershipIdAcceptPostIdParameter() # ApiV1VideosOwnershipIdAcceptPostIdParameter | The object id, uuid or short uuid
caption_language = 'caption_language_example' # str | The caption language
captionfile = None # bytearray | The file to upload. (optional)
try:
# Add or replace a video caption
api_instance.add_video_caption(id, caption_language, captionfile=captionfile)
except Exception as e:
print("Exception when calling VideoCaptionsApi->add_video_caption: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | [**ApiV1VideosOwnershipIdAcceptPostIdParameter**](.md)| The object id, uuid or short uuid |
**caption_language** | **str**| The caption language |
**captionfile** | **bytearray**| The file to upload. | [optional]
### Return type
void (empty response body)
### Authorization
[OAuth2](../README.md#OAuth2)
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**204** | successful operation | - |
**404** | video or language not found | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **del_video_caption**
> del_video_caption(id, caption_language)
Delete a video caption
### Example
* OAuth Authentication (OAuth2):
```python
import peertube
from peertube.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://peertube2.cpy.re
# See configuration.py for a list of all supported configuration parameters.
configuration = peertube.Configuration(
host = "https://peertube2.cpy.re"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
configuration.access_token = os.environ["ACCESS_TOKEN"]
# Enter a context with an instance of the API client
with peertube.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = peertube.VideoCaptionsApi(api_client)
id = peertube.ApiV1VideosOwnershipIdAcceptPostIdParameter() # ApiV1VideosOwnershipIdAcceptPostIdParameter | The object id, uuid or short uuid
caption_language = 'caption_language_example' # str | The caption language
try:
# Delete a video caption
api_instance.del_video_caption(id, caption_language)
except Exception as e:
print("Exception when calling VideoCaptionsApi->del_video_caption: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | [**ApiV1VideosOwnershipIdAcceptPostIdParameter**](.md)| The object id, uuid or short uuid |
**caption_language** | **str**| The caption language |
### Return type
void (empty response body)
### Authorization
[OAuth2](../README.md#OAuth2)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**204** | successful operation | - |
**404** | video or language or caption for that language not found | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **get_video_captions**
> GetVideoCaptions200Response get_video_captions(id, x_peertube_video_password=x_peertube_video_password)
List captions of a video
### Example
```python
import peertube
from peertube.models.get_video_captions200_response import GetVideoCaptions200Response
from peertube.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://peertube2.cpy.re
# See configuration.py for a list of all supported configuration parameters.
configuration = peertube.Configuration(
host = "https://peertube2.cpy.re"
)
# Enter a context with an instance of the API client
with peertube.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = peertube.VideoCaptionsApi(api_client)
id = peertube.ApiV1VideosOwnershipIdAcceptPostIdParameter() # ApiV1VideosOwnershipIdAcceptPostIdParameter | The object id, uuid or short uuid
x_peertube_video_password = 'x_peertube_video_password_example' # str | Required on password protected video (optional)
try:
# List captions of a video
api_response = api_instance.get_video_captions(id, x_peertube_video_password=x_peertube_video_password)
print("The response of VideoCaptionsApi->get_video_captions:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling VideoCaptionsApi->get_video_captions: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | [**ApiV1VideosOwnershipIdAcceptPostIdParameter**](.md)| The object id, uuid or short uuid |
**x_peertube_video_password** | **str**| Required on password protected video | [optional]
### Return type
[**GetVideoCaptions200Response**](GetVideoCaptions200Response.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | successful operation | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)