-
Notifications
You must be signed in to change notification settings - Fork 116
/
credentials.ts
168 lines (157 loc) · 3.81 KB
/
credentials.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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/**
* Interface representing a Nylas Credential object.
*/
export interface Credential {
/**
* Globally unique object identifier
*/
id: string;
/**
* Name of the credential
*/
name: string;
/**
* The type of credential
*/
credentialType?: CredentialType;
/**
* Hashed value of the credential that you created
*/
hashedData?: string;
/**
* Timestamp of when the credential was created
*/
createdAt?: number;
/**
* Timestamp of when the credential was updated
*/
updatedAt?: number;
}
/**
* Interface representing additional data needed to create a credential for Microsoft Admin Consent
*/
export interface MicrosoftAdminConsentSettings {
clientId: string;
clientSecret: string;
[key: string]: string;
}
/**
* Interface representing additional data needed to create a credential for Google Service Account
*/
export interface GoogleServiceAccountCredential {
privateKeyId: string;
privateKey: string;
clientEmail: string;
[key: string]: string;
}
/**
* Interface representing additional data needed to create a credential for a Connector Override
*/
export type ConnectorOverrideCredential = Record<string, unknown>;
/**
* Type representing the data needed to create a credential
*/
export type CredentialData =
| MicrosoftAdminConsentSettings
| GoogleServiceAccountCredential
| ConnectorOverrideCredential;
/**
* Interface representing a request to create a Microsoft Admin Consent credential
*/
export interface CreateMicrosoftCredentialRequest {
/**
* Unique name of this credential
*/
name: string;
/**
* Type of credential for the admin consent flow
*/
credentialType: CredentialType.ADMINCONSENT;
/**
* Data that specifies some special data required for this credential
*/
credentialData: MicrosoftAdminConsentSettings;
}
/**
* Interface representing a request to create a Google Service Account credential
*/
export interface CreateGoogleCredentialRequest {
/**
* Unique name of this credential
*/
name: string;
/**
* Type of credential for the app permission flow
*/
credentialType: CredentialType.SERVICEACCOUNT;
/**
* Data that specifies some special data required for this credential
*/
credentialData: GoogleServiceAccountCredential;
}
/**
* Interface representing a request to create a Connector Override credential
*/
export interface CreateOverrideCredentialRequest {
/**
* Unique name of this credential
*/
name: string;
/**
* Type of credential to force the override of a connector's client values
*/
credentialType: CredentialType.CONNECTOR;
/**
* Data that specifies some special data required for this credential
*/
credentialData: ConnectorOverrideCredential;
}
/**
* Interface representing a request to create a credential
*/
export type CreateCredentialRequest =
| CreateMicrosoftCredentialRequest
| CreateGoogleCredentialRequest
| CreateOverrideCredentialRequest;
/**
* Interface representing a request to update a credential
*/
export interface UpdateCredentialRequest {
/**
* Unique name of this credential
*/
name?: string;
/**
* Data that specifies some special data required for this credential
*/
credentialData?: CredentialData;
}
/**
* Enum representing the type of credential
*/
export enum CredentialType {
ADMINCONSENT = 'adminconsent',
SERVICEACCOUNT = 'serviceaccount',
CONNECTOR = 'connector',
}
/**
* Interface representing the query parameters for listing credentials.
*/
export interface ListCredentialsQueryParams {
/**
* Limit the number of results
*/
limit?: number;
/**
* Offset the results by this number
*/
offset?: number;
/**
* Sort the results by field name
*/
sortBy?: 'createdAt' | 'updatedAt';
/**
* Order the results by ascending or descending
*/
orderBy?: 'desc' | 'asc';
}