@unito/integration-cli 0.60.0 → 0.60.2

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.
@@ -0,0 +1,502 @@
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/runtime';
8
+ export declare const defaults: Oazapfts.Defaults<Oazapfts.CustomHeaders>;
9
+ export declare const servers: {
10
+ local: string;
11
+ staging: string;
12
+ production: string;
13
+ };
14
+ export type Pagination = {
15
+ /** The total number of results. */
16
+ total: number;
17
+ };
18
+ export type Base = {
19
+ createdAt: string;
20
+ updatedAt: string;
21
+ archivedAt: string | null;
22
+ };
23
+ export type IntegrationSummary = Base & {
24
+ /** The id of the integration. */
25
+ id: number;
26
+ /** The name of the integration. */
27
+ name: string;
28
+ /** The base URL where the integration is located. */
29
+ baseUrl: string | null;
30
+ /** The relative URL (to the baseUrl) where the graph of items of the integration is located. */
31
+ graphRelativeUrl: string;
32
+ /** The relative URL (to the baseUrl) to fetch the current integration's authenticated user. */
33
+ credentialAccountRelativeUrl: string;
34
+ /** The relative URL (to the baseUrl) to parse a webhook payload. */
35
+ webhookParsingRelativeUrl?: string | null;
36
+ /** The relative URL (to the baseUrl) to operate on webhook subscriptions. */
37
+ webhookSubscriptionsRelativeUrl?: string | null;
38
+ /** The relative URL (to the baseUrl) to acknowledge a webhook reception. */
39
+ webhookAcknowledgeRelativeUrl?: string | null;
40
+ /** The visibility of the integration. */
41
+ visibility: 'private' | 'public';
42
+ /** The list of organization ids for which this integration is visibile. */
43
+ unitoOrganizationIds: string[];
44
+ /** The UI-related information of the integration. */
45
+ ui: {
46
+ /** The name of the integration, as it should be displayed in a UI. */
47
+ displayName: string;
48
+ /** The logo of the integration, in SVG format. */
49
+ logo: string | null;
50
+ };
51
+ /** The encrypted secrets of the integration. */
52
+ secrets?: {
53
+ [key: string]: string;
54
+ };
55
+ /** The date at which the integration has been disabled */
56
+ disabledAt?: string | null;
57
+ };
58
+ export type Error = {
59
+ /** The message of the error. */
60
+ message: string;
61
+ /** The details of the error. */
62
+ details?: {
63
+ [key: string]: any;
64
+ };
65
+ /** The stack trace of the error. */
66
+ stack?: string[];
67
+ };
68
+ export type AuthorizationMethod = 'custom' | 'oauth2';
69
+ export type AuthorizationGrantType = 'authorization_code' | 'password' | 'client_credentials';
70
+ export type AuthorizationScope = {
71
+ /** The name of the scope. */
72
+ name: string;
73
+ /** Message to the end-user to explain the usage of the scope by Unito. */
74
+ help?: string;
75
+ };
76
+ export type AuthorizationOAuth2ContentType = 'application/x-www-form-urlencoded' | 'application/json';
77
+ export type AuthorizationOAuth2RequestParameters = {
78
+ /** Extra information to include in the HTTP request headers. */
79
+ header?: {
80
+ [key: string]: string | number | boolean;
81
+ };
82
+ /** Extra information to include in the HTTP request body. */
83
+ body?: {
84
+ [key: string]: string | number | boolean;
85
+ };
86
+ };
87
+ export type AuthorizationOAuth2 = {
88
+ /** The Client Secret obtained from the provider. */
89
+ clientSecret?: string;
90
+ /** The Client Id obtained from the provider. */
91
+ clientId?: string;
92
+ /** The URL to grant or deny access to the user account. */
93
+ authorizationUrl?: string;
94
+ /** The URL to obtain or refresh an access token. */
95
+ tokenUrl: string;
96
+ grantType: AuthorizationGrantType;
97
+ scopes: AuthorizationScope[];
98
+ requestContentType: AuthorizationOAuth2ContentType;
99
+ responseContentType: AuthorizationOAuth2ContentType;
100
+ refreshRequestParameters?: AuthorizationOAuth2RequestParameters;
101
+ tokenRequestParameters?: AuthorizationOAuth2RequestParameters;
102
+ } | null;
103
+ export type AuthorizationVariables = {
104
+ [key: string]: {
105
+ type: 'boolean' | 'number' | 'password' | 'string' | 'text';
106
+ format?: 'uri' | 'email';
107
+ pattern?: string;
108
+ label?: string;
109
+ required?: boolean;
110
+ placeholder?: string;
111
+ defaultValue?: string | number | boolean;
112
+ help?: string;
113
+ documentationUrl?: string;
114
+ };
115
+ };
116
+ export type Authorization = Base & {
117
+ id: number;
118
+ integrationId: number;
119
+ name: string;
120
+ method: AuthorizationMethod;
121
+ oauth2: AuthorizationOAuth2;
122
+ variables: AuthorizationVariables;
123
+ /** The Base64-encoded data URL of an <img> src content. For example: 'data:image/png;base64,<base64>' */
124
+ instructionsImage?: string | null;
125
+ /** A string representing a markdown document. */
126
+ instructionsMarkdown?: string | null;
127
+ };
128
+ export type Integration = IntegrationSummary & {
129
+ /** The authorizations of the integration. */
130
+ authorizations: Authorization[];
131
+ /** The ids of the developers of the integration. */
132
+ userIds: number[];
133
+ };
134
+ export type IntegrationEvent = {
135
+ /** The date at which the event took place. */
136
+ date: string;
137
+ /** The text of the event. */
138
+ text: string;
139
+ /** The tags associated with the event. */
140
+ tags: string[];
141
+ /** The title of the event. */
142
+ title: string;
143
+ };
144
+ export type Credential = Base & {
145
+ /** The id of the credential. */
146
+ id: number;
147
+ /** The id of the integration. */
148
+ integrationId: number;
149
+ /** The name of the integration. */
150
+ integrationName: string;
151
+ /** The id of the authorization. */
152
+ authorizationId: number;
153
+ /** The scope of the credential. */
154
+ scope: 'development' | 'compliance' | 'production' | 'service';
155
+ /** The id of the Unito User for which this credential belongs to. */
156
+ unitoUserId: string | null;
157
+ /** The payload of the credential, which conforms to the schema (ex. variables) of the authorization. */
158
+ payload: {
159
+ [key: string]: any;
160
+ };
161
+ /** The partition used to divide data into different buckets. */
162
+ partitionKey?: string | null;
163
+ };
164
+ export type CredentialAccount = {
165
+ /** The native id of the provider account. */
166
+ id: string;
167
+ /** The display name of the provider account. */
168
+ displayName: string;
169
+ /** The emails associated with the provider account. */
170
+ emails: string[];
171
+ /** The partition used to divide data into different buckets. */
172
+ partition?: string;
173
+ };
174
+ export type UserRole = 'unitoAdministrator' | 'unitoService' | 'developer';
175
+ export type UserSummary = Base & {
176
+ /** The id of the user. */
177
+ id: number;
178
+ /** The email of the user. */
179
+ email: string;
180
+ /** The ID of the organization which will have access to integrations created by this user. */
181
+ defaultUnitoOrganizationId: string | null;
182
+ /** The date & time at which the user accepted the terms & conditions of the SDK. */
183
+ termsAcceptedAt: string | null;
184
+ role: UserRole;
185
+ };
186
+ export type User = UserSummary & {
187
+ /** The API key of the user. */
188
+ apiKey: string;
189
+ };
190
+ /**
191
+ * Get all the integrations
192
+ */
193
+ export declare function getIntegrations({ pagination, unitoOrganizationId, search, }?: {
194
+ pagination?: {
195
+ /** Number of 'first results' to skip */
196
+ offset?: number;
197
+ /** Maximum number of results after the offset */
198
+ limit?: number;
199
+ };
200
+ unitoOrganizationId?: string;
201
+ search?: string;
202
+ }, opts?: Oazapfts.RequestOpts): Promise<Pagination & {
203
+ /** The integrations. */
204
+ data: IntegrationSummary[];
205
+ }>;
206
+ /**
207
+ * Create an integration
208
+ */
209
+ export declare function createIntegration(body?: {
210
+ name: string;
211
+ baseUrl?: string | null;
212
+ graphRelativeUrl?: string | null;
213
+ credentialAccountRelativeUrl?: string | null;
214
+ webhookParsingRelativeUrl?: string | null;
215
+ webhookSubscriptionsRelativeUrl?: string | null;
216
+ webhookAcknowledgeRelativeUrl?: string | null;
217
+ }, opts?: Oazapfts.RequestOpts): Promise<Integration>;
218
+ /**
219
+ * Publish an integration
220
+ */
221
+ export declare function publishIntegration(body?: {
222
+ /** The archive of the integration, including the .unito.json file. */
223
+ file: Blob;
224
+ }, opts?: Oazapfts.RequestOpts): Promise<Integration>;
225
+ /**
226
+ * Find an integration by exact name
227
+ */
228
+ export declare function getIntegrationByName(integrationName: string, opts?: Oazapfts.RequestOpts): Promise<Integration>;
229
+ /**
230
+ * Invite a user to an integration
231
+ */
232
+ export declare function inviteUser(integrationId: number, body?: {
233
+ email?: string;
234
+ }, opts?: Oazapfts.RequestOpts): Promise<unknown>;
235
+ /**
236
+ * Invite a unito organization to an integration
237
+ */
238
+ export declare function inviteOrganization(integrationId: number, body?: {
239
+ unitoOrganizationId?: string;
240
+ }, opts?: Oazapfts.RequestOpts): Promise<Integration>;
241
+ /**
242
+ * Get an integration
243
+ */
244
+ export declare function getIntegrationById(integrationId: number, opts?: Oazapfts.RequestOpts): Promise<Integration>;
245
+ /**
246
+ * Update an integration
247
+ */
248
+ export declare function updateIntegration(integrationId: number, body?: {
249
+ baseUrl?: string | null;
250
+ graphRelativeUrl?: string | null;
251
+ credentialAccountRelativeUrl?: string | null;
252
+ webhookParsingRelativeUrl?: string | null;
253
+ webhookSubscriptionsRelativeUrl?: string | null;
254
+ webhookAcknowledgeRelativeUrl?: string | null;
255
+ authorizations?: {
256
+ id?: number;
257
+ name: string;
258
+ method: AuthorizationMethod;
259
+ oauth2?: AuthorizationOAuth2;
260
+ variables?: AuthorizationVariables;
261
+ archived?: boolean;
262
+ }[];
263
+ userIds?: number[];
264
+ archived?: boolean;
265
+ disabled?: boolean;
266
+ ui?: {
267
+ displayName?: string | null;
268
+ logo?: string | null;
269
+ };
270
+ visibility?: 'private' | 'public';
271
+ unitoOrganizationIds?: string[];
272
+ /** The encrypted secrets of the integration. */
273
+ secrets?: {
274
+ [key: string]: string;
275
+ };
276
+ }, opts?: Oazapfts.RequestOpts): Promise<Integration>;
277
+ /**
278
+ * Delete an integration
279
+ */
280
+ export declare function deleteIntegration(integrationId: number, name: string, opts?: Oazapfts.RequestOpts): Promise<unknown>;
281
+ /**
282
+ * Get the events associated with this integration.
283
+ */
284
+ export declare function getIntegrationEvents(integrationId: number, { search, $from, limit, }?: {
285
+ search?: string;
286
+ $from?: number;
287
+ limit?: number;
288
+ }, opts?: Oazapfts.RequestOpts): Promise<Pagination & {
289
+ /** The integration events. */
290
+ data: IntegrationEvent[];
291
+ }>;
292
+ /**
293
+ * Get the logo of the integration, in SVG format.
294
+ */
295
+ export declare function getIntegrationLogo(integrationName: string, opts?: Oazapfts.RequestOpts): Promise<Blob>;
296
+ /**
297
+ * Get all the credentials
298
+ */
299
+ export declare function getCredentials({ pagination, filters, }?: {
300
+ pagination?: {
301
+ /** Number of 'first results' to skip */
302
+ offset?: number;
303
+ /** Maximum number of results after the offset */
304
+ limit?: number;
305
+ };
306
+ filters?: {
307
+ /** The authorization id of the credential. */
308
+ authorizationId?: number;
309
+ /** The integration id of the credential. */
310
+ integrationId?: number;
311
+ /** List of credential ids. */
312
+ id?: number[];
313
+ /** The scope of the credential. */
314
+ credentialScope?: 'development' | 'compliance' | 'production' | 'service';
315
+ /** The id of the Unito User for which this credential belongs to. */
316
+ unitoUserId?: string;
317
+ /** The id of the credential account for which this credential belongs to. */
318
+ credentialAccountId?: string;
319
+ };
320
+ }, opts?: Oazapfts.RequestOpts): Promise<Pagination & {
321
+ /** The credentials. */
322
+ data: Credential[];
323
+ }>;
324
+ /**
325
+ * Create a credential
326
+ */
327
+ export declare function createCredential(body?: {
328
+ authorizationId: number;
329
+ scope?: 'development' | 'compliance' | 'production' | 'service';
330
+ payload: {
331
+ [key: string]: any;
332
+ };
333
+ unitoUserId?: string;
334
+ credentialAccountId?: string;
335
+ }, opts?: Oazapfts.RequestOpts): Promise<Credential>;
336
+ /**
337
+ * Get a credential
338
+ */
339
+ export declare function getCredentialById(credentialId: number, opts?: Oazapfts.RequestOpts): Promise<Credential>;
340
+ /**
341
+ * Update a credential
342
+ */
343
+ export declare function updateCredential(credentialId: number, body?: {
344
+ payload?: {
345
+ [key: string]: any;
346
+ };
347
+ scope?: 'development' | 'compliance' | 'production' | 'service';
348
+ archived?: boolean;
349
+ unitoUserId?: string;
350
+ credentialAccountId?: string;
351
+ }, opts?: Oazapfts.RequestOpts): Promise<Credential>;
352
+ /**
353
+ * Delete a credential
354
+ */
355
+ export declare function deleteCredential(credentialId: number, opts?: Oazapfts.RequestOpts): Promise<unknown>;
356
+ /**
357
+ * Returns the credentialAccount either from the integration's /me endpoint, if available, or the credential's latestCredentialAccount
358
+ */
359
+ export declare function getCredentialAccount(xUnitoCredentialId: string, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
360
+ xUnitoCorrelationId?: string;
361
+ xUnitoAdditionalLoggingContext?: string;
362
+ }, opts?: Oazapfts.RequestOpts): Promise<CredentialAccount>;
363
+ /**
364
+ * Used by the frontend to send analytics data
365
+ */
366
+ export declare function postTrack(body: {
367
+ jwtToken: string;
368
+ event: 'AUTH_START' | 'AUTH_SUBMIT' | 'AUTH_ACTION' | 'AUTH_BLOCKED' | 'AUTH_CHOOSE_CONNECTION_START' | 'AUTH_CHOOSE_CONNECTION_SUBMIT';
369
+ payload?: {
370
+ [key: string]: any;
371
+ };
372
+ }, opts?: Oazapfts.RequestOpts): Promise<unknown>;
373
+ /**
374
+ * Encrypt data
375
+ */
376
+ export declare function encryptData(body: {
377
+ data: string;
378
+ integrationName: string;
379
+ sensitive?: boolean;
380
+ }, opts?: Oazapfts.RequestOpts): Promise<{
381
+ encryptedData: string;
382
+ }>;
383
+ /**
384
+ * Decrypt data
385
+ */
386
+ export declare function decryptData(body: {
387
+ data: string;
388
+ integrationName: string;
389
+ }, opts?: Oazapfts.RequestOpts): Promise<{
390
+ decryptedData: string;
391
+ }>;
392
+ /**
393
+ * Decrypt and encrypt data
394
+ */
395
+ export declare function reencryptData(body: {
396
+ encryptedData: string;
397
+ integrationName: string;
398
+ newIntegrationName: string;
399
+ }, opts?: Oazapfts.RequestOpts): Promise<{
400
+ encryptedData: string;
401
+ }>;
402
+ /**
403
+ * Get my profile
404
+ */
405
+ export declare function getProfile(opts?: Oazapfts.RequestOpts): Promise<User>;
406
+ /**
407
+ * Update my profile
408
+ */
409
+ export declare function updateProfile(body?: {
410
+ termsAccepted?: boolean;
411
+ }, opts?: Oazapfts.RequestOpts): Promise<User>;
412
+ /**
413
+ * Call an integration's me
414
+ */
415
+ export declare function getProxyMe(xUnitoCredentialId: string, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
416
+ xUnitoCorrelationId?: string;
417
+ xUnitoAdditionalLoggingContext?: string;
418
+ }, opts?: Oazapfts.RequestOpts): Promise<CredentialAccount>;
419
+ /**
420
+ * Update a webhook subscription
421
+ */
422
+ export declare function updateWebhookSubscription(xUnitoCredentialId: string, body: {
423
+ itemPath: string;
424
+ targetUrl: string;
425
+ action: 'start' | 'stop';
426
+ }, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
427
+ xUnitoCorrelationId?: string;
428
+ xUnitoAdditionalLoggingContext?: string;
429
+ }, opts?: Oazapfts.RequestOpts): Promise<unknown>;
430
+ /**
431
+ * Call an integration's graph
432
+ */
433
+ export declare function getProxyGraph(xUnitoCredentialId: string, path: string, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
434
+ xUnitoCorrelationId?: string;
435
+ xUnitoAdditionalLoggingContext?: string;
436
+ }, opts?: Oazapfts.RequestOpts): Promise<any>;
437
+ /**
438
+ * Call an integration's graph
439
+ */
440
+ export declare function patchProxyGraph(xUnitoCredentialId: string, path: string, body?: object, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
441
+ xUnitoCorrelationId?: string;
442
+ xUnitoAdditionalLoggingContext?: string;
443
+ }, opts?: Oazapfts.RequestOpts): Promise<any>;
444
+ /**
445
+ * Call an integration's graph
446
+ */
447
+ export declare function postProxyGraph(xUnitoCredentialId: string, path: string, body?: object, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
448
+ xUnitoCorrelationId?: string;
449
+ xUnitoAdditionalLoggingContext?: string;
450
+ }, opts?: Oazapfts.RequestOpts): Promise<any>;
451
+ /**
452
+ * Call an integration's graph
453
+ */
454
+ export declare function deleteProxyGraph(xUnitoCredentialId: string, path: string, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
455
+ xUnitoCorrelationId?: string;
456
+ xUnitoAdditionalLoggingContext?: string;
457
+ }, opts?: Oazapfts.RequestOpts): Promise<any>;
458
+ /**
459
+ * Get all the users
460
+ */
461
+ export declare function getUsers({ pagination, }?: {
462
+ pagination?: {
463
+ /** Number of 'first results' to skip */
464
+ offset?: number;
465
+ /** Maximum number of results after the offset */
466
+ limit?: number;
467
+ };
468
+ }, opts?: Oazapfts.RequestOpts): Promise<Pagination & {
469
+ /** The users. */
470
+ data: UserSummary[];
471
+ }>;
472
+ /**
473
+ * Create a user
474
+ */
475
+ export declare function createUser(body: {
476
+ email: string;
477
+ defaultUnitoOrganizationId?: string | null;
478
+ role: UserRole;
479
+ }, opts?: Oazapfts.RequestOpts): Promise<User>;
480
+ /**
481
+ * Get a user
482
+ */
483
+ export declare function getUserById(userId: number, opts?: Oazapfts.RequestOpts): Promise<User>;
484
+ /**
485
+ * Update a user
486
+ */
487
+ export declare function updateUser(userId: number, body: {
488
+ email?: string;
489
+ role?: UserRole;
490
+ archived?: boolean;
491
+ defaultUnitoOrganizationId?: string | null;
492
+ }, opts?: Oazapfts.RequestOpts): Promise<User>;
493
+ /**
494
+ * Regenerate the api key of a user
495
+ */
496
+ export declare function regenerateApiKey(userId: number, opts?: Oazapfts.RequestOpts): Promise<User>;
497
+ /**
498
+ * Get a user by its email address
499
+ */
500
+ export declare function getUserByEmail(email: string, opts?: Oazapfts.RequestOpts): Promise<User>;
501
+ import { HttpError } from '@oazapfts/runtime';
502
+ export { HttpError };