diff options
author | Chocobozzz <me@florianbigard.com> | 2023-01-19 09:27:56 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2023-01-19 13:53:40 +0100 |
commit | 3e5716dd3a5b0db4a1db327714247da687419f92 (patch) | |
tree | 6ae34a141fdebbfc01ca82c5ded9de18c0456b84 /support/doc | |
parent | e364e31e25bd1d4b8d801c845a96d6be708f0a18 (diff) | |
download | PeerTube-3e5716dd3a5b0db4a1db327714247da687419f92.tar.gz PeerTube-3e5716dd3a5b0db4a1db327714247da687419f92.tar.zst PeerTube-3e5716dd3a5b0db4a1db327714247da687419f92.zip |
Add signup approval API REST doc
Diffstat (limited to 'support/doc')
-rw-r--r-- | support/doc/api/openapi.yaml | 294 |
1 files changed, 276 insertions, 18 deletions
diff --git a/support/doc/api/openapi.yaml b/support/doc/api/openapi.yaml index bfa7235a2..61cd6a651 100644 --- a/support/doc/api/openapi.yaml +++ b/support/doc/api/openapi.yaml | |||
@@ -1,7 +1,7 @@ | |||
1 | openapi: 3.0.0 | 1 | openapi: 3.0.0 |
2 | info: | 2 | info: |
3 | title: PeerTube | 3 | title: PeerTube |
4 | version: 4.0.0 | 4 | version: 5.1.0 |
5 | contact: | 5 | contact: |
6 | name: PeerTube Community | 6 | name: PeerTube Community |
7 | url: https://joinpeertube.org | 7 | url: https://joinpeertube.org |
@@ -1401,22 +1401,44 @@ paths: | |||
1401 | '200': | 1401 | '200': |
1402 | description: successful operation | 1402 | description: successful operation |
1403 | 1403 | ||
1404 | /api/v1/users/register: | 1404 | /api/v1/users/ask-send-verify-email: |
1405 | post: | 1405 | post: |
1406 | summary: Register a user | 1406 | summary: Resend user verification link |
1407 | operationId: registerUser | 1407 | operationId: resendEmailToVerifyUser |
1408 | tags: | 1408 | tags: |
1409 | - Users | 1409 | - Users |
1410 | - Register | 1410 | - Register |
1411 | requestBody: | ||
1412 | content: | ||
1413 | application/json: | ||
1414 | schema: | ||
1415 | type: object | ||
1416 | properties: | ||
1417 | email: | ||
1418 | type: string | ||
1419 | description: User email | ||
1411 | responses: | 1420 | responses: |
1412 | '204': | 1421 | '204': |
1413 | description: successful operation | 1422 | description: successful operation |
1423 | |||
1424 | /api/v1/users/registrations/ask-send-verify-email: | ||
1425 | post: | ||
1426 | summary: Resend verification link to registration email | ||
1427 | operationId: resendEmailToVerifyRegistration | ||
1428 | tags: | ||
1429 | - Register | ||
1414 | requestBody: | 1430 | requestBody: |
1415 | content: | 1431 | content: |
1416 | application/json: | 1432 | application/json: |
1417 | schema: | 1433 | schema: |
1418 | $ref: '#/components/schemas/RegisterUser' | 1434 | type: object |
1419 | required: true | 1435 | properties: |
1436 | email: | ||
1437 | type: string | ||
1438 | description: Registration email | ||
1439 | responses: | ||
1440 | '204': | ||
1441 | description: successful operation | ||
1420 | 1442 | ||
1421 | /api/v1/users/{id}/verify-email: | 1443 | /api/v1/users/{id}/verify-email: |
1422 | post: | 1444 | post: |
@@ -1425,6 +1447,7 @@ paths: | |||
1425 | description: | | 1447 | description: | |
1426 | Following a user registration, the new user will receive an email asking to click a link | 1448 | Following a user registration, the new user will receive an email asking to click a link |
1427 | containing a secret. | 1449 | containing a secret. |
1450 | This endpoint can also be used to verify a new email set in the user account. | ||
1428 | tags: | 1451 | tags: |
1429 | - Users | 1452 | - Users |
1430 | - Register | 1453 | - Register |
@@ -1451,6 +1474,36 @@ paths: | |||
1451 | '404': | 1474 | '404': |
1452 | description: user not found | 1475 | description: user not found |
1453 | 1476 | ||
1477 | /api/v1/users/registrations/{registrationId}/verify-email: | ||
1478 | post: | ||
1479 | summary: Verify a registration email | ||
1480 | operationId: verifyRegistrationEmail | ||
1481 | description: | | ||
1482 | Following a user registration request, the user will receive an email asking to click a link | ||
1483 | containing a secret. | ||
1484 | tags: | ||
1485 | - Register | ||
1486 | parameters: | ||
1487 | - $ref: '#/components/parameters/registrationId' | ||
1488 | requestBody: | ||
1489 | content: | ||
1490 | application/json: | ||
1491 | schema: | ||
1492 | type: object | ||
1493 | properties: | ||
1494 | verificationString: | ||
1495 | type: string | ||
1496 | format: url | ||
1497 | required: | ||
1498 | - verificationString | ||
1499 | responses: | ||
1500 | '204': | ||
1501 | description: successful operation | ||
1502 | '403': | ||
1503 | description: invalid verification string | ||
1504 | '404': | ||
1505 | description: registration not found | ||
1506 | |||
1454 | /api/v1/users/{id}/two-factor/request: | 1507 | /api/v1/users/{id}/two-factor/request: |
1455 | post: | 1508 | post: |
1456 | summary: Request two factor auth | 1509 | summary: Request two factor auth |
@@ -1541,18 +1594,6 @@ paths: | |||
1541 | '404': | 1594 | '404': |
1542 | description: user not found | 1595 | description: user not found |
1543 | 1596 | ||
1544 | |||
1545 | /api/v1/users/ask-send-verify-email: | ||
1546 | post: | ||
1547 | summary: Resend user verification link | ||
1548 | operationId: resendEmailToVerifyUser | ||
1549 | tags: | ||
1550 | - Users | ||
1551 | - Register | ||
1552 | responses: | ||
1553 | '204': | ||
1554 | description: successful operation | ||
1555 | |||
1556 | /api/v1/users/me: | 1597 | /api/v1/users/me: |
1557 | get: | 1598 | get: |
1558 | summary: Get my user information | 1599 | summary: Get my user information |
@@ -2037,6 +2078,146 @@ paths: | |||
2037 | '204': | 2078 | '204': |
2038 | description: successful operation | 2079 | description: successful operation |
2039 | 2080 | ||
2081 | /api/v1/users/register: | ||
2082 | post: | ||
2083 | summary: Register a user | ||
2084 | operationId: registerUser | ||
2085 | description: Signup has to be enabled and signup approval is not required | ||
2086 | tags: | ||
2087 | - Register | ||
2088 | responses: | ||
2089 | '204': | ||
2090 | description: successful operation | ||
2091 | '400': | ||
2092 | description: request error | ||
2093 | '403': | ||
2094 | description: user registration is not enabled, user limit is reached, registration is not allowed for the ip, requires approval or blocked by a plugin | ||
2095 | '409': | ||
2096 | description: 'a user with this username, channel name or email already exists' | ||
2097 | requestBody: | ||
2098 | content: | ||
2099 | application/json: | ||
2100 | schema: | ||
2101 | $ref: '#/components/schemas/RegisterUser' | ||
2102 | required: true | ||
2103 | |||
2104 | /api/v1/users/registrations/request: | ||
2105 | post: | ||
2106 | summary: Request registration | ||
2107 | description: Signup has to be enabled and require approval on the instance | ||
2108 | operationId: requestRegistration | ||
2109 | tags: | ||
2110 | - Register | ||
2111 | responses: | ||
2112 | '200': | ||
2113 | description: successful operation | ||
2114 | content: | ||
2115 | application/json: | ||
2116 | schema: | ||
2117 | $ref: '#/components/schemas/UserRegistration' | ||
2118 | '400': | ||
2119 | description: request error or signup approval is not enabled on the instance | ||
2120 | '403': | ||
2121 | description: user registration is not enabled, user limit is reached, registration is not allowed for the ip or blocked by a plugin | ||
2122 | '409': | ||
2123 | description: 'a user or registration with this username, channel name or email already exists' | ||
2124 | requestBody: | ||
2125 | content: | ||
2126 | application/json: | ||
2127 | schema: | ||
2128 | $ref: '#/components/schemas/UserRegistrationRequest' | ||
2129 | |||
2130 | /api/v1/users/registrations/{registrationId}/accept: | ||
2131 | post: | ||
2132 | security: | ||
2133 | - OAuth2: | ||
2134 | - admin | ||
2135 | - moderator | ||
2136 | summary: Accept registration | ||
2137 | operationId: acceptRegistration | ||
2138 | tags: | ||
2139 | - Register | ||
2140 | parameters: | ||
2141 | - $ref: '#/components/parameters/registrationId' | ||
2142 | requestBody: | ||
2143 | content: | ||
2144 | application/json: | ||
2145 | schema: | ||
2146 | $ref: '#/components/schemas/UserRegistrationAcceptOrReject' | ||
2147 | responses: | ||
2148 | '204': | ||
2149 | description: successful operation | ||
2150 | |||
2151 | /api/v1/users/registrations/{registrationId}/reject: | ||
2152 | post: | ||
2153 | security: | ||
2154 | - OAuth2: | ||
2155 | - admin | ||
2156 | - moderator | ||
2157 | summary: Reject registration | ||
2158 | operationId: rejectRegistration | ||
2159 | tags: | ||
2160 | - Register | ||
2161 | parameters: | ||
2162 | - $ref: '#/components/parameters/registrationId' | ||
2163 | requestBody: | ||
2164 | content: | ||
2165 | application/json: | ||
2166 | schema: | ||
2167 | $ref: '#/components/schemas/UserRegistrationAcceptOrReject' | ||
2168 | responses: | ||
2169 | '204': | ||
2170 | description: successful operation | ||
2171 | |||
2172 | /api/v1/users/registrations/{registrationId}: | ||
2173 | delete: | ||
2174 | security: | ||
2175 | - OAuth2: | ||
2176 | - admin | ||
2177 | - moderator | ||
2178 | summary: Delete registration | ||
2179 | description: 'Delete the registration entry. It will not remove the user associated with this registration (if any)' | ||
2180 | operationId: deleteRegistration | ||
2181 | tags: | ||
2182 | - Register | ||
2183 | parameters: | ||
2184 | - $ref: '#/components/parameters/registrationId' | ||
2185 | responses: | ||
2186 | '204': | ||
2187 | description: successful operation | ||
2188 | |||
2189 | /api/v1/users/registrations: | ||
2190 | get: | ||
2191 | security: | ||
2192 | - OAuth2: | ||
2193 | - admin | ||
2194 | - moderator | ||
2195 | summary: List registrations | ||
2196 | operationId: listRegistrations | ||
2197 | tags: | ||
2198 | - Register | ||
2199 | parameters: | ||
2200 | - $ref: '#/components/parameters/start' | ||
2201 | - $ref: '#/components/parameters/count' | ||
2202 | - name: search | ||
2203 | in: query | ||
2204 | required: false | ||
2205 | schema: | ||
2206 | type: string | ||
2207 | - name: sort | ||
2208 | in: query | ||
2209 | required: false | ||
2210 | schema: | ||
2211 | type: string | ||
2212 | enum: | ||
2213 | - -createdAt | ||
2214 | - createdAt | ||
2215 | - state | ||
2216 | - -state | ||
2217 | responses: | ||
2218 | '204': | ||
2219 | description: successful operation | ||
2220 | |||
2040 | /api/v1/videos/ownership: | 2221 | /api/v1/videos/ownership: |
2041 | get: | 2222 | get: |
2042 | summary: List video ownership changes | 2223 | summary: List video ownership changes |
@@ -5389,6 +5570,7 @@ components: | |||
5389 | type: string | 5570 | type: string |
5390 | enum: | 5571 | enum: |
5391 | - createdAt | 5572 | - createdAt |
5573 | |||
5392 | name: | 5574 | name: |
5393 | name: name | 5575 | name: name |
5394 | in: path | 5576 | in: path |
@@ -5404,6 +5586,13 @@ components: | |||
5404 | description: Entity id | 5586 | description: Entity id |
5405 | schema: | 5587 | schema: |
5406 | $ref: '#/components/schemas/id' | 5588 | $ref: '#/components/schemas/id' |
5589 | registrationId: | ||
5590 | name: registrationId | ||
5591 | in: path | ||
5592 | required: true | ||
5593 | description: Registration ID | ||
5594 | schema: | ||
5595 | $ref: '#/components/schemas/id' | ||
5407 | idOrUUID: | 5596 | idOrUUID: |
5408 | name: id | 5597 | name: id |
5409 | in: path | 5598 | in: path |
@@ -7724,6 +7913,7 @@ components: | |||
7724 | required: | 7913 | required: |
7725 | - video | 7914 | - video |
7726 | - rating | 7915 | - rating |
7916 | |||
7727 | RegisterUser: | 7917 | RegisterUser: |
7728 | properties: | 7918 | properties: |
7729 | username: | 7919 | username: |
@@ -7754,6 +7944,74 @@ components: | |||
7754 | - password | 7944 | - password |
7755 | 7945 | ||
7756 | 7946 | ||
7947 | UserRegistrationRequest: | ||
7948 | allOf: | ||
7949 | - $ref: '#/components/schemas/RegisterUser' | ||
7950 | - type: object | ||
7951 | properties: | ||
7952 | registrationReason: | ||
7953 | type: string | ||
7954 | description: reason for the user to register on the instance | ||
7955 | required: | ||
7956 | - registrationReason | ||
7957 | |||
7958 | UserRegistrationAcceptOrReject: | ||
7959 | type: object | ||
7960 | properties: | ||
7961 | moderationResponse: | ||
7962 | type: string | ||
7963 | description: Moderation response to send to the user | ||
7964 | required: | ||
7965 | - moderationResponse | ||
7966 | |||
7967 | UserRegistration: | ||
7968 | properties: | ||
7969 | id: | ||
7970 | $ref: '#/components/schemas/id' | ||
7971 | state: | ||
7972 | type: object | ||
7973 | properties: | ||
7974 | id: | ||
7975 | type: integer | ||
7976 | enum: | ||
7977 | - 1 | ||
7978 | - 2 | ||
7979 | - 3 | ||
7980 | description: 'The registration state (Pending = `1`, Rejected = `2`, Accepted = `3`)' | ||
7981 | label: | ||
7982 | type: string | ||
7983 | registrationReason: | ||
7984 | type: string | ||
7985 | moderationResponse: | ||
7986 | type: string | ||
7987 | nullable: true | ||
7988 | username: | ||
7989 | type: string | ||
7990 | email: | ||
7991 | type: string | ||
7992 | format: email | ||
7993 | emailVerified: | ||
7994 | type: boolean | ||
7995 | accountDisplayName: | ||
7996 | type: string | ||
7997 | channelHandle: | ||
7998 | type: string | ||
7999 | channelDisplayName: | ||
8000 | type: string | ||
8001 | createdAt: | ||
8002 | type: string | ||
8003 | format: date-time | ||
8004 | updatedAt: | ||
8005 | type: string | ||
8006 | format: date-time | ||
8007 | user: | ||
8008 | type: object | ||
8009 | nullable: true | ||
8010 | description: If the registration has been accepted, this is a partial user object created by the registration | ||
8011 | properties: | ||
8012 | id: | ||
8013 | $ref: '#/components/schemas/id' | ||
8014 | |||
7757 | OAuthClient: | 8015 | OAuthClient: |
7758 | properties: | 8016 | properties: |
7759 | client_id: | 8017 | client_id: |