1
0
Fork 0

specify operationId in openapi spec and factorize videoconstant ids

This commit is contained in:
Rigel Kent 2021-05-10 14:17:26 +02:00
parent 3ec535f72b
commit 40cfb36b9d
No known key found for this signature in database
GPG key ID: 5E53E96A494E452F

View file

@ -144,8 +144,8 @@ tags:
### Upload ### Upload
- [_legacy_](#tag/Video-Upload/paths/~1videos~1upload/post), where the video file is sent in a single request - [_legacy_](#operation/uploadLegacy), where the video file is sent in a single request
- [_resumable_](#tag/Video-Upload/paths/~1videos~1upload-resumable/post), where the video file is sent in chunks - [_resumable_](#operation/uploadResumableInit), where the video file is sent in chunks
You can upload videos more reliably by using the resumable variant. Its protocol lets You can upload videos more reliably by using the resumable variant. Its protocol lets
you resume an upload operation after a network interruption or other transmission failure, you resume an upload operation after a network interruption or other transmission failure,
@ -280,7 +280,7 @@ paths:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/VideoListResponse' $ref: '#/components/schemas/VideoListResponse'
x-code-samples: x-codeSamples:
- lang: JavaScript - lang: JavaScript
source: | source: |
fetch('https://peertube2.cpy.re/api/v1/accounts/{name}/videos') fetch('https://peertube2.cpy.re/api/v1/accounts/{name}/videos')
@ -344,6 +344,9 @@ paths:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/ServerConfig' $ref: '#/components/schemas/ServerConfig'
examples:
nightly:
externalValue: https://peertube2.cpy.re/api/v1/config
/config/about: /config/about:
get: get:
summary: Get instance "About" information summary: Get instance "About" information
@ -356,6 +359,9 @@ paths:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/ServerConfigAbout' $ref: '#/components/schemas/ServerConfigAbout'
examples:
nightly:
externalValue: https://peertube2.cpy.re/api/v1/config/about
/config/custom: /config/custom:
get: get:
summary: Get instance runtime configuration summary: Get instance runtime configuration
@ -1179,6 +1185,7 @@ paths:
/videos/categories: /videos/categories:
get: get:
summary: List available video categories summary: List available video categories
operationId: getCategories
tags: tags:
- Video - Video
responses: responses:
@ -1196,6 +1203,7 @@ paths:
/videos/licences: /videos/licences:
get: get:
summary: List available video licences summary: List available video licences
operationId: getLicences
tags: tags:
- Video - Video
responses: responses:
@ -1213,6 +1221,7 @@ paths:
/videos/languages: /videos/languages:
get: get:
summary: List available video languages summary: List available video languages
operationId: getLanguages
tags: tags:
- Video - Video
responses: responses:
@ -1229,7 +1238,8 @@ paths:
externalValue: https://peertube2.cpy.re/api/v1/videos/languages externalValue: https://peertube2.cpy.re/api/v1/videos/languages
/videos/privacies: /videos/privacies:
get: get:
summary: List available video privacies summary: List available video privacy policies
operationId: getPrivacyPolicies
tags: tags:
- Video - Video
responses: responses:
@ -1271,16 +1281,11 @@ paths:
type: string type: string
format: binary format: binary
category: category:
description: Video category $ref: '#/components/schemas/VideoCategorySet'
type: integer
example: 4
licence: licence:
description: Video licence $ref: '#/components/schemas/VideoLicenceSet'
type: integer
example: 2
language: language:
description: Video language $ref: '#/components/schemas/VideoLanguageSet'
type: string
privacy: privacy:
$ref: '#/components/schemas/VideoPrivacySet' $ref: '#/components/schemas/VideoPrivacySet'
description: description:
@ -1394,6 +1399,7 @@ paths:
post: post:
summary: Upload a video summary: Upload a video
description: Uses a single request to upload a video. description: Uses a single request to upload a video.
operationId: uploadLegacy
security: security:
- OAuth2: [] - OAuth2: []
tags: tags:
@ -1436,7 +1442,7 @@ paths:
contentType: image/jpeg contentType: image/jpeg
previewfile: previewfile:
contentType: image/jpeg contentType: image/jpeg
x-code-samples: x-codeSamples:
- lang: Shell - lang: Shell
source: | source: |
## DEPENDENCIES: jq ## DEPENDENCIES: jq
@ -1469,6 +1475,7 @@ paths:
post: post:
summary: Initialize the resumable upload of a video summary: Initialize the resumable upload of a video
description: Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to initialize the upload of a video description: Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to initialize the upload of a video
operationId: uploadResumableInit
security: security:
- OAuth2: [] - OAuth2: []
tags: tags:
@ -1519,6 +1526,7 @@ paths:
put: put:
summary: Send chunk for the resumable upload of a video summary: Send chunk for the resumable upload of a video
description: Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to continue, pause or resume the upload of a video description: Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to continue, pause or resume the upload of a video
operationId: uploadResumable
security: security:
- OAuth2: [] - OAuth2: []
tags: tags:
@ -1595,6 +1603,7 @@ paths:
delete: delete:
summary: Cancel the resumable upload of a video, deleting any data uploaded so far summary: Cancel the resumable upload of a video, deleting any data uploaded so far
description: Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to cancel the upload of a video description: Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to cancel the upload of a video
operationId: uploadResumableCancel
security: security:
- OAuth2: [] - OAuth2: []
tags: tags:
@ -1627,6 +1636,7 @@ paths:
post: post:
summary: Import a video summary: Import a video
description: Import a torrent or magnetURI or HTTP resource (if enabled by the instance administrator) description: Import a torrent or magnetURI or HTTP resource (if enabled by the instance administrator)
operationId: importVideo
security: security:
- OAuth2: [] - OAuth2: []
tags: tags:
@ -1662,16 +1672,11 @@ paths:
privacy: privacy:
$ref: '#/components/schemas/VideoPrivacySet' $ref: '#/components/schemas/VideoPrivacySet'
category: category:
description: Video category $ref: '#/components/schemas/VideoCategorySet'
type: integer
example: 4
licence: licence:
description: Video licence $ref: '#/components/schemas/VideoLicenceSet'
type: integer
example: 2
language: language:
description: Video language $ref: '#/components/schemas/VideoLanguageSet'
type: string
description: description:
description: Video description description: Video description
type: string type: string
@ -1734,6 +1739,7 @@ paths:
/videos/live: /videos/live:
post: post:
summary: Create a live summary: Create a live
operationId: createLive
security: security:
- OAuth2: [] - OAuth2: []
tags: tags:
@ -1773,14 +1779,11 @@ paths:
privacy: privacy:
$ref: '#/components/schemas/VideoPrivacySet' $ref: '#/components/schemas/VideoPrivacySet'
category: category:
description: Live video/replay category $ref: '#/components/schemas/VideoCategorySet'
type: string
licence: licence:
description: Live video/replay licence $ref: '#/components/schemas/VideoLicenceSet'
type: string
language: language:
description: Live video/replay language $ref: '#/components/schemas/VideoLanguageSet'
type: string
description: description:
description: Live video/replay description description: Live video/replay description
type: string type: string
@ -1823,6 +1826,7 @@ paths:
/videos/live/{id}: /videos/live/{id}:
get: get:
summary: Get information about a live summary: Get information about a live
operationId: getLiveId
security: security:
- OAuth2: [] - OAuth2: []
tags: tags:
@ -1839,6 +1843,7 @@ paths:
$ref: '#/components/schemas/LiveVideoResponse' $ref: '#/components/schemas/LiveVideoResponse'
put: put:
summary: Update information about a live summary: Update information about a live
operationId: updateLiveId
security: security:
- OAuth2: [] - OAuth2: []
tags: tags:
@ -2482,7 +2487,8 @@ paths:
/video-playlists/privacies: /video-playlists/privacies:
get: get:
summary: List available playlist privacies summary: List available playlist privacy policies
operationId: getPlaylistPrivacyPolicies
tags: tags:
- Video Playlists - Video Playlists
responses: responses:
@ -2501,6 +2507,7 @@ paths:
/video-playlists: /video-playlists:
get: get:
summary: List video playlists summary: List video playlists
operationId: getPlaylists
tags: tags:
- Video Playlists - Video Playlists
parameters: parameters:
@ -2525,6 +2532,7 @@ paths:
post: post:
summary: Create a video playlist summary: Create a video playlist
description: 'If the video playlist is set as public, the videoChannelId is mandatory.' description: 'If the video playlist is set as public, the videoChannelId is mandatory.'
operationId: createPlaylist
security: security:
- OAuth2: [] - OAuth2: []
tags: tags:
@ -4056,7 +4064,7 @@ components:
name: categoryOneOf name: categoryOneOf
in: query in: query
required: false required: false
description: category id of the video (see [/videos/categories](#tag/Video/paths/~1videos~1categories/get)) description: category id of the video (see [/videos/categories](#operation/getCategories))
schema: schema:
oneOf: oneOf:
- type: integer - type: integer
@ -4096,7 +4104,7 @@ components:
name: languageOneOf name: languageOneOf
in: query in: query
required: false required: false
description: language id of the video (see [/videos/languages](#tag/Video/paths/~1videos~1languages/get)). Use `_unknown` to filter on videos that don't have a video language description: language id of the video (see [/videos/languages](#operation/getLanguages)). Use `_unknown` to filter on videos that don't have a video language
schema: schema:
oneOf: oneOf:
- type: string - type: string
@ -4109,7 +4117,7 @@ components:
name: licenceOneOf name: licenceOneOf
in: query in: query
required: false required: false
description: licence id of the video (see [/videos/licences](#tag/Video/paths/~1videos~1licences/get)) description: licence id of the video (see [/videos/licences](#operation/getLicences))
schema: schema:
oneOf: oneOf:
- type: integer - type: integer
@ -4222,25 +4230,33 @@ components:
minLength: 36 minLength: 36
maxLength: 36 maxLength: 36
VideoCategorySet:
type: integer
description: category id of the video (see [/videos/categories](#operation/getCategories))
VideoConstantNumber-Category: VideoConstantNumber-Category:
properties: properties:
id: id:
type: integer $ref: '#/components/schemas/VideoCategorySet'
description: category id of the video (see [/videos/categories](#tag/Video/paths/~1videos~1categories/get))
label: label:
type: string type: string
VideoLicenceSet:
type: integer
description: licence id of the video (see [/videos/licences](#operation/getLicences))
VideoConstantNumber-Licence: VideoConstantNumber-Licence:
properties: properties:
id: id:
type: integer $ref: '#/components/schemas/VideoLicenceSet'
description: licence id of the video (see [/videos/licences](#tag/Video/paths/~1videos~1licences/get))
label: label:
type: string type: string
VideoLanguageSet:
type: string
description: language id of the video (see [/videos/languages](#operation/getLanguages))
VideoConstantString-Language: VideoConstantString-Language:
properties: properties:
id: id:
type: string $ref: '#/components/schemas/VideoLanguageSet'
description: language id of the video (see [/videos/languages](#tag/Video/paths/~1videos~1languages/get))
label: label:
type: string type: string
@ -4250,7 +4266,7 @@ components:
- 1 - 1
- 2 - 2
- 3 - 3
description: 'The video playlist privacy (Public = `1`, Unlisted = `2`, Private = `3`)' description: Video playlist privacy policy (see [/video-playlists/privacies])
VideoPlaylistPrivacyConstant: VideoPlaylistPrivacyConstant:
properties: properties:
id: id:
@ -4263,7 +4279,7 @@ components:
enum: enum:
- 1 - 1
- 2 - 2
description: 'The video playlist type (Regular = `1`, Watch Later = `2`)' description: The video playlist type (Regular = `1`, Watch Later = `2`)
VideoPlaylistTypeConstant: VideoPlaylistTypeConstant:
properties: properties:
id: id:
@ -4278,7 +4294,7 @@ components:
- 2 - 2
- 3 - 3
- 4 - 4
description: 'The video privacy (Public = `1`, Unlisted = `2`, Private = `3`, Internal = `4`)' description: privacy id of the video (see [/videos/privacies](#operation/getPrivacyPolicies))
VideoPrivacyConstant: VideoPrivacyConstant:
properties: properties:
id: id:
@ -4349,12 +4365,17 @@ components:
- captions - captions
example: [spamOrMisleading] example: [spamOrMisleading]
VideoResolutionSet:
type: integer
description: |
Video resolution (`0`, `240`, `360`, `720`, `1080`, `1440` or `2160`)
`0` is used as a special value for stillimage videos dedicated to audio, a.k.a. audio-only videos.
example: 240
VideoResolutionConstant: VideoResolutionConstant:
properties: properties:
id: id:
type: integer $ref: '#/components/schemas/VideoResolutionSet'
description: 'Video resolution (240, 360, 720, 1080, 1440 or 2160)'
example: 240
label: label:
type: string type: string
example: 240p example: 240p
@ -5072,7 +5093,7 @@ components:
enabledResolutions: enabledResolutions:
type: array type: array
items: items:
type: integer $ref: '#/components/schemas/VideoResolutionSet'
import: import:
type: object type: object
properties: properties:
@ -5273,6 +5294,7 @@ components:
type: boolean type: boolean
user: user:
type: object type: object
description: Settings that apply to new users, if registration is enabled
properties: properties:
videoQuota: videoQuota:
type: integer type: integer
@ -5280,18 +5302,34 @@ components:
type: integer type: integer
transcoding: transcoding:
type: object type: object
description: Settings pertaining to transcoding jobs
properties: properties:
enabled: enabled:
type: boolean type: boolean
allowAdditionalExtensions: allowAdditionalExtensions:
type: boolean type: boolean
description: Allow your users to upload .mkv, .mov, .avi, .wmv, .flv, .f4v, .3g2, .3gp, .mts, m2ts, .mxf, .nut videos
allowAudioFiles: allowAudioFiles:
type: boolean type: boolean
description: If a user uploads an audio file, PeerTube will create a video by merging the preview file and the audio file
threads: threads:
type: integer type: integer
description: Amount of threads used by ffmpeg for 1 transcoding job
concurrency:
type: number
description: Amount of transcoding jobs to execute in parallel
profile:
type: string
enum:
- default
description: |
New profiles can be added by plugins ; available in core PeerTube: 'default'.
resolutions: resolutions:
type: object type: object
description: Resolutions to transcode _new videos_ to
properties: properties:
0p:
type: boolean
240p: 240p:
type: boolean type: boolean
360p: 360p:
@ -5306,8 +5344,15 @@ components:
type: boolean type: boolean
2160p: 2160p:
type: boolean type: boolean
webtorrent:
type: object
description: WebTorrent-specific settings
properties:
enabled:
type: boolean
hls: hls:
type: object type: object
description: HLS-specific settings
properties: properties:
enabled: enabled:
type: boolean type: boolean
@ -5455,16 +5500,11 @@ components:
privacy: privacy:
$ref: '#/components/schemas/VideoPrivacySet' $ref: '#/components/schemas/VideoPrivacySet'
category: category:
description: Video category $ref: '#/components/schemas/VideoCategorySet'
type: integer
example: 4
licence: licence:
description: Video licence $ref: '#/components/schemas/VideoLicenceSet'
type: integer
example: 2
language: language:
description: Video language $ref: '#/components/schemas/VideoLanguageSet'
type: string
description: description:
description: Video description description: Video description
type: string type: string