-
Notifications
You must be signed in to change notification settings - Fork 116
/
grants.ts
138 lines (134 loc) · 2.93 KB
/
grants.ts
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
import { Provider } from './auth.js';
/**
* Interface representing a Nylas Grant object.
*/
export interface Grant {
/**
* Globally unique object identifier.
*/
id: string;
/**
* OAuth provider that the user authenticated with.
*/
provider: string;
/**
* Scopes specified for the grant.
*/
scope: string[];
/**
* Unix timestamp when the grant was created.
*/
createdAt: number;
/**
* Status of the grant, if it is still valid or if the user needs to re-authenticate.
*/
grantStatus?: string;
/**
* Email address associated with the grant.
*/
email?: string;
/**
* End user's client user agent.
*/
userAgent?: string;
/**
* End user's client IP address.
*/
ip?: string;
/**
* Initial state that was sent as part of the OAuth request.
*/
state?: string;
/**
* Unix timestamp when the grant was updated.
*/
updatedAt?: number;
/**
* Provider's ID for the user this grant is associated with.
*/
providerUserId?: string;
/**
* Settings required by the provider that were sent as part of the OAuth request.
*/
settings?: Record<string, unknown>;
}
/**
* Interface representing a request to create a grant.
*/
export interface CreateGrantRequest {
/**
* OAuth provider
*/
provider: Provider;
/**
* Settings required by provider.
*/
settings: Record<string, unknown>;
/**
* Optional state value to return to developer's website after authentication flow is completed.
*/
state?: string;
/**
* Optional list of scopes to request. If not specified it will use the integration default scopes.
*/
scope?: string[];
}
/**
* Interface representing a request to update a grant.
*/
export interface UpdateGrantRequest {
/**
* Settings required by provider.
*/
settings?: Record<string, unknown>;
/**
* List of integration scopes for the grant.
*/
scope?: string[];
}
/**
* Interface representing the query parameters for listing grants.
*/
export interface ListGrantsQueryParams {
/**
* The maximum number of objects to return.
* This field defaults to 10. The maximum allowed value is 200.
*/
limit?: number;
/**
* Offset grant results by this number.
*/
offset?: number;
/**
* Sort entries by field name
*/
sortBy?: 'createdAt' | 'updatedAt';
/**
* Specify ascending or descending order.
*/
orderBy?: 'asc' | 'desc';
/**
* Scope grants from a specific point in time by Unix timestamp.
*/
since?: number;
/**
* Scope grants to a specific point in time by Unix timestamp.
*/
before?: number;
/**
* Filtering your query based on grant email address (if applicable)
*/
email?: string;
/**
* Filtering your query based on grant email status (if applicable)
*/
grantStatus?: string;
/**
* Filtering your query based on grant IP address
*/
ip?: string;
/**
* Filtering your query based on OAuth provider
*/
provider?: Provider;
}