X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=support%2Fdoc%2Fapi%2Fopenapi.yaml;h=86dfae69d84631dd5fbef0828c1ff6857672e962;hb=61b66b361f3e5f6d507188517461c2791d0600e5;hp=e6d2f51d823f9be855c51a892fc9e1fe84dec880;hpb=9ee83eb99e908c6038cbb6501bacfe18d092f0b6;p=github%2FChocobozzz%2FPeerTube.git diff --git a/support/doc/api/openapi.yaml b/support/doc/api/openapi.yaml index e6d2f51d8..86dfae69d 100644 --- a/support/doc/api/openapi.yaml +++ b/support/doc/api/openapi.yaml @@ -1,8 +1,12 @@ swagger: '2.0' info: - title: peertube - version: 0.0.13-alpha + title: PeerTube + version: 1.0.0-beta description: Federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser with WebTorrent and Angular. +host: peertube.example.com +basePath: '/api/v1' +schemes: + - https paths: '/accounts/{id}': get: @@ -18,6 +22,21 @@ paths: required: true type: string description: 'The id of the account' + - name: start + in: query + required: false + type: number + description: 'starting page' + - name: stop + in: query + required: false + type: number + description: 'stopping page' + - name: sort + in: query + required: false + type: number + description: 'sorting' responses: '200': description: successful operation @@ -50,7 +69,7 @@ paths: '200': description: successful operation schema: - $ref: '#/definitions/ServerConfig' + $ref: '#/definitions/ServerConfig' /jobs: get: tags: @@ -59,13 +78,34 @@ paths: - application/json produces: - application/json + parameters: + - name: state + in: path + required: true + type: string + description: 'The id of the account' + - name: start + in: query + required: false + type: number + description: 'starting page' + - name: count + in: query + required: false + type: number + description: '' + - name: sort + in: query + required: false + type: number + description: 'sorting' responses: '200': description: successful operation schema: type: array items: - $ref: '#/definitions/Job' + $ref: '#/definitions/Job' '/server/following/{host}': delete: tags: @@ -91,6 +131,22 @@ paths: - application/json produces: - application/json + parameters: + - name: start + in: query + required: false + type: number + description: 'starting page' + - name: stop + in: query + required: false + type: number + description: 'stopping page' + - name: sort + in: query + required: false + type: number + description: 'sorting' responses: '200': description: successful operation @@ -106,6 +162,22 @@ paths: - application/json produces: - application/json + parameters: + - name: start + in: query + required: false + type: number + description: 'starting page' + - name: stop + in: query + required: false + type: number + description: 'stopping page' + - name: sort + in: query + required: false + type: number + description: 'sorting' responses: '200': description: successful operation @@ -140,6 +212,7 @@ paths: - in: body name: body required: true + description: 'User to create' schema: $ref: '#/definitions/AddUser' responses: @@ -154,6 +227,22 @@ paths: - application/json produces: - application/json + parameters: + - name: start + in: query + required: false + type: number + description: 'starting page' + - name: stop + in: query + required: false + type: number + description: 'stopping page' + - name: sort + in: query + required: false + type: number + description: 'sorting' responses: '200': description: successful operation @@ -289,6 +378,22 @@ paths: - application/json produces: - application/json + parameters: + - name: start + in: query + required: false + type: number + description: 'starting page' + - name: stop + in: query + required: false + type: number + description: 'stopping page' + - name: sort + in: query + required: false + type: number + description: 'sorting' responses: '200': description: successful operation @@ -331,7 +436,7 @@ paths: description: successful operation schema: $ref: '#/definitions/Avatar' - /video: + /videos: get: tags: - Video @@ -339,6 +444,22 @@ paths: - application/json produces: - application/json + parameters: + - name: start + in: query + required: false + type: number + description: 'starting page' + - name: stop + in: query + required: false + type: number + description: 'stopping page' + - name: sort + in: query + required: false + type: number + description: 'sorting' responses: '200': description: successful operation @@ -346,7 +467,7 @@ paths: type: array items: $ref: '#/definitions/Video' - /video/categories: + /videos/categories: get: tags: - Video @@ -361,7 +482,7 @@ paths: type: array items: type: string - /video/licences: + /videos/licences: get: tags: - Video @@ -376,7 +497,7 @@ paths: type: array items: type: string - /video/languages: + /videos/languages: get: tags: - Video @@ -391,7 +512,7 @@ paths: type: array items: type: string - /video/privacies: + /videos/privacies: get: tags: - Video @@ -406,7 +527,7 @@ paths: type: array items: type: string - /video/search: + /videos/search: get: tags: - Video @@ -414,6 +535,22 @@ paths: - application/json produces: - application/json + parameters: + - name: start + in: query + required: false + type: number + description: 'starting page' + - name: stop + in: query + required: false + type: number + description: 'stopping page' + - name: sort + in: query + required: false + type: number + description: 'sorting' responses: '200': description: successful operation @@ -421,12 +558,12 @@ paths: type: array items: $ref: '#/definitions/Video' - "/video/{id}": + "/videos/{id}": put: tags: - Video consumes: - - application/json + - multipart/form-data produces: - application/json parameters: @@ -434,7 +571,56 @@ paths: in: path required: true type: string - description: 'The video id ' + description: 'The video id' + - name: thumbnailfile + in: formData + type: file + description: 'Video thumbnail file' + - name: previewfile + in: formData + type: file + description: 'Video preview file' + - name: category + in: formData + type: number + description: 'Video category' + - name: licence + in: formData + type: number + description: 'Video licence' + - name: language + in: formData + type: number + description: 'Video language' + - name: description + in: formData + type: string + description: 'Video description' + - name: support + in: formData + type: string + description: 'Text describing how to support the video uploader' + - name: nsfw + in: formData + type: boolean + description: 'Whether or not this video contains sensitive content' + - name: name + in: formData + type: string + description: 'Video name' + - name: tags + in: formData + type: string[] + description: 'Video tags' + - name: commentsEnabled + in: formData + type: boolean + description: 'Enable or disable comments for this video' + - name: privacy + in: formData + type: string + enum: [Public, Unlisted, Private] + description: 'Video privacy' responses: '200': description: successful operation @@ -474,7 +660,7 @@ paths: responses: '204': description: successful operation - "/video/{id}/description": + "/videos/{id}/description": get: tags: - Video @@ -493,7 +679,7 @@ paths: description: successful operation schema: type: string - "/video/{id}/views": + "/videos/{id}/views": post: tags: - Video @@ -510,7 +696,7 @@ paths: responses: '204': description: successful operation - /video/upload: + /videos/upload: post: tags: - Video @@ -519,16 +705,76 @@ paths: produces: - application/json parameters: - - in: formData - name: videofile + - name: videofile + in: formData type: file - description: The file to upload. + required: true + description: 'Video file' + - name: thumbnailfile + in: formData + type: file + required: true + description: 'Video thumbnail file' + - name: previewfile + in: formData + type: file + required: true + description: 'Video preview file' + - name: category + in: formData + type: number + description: 'Video category' + - name: licence + in: formData + type: number + description: 'Video licence' + - name: language + in: formData + type: number + description: 'Video language' + - name: description + in: formData + type: string + description: 'Video description' + - name: support + in: formData + type: string + description: 'Text describing how to support the video uploader' + - name: channelId + in: formData + required: true + type: number + description: 'Channel id that will contain this video' + - name: nsfw + in: formData + required: true + type: boolean + description: 'Whether or not this video contains sensitive content' + - name: name + in: formData + required: true + type: string + description: 'Video name' + - name: tags + in: formData + type: string[] + description: 'Video tags' + - name: commentsEnabled + in: formData + type: boolean + description: 'Enable or disable comments for this video' + - name: privacy + in: formData + required: true + type: string + enum: [Public, Unlisted, Private] + description: 'Video privacy' responses: '200': description: successful operation schema: $ref: '#/definitions/VideoUploadResponse' - /video/abuse: + /videos/abuse: get: tags: - VideoAbuse @@ -536,6 +782,22 @@ paths: - application/json produces: - application/json + parameters: + - name: start + in: query + required: false + type: number + description: 'starting page' + - name: stop + in: query + required: false + type: number + description: 'stopping page' + - name: sort + in: query + required: false + type: number + description: 'sorting' responses: '200': description: successful operation @@ -543,7 +805,7 @@ paths: type: array items: $ref: '#/definitions/VideoAbuse' - "/video/{id}/abuse": + "/videos/{id}/abuse": post: tags: - VideoAbuse @@ -560,7 +822,7 @@ paths: responses: '204': description: successful operation - "/video/{videoId}/blacklist": + "/videos/{videoId}/blacklist": post: tags: - VideoBlacklist @@ -593,7 +855,7 @@ paths: responses: '204': description: successful operation - /video/blacklist: + /videos/blacklist: get: tags: - VideoBlacklist @@ -601,6 +863,22 @@ paths: - application/json produces: - application/json + parameters: + - name: start + in: query + required: false + type: number + description: 'starting page' + - name: stop + in: query + required: false + type: number + description: 'stopping page' + - name: sort + in: query + required: false + type: number + description: 'sorting' responses: '200': description: successful operation @@ -608,7 +886,7 @@ paths: type: array items: $ref: '#/definitions/VideoBlacklist' - /video/channels: + /videos/channels: get: tags: - VideoChannel @@ -616,6 +894,22 @@ paths: - application/json produces: - application/json + parameters: + - name: start + in: query + required: false + type: number + description: 'starting page' + - name: stop + in: query + required: false + type: number + description: 'stopping page' + - name: sort + in: query + required: false + type: number + description: 'sorting' responses: '200': description: successful operation @@ -638,7 +932,7 @@ paths: responses: '204': description: successful operation - "/video/channels/{id}": + "/videos/channels/{id}": get: tags: - VideoChannel @@ -693,7 +987,7 @@ paths: responses: '204': description: successful operation - /video/accounts/{accountId}/channels: + /videos/accounts/{accountId}/channels: get: tags: - VideoChannel @@ -714,7 +1008,7 @@ paths: type: array items: $ref: '#/definitions/VideoChannel' - "/video/{videoId}/comment-threads": + "/videos/{videoId}/comment-threads": get: tags: - VideoComment @@ -728,9 +1022,26 @@ paths: required: true type: string description: 'The video id ' + - name: start + in: query + required: false + type: number + description: 'starting page' + - name: stop + in: query + required: false + type: number + description: 'stopping page' + - name: sort + in: query + required: false + type: number + description: 'sorting' responses: '200': description: successful operation + schema: + $ref: '#/definitions/CommentThreadResponse' post: tags: - VideoComment @@ -747,7 +1058,9 @@ paths: responses: '200': description: successful operation - "/video/{videoId}/comment-threads/{threadId}": + schema: + $ref: '#/definitions/CommentThreadPostResponse' + "/videos/{videoId}/comment-threads/{threadId}": get: tags: - VideoComment @@ -769,7 +1082,9 @@ paths: responses: '200': description: successful operation - "/video/{videoId}/comments/{commentId}": + schema: + $ref: '#/definitions/VideoCommentThreadTree' + "/videos/{videoId}/comments/{commentId}": post: tags: - VideoComment @@ -791,6 +1106,8 @@ paths: responses: '200': description: successful operation + schema: + $ref: '#/definitions/CommentThreadPostResponse' delete: tags: - VideoComment @@ -812,7 +1129,7 @@ paths: responses: '204': description: successful operation - "/video/{id}/rate": + "/videos/{id}/rate": put: tags: - VideoRate @@ -830,30 +1147,35 @@ paths: '204': description: successful operation definitions: + VideoConstant: + properties: + id: + type: number + label: + type: string + VideoPrivacy: + type: string + enum: [Public, Unlisted, Private] Video: properties: id: type: number uuid: type: string - accountName: - type: string createdAt: type: string - updatedAt: + publishedAt: type: string - categoryLabel: + updatedAt: type: string category: - type: number - licenceLabel: - type: string + $ref: "#/definitions/VideoConstant" licence: - type: number - languageLabel: - type: string + $ref: "#/definitions/VideoConstant" language: - type: number + $ref: "#/definitions/VideoConstant" + privacy: + $ref: "#/definitions/VideoPrivacy" description: type: string duration: @@ -862,8 +1184,6 @@ definitions: type: boolean name: type: string - serverHost: - type: string thumbnailPath: type: string previewPath: @@ -878,22 +1198,38 @@ definitions: type: number nsfw: type: boolean + account: + type: object + properties: + name: + type: string + displayName: + type: string + url: + type: string + host: + type: string + avatar: + $ref: "#/definitions/Avatar" VideoAbuse: properties: id: type: number reason: type: string - reporterUsername: - type: string - reporterServerHost: - type: string - videoId: - type: number - videoUUID: - type: string - videoName: - type: string + reporterAccount: + $ref: "#/definitions/Account" + video: + type: object + properties: + id: + type: number + name: + type: string + uuid: + type: string + url: + type: string createdAt: type: string VideoBlacklist: @@ -932,14 +1268,14 @@ definitions: type: boolean owner: type: object - properties: - name: + properties: + name: type: string - uuid: + uuid: type: string videos: type: array - items: + items: $ref: "#/definitions/Video" VideoComment: properties: @@ -963,6 +1299,14 @@ definitions: type: number account: $ref: "#/definitions/Account" + VideoCommentThreadTree: + properties: + comment: + $ref: "#/definitions/VideoComment" + children: + type: array + items: + $ref: "#/definitions/VideoCommentThreadTree" Avatar: properties: path: @@ -1013,7 +1357,7 @@ definitions: type: boolean role: type: string - enum: [User, Moderator, Administrator] + enum: [User, Moderator, Administrator] videoQuota: type: number createdAt: @@ -1026,7 +1370,7 @@ definitions: $ref: "#/definitions/VideoChannel" ServerConfig: properties: - signup: + signup: type: object properties: allowed: @@ -1049,7 +1393,7 @@ definitions: properties: max: type: number - extensions: + extensions: type: array items: type: string @@ -1058,8 +1402,8 @@ definitions: properties: file: type: object - properties: - extensions: + properties: + extensions: type: array items: type: string @@ -1099,7 +1443,7 @@ definitions: updatedAt: type: string -#Api responses +# Api responses AddUserResponse: properties: id: @@ -1108,12 +1452,27 @@ definitions: type: string VideoUploadResponse: properties: - id: + video: + type: object + properties: + id: + type: number + uuid: + type: string + CommentThreadResponse: + properties: + total: type: number - uuid: - type: string + data: + type: array + items: + $ref: "#/definitions/VideoComment" + CommentThreadPostResponse: + properties: + comment: + $ref: "#/definitions/VideoComment" -#input bodies +# Request bodies AddUser: properties: username: