1
0
Fork 0

Add user import/export in openapi

This commit is contained in:
Chocobozzz 2024-02-12 10:50:02 +01:00 committed by Chocobozzz
parent f6af3f701c
commit b18127d91b
1 changed files with 285 additions and 0 deletions

View File

@ -172,6 +172,12 @@ tags:
Using some features of PeerTube require authentication, for which User Using some features of PeerTube require authentication, for which User
provide different levels of permission as well as associated user provide different levels of permission as well as associated user
information. Each user has a corresponding local Account for federation. information. Each user has a corresponding local Account for federation.
- name: User Exports
description: >
To create an archive of user data.
- name: User Imports
description: >
To import an archive of user data.
- name: My User - name: My User
description: > description: >
Operations related to your own User, when logged-in. Operations related to your own User, when logged-in.
@ -320,6 +326,8 @@ x-tagGroups:
tags: tags:
- Accounts - Accounts
- Users - Users
- User Exports
- User Imports
- My User - My User
- My Subscriptions - My Subscriptions
- My Notifications - My Notifications
@ -1615,6 +1623,8 @@ paths:
summary: Request two factor auth summary: Request two factor auth
operationId: requestTwoFactor operationId: requestTwoFactor
description: Request two factor authentication for a user description: Request two factor authentication for a user
security:
- OAuth2: []
tags: tags:
- Users - Users
parameters: parameters:
@ -1647,6 +1657,8 @@ paths:
summary: Confirm two factor auth summary: Confirm two factor auth
operationId: confirmTwoFactorRequest operationId: confirmTwoFactorRequest
description: Confirm a two factor authentication request description: Confirm a two factor authentication request
security:
- OAuth2: []
tags: tags:
- Users - Users
parameters: parameters:
@ -1679,6 +1691,8 @@ paths:
summary: Disable two factor auth summary: Disable two factor auth
operationId: disableTwoFactor operationId: disableTwoFactor
description: Disable two factor authentication of a user description: Disable two factor authentication of a user
security:
- OAuth2: []
tags: tags:
- Users - Users
parameters: parameters:
@ -1700,6 +1714,214 @@ paths:
'404': '404':
description: user not found description: user not found
/api/v1/users/{userId}/imports/import-resumable:
post:
summary: Initialize the resumable user import
description: "**PeerTube >= 6.1** Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to initialize the import of the archive"
operationId: userImportResumableInit
security:
- OAuth2: []
tags:
- User Imports
parameters:
- $ref: '#/components/parameters/resumableUploadInitContentLengthHeader'
- $ref: '#/components/parameters/resumableUploadInitContentTypeHeader'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UserImportResumable'
responses:
'201':
description: created
headers:
Location:
schema:
type: string
format: url
Content-Length:
schema:
type: number
example: 0
put:
summary: Send chunk for the resumable user import
description: "**PeerTube >= 6.1** Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to continue, pause or resume the import of the archive"
operationId: userImportResumable
security:
- OAuth2: []
tags:
- User Imports
parameters:
- $ref: '#/components/parameters/resumableUploadId'
- $ref: '#/components/parameters/resumableUploadChunkContentRangeHeader'
- $ref: '#/components/parameters/resumableUploadChunkContentLengthHeader'
requestBody:
content:
application/octet-stream:
schema:
type: string
format: binary
responses:
'204':
description: 'last chunk received: successful operation'
'308':
description: resume incomplete
headers:
Range:
schema:
type: string
example: bytes=0-262143
Content-Length:
schema:
type: number
example: 0
delete:
summary: Cancel the resumable user import
description: "**PeerTube >= 6.1** Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to cancel the resumable user import"
operationId: userImportResumableCancel
security:
- OAuth2: []
tags:
- User Imports
parameters:
- $ref: '#/components/parameters/resumableUploadId'
- name: Content-Length
in: header
required: true
schema:
type: number
example: 0
responses:
'204':
description: import cancelled
headers:
Content-Length:
schema:
type: number
example: 0
/api/v1/users/{userId}/imports/latest:
get:
summary: Get latest user import
description: "**PeerTube >= 6.1**"
operationId: getLatestUserImport
security:
- OAuth2: []
tags:
- User Imports
parameters:
- $ref: '#/components/parameters/userId'
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
properties:
id:
type: integer
state:
type: object
properties:
id:
$ref: '#/components/schemas/UserImportState'
label:
type: string
createdAt:
type: string
format: date-time
/api/v1/users/{userId}/exports/request:
post:
summary: Request user export
operationId: requestUserExport
description: Request an archive of user data. An email is sent when the archive is ready.
security:
- OAuth2: []
tags:
- User Exports
parameters:
- $ref: '#/components/parameters/userId'
requestBody:
content:
application/json:
schema:
type: object
properties:
withVideoFiles:
type: boolean
description: Whether to include video files in the archive
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
properties:
export:
type: object
properties:
id:
type: integer
/api/v1/users/{userId}/exports:
get:
summary: List user exports
description: "**PeerTube >= 6.1**"
operationId: listUserExports
security:
- OAuth2: []
tags:
- User Exports
parameters:
- $ref: '#/components/parameters/userId'
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
properties:
id:
type: integer
state:
type: object
properties:
id:
$ref: '#/components/schemas/UserExportState'
label:
type: string
size:
type: integer
description: Size of the archive file in bytes
privateDownloadUrl:
type: string
description: This URL already contains the JWT token, so no additional authentication credentials are required
createdAt:
type: string
format: date-time
expiresOn:
type: string
format: date-time
/api/v1/users/{userId}/exports/{id}:
delete:
summary: Delete a user export
description: "**PeerTube >= 6.1**"
operationId: deleteUserExport
security:
- OAuth2: []
tags:
- User Exports
parameters:
- $ref: '#/components/parameters/userId'
- $ref: '#/components/parameters/id'
responses:
'204':
description: successful operation
/api/v1/users/me: /api/v1/users/me:
get: get:
summary: Get my user information summary: Get my user information
@ -6486,6 +6708,13 @@ components:
description: Entity id description: Entity id
schema: schema:
$ref: '#/components/schemas/id' $ref: '#/components/schemas/id'
userId:
name: userId
in: path
required: true
description: User id
schema:
$ref: '#/components/schemas/id'
registrationId: registrationId:
name: registrationId name: registrationId
in: path in: path
@ -7130,6 +7359,34 @@ components:
label: label:
type: string type: string
UserExportState:
type: integer
enum:
- 1
- 2
- 3
- 4
description: |
The user export state:
- `1`: Pending
- `2`: Processing
- `3`: Completed
- `4`: Errored
UserImportState:
type: integer
enum:
- 1
- 2
- 3
- 4
description: |
The user import state:
- `1`: Pending
- `2`: Processing
- `3`: Completed
- `4`: Errored
AbuseStateSet: AbuseStateSet:
type: integer type: integer
enum: enum:
@ -8079,6 +8336,25 @@ components:
properties: properties:
enabled: enabled:
type: boolean type: boolean
users:
type: object
properties:
enabled:
type: boolean
export:
type: object
properties:
users:
type: object
properties:
enabled:
type: boolean
exportExpiration:
type: number
description: In milliseconds
maxUserVideoQuota:
type: number
description: In bytes
autoBlacklist: autoBlacklist:
type: object type: object
properties: properties:
@ -8147,9 +8423,11 @@ components:
properties: properties:
videoQuota: videoQuota:
type: integer type: integer
description: In bytes
example: 16810141515 example: 16810141515
videoQuotaDaily: videoQuotaDaily:
type: integer type: integer
description: In bytes
example: 1681014151 example: 1681014151
trending: trending:
type: object type: object
@ -8721,6 +8999,13 @@ components:
type: string type: string
format: filename format: filename
example: what_is_peertube.mp4 example: what_is_peertube.mp4
UserImportResumable:
properties:
filename:
description: Archive filename including extension
type: string
format: filename
example: "user-export-6-2024-02-09T10_12_11.682Z"
CommentThreadResponse: CommentThreadResponse:
properties: properties:
total: total: