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