@algolia/ingestion 1.17.1 → 1.19.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.
@@ -0,0 +1,1996 @@
1
+ // builds/worker.ts
2
+ import { createMemoryCache, createNullCache, createNullLogger } from "@algolia/client-common";
3
+ import { createFetchRequester } from "@algolia/requester-fetch";
4
+
5
+ // src/ingestionClient.ts
6
+ import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
7
+ var apiClientVersion = "1.19.0";
8
+ var REGIONS = ["eu", "us"];
9
+ function getDefaultHosts(region) {
10
+ const url = "data.{region}.algolia.com".replace("{region}", region);
11
+ return [{ url, accept: "readWrite", protocol: "https" }];
12
+ }
13
+ function isOnDemandTrigger(trigger) {
14
+ return trigger.type === "onDemand";
15
+ }
16
+ function isScheduleTrigger(trigger) {
17
+ return trigger.type === "schedule";
18
+ }
19
+ function isSubscriptionTrigger(trigger) {
20
+ return trigger.type === "subscription";
21
+ }
22
+ function createIngestionClient({
23
+ appId: appIdOption,
24
+ apiKey: apiKeyOption,
25
+ authMode,
26
+ algoliaAgents,
27
+ region: regionOption,
28
+ ...options
29
+ }) {
30
+ const auth = createAuth(appIdOption, apiKeyOption, authMode);
31
+ const transporter = createTransporter({
32
+ hosts: getDefaultHosts(regionOption),
33
+ ...options,
34
+ algoliaAgent: getAlgoliaAgent({
35
+ algoliaAgents,
36
+ client: "Ingestion",
37
+ version: apiClientVersion
38
+ }),
39
+ baseHeaders: {
40
+ "content-type": "text/plain",
41
+ ...auth.headers(),
42
+ ...options.baseHeaders
43
+ },
44
+ baseQueryParameters: {
45
+ ...auth.queryParameters(),
46
+ ...options.baseQueryParameters
47
+ }
48
+ });
49
+ return {
50
+ transporter,
51
+ /**
52
+ * The `appId` currently in use.
53
+ */
54
+ appId: appIdOption,
55
+ /**
56
+ * The `apiKey` currently in use.
57
+ */
58
+ apiKey: apiKeyOption,
59
+ /**
60
+ * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
61
+ */
62
+ clearCache() {
63
+ return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
64
+ },
65
+ /**
66
+ * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
67
+ */
68
+ get _ua() {
69
+ return transporter.algoliaAgent.value;
70
+ },
71
+ /**
72
+ * Adds a `segment` to the `x-algolia-agent` sent with every requests.
73
+ *
74
+ * @param segment - The algolia agent (user-agent) segment to add.
75
+ * @param version - The version of the agent.
76
+ */
77
+ addAlgoliaAgent(segment, version) {
78
+ transporter.algoliaAgent.add({ segment, version });
79
+ },
80
+ /**
81
+ * Helper method to switch the API key used to authenticate the requests.
82
+ *
83
+ * @param params - Method params.
84
+ * @param params.apiKey - The new API Key to use.
85
+ */
86
+ setClientApiKey({ apiKey }) {
87
+ if (!authMode || authMode === "WithinHeaders") {
88
+ transporter.baseHeaders["x-algolia-api-key"] = apiKey;
89
+ } else {
90
+ transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
91
+ }
92
+ },
93
+ /**
94
+ * Creates a new authentication resource.
95
+ *
96
+ * Required API Key ACLs:
97
+ * - addObject
98
+ * - deleteIndex
99
+ * - editSettings
100
+ * @param authenticationCreate -
101
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
102
+ */
103
+ createAuthentication(authenticationCreate, requestOptions) {
104
+ if (!authenticationCreate) {
105
+ throw new Error("Parameter `authenticationCreate` is required when calling `createAuthentication`.");
106
+ }
107
+ if (!authenticationCreate.type) {
108
+ throw new Error("Parameter `authenticationCreate.type` is required when calling `createAuthentication`.");
109
+ }
110
+ if (!authenticationCreate.name) {
111
+ throw new Error("Parameter `authenticationCreate.name` is required when calling `createAuthentication`.");
112
+ }
113
+ if (!authenticationCreate.input) {
114
+ throw new Error("Parameter `authenticationCreate.input` is required when calling `createAuthentication`.");
115
+ }
116
+ const requestPath = "/1/authentications";
117
+ const headers = {};
118
+ const queryParameters = {};
119
+ const request = {
120
+ method: "POST",
121
+ path: requestPath,
122
+ queryParameters,
123
+ headers,
124
+ data: authenticationCreate
125
+ };
126
+ return transporter.request(request, requestOptions);
127
+ },
128
+ /**
129
+ * Creates a new destination.
130
+ *
131
+ * Required API Key ACLs:
132
+ * - addObject
133
+ * - deleteIndex
134
+ * - editSettings
135
+ * @param destinationCreate -
136
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
137
+ */
138
+ createDestination(destinationCreate, requestOptions) {
139
+ if (!destinationCreate) {
140
+ throw new Error("Parameter `destinationCreate` is required when calling `createDestination`.");
141
+ }
142
+ if (!destinationCreate.type) {
143
+ throw new Error("Parameter `destinationCreate.type` is required when calling `createDestination`.");
144
+ }
145
+ if (!destinationCreate.name) {
146
+ throw new Error("Parameter `destinationCreate.name` is required when calling `createDestination`.");
147
+ }
148
+ if (!destinationCreate.input) {
149
+ throw new Error("Parameter `destinationCreate.input` is required when calling `createDestination`.");
150
+ }
151
+ const requestPath = "/1/destinations";
152
+ const headers = {};
153
+ const queryParameters = {};
154
+ const request = {
155
+ method: "POST",
156
+ path: requestPath,
157
+ queryParameters,
158
+ headers,
159
+ data: destinationCreate
160
+ };
161
+ return transporter.request(request, requestOptions);
162
+ },
163
+ /**
164
+ * Creates a new source.
165
+ *
166
+ * Required API Key ACLs:
167
+ * - addObject
168
+ * - deleteIndex
169
+ * - editSettings
170
+ * @param sourceCreate -
171
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
172
+ */
173
+ createSource(sourceCreate, requestOptions) {
174
+ if (!sourceCreate) {
175
+ throw new Error("Parameter `sourceCreate` is required when calling `createSource`.");
176
+ }
177
+ if (!sourceCreate.type) {
178
+ throw new Error("Parameter `sourceCreate.type` is required when calling `createSource`.");
179
+ }
180
+ if (!sourceCreate.name) {
181
+ throw new Error("Parameter `sourceCreate.name` is required when calling `createSource`.");
182
+ }
183
+ const requestPath = "/1/sources";
184
+ const headers = {};
185
+ const queryParameters = {};
186
+ const request = {
187
+ method: "POST",
188
+ path: requestPath,
189
+ queryParameters,
190
+ headers,
191
+ data: sourceCreate
192
+ };
193
+ return transporter.request(request, requestOptions);
194
+ },
195
+ /**
196
+ * Creates a new task.
197
+ * @param taskCreate - Request body for creating a task.
198
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
199
+ */
200
+ createTask(taskCreate, requestOptions) {
201
+ if (!taskCreate) {
202
+ throw new Error("Parameter `taskCreate` is required when calling `createTask`.");
203
+ }
204
+ if (!taskCreate.sourceID) {
205
+ throw new Error("Parameter `taskCreate.sourceID` is required when calling `createTask`.");
206
+ }
207
+ if (!taskCreate.destinationID) {
208
+ throw new Error("Parameter `taskCreate.destinationID` is required when calling `createTask`.");
209
+ }
210
+ if (!taskCreate.action) {
211
+ throw new Error("Parameter `taskCreate.action` is required when calling `createTask`.");
212
+ }
213
+ const requestPath = "/2/tasks";
214
+ const headers = {};
215
+ const queryParameters = {};
216
+ const request = {
217
+ method: "POST",
218
+ path: requestPath,
219
+ queryParameters,
220
+ headers,
221
+ data: taskCreate
222
+ };
223
+ return transporter.request(request, requestOptions);
224
+ },
225
+ /**
226
+ * Creates a new task using the v1 endpoint, please use `createTask` instead.
227
+ * @param taskCreate - Request body for creating a task.
228
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
229
+ */
230
+ createTaskV1(taskCreate, requestOptions) {
231
+ if (!taskCreate) {
232
+ throw new Error("Parameter `taskCreate` is required when calling `createTaskV1`.");
233
+ }
234
+ if (!taskCreate.sourceID) {
235
+ throw new Error("Parameter `taskCreate.sourceID` is required when calling `createTaskV1`.");
236
+ }
237
+ if (!taskCreate.destinationID) {
238
+ throw new Error("Parameter `taskCreate.destinationID` is required when calling `createTaskV1`.");
239
+ }
240
+ if (!taskCreate.trigger) {
241
+ throw new Error("Parameter `taskCreate.trigger` is required when calling `createTaskV1`.");
242
+ }
243
+ if (!taskCreate.action) {
244
+ throw new Error("Parameter `taskCreate.action` is required when calling `createTaskV1`.");
245
+ }
246
+ const requestPath = "/1/tasks";
247
+ const headers = {};
248
+ const queryParameters = {};
249
+ const request = {
250
+ method: "POST",
251
+ path: requestPath,
252
+ queryParameters,
253
+ headers,
254
+ data: taskCreate
255
+ };
256
+ return transporter.request(request, requestOptions);
257
+ },
258
+ /**
259
+ * Creates a new transformation.
260
+ * @param transformationCreate - Request body for creating a transformation.
261
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
262
+ */
263
+ createTransformation(transformationCreate, requestOptions) {
264
+ if (!transformationCreate) {
265
+ throw new Error("Parameter `transformationCreate` is required when calling `createTransformation`.");
266
+ }
267
+ if (!transformationCreate.code) {
268
+ throw new Error("Parameter `transformationCreate.code` is required when calling `createTransformation`.");
269
+ }
270
+ if (!transformationCreate.name) {
271
+ throw new Error("Parameter `transformationCreate.name` is required when calling `createTransformation`.");
272
+ }
273
+ const requestPath = "/1/transformations";
274
+ const headers = {};
275
+ const queryParameters = {};
276
+ const request = {
277
+ method: "POST",
278
+ path: requestPath,
279
+ queryParameters,
280
+ headers,
281
+ data: transformationCreate
282
+ };
283
+ return transporter.request(request, requestOptions);
284
+ },
285
+ /**
286
+ * This method allow you to send requests to the Algolia REST API.
287
+ * @param customDelete - The customDelete object.
288
+ * @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
289
+ * @param customDelete.parameters - Query parameters to apply to the current query.
290
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
291
+ */
292
+ customDelete({ path, parameters }, requestOptions) {
293
+ if (!path) {
294
+ throw new Error("Parameter `path` is required when calling `customDelete`.");
295
+ }
296
+ const requestPath = "/{path}".replace("{path}", path);
297
+ const headers = {};
298
+ const queryParameters = parameters ? parameters : {};
299
+ const request = {
300
+ method: "DELETE",
301
+ path: requestPath,
302
+ queryParameters,
303
+ headers
304
+ };
305
+ return transporter.request(request, requestOptions);
306
+ },
307
+ /**
308
+ * This method allow you to send requests to the Algolia REST API.
309
+ * @param customGet - The customGet object.
310
+ * @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
311
+ * @param customGet.parameters - Query parameters to apply to the current query.
312
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
313
+ */
314
+ customGet({ path, parameters }, requestOptions) {
315
+ if (!path) {
316
+ throw new Error("Parameter `path` is required when calling `customGet`.");
317
+ }
318
+ const requestPath = "/{path}".replace("{path}", path);
319
+ const headers = {};
320
+ const queryParameters = parameters ? parameters : {};
321
+ const request = {
322
+ method: "GET",
323
+ path: requestPath,
324
+ queryParameters,
325
+ headers
326
+ };
327
+ return transporter.request(request, requestOptions);
328
+ },
329
+ /**
330
+ * This method allow you to send requests to the Algolia REST API.
331
+ * @param customPost - The customPost object.
332
+ * @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
333
+ * @param customPost.parameters - Query parameters to apply to the current query.
334
+ * @param customPost.body - Parameters to send with the custom request.
335
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
336
+ */
337
+ customPost({ path, parameters, body }, requestOptions) {
338
+ if (!path) {
339
+ throw new Error("Parameter `path` is required when calling `customPost`.");
340
+ }
341
+ const requestPath = "/{path}".replace("{path}", path);
342
+ const headers = {};
343
+ const queryParameters = parameters ? parameters : {};
344
+ const request = {
345
+ method: "POST",
346
+ path: requestPath,
347
+ queryParameters,
348
+ headers,
349
+ data: body ? body : {}
350
+ };
351
+ return transporter.request(request, requestOptions);
352
+ },
353
+ /**
354
+ * This method allow you to send requests to the Algolia REST API.
355
+ * @param customPut - The customPut object.
356
+ * @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
357
+ * @param customPut.parameters - Query parameters to apply to the current query.
358
+ * @param customPut.body - Parameters to send with the custom request.
359
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
360
+ */
361
+ customPut({ path, parameters, body }, requestOptions) {
362
+ if (!path) {
363
+ throw new Error("Parameter `path` is required when calling `customPut`.");
364
+ }
365
+ const requestPath = "/{path}".replace("{path}", path);
366
+ const headers = {};
367
+ const queryParameters = parameters ? parameters : {};
368
+ const request = {
369
+ method: "PUT",
370
+ path: requestPath,
371
+ queryParameters,
372
+ headers,
373
+ data: body ? body : {}
374
+ };
375
+ return transporter.request(request, requestOptions);
376
+ },
377
+ /**
378
+ * Deletes an authentication resource. You can\'t delete authentication resources that are used by a source or a destination.
379
+ *
380
+ * Required API Key ACLs:
381
+ * - addObject
382
+ * - deleteIndex
383
+ * - editSettings
384
+ * @param deleteAuthentication - The deleteAuthentication object.
385
+ * @param deleteAuthentication.authenticationID - Unique identifier of an authentication resource.
386
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
387
+ */
388
+ deleteAuthentication({ authenticationID }, requestOptions) {
389
+ if (!authenticationID) {
390
+ throw new Error("Parameter `authenticationID` is required when calling `deleteAuthentication`.");
391
+ }
392
+ const requestPath = "/1/authentications/{authenticationID}".replace(
393
+ "{authenticationID}",
394
+ encodeURIComponent(authenticationID)
395
+ );
396
+ const headers = {};
397
+ const queryParameters = {};
398
+ const request = {
399
+ method: "DELETE",
400
+ path: requestPath,
401
+ queryParameters,
402
+ headers
403
+ };
404
+ return transporter.request(request, requestOptions);
405
+ },
406
+ /**
407
+ * Deletes a destination by its ID. You can\'t delete destinations that are referenced in tasks.
408
+ *
409
+ * Required API Key ACLs:
410
+ * - addObject
411
+ * - deleteIndex
412
+ * - editSettings
413
+ * @param deleteDestination - The deleteDestination object.
414
+ * @param deleteDestination.destinationID - Unique identifier of a destination.
415
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
416
+ */
417
+ deleteDestination({ destinationID }, requestOptions) {
418
+ if (!destinationID) {
419
+ throw new Error("Parameter `destinationID` is required when calling `deleteDestination`.");
420
+ }
421
+ const requestPath = "/1/destinations/{destinationID}".replace(
422
+ "{destinationID}",
423
+ encodeURIComponent(destinationID)
424
+ );
425
+ const headers = {};
426
+ const queryParameters = {};
427
+ const request = {
428
+ method: "DELETE",
429
+ path: requestPath,
430
+ queryParameters,
431
+ headers
432
+ };
433
+ return transporter.request(request, requestOptions);
434
+ },
435
+ /**
436
+ * Deletes a source by its ID. You can\'t delete sources that are referenced in tasks.
437
+ *
438
+ * Required API Key ACLs:
439
+ * - addObject
440
+ * - deleteIndex
441
+ * - editSettings
442
+ * @param deleteSource - The deleteSource object.
443
+ * @param deleteSource.sourceID - Unique identifier of a source.
444
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
445
+ */
446
+ deleteSource({ sourceID }, requestOptions) {
447
+ if (!sourceID) {
448
+ throw new Error("Parameter `sourceID` is required when calling `deleteSource`.");
449
+ }
450
+ const requestPath = "/1/sources/{sourceID}".replace("{sourceID}", encodeURIComponent(sourceID));
451
+ const headers = {};
452
+ const queryParameters = {};
453
+ const request = {
454
+ method: "DELETE",
455
+ path: requestPath,
456
+ queryParameters,
457
+ headers
458
+ };
459
+ return transporter.request(request, requestOptions);
460
+ },
461
+ /**
462
+ * Deletes a task by its ID.
463
+ * @param deleteTask - The deleteTask object.
464
+ * @param deleteTask.taskID - Unique identifier of a task.
465
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
466
+ */
467
+ deleteTask({ taskID }, requestOptions) {
468
+ if (!taskID) {
469
+ throw new Error("Parameter `taskID` is required when calling `deleteTask`.");
470
+ }
471
+ const requestPath = "/2/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
472
+ const headers = {};
473
+ const queryParameters = {};
474
+ const request = {
475
+ method: "DELETE",
476
+ path: requestPath,
477
+ queryParameters,
478
+ headers
479
+ };
480
+ return transporter.request(request, requestOptions);
481
+ },
482
+ /**
483
+ * Deletes a task by its ID using the v1 endpoint, please use `deleteTask` instead.
484
+ * @param deleteTaskV1 - The deleteTaskV1 object.
485
+ * @param deleteTaskV1.taskID - Unique identifier of a task.
486
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
487
+ */
488
+ deleteTaskV1({ taskID }, requestOptions) {
489
+ if (!taskID) {
490
+ throw new Error("Parameter `taskID` is required when calling `deleteTaskV1`.");
491
+ }
492
+ const requestPath = "/1/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
493
+ const headers = {};
494
+ const queryParameters = {};
495
+ const request = {
496
+ method: "DELETE",
497
+ path: requestPath,
498
+ queryParameters,
499
+ headers
500
+ };
501
+ return transporter.request(request, requestOptions);
502
+ },
503
+ /**
504
+ * Deletes a transformation by its ID.
505
+ * @param deleteTransformation - The deleteTransformation object.
506
+ * @param deleteTransformation.transformationID - Unique identifier of a transformation.
507
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
508
+ */
509
+ deleteTransformation({ transformationID }, requestOptions) {
510
+ if (!transformationID) {
511
+ throw new Error("Parameter `transformationID` is required when calling `deleteTransformation`.");
512
+ }
513
+ const requestPath = "/1/transformations/{transformationID}".replace(
514
+ "{transformationID}",
515
+ encodeURIComponent(transformationID)
516
+ );
517
+ const headers = {};
518
+ const queryParameters = {};
519
+ const request = {
520
+ method: "DELETE",
521
+ path: requestPath,
522
+ queryParameters,
523
+ headers
524
+ };
525
+ return transporter.request(request, requestOptions);
526
+ },
527
+ /**
528
+ * Disables a task.
529
+ *
530
+ * Required API Key ACLs:
531
+ * - addObject
532
+ * - deleteIndex
533
+ * - editSettings
534
+ * @param disableTask - The disableTask object.
535
+ * @param disableTask.taskID - Unique identifier of a task.
536
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
537
+ */
538
+ disableTask({ taskID }, requestOptions) {
539
+ if (!taskID) {
540
+ throw new Error("Parameter `taskID` is required when calling `disableTask`.");
541
+ }
542
+ const requestPath = "/2/tasks/{taskID}/disable".replace("{taskID}", encodeURIComponent(taskID));
543
+ const headers = {};
544
+ const queryParameters = {};
545
+ const request = {
546
+ method: "PUT",
547
+ path: requestPath,
548
+ queryParameters,
549
+ headers
550
+ };
551
+ return transporter.request(request, requestOptions);
552
+ },
553
+ /**
554
+ * Disables a task using the v1 endpoint, please use `disableTask` instead.
555
+ *
556
+ * Required API Key ACLs:
557
+ * - addObject
558
+ * - deleteIndex
559
+ * - editSettings
560
+ * @param disableTaskV1 - The disableTaskV1 object.
561
+ * @param disableTaskV1.taskID - Unique identifier of a task.
562
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
563
+ */
564
+ disableTaskV1({ taskID }, requestOptions) {
565
+ if (!taskID) {
566
+ throw new Error("Parameter `taskID` is required when calling `disableTaskV1`.");
567
+ }
568
+ const requestPath = "/1/tasks/{taskID}/disable".replace("{taskID}", encodeURIComponent(taskID));
569
+ const headers = {};
570
+ const queryParameters = {};
571
+ const request = {
572
+ method: "PUT",
573
+ path: requestPath,
574
+ queryParameters,
575
+ headers
576
+ };
577
+ return transporter.request(request, requestOptions);
578
+ },
579
+ /**
580
+ * Enables a task.
581
+ *
582
+ * Required API Key ACLs:
583
+ * - addObject
584
+ * - deleteIndex
585
+ * - editSettings
586
+ * @param enableTask - The enableTask object.
587
+ * @param enableTask.taskID - Unique identifier of a task.
588
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
589
+ */
590
+ enableTask({ taskID }, requestOptions) {
591
+ if (!taskID) {
592
+ throw new Error("Parameter `taskID` is required when calling `enableTask`.");
593
+ }
594
+ const requestPath = "/2/tasks/{taskID}/enable".replace("{taskID}", encodeURIComponent(taskID));
595
+ const headers = {};
596
+ const queryParameters = {};
597
+ const request = {
598
+ method: "PUT",
599
+ path: requestPath,
600
+ queryParameters,
601
+ headers
602
+ };
603
+ return transporter.request(request, requestOptions);
604
+ },
605
+ /**
606
+ * Enables a task using the v1 endpoint, please use `enableTask` instead.
607
+ *
608
+ * Required API Key ACLs:
609
+ * - addObject
610
+ * - deleteIndex
611
+ * - editSettings
612
+ * @param enableTaskV1 - The enableTaskV1 object.
613
+ * @param enableTaskV1.taskID - Unique identifier of a task.
614
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
615
+ */
616
+ enableTaskV1({ taskID }, requestOptions) {
617
+ if (!taskID) {
618
+ throw new Error("Parameter `taskID` is required when calling `enableTaskV1`.");
619
+ }
620
+ const requestPath = "/1/tasks/{taskID}/enable".replace("{taskID}", encodeURIComponent(taskID));
621
+ const headers = {};
622
+ const queryParameters = {};
623
+ const request = {
624
+ method: "PUT",
625
+ path: requestPath,
626
+ queryParameters,
627
+ headers
628
+ };
629
+ return transporter.request(request, requestOptions);
630
+ },
631
+ /**
632
+ * Retrieves an authentication resource by its ID.
633
+ *
634
+ * Required API Key ACLs:
635
+ * - addObject
636
+ * - deleteIndex
637
+ * - editSettings
638
+ * @param getAuthentication - The getAuthentication object.
639
+ * @param getAuthentication.authenticationID - Unique identifier of an authentication resource.
640
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
641
+ */
642
+ getAuthentication({ authenticationID }, requestOptions) {
643
+ if (!authenticationID) {
644
+ throw new Error("Parameter `authenticationID` is required when calling `getAuthentication`.");
645
+ }
646
+ const requestPath = "/1/authentications/{authenticationID}".replace(
647
+ "{authenticationID}",
648
+ encodeURIComponent(authenticationID)
649
+ );
650
+ const headers = {};
651
+ const queryParameters = {};
652
+ const request = {
653
+ method: "GET",
654
+ path: requestPath,
655
+ queryParameters,
656
+ headers
657
+ };
658
+ return transporter.request(request, requestOptions);
659
+ },
660
+ /**
661
+ * Retrieves a destination by its ID.
662
+ *
663
+ * Required API Key ACLs:
664
+ * - addObject
665
+ * - deleteIndex
666
+ * - editSettings
667
+ * @param getDestination - The getDestination object.
668
+ * @param getDestination.destinationID - Unique identifier of a destination.
669
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
670
+ */
671
+ getDestination({ destinationID }, requestOptions) {
672
+ if (!destinationID) {
673
+ throw new Error("Parameter `destinationID` is required when calling `getDestination`.");
674
+ }
675
+ const requestPath = "/1/destinations/{destinationID}".replace(
676
+ "{destinationID}",
677
+ encodeURIComponent(destinationID)
678
+ );
679
+ const headers = {};
680
+ const queryParameters = {};
681
+ const request = {
682
+ method: "GET",
683
+ path: requestPath,
684
+ queryParameters,
685
+ headers
686
+ };
687
+ return transporter.request(request, requestOptions);
688
+ },
689
+ /**
690
+ * Retrieves a single task run event by its ID.
691
+ *
692
+ * Required API Key ACLs:
693
+ * - addObject
694
+ * - deleteIndex
695
+ * - editSettings
696
+ * @param getEvent - The getEvent object.
697
+ * @param getEvent.runID - Unique identifier of a task run.
698
+ * @param getEvent.eventID - Unique identifier of an event.
699
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
700
+ */
701
+ getEvent({ runID, eventID }, requestOptions) {
702
+ if (!runID) {
703
+ throw new Error("Parameter `runID` is required when calling `getEvent`.");
704
+ }
705
+ if (!eventID) {
706
+ throw new Error("Parameter `eventID` is required when calling `getEvent`.");
707
+ }
708
+ const requestPath = "/1/runs/{runID}/events/{eventID}".replace("{runID}", encodeURIComponent(runID)).replace("{eventID}", encodeURIComponent(eventID));
709
+ const headers = {};
710
+ const queryParameters = {};
711
+ const request = {
712
+ method: "GET",
713
+ path: requestPath,
714
+ queryParameters,
715
+ headers
716
+ };
717
+ return transporter.request(request, requestOptions);
718
+ },
719
+ /**
720
+ * Retrieve a single task run by its ID.
721
+ *
722
+ * Required API Key ACLs:
723
+ * - addObject
724
+ * - deleteIndex
725
+ * - editSettings
726
+ * @param getRun - The getRun object.
727
+ * @param getRun.runID - Unique identifier of a task run.
728
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
729
+ */
730
+ getRun({ runID }, requestOptions) {
731
+ if (!runID) {
732
+ throw new Error("Parameter `runID` is required when calling `getRun`.");
733
+ }
734
+ const requestPath = "/1/runs/{runID}".replace("{runID}", encodeURIComponent(runID));
735
+ const headers = {};
736
+ const queryParameters = {};
737
+ const request = {
738
+ method: "GET",
739
+ path: requestPath,
740
+ queryParameters,
741
+ headers
742
+ };
743
+ return transporter.request(request, requestOptions);
744
+ },
745
+ /**
746
+ * Retrieve a source by its ID.
747
+ *
748
+ * Required API Key ACLs:
749
+ * - addObject
750
+ * - deleteIndex
751
+ * - editSettings
752
+ * @param getSource - The getSource object.
753
+ * @param getSource.sourceID - Unique identifier of a source.
754
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
755
+ */
756
+ getSource({ sourceID }, requestOptions) {
757
+ if (!sourceID) {
758
+ throw new Error("Parameter `sourceID` is required when calling `getSource`.");
759
+ }
760
+ const requestPath = "/1/sources/{sourceID}".replace("{sourceID}", encodeURIComponent(sourceID));
761
+ const headers = {};
762
+ const queryParameters = {};
763
+ const request = {
764
+ method: "GET",
765
+ path: requestPath,
766
+ queryParameters,
767
+ headers
768
+ };
769
+ return transporter.request(request, requestOptions);
770
+ },
771
+ /**
772
+ * Retrieves a task by its ID.
773
+ *
774
+ * Required API Key ACLs:
775
+ * - addObject
776
+ * - deleteIndex
777
+ * - editSettings
778
+ * @param getTask - The getTask object.
779
+ * @param getTask.taskID - Unique identifier of a task.
780
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
781
+ */
782
+ getTask({ taskID }, requestOptions) {
783
+ if (!taskID) {
784
+ throw new Error("Parameter `taskID` is required when calling `getTask`.");
785
+ }
786
+ const requestPath = "/2/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
787
+ const headers = {};
788
+ const queryParameters = {};
789
+ const request = {
790
+ method: "GET",
791
+ path: requestPath,
792
+ queryParameters,
793
+ headers
794
+ };
795
+ return transporter.request(request, requestOptions);
796
+ },
797
+ /**
798
+ * Retrieves a task by its ID using the v1 endpoint, please use `getTask` instead.
799
+ *
800
+ * Required API Key ACLs:
801
+ * - addObject
802
+ * - deleteIndex
803
+ * - editSettings
804
+ * @param getTaskV1 - The getTaskV1 object.
805
+ * @param getTaskV1.taskID - Unique identifier of a task.
806
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
807
+ */
808
+ getTaskV1({ taskID }, requestOptions) {
809
+ if (!taskID) {
810
+ throw new Error("Parameter `taskID` is required when calling `getTaskV1`.");
811
+ }
812
+ const requestPath = "/1/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
813
+ const headers = {};
814
+ const queryParameters = {};
815
+ const request = {
816
+ method: "GET",
817
+ path: requestPath,
818
+ queryParameters,
819
+ headers
820
+ };
821
+ return transporter.request(request, requestOptions);
822
+ },
823
+ /**
824
+ * Retrieves a transformation by its ID.
825
+ *
826
+ * Required API Key ACLs:
827
+ * - addObject
828
+ * - deleteIndex
829
+ * - editSettings
830
+ * @param getTransformation - The getTransformation object.
831
+ * @param getTransformation.transformationID - Unique identifier of a transformation.
832
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
833
+ */
834
+ getTransformation({ transformationID }, requestOptions) {
835
+ if (!transformationID) {
836
+ throw new Error("Parameter `transformationID` is required when calling `getTransformation`.");
837
+ }
838
+ const requestPath = "/1/transformations/{transformationID}".replace(
839
+ "{transformationID}",
840
+ encodeURIComponent(transformationID)
841
+ );
842
+ const headers = {};
843
+ const queryParameters = {};
844
+ const request = {
845
+ method: "GET",
846
+ path: requestPath,
847
+ queryParameters,
848
+ headers
849
+ };
850
+ return transporter.request(request, requestOptions);
851
+ },
852
+ /**
853
+ * Retrieves a list of all authentication resources.
854
+ *
855
+ * Required API Key ACLs:
856
+ * - addObject
857
+ * - deleteIndex
858
+ * - editSettings
859
+ * @param listAuthentications - The listAuthentications object.
860
+ * @param listAuthentications.itemsPerPage - Number of items per page.
861
+ * @param listAuthentications.page - Page number of the paginated API response.
862
+ * @param listAuthentications.type - Type of authentication resource to retrieve.
863
+ * @param listAuthentications.platform - Ecommerce platform for which to retrieve authentications.
864
+ * @param listAuthentications.sort - Property by which to sort the list of authentications.
865
+ * @param listAuthentications.order - Sort order of the response, ascending or descending.
866
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
867
+ */
868
+ listAuthentications({ itemsPerPage, page, type, platform, sort, order } = {}, requestOptions = void 0) {
869
+ const requestPath = "/1/authentications";
870
+ const headers = {};
871
+ const queryParameters = {};
872
+ if (itemsPerPage !== void 0) {
873
+ queryParameters["itemsPerPage"] = itemsPerPage.toString();
874
+ }
875
+ if (page !== void 0) {
876
+ queryParameters["page"] = page.toString();
877
+ }
878
+ if (type !== void 0) {
879
+ queryParameters["type"] = type.toString();
880
+ }
881
+ if (platform !== void 0) {
882
+ queryParameters["platform"] = platform.toString();
883
+ }
884
+ if (sort !== void 0) {
885
+ queryParameters["sort"] = sort.toString();
886
+ }
887
+ if (order !== void 0) {
888
+ queryParameters["order"] = order.toString();
889
+ }
890
+ const request = {
891
+ method: "GET",
892
+ path: requestPath,
893
+ queryParameters,
894
+ headers
895
+ };
896
+ return transporter.request(request, requestOptions);
897
+ },
898
+ /**
899
+ * Retrieves a list of destinations.
900
+ *
901
+ * Required API Key ACLs:
902
+ * - addObject
903
+ * - deleteIndex
904
+ * - editSettings
905
+ * @param listDestinations - The listDestinations object.
906
+ * @param listDestinations.itemsPerPage - Number of items per page.
907
+ * @param listDestinations.page - Page number of the paginated API response.
908
+ * @param listDestinations.type - Destination type.
909
+ * @param listDestinations.authenticationID - Authentication ID used by destinations.
910
+ * @param listDestinations.transformationID - Get the list of destinations used by a transformation.
911
+ * @param listDestinations.sort - Property by which to sort the destinations.
912
+ * @param listDestinations.order - Sort order of the response, ascending or descending.
913
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
914
+ */
915
+ listDestinations({ itemsPerPage, page, type, authenticationID, transformationID, sort, order } = {}, requestOptions = void 0) {
916
+ const requestPath = "/1/destinations";
917
+ const headers = {};
918
+ const queryParameters = {};
919
+ if (itemsPerPage !== void 0) {
920
+ queryParameters["itemsPerPage"] = itemsPerPage.toString();
921
+ }
922
+ if (page !== void 0) {
923
+ queryParameters["page"] = page.toString();
924
+ }
925
+ if (type !== void 0) {
926
+ queryParameters["type"] = type.toString();
927
+ }
928
+ if (authenticationID !== void 0) {
929
+ queryParameters["authenticationID"] = authenticationID.toString();
930
+ }
931
+ if (transformationID !== void 0) {
932
+ queryParameters["transformationID"] = transformationID.toString();
933
+ }
934
+ if (sort !== void 0) {
935
+ queryParameters["sort"] = sort.toString();
936
+ }
937
+ if (order !== void 0) {
938
+ queryParameters["order"] = order.toString();
939
+ }
940
+ const request = {
941
+ method: "GET",
942
+ path: requestPath,
943
+ queryParameters,
944
+ headers
945
+ };
946
+ return transporter.request(request, requestOptions);
947
+ },
948
+ /**
949
+ * Retrieves a list of events for a task run, identified by its ID.
950
+ *
951
+ * Required API Key ACLs:
952
+ * - addObject
953
+ * - deleteIndex
954
+ * - editSettings
955
+ * @param listEvents - The listEvents object.
956
+ * @param listEvents.runID - Unique identifier of a task run.
957
+ * @param listEvents.itemsPerPage - Number of items per page.
958
+ * @param listEvents.page - Page number of the paginated API response.
959
+ * @param listEvents.status - Event status for filtering the list of task runs.
960
+ * @param listEvents.type - Event type for filtering the list of task runs.
961
+ * @param listEvents.sort - Property by which to sort the list of task run events.
962
+ * @param listEvents.order - Sort order of the response, ascending or descending.
963
+ * @param listEvents.startDate - Date and time in RFC 3339 format for the earliest events to retrieve. By default, the current time minus three hours is used.
964
+ * @param listEvents.endDate - Date and time in RFC 3339 format for the latest events to retrieve. By default, the current time is used.
965
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
966
+ */
967
+ listEvents({ runID, itemsPerPage, page, status, type, sort, order, startDate, endDate }, requestOptions) {
968
+ if (!runID) {
969
+ throw new Error("Parameter `runID` is required when calling `listEvents`.");
970
+ }
971
+ const requestPath = "/1/runs/{runID}/events".replace("{runID}", encodeURIComponent(runID));
972
+ const headers = {};
973
+ const queryParameters = {};
974
+ if (itemsPerPage !== void 0) {
975
+ queryParameters["itemsPerPage"] = itemsPerPage.toString();
976
+ }
977
+ if (page !== void 0) {
978
+ queryParameters["page"] = page.toString();
979
+ }
980
+ if (status !== void 0) {
981
+ queryParameters["status"] = status.toString();
982
+ }
983
+ if (type !== void 0) {
984
+ queryParameters["type"] = type.toString();
985
+ }
986
+ if (sort !== void 0) {
987
+ queryParameters["sort"] = sort.toString();
988
+ }
989
+ if (order !== void 0) {
990
+ queryParameters["order"] = order.toString();
991
+ }
992
+ if (startDate !== void 0) {
993
+ queryParameters["startDate"] = startDate.toString();
994
+ }
995
+ if (endDate !== void 0) {
996
+ queryParameters["endDate"] = endDate.toString();
997
+ }
998
+ const request = {
999
+ method: "GET",
1000
+ path: requestPath,
1001
+ queryParameters,
1002
+ headers
1003
+ };
1004
+ return transporter.request(request, requestOptions);
1005
+ },
1006
+ /**
1007
+ * Retrieve a list of task runs.
1008
+ *
1009
+ * Required API Key ACLs:
1010
+ * - addObject
1011
+ * - deleteIndex
1012
+ * - editSettings
1013
+ * @param listRuns - The listRuns object.
1014
+ * @param listRuns.itemsPerPage - Number of items per page.
1015
+ * @param listRuns.page - Page number of the paginated API response.
1016
+ * @param listRuns.status - Run status for filtering the list of task runs.
1017
+ * @param listRuns.type - Run type for filtering the list of task runs.
1018
+ * @param listRuns.taskID - Task ID for filtering the list of task runs.
1019
+ * @param listRuns.sort - Property by which to sort the list of task runs.
1020
+ * @param listRuns.order - Sort order of the response, ascending or descending.
1021
+ * @param listRuns.startDate - Date in RFC 3339 format for the earliest run to retrieve. By default, the current day minus seven days is used.
1022
+ * @param listRuns.endDate - Date in RFC 3339 format for the latest run to retrieve. By default, the current day is used.
1023
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1024
+ */
1025
+ listRuns({ itemsPerPage, page, status, type, taskID, sort, order, startDate, endDate } = {}, requestOptions = void 0) {
1026
+ const requestPath = "/1/runs";
1027
+ const headers = {};
1028
+ const queryParameters = {};
1029
+ if (itemsPerPage !== void 0) {
1030
+ queryParameters["itemsPerPage"] = itemsPerPage.toString();
1031
+ }
1032
+ if (page !== void 0) {
1033
+ queryParameters["page"] = page.toString();
1034
+ }
1035
+ if (status !== void 0) {
1036
+ queryParameters["status"] = status.toString();
1037
+ }
1038
+ if (type !== void 0) {
1039
+ queryParameters["type"] = type.toString();
1040
+ }
1041
+ if (taskID !== void 0) {
1042
+ queryParameters["taskID"] = taskID.toString();
1043
+ }
1044
+ if (sort !== void 0) {
1045
+ queryParameters["sort"] = sort.toString();
1046
+ }
1047
+ if (order !== void 0) {
1048
+ queryParameters["order"] = order.toString();
1049
+ }
1050
+ if (startDate !== void 0) {
1051
+ queryParameters["startDate"] = startDate.toString();
1052
+ }
1053
+ if (endDate !== void 0) {
1054
+ queryParameters["endDate"] = endDate.toString();
1055
+ }
1056
+ const request = {
1057
+ method: "GET",
1058
+ path: requestPath,
1059
+ queryParameters,
1060
+ headers
1061
+ };
1062
+ return transporter.request(request, requestOptions);
1063
+ },
1064
+ /**
1065
+ * Retrieves a list of sources.
1066
+ *
1067
+ * Required API Key ACLs:
1068
+ * - addObject
1069
+ * - deleteIndex
1070
+ * - editSettings
1071
+ * @param listSources - The listSources object.
1072
+ * @param listSources.itemsPerPage - Number of items per page.
1073
+ * @param listSources.page - Page number of the paginated API response.
1074
+ * @param listSources.type - Source type. Some sources require authentication.
1075
+ * @param listSources.authenticationID - Authentication IDs of the sources to retrieve. \'none\' returns sources that doesn\'t have an authentication.
1076
+ * @param listSources.sort - Property by which to sort the list of sources.
1077
+ * @param listSources.order - Sort order of the response, ascending or descending.
1078
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1079
+ */
1080
+ listSources({ itemsPerPage, page, type, authenticationID, sort, order } = {}, requestOptions = void 0) {
1081
+ const requestPath = "/1/sources";
1082
+ const headers = {};
1083
+ const queryParameters = {};
1084
+ if (itemsPerPage !== void 0) {
1085
+ queryParameters["itemsPerPage"] = itemsPerPage.toString();
1086
+ }
1087
+ if (page !== void 0) {
1088
+ queryParameters["page"] = page.toString();
1089
+ }
1090
+ if (type !== void 0) {
1091
+ queryParameters["type"] = type.toString();
1092
+ }
1093
+ if (authenticationID !== void 0) {
1094
+ queryParameters["authenticationID"] = authenticationID.toString();
1095
+ }
1096
+ if (sort !== void 0) {
1097
+ queryParameters["sort"] = sort.toString();
1098
+ }
1099
+ if (order !== void 0) {
1100
+ queryParameters["order"] = order.toString();
1101
+ }
1102
+ const request = {
1103
+ method: "GET",
1104
+ path: requestPath,
1105
+ queryParameters,
1106
+ headers
1107
+ };
1108
+ return transporter.request(request, requestOptions);
1109
+ },
1110
+ /**
1111
+ * Retrieves a list of tasks.
1112
+ *
1113
+ * Required API Key ACLs:
1114
+ * - addObject
1115
+ * - deleteIndex
1116
+ * - editSettings
1117
+ * @param listTasks - The listTasks object.
1118
+ * @param listTasks.itemsPerPage - Number of items per page.
1119
+ * @param listTasks.page - Page number of the paginated API response.
1120
+ * @param listTasks.action - Actions for filtering the list of tasks.
1121
+ * @param listTasks.enabled - Whether to filter the list of tasks by the `enabled` status.
1122
+ * @param listTasks.sourceID - Source IDs for filtering the list of tasks.
1123
+ * @param listTasks.sourceType - Filters the tasks with the specified source type.
1124
+ * @param listTasks.destinationID - Destination IDs for filtering the list of tasks.
1125
+ * @param listTasks.triggerType - Type of task trigger for filtering the list of tasks.
1126
+ * @param listTasks.withEmailNotifications - If specified, the response only includes tasks with notifications.email.enabled set to this value.
1127
+ * @param listTasks.sort - Property by which to sort the list of tasks.
1128
+ * @param listTasks.order - Sort order of the response, ascending or descending.
1129
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1130
+ */
1131
+ listTasks({
1132
+ itemsPerPage,
1133
+ page,
1134
+ action,
1135
+ enabled,
1136
+ sourceID,
1137
+ sourceType,
1138
+ destinationID,
1139
+ triggerType,
1140
+ withEmailNotifications,
1141
+ sort,
1142
+ order
1143
+ } = {}, requestOptions = void 0) {
1144
+ const requestPath = "/2/tasks";
1145
+ const headers = {};
1146
+ const queryParameters = {};
1147
+ if (itemsPerPage !== void 0) {
1148
+ queryParameters["itemsPerPage"] = itemsPerPage.toString();
1149
+ }
1150
+ if (page !== void 0) {
1151
+ queryParameters["page"] = page.toString();
1152
+ }
1153
+ if (action !== void 0) {
1154
+ queryParameters["action"] = action.toString();
1155
+ }
1156
+ if (enabled !== void 0) {
1157
+ queryParameters["enabled"] = enabled.toString();
1158
+ }
1159
+ if (sourceID !== void 0) {
1160
+ queryParameters["sourceID"] = sourceID.toString();
1161
+ }
1162
+ if (sourceType !== void 0) {
1163
+ queryParameters["sourceType"] = sourceType.toString();
1164
+ }
1165
+ if (destinationID !== void 0) {
1166
+ queryParameters["destinationID"] = destinationID.toString();
1167
+ }
1168
+ if (triggerType !== void 0) {
1169
+ queryParameters["triggerType"] = triggerType.toString();
1170
+ }
1171
+ if (withEmailNotifications !== void 0) {
1172
+ queryParameters["withEmailNotifications"] = withEmailNotifications.toString();
1173
+ }
1174
+ if (sort !== void 0) {
1175
+ queryParameters["sort"] = sort.toString();
1176
+ }
1177
+ if (order !== void 0) {
1178
+ queryParameters["order"] = order.toString();
1179
+ }
1180
+ const request = {
1181
+ method: "GET",
1182
+ path: requestPath,
1183
+ queryParameters,
1184
+ headers
1185
+ };
1186
+ return transporter.request(request, requestOptions);
1187
+ },
1188
+ /**
1189
+ * Retrieves a list of tasks using the v1 endpoint, please use `getTasks` instead.
1190
+ *
1191
+ * Required API Key ACLs:
1192
+ * - addObject
1193
+ * - deleteIndex
1194
+ * - editSettings
1195
+ * @param listTasksV1 - The listTasksV1 object.
1196
+ * @param listTasksV1.itemsPerPage - Number of items per page.
1197
+ * @param listTasksV1.page - Page number of the paginated API response.
1198
+ * @param listTasksV1.action - Actions for filtering the list of tasks.
1199
+ * @param listTasksV1.enabled - Whether to filter the list of tasks by the `enabled` status.
1200
+ * @param listTasksV1.sourceID - Source IDs for filtering the list of tasks.
1201
+ * @param listTasksV1.destinationID - Destination IDs for filtering the list of tasks.
1202
+ * @param listTasksV1.triggerType - Type of task trigger for filtering the list of tasks.
1203
+ * @param listTasksV1.sort - Property by which to sort the list of tasks.
1204
+ * @param listTasksV1.order - Sort order of the response, ascending or descending.
1205
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1206
+ */
1207
+ listTasksV1({ itemsPerPage, page, action, enabled, sourceID, destinationID, triggerType, sort, order } = {}, requestOptions = void 0) {
1208
+ const requestPath = "/1/tasks";
1209
+ const headers = {};
1210
+ const queryParameters = {};
1211
+ if (itemsPerPage !== void 0) {
1212
+ queryParameters["itemsPerPage"] = itemsPerPage.toString();
1213
+ }
1214
+ if (page !== void 0) {
1215
+ queryParameters["page"] = page.toString();
1216
+ }
1217
+ if (action !== void 0) {
1218
+ queryParameters["action"] = action.toString();
1219
+ }
1220
+ if (enabled !== void 0) {
1221
+ queryParameters["enabled"] = enabled.toString();
1222
+ }
1223
+ if (sourceID !== void 0) {
1224
+ queryParameters["sourceID"] = sourceID.toString();
1225
+ }
1226
+ if (destinationID !== void 0) {
1227
+ queryParameters["destinationID"] = destinationID.toString();
1228
+ }
1229
+ if (triggerType !== void 0) {
1230
+ queryParameters["triggerType"] = triggerType.toString();
1231
+ }
1232
+ if (sort !== void 0) {
1233
+ queryParameters["sort"] = sort.toString();
1234
+ }
1235
+ if (order !== void 0) {
1236
+ queryParameters["order"] = order.toString();
1237
+ }
1238
+ const request = {
1239
+ method: "GET",
1240
+ path: requestPath,
1241
+ queryParameters,
1242
+ headers
1243
+ };
1244
+ return transporter.request(request, requestOptions);
1245
+ },
1246
+ /**
1247
+ * Retrieves a list of transformations.
1248
+ *
1249
+ * Required API Key ACLs:
1250
+ * - addObject
1251
+ * - deleteIndex
1252
+ * - editSettings
1253
+ * @param listTransformations - The listTransformations object.
1254
+ * @param listTransformations.itemsPerPage - Number of items per page.
1255
+ * @param listTransformations.page - Page number of the paginated API response.
1256
+ * @param listTransformations.sort - Property by which to sort the list of transformations.
1257
+ * @param listTransformations.order - Sort order of the response, ascending or descending.
1258
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1259
+ */
1260
+ listTransformations({ itemsPerPage, page, sort, order } = {}, requestOptions = void 0) {
1261
+ const requestPath = "/1/transformations";
1262
+ const headers = {};
1263
+ const queryParameters = {};
1264
+ if (itemsPerPage !== void 0) {
1265
+ queryParameters["itemsPerPage"] = itemsPerPage.toString();
1266
+ }
1267
+ if (page !== void 0) {
1268
+ queryParameters["page"] = page.toString();
1269
+ }
1270
+ if (sort !== void 0) {
1271
+ queryParameters["sort"] = sort.toString();
1272
+ }
1273
+ if (order !== void 0) {
1274
+ queryParameters["order"] = order.toString();
1275
+ }
1276
+ const request = {
1277
+ method: "GET",
1278
+ path: requestPath,
1279
+ queryParameters,
1280
+ headers
1281
+ };
1282
+ return transporter.request(request, requestOptions);
1283
+ },
1284
+ /**
1285
+ * Push a `batch` request payload through the Pipeline. You can check the status of task pushes with the observability endpoints.
1286
+ *
1287
+ * Required API Key ACLs:
1288
+ * - addObject
1289
+ * - deleteIndex
1290
+ * - editSettings
1291
+ * @param pushTask - The pushTask object.
1292
+ * @param pushTask.taskID - Unique identifier of a task.
1293
+ * @param pushTask.pushTaskPayload - Request body of a Search API `batch` request that will be pushed in the Connectors pipeline.
1294
+ * @param pushTask.watch - When provided, the push operation will be synchronous and the API will wait for the ingestion to be finished before responding.
1295
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1296
+ */
1297
+ pushTask({ taskID, pushTaskPayload, watch }, requestOptions) {
1298
+ if (!taskID) {
1299
+ throw new Error("Parameter `taskID` is required when calling `pushTask`.");
1300
+ }
1301
+ if (!pushTaskPayload) {
1302
+ throw new Error("Parameter `pushTaskPayload` is required when calling `pushTask`.");
1303
+ }
1304
+ if (!pushTaskPayload.action) {
1305
+ throw new Error("Parameter `pushTaskPayload.action` is required when calling `pushTask`.");
1306
+ }
1307
+ if (!pushTaskPayload.records) {
1308
+ throw new Error("Parameter `pushTaskPayload.records` is required when calling `pushTask`.");
1309
+ }
1310
+ const requestPath = "/2/tasks/{taskID}/push".replace("{taskID}", encodeURIComponent(taskID));
1311
+ const headers = {};
1312
+ const queryParameters = {};
1313
+ if (watch !== void 0) {
1314
+ queryParameters["watch"] = watch.toString();
1315
+ }
1316
+ const request = {
1317
+ method: "POST",
1318
+ path: requestPath,
1319
+ queryParameters,
1320
+ headers,
1321
+ data: pushTaskPayload
1322
+ };
1323
+ requestOptions = {
1324
+ timeouts: {
1325
+ connect: 18e4,
1326
+ read: 18e4,
1327
+ write: 18e4,
1328
+ ...requestOptions == null ? void 0 : requestOptions.timeouts
1329
+ }
1330
+ };
1331
+ return transporter.request(request, requestOptions);
1332
+ },
1333
+ /**
1334
+ * Runs all tasks linked to a source, only available for Shopify sources. It will create 1 run per task.
1335
+ *
1336
+ * Required API Key ACLs:
1337
+ * - addObject
1338
+ * - deleteIndex
1339
+ * - editSettings
1340
+ * @param runSource - The runSource object.
1341
+ * @param runSource.sourceID - Unique identifier of a source.
1342
+ * @param runSource.runSourcePayload -
1343
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1344
+ */
1345
+ runSource({ sourceID, runSourcePayload }, requestOptions) {
1346
+ if (!sourceID) {
1347
+ throw new Error("Parameter `sourceID` is required when calling `runSource`.");
1348
+ }
1349
+ const requestPath = "/1/sources/{sourceID}/run".replace("{sourceID}", encodeURIComponent(sourceID));
1350
+ const headers = {};
1351
+ const queryParameters = {};
1352
+ const request = {
1353
+ method: "POST",
1354
+ path: requestPath,
1355
+ queryParameters,
1356
+ headers,
1357
+ data: runSourcePayload ? runSourcePayload : {}
1358
+ };
1359
+ return transporter.request(request, requestOptions);
1360
+ },
1361
+ /**
1362
+ * Runs a task. You can check the status of task runs with the observability endpoints.
1363
+ *
1364
+ * Required API Key ACLs:
1365
+ * - addObject
1366
+ * - deleteIndex
1367
+ * - editSettings
1368
+ * @param runTask - The runTask object.
1369
+ * @param runTask.taskID - Unique identifier of a task.
1370
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1371
+ */
1372
+ runTask({ taskID }, requestOptions) {
1373
+ if (!taskID) {
1374
+ throw new Error("Parameter `taskID` is required when calling `runTask`.");
1375
+ }
1376
+ const requestPath = "/2/tasks/{taskID}/run".replace("{taskID}", encodeURIComponent(taskID));
1377
+ const headers = {};
1378
+ const queryParameters = {};
1379
+ const request = {
1380
+ method: "POST",
1381
+ path: requestPath,
1382
+ queryParameters,
1383
+ headers
1384
+ };
1385
+ return transporter.request(request, requestOptions);
1386
+ },
1387
+ /**
1388
+ * Runs a task using the v1 endpoint, please use `runTask` instead. You can check the status of task runs with the observability endpoints.
1389
+ *
1390
+ * Required API Key ACLs:
1391
+ * - addObject
1392
+ * - deleteIndex
1393
+ * - editSettings
1394
+ * @param runTaskV1 - The runTaskV1 object.
1395
+ * @param runTaskV1.taskID - Unique identifier of a task.
1396
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1397
+ */
1398
+ runTaskV1({ taskID }, requestOptions) {
1399
+ if (!taskID) {
1400
+ throw new Error("Parameter `taskID` is required when calling `runTaskV1`.");
1401
+ }
1402
+ const requestPath = "/1/tasks/{taskID}/run".replace("{taskID}", encodeURIComponent(taskID));
1403
+ const headers = {};
1404
+ const queryParameters = {};
1405
+ const request = {
1406
+ method: "POST",
1407
+ path: requestPath,
1408
+ queryParameters,
1409
+ headers
1410
+ };
1411
+ return transporter.request(request, requestOptions);
1412
+ },
1413
+ /**
1414
+ * Searches for authentication resources.
1415
+ *
1416
+ * Required API Key ACLs:
1417
+ * - addObject
1418
+ * - deleteIndex
1419
+ * - editSettings
1420
+ * @param authenticationSearch - The authenticationSearch object.
1421
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1422
+ */
1423
+ searchAuthentications(authenticationSearch, requestOptions) {
1424
+ if (!authenticationSearch) {
1425
+ throw new Error("Parameter `authenticationSearch` is required when calling `searchAuthentications`.");
1426
+ }
1427
+ if (!authenticationSearch.authenticationIDs) {
1428
+ throw new Error(
1429
+ "Parameter `authenticationSearch.authenticationIDs` is required when calling `searchAuthentications`."
1430
+ );
1431
+ }
1432
+ const requestPath = "/1/authentications/search";
1433
+ const headers = {};
1434
+ const queryParameters = {};
1435
+ const request = {
1436
+ method: "POST",
1437
+ path: requestPath,
1438
+ queryParameters,
1439
+ headers,
1440
+ data: authenticationSearch
1441
+ };
1442
+ return transporter.request(request, requestOptions);
1443
+ },
1444
+ /**
1445
+ * Searches for destinations.
1446
+ *
1447
+ * Required API Key ACLs:
1448
+ * - addObject
1449
+ * - deleteIndex
1450
+ * - editSettings
1451
+ * @param destinationSearch - The destinationSearch object.
1452
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1453
+ */
1454
+ searchDestinations(destinationSearch, requestOptions) {
1455
+ if (!destinationSearch) {
1456
+ throw new Error("Parameter `destinationSearch` is required when calling `searchDestinations`.");
1457
+ }
1458
+ if (!destinationSearch.destinationIDs) {
1459
+ throw new Error("Parameter `destinationSearch.destinationIDs` is required when calling `searchDestinations`.");
1460
+ }
1461
+ const requestPath = "/1/destinations/search";
1462
+ const headers = {};
1463
+ const queryParameters = {};
1464
+ const request = {
1465
+ method: "POST",
1466
+ path: requestPath,
1467
+ queryParameters,
1468
+ headers,
1469
+ data: destinationSearch
1470
+ };
1471
+ return transporter.request(request, requestOptions);
1472
+ },
1473
+ /**
1474
+ * Searches for sources.
1475
+ *
1476
+ * Required API Key ACLs:
1477
+ * - addObject
1478
+ * - deleteIndex
1479
+ * - editSettings
1480
+ * @param sourceSearch - The sourceSearch object.
1481
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1482
+ */
1483
+ searchSources(sourceSearch, requestOptions) {
1484
+ if (!sourceSearch) {
1485
+ throw new Error("Parameter `sourceSearch` is required when calling `searchSources`.");
1486
+ }
1487
+ if (!sourceSearch.sourceIDs) {
1488
+ throw new Error("Parameter `sourceSearch.sourceIDs` is required when calling `searchSources`.");
1489
+ }
1490
+ const requestPath = "/1/sources/search";
1491
+ const headers = {};
1492
+ const queryParameters = {};
1493
+ const request = {
1494
+ method: "POST",
1495
+ path: requestPath,
1496
+ queryParameters,
1497
+ headers,
1498
+ data: sourceSearch
1499
+ };
1500
+ return transporter.request(request, requestOptions);
1501
+ },
1502
+ /**
1503
+ * Searches for tasks.
1504
+ *
1505
+ * Required API Key ACLs:
1506
+ * - addObject
1507
+ * - deleteIndex
1508
+ * - editSettings
1509
+ * @param taskSearch - The taskSearch object.
1510
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1511
+ */
1512
+ searchTasks(taskSearch, requestOptions) {
1513
+ if (!taskSearch) {
1514
+ throw new Error("Parameter `taskSearch` is required when calling `searchTasks`.");
1515
+ }
1516
+ if (!taskSearch.taskIDs) {
1517
+ throw new Error("Parameter `taskSearch.taskIDs` is required when calling `searchTasks`.");
1518
+ }
1519
+ const requestPath = "/2/tasks/search";
1520
+ const headers = {};
1521
+ const queryParameters = {};
1522
+ const request = {
1523
+ method: "POST",
1524
+ path: requestPath,
1525
+ queryParameters,
1526
+ headers,
1527
+ data: taskSearch
1528
+ };
1529
+ return transporter.request(request, requestOptions);
1530
+ },
1531
+ /**
1532
+ * Searches for tasks using the v1 endpoint, please use `searchTasks` instead.
1533
+ *
1534
+ * Required API Key ACLs:
1535
+ * - addObject
1536
+ * - deleteIndex
1537
+ * - editSettings
1538
+ * @param taskSearch - The taskSearch object.
1539
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1540
+ */
1541
+ searchTasksV1(taskSearch, requestOptions) {
1542
+ if (!taskSearch) {
1543
+ throw new Error("Parameter `taskSearch` is required when calling `searchTasksV1`.");
1544
+ }
1545
+ if (!taskSearch.taskIDs) {
1546
+ throw new Error("Parameter `taskSearch.taskIDs` is required when calling `searchTasksV1`.");
1547
+ }
1548
+ const requestPath = "/1/tasks/search";
1549
+ const headers = {};
1550
+ const queryParameters = {};
1551
+ const request = {
1552
+ method: "POST",
1553
+ path: requestPath,
1554
+ queryParameters,
1555
+ headers,
1556
+ data: taskSearch
1557
+ };
1558
+ return transporter.request(request, requestOptions);
1559
+ },
1560
+ /**
1561
+ * Searches for transformations.
1562
+ *
1563
+ * Required API Key ACLs:
1564
+ * - addObject
1565
+ * - deleteIndex
1566
+ * - editSettings
1567
+ * @param transformationSearch - The transformationSearch object.
1568
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1569
+ */
1570
+ searchTransformations(transformationSearch, requestOptions) {
1571
+ if (!transformationSearch) {
1572
+ throw new Error("Parameter `transformationSearch` is required when calling `searchTransformations`.");
1573
+ }
1574
+ if (!transformationSearch.transformationIDs) {
1575
+ throw new Error(
1576
+ "Parameter `transformationSearch.transformationIDs` is required when calling `searchTransformations`."
1577
+ );
1578
+ }
1579
+ const requestPath = "/1/transformations/search";
1580
+ const headers = {};
1581
+ const queryParameters = {};
1582
+ const request = {
1583
+ method: "POST",
1584
+ path: requestPath,
1585
+ queryParameters,
1586
+ headers,
1587
+ data: transformationSearch
1588
+ };
1589
+ return transporter.request(request, requestOptions);
1590
+ },
1591
+ /**
1592
+ * Triggers a stream-listing request for a source. Triggering stream-listing requests only works with sources with `type: docker` and `imageType: airbyte`.
1593
+ *
1594
+ * Required API Key ACLs:
1595
+ * - addObject
1596
+ * - deleteIndex
1597
+ * - editSettings
1598
+ * @param triggerDockerSourceDiscover - The triggerDockerSourceDiscover object.
1599
+ * @param triggerDockerSourceDiscover.sourceID - Unique identifier of a source.
1600
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1601
+ */
1602
+ triggerDockerSourceDiscover({ sourceID }, requestOptions) {
1603
+ if (!sourceID) {
1604
+ throw new Error("Parameter `sourceID` is required when calling `triggerDockerSourceDiscover`.");
1605
+ }
1606
+ const requestPath = "/1/sources/{sourceID}/discover".replace("{sourceID}", encodeURIComponent(sourceID));
1607
+ const headers = {};
1608
+ const queryParameters = {};
1609
+ const request = {
1610
+ method: "POST",
1611
+ path: requestPath,
1612
+ queryParameters,
1613
+ headers
1614
+ };
1615
+ requestOptions = {
1616
+ timeouts: {
1617
+ connect: 18e4,
1618
+ read: 18e4,
1619
+ write: 18e4,
1620
+ ...requestOptions == null ? void 0 : requestOptions.timeouts
1621
+ }
1622
+ };
1623
+ return transporter.request(request, requestOptions);
1624
+ },
1625
+ /**
1626
+ * Try a transformation before creating it.
1627
+ *
1628
+ * Required API Key ACLs:
1629
+ * - addObject
1630
+ * - deleteIndex
1631
+ * - editSettings
1632
+ * @param transformationTry - The transformationTry object.
1633
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1634
+ */
1635
+ tryTransformation(transformationTry, requestOptions) {
1636
+ if (!transformationTry) {
1637
+ throw new Error("Parameter `transformationTry` is required when calling `tryTransformation`.");
1638
+ }
1639
+ if (!transformationTry.code) {
1640
+ throw new Error("Parameter `transformationTry.code` is required when calling `tryTransformation`.");
1641
+ }
1642
+ if (!transformationTry.sampleRecord) {
1643
+ throw new Error("Parameter `transformationTry.sampleRecord` is required when calling `tryTransformation`.");
1644
+ }
1645
+ const requestPath = "/1/transformations/try";
1646
+ const headers = {};
1647
+ const queryParameters = {};
1648
+ const request = {
1649
+ method: "POST",
1650
+ path: requestPath,
1651
+ queryParameters,
1652
+ headers,
1653
+ data: transformationTry
1654
+ };
1655
+ return transporter.request(request, requestOptions);
1656
+ },
1657
+ /**
1658
+ * Try a transformation before updating it.
1659
+ *
1660
+ * Required API Key ACLs:
1661
+ * - addObject
1662
+ * - deleteIndex
1663
+ * - editSettings
1664
+ * @param tryTransformationBeforeUpdate - The tryTransformationBeforeUpdate object.
1665
+ * @param tryTransformationBeforeUpdate.transformationID - Unique identifier of a transformation.
1666
+ * @param tryTransformationBeforeUpdate.transformationTry - The transformationTry object.
1667
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1668
+ */
1669
+ tryTransformationBeforeUpdate({ transformationID, transformationTry }, requestOptions) {
1670
+ if (!transformationID) {
1671
+ throw new Error("Parameter `transformationID` is required when calling `tryTransformationBeforeUpdate`.");
1672
+ }
1673
+ if (!transformationTry) {
1674
+ throw new Error("Parameter `transformationTry` is required when calling `tryTransformationBeforeUpdate`.");
1675
+ }
1676
+ if (!transformationTry.code) {
1677
+ throw new Error("Parameter `transformationTry.code` is required when calling `tryTransformationBeforeUpdate`.");
1678
+ }
1679
+ if (!transformationTry.sampleRecord) {
1680
+ throw new Error(
1681
+ "Parameter `transformationTry.sampleRecord` is required when calling `tryTransformationBeforeUpdate`."
1682
+ );
1683
+ }
1684
+ const requestPath = "/1/transformations/{transformationID}/try".replace(
1685
+ "{transformationID}",
1686
+ encodeURIComponent(transformationID)
1687
+ );
1688
+ const headers = {};
1689
+ const queryParameters = {};
1690
+ const request = {
1691
+ method: "POST",
1692
+ path: requestPath,
1693
+ queryParameters,
1694
+ headers,
1695
+ data: transformationTry
1696
+ };
1697
+ return transporter.request(request, requestOptions);
1698
+ },
1699
+ /**
1700
+ * Updates an authentication resource.
1701
+ *
1702
+ * Required API Key ACLs:
1703
+ * - addObject
1704
+ * - deleteIndex
1705
+ * - editSettings
1706
+ * @param updateAuthentication - The updateAuthentication object.
1707
+ * @param updateAuthentication.authenticationID - Unique identifier of an authentication resource.
1708
+ * @param updateAuthentication.authenticationUpdate - The authenticationUpdate object.
1709
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1710
+ */
1711
+ updateAuthentication({ authenticationID, authenticationUpdate }, requestOptions) {
1712
+ if (!authenticationID) {
1713
+ throw new Error("Parameter `authenticationID` is required when calling `updateAuthentication`.");
1714
+ }
1715
+ if (!authenticationUpdate) {
1716
+ throw new Error("Parameter `authenticationUpdate` is required when calling `updateAuthentication`.");
1717
+ }
1718
+ const requestPath = "/1/authentications/{authenticationID}".replace(
1719
+ "{authenticationID}",
1720
+ encodeURIComponent(authenticationID)
1721
+ );
1722
+ const headers = {};
1723
+ const queryParameters = {};
1724
+ const request = {
1725
+ method: "PATCH",
1726
+ path: requestPath,
1727
+ queryParameters,
1728
+ headers,
1729
+ data: authenticationUpdate
1730
+ };
1731
+ return transporter.request(request, requestOptions);
1732
+ },
1733
+ /**
1734
+ * Updates the destination by its ID.
1735
+ *
1736
+ * Required API Key ACLs:
1737
+ * - addObject
1738
+ * - deleteIndex
1739
+ * - editSettings
1740
+ * @param updateDestination - The updateDestination object.
1741
+ * @param updateDestination.destinationID - Unique identifier of a destination.
1742
+ * @param updateDestination.destinationUpdate - The destinationUpdate object.
1743
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1744
+ */
1745
+ updateDestination({ destinationID, destinationUpdate }, requestOptions) {
1746
+ if (!destinationID) {
1747
+ throw new Error("Parameter `destinationID` is required when calling `updateDestination`.");
1748
+ }
1749
+ if (!destinationUpdate) {
1750
+ throw new Error("Parameter `destinationUpdate` is required when calling `updateDestination`.");
1751
+ }
1752
+ const requestPath = "/1/destinations/{destinationID}".replace(
1753
+ "{destinationID}",
1754
+ encodeURIComponent(destinationID)
1755
+ );
1756
+ const headers = {};
1757
+ const queryParameters = {};
1758
+ const request = {
1759
+ method: "PATCH",
1760
+ path: requestPath,
1761
+ queryParameters,
1762
+ headers,
1763
+ data: destinationUpdate
1764
+ };
1765
+ return transporter.request(request, requestOptions);
1766
+ },
1767
+ /**
1768
+ * Updates a source by its ID.
1769
+ *
1770
+ * Required API Key ACLs:
1771
+ * - addObject
1772
+ * - deleteIndex
1773
+ * - editSettings
1774
+ * @param updateSource - The updateSource object.
1775
+ * @param updateSource.sourceID - Unique identifier of a source.
1776
+ * @param updateSource.sourceUpdate - The sourceUpdate object.
1777
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1778
+ */
1779
+ updateSource({ sourceID, sourceUpdate }, requestOptions) {
1780
+ if (!sourceID) {
1781
+ throw new Error("Parameter `sourceID` is required when calling `updateSource`.");
1782
+ }
1783
+ if (!sourceUpdate) {
1784
+ throw new Error("Parameter `sourceUpdate` is required when calling `updateSource`.");
1785
+ }
1786
+ const requestPath = "/1/sources/{sourceID}".replace("{sourceID}", encodeURIComponent(sourceID));
1787
+ const headers = {};
1788
+ const queryParameters = {};
1789
+ const request = {
1790
+ method: "PATCH",
1791
+ path: requestPath,
1792
+ queryParameters,
1793
+ headers,
1794
+ data: sourceUpdate
1795
+ };
1796
+ return transporter.request(request, requestOptions);
1797
+ },
1798
+ /**
1799
+ * Updates a task by its ID.
1800
+ * @param updateTask - The updateTask object.
1801
+ * @param updateTask.taskID - Unique identifier of a task.
1802
+ * @param updateTask.taskUpdate - The taskUpdate object.
1803
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1804
+ */
1805
+ updateTask({ taskID, taskUpdate }, requestOptions) {
1806
+ if (!taskID) {
1807
+ throw new Error("Parameter `taskID` is required when calling `updateTask`.");
1808
+ }
1809
+ if (!taskUpdate) {
1810
+ throw new Error("Parameter `taskUpdate` is required when calling `updateTask`.");
1811
+ }
1812
+ const requestPath = "/2/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
1813
+ const headers = {};
1814
+ const queryParameters = {};
1815
+ const request = {
1816
+ method: "PATCH",
1817
+ path: requestPath,
1818
+ queryParameters,
1819
+ headers,
1820
+ data: taskUpdate
1821
+ };
1822
+ return transporter.request(request, requestOptions);
1823
+ },
1824
+ /**
1825
+ * Updates a task by its ID using the v1 endpoint, please use `updateTask` instead.
1826
+ * @param updateTaskV1 - The updateTaskV1 object.
1827
+ * @param updateTaskV1.taskID - Unique identifier of a task.
1828
+ * @param updateTaskV1.taskUpdate - The taskUpdate object.
1829
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1830
+ */
1831
+ updateTaskV1({ taskID, taskUpdate }, requestOptions) {
1832
+ if (!taskID) {
1833
+ throw new Error("Parameter `taskID` is required when calling `updateTaskV1`.");
1834
+ }
1835
+ if (!taskUpdate) {
1836
+ throw new Error("Parameter `taskUpdate` is required when calling `updateTaskV1`.");
1837
+ }
1838
+ const requestPath = "/1/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
1839
+ const headers = {};
1840
+ const queryParameters = {};
1841
+ const request = {
1842
+ method: "PATCH",
1843
+ path: requestPath,
1844
+ queryParameters,
1845
+ headers,
1846
+ data: taskUpdate
1847
+ };
1848
+ return transporter.request(request, requestOptions);
1849
+ },
1850
+ /**
1851
+ * Updates a transformation by its ID.
1852
+ * @param updateTransformation - The updateTransformation object.
1853
+ * @param updateTransformation.transformationID - Unique identifier of a transformation.
1854
+ * @param updateTransformation.transformationCreate - The transformationCreate object.
1855
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1856
+ */
1857
+ updateTransformation({ transformationID, transformationCreate }, requestOptions) {
1858
+ if (!transformationID) {
1859
+ throw new Error("Parameter `transformationID` is required when calling `updateTransformation`.");
1860
+ }
1861
+ if (!transformationCreate) {
1862
+ throw new Error("Parameter `transformationCreate` is required when calling `updateTransformation`.");
1863
+ }
1864
+ if (!transformationCreate.code) {
1865
+ throw new Error("Parameter `transformationCreate.code` is required when calling `updateTransformation`.");
1866
+ }
1867
+ if (!transformationCreate.name) {
1868
+ throw new Error("Parameter `transformationCreate.name` is required when calling `updateTransformation`.");
1869
+ }
1870
+ const requestPath = "/1/transformations/{transformationID}".replace(
1871
+ "{transformationID}",
1872
+ encodeURIComponent(transformationID)
1873
+ );
1874
+ const headers = {};
1875
+ const queryParameters = {};
1876
+ const request = {
1877
+ method: "PUT",
1878
+ path: requestPath,
1879
+ queryParameters,
1880
+ headers,
1881
+ data: transformationCreate
1882
+ };
1883
+ return transporter.request(request, requestOptions);
1884
+ },
1885
+ /**
1886
+ * Validates a source payload to ensure it can be created and that the data source can be reached by Algolia.
1887
+ *
1888
+ * Required API Key ACLs:
1889
+ * - addObject
1890
+ * - deleteIndex
1891
+ * - editSettings
1892
+ * @param sourceCreate -
1893
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1894
+ */
1895
+ validateSource(sourceCreate, requestOptions = void 0) {
1896
+ const requestPath = "/1/sources/validate";
1897
+ const headers = {};
1898
+ const queryParameters = {};
1899
+ const request = {
1900
+ method: "POST",
1901
+ path: requestPath,
1902
+ queryParameters,
1903
+ headers,
1904
+ data: sourceCreate ? sourceCreate : {}
1905
+ };
1906
+ requestOptions = {
1907
+ timeouts: {
1908
+ connect: 18e4,
1909
+ read: 18e4,
1910
+ write: 18e4,
1911
+ ...requestOptions == null ? void 0 : requestOptions.timeouts
1912
+ }
1913
+ };
1914
+ return transporter.request(request, requestOptions);
1915
+ },
1916
+ /**
1917
+ * Validates an update of a source payload to ensure it can be created and that the data source can be reached by Algolia.
1918
+ *
1919
+ * Required API Key ACLs:
1920
+ * - addObject
1921
+ * - deleteIndex
1922
+ * - editSettings
1923
+ * @param validateSourceBeforeUpdate - The validateSourceBeforeUpdate object.
1924
+ * @param validateSourceBeforeUpdate.sourceID - Unique identifier of a source.
1925
+ * @param validateSourceBeforeUpdate.sourceUpdate - The sourceUpdate object.
1926
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1927
+ */
1928
+ validateSourceBeforeUpdate({ sourceID, sourceUpdate }, requestOptions) {
1929
+ if (!sourceID) {
1930
+ throw new Error("Parameter `sourceID` is required when calling `validateSourceBeforeUpdate`.");
1931
+ }
1932
+ if (!sourceUpdate) {
1933
+ throw new Error("Parameter `sourceUpdate` is required when calling `validateSourceBeforeUpdate`.");
1934
+ }
1935
+ const requestPath = "/1/sources/{sourceID}/validate".replace("{sourceID}", encodeURIComponent(sourceID));
1936
+ const headers = {};
1937
+ const queryParameters = {};
1938
+ const request = {
1939
+ method: "POST",
1940
+ path: requestPath,
1941
+ queryParameters,
1942
+ headers,
1943
+ data: sourceUpdate
1944
+ };
1945
+ requestOptions = {
1946
+ timeouts: {
1947
+ connect: 18e4,
1948
+ read: 18e4,
1949
+ write: 18e4,
1950
+ ...requestOptions == null ? void 0 : requestOptions.timeouts
1951
+ }
1952
+ };
1953
+ return transporter.request(request, requestOptions);
1954
+ }
1955
+ };
1956
+ }
1957
+
1958
+ // builds/worker.ts
1959
+ function ingestionClient(appId, apiKey, region, options) {
1960
+ if (!appId || typeof appId !== "string") {
1961
+ throw new Error("`appId` is missing.");
1962
+ }
1963
+ if (!apiKey || typeof apiKey !== "string") {
1964
+ throw new Error("`apiKey` is missing.");
1965
+ }
1966
+ if (!region || region && (typeof region !== "string" || !REGIONS.includes(region))) {
1967
+ throw new Error(`\`region\` is required and must be one of the following: ${REGIONS.join(", ")}`);
1968
+ }
1969
+ return {
1970
+ ...createIngestionClient({
1971
+ appId,
1972
+ apiKey,
1973
+ region,
1974
+ timeouts: {
1975
+ connect: 25e3,
1976
+ read: 25e3,
1977
+ write: 25e3
1978
+ },
1979
+ logger: createNullLogger(),
1980
+ requester: createFetchRequester(),
1981
+ algoliaAgents: [{ segment: "Worker" }],
1982
+ responsesCache: createNullCache(),
1983
+ requestsCache: createNullCache(),
1984
+ hostsCache: createMemoryCache(),
1985
+ ...options
1986
+ })
1987
+ };
1988
+ }
1989
+ export {
1990
+ apiClientVersion,
1991
+ ingestionClient,
1992
+ isOnDemandTrigger,
1993
+ isScheduleTrigger,
1994
+ isSubscriptionTrigger
1995
+ };
1996
+ //# sourceMappingURL=worker.js.map