diff options
author | Chocobozzz <me@florianbigard.com> | 2023-07-19 16:02:49 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-07-21 17:38:13 +0200 |
commit | 12dc3a942a13c7f1489822dae052da197ef15905 (patch) | |
tree | 7b87b6be692af0b62ebac17e720c80244fd8a7ec /support | |
parent | c6867725fb8e3dfbc2018a37ed5a963103587cb6 (diff) | |
download | PeerTube-12dc3a942a13c7f1489822dae052da197ef15905.tar.gz PeerTube-12dc3a942a13c7f1489822dae052da197ef15905.tar.zst PeerTube-12dc3a942a13c7f1489822dae052da197ef15905.zip |
Implement replace file in server side
Diffstat (limited to 'support')
-rw-r--r-- | support/doc/api/openapi.yaml | 276 |
1 files changed, 207 insertions, 69 deletions
diff --git a/support/doc/api/openapi.yaml b/support/doc/api/openapi.yaml index 90aaebd26..654bd7461 100644 --- a/support/doc/api/openapi.yaml +++ b/support/doc/api/openapi.yaml | |||
@@ -2641,22 +2641,6 @@ paths: | |||
2641 | example: | | 2641 | example: | |
2642 | **[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)** | 2642 | **[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)** |
2643 | 2643 | ||
2644 | '/api/v1/videos/{id}/source': | ||
2645 | post: | ||
2646 | summary: Get video source file metadata | ||
2647 | operationId: getVideoSource | ||
2648 | tags: | ||
2649 | - Video | ||
2650 | parameters: | ||
2651 | - $ref: '#/components/parameters/idOrUUID' | ||
2652 | responses: | ||
2653 | '200': | ||
2654 | description: successful operation | ||
2655 | content: | ||
2656 | application/json: | ||
2657 | schema: | ||
2658 | $ref: '#/components/schemas/VideoSource' | ||
2659 | |||
2660 | '/api/v1/videos/{id}/views': | 2644 | '/api/v1/videos/{id}/views': |
2661 | post: | 2645 | post: |
2662 | summary: Notify user is watching a video | 2646 | summary: Notify user is watching a video |
@@ -2871,21 +2855,8 @@ paths: | |||
2871 | - Video | 2855 | - Video |
2872 | - Video Upload | 2856 | - Video Upload |
2873 | parameters: | 2857 | parameters: |
2874 | - name: X-Upload-Content-Length | 2858 | - $ref: '#/components/parameters/resumableUploadInitContentLengthHeader' |
2875 | in: header | 2859 | - $ref: '#/components/parameters/resumableUploadInitContentTypeHeader' |
2876 | schema: | ||
2877 | type: number | ||
2878 | example: 2469036 | ||
2879 | required: true | ||
2880 | description: Number of bytes that will be uploaded in subsequent requests. Set this value to the size of the file you are uploading. | ||
2881 | - name: X-Upload-Content-Type | ||
2882 | in: header | ||
2883 | schema: | ||
2884 | type: string | ||
2885 | format: mimetype | ||
2886 | example: video/mp4 | ||
2887 | required: true | ||
2888 | description: MIME type of the file that you are uploading. Depending on your instance settings, acceptable values might vary. | ||
2889 | requestBody: | 2860 | requestBody: |
2890 | content: | 2861 | content: |
2891 | application/json: | 2862 | application/json: |
@@ -2924,36 +2895,9 @@ paths: | |||
2924 | - Video | 2895 | - Video |
2925 | - Video Upload | 2896 | - Video Upload |
2926 | parameters: | 2897 | parameters: |
2927 | - name: upload_id | 2898 | - $ref: '#/components/parameters/resumableUploadId' |
2928 | in: query | 2899 | - $ref: '#/components/parameters/resumableUploadChunkContentRangeHeader' |
2929 | required: true | 2900 | - $ref: '#/components/parameters/resumableUploadChunkContentLengthHeader' |
2930 | description: | | ||
2931 | Created session id to proceed with. If you didn't send chunks in the last hour, it is | ||
2932 | not valid anymore and you need to initialize a new upload. | ||
2933 | schema: | ||
2934 | type: string | ||
2935 | - name: Content-Range | ||
2936 | in: header | ||
2937 | schema: | ||
2938 | type: string | ||
2939 | example: bytes 0-262143/2469036 | ||
2940 | required: true | ||
2941 | description: | | ||
2942 | Specifies the bytes in the file that the request is uploading. | ||
2943 | |||
2944 | For example, a value of `bytes 0-262143/1000000` shows that the request is sending the first | ||
2945 | 262144 bytes (256 x 1024) in a 2,469,036 byte file. | ||
2946 | - name: Content-Length | ||
2947 | in: header | ||
2948 | schema: | ||
2949 | type: number | ||
2950 | example: 262144 | ||
2951 | required: true | ||
2952 | description: | | ||
2953 | Size of the chunk that the request is sending. | ||
2954 | |||
2955 | Remember that larger chunks are more efficient. PeerTube's web client uses chunks varying from | ||
2956 | 1048576 bytes (~1MB) and increases or reduces size depending on connection health. | ||
2957 | requestBody: | 2901 | requestBody: |
2958 | content: | 2902 | content: |
2959 | application/octet-stream: | 2903 | application/octet-stream: |
@@ -3009,14 +2953,7 @@ paths: | |||
3009 | - Video | 2953 | - Video |
3010 | - Video Upload | 2954 | - Video Upload |
3011 | parameters: | 2955 | parameters: |
3012 | - name: upload_id | 2956 | - $ref: '#/components/parameters/resumableUploadId' |
3013 | in: query | ||
3014 | required: true | ||
3015 | description: | | ||
3016 | Created session id to proceed with. If you didn't send chunks in the last 12 hours, it is | ||
3017 | not valid anymore and the upload session has already been deleted with its data ;-) | ||
3018 | schema: | ||
3019 | type: string | ||
3020 | - name: Content-Length | 2957 | - name: Content-Length |
3021 | in: header | 2958 | in: header |
3022 | required: true | 2959 | required: true |
@@ -3286,6 +3223,140 @@ paths: | |||
3286 | schema: | 3223 | schema: |
3287 | $ref: '#/components/schemas/LiveVideoSessionResponse' | 3224 | $ref: '#/components/schemas/LiveVideoSessionResponse' |
3288 | 3225 | ||
3226 | '/api/v1/videos/{id}/source': | ||
3227 | get: | ||
3228 | summary: Get video source file metadata | ||
3229 | operationId: getVideoSource | ||
3230 | tags: | ||
3231 | - Video | ||
3232 | parameters: | ||
3233 | - $ref: '#/components/parameters/idOrUUID' | ||
3234 | responses: | ||
3235 | '200': | ||
3236 | description: successful operation | ||
3237 | content: | ||
3238 | application/json: | ||
3239 | schema: | ||
3240 | $ref: '#/components/schemas/VideoSource' | ||
3241 | |||
3242 | '/api/v1/videos/{id}/source/replace-resumable': | ||
3243 | post: | ||
3244 | summary: Initialize the resumable replacement of a video | ||
3245 | description: Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to initialize the replacement of a video | ||
3246 | operationId: replaceVideoSourceResumableInit | ||
3247 | security: | ||
3248 | - OAuth2: [] | ||
3249 | tags: | ||
3250 | - Video | ||
3251 | - Video Upload | ||
3252 | parameters: | ||
3253 | - $ref: '#/components/parameters/resumableUploadInitContentLengthHeader' | ||
3254 | - $ref: '#/components/parameters/resumableUploadInitContentTypeHeader' | ||
3255 | requestBody: | ||
3256 | content: | ||
3257 | application/json: | ||
3258 | schema: | ||
3259 | $ref: '#/components/schemas/VideoReplaceSourceRequestResumable' | ||
3260 | responses: | ||
3261 | '200': | ||
3262 | description: file already exists, send a [`resume`](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) request instead | ||
3263 | '201': | ||
3264 | description: created | ||
3265 | headers: | ||
3266 | Location: | ||
3267 | schema: | ||
3268 | type: string | ||
3269 | format: url | ||
3270 | Content-Length: | ||
3271 | schema: | ||
3272 | type: number | ||
3273 | example: 0 | ||
3274 | '413': | ||
3275 | x-summary: video file too large, due to quota, absolute max file size or concurrent partial upload limit | ||
3276 | description: | | ||
3277 | Disambiguate via `type`: | ||
3278 | - `max_file_size_reached` for the absolute file size limit | ||
3279 | - `quota_reached` for quota limits whether daily or global | ||
3280 | '415': | ||
3281 | description: video type unsupported | ||
3282 | put: | ||
3283 | summary: Send chunk for the resumable replacement of a video | ||
3284 | description: Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to continue, pause or resume the replacement of a video | ||
3285 | operationId: replaceVideoSourceResumable | ||
3286 | security: | ||
3287 | - OAuth2: [] | ||
3288 | tags: | ||
3289 | - Video | ||
3290 | - Video Upload | ||
3291 | parameters: | ||
3292 | - $ref: '#/components/parameters/resumableUploadId' | ||
3293 | - $ref: '#/components/parameters/resumableUploadChunkContentRangeHeader' | ||
3294 | - $ref: '#/components/parameters/resumableUploadChunkContentLengthHeader' | ||
3295 | requestBody: | ||
3296 | content: | ||
3297 | application/octet-stream: | ||
3298 | schema: | ||
3299 | type: string | ||
3300 | format: binary | ||
3301 | responses: | ||
3302 | '204': | ||
3303 | description: 'last chunk received: successful operation' | ||
3304 | '308': | ||
3305 | description: resume incomplete | ||
3306 | headers: | ||
3307 | Range: | ||
3308 | schema: | ||
3309 | type: string | ||
3310 | example: bytes=0-262143 | ||
3311 | Content-Length: | ||
3312 | schema: | ||
3313 | type: number | ||
3314 | example: 0 | ||
3315 | '403': | ||
3316 | description: video didn't pass file replacement filter | ||
3317 | '404': | ||
3318 | description: replace upload not found | ||
3319 | '409': | ||
3320 | description: chunk doesn't match range | ||
3321 | '422': | ||
3322 | description: video unreadable | ||
3323 | '429': | ||
3324 | description: too many concurrent requests | ||
3325 | '503': | ||
3326 | description: upload is already being processed | ||
3327 | headers: | ||
3328 | 'Retry-After': | ||
3329 | schema: | ||
3330 | type: number | ||
3331 | example: 300 | ||
3332 | delete: | ||
3333 | summary: Cancel the resumable replacement of a video | ||
3334 | description: Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to cancel the replacement of a video | ||
3335 | operationId: replaceVideoSourceResumableCancel | ||
3336 | security: | ||
3337 | - OAuth2: [] | ||
3338 | tags: | ||
3339 | - Video | ||
3340 | - Video Upload | ||
3341 | parameters: | ||
3342 | - $ref: '#/components/parameters/resumableUploadId' | ||
3343 | - name: Content-Length | ||
3344 | in: header | ||
3345 | required: true | ||
3346 | schema: | ||
3347 | type: number | ||
3348 | example: 0 | ||
3349 | responses: | ||
3350 | '204': | ||
3351 | description: source file replacement cancelled | ||
3352 | headers: | ||
3353 | Content-Length: | ||
3354 | schema: | ||
3355 | type: number | ||
3356 | example: 0 | ||
3357 | '404': | ||
3358 | description: source file replacement not found | ||
3359 | |||
3289 | /api/v1/users/me/abuses: | 3360 | /api/v1/users/me/abuses: |
3290 | get: | 3361 | get: |
3291 | summary: List my abuses | 3362 | summary: List my abuses |
@@ -6640,6 +6711,58 @@ components: | |||
6640 | required: false | 6711 | required: false |
6641 | schema: | 6712 | schema: |
6642 | type: string | 6713 | type: string |
6714 | resumableUploadInitContentLengthHeader: | ||
6715 | name: X-Upload-Content-Length | ||
6716 | in: header | ||
6717 | schema: | ||
6718 | type: number | ||
6719 | example: 2469036 | ||
6720 | required: true | ||
6721 | description: Number of bytes that will be uploaded in subsequent requests. Set this value to the size of the file you are uploading. | ||
6722 | resumableUploadInitContentTypeHeader: | ||
6723 | name: X-Upload-Content-Type | ||
6724 | in: header | ||
6725 | schema: | ||
6726 | type: string | ||
6727 | format: mimetype | ||
6728 | example: video/mp4 | ||
6729 | required: true | ||
6730 | description: MIME type of the file that you are uploading. Depending on your instance settings, acceptable values might vary. | ||
6731 | resumableUploadChunkContentRangeHeader: | ||
6732 | name: Content-Range | ||
6733 | in: header | ||
6734 | schema: | ||
6735 | type: string | ||
6736 | example: bytes 0-262143/2469036 | ||
6737 | required: true | ||
6738 | description: | | ||
6739 | Specifies the bytes in the file that the request is uploading. | ||
6740 | |||
6741 | For example, a value of `bytes 0-262143/1000000` shows that the request is sending the first | ||
6742 | 262144 bytes (256 x 1024) in a 2,469,036 byte file. | ||
6743 | resumableUploadChunkContentLengthHeader: | ||
6744 | name: Content-Length | ||
6745 | in: header | ||
6746 | schema: | ||
6747 | type: number | ||
6748 | example: 262144 | ||
6749 | required: true | ||
6750 | description: | | ||
6751 | Size of the chunk that the request is sending. | ||
6752 | |||
6753 | Remember that larger chunks are more efficient. PeerTube's web client uses chunks varying from | ||
6754 | 1048576 bytes (~1MB) and increases or reduces size depending on connection health. | ||
6755 | resumableUploadId: | ||
6756 | name: upload_id | ||
6757 | in: query | ||
6758 | required: true | ||
6759 | description: | | ||
6760 | Created session id to proceed with. If you didn't send chunks in the last hour, it is | ||
6761 | not valid anymore and you need to initialize a new upload. | ||
6762 | schema: | ||
6763 | type: string | ||
6764 | |||
6765 | |||
6643 | securitySchemes: | 6766 | securitySchemes: |
6644 | OAuth2: | 6767 | OAuth2: |
6645 | description: | | 6768 | description: | |
@@ -7209,6 +7332,11 @@ components: | |||
7209 | type: boolean | 7332 | type: boolean |
7210 | downloadEnabled: | 7333 | downloadEnabled: |
7211 | type: boolean | 7334 | type: boolean |
7335 | inputFileUpdatedAt: | ||
7336 | type: string | ||
7337 | format: date-time | ||
7338 | nullable: true | ||
7339 | description: Latest input file update. Null if the file has never been replaced since the original upload | ||
7212 | trackerUrls: | 7340 | trackerUrls: |
7213 | type: array | 7341 | type: array |
7214 | items: | 7342 | items: |
@@ -7554,6 +7682,9 @@ components: | |||
7554 | properties: | 7682 | properties: |
7555 | filename: | 7683 | filename: |
7556 | type: string | 7684 | type: string |
7685 | createdAt: | ||
7686 | type: string | ||
7687 | format: date-time | ||
7557 | ActorImage: | 7688 | ActorImage: |
7558 | properties: | 7689 | properties: |
7559 | path: | 7690 | path: |
@@ -8403,6 +8534,13 @@ components: | |||
8403 | $ref: '#/components/schemas/Video/properties/uuid' | 8534 | $ref: '#/components/schemas/Video/properties/uuid' |
8404 | shortUUID: | 8535 | shortUUID: |
8405 | $ref: '#/components/schemas/Video/properties/shortUUID' | 8536 | $ref: '#/components/schemas/Video/properties/shortUUID' |
8537 | VideoReplaceSourceRequestResumable: | ||
8538 | properties: | ||
8539 | filename: | ||
8540 | description: Video filename including extension | ||
8541 | type: string | ||
8542 | format: filename | ||
8543 | example: what_is_peertube.mp4 | ||
8406 | CommentThreadResponse: | 8544 | CommentThreadResponse: |
8407 | properties: | 8545 | properties: |
8408 | total: | 8546 | total: |