@unito/integrations-platform-client 0.44.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +3 -0
- package/README.md +68 -0
- package/dist/src/api.d.ts +421 -0
- package/dist/src/api.js +451 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +27 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
Copyright (c) Unito, Inc.
|
|
2
|
+
|
|
3
|
+
This repository is a component of the Unito Software Development Kit (SDK). By downloading, installing, accessing, or using any part of the Unito SDK, including this repository, you signify your acceptance of and agree to be bound by the terms of the Unito Software Development Kit Agreement found at https://unito.io/sdk-agreement/. If you do not agree to the terms of the Unito Software Development Kit Agreement, you are not authorized to download, install, access, or use any part of the Unito SDK, including this repository.
|
package/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Integrations Platform - Client
|
|
2
|
+
|
|
3
|
+
This component is a JS client library to communicate with the Integrations Platform Server. It exposes a standard
|
|
4
|
+
[`oazapfts`](https://www.npmjs.com/package/oazapfts) interface compiled with the `--optimistic` option.
|
|
5
|
+
|
|
6
|
+
## Getting started
|
|
7
|
+
|
|
8
|
+
1. Install the library:
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install @unitoio/integrations-platform-client
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
2. Use the library:
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import IntegrationsPlatform from '@unitoio/integrations-platform-client';
|
|
18
|
+
|
|
19
|
+
IntegrationsPlatform.defaults.baseUrl = 'http://enpoint.to.the.server';
|
|
20
|
+
IntegrationsPlatform.defaults.headers = { Authorization: 'Bearer YOUR_TOKEN' };
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
await IntegrationsPlatform.getIntegrations();
|
|
24
|
+
} catch (err: unknown) {
|
|
25
|
+
if (err instanceof IntegrationsPlatform.HttpError) {
|
|
26
|
+
// Handle the error.
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
See [oazapfts](https://www.npmjs.com/package/oazapfts) for more information.
|
|
32
|
+
|
|
33
|
+
## Development
|
|
34
|
+
|
|
35
|
+
### Getting started
|
|
36
|
+
|
|
37
|
+
Install the dependencies:
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
npm ci
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Regenerate the library
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
npm publish --dry-run
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Publish the library
|
|
50
|
+
|
|
51
|
+
1. Modify the version. For example:
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
npm version minor
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
See `npm version help` for more information.
|
|
58
|
+
|
|
59
|
+
2. Create a changeset -> pull request -> merge on `main`.
|
|
60
|
+
|
|
61
|
+
3. A Github Action will automatically publish the package in our private NPM repository.
|
|
62
|
+
|
|
63
|
+
## Terms and Conditions
|
|
64
|
+
|
|
65
|
+
By using the Integration Platform Client, you agree to be bound by our terms and conditions.
|
|
66
|
+
Please ensure you have read and understood the Unito Software Development Kit Agreement before using the Platform Client.
|
|
67
|
+
The full agreement can be found at [Unito SDK Agreement](https://unito.io/sdk-agreement/).
|
|
68
|
+
|
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integrations Platform API
|
|
3
|
+
* 0.1.0
|
|
4
|
+
* DO NOT MODIFY - This file has been generated using oazapfts.
|
|
5
|
+
* See https://www.npmjs.com/package/oazapfts
|
|
6
|
+
*/
|
|
7
|
+
import * as Oazapfts from 'oazapfts/lib/runtime';
|
|
8
|
+
export declare const defaults: Oazapfts.RequestOpts;
|
|
9
|
+
export declare const servers: {
|
|
10
|
+
local: string;
|
|
11
|
+
staging: string;
|
|
12
|
+
production: string;
|
|
13
|
+
};
|
|
14
|
+
export type Pagination = {
|
|
15
|
+
total: number;
|
|
16
|
+
};
|
|
17
|
+
export type Base = {
|
|
18
|
+
createdAt: string;
|
|
19
|
+
updatedAt: string;
|
|
20
|
+
archivedAt: string | null;
|
|
21
|
+
};
|
|
22
|
+
export type IntegrationSummary = Base & {
|
|
23
|
+
id: number;
|
|
24
|
+
name: string;
|
|
25
|
+
baseUrl: string | null;
|
|
26
|
+
graphRelativeUrl: string;
|
|
27
|
+
credentialAccountRelativeUrl: string;
|
|
28
|
+
webhookParsingRelativeUrl?: string | null;
|
|
29
|
+
webhookSubscriptionsRelativeUrl?: string | null;
|
|
30
|
+
webhookAcknowledgeRelativeUrl?: string | null;
|
|
31
|
+
visibility: 'private' | 'public';
|
|
32
|
+
unitoOrganizationIds: string[];
|
|
33
|
+
ui: {
|
|
34
|
+
displayName: string;
|
|
35
|
+
logo: string | null;
|
|
36
|
+
};
|
|
37
|
+
secrets?: {
|
|
38
|
+
[key: string]: string;
|
|
39
|
+
};
|
|
40
|
+
disabledAt?: string | null;
|
|
41
|
+
};
|
|
42
|
+
export type Error = {
|
|
43
|
+
message: string;
|
|
44
|
+
details?: {
|
|
45
|
+
[key: string]: any;
|
|
46
|
+
};
|
|
47
|
+
stack?: string[];
|
|
48
|
+
};
|
|
49
|
+
export type AuthorizationMethod = 'custom' | 'oauth2';
|
|
50
|
+
export type AuthorizationGrantType = 'authorization_code' | 'password';
|
|
51
|
+
export type AuthorizationScope = {
|
|
52
|
+
name: string;
|
|
53
|
+
help?: string;
|
|
54
|
+
};
|
|
55
|
+
export type AuthorizationOAuth2ContentType = 'application/x-www-form-urlencoded' | 'application/json';
|
|
56
|
+
export type AuthorizationOAuth2RequestParameters = {
|
|
57
|
+
header?: {
|
|
58
|
+
[key: string]: string | number | boolean;
|
|
59
|
+
};
|
|
60
|
+
body?: {
|
|
61
|
+
[key: string]: string | number | boolean;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export type AuthorizationOAuth2 = {
|
|
65
|
+
clientSecret?: string;
|
|
66
|
+
clientId?: string;
|
|
67
|
+
authorizationUrl?: string;
|
|
68
|
+
tokenUrl: string;
|
|
69
|
+
grantType: AuthorizationGrantType;
|
|
70
|
+
scopes: AuthorizationScope[];
|
|
71
|
+
requestContentType: AuthorizationOAuth2ContentType;
|
|
72
|
+
responseContentType: AuthorizationOAuth2ContentType;
|
|
73
|
+
refreshRequestParameters?: AuthorizationOAuth2RequestParameters;
|
|
74
|
+
tokenRequestParameters?: AuthorizationOAuth2RequestParameters;
|
|
75
|
+
} | null;
|
|
76
|
+
export type AuthorizationVariables = {
|
|
77
|
+
[key: string]: {
|
|
78
|
+
type: 'boolean' | 'number' | 'password' | 'string' | 'text';
|
|
79
|
+
format?: 'uri' | 'email';
|
|
80
|
+
pattern?: string;
|
|
81
|
+
label?: string;
|
|
82
|
+
required?: boolean;
|
|
83
|
+
placeholder?: string;
|
|
84
|
+
defaultValue?: string | number | boolean;
|
|
85
|
+
help?: string;
|
|
86
|
+
documentationUrl?: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
export type Authorization = Base & {
|
|
90
|
+
id: number;
|
|
91
|
+
integrationId: number;
|
|
92
|
+
name: string;
|
|
93
|
+
method: AuthorizationMethod;
|
|
94
|
+
oauth2: AuthorizationOAuth2;
|
|
95
|
+
variables: AuthorizationVariables;
|
|
96
|
+
instructionsImage?: string | null;
|
|
97
|
+
instructionsMarkdown?: string | null;
|
|
98
|
+
};
|
|
99
|
+
export type Integration = IntegrationSummary & {
|
|
100
|
+
authorizations: Authorization[];
|
|
101
|
+
userIds: number[];
|
|
102
|
+
};
|
|
103
|
+
export type IntegrationEvent = {
|
|
104
|
+
date: string;
|
|
105
|
+
text: string;
|
|
106
|
+
tags: string[];
|
|
107
|
+
title: string;
|
|
108
|
+
};
|
|
109
|
+
export type Credential = Base & {
|
|
110
|
+
id: number;
|
|
111
|
+
integrationId: number;
|
|
112
|
+
integrationName: string;
|
|
113
|
+
authorizationId: number;
|
|
114
|
+
scope: 'development' | 'compliance' | 'production' | 'service';
|
|
115
|
+
unitoUserId: string | null;
|
|
116
|
+
payload: {
|
|
117
|
+
[key: string]: any;
|
|
118
|
+
};
|
|
119
|
+
partitionKey?: string | null;
|
|
120
|
+
};
|
|
121
|
+
export type UserRole = 'unitoAdministrator' | 'unitoService' | 'developer';
|
|
122
|
+
export type UserSummary = Base & {
|
|
123
|
+
id: number;
|
|
124
|
+
email: string;
|
|
125
|
+
defaultUnitoOrganizationId: string | null;
|
|
126
|
+
termsAcceptedAt: string | null;
|
|
127
|
+
role: UserRole;
|
|
128
|
+
};
|
|
129
|
+
export type User = UserSummary & {
|
|
130
|
+
apiKey: string;
|
|
131
|
+
};
|
|
132
|
+
export type CredentialAccount = {
|
|
133
|
+
id: string;
|
|
134
|
+
displayName: string;
|
|
135
|
+
emails: string[];
|
|
136
|
+
partition?: string;
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Get all the integrations
|
|
140
|
+
*/
|
|
141
|
+
export declare function getIntegrations({ pagination, unitoOrganizationId, search, }?: {
|
|
142
|
+
pagination?: {
|
|
143
|
+
offset?: number;
|
|
144
|
+
limit?: number;
|
|
145
|
+
};
|
|
146
|
+
unitoOrganizationId?: string;
|
|
147
|
+
search?: string;
|
|
148
|
+
}, opts?: Oazapfts.RequestOpts): Promise<Pagination & {
|
|
149
|
+
data: IntegrationSummary[];
|
|
150
|
+
}>;
|
|
151
|
+
/**
|
|
152
|
+
* Create an integration
|
|
153
|
+
*/
|
|
154
|
+
export declare function createIntegration(body?: {
|
|
155
|
+
name: string;
|
|
156
|
+
baseUrl?: string | null;
|
|
157
|
+
graphRelativeUrl?: string | null;
|
|
158
|
+
credentialAccountRelativeUrl?: string | null;
|
|
159
|
+
webhookParsingRelativeUrl?: string | null;
|
|
160
|
+
webhookSubscriptionsRelativeUrl?: string | null;
|
|
161
|
+
webhookAcknowledgeRelativeUrl?: string | null;
|
|
162
|
+
}, opts?: Oazapfts.RequestOpts): Promise<Integration>;
|
|
163
|
+
/**
|
|
164
|
+
* Publish an integration
|
|
165
|
+
*/
|
|
166
|
+
export declare function publishIntegration(body?: {
|
|
167
|
+
file: Blob;
|
|
168
|
+
}, opts?: Oazapfts.RequestOpts): Promise<Integration>;
|
|
169
|
+
/**
|
|
170
|
+
* Find an integration by exact name
|
|
171
|
+
*/
|
|
172
|
+
export declare function getIntegrationByName(integrationName: string, opts?: Oazapfts.RequestOpts): Promise<Integration>;
|
|
173
|
+
/**
|
|
174
|
+
* Invite a user to an integration
|
|
175
|
+
*/
|
|
176
|
+
export declare function inviteUser(integrationId: number, body?: {
|
|
177
|
+
email?: string;
|
|
178
|
+
}, opts?: Oazapfts.RequestOpts): Promise<Integration>;
|
|
179
|
+
/**
|
|
180
|
+
* Get an integration
|
|
181
|
+
*/
|
|
182
|
+
export declare function getIntegrationById(integrationId: number, opts?: Oazapfts.RequestOpts): Promise<Integration>;
|
|
183
|
+
/**
|
|
184
|
+
* Update an integration
|
|
185
|
+
*/
|
|
186
|
+
export declare function updateIntegration(integrationId: number, body?: {
|
|
187
|
+
baseUrl?: string | null;
|
|
188
|
+
graphRelativeUrl?: string | null;
|
|
189
|
+
credentialAccountRelativeUrl?: string | null;
|
|
190
|
+
webhookParsingRelativeUrl?: string | null;
|
|
191
|
+
webhookSubscriptionsRelativeUrl?: string | null;
|
|
192
|
+
webhookAcknowledgeRelativeUrl?: string | null;
|
|
193
|
+
authorizations?: {
|
|
194
|
+
id?: number;
|
|
195
|
+
name: string;
|
|
196
|
+
method: AuthorizationMethod;
|
|
197
|
+
oauth2?: AuthorizationOAuth2;
|
|
198
|
+
variables?: AuthorizationVariables;
|
|
199
|
+
archived?: boolean;
|
|
200
|
+
}[];
|
|
201
|
+
userIds?: number[];
|
|
202
|
+
archived?: boolean;
|
|
203
|
+
disabled?: boolean;
|
|
204
|
+
ui?: {
|
|
205
|
+
displayName?: string | null;
|
|
206
|
+
logo?: string | null;
|
|
207
|
+
};
|
|
208
|
+
visibility?: 'private' | 'public';
|
|
209
|
+
unitoOrganizationIds?: string[];
|
|
210
|
+
secrets?: {
|
|
211
|
+
[key: string]: string;
|
|
212
|
+
};
|
|
213
|
+
}, opts?: Oazapfts.RequestOpts): Promise<Integration>;
|
|
214
|
+
/**
|
|
215
|
+
* Delete an integration
|
|
216
|
+
*/
|
|
217
|
+
export declare function deleteIntegration(integrationId: number, name: string, opts?: Oazapfts.RequestOpts): Promise<unknown>;
|
|
218
|
+
/**
|
|
219
|
+
* Get the events associated with this integration.
|
|
220
|
+
*/
|
|
221
|
+
export declare function getIntegrationEvents(integrationId: number, opts?: Oazapfts.RequestOpts): Promise<Pagination & {
|
|
222
|
+
data: IntegrationEvent[];
|
|
223
|
+
}>;
|
|
224
|
+
/**
|
|
225
|
+
* Get the logo of the integration, in SVG format.
|
|
226
|
+
*/
|
|
227
|
+
export declare function getIntegrationLogo(integrationName: string, opts?: Oazapfts.RequestOpts): Promise<Blob>;
|
|
228
|
+
/**
|
|
229
|
+
* Get all the credentials
|
|
230
|
+
*/
|
|
231
|
+
export declare function getCredentials({ pagination, filters, }?: {
|
|
232
|
+
pagination?: {
|
|
233
|
+
offset?: number;
|
|
234
|
+
limit?: number;
|
|
235
|
+
};
|
|
236
|
+
filters?: {
|
|
237
|
+
authorizationId?: number;
|
|
238
|
+
integrationId?: number;
|
|
239
|
+
credentialScope?: 'development' | 'compliance' | 'production' | 'service';
|
|
240
|
+
unitoUserId?: string;
|
|
241
|
+
credentialAccountId?: string;
|
|
242
|
+
};
|
|
243
|
+
}, opts?: Oazapfts.RequestOpts): Promise<Pagination & {
|
|
244
|
+
data: Credential[];
|
|
245
|
+
}>;
|
|
246
|
+
/**
|
|
247
|
+
* Create a credential
|
|
248
|
+
*/
|
|
249
|
+
export declare function createCredential(body?: {
|
|
250
|
+
authorizationId: number;
|
|
251
|
+
scope?: 'development' | 'compliance' | 'production' | 'service';
|
|
252
|
+
payload: {
|
|
253
|
+
[key: string]: any;
|
|
254
|
+
};
|
|
255
|
+
unitoUserId?: string;
|
|
256
|
+
credentialAccountId?: string;
|
|
257
|
+
}, opts?: Oazapfts.RequestOpts): Promise<Credential>;
|
|
258
|
+
/**
|
|
259
|
+
* Get a credential
|
|
260
|
+
*/
|
|
261
|
+
export declare function getCredentialById(credentialId: number, opts?: Oazapfts.RequestOpts): Promise<Credential>;
|
|
262
|
+
/**
|
|
263
|
+
* Update a credential
|
|
264
|
+
*/
|
|
265
|
+
export declare function updateCredential(credentialId: number, body?: {
|
|
266
|
+
payload?: {
|
|
267
|
+
[key: string]: any;
|
|
268
|
+
};
|
|
269
|
+
scope?: 'development' | 'compliance' | 'production' | 'service';
|
|
270
|
+
archived?: boolean;
|
|
271
|
+
unitoUserId?: string;
|
|
272
|
+
credentialAccountId?: string;
|
|
273
|
+
}, opts?: Oazapfts.RequestOpts): Promise<Credential>;
|
|
274
|
+
/**
|
|
275
|
+
* Delete a credential
|
|
276
|
+
*/
|
|
277
|
+
export declare function deleteCredential(credentialId: number, opts?: Oazapfts.RequestOpts): Promise<unknown>;
|
|
278
|
+
/**
|
|
279
|
+
* Used by the frontend to send analytics data
|
|
280
|
+
*/
|
|
281
|
+
export declare function postTrack(body: {
|
|
282
|
+
jwtToken: string;
|
|
283
|
+
event: 'AUTH_START' | 'AUTH_SUBMIT';
|
|
284
|
+
payload?: {
|
|
285
|
+
[key: string]: any;
|
|
286
|
+
};
|
|
287
|
+
}, opts?: Oazapfts.RequestOpts): Promise<unknown>;
|
|
288
|
+
/**
|
|
289
|
+
* Encrypt data
|
|
290
|
+
*/
|
|
291
|
+
export declare function encryptData(body: {
|
|
292
|
+
data: string;
|
|
293
|
+
integrationName: string;
|
|
294
|
+
}, opts?: Oazapfts.RequestOpts): Promise<{
|
|
295
|
+
encryptedData: string;
|
|
296
|
+
}>;
|
|
297
|
+
/**
|
|
298
|
+
* Decrypt data
|
|
299
|
+
*/
|
|
300
|
+
export declare function decryptData(body: {
|
|
301
|
+
data: string;
|
|
302
|
+
integrationName: string;
|
|
303
|
+
}, opts?: Oazapfts.RequestOpts): Promise<{
|
|
304
|
+
decryptedData: string;
|
|
305
|
+
}>;
|
|
306
|
+
/**
|
|
307
|
+
* Decrypt and encrypt data
|
|
308
|
+
*/
|
|
309
|
+
export declare function reencryptData(body: {
|
|
310
|
+
encryptedData: string;
|
|
311
|
+
integrationName: string;
|
|
312
|
+
newIntegrationName: string;
|
|
313
|
+
}, opts?: Oazapfts.RequestOpts): Promise<{
|
|
314
|
+
encryptedData: string;
|
|
315
|
+
}>;
|
|
316
|
+
/**
|
|
317
|
+
* Get my profile
|
|
318
|
+
*/
|
|
319
|
+
export declare function getProfile(opts?: Oazapfts.RequestOpts): Promise<User>;
|
|
320
|
+
/**
|
|
321
|
+
* Update my profile
|
|
322
|
+
*/
|
|
323
|
+
export declare function updateProfile(body?: {
|
|
324
|
+
termsAccepted?: boolean;
|
|
325
|
+
}, opts?: Oazapfts.RequestOpts): Promise<User>;
|
|
326
|
+
/**
|
|
327
|
+
* Call an integration's me
|
|
328
|
+
*/
|
|
329
|
+
export declare function getProxyMe(xUnitoCredentialId: string, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
|
|
330
|
+
xUnitoCorrelationId?: string;
|
|
331
|
+
xUnitoAdditionalLoggingContext?: string;
|
|
332
|
+
}, opts?: Oazapfts.RequestOpts): Promise<CredentialAccount>;
|
|
333
|
+
/**
|
|
334
|
+
* Update a webhook subscription
|
|
335
|
+
*/
|
|
336
|
+
export declare function updateWebhookSubscription(xUnitoCredentialId: string, body: {
|
|
337
|
+
itemPath: string;
|
|
338
|
+
targetUrl: string;
|
|
339
|
+
action: 'start' | 'stop';
|
|
340
|
+
}, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
|
|
341
|
+
xUnitoCorrelationId?: string;
|
|
342
|
+
xUnitoAdditionalLoggingContext?: string;
|
|
343
|
+
}, opts?: Oazapfts.RequestOpts): Promise<unknown>;
|
|
344
|
+
/**
|
|
345
|
+
* Call an integration's graph
|
|
346
|
+
*/
|
|
347
|
+
export declare function getProxyGraph(xUnitoCredentialId: string, path: string, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
|
|
348
|
+
xUnitoCorrelationId?: string;
|
|
349
|
+
xUnitoAdditionalLoggingContext?: string;
|
|
350
|
+
}, opts?: Oazapfts.RequestOpts): Promise<any>;
|
|
351
|
+
/**
|
|
352
|
+
* Call an integration's graph
|
|
353
|
+
*/
|
|
354
|
+
export declare function patchProxyGraph(xUnitoCredentialId: string, path: string, body?: object, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
|
|
355
|
+
xUnitoCorrelationId?: string;
|
|
356
|
+
xUnitoAdditionalLoggingContext?: string;
|
|
357
|
+
}, opts?: Oazapfts.RequestOpts): Promise<any>;
|
|
358
|
+
/**
|
|
359
|
+
* Call an integration's graph
|
|
360
|
+
*/
|
|
361
|
+
export declare function postProxyGraph(xUnitoCredentialId: string, path: string, body?: object, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
|
|
362
|
+
xUnitoCorrelationId?: string;
|
|
363
|
+
xUnitoAdditionalLoggingContext?: string;
|
|
364
|
+
}, opts?: Oazapfts.RequestOpts): Promise<any>;
|
|
365
|
+
/**
|
|
366
|
+
* Call an integration's graph
|
|
367
|
+
*/
|
|
368
|
+
export declare function deleteProxyGraph(xUnitoCredentialId: string, path: string, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
|
|
369
|
+
xUnitoCorrelationId?: string;
|
|
370
|
+
xUnitoAdditionalLoggingContext?: string;
|
|
371
|
+
}, opts?: Oazapfts.RequestOpts): Promise<any>;
|
|
372
|
+
/**
|
|
373
|
+
* Get all the users
|
|
374
|
+
*/
|
|
375
|
+
export declare function getUsers({ pagination, }?: {
|
|
376
|
+
pagination?: {
|
|
377
|
+
offset?: number;
|
|
378
|
+
limit?: number;
|
|
379
|
+
};
|
|
380
|
+
}, opts?: Oazapfts.RequestOpts): Promise<Pagination & {
|
|
381
|
+
data: UserSummary[];
|
|
382
|
+
}>;
|
|
383
|
+
/**
|
|
384
|
+
* Create a user
|
|
385
|
+
*/
|
|
386
|
+
export declare function createUser(body: {
|
|
387
|
+
email: string;
|
|
388
|
+
defaultUnitoOrganizationId?: string | null;
|
|
389
|
+
role: UserRole;
|
|
390
|
+
}, opts?: Oazapfts.RequestOpts): Promise<User>;
|
|
391
|
+
/**
|
|
392
|
+
* Get a user
|
|
393
|
+
*/
|
|
394
|
+
export declare function getUserById(userId: number, opts?: Oazapfts.RequestOpts): Promise<User>;
|
|
395
|
+
/**
|
|
396
|
+
* Update a user
|
|
397
|
+
*/
|
|
398
|
+
export declare function updateUser(userId: number, body: {
|
|
399
|
+
email?: string;
|
|
400
|
+
role?: UserRole;
|
|
401
|
+
archived?: boolean;
|
|
402
|
+
defaultUnitoOrganizationId?: string | null;
|
|
403
|
+
}, opts?: Oazapfts.RequestOpts): Promise<User>;
|
|
404
|
+
/**
|
|
405
|
+
* Regenerate the api key of a user
|
|
406
|
+
*/
|
|
407
|
+
export declare function regenerateApiKey(userId: number, opts?: Oazapfts.RequestOpts): Promise<User>;
|
|
408
|
+
/**
|
|
409
|
+
* Get a user by its email address
|
|
410
|
+
*/
|
|
411
|
+
export declare function getUserByEmail(email: string, opts?: Oazapfts.RequestOpts): Promise<User>;
|
|
412
|
+
/**
|
|
413
|
+
* Whether the service is ready to serve requests
|
|
414
|
+
*/
|
|
415
|
+
export declare function getHealthReady(opts?: Oazapfts.RequestOpts): Promise<never>;
|
|
416
|
+
/**
|
|
417
|
+
* Whether the service is responsive
|
|
418
|
+
*/
|
|
419
|
+
export declare function getHealthAlive(opts?: Oazapfts.RequestOpts): Promise<never>;
|
|
420
|
+
import { HttpError } from 'oazapfts';
|
|
421
|
+
export { HttpError };
|
package/dist/src/api.js
ADDED
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.HttpError = exports.getHealthAlive = exports.getHealthReady = exports.getUserByEmail = exports.regenerateApiKey = exports.updateUser = exports.getUserById = exports.createUser = exports.getUsers = exports.deleteProxyGraph = exports.postProxyGraph = exports.patchProxyGraph = exports.getProxyGraph = exports.updateWebhookSubscription = exports.getProxyMe = exports.updateProfile = exports.getProfile = exports.reencryptData = exports.decryptData = exports.encryptData = exports.postTrack = exports.deleteCredential = exports.updateCredential = exports.getCredentialById = exports.createCredential = exports.getCredentials = exports.getIntegrationLogo = exports.getIntegrationEvents = exports.deleteIntegration = exports.updateIntegration = exports.getIntegrationById = exports.inviteUser = exports.getIntegrationByName = exports.publishIntegration = exports.createIntegration = exports.getIntegrations = exports.servers = exports.defaults = void 0;
|
|
27
|
+
/**
|
|
28
|
+
* Integrations Platform API
|
|
29
|
+
* 0.1.0
|
|
30
|
+
* DO NOT MODIFY - This file has been generated using oazapfts.
|
|
31
|
+
* See https://www.npmjs.com/package/oazapfts
|
|
32
|
+
*/
|
|
33
|
+
const Oazapfts = __importStar(require("oazapfts/lib/runtime"));
|
|
34
|
+
const QS = __importStar(require("oazapfts/lib/runtime/query"));
|
|
35
|
+
exports.defaults = {
|
|
36
|
+
baseUrl: 'http://localhost:9000',
|
|
37
|
+
};
|
|
38
|
+
const oazapfts = Oazapfts.runtime(exports.defaults);
|
|
39
|
+
exports.servers = {
|
|
40
|
+
local: 'http://localhost:9000',
|
|
41
|
+
staging: 'https://staging-integrations-platform.unito.io',
|
|
42
|
+
production: 'https://integrations-platform.unito.io',
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Get all the integrations
|
|
46
|
+
*/
|
|
47
|
+
function getIntegrations({ pagination, unitoOrganizationId, search, } = {}, opts) {
|
|
48
|
+
return oazapfts.ok(oazapfts.fetchJson(`/integrations${QS.query(QS.explode({
|
|
49
|
+
pagination,
|
|
50
|
+
unitoOrganizationId,
|
|
51
|
+
search,
|
|
52
|
+
}))}`, {
|
|
53
|
+
...opts,
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
exports.getIntegrations = getIntegrations;
|
|
57
|
+
/**
|
|
58
|
+
* Create an integration
|
|
59
|
+
*/
|
|
60
|
+
function createIntegration(body, opts) {
|
|
61
|
+
return oazapfts.ok(oazapfts.fetchJson('/integrations', oazapfts.json({
|
|
62
|
+
...opts,
|
|
63
|
+
method: 'POST',
|
|
64
|
+
body,
|
|
65
|
+
})));
|
|
66
|
+
}
|
|
67
|
+
exports.createIntegration = createIntegration;
|
|
68
|
+
/**
|
|
69
|
+
* Publish an integration
|
|
70
|
+
*/
|
|
71
|
+
function publishIntegration(body, opts) {
|
|
72
|
+
return oazapfts.ok(oazapfts.fetchJson('/integrations/publish', oazapfts.multipart({
|
|
73
|
+
...opts,
|
|
74
|
+
method: 'POST',
|
|
75
|
+
body,
|
|
76
|
+
})));
|
|
77
|
+
}
|
|
78
|
+
exports.publishIntegration = publishIntegration;
|
|
79
|
+
/**
|
|
80
|
+
* Find an integration by exact name
|
|
81
|
+
*/
|
|
82
|
+
function getIntegrationByName(integrationName, opts) {
|
|
83
|
+
return oazapfts.ok(oazapfts.fetchJson(`/integrations/find/${encodeURIComponent(integrationName)}`, {
|
|
84
|
+
...opts,
|
|
85
|
+
}));
|
|
86
|
+
}
|
|
87
|
+
exports.getIntegrationByName = getIntegrationByName;
|
|
88
|
+
/**
|
|
89
|
+
* Invite a user to an integration
|
|
90
|
+
*/
|
|
91
|
+
function inviteUser(integrationId, body, opts) {
|
|
92
|
+
return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}/users/invite`, oazapfts.json({
|
|
93
|
+
...opts,
|
|
94
|
+
method: 'POST',
|
|
95
|
+
body,
|
|
96
|
+
})));
|
|
97
|
+
}
|
|
98
|
+
exports.inviteUser = inviteUser;
|
|
99
|
+
/**
|
|
100
|
+
* Get an integration
|
|
101
|
+
*/
|
|
102
|
+
function getIntegrationById(integrationId, opts) {
|
|
103
|
+
return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}`, {
|
|
104
|
+
...opts,
|
|
105
|
+
}));
|
|
106
|
+
}
|
|
107
|
+
exports.getIntegrationById = getIntegrationById;
|
|
108
|
+
/**
|
|
109
|
+
* Update an integration
|
|
110
|
+
*/
|
|
111
|
+
function updateIntegration(integrationId, body, opts) {
|
|
112
|
+
return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}`, oazapfts.json({
|
|
113
|
+
...opts,
|
|
114
|
+
method: 'PATCH',
|
|
115
|
+
body,
|
|
116
|
+
})));
|
|
117
|
+
}
|
|
118
|
+
exports.updateIntegration = updateIntegration;
|
|
119
|
+
/**
|
|
120
|
+
* Delete an integration
|
|
121
|
+
*/
|
|
122
|
+
function deleteIntegration(integrationId, name, opts) {
|
|
123
|
+
return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}${QS.query(QS.explode({
|
|
124
|
+
name,
|
|
125
|
+
}))}`, {
|
|
126
|
+
...opts,
|
|
127
|
+
method: 'DELETE',
|
|
128
|
+
}));
|
|
129
|
+
}
|
|
130
|
+
exports.deleteIntegration = deleteIntegration;
|
|
131
|
+
/**
|
|
132
|
+
* Get the events associated with this integration.
|
|
133
|
+
*/
|
|
134
|
+
function getIntegrationEvents(integrationId, opts) {
|
|
135
|
+
return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}/events`, {
|
|
136
|
+
...opts,
|
|
137
|
+
}));
|
|
138
|
+
}
|
|
139
|
+
exports.getIntegrationEvents = getIntegrationEvents;
|
|
140
|
+
/**
|
|
141
|
+
* Get the logo of the integration, in SVG format.
|
|
142
|
+
*/
|
|
143
|
+
function getIntegrationLogo(integrationName, opts) {
|
|
144
|
+
return oazapfts.ok(oazapfts.fetchJson(`/public/${encodeURIComponent(integrationName)}/logo.svg`, {
|
|
145
|
+
...opts,
|
|
146
|
+
}));
|
|
147
|
+
}
|
|
148
|
+
exports.getIntegrationLogo = getIntegrationLogo;
|
|
149
|
+
/**
|
|
150
|
+
* Get all the credentials
|
|
151
|
+
*/
|
|
152
|
+
function getCredentials({ pagination, filters, } = {}, opts) {
|
|
153
|
+
return oazapfts.ok(oazapfts.fetchJson(`/credentials${QS.query(QS.explode({
|
|
154
|
+
pagination,
|
|
155
|
+
filters,
|
|
156
|
+
}))}`, {
|
|
157
|
+
...opts,
|
|
158
|
+
}));
|
|
159
|
+
}
|
|
160
|
+
exports.getCredentials = getCredentials;
|
|
161
|
+
/**
|
|
162
|
+
* Create a credential
|
|
163
|
+
*/
|
|
164
|
+
function createCredential(body, opts) {
|
|
165
|
+
return oazapfts.ok(oazapfts.fetchJson('/credentials', oazapfts.json({
|
|
166
|
+
...opts,
|
|
167
|
+
method: 'POST',
|
|
168
|
+
body,
|
|
169
|
+
})));
|
|
170
|
+
}
|
|
171
|
+
exports.createCredential = createCredential;
|
|
172
|
+
/**
|
|
173
|
+
* Get a credential
|
|
174
|
+
*/
|
|
175
|
+
function getCredentialById(credentialId, opts) {
|
|
176
|
+
return oazapfts.ok(oazapfts.fetchJson(`/credentials/${encodeURIComponent(credentialId)}`, {
|
|
177
|
+
...opts,
|
|
178
|
+
}));
|
|
179
|
+
}
|
|
180
|
+
exports.getCredentialById = getCredentialById;
|
|
181
|
+
/**
|
|
182
|
+
* Update a credential
|
|
183
|
+
*/
|
|
184
|
+
function updateCredential(credentialId, body, opts) {
|
|
185
|
+
return oazapfts.ok(oazapfts.fetchJson(`/credentials/${encodeURIComponent(credentialId)}`, oazapfts.json({
|
|
186
|
+
...opts,
|
|
187
|
+
method: 'PATCH',
|
|
188
|
+
body,
|
|
189
|
+
})));
|
|
190
|
+
}
|
|
191
|
+
exports.updateCredential = updateCredential;
|
|
192
|
+
/**
|
|
193
|
+
* Delete a credential
|
|
194
|
+
*/
|
|
195
|
+
function deleteCredential(credentialId, opts) {
|
|
196
|
+
return oazapfts.ok(oazapfts.fetchJson(`/credentials/${encodeURIComponent(credentialId)}`, {
|
|
197
|
+
...opts,
|
|
198
|
+
method: 'DELETE',
|
|
199
|
+
}));
|
|
200
|
+
}
|
|
201
|
+
exports.deleteCredential = deleteCredential;
|
|
202
|
+
/**
|
|
203
|
+
* Used by the frontend to send analytics data
|
|
204
|
+
*/
|
|
205
|
+
function postTrack(body, opts) {
|
|
206
|
+
return oazapfts.ok(oazapfts.fetchJson('/track', oazapfts.json({
|
|
207
|
+
...opts,
|
|
208
|
+
method: 'POST',
|
|
209
|
+
body,
|
|
210
|
+
})));
|
|
211
|
+
}
|
|
212
|
+
exports.postTrack = postTrack;
|
|
213
|
+
/**
|
|
214
|
+
* Encrypt data
|
|
215
|
+
*/
|
|
216
|
+
function encryptData(body, opts) {
|
|
217
|
+
return oazapfts.ok(oazapfts.fetchJson('/encryptions/encrypt', oazapfts.json({
|
|
218
|
+
...opts,
|
|
219
|
+
method: 'POST',
|
|
220
|
+
body,
|
|
221
|
+
})));
|
|
222
|
+
}
|
|
223
|
+
exports.encryptData = encryptData;
|
|
224
|
+
/**
|
|
225
|
+
* Decrypt data
|
|
226
|
+
*/
|
|
227
|
+
function decryptData(body, opts) {
|
|
228
|
+
return oazapfts.ok(oazapfts.fetchJson('/encryptions/decrypt', oazapfts.json({
|
|
229
|
+
...opts,
|
|
230
|
+
method: 'POST',
|
|
231
|
+
body,
|
|
232
|
+
})));
|
|
233
|
+
}
|
|
234
|
+
exports.decryptData = decryptData;
|
|
235
|
+
/**
|
|
236
|
+
* Decrypt and encrypt data
|
|
237
|
+
*/
|
|
238
|
+
function reencryptData(body, opts) {
|
|
239
|
+
return oazapfts.ok(oazapfts.fetchJson('/encryptions/reencrypt', oazapfts.json({
|
|
240
|
+
...opts,
|
|
241
|
+
method: 'POST',
|
|
242
|
+
body,
|
|
243
|
+
})));
|
|
244
|
+
}
|
|
245
|
+
exports.reencryptData = reencryptData;
|
|
246
|
+
/**
|
|
247
|
+
* Get my profile
|
|
248
|
+
*/
|
|
249
|
+
function getProfile(opts) {
|
|
250
|
+
return oazapfts.ok(oazapfts.fetchJson('/profile', {
|
|
251
|
+
...opts,
|
|
252
|
+
}));
|
|
253
|
+
}
|
|
254
|
+
exports.getProfile = getProfile;
|
|
255
|
+
/**
|
|
256
|
+
* Update my profile
|
|
257
|
+
*/
|
|
258
|
+
function updateProfile(body, opts) {
|
|
259
|
+
return oazapfts.ok(oazapfts.fetchJson('/profile', oazapfts.json({
|
|
260
|
+
...opts,
|
|
261
|
+
method: 'PATCH',
|
|
262
|
+
body,
|
|
263
|
+
})));
|
|
264
|
+
}
|
|
265
|
+
exports.updateProfile = updateProfile;
|
|
266
|
+
/**
|
|
267
|
+
* Call an integration's me
|
|
268
|
+
*/
|
|
269
|
+
function getProxyMe(xUnitoCredentialId, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
|
|
270
|
+
return oazapfts.ok(oazapfts.fetchJson('/proxy/me', {
|
|
271
|
+
...opts,
|
|
272
|
+
headers: {
|
|
273
|
+
...(opts && opts.headers),
|
|
274
|
+
'X-Unito-Credential-Id': xUnitoCredentialId,
|
|
275
|
+
'X-Unito-Correlation-Id': xUnitoCorrelationId,
|
|
276
|
+
'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
|
|
277
|
+
},
|
|
278
|
+
}));
|
|
279
|
+
}
|
|
280
|
+
exports.getProxyMe = getProxyMe;
|
|
281
|
+
/**
|
|
282
|
+
* Update a webhook subscription
|
|
283
|
+
*/
|
|
284
|
+
function updateWebhookSubscription(xUnitoCredentialId, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
|
|
285
|
+
return oazapfts.ok(oazapfts.fetchJson('/proxy/webhooks/subscriptions', oazapfts.json({
|
|
286
|
+
...opts,
|
|
287
|
+
method: 'PUT',
|
|
288
|
+
body,
|
|
289
|
+
headers: {
|
|
290
|
+
...(opts && opts.headers),
|
|
291
|
+
'X-Unito-Credential-Id': xUnitoCredentialId,
|
|
292
|
+
'X-Unito-Correlation-Id': xUnitoCorrelationId,
|
|
293
|
+
'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
|
|
294
|
+
},
|
|
295
|
+
})));
|
|
296
|
+
}
|
|
297
|
+
exports.updateWebhookSubscription = updateWebhookSubscription;
|
|
298
|
+
/**
|
|
299
|
+
* Call an integration's graph
|
|
300
|
+
*/
|
|
301
|
+
function getProxyGraph(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
|
|
302
|
+
return oazapfts.ok(oazapfts.fetchJson(`/proxy/graph${QS.query(QS.explode({
|
|
303
|
+
path,
|
|
304
|
+
}))}`, {
|
|
305
|
+
...opts,
|
|
306
|
+
headers: {
|
|
307
|
+
...(opts && opts.headers),
|
|
308
|
+
'X-Unito-Credential-Id': xUnitoCredentialId,
|
|
309
|
+
'X-Unito-Correlation-Id': xUnitoCorrelationId,
|
|
310
|
+
'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
|
|
311
|
+
},
|
|
312
|
+
}));
|
|
313
|
+
}
|
|
314
|
+
exports.getProxyGraph = getProxyGraph;
|
|
315
|
+
/**
|
|
316
|
+
* Call an integration's graph
|
|
317
|
+
*/
|
|
318
|
+
function patchProxyGraph(xUnitoCredentialId, path, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
|
|
319
|
+
return oazapfts.ok(oazapfts.fetchJson(`/proxy/graph${QS.query(QS.explode({
|
|
320
|
+
path,
|
|
321
|
+
}))}`, oazapfts.json({
|
|
322
|
+
...opts,
|
|
323
|
+
method: 'PATCH',
|
|
324
|
+
body,
|
|
325
|
+
headers: {
|
|
326
|
+
...(opts && opts.headers),
|
|
327
|
+
'X-Unito-Credential-Id': xUnitoCredentialId,
|
|
328
|
+
'X-Unito-Correlation-Id': xUnitoCorrelationId,
|
|
329
|
+
'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
|
|
330
|
+
},
|
|
331
|
+
})));
|
|
332
|
+
}
|
|
333
|
+
exports.patchProxyGraph = patchProxyGraph;
|
|
334
|
+
/**
|
|
335
|
+
* Call an integration's graph
|
|
336
|
+
*/
|
|
337
|
+
function postProxyGraph(xUnitoCredentialId, path, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
|
|
338
|
+
return oazapfts.ok(oazapfts.fetchJson(`/proxy/graph${QS.query(QS.explode({
|
|
339
|
+
path,
|
|
340
|
+
}))}`, oazapfts.json({
|
|
341
|
+
...opts,
|
|
342
|
+
method: 'POST',
|
|
343
|
+
body,
|
|
344
|
+
headers: {
|
|
345
|
+
...(opts && opts.headers),
|
|
346
|
+
'X-Unito-Credential-Id': xUnitoCredentialId,
|
|
347
|
+
'X-Unito-Correlation-Id': xUnitoCorrelationId,
|
|
348
|
+
'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
|
|
349
|
+
},
|
|
350
|
+
})));
|
|
351
|
+
}
|
|
352
|
+
exports.postProxyGraph = postProxyGraph;
|
|
353
|
+
/**
|
|
354
|
+
* Call an integration's graph
|
|
355
|
+
*/
|
|
356
|
+
function deleteProxyGraph(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
|
|
357
|
+
return oazapfts.ok(oazapfts.fetchJson(`/proxy/graph${QS.query(QS.explode({
|
|
358
|
+
path,
|
|
359
|
+
}))}`, {
|
|
360
|
+
...opts,
|
|
361
|
+
method: 'DELETE',
|
|
362
|
+
headers: {
|
|
363
|
+
...(opts && opts.headers),
|
|
364
|
+
'X-Unito-Credential-Id': xUnitoCredentialId,
|
|
365
|
+
'X-Unito-Correlation-Id': xUnitoCorrelationId,
|
|
366
|
+
'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
|
|
367
|
+
},
|
|
368
|
+
}));
|
|
369
|
+
}
|
|
370
|
+
exports.deleteProxyGraph = deleteProxyGraph;
|
|
371
|
+
/**
|
|
372
|
+
* Get all the users
|
|
373
|
+
*/
|
|
374
|
+
function getUsers({ pagination, } = {}, opts) {
|
|
375
|
+
return oazapfts.ok(oazapfts.fetchJson(`/users${QS.query(QS.explode({
|
|
376
|
+
pagination,
|
|
377
|
+
}))}`, {
|
|
378
|
+
...opts,
|
|
379
|
+
}));
|
|
380
|
+
}
|
|
381
|
+
exports.getUsers = getUsers;
|
|
382
|
+
/**
|
|
383
|
+
* Create a user
|
|
384
|
+
*/
|
|
385
|
+
function createUser(body, opts) {
|
|
386
|
+
return oazapfts.ok(oazapfts.fetchJson('/users', oazapfts.json({
|
|
387
|
+
...opts,
|
|
388
|
+
method: 'POST',
|
|
389
|
+
body,
|
|
390
|
+
})));
|
|
391
|
+
}
|
|
392
|
+
exports.createUser = createUser;
|
|
393
|
+
/**
|
|
394
|
+
* Get a user
|
|
395
|
+
*/
|
|
396
|
+
function getUserById(userId, opts) {
|
|
397
|
+
return oazapfts.ok(oazapfts.fetchJson(`/users/${encodeURIComponent(userId)}`, {
|
|
398
|
+
...opts,
|
|
399
|
+
}));
|
|
400
|
+
}
|
|
401
|
+
exports.getUserById = getUserById;
|
|
402
|
+
/**
|
|
403
|
+
* Update a user
|
|
404
|
+
*/
|
|
405
|
+
function updateUser(userId, body, opts) {
|
|
406
|
+
return oazapfts.ok(oazapfts.fetchJson(`/users/${encodeURIComponent(userId)}`, oazapfts.json({
|
|
407
|
+
...opts,
|
|
408
|
+
method: 'PATCH',
|
|
409
|
+
body,
|
|
410
|
+
})));
|
|
411
|
+
}
|
|
412
|
+
exports.updateUser = updateUser;
|
|
413
|
+
/**
|
|
414
|
+
* Regenerate the api key of a user
|
|
415
|
+
*/
|
|
416
|
+
function regenerateApiKey(userId, opts) {
|
|
417
|
+
return oazapfts.ok(oazapfts.fetchJson(`/users/${encodeURIComponent(userId)}/apiKey`, {
|
|
418
|
+
...opts,
|
|
419
|
+
method: 'POST',
|
|
420
|
+
}));
|
|
421
|
+
}
|
|
422
|
+
exports.regenerateApiKey = regenerateApiKey;
|
|
423
|
+
/**
|
|
424
|
+
* Get a user by its email address
|
|
425
|
+
*/
|
|
426
|
+
function getUserByEmail(email, opts) {
|
|
427
|
+
return oazapfts.ok(oazapfts.fetchJson(`/users/find/${encodeURIComponent(email)}`, {
|
|
428
|
+
...opts,
|
|
429
|
+
}));
|
|
430
|
+
}
|
|
431
|
+
exports.getUserByEmail = getUserByEmail;
|
|
432
|
+
/**
|
|
433
|
+
* Whether the service is ready to serve requests
|
|
434
|
+
*/
|
|
435
|
+
function getHealthReady(opts) {
|
|
436
|
+
return oazapfts.ok(oazapfts.fetchText('/health/ready', {
|
|
437
|
+
...opts,
|
|
438
|
+
}));
|
|
439
|
+
}
|
|
440
|
+
exports.getHealthReady = getHealthReady;
|
|
441
|
+
/**
|
|
442
|
+
* Whether the service is responsive
|
|
443
|
+
*/
|
|
444
|
+
function getHealthAlive(opts) {
|
|
445
|
+
return oazapfts.ok(oazapfts.fetchText('/health/alive', {
|
|
446
|
+
...opts,
|
|
447
|
+
}));
|
|
448
|
+
}
|
|
449
|
+
exports.getHealthAlive = getHealthAlive;
|
|
450
|
+
const oazapfts_1 = require("oazapfts");
|
|
451
|
+
Object.defineProperty(exports, "HttpError", { enumerable: true, get: function () { return oazapfts_1.HttpError; } });
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const api = __importStar(require("./api"));
|
|
27
|
+
exports.default = api;
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@unito/integrations-platform-client",
|
|
3
|
+
"version": "0.44.3",
|
|
4
|
+
"description": "The Unito Integrations Platform Client",
|
|
5
|
+
"type": "commonjs",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=18",
|
|
8
|
+
"npm": ">=9.5.0"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"prepublishOnly": "npm run lint && npm run test",
|
|
12
|
+
"prepare": "npm run compile",
|
|
13
|
+
"lint": "eslint --fix src test --ext .ts && prettier --write src test",
|
|
14
|
+
"compile": "tsc",
|
|
15
|
+
"compile:watch": "tsc --watch",
|
|
16
|
+
"test": "NODE_ENV=test ts-mocha -p tsconfig.json test/**/*.test.ts",
|
|
17
|
+
"test:debug": "NODE_ENV=test ts-mocha -p tsconfig.json --inspect-brk test/**/*.test.ts",
|
|
18
|
+
"ci:test": "nyc npm run test"
|
|
19
|
+
},
|
|
20
|
+
"author": {
|
|
21
|
+
"name": "Unito",
|
|
22
|
+
"email": "hello@unito.io"
|
|
23
|
+
},
|
|
24
|
+
"license": "LicenseRef-LICENSE",
|
|
25
|
+
"main": "dist/src/index.js",
|
|
26
|
+
"files": [
|
|
27
|
+
"dist/src/**/*"
|
|
28
|
+
],
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/chai": "4.x",
|
|
31
|
+
"@types/mocha": "10.x",
|
|
32
|
+
"@types/node": "18.x",
|
|
33
|
+
"@types/node-fetch": "2.x",
|
|
34
|
+
"@types/prettier": "2.x",
|
|
35
|
+
"@types/sinon": "10.x",
|
|
36
|
+
"@typescript-eslint/eslint-plugin": "6.x",
|
|
37
|
+
"@typescript-eslint/parser": "6.x",
|
|
38
|
+
"chai": "4.x",
|
|
39
|
+
"eslint": "8.x",
|
|
40
|
+
"mocha": "10.x",
|
|
41
|
+
"nyc": "15.x",
|
|
42
|
+
"prettier": "3.x",
|
|
43
|
+
"sinon": "16.x",
|
|
44
|
+
"ts-mocha": "10.x",
|
|
45
|
+
"ts-node": "10.x",
|
|
46
|
+
"typescript": "5.x"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"node-fetch": "2.x",
|
|
50
|
+
"oazapfts": "4.9.x"
|
|
51
|
+
}
|
|
52
|
+
}
|