X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=support%2Fdoc%2Fapi%2Fopenapi.yaml;h=3c7688a7c8f35b80ab77cea9c494a4a29512384a;hb=46e9407c60650fefd0c0a3358da22d81dabe6f09;hp=5764a0e302a223261f9da6cd982a970b275d8fe3;hpb=5776f78e3b3f3a371ec30c7fcb11e7ca17f2f65e;p=github%2FChocobozzz%2FPeerTube.git diff --git a/support/doc/api/openapi.yaml b/support/doc/api/openapi.yaml index 5764a0e30..3c7688a7c 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: 1.1.0-alpha.2 + version: 1.3.0-rc.2 contact: name: PeerTube Community url: 'https://joinpeertube.org' @@ -23,7 +23,7 @@ info: # Authentication When you sign up for an account, you are given the possibility to generate - sessions, and authenticate using this session token. One session token can + sessions, and authenticate using this session token. One session token can currently be used at a time. # Errors @@ -38,7 +38,7 @@ info: } ``` externalDocs: - url: https://docs.joinpeertube.org/api.html + url: https://docs.joinpeertube.org/#/api-rest-reference.html tags: - name: Accounts description: > @@ -61,7 +61,7 @@ tags: description: > Managing servers which the instance interacts with is crucial to the concept of federation in PeerTube and external video indexation. The PeerTube - server then deals with inter-server ActivityPub operations and propagates + server then deals with inter-server ActivityPub operations and propagates information across its social graph by posting activities to actors' inbox endpoints. - name: Video Abuse @@ -101,13 +101,13 @@ x-tagGroups: - Video - Video Channel - Video Comment - - Video Abuse - Video Following - Video Rate - name: Moderation tags: + - Video Abuse - Video Blacklist - - name: Public Instance Information + - name: Instance Configuration tags: - Config - Server Following @@ -300,7 +300,7 @@ paths: responses: '200': description: successful operation - /jobs: + /jobs/{state}: get: summary: Get list of jobs security: @@ -315,6 +315,12 @@ paths: description: The state of the job schema: type: string + enum: + - active + - completed + - failed + - waiting + - delayed - $ref: '#/components/parameters/start' - $ref: '#/components/parameters/count' - $ref: '#/components/parameters/sort' @@ -427,7 +433,7 @@ paths: parameters: - $ref: '#/components/parameters/start' - $ref: '#/components/parameters/count' - - $ref: '#/components/parameters/sort' + - $ref: '#/components/parameters/usersSort' responses: '200': description: successful operation @@ -486,7 +492,8 @@ paths: get: summary: Get current user information security: - - OAuth2: [] + - OAuth2: + - user tags: - User responses: @@ -501,7 +508,8 @@ paths: put: summary: Update current user information security: - - OAuth2: [] + - OAuth2: + - user tags: - User responses: @@ -517,7 +525,8 @@ paths: get: summary: Get current user used quota security: - - OAuth2: [] + - OAuth2: + - user tags: - User responses: @@ -552,7 +561,8 @@ paths: get: summary: Get videos of the current user security: - - OAuth2: [] + - OAuth2: + - user tags: - User parameters: @@ -568,6 +578,94 @@ paths: type: array items: $ref: '#/components/schemas/Video' + /users/me/subscriptions: + get: + summary: Get subscriptions of the current user + security: + - OAuth2: + - user + tags: + - User + parameters: + - $ref: '#/components/parameters/start' + - $ref: '#/components/parameters/count' + - $ref: '#/components/parameters/sort' + responses: + '200': + description: successful operation + post: + summary: Add subscription to the current user + security: + - OAuth2: + - user + tags: + - User + responses: + '200': + description: successful operation + /users/me/subscriptions/exist: + get: + summary: Get if subscriptions exist for the current user + security: + - OAuth2: + - user + tags: + - User + parameters: + - $ref: '#/components/parameters/subscriptionsUris' + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + /users/me/subscriptions/videos: + get: + summary: Get videos of subscriptions of the current user + security: + - OAuth2: + - user + tags: + - User + parameters: + - $ref: '#/components/parameters/start' + - $ref: '#/components/parameters/count' + - $ref: '#/components/parameters/sort' + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Video' + '/users/me/subscriptions/{uri}': + get: + summary: Get subscription of the current user for a given uri + security: + - OAuth2: + - user + tags: + - User + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/VideoChannel' + delete: + summary: Delete subscription of the current user for a given uri + security: + - OAuth2: + - user + tags: + - User + responses: + '200': + description: successful operation /users/register: post: summary: Register a user @@ -616,15 +714,16 @@ paths: tags: - Video parameters: - - name: category - in: query - required: false - description: category id of the video - schema: - type: number + - $ref: '#/components/parameters/categoryOneOf' + - $ref: '#/components/parameters/tagsOneOf' + - $ref: '#/components/parameters/tagsAllOf' + - $ref: '#/components/parameters/licenceOneOf' + - $ref: '#/components/parameters/languageOneOf' + - $ref: '#/components/parameters/nsfw' + - $ref: '#/components/parameters/filter' - $ref: '#/components/parameters/start' - $ref: '#/components/parameters/count' - - $ref: '#/components/parameters/sort' + - $ref: '#/components/parameters/videosSort' responses: '200': description: successful operation @@ -743,8 +842,10 @@ paths: description: Video name type: string tags: - description: Video tags - type: string + description: Video tags (maximum 5 tags each between 2 and 30 characters) + type: array + items: + type: string commentsEnabled: description: Enable or disable comments for this video type: string @@ -813,7 +914,7 @@ paths: $ref: '#/paths/~1users~1me/put/responses/204' '/videos/{id}/watching': put: - summary: Indicate progress of in watching the video by its id for a user + summary: Set watching progress of a video by its id for a user tags: - Video security: @@ -951,7 +1052,9 @@ paths: type: string tags: description: Video tags - type: string + type: array + items: + type: string commentsEnabled: description: Enable or disable comments for this video type: string @@ -986,6 +1089,83 @@ paths: channelId=$CHANNEL_ID \ name=$NAME \ "Authorization:Bearer $token" + /videos/imports: + post: + summary: Import a torrent or magnetURI or HTTP ressource (if enabled by the instance administrator) + security: + - OAuth2: [] + tags: + - Video + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/VideoUploadResponse' + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + torrentfile: + description: Torrent File + type: string + format: binary + targetUrl: + description: HTTP target URL + type: string + magnetUri: + description: Magnet URI + type: string + channelId: + description: Channel id that will contain this video + type: number + thumbnailfile: + description: Video thumbnail file + type: string + previewfile: + description: Video preview file + type: string + privacy: + $ref: '#/components/schemas/VideoPrivacy' + category: + description: Video category + type: string + licence: + description: Video licence + type: string + language: + description: Video language + type: string + description: + description: Video description + type: string + waitTranscoding: + description: Whether or not we wait transcoding before publish the video + type: string + support: + description: Text describing how to support the video uploader + type: string + nsfw: + description: Whether or not this video contains sensitive content + type: string + name: + description: Video name + type: string + tags: + description: Video tags + type: array + items: + type: string + commentsEnabled: + description: Enable or disable comments for this video + type: string + scheduleUpdate: *ref_0 + required: + - channelId + - name /videos/abuse: get: summary: Get list of reported video abuses @@ -996,7 +1176,7 @@ paths: parameters: - $ref: '#/components/parameters/start' - $ref: '#/components/parameters/count' - - $ref: '#/components/parameters/sort' + - $ref: '#/components/parameters/abusesSort' responses: '200': description: successful operation @@ -1057,7 +1237,7 @@ paths: parameters: - $ref: '#/components/parameters/start' - $ref: '#/components/parameters/count' - - $ref: '#/components/parameters/sort' + - $ref: '#/components/parameters/blacklistsSort' responses: '200': description: successful operation @@ -1096,13 +1276,13 @@ paths: $ref: '#/paths/~1users~1me/put/responses/204' requestBody: $ref: '#/components/requestBodies/VideoChannelInput' - '/video-channels/{id}': + '/video-channels/{channelHandle}': get: summary: Get a video channel by its id tags: - Video Channel parameters: - - $ref: '#/components/parameters/id3' + - $ref: '#/components/parameters/channelHandle' responses: '200': description: successful operation @@ -1117,7 +1297,7 @@ paths: tags: - Video Channel parameters: - - $ref: '#/components/parameters/id3' + - $ref: '#/components/parameters/channelHandle' responses: '204': $ref: '#/paths/~1users~1me/put/responses/204' @@ -1130,17 +1310,17 @@ paths: tags: - Video Channel parameters: - - $ref: '#/components/parameters/id3' + - $ref: '#/components/parameters/channelHandle' responses: '204': $ref: '#/paths/~1users~1me/put/responses/204' - '/video-channels/{id}/videos': + '/video-channels/{channelHandle}/videos': get: summary: Get videos of a video channel by its id tags: - Video Channel parameters: - - $ref: '#/components/parameters/id3' + - $ref: '#/components/parameters/channelHandle' responses: '200': description: successful operation @@ -1164,6 +1344,35 @@ paths: type: array items: $ref: '#/components/schemas/VideoChannel' + '/accounts/{name}/ratings': + get: + summary: Get ratings of an account by its name + security: + - OAuth2: [] + tags: + - User + parameters: + - $ref: '#/components/parameters/start' + - $ref: '#/components/parameters/count' + - $ref: '#/components/parameters/sort' + - name: rating + in: query + required: false + description: Optionaly filter which ratings to retrieve + schema: + type: string + enum: + - like + - dislike + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/VideoRating' '/videos/{id}/comment-threads': get: summary: Get the comment threads of a video by its id @@ -1265,7 +1474,7 @@ paths: parameters: - $ref: '#/components/parameters/start' - $ref: '#/components/parameters/count' - - $ref: '#/components/parameters/sort' + - $ref: '#/components/parameters/videosSearchSort' - name: search in: query required: true @@ -1311,6 +1520,74 @@ components: description: Sort column (-createdAt for example) schema: type: string + videosSort: + name: sort + in: query + required: false + description: Sort videos by criteria + schema: + type: string + enum: + - -name + - -duration + - -createdAt + - -publishedAt + - -views + - -likes + - -trending + videosSearchSort: + name: sort + in: query + required: false + description: Sort videos by criteria + schema: + type: string + enum: + - -name + - -duration + - -createdAt + - -publishedAt + - -views + - -likes + - -match + blacklistsSort: + name: sort + in: query + required: false + description: Sort blacklists by criteria + schema: + type: string + enum: + - -id + - -name + - -duration + - -views + - -likes + - -dislikes + - -uuid + - -createdAt + usersSort: + name: sort + in: query + required: false + description: Sort users by criteria + schema: + type: string + enum: + - -id + - -username + - -createdAt + abusesSort: + name: sort + in: query + required: false + description: Sort abuses by criteria + schema: + type: string + enum: + - -id + - -createdAt + - -state name: name: name in: path @@ -1334,11 +1611,11 @@ components: description: The video id or uuid schema: type: string - id3: - name: id + channelHandle: + name: channelHandle in: path required: true - description: The video channel id or uuid + description: "The video channel handle (example: 'my_username@example.com' or 'my_username')" schema: type: string commentId: @@ -1348,6 +1625,103 @@ components: description: The comment id schema: type: number + categoryOneOf: + name: categoryOneOf + in: query + required: false + description: category id of the video + schema: + oneOf: + - type: number + - type: array + items: + type: number + style: form + explode: false + tagsOneOf: + name: tagsOneOf + in: query + required: false + description: tag(s) of the video + schema: + oneOf: + - type: string + - type: array + items: + type: string + style: form + explode: false + tagsAllOf: + name: tagsAllOf + in: query + required: false + description: tag(s) of the video, where all should be present in the video + schema: + oneOf: + - type: string + - type: array + items: + type: string + style: form + explode: false + languageOneOf: + name: languageOneOf + in: query + required: false + description: language id of the video + schema: + oneOf: + - type: string + - type: array + items: + type: string + style: form + explode: false + licenceOneOf: + name: licenceOneOf + in: query + required: false + description: licence id of the video + schema: + oneOf: + - type: number + - type: array + items: + type: number + style: form + explode: false + nsfw: + name: nsfw + in: query + required: false + description: whether to include nsfw videos, if any + schema: + type: string + enum: + - 'true' + - 'false' + filter: + name: filter + in: query + required: false + description: > + Special filters (local for instance) which might require special rights: + * `local` - only videos local to the instance + * `all-local` - only videos local to the instance, but showing private and unlisted videos (requires Admin privileges) + schema: + type: string + enum: + - local + - all-local + subscriptionsUris: + name: uris + in: query + required: true + description: list of uris to check if each is part of the user subscriptions + schema: + type: array + items: + type: string requestBodies: VideoChannelInput: content: @@ -1365,7 +1739,7 @@ components: - Have an account with sufficient authorization levels - - [Generate](https://docs.joinpeertube.org/lang/en/devdocs/rest.html) a + - [Generate](https://docs.joinpeertube.org/#/api-rest-getting-started) a Bearer Token - Make Authenticated Requests @@ -1599,6 +1973,8 @@ components: - Administrator videoQuota: type: number + videoQuotaDaily: + type: number createdAt: type: string account: @@ -1734,14 +2110,23 @@ components: videoQuota: type: string description: 'The user videoQuota ' - role: + videoQuotaDaily: type: string + description: 'The user daily video quota ' + role: + type: integer + format: int32 + enum: + - 0 + - 1 + - 2 description: 'The user role ' required: - username - password - email - videoQuota + - videoQuotaDaily - role UpdateUser: properties: @@ -1754,6 +2139,9 @@ components: videoQuota: type: string description: 'The updated videoQuota of the user ' + videoQuotaDaily: + type: string + description: 'The updated daily video quota of the user ' role: type: string description: 'The updated role of the user ' @@ -1761,6 +2149,7 @@ components: - id - email - videoQuota + - videoQuotaDaily - role UpdateMe: properties: @@ -1792,6 +2181,16 @@ components: required: - id - rating + VideoRating: + properties: + video: + $ref: '#/components/schemas/Video' + rating: + type: number + description: 'Rating of the video' + required: + - video + - rating RegisterUser: properties: username: