Merge pull request #4784 from manics/token-api-doc

doc: list/get token response is different from post
This commit is contained in:
Min RK
2024-04-18 15:02:51 +02:00
committed by GitHub

View File

@@ -553,6 +553,9 @@ paths:
content: content:
application/json: application/json:
schema: schema:
type: object
properties:
api_tokens:
type: array type: array
items: items:
$ref: "#/components/schemas/Token" $ref: "#/components/schemas/Token"
@@ -571,7 +574,7 @@ paths:
description: | description: |
Creates a new token owned by the user. Creates a new token owned by the user.
Permissions can be limited by specifying a list of `scopes` in the JSON request body Permissions can be limited by specifying a list of `scopes` in the JSON request body
(starting in JupyerHub 3.0; previously, permissions could be specified as `roles`, (starting in JupyterHub 3.0; previously, permissions could be specified as `roles`,
which is deprecated in 3.0). which is deprecated in 3.0).
parameters: parameters:
- $ref: "#/components/parameters/userName" - $ref: "#/components/parameters/userName"
@@ -614,7 +617,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/Token" $ref: "#/components/schemas/NewToken"
400: 400:
description: Body must be a JSON dict or empty description: Body must be a JSON dict or empty
content: {} content: {}
@@ -639,7 +642,7 @@ paths:
type: string type: string
responses: responses:
200: 200:
description: The info for the new token description: The info for the token
content: content:
application/json: application/json:
schema: schema:
@@ -1173,7 +1176,7 @@ paths:
example: abc123 example: abc123
accept_url: accept_url:
type: string type: string
description: The URL for acepting the code description: The URL for accepting the code
example: /hub/accept-share?code=abc123 example: /hub/accept-share?code=abc123
security: security:
- oauth2: - oauth2:
@@ -1518,7 +1521,7 @@ paths:
description: Shutdown successful description: Shutdown successful
content: {} content: {}
400: 400:
description: Unexpeced value for proxy or servers description: Unexpected value for proxy or servers
content: {} content: {}
security: security:
- oauth2: - oauth2:
@@ -1941,11 +1944,6 @@ components:
Token: Token:
type: object type: object
properties: properties:
token:
type: string
description:
The token itself. Only present in responses to requests for
a new token.
id: id:
type: string type: string
description: description:
@@ -1968,7 +1966,7 @@ components:
type: array type: array
description: description:
List of scopes this token has been assigned. New in JupyterHub List of scopes this token has been assigned. New in JupyterHub
3. In JupyterHub 2.x, tokens were assigned 'roles' insead of scopes. 3. In JupyterHub 2.x, tokens were assigned 'roles' instead of scopes.
items: items:
type: string type: string
note: note:
@@ -1999,6 +1997,69 @@ components:
Only used for tokens set during oauth flows. Only used for tokens set during oauth flows.
Added in 2.0. Added in 2.0.
NewToken:
type: object
properties:
token:
type: string
description:
The token itself. Only present in responses to requests for
a new token.
id:
type: string
description:
The id of the API token. Used for modifying or deleting the
token.
user:
type: string
description: The user that owns a token (undefined if owned by a service)
service:
type: string
description: The service that owns the token (undefined of owned by a user)
roles:
type: array
description:
Deprecated in JupyterHub 3, always an empty list. Tokens have
'scopes' starting from JupyterHub 3.
items:
type: string
scopes:
type: array
description:
List of scopes this token has been assigned. New in JupyterHub
3. In JupyterHub 2.x, tokens were assigned 'roles' instead of scopes.
items:
type: string
note:
type: string
description:
A note about the token, typically describing what it was created
for.
created:
type: string
description: Timestamp when this token was created
format: date-time
expires_at:
type: string
description: Timestamp when this token expires. Null if there is no expiry.
format: date-time
last_activity:
type: string
description: |
Timestamp of last-seen activity using this token.
Can be null if token has never been used.
format: date-time
session_id:
type:
- string
- "null"
description: |
The session id associated with the token, if any.
Only used for tokens set during oauth flows.
Added in 2.0.
securitySchemes: securitySchemes:
token: token:
type: http type: http