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