-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccess-token.ts
More file actions
70 lines (63 loc) · 1.92 KB
/
access-token.ts
File metadata and controls
70 lines (63 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../core/resource';
import { APIPromise } from '../core/api-promise';
import { RequestOptions } from '../internal/request-options';
/**
* Endpoints for managing access tokens for the Portfolio Connect SDK.
* Use these to generate short-lived `at_` prefixed tokens that can be safely passed to frontend applications.
* Access tokens can be used in place of API keys on all v4 endpoints.
*/
export class AccessToken extends APIResource {
/**
* Generate a short-lived access token from your API key.
*
* **Use this endpoint from your backend** to create tokens that can be safely
* passed to frontend/SDK.
*
* **Legacy path:** `/v1/access-token` (still supported)
*
* Access tokens:
*
* - Are prefixed with `at_` for easy identification
* - Valid for up to 60 minutes
* - Can be used in place of API keys on all v4 endpoints
* - Cannot be used to generate other access tokens
*
* @example
* ```ts
* const accessToken = await client.accessToken.create();
* ```
*/
create(
body: AccessTokenCreateParams | null | undefined = {},
options?: RequestOptions,
): APIPromise<AccessTokenCreateResponse> {
return this._client.post('/v1/token', { body, ...options });
}
}
export interface AccessTokenCreateResponse {
/**
* The at\_ prefixed access token
*/
access_token?: string;
/**
* Token validity in seconds
*/
expires_in?: number;
/**
* Always "api_key" - token is a drop-in replacement for x-api-key header
*/
token_type?: string;
}
export interface AccessTokenCreateParams {
/**
* Token validity in minutes (max 60)
*/
expiry_minutes?: number;
}
export declare namespace AccessToken {
export {
type AccessTokenCreateResponse as AccessTokenCreateResponse,
type AccessTokenCreateParams as AccessTokenCreateParams,
};
}