@unito/integrations-platform-client 0.48.3 → 1.0.0

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/dist/src/api.js CHANGED
@@ -20,248 +20,248 @@ export const servers = {
20
20
  * Get all the integrations
21
21
  */
22
22
  export function getIntegrations({ pagination, unitoOrganizationId, search, } = {}, opts) {
23
- return oazapfts.ok(oazapfts.fetchJson(`/integrations${QS.query(QS.explode({
23
+ return oazapfts.fetchJson(`/integrations${QS.query(QS.explode({
24
24
  pagination,
25
25
  unitoOrganizationId,
26
26
  search,
27
27
  }))}`, {
28
28
  ...opts,
29
- }));
29
+ });
30
30
  }
31
31
  /**
32
32
  * Create an integration
33
33
  */
34
34
  export function createIntegration(body, opts) {
35
- return oazapfts.ok(oazapfts.fetchJson('/integrations', oazapfts.json({
35
+ return oazapfts.fetchJson('/integrations', oazapfts.json({
36
36
  ...opts,
37
37
  method: 'POST',
38
38
  body,
39
- })));
39
+ }));
40
40
  }
41
41
  /**
42
42
  * Publish an integration
43
43
  */
44
44
  export function publishIntegration(body, opts) {
45
- return oazapfts.ok(oazapfts.fetchJson('/integrations/publish', oazapfts.multipart({
45
+ return oazapfts.fetchJson('/integrations/publish', oazapfts.multipart({
46
46
  ...opts,
47
47
  method: 'POST',
48
48
  body,
49
- })));
49
+ }));
50
50
  }
51
51
  /**
52
52
  * Find an integration by exact name
53
53
  */
54
54
  export function getIntegrationByName(integrationName, opts) {
55
- return oazapfts.ok(oazapfts.fetchJson(`/integrations/find/${encodeURIComponent(integrationName)}`, {
55
+ return oazapfts.fetchJson(`/integrations/find/${encodeURIComponent(integrationName)}`, {
56
56
  ...opts,
57
- }));
57
+ });
58
58
  }
59
59
  /**
60
60
  * Invite a user to an integration
61
61
  */
62
62
  export function inviteUser(integrationId, body, opts) {
63
- return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}/users/invite`, oazapfts.json({
63
+ return oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}/users/invite`, oazapfts.json({
64
64
  ...opts,
65
65
  method: 'POST',
66
66
  body,
67
- })));
67
+ }));
68
68
  }
69
69
  /**
70
70
  * Invite a unito organization to an integration
71
71
  */
72
72
  export function inviteOrganization(integrationId, body, opts) {
73
- return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}/organizations/invite`, oazapfts.json({
73
+ return oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}/organizations/invite`, oazapfts.json({
74
74
  ...opts,
75
75
  method: 'POST',
76
76
  body,
77
- })));
77
+ }));
78
78
  }
79
79
  /**
80
80
  * Get an integration
81
81
  */
82
82
  export function getIntegrationById(integrationId, opts) {
83
- return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}`, {
83
+ return oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}`, {
84
84
  ...opts,
85
- }));
85
+ });
86
86
  }
87
87
  /**
88
88
  * Update an integration
89
89
  */
90
90
  export function updateIntegration(integrationId, body, opts) {
91
- return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}`, oazapfts.json({
91
+ return oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}`, oazapfts.json({
92
92
  ...opts,
93
93
  method: 'PATCH',
94
94
  body,
95
- })));
95
+ }));
96
96
  }
97
97
  /**
98
98
  * Delete an integration
99
99
  */
100
100
  export function deleteIntegration(integrationId, name, opts) {
101
- return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}${QS.query(QS.explode({
101
+ return oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}${QS.query(QS.explode({
102
102
  name,
103
103
  }))}`, {
104
104
  ...opts,
105
105
  method: 'DELETE',
106
- }));
106
+ });
107
107
  }
108
108
  /**
109
109
  * Get the events associated with this integration.
110
110
  */
111
111
  export function getIntegrationEvents(integrationId, { search, $from, limit, } = {}, opts) {
112
- return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}/events${QS.query(QS.explode({
112
+ return oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}/events${QS.query(QS.explode({
113
113
  search,
114
114
  from: $from,
115
115
  limit,
116
116
  }))}`, {
117
117
  ...opts,
118
- }));
118
+ });
119
119
  }
120
120
  /**
121
121
  * Get the logo of the integration, in SVG format.
122
122
  */
123
123
  export function getIntegrationLogo(integrationName, opts) {
124
- return oazapfts.ok(oazapfts.fetchJson(`/public/${encodeURIComponent(integrationName)}/logo.svg`, {
124
+ return oazapfts.fetchJson(`/public/${encodeURIComponent(integrationName)}/logo.svg`, {
125
125
  ...opts,
126
- }));
126
+ });
127
127
  }
128
128
  /**
129
129
  * Get all the credentials
130
130
  */
131
131
  export function getCredentials({ pagination, filters, } = {}, opts) {
132
- return oazapfts.ok(oazapfts.fetchJson(`/credentials${QS.query(QS.explode({
132
+ return oazapfts.fetchJson(`/credentials${QS.query(QS.explode({
133
133
  pagination,
134
134
  filters,
135
135
  }))}`, {
136
136
  ...opts,
137
- }));
137
+ });
138
138
  }
139
139
  /**
140
140
  * Create a credential
141
141
  */
142
142
  export function createCredential(body, opts) {
143
- return oazapfts.ok(oazapfts.fetchJson('/credentials', oazapfts.json({
143
+ return oazapfts.fetchJson('/credentials', oazapfts.json({
144
144
  ...opts,
145
145
  method: 'POST',
146
146
  body,
147
- })));
147
+ }));
148
148
  }
149
149
  /**
150
150
  * Get a credential
151
151
  */
152
152
  export function getCredentialById(credentialId, opts) {
153
- return oazapfts.ok(oazapfts.fetchJson(`/credentials/${encodeURIComponent(credentialId)}`, {
153
+ return oazapfts.fetchJson(`/credentials/${encodeURIComponent(credentialId)}`, {
154
154
  ...opts,
155
- }));
155
+ });
156
156
  }
157
157
  /**
158
158
  * Update a credential
159
159
  */
160
160
  export function updateCredential(credentialId, body, opts) {
161
- return oazapfts.ok(oazapfts.fetchJson(`/credentials/${encodeURIComponent(credentialId)}`, oazapfts.json({
161
+ return oazapfts.fetchJson(`/credentials/${encodeURIComponent(credentialId)}`, oazapfts.json({
162
162
  ...opts,
163
163
  method: 'PATCH',
164
164
  body,
165
- })));
165
+ }));
166
166
  }
167
167
  /**
168
168
  * Delete a credential
169
169
  */
170
170
  export function deleteCredential(credentialId, opts) {
171
- return oazapfts.ok(oazapfts.fetchJson(`/credentials/${encodeURIComponent(credentialId)}`, {
171
+ return oazapfts.fetchJson(`/credentials/${encodeURIComponent(credentialId)}`, {
172
172
  ...opts,
173
173
  method: 'DELETE',
174
- }));
174
+ });
175
175
  }
176
176
  /**
177
177
  * Returns the credentialAccount either from the integration's /me endpoint, if available, or the credential's latestCredentialAccount
178
178
  */
179
179
  export function getCredentialAccount(xUnitoCredentialId, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
180
- return oazapfts.ok(oazapfts.fetchJson('/credentialAccount', {
180
+ return oazapfts.fetchJson('/credentialAccount', {
181
181
  ...opts,
182
182
  headers: oazapfts.mergeHeaders(opts?.headers, {
183
183
  'X-Unito-Credential-Id': xUnitoCredentialId,
184
184
  'X-Unito-Correlation-Id': xUnitoCorrelationId,
185
185
  'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
186
186
  }),
187
- }));
187
+ });
188
188
  }
189
189
  /**
190
190
  * Used by the frontend to send analytics data
191
191
  */
192
192
  export function postTrack(body, opts) {
193
- return oazapfts.ok(oazapfts.fetchJson('/track', oazapfts.json({
193
+ return oazapfts.fetchJson('/track', oazapfts.json({
194
194
  ...opts,
195
195
  method: 'POST',
196
196
  body,
197
- })));
197
+ }));
198
198
  }
199
199
  /**
200
200
  * Encrypt data
201
201
  */
202
202
  export function encryptData(body, opts) {
203
- return oazapfts.ok(oazapfts.fetchJson('/encryptions/encrypt', oazapfts.json({
203
+ return oazapfts.fetchJson('/encryptions/encrypt', oazapfts.json({
204
204
  ...opts,
205
205
  method: 'POST',
206
206
  body,
207
- })));
207
+ }));
208
208
  }
209
209
  /**
210
210
  * Decrypt data
211
211
  */
212
212
  export function decryptData(body, opts) {
213
- return oazapfts.ok(oazapfts.fetchJson('/encryptions/decrypt', oazapfts.json({
213
+ return oazapfts.fetchJson('/encryptions/decrypt', oazapfts.json({
214
214
  ...opts,
215
215
  method: 'POST',
216
216
  body,
217
- })));
217
+ }));
218
218
  }
219
219
  /**
220
220
  * Decrypt and encrypt data
221
221
  */
222
222
  export function reencryptData(body, opts) {
223
- return oazapfts.ok(oazapfts.fetchJson('/encryptions/reencrypt', oazapfts.json({
223
+ return oazapfts.fetchJson('/encryptions/reencrypt', oazapfts.json({
224
224
  ...opts,
225
225
  method: 'POST',
226
226
  body,
227
- })));
227
+ }));
228
228
  }
229
229
  /**
230
230
  * Get my profile
231
231
  */
232
232
  export function getProfile(opts) {
233
- return oazapfts.ok(oazapfts.fetchJson('/profile', {
233
+ return oazapfts.fetchJson('/profile', {
234
234
  ...opts,
235
- }));
235
+ });
236
236
  }
237
237
  /**
238
238
  * Update my profile
239
239
  */
240
240
  export function updateProfile(body, opts) {
241
- return oazapfts.ok(oazapfts.fetchJson('/profile', oazapfts.json({
241
+ return oazapfts.fetchJson('/profile', oazapfts.json({
242
242
  ...opts,
243
243
  method: 'PATCH',
244
244
  body,
245
- })));
245
+ }));
246
246
  }
247
247
  /**
248
248
  * Call an integration's me
249
249
  */
250
250
  export function getProxyMe(xUnitoCredentialId, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
251
- return oazapfts.ok(oazapfts.fetchJson('/proxy/me', {
251
+ return oazapfts.fetchJson('/proxy/me', {
252
252
  ...opts,
253
253
  headers: oazapfts.mergeHeaders(opts?.headers, {
254
254
  'X-Unito-Credential-Id': xUnitoCredentialId,
255
255
  'X-Unito-Correlation-Id': xUnitoCorrelationId,
256
256
  'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
257
257
  }),
258
- }));
258
+ });
259
259
  }
260
260
  /**
261
261
  * Update a webhook subscription
262
262
  */
263
263
  export function updateWebhookSubscription(xUnitoCredentialId, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
264
- return oazapfts.ok(oazapfts.fetchJson('/proxy/webhooks/subscriptions', oazapfts.json({
264
+ return oazapfts.fetchJson('/proxy/webhooks/subscriptions', oazapfts.json({
265
265
  ...opts,
266
266
  method: 'PUT',
267
267
  body,
@@ -270,13 +270,13 @@ export function updateWebhookSubscription(xUnitoCredentialId, body, { xUnitoCorr
270
270
  'X-Unito-Correlation-Id': xUnitoCorrelationId,
271
271
  'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
272
272
  }),
273
- })));
273
+ }));
274
274
  }
275
275
  /**
276
276
  * Call an integration's graph
277
277
  */
278
- export function getProxyGraph(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
279
- return oazapfts.ok(oazapfts.fetchJson(`/proxy/graph${QS.query(QS.explode({
278
+ export function getProxyGraph(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, accept, } = {}, opts) {
279
+ return oazapfts.fetchJson(`/proxy/graph${QS.query(QS.explode({
280
280
  path,
281
281
  }))}`, {
282
282
  ...opts,
@@ -284,14 +284,15 @@ export function getProxyGraph(xUnitoCredentialId, path, { xUnitoCorrelationId, x
284
284
  'X-Unito-Credential-Id': xUnitoCredentialId,
285
285
  'X-Unito-Correlation-Id': xUnitoCorrelationId,
286
286
  'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
287
+ Accept: accept,
287
288
  }),
288
- }));
289
+ });
289
290
  }
290
291
  /**
291
292
  * Call an integration's graph
292
293
  */
293
- export function patchProxyGraph(xUnitoCredentialId, path, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
294
- return oazapfts.ok(oazapfts.fetchJson(`/proxy/graph${QS.query(QS.explode({
294
+ export function patchProxyGraph(xUnitoCredentialId, path, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, contentType, } = {}, opts) {
295
+ return oazapfts.fetchJson(`/proxy/graph${QS.query(QS.explode({
295
296
  path,
296
297
  }))}`, oazapfts.json({
297
298
  ...opts,
@@ -301,14 +302,15 @@ export function patchProxyGraph(xUnitoCredentialId, path, body, { xUnitoCorrelat
301
302
  'X-Unito-Credential-Id': xUnitoCredentialId,
302
303
  'X-Unito-Correlation-Id': xUnitoCorrelationId,
303
304
  'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
305
+ 'Content-Type': contentType,
304
306
  }),
305
- })));
307
+ }));
306
308
  }
307
309
  /**
308
310
  * Call an integration's graph
309
311
  */
310
- export function postProxyGraph(xUnitoCredentialId, path, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
311
- return oazapfts.ok(oazapfts.fetchJson(`/proxy/graph${QS.query(QS.explode({
312
+ export function postProxyGraph(xUnitoCredentialId, path, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, contentType, } = {}, opts) {
313
+ return oazapfts.fetchJson(`/proxy/graph${QS.query(QS.explode({
312
314
  path,
313
315
  }))}`, oazapfts.json({
314
316
  ...opts,
@@ -318,14 +320,15 @@ export function postProxyGraph(xUnitoCredentialId, path, body, { xUnitoCorrelati
318
320
  'X-Unito-Credential-Id': xUnitoCredentialId,
319
321
  'X-Unito-Correlation-Id': xUnitoCorrelationId,
320
322
  'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
323
+ 'Content-Type': contentType,
321
324
  }),
322
- })));
325
+ }));
323
326
  }
324
327
  /**
325
328
  * Call an integration's graph
326
329
  */
327
330
  export function deleteProxyGraph(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
328
- return oazapfts.ok(oazapfts.fetchJson(`/proxy/graph${QS.query(QS.explode({
331
+ return oazapfts.fetchJson(`/proxy/graph${QS.query(QS.explode({
329
332
  path,
330
333
  }))}`, {
331
334
  ...opts,
@@ -335,62 +338,60 @@ export function deleteProxyGraph(xUnitoCredentialId, path, { xUnitoCorrelationId
335
338
  'X-Unito-Correlation-Id': xUnitoCorrelationId,
336
339
  'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
337
340
  }),
338
- }));
341
+ });
339
342
  }
340
343
  /**
341
344
  * Get all the users
342
345
  */
343
346
  export function getUsers({ pagination, } = {}, opts) {
344
- return oazapfts.ok(oazapfts.fetchJson(`/users${QS.query(QS.explode({
347
+ return oazapfts.fetchJson(`/users${QS.query(QS.explode({
345
348
  pagination,
346
349
  }))}`, {
347
350
  ...opts,
348
- }));
351
+ });
349
352
  }
350
353
  /**
351
354
  * Create a user
352
355
  */
353
356
  export function createUser(body, opts) {
354
- return oazapfts.ok(oazapfts.fetchJson('/users', oazapfts.json({
357
+ return oazapfts.fetchJson('/users', oazapfts.json({
355
358
  ...opts,
356
359
  method: 'POST',
357
360
  body,
358
- })));
361
+ }));
359
362
  }
360
363
  /**
361
364
  * Get a user
362
365
  */
363
366
  export function getUserById(userId, opts) {
364
- return oazapfts.ok(oazapfts.fetchJson(`/users/${encodeURIComponent(userId)}`, {
367
+ return oazapfts.fetchJson(`/users/${encodeURIComponent(userId)}`, {
365
368
  ...opts,
366
- }));
369
+ });
367
370
  }
368
371
  /**
369
372
  * Update a user
370
373
  */
371
374
  export function updateUser(userId, body, opts) {
372
- return oazapfts.ok(oazapfts.fetchJson(`/users/${encodeURIComponent(userId)}`, oazapfts.json({
375
+ return oazapfts.fetchJson(`/users/${encodeURIComponent(userId)}`, oazapfts.json({
373
376
  ...opts,
374
377
  method: 'PATCH',
375
378
  body,
376
- })));
379
+ }));
377
380
  }
378
381
  /**
379
382
  * Regenerate the api key of a user
380
383
  */
381
384
  export function regenerateApiKey(userId, opts) {
382
- return oazapfts.ok(oazapfts.fetchJson(`/users/${encodeURIComponent(userId)}/apiKey`, {
385
+ return oazapfts.fetchJson(`/users/${encodeURIComponent(userId)}/apiKey`, {
383
386
  ...opts,
384
387
  method: 'POST',
385
- }));
388
+ });
386
389
  }
387
390
  /**
388
391
  * Get a user by its email address
389
392
  */
390
393
  export function getUserByEmail(email, opts) {
391
- return oazapfts.ok(oazapfts.fetchJson(`/users/find/${encodeURIComponent(email)}`, {
394
+ return oazapfts.fetchJson(`/users/find/${encodeURIComponent(email)}`, {
392
395
  ...opts,
393
- }));
396
+ });
394
397
  }
395
- import { HttpError } from '@oazapfts/runtime';
396
- export { HttpError };