X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=support%2Fdoc%2Fapi%2Fopenapi.yaml;h=d4fe1566401a9dcedff8cf686b4dc4a21aaca103;hb=0c1145687bf029561e56219e669c9f1b0cd61577;hp=c06bffb0a1ac550a84018520492a0565d4f72600;hpb=040d6896a3cd5622e78cccdedd8cce2afcf49a31;p=github%2FChocobozzz%2FPeerTube.git diff --git a/support/doc/api/openapi.yaml b/support/doc/api/openapi.yaml index c06bffb0a..d4fe15664 100644 --- a/support/doc/api/openapi.yaml +++ b/support/doc/api/openapi.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: title: PeerTube - version: 2.4.0 + version: 3.1.0 contact: name: PeerTube Community url: 'https://joinpeertube.org' @@ -23,7 +23,7 @@ info: - [Go](https://framagit.org/framasoft/peertube/clients/go) - [Kotlin](https://framagit.org/framasoft/peertube/clients/kotlin) - See the [Quick Start guide](https://docs.joinpeertube.org/#/api-rest-getting-started) so you can play with the PeerTube API. + See the [Quick Start guide](https://docs.joinpeertube.org/api-rest-getting-started) so you can play with the PeerTube API. # Authentication @@ -34,7 +34,7 @@ info: ## 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?id=roles) for a detail of their permissions. + PeerTube: Administrator, Moderator, and User. See the [roles guide](https://docs.joinpeertube.org/admin-managing-users?id=roles) for a detail of their permissions. # Errors @@ -95,7 +95,7 @@ tags: information across its social graph by posting activities to actors' inbox endpoints. externalDocs: - url: https://docs.joinpeertube.org/#/admin-following-instances?id=instances-follows + url: https://docs.joinpeertube.org/admin-following-instances?id=instances-follows - name: Instance Redundancy description: > Redundancy is part of the inter-server solidarity that PeerTube fosters. @@ -103,12 +103,12 @@ tags: to the policy of video selection of your choice. Note that you have a similar functionality to mirror individual videos, see `Video Mirroring`. externalDocs: - url: https://docs.joinpeertube.org/#/admin-following-instances?id=instances-redundancy + url: https://docs.joinpeertube.org/admin-following-instances?id=instances-redundancy - name: Plugins description: > Managing plugins installed from a local path or from NPM, or search for new ones. externalDocs: - url: https://docs.joinpeertube.org/#/api-plugins + url: https://docs.joinpeertube.org/api-plugins - name: Abuses description: | Abuses deal with reports of local or remote videos/comments/accounts alike. @@ -210,6 +210,7 @@ paths: parameters: - $ref: '#/components/parameters/name' - $ref: '#/components/parameters/categoryOneOf' + - $ref: '#/components/parameters/isLive' - $ref: '#/components/parameters/tagsOneOf' - $ref: '#/components/parameters/tagsAllOf' - $ref: '#/components/parameters/licenceOneOf' @@ -781,6 +782,7 @@ paths: - Videos parameters: - $ref: '#/components/parameters/categoryOneOf' + - $ref: '#/components/parameters/isLive' - $ref: '#/components/parameters/tagsOneOf' - $ref: '#/components/parameters/tagsAllOf' - $ref: '#/components/parameters/licenceOneOf' @@ -933,6 +935,7 @@ paths: parameters: - $ref: '#/components/parameters/start' - $ref: '#/components/parameters/count' + - $ref: '#/components/parameters/search' responses: '200': description: successful operation @@ -973,7 +976,10 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Avatar' + type: object + properties: + avatar: + $ref: '#/components/schemas/ActorImage' '413': description: image file too large headers: @@ -995,6 +1001,17 @@ paths: encoding: avatarfile: contentType: image/png, image/jpeg + /users/me/avatar: + delete: + summary: Delete my avatar + security: + - OAuth2: [] + tags: + - My User + responses: + '204': + description: successful operation + /videos/ownership: get: summary: List video ownership changes @@ -1071,6 +1088,7 @@ paths: - Video parameters: - $ref: '#/components/parameters/categoryOneOf' + - $ref: '#/components/parameters/isLive' - $ref: '#/components/parameters/tagsOneOf' - $ref: '#/components/parameters/tagsAllOf' - $ref: '#/components/parameters/licenceOneOf' @@ -1211,6 +1229,8 @@ paths: name: description: Video name type: string + minLength: 3 + maxLength: 120 tags: description: Video tags (maximum 5 tags each between 2 and 30 characters) type: array @@ -1361,11 +1381,11 @@ paths: example: 4 licence: description: Video licence - type: string - language: - description: Video language type: integer example: 2 + language: + description: Video language + type: string description: description: Video description type: string @@ -1382,6 +1402,8 @@ paths: name: description: Video name type: string + minLength: 3 + maxLength: 120 tags: description: Video tags (maximum 5 tags each between 2 and 30 characters) type: array @@ -1483,10 +1505,12 @@ paths: $ref: '#/components/schemas/VideoPrivacySet' category: description: Video category - type: string + type: integer + example: 4 licence: description: Video licence - type: string + type: integer + example: 2 language: description: Video language type: string @@ -1506,6 +1530,8 @@ paths: name: description: Video name type: string + minLength: 3 + maxLength: 120 tags: description: Video tags (maximum 5 tags each between 2 and 30 characters) type: array @@ -1610,6 +1636,8 @@ paths: name: description: Live video/replay name type: string + minLength: 3 + maxLength: 120 tags: description: Live video/replay tags (maximum 5 tags each between 2 and 30 characters) type: array @@ -1799,10 +1827,10 @@ paths: reason: description: Reason why the user reports this video type: string - minLength: 4 + minLength: 2 + maxLength: 3000 predefinedReasons: $ref: '#/components/schemas/PredefinedAbuseReasons' - video: type: object properties: @@ -1858,6 +1886,8 @@ paths: moderationComment: type: string description: Update the report comment visible only to the moderation team + minLength: 2 + maxLength: 3000 responses: '204': description: successful operation @@ -1915,6 +1945,8 @@ paths: message: description: Message to send type: string + minLength: 2 + maxLength: 3000 required: - message responses: @@ -2165,6 +2197,7 @@ paths: parameters: - $ref: '#/components/parameters/channelHandle' - $ref: '#/components/parameters/categoryOneOf' + - $ref: '#/components/parameters/isLive' - $ref: '#/components/parameters/tagsOneOf' - $ref: '#/components/parameters/tagsAllOf' - $ref: '#/components/parameters/licenceOneOf' @@ -2182,6 +2215,112 @@ paths: application/json: schema: $ref: '#/components/schemas/VideoListResponse' + '/video-channels/{channelHandle}/avatar/pick': + post: + summary: Update channel avatar + security: + - OAuth2: [] + tags: + - Video Channels + parameters: + - $ref: '#/components/parameters/channelHandle' + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + avatar: + $ref: '#/components/schemas/ActorImage' + '413': + description: image file too large + headers: + X-File-Maximum-Size: + schema: + type: string + format: Nginx size + description: Maximum file size for the avatar + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + avatarfile: + description: The file to upload. + type: string + format: binary + encoding: + avatarfile: + contentType: image/png, image/jpeg + '/video-channels/{channelHandle}/avatar': + delete: + summary: Delete channel avatar + security: + - OAuth2: [] + tags: + - Video Channels + parameters: + - $ref: '#/components/parameters/channelHandle' + responses: + '204': + description: successful operation + + + '/video-channels/{channelHandle}/banner/pick': + post: + summary: Update channel banner + security: + - OAuth2: [] + tags: + - Video Channels + parameters: + - $ref: '#/components/parameters/channelHandle' + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + banner: + $ref: '#/components/schemas/ActorImage' + '413': + description: image file too large + headers: + X-File-Maximum-Size: + schema: + type: string + format: Nginx size + description: Maximum file size for the banner + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + bannerfile: + description: The file to upload. + type: string + format: binary + encoding: + bannerfile: + contentType: image/png, image/jpeg + '/video-channels/{channelHandle}/banner': + delete: + summary: Delete channel banner + security: + - OAuth2: [] + tags: + - Video Channels + parameters: + - $ref: '#/components/parameters/channelHandle' + responses: + '204': + description: successful operation /video-playlists/privacies: get: @@ -2246,7 +2385,7 @@ paths: id: type: integer uuid: - type: string + $ref: '#/components/schemas/UUIDv4' requestBody: content: multipart/form-data: @@ -2256,6 +2395,8 @@ paths: displayName: description: Video playlist display name type: string + minLength: 1 + maxLength: 120 thumbnailfile: description: Video playlist thumbnail file type: string @@ -2309,6 +2450,8 @@ paths: displayName: description: Video playlist display name type: string + minLength: 1 + maxLength: 120 thumbnailfile: description: Video playlist thumbnail file type: string @@ -2523,9 +2666,14 @@ paths: content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/VideoChannel' + properties: + total: + type: integer + example: 1 + data: + type: array + items: + $ref: '#/components/schemas/VideoChannel' '/accounts/{name}/ratings': get: summary: List ratings of an account @@ -2697,6 +2845,7 @@ paths: schema: type: string - $ref: '#/components/parameters/categoryOneOf' + - $ref: '#/components/parameters/isLive' - $ref: '#/components/parameters/tagsOneOf' - $ref: '#/components/parameters/tagsAllOf' - $ref: '#/components/parameters/licenceOneOf' @@ -3490,6 +3639,7 @@ components: - -views - -likes - -trending + - -hot videosSearchSort: name: sort in: query @@ -3603,9 +3753,7 @@ components: - type: integer minimum: 0 example: 42 - - type: string - format: uuid - example: 9c9de5e8-0a1e-484a-b099-e80766180a6d + - $ref: '#/components/schemas/UUIDv4' playlistElementId: name: playlistElementId in: path @@ -3664,6 +3812,13 @@ components: description: The comment id schema: type: integer + isLive: + name: isLive + in: query + required: false + description: whether or not the video is a live + schema: + type: boolean categoryOneOf: name: categoryOneOf in: query @@ -3813,7 +3968,7 @@ components: - Have an account with sufficient authorization levels - - [Generate](https://docs.joinpeertube.org/#/api-rest-getting-started) a + - [Generate](https://docs.joinpeertube.org/api-rest-getting-started) a Bearer Token - Make Authenticated Requests @@ -3826,16 +3981,35 @@ components: moderator: Moderator scope user: User scope schemas: - VideoConstantNumber: + UUIDv4: + type: string + format: uuid + example: 9c9de5e8-0a1e-484a-b099-e80766180a6d + pattern: '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$' + # the regex above limits the length; + # however, some tools might require explicit settings: + minLength: 36 + maxLength: 36 + + VideoConstantNumber-Category: + properties: + id: + type: integer + description: category id of the video (see [/videos/categories](#tag/Video/paths/~1videos~1categories/get)) + label: + type: string + VideoConstantNumber-Licence: properties: id: type: integer + description: licence id of the video (see [/videos/licences](#tag/Video/paths/~1videos~1licences/get)) label: type: string - VideoConstantString: + VideoConstantString-Language: properties: id: type: string + description: language id of the video (see [/videos/languages](#tag/Video/paths/~1videos~1languages/get)) label: type: string @@ -3896,6 +4070,13 @@ components: - 2 description: 'The user role (Admin = `0`, Moderator = `1`, User = `2`)' example: 2 + UserAdminFlags: + type: integer + enum: + - 0 + - 1 + description: 'Admin flags for the user (None = `0`, Bypass video blacklist = `1`)' + example: 1 VideoStateConstant: properties: @@ -3941,7 +4122,7 @@ components: properties: id: type: integer - description: 'Video resolution (240, 360, 720 ...)' + description: 'Video resolution (240, 360, 720, 1080, 1440 or 2160)' example: 240 label: type: string @@ -3973,7 +4154,7 @@ components: avatar: nullable: true allOf: - - $ref: '#/components/schemas/Avatar' + - $ref: '#/components/schemas/ActorImage' VideoChannelSummary: properties: id: @@ -3991,7 +4172,7 @@ components: avatar: nullable: true allOf: - - $ref: '#/components/schemas/Avatar' + - $ref: '#/components/schemas/ActorImage' PlaylistElement: properties: position: @@ -4015,15 +4196,19 @@ components: description: 'Video file size in bytes' torrentUrl: type: string + description: Direct URL of the torrent file format: url torrentDownloadUrl: type: string + description: URL endpoint that transfers the torrent file as an attachment (so that the browser opens a download dialog) format: url fileUrl: type: string + description: Direct URL of the video format: url fileDownloadUrl: type: string + description: URL endpoint that transfers the video file as an attachment (so that the browser opens a download dialog) format: url fps: type: number @@ -4031,14 +4216,21 @@ components: type: string format: url VideoStreamingPlaylists: + allOf: + - type: object + properties: + id: + type: integer + type: + type: integer + enum: + - 1 + description: | + Playlist type: + - `1`: HLS + - $ref: '#/components/schemas/VideoStreamingPlaylists-HLS' + VideoStreamingPlaylists-HLS: properties: - id: - type: integer - type: - type: integer - enum: - - 1 - description: 'Playlist type (HLS = `1`)' playlistUrl: type: string format: url @@ -4047,7 +4239,10 @@ components: format: url files: type: array - description: 'Video files associated to this playlist. The difference with the root "files" property is that these files are fragmented, so they can be used in this streaming playlist (HLS etc)' + description: | + Video files associated to this playlist. + + The difference with the root `files` property is that these files are fragmented, so they can be used in this streaming playlist (HLS, etc.) items: $ref: '#/components/schemas/VideoFile' redundancies: @@ -4063,52 +4258,69 @@ components: id: type: integer uuid: - type: string - format: uuid - example: 9c9de5e8-0a1e-484a-b099-e80766180a6d + $ref: '#/components/schemas/UUIDv4' name: type: string + minLength: 3 + maxLength: 120 Video: properties: id: type: integer example: 8 uuid: - type: string - format: uuid - example: 9c9de5e8-0a1e-484a-b099-e80766180a6d + $ref: '#/components/schemas/UUIDv4' isLive: type: boolean createdAt: type: string format: date-time + example: 2017-10-01T10:52:46.396Z + description: time at which the video object was first drafted publishedAt: type: string format: date-time + example: 2018-10-01T10:52:46.396Z + description: time at which the video was marked as ready for playback (with restrictions depending on `privacy`). Usually set after a `state` evolution. updatedAt: type: string format: date-time + example: 2021-05-04T08:01:01.502Z + description: last time the video's metadata was modified originallyPublishedAt: type: string format: date-time + example: 2010-10-01T10:52:46.396Z + description: used to represent a date of first publication, prior to the practical publication date of `publishedAt` category: - $ref: '#/components/schemas/VideoConstantNumber' + $ref: '#/components/schemas/VideoConstantNumber-Category' licence: - $ref: '#/components/schemas/VideoConstantNumber' + $ref: '#/components/schemas/VideoConstantNumber-Licence' language: - $ref: '#/components/schemas/VideoConstantString' + $ref: '#/components/schemas/VideoConstantString-Language' privacy: $ref: '#/components/schemas/VideoPrivacyConstant' description: type: string + example: | + **[Want to help to translate this video?](https://weblate.framasoft.org/projects/what-is-peertube-video/)**\r\n\r\n + **Take back the control of your videos! [#JoinPeertube](https://joinpeertube.org)**\r\n*A decentralized video hosting network, based on fr... + minLength: 3 + maxLength: 250 + description: | + truncated description of the video, written in Markdown. + Resolve `descriptionPath` to get the full description of maximum `10000` characters. duration: type: integer example: 1419 + description: duration of the video in seconds isLocal: type: boolean name: type: string example: What is PeerTube? + minLength: 3 + maxLength: 120 thumbnailPath: type: string example: /static/thumbnails/a65bc12f-9383-462e-81ae-8207e8b434ee.jpg @@ -4161,24 +4373,27 @@ components: properties: descriptionPath: type: string + example: /api/v1/videos/9c9de5e8-0a1e-484a-b099-e80766180a6d/description + description: path at which to get the full description of maximum `10000` characters support: type: string description: A text tell the audience how to support the video creator example: Please support my work on ! <3 + minLength: 3 + maxLength: 1000 channel: $ref: '#/components/schemas/VideoChannel' account: $ref: '#/components/schemas/Account' tags: - type: array - items: - type: string example: [flowers, gardening] - files: type: array - description: 'WebTorrent/raw video files. Can be empty if WebTorrent is disabled on the server. In this case, video files will be in the "streamingPlaylists[].files" property' + minItems: 1 + maxItems: 5 items: - $ref: '#/components/schemas/VideoFile' + type: string + minLength: 2 + maxLength: 30 commentsEnabled: type: boolean downloadEnabled: @@ -4188,10 +4403,24 @@ components: items: type: string format: url + files: + type: array + items: + $ref: '#/components/schemas/VideoFile' + description: | + WebTorrent/raw video files. If WebTorrent is disabled on the server: + + - field will be empty + - video files will be found in `streamingPlaylists[].files` field streamingPlaylists: type: array items: $ref: '#/components/schemas/VideoStreamingPlaylists' + description: | + HLS playlists/manifest files. If HLS is disabled on the server: + + - field will be empty + - video files will be found in `files` field FileRedundancyInformation: properties: id: @@ -4227,9 +4456,7 @@ components: type: string format: url uuid: - type: string - format: uuid - example: 9c9de5e8-0a1e-484a-b099-e80766180a6d + $ref: '#/components/schemas/UUIDv4' redundancies: type: object properties: @@ -4288,6 +4515,8 @@ components: reason: type: string example: The video is a spam + minLength: 2 + maxLength: 3000 predefinedReasons: $ref: '#/components/schemas/AbusePredefinedReasons' reporterAccount: @@ -4297,17 +4526,10 @@ components: moderationComment: type: string example: Decided to ban the server since it spams us regularly + minLength: 2 + maxLength: 3000 video: - type: object - properties: - id: - type: integer - name: - type: string - uuid: - type: string - format: uuid - example: 9c9de5e8-0a1e-484a-b099-e80766180a6d + $ref: '#/components/schemas/VideoInfo' createdAt: type: string format: date-time @@ -4317,6 +4539,8 @@ components: type: integer message: type: string + minLength: 2 + maxLength: 3000 byModerator: type: boolean createdAt: @@ -4338,12 +4562,14 @@ components: format: date-time name: type: string + minLength: 3 + maxLength: 120 uuid: - type: string - format: uuid - example: 9c9de5e8-0a1e-484a-b099-e80766180a6d + $ref: '#/components/schemas/UUIDv4' description: type: string + minLength: 3 + maxLength: 10000 duration: type: integer views: @@ -4358,8 +4584,12 @@ components: properties: displayName: type: string + minLength: 1 + maxLength: 120 description: type: string + minLength: 3 + maxLength: 1000 isLocal: type: boolean ownerAccount: @@ -4368,9 +4598,7 @@ components: id: type: integer uuid: - type: string - format: uuid - example: 9c9de5e8-0a1e-484a-b099-e80766180a6d + $ref: '#/components/schemas/UUIDv4' VideoPlaylist: properties: id: @@ -4383,12 +4611,14 @@ components: format: date-time description: type: string + minLength: 3 + maxLength: 1000 uuid: - type: string - format: uuid - example: 9c9de5e8-0a1e-484a-b099-e80766180a6d + $ref: '#/components/schemas/UUIDv4' displayName: type: string + minLength: 1 + maxLength: 120 isLocal: type: boolean videoLength: @@ -4412,6 +4642,8 @@ components: format: url text: type: string + minLength: 1 + maxLength: 10000 threadId: type: integer inReplyToCommentId: @@ -4441,10 +4673,10 @@ components: VideoCaption: properties: language: - $ref: '#/components/schemas/VideoConstantString' + $ref: '#/components/schemas/VideoConstantString-Language' captionPath: type: string - Avatar: + ActorImage: properties: path: type: string @@ -4496,7 +4728,7 @@ components: type: string format: date-time avatar: - $ref: '#/components/schemas/Avatar' + $ref: '#/components/schemas/ActorImage' Account: allOf: - $ref: '#/components/schemas/Actor' @@ -4829,6 +5061,8 @@ components: type: boolean 1080p: type: boolean + 1440p: + type: boolean 2160p: type: boolean hls: @@ -4977,9 +5211,7 @@ components: type: integer example: 8 uuid: - type: string - format: uuid - example: 9c9de5e8-0a1e-484a-b099-e80766180a6d + $ref: '#/components/schemas/UUIDv4' CommentThreadResponse: properties: total: @@ -5018,6 +5250,9 @@ components: type: string format: email description: The user email + pluginAuth: + type: string + description: Auth plugin to use to authenticate the user theme: type: string description: Theme enabled by this user @@ -5095,8 +5330,13 @@ components: videoQuotaDaily: type: integer description: The user daily video quota + channelName: + type: string + description: The user default channel username role: $ref: '#/components/schemas/UserRole' + adminFlags: + $ref: '#/components/schemas/UserAdminFlags' required: - username - password @@ -5113,20 +5353,26 @@ components: type: string format: email description: The updated email of the user + emailVerified: + type: boolean + description: Set the email as verified videoQuota: type: integer description: The updated video quota of the user videoQuotaDaily: type: integer description: The updated daily video quota of the user + pluginAuth: + type: string + nullable: true + description: The auth plugin to use to authenticate the user + example: 'peertube-plugin-auth-saml2' role: $ref: '#/components/schemas/UserRole' + adminFlags: + $ref: '#/components/schemas/UserAdminFlags' required: - id - - email - - videoQuota - - videoQuotaDaily - - role UpdateMe: properties: password: @@ -5214,34 +5460,41 @@ components: - username - password - email - VideoChannelCreate: + + VideoChannelCommon: properties: - name: - type: string displayName: type: string + minLength: 1 + maxLength: 120 description: type: string + minLength: 3 + maxLength: 1000 support: type: string description: 'A text shown by default on all videos of this channel, to tell the audience how to support it' example: Please support my work on ! <3 + minLength: 3 + maxLength: 1000 + VideoChannelCreate: + allOf: + - $ref: '#/components/schemas/VideoChannelCommon' + - properties: + name: + type: string + minLength: 1 + maxLength: 120 required: - name - displayName VideoChannelUpdate: - properties: - displayName: - type: string - description: - type: string - support: - type: string - description: 'A text shown by default on all videos of this channel, to tell the audience how to support it' - example: Please support my work on ! <3 - bulkVideosSupportUpdate: - type: boolean - description: 'Update the support field for all videos of this channel' + allOf: + - $ref: '#/components/schemas/VideoChannelCommon' + - properties: + bulkVideosSupportUpdate: + type: boolean + description: 'Update the support field for all videos of this channel' MRSSPeerLink: type: object @@ -5662,6 +5915,8 @@ components: description: User can stream multiple times in a permanent live type: boolean + + callbacks: searchIndex: 'https://search.example.org/api/v1/search/videos':