You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`permissions``string[]` List of permissions to grant to the token. You must already have each of these permissions with your current token.
184
+
-`lifetime``number` Lifetime of the token in seconds. If null, the token will never expire (not recommended). Max: 31560000 (1 year). Min: 60 (1 minute).
185
+
-`note``string` A user-specified note to label the token. Max length: 2⁸ (256) characters.
Refresh current token. The token that was used to authenticate the request will be deleted. A new token with a new ID but the same permissions will be created and returned. The lifespan of the new token will be the same as the old one, starting from the time of the request. This operation effectively allows a token to be used indefinitely.
@@ -226,6 +315,39 @@ Your subscription to a newsletter
226
315
-`email``string` The email address of the subscriber
227
316
-`newsletter``string` The ID of the newsletter that was subscribed to
228
317
318
+
<aname="interface-cloudnodepartialtoken"></a>
319
+
320
+
### Interface: `Cloudnode.PartialToken`
321
+
322
+
A token, however, the `permissions` field is not included
323
+
324
+
-`id``string` The ID or key of the token
325
+
-`created``Date` Date and time when this token was created
326
+
-`expires``Date | null` Date and time when this token expires. Null if it never expires.
327
+
-`internal``string | undefined` Whether this token is for internal use only, e.g. to power a session. In other words, an internal token is one that was **not** created by the client.
328
+
-`metadata``Cloudnode.TokenMetadata` Additional metadata about this token
329
+
330
+
<aname="interface-cloudnodetoken"></a>
331
+
332
+
### Interface: `Cloudnode.Token`
333
+
334
+
An authentication token
335
+
336
+
-`id``string` The ID or key of the token
337
+
-`created``Date` Date and time when this token was created
338
+
-`expires``Date | null` Date and time when this token expires. Null if it never expires.
339
+
-`permissions``string[]` Permission scopes that this token holds
340
+
-`internal``string | undefined` Whether this token is for internal use only, e.g. to power a session. In other words, an internal token is one that was **not** created by the client.
341
+
-`metadata``Cloudnode.TokenMetadata` Additional metadata about this token
342
+
343
+
<aname="interface-cloudnodetokenmetadata"></a>
344
+
345
+
### Interface: `Cloudnode.TokenMetadata`
346
+
347
+
Token metadata
348
+
349
+
-`note``string | undefined` A user-supplied note for this token
returnawaitthis.#sendRequest({"type": "operation","description": "List tokens of user","token": "tokens.list.own","method": "GET","path": "/token","parameters": {"query": {"limit": {"description": "The number of tokens to return per page. No more than 50.","default": "10","type": "number","required": false},"page": {"description": "The page number. No more than 2³² (4294967296).","default": "1","type": "number","required": false},"internal": {"description": "Internal tokens are returned as well if this parameter is present.","type": "any","required": false}}},"returns": [{"status": 200,"type": "PartialToken[]"},{"status": 401,"type": "Error & {code: \"UNAUTHORIZED\"}"},{"status": 403,"type": "Error & {code: \"NO_PERMISSION\"}"},{"status": 429,"type": "Error & {code: \"RATE_LIMITED\"}"},{"status": 500,"type": "Error & {code: \"INTERNAL_SERVER_ERROR\"}"},{"status": 503,"type": "Error & {code: \"MAINTENANCE\"}"}]},{},{limit: `${limit}`,page: `${page}`,internal: `${internal}`},{});
166
+
},
167
+
/**
168
+
* Create token
169
+
* @POST /token
170
+
* @param permissions List of permissions to grant to the token. You must already have each of these permissions with your current token.
171
+
* @param lifetime Lifetime of the token in seconds. If null, the token will never expire (not recommended). Max: 31560000 (1 year). Min: 60 (1 minute).
172
+
* @param note A user-specified note to label the token. Max length: 2⁸ (256) characters.
returnawaitthis.#sendRequest({"type": "operation","description": "Create token","token": "tokens.create.own","method": "POST","path": "/token","parameters": {"body": {"permissions": {"description": "List of permissions to grant to the token. You must already have each of these permissions with your current token.","type": "string[]","required": true},"lifetime": {"description": "Lifetime of the token in seconds. If null, the token will never expire (not recommended). Max: 31560000 (1 year). Min: 60 (1 minute).","type": "number","required": true},"note": {"description": "A user-specified note to label the token. Max length: 2⁸ (256) characters.","type": "string","required": false}}},"returns": [{"status": 201,"type": "Token"},{"status": 422,"type": "Error & {code: \"INVALID_DATA\"}"},{"status": 401,"type": "Error & {code: \"UNAUTHORIZED\"}"},{"status": 403,"type": "Error & {code: \"NO_PERMISSION\"}"},{"status": 429,"type": "Error & {code: \"RATE_LIMITED\"}"},{"status": 500,"type": "Error & {code: \"INTERNAL_SERVER_ERROR\"}"},{"status": 503,"type": "Error & {code: \"MAINTENANCE\"}"}]},{},{},{ permissions, lifetime, note });
182
+
},
183
+
/**
184
+
* Get token details
185
+
* @GET /token/:id
186
+
* @param id The ID of the token to get. Specify `current` to get information about the token that was used to authenticate the request.
returnawaitthis.#sendRequest({"type": "operation","description": "Get token details","token": "tokens.get.own","method": "GET","path": "/token/:id","parameters": {"path": {"id": {"description": "The ID of the token to get. Specify `current` to get information about the token that was used to authenticate the request.","type": "string","required": true}}},"returns": [{"status": 200,"type": "Token"},{"status": 404,"type": "Error & {code: \"RESOURCE_NOT_FOUND\"}"},{"status": 422,"type": "Error & {code: \"INVALID_DATA\"}"},{"status": 401,"type": "Error & {code: \"UNAUTHORIZED\"}"},{"status": 403,"type": "Error & {code: \"NO_PERMISSION\"}"},{"status": 429,"type": "Error & {code: \"RATE_LIMITED\"}"},{"status": 500,"type": "Error & {code: \"INTERNAL_SERVER_ERROR\"}"},{"status": 503,"type": "Error & {code: \"MAINTENANCE\"}"}]},{id: `${id}`},{},{});
197
+
},
198
+
/**
199
+
* Revoke token
200
+
* @DELETE /token/:id
201
+
* @param id The ID of the token to revoke. Specify `current` to revoke the token that was used to authenticate the request.
returnawaitthis.#sendRequest({"type": "operation","description": "Revoke token","token": "tokens.revoke.own","method": "DELETE","path": "/token/:id","parameters": {"path": {"id": {"description": "The ID of the token to revoke. Specify `current` to revoke the token that was used to authenticate the request.","type": "string","required": true}}},"returns": [{"status": 204,"type": "void"},{"status": 404,"type": "Error & {code: \"RESOURCE_NOT_FOUND\"}"},{"status": 422,"type": "Error & {code: \"INVALID_DATA\"}"},{"status": 400,"type": "Error & {code: \"MODIFICATION_NOT_ALLOWED\"}"},{"status": 401,"type": "Error & {code: \"UNAUTHORIZED\"}"},{"status": 403,"type": "Error & {code: \"NO_PERMISSION\"}"},{"status": 429,"type": "Error & {code: \"RATE_LIMITED\"}"},{"status": 500,"type": "Error & {code: \"INTERNAL_SERVER_ERROR\"}"},{"status": 503,"type": "Error & {code: \"MAINTENANCE\"}"}]},{id: `${id}`},{},{});
213
+
},
214
+
};
215
+
tokens={
216
+
/**
217
+
* Refresh current token. The token that was used to authenticate the request will be deleted. A new token with a new ID but the same permissions will be created and returned. The lifespan of the new token will be the same as the old one, starting from the time of the request. This operation effectively allows a token to be used indefinitely.
returnawaitthis.#sendRequest({"type": "operation","description": "Refresh current token. The token that was used to authenticate the request will be deleted. A new token with a new ID but the same permissions will be created and returned. The lifespan of the new token will be the same as the old one, starting from the time of the request. This operation effectively allows a token to be used indefinitely.","token": "token.refresh","method": "POST","path": "/token/refresh","parameters": {},"returns": [{"status": 201,"type": "Token"},{"status": 422,"type": "Error & {code: \"INVALID_DATA\"}"},{"status": 401,"type": "Error & {code: \"UNAUTHORIZED\"}"},{"status": 403,"type": "Error & {code: \"NO_PERMISSION\"}"},{"status": 429,"type": "Error & {code: \"RATE_LIMITED\"}"},{"status": 500,"type": "Error & {code: \"INTERNAL_SERVER_ERROR\"}"},{"status": 503,"type": "Error & {code: \"MAINTENANCE\"}"}]},{},{},{});
0 commit comments