@algolia/ingestion 1.53.0 → 1.54.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.
@@ -3,8 +3,14 @@ import { createMemoryCache, createNullCache, createNullLogger } from "@algolia/c
3
3
  import { createFetchRequester } from "@algolia/requester-fetch";
4
4
 
5
5
  // src/ingestionClient.ts
6
- import { createAuth, createIterablePromise, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
7
- var apiClientVersion = "1.53.0";
6
+ import {
7
+ createAuth,
8
+ createIterablePromise,
9
+ createTransporter,
10
+ getAlgoliaAgent,
11
+ validateRequired
12
+ } from "@algolia/client-common";
13
+ var apiClientVersion = "1.54.0";
8
14
  var REGIONS = ["eu", "us"];
9
15
  function getDefaultHosts(region) {
10
16
  const url = "data.{region}.algolia.com".replace("{region}", region);
@@ -169,18 +175,10 @@ function createIngestionClient({
169
175
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
170
176
  */
171
177
  createAuthentication(authenticationCreate, requestOptions) {
172
- if (!authenticationCreate) {
173
- throw new Error("Parameter `authenticationCreate` is required when calling `createAuthentication`.");
174
- }
175
- if (!authenticationCreate.type) {
176
- throw new Error("Parameter `authenticationCreate.type` is required when calling `createAuthentication`.");
177
- }
178
- if (!authenticationCreate.name) {
179
- throw new Error("Parameter `authenticationCreate.name` is required when calling `createAuthentication`.");
180
- }
181
- if (!authenticationCreate.input) {
182
- throw new Error("Parameter `authenticationCreate.input` is required when calling `createAuthentication`.");
183
- }
178
+ validateRequired("authenticationCreate", "createAuthentication", authenticationCreate);
179
+ validateRequired("authenticationCreate.type", "createAuthentication", authenticationCreate.type);
180
+ validateRequired("authenticationCreate.name", "createAuthentication", authenticationCreate.name);
181
+ validateRequired("authenticationCreate.input", "createAuthentication", authenticationCreate.input);
184
182
  const requestPath = "/1/authentications";
185
183
  const headers = {};
186
184
  const queryParameters = {};
@@ -204,18 +202,10 @@ function createIngestionClient({
204
202
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
205
203
  */
206
204
  createDestination(destinationCreate, requestOptions) {
207
- if (!destinationCreate) {
208
- throw new Error("Parameter `destinationCreate` is required when calling `createDestination`.");
209
- }
210
- if (!destinationCreate.type) {
211
- throw new Error("Parameter `destinationCreate.type` is required when calling `createDestination`.");
212
- }
213
- if (!destinationCreate.name) {
214
- throw new Error("Parameter `destinationCreate.name` is required when calling `createDestination`.");
215
- }
216
- if (!destinationCreate.input) {
217
- throw new Error("Parameter `destinationCreate.input` is required when calling `createDestination`.");
218
- }
205
+ validateRequired("destinationCreate", "createDestination", destinationCreate);
206
+ validateRequired("destinationCreate.type", "createDestination", destinationCreate.type);
207
+ validateRequired("destinationCreate.name", "createDestination", destinationCreate.name);
208
+ validateRequired("destinationCreate.input", "createDestination", destinationCreate.input);
219
209
  const requestPath = "/1/destinations";
220
210
  const headers = {};
221
211
  const queryParameters = {};
@@ -239,15 +229,9 @@ function createIngestionClient({
239
229
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
240
230
  */
241
231
  createSource(sourceCreate, requestOptions) {
242
- if (!sourceCreate) {
243
- throw new Error("Parameter `sourceCreate` is required when calling `createSource`.");
244
- }
245
- if (!sourceCreate.type) {
246
- throw new Error("Parameter `sourceCreate.type` is required when calling `createSource`.");
247
- }
248
- if (!sourceCreate.name) {
249
- throw new Error("Parameter `sourceCreate.name` is required when calling `createSource`.");
250
- }
232
+ validateRequired("sourceCreate", "createSource", sourceCreate);
233
+ validateRequired("sourceCreate.type", "createSource", sourceCreate.type);
234
+ validateRequired("sourceCreate.name", "createSource", sourceCreate.name);
251
235
  const requestPath = "/1/sources";
252
236
  const headers = {};
253
237
  const queryParameters = {};
@@ -271,18 +255,10 @@ function createIngestionClient({
271
255
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
272
256
  */
273
257
  createTask(taskCreate, requestOptions) {
274
- if (!taskCreate) {
275
- throw new Error("Parameter `taskCreate` is required when calling `createTask`.");
276
- }
277
- if (!taskCreate.sourceID) {
278
- throw new Error("Parameter `taskCreate.sourceID` is required when calling `createTask`.");
279
- }
280
- if (!taskCreate.destinationID) {
281
- throw new Error("Parameter `taskCreate.destinationID` is required when calling `createTask`.");
282
- }
283
- if (!taskCreate.action) {
284
- throw new Error("Parameter `taskCreate.action` is required when calling `createTask`.");
285
- }
258
+ validateRequired("taskCreate", "createTask", taskCreate);
259
+ validateRequired("taskCreate.sourceID", "createTask", taskCreate.sourceID);
260
+ validateRequired("taskCreate.destinationID", "createTask", taskCreate.destinationID);
261
+ validateRequired("taskCreate.action", "createTask", taskCreate.action);
286
262
  const requestPath = "/2/tasks";
287
263
  const headers = {};
288
264
  const queryParameters = {};
@@ -308,21 +284,11 @@ function createIngestionClient({
308
284
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
309
285
  */
310
286
  createTaskV1(taskCreate, requestOptions) {
311
- if (!taskCreate) {
312
- throw new Error("Parameter `taskCreate` is required when calling `createTaskV1`.");
313
- }
314
- if (!taskCreate.sourceID) {
315
- throw new Error("Parameter `taskCreate.sourceID` is required when calling `createTaskV1`.");
316
- }
317
- if (!taskCreate.destinationID) {
318
- throw new Error("Parameter `taskCreate.destinationID` is required when calling `createTaskV1`.");
319
- }
320
- if (!taskCreate.trigger) {
321
- throw new Error("Parameter `taskCreate.trigger` is required when calling `createTaskV1`.");
322
- }
323
- if (!taskCreate.action) {
324
- throw new Error("Parameter `taskCreate.action` is required when calling `createTaskV1`.");
325
- }
287
+ validateRequired("taskCreate", "createTaskV1", taskCreate);
288
+ validateRequired("taskCreate.sourceID", "createTaskV1", taskCreate.sourceID);
289
+ validateRequired("taskCreate.destinationID", "createTaskV1", taskCreate.destinationID);
290
+ validateRequired("taskCreate.trigger", "createTaskV1", taskCreate.trigger);
291
+ validateRequired("taskCreate.action", "createTaskV1", taskCreate.action);
326
292
  const requestPath = "/1/tasks";
327
293
  const headers = {};
328
294
  const queryParameters = {};
@@ -346,12 +312,8 @@ function createIngestionClient({
346
312
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
347
313
  */
348
314
  createTransformation(transformationCreate, requestOptions) {
349
- if (!transformationCreate) {
350
- throw new Error("Parameter `transformationCreate` is required when calling `createTransformation`.");
351
- }
352
- if (!transformationCreate.name) {
353
- throw new Error("Parameter `transformationCreate.name` is required when calling `createTransformation`.");
354
- }
315
+ validateRequired("transformationCreate", "createTransformation", transformationCreate);
316
+ validateRequired("transformationCreate.name", "createTransformation", transformationCreate.name);
355
317
  const requestPath = "/1/transformations";
356
318
  const headers = {};
357
319
  const queryParameters = {};
@@ -372,9 +334,7 @@ function createIngestionClient({
372
334
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
373
335
  */
374
336
  customDelete({ path, parameters }, requestOptions) {
375
- if (!path) {
376
- throw new Error("Parameter `path` is required when calling `customDelete`.");
377
- }
337
+ validateRequired("path", "customDelete", path);
378
338
  const requestPath = "/{path}".replace("{path}", path);
379
339
  const headers = {};
380
340
  const queryParameters = parameters ? parameters : {};
@@ -394,9 +354,7 @@ function createIngestionClient({
394
354
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
395
355
  */
396
356
  customGet({ path, parameters }, requestOptions) {
397
- if (!path) {
398
- throw new Error("Parameter `path` is required when calling `customGet`.");
399
- }
357
+ validateRequired("path", "customGet", path);
400
358
  const requestPath = "/{path}".replace("{path}", path);
401
359
  const headers = {};
402
360
  const queryParameters = parameters ? parameters : {};
@@ -417,9 +375,7 @@ function createIngestionClient({
417
375
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
418
376
  */
419
377
  customPost({ path, parameters, body }, requestOptions) {
420
- if (!path) {
421
- throw new Error("Parameter `path` is required when calling `customPost`.");
422
- }
378
+ validateRequired("path", "customPost", path);
423
379
  const requestPath = "/{path}".replace("{path}", path);
424
380
  const headers = {};
425
381
  const queryParameters = parameters ? parameters : {};
@@ -441,9 +397,7 @@ function createIngestionClient({
441
397
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
442
398
  */
443
399
  customPut({ path, parameters, body }, requestOptions) {
444
- if (!path) {
445
- throw new Error("Parameter `path` is required when calling `customPut`.");
446
- }
400
+ validateRequired("path", "customPut", path);
447
401
  const requestPath = "/{path}".replace("{path}", path);
448
402
  const headers = {};
449
403
  const queryParameters = parameters ? parameters : {};
@@ -468,9 +422,7 @@ function createIngestionClient({
468
422
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
469
423
  */
470
424
  deleteAuthentication({ authenticationID }, requestOptions) {
471
- if (!authenticationID) {
472
- throw new Error("Parameter `authenticationID` is required when calling `deleteAuthentication`.");
473
- }
425
+ validateRequired("authenticationID", "deleteAuthentication", authenticationID);
474
426
  const requestPath = "/1/authentications/{authenticationID}".replace(
475
427
  "{authenticationID}",
476
428
  encodeURIComponent(authenticationID)
@@ -497,9 +449,7 @@ function createIngestionClient({
497
449
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
498
450
  */
499
451
  deleteDestination({ destinationID }, requestOptions) {
500
- if (!destinationID) {
501
- throw new Error("Parameter `destinationID` is required when calling `deleteDestination`.");
502
- }
452
+ validateRequired("destinationID", "deleteDestination", destinationID);
503
453
  const requestPath = "/1/destinations/{destinationID}".replace(
504
454
  "{destinationID}",
505
455
  encodeURIComponent(destinationID)
@@ -526,9 +476,7 @@ function createIngestionClient({
526
476
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
527
477
  */
528
478
  deleteSource({ sourceID }, requestOptions) {
529
- if (!sourceID) {
530
- throw new Error("Parameter `sourceID` is required when calling `deleteSource`.");
531
- }
479
+ validateRequired("sourceID", "deleteSource", sourceID);
532
480
  const requestPath = "/1/sources/{sourceID}".replace("{sourceID}", encodeURIComponent(sourceID));
533
481
  const headers = {};
534
482
  const queryParameters = {};
@@ -552,9 +500,7 @@ function createIngestionClient({
552
500
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
553
501
  */
554
502
  deleteTask({ taskID }, requestOptions) {
555
- if (!taskID) {
556
- throw new Error("Parameter `taskID` is required when calling `deleteTask`.");
557
- }
503
+ validateRequired("taskID", "deleteTask", taskID);
558
504
  const requestPath = "/2/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
559
505
  const headers = {};
560
506
  const queryParameters = {};
@@ -580,9 +526,7 @@ function createIngestionClient({
580
526
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
581
527
  */
582
528
  deleteTaskV1({ taskID }, requestOptions) {
583
- if (!taskID) {
584
- throw new Error("Parameter `taskID` is required when calling `deleteTaskV1`.");
585
- }
529
+ validateRequired("taskID", "deleteTaskV1", taskID);
586
530
  const requestPath = "/1/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
587
531
  const headers = {};
588
532
  const queryParameters = {};
@@ -606,9 +550,7 @@ function createIngestionClient({
606
550
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
607
551
  */
608
552
  deleteTransformation({ transformationID }, requestOptions) {
609
- if (!transformationID) {
610
- throw new Error("Parameter `transformationID` is required when calling `deleteTransformation`.");
611
- }
553
+ validateRequired("transformationID", "deleteTransformation", transformationID);
612
554
  const requestPath = "/1/transformations/{transformationID}".replace(
613
555
  "{transformationID}",
614
556
  encodeURIComponent(transformationID)
@@ -635,9 +577,7 @@ function createIngestionClient({
635
577
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
636
578
  */
637
579
  disableTask({ taskID }, requestOptions) {
638
- if (!taskID) {
639
- throw new Error("Parameter `taskID` is required when calling `disableTask`.");
640
- }
580
+ validateRequired("taskID", "disableTask", taskID);
641
581
  const requestPath = "/2/tasks/{taskID}/disable".replace("{taskID}", encodeURIComponent(taskID));
642
582
  const headers = {};
643
583
  const queryParameters = {};
@@ -663,9 +603,7 @@ function createIngestionClient({
663
603
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
664
604
  */
665
605
  disableTaskV1({ taskID }, requestOptions) {
666
- if (!taskID) {
667
- throw new Error("Parameter `taskID` is required when calling `disableTaskV1`.");
668
- }
606
+ validateRequired("taskID", "disableTaskV1", taskID);
669
607
  const requestPath = "/1/tasks/{taskID}/disable".replace("{taskID}", encodeURIComponent(taskID));
670
608
  const headers = {};
671
609
  const queryParameters = {};
@@ -689,9 +627,7 @@ function createIngestionClient({
689
627
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
690
628
  */
691
629
  enableTask({ taskID }, requestOptions) {
692
- if (!taskID) {
693
- throw new Error("Parameter `taskID` is required when calling `enableTask`.");
694
- }
630
+ validateRequired("taskID", "enableTask", taskID);
695
631
  const requestPath = "/2/tasks/{taskID}/enable".replace("{taskID}", encodeURIComponent(taskID));
696
632
  const headers = {};
697
633
  const queryParameters = {};
@@ -717,9 +653,7 @@ function createIngestionClient({
717
653
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
718
654
  */
719
655
  enableTaskV1({ taskID }, requestOptions) {
720
- if (!taskID) {
721
- throw new Error("Parameter `taskID` is required when calling `enableTaskV1`.");
722
- }
656
+ validateRequired("taskID", "enableTaskV1", taskID);
723
657
  const requestPath = "/1/tasks/{taskID}/enable".replace("{taskID}", encodeURIComponent(taskID));
724
658
  const headers = {};
725
659
  const queryParameters = {};
@@ -743,9 +677,7 @@ function createIngestionClient({
743
677
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
744
678
  */
745
679
  getAuthentication({ authenticationID }, requestOptions) {
746
- if (!authenticationID) {
747
- throw new Error("Parameter `authenticationID` is required when calling `getAuthentication`.");
748
- }
680
+ validateRequired("authenticationID", "getAuthentication", authenticationID);
749
681
  const requestPath = "/1/authentications/{authenticationID}".replace(
750
682
  "{authenticationID}",
751
683
  encodeURIComponent(authenticationID)
@@ -772,9 +704,7 @@ function createIngestionClient({
772
704
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
773
705
  */
774
706
  getDestination({ destinationID }, requestOptions) {
775
- if (!destinationID) {
776
- throw new Error("Parameter `destinationID` is required when calling `getDestination`.");
777
- }
707
+ validateRequired("destinationID", "getDestination", destinationID);
778
708
  const requestPath = "/1/destinations/{destinationID}".replace(
779
709
  "{destinationID}",
780
710
  encodeURIComponent(destinationID)
@@ -802,12 +732,8 @@ function createIngestionClient({
802
732
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
803
733
  */
804
734
  getEvent({ runID, eventID }, requestOptions) {
805
- if (!runID) {
806
- throw new Error("Parameter `runID` is required when calling `getEvent`.");
807
- }
808
- if (!eventID) {
809
- throw new Error("Parameter `eventID` is required when calling `getEvent`.");
810
- }
735
+ validateRequired("runID", "getEvent", runID);
736
+ validateRequired("eventID", "getEvent", eventID);
811
737
  const requestPath = "/1/runs/{runID}/events/{eventID}".replace("{runID}", encodeURIComponent(runID)).replace("{eventID}", encodeURIComponent(eventID));
812
738
  const headers = {};
813
739
  const queryParameters = {};
@@ -831,9 +757,7 @@ function createIngestionClient({
831
757
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
832
758
  */
833
759
  getRun({ runID }, requestOptions) {
834
- if (!runID) {
835
- throw new Error("Parameter `runID` is required when calling `getRun`.");
836
- }
760
+ validateRequired("runID", "getRun", runID);
837
761
  const requestPath = "/1/runs/{runID}".replace("{runID}", encodeURIComponent(runID));
838
762
  const headers = {};
839
763
  const queryParameters = {};
@@ -857,9 +781,7 @@ function createIngestionClient({
857
781
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
858
782
  */
859
783
  getSource({ sourceID }, requestOptions) {
860
- if (!sourceID) {
861
- throw new Error("Parameter `sourceID` is required when calling `getSource`.");
862
- }
784
+ validateRequired("sourceID", "getSource", sourceID);
863
785
  const requestPath = "/1/sources/{sourceID}".replace("{sourceID}", encodeURIComponent(sourceID));
864
786
  const headers = {};
865
787
  const queryParameters = {};
@@ -883,9 +805,7 @@ function createIngestionClient({
883
805
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
884
806
  */
885
807
  getTask({ taskID }, requestOptions) {
886
- if (!taskID) {
887
- throw new Error("Parameter `taskID` is required when calling `getTask`.");
888
- }
808
+ validateRequired("taskID", "getTask", taskID);
889
809
  const requestPath = "/2/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
890
810
  const headers = {};
891
811
  const queryParameters = {};
@@ -911,9 +831,7 @@ function createIngestionClient({
911
831
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
912
832
  */
913
833
  getTaskV1({ taskID }, requestOptions) {
914
- if (!taskID) {
915
- throw new Error("Parameter `taskID` is required when calling `getTaskV1`.");
916
- }
834
+ validateRequired("taskID", "getTaskV1", taskID);
917
835
  const requestPath = "/1/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
918
836
  const headers = {};
919
837
  const queryParameters = {};
@@ -937,9 +855,7 @@ function createIngestionClient({
937
855
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
938
856
  */
939
857
  getTransformation({ transformationID }, requestOptions) {
940
- if (!transformationID) {
941
- throw new Error("Parameter `transformationID` is required when calling `getTransformation`.");
942
- }
858
+ validateRequired("transformationID", "getTransformation", transformationID);
943
859
  const requestPath = "/1/transformations/{transformationID}".replace(
944
860
  "{transformationID}",
945
861
  encodeURIComponent(transformationID)
@@ -1070,9 +986,7 @@ function createIngestionClient({
1070
986
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1071
987
  */
1072
988
  listEvents({ runID, itemsPerPage, page, status, type, sort, order, startDate, endDate }, requestOptions) {
1073
- if (!runID) {
1074
- throw new Error("Parameter `runID` is required when calling `listEvents`.");
1075
- }
989
+ validateRequired("runID", "listEvents", runID);
1076
990
  const requestPath = "/1/runs/{runID}/events".replace("{runID}", encodeURIComponent(runID));
1077
991
  const headers = {};
1078
992
  const queryParameters = {};
@@ -1407,18 +1321,10 @@ function createIngestionClient({
1407
1321
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1408
1322
  */
1409
1323
  push({ indexName, pushTaskPayload, watch, referenceIndexName }, requestOptions) {
1410
- if (!indexName) {
1411
- throw new Error("Parameter `indexName` is required when calling `push`.");
1412
- }
1413
- if (!pushTaskPayload) {
1414
- throw new Error("Parameter `pushTaskPayload` is required when calling `push`.");
1415
- }
1416
- if (!pushTaskPayload.action) {
1417
- throw new Error("Parameter `pushTaskPayload.action` is required when calling `push`.");
1418
- }
1419
- if (!pushTaskPayload.records) {
1420
- throw new Error("Parameter `pushTaskPayload.records` is required when calling `push`.");
1421
- }
1324
+ validateRequired("indexName", "push", indexName);
1325
+ validateRequired("pushTaskPayload", "push", pushTaskPayload);
1326
+ validateRequired("pushTaskPayload.action", "push", pushTaskPayload.action);
1327
+ validateRequired("pushTaskPayload.records", "push", pushTaskPayload.records);
1422
1328
  const requestPath = "/1/push/{indexName}".replace("{indexName}", encodeURIComponent(indexName));
1423
1329
  const headers = {};
1424
1330
  const queryParameters = {};
@@ -1459,18 +1365,10 @@ function createIngestionClient({
1459
1365
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1460
1366
  */
1461
1367
  pushTask({ taskID, pushTaskPayload, watch }, requestOptions) {
1462
- if (!taskID) {
1463
- throw new Error("Parameter `taskID` is required when calling `pushTask`.");
1464
- }
1465
- if (!pushTaskPayload) {
1466
- throw new Error("Parameter `pushTaskPayload` is required when calling `pushTask`.");
1467
- }
1468
- if (!pushTaskPayload.action) {
1469
- throw new Error("Parameter `pushTaskPayload.action` is required when calling `pushTask`.");
1470
- }
1471
- if (!pushTaskPayload.records) {
1472
- throw new Error("Parameter `pushTaskPayload.records` is required when calling `pushTask`.");
1473
- }
1368
+ validateRequired("taskID", "pushTask", taskID);
1369
+ validateRequired("pushTaskPayload", "pushTask", pushTaskPayload);
1370
+ validateRequired("pushTaskPayload.action", "pushTask", pushTaskPayload.action);
1371
+ validateRequired("pushTaskPayload.records", "pushTask", pushTaskPayload.records);
1474
1372
  const requestPath = "/2/tasks/{taskID}/push".replace("{taskID}", encodeURIComponent(taskID));
1475
1373
  const headers = {};
1476
1374
  const queryParameters = {};
@@ -1507,18 +1405,10 @@ function createIngestionClient({
1507
1405
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1508
1406
  */
1509
1407
  replaceTask({ taskID, taskReplace }, requestOptions) {
1510
- if (!taskID) {
1511
- throw new Error("Parameter `taskID` is required when calling `replaceTask`.");
1512
- }
1513
- if (!taskReplace) {
1514
- throw new Error("Parameter `taskReplace` is required when calling `replaceTask`.");
1515
- }
1516
- if (!taskReplace.destinationID) {
1517
- throw new Error("Parameter `taskReplace.destinationID` is required when calling `replaceTask`.");
1518
- }
1519
- if (!taskReplace.action) {
1520
- throw new Error("Parameter `taskReplace.action` is required when calling `replaceTask`.");
1521
- }
1408
+ validateRequired("taskID", "replaceTask", taskID);
1409
+ validateRequired("taskReplace", "replaceTask", taskReplace);
1410
+ validateRequired("taskReplace.destinationID", "replaceTask", taskReplace.destinationID);
1411
+ validateRequired("taskReplace.action", "replaceTask", taskReplace.action);
1522
1412
  const requestPath = "/2/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
1523
1413
  const headers = {};
1524
1414
  const queryParameters = {};
@@ -1544,9 +1434,7 @@ function createIngestionClient({
1544
1434
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1545
1435
  */
1546
1436
  runSource({ sourceID, runSourcePayload }, requestOptions) {
1547
- if (!sourceID) {
1548
- throw new Error("Parameter `sourceID` is required when calling `runSource`.");
1549
- }
1437
+ validateRequired("sourceID", "runSource", sourceID);
1550
1438
  const requestPath = "/1/sources/{sourceID}/run".replace("{sourceID}", encodeURIComponent(sourceID));
1551
1439
  const headers = {};
1552
1440
  const queryParameters = {};
@@ -1572,9 +1460,7 @@ function createIngestionClient({
1572
1460
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1573
1461
  */
1574
1462
  runTask({ taskID, runTaskPayload }, requestOptions) {
1575
- if (!taskID) {
1576
- throw new Error("Parameter `taskID` is required when calling `runTask`.");
1577
- }
1463
+ validateRequired("taskID", "runTask", taskID);
1578
1464
  const requestPath = "/2/tasks/{taskID}/run".replace("{taskID}", encodeURIComponent(taskID));
1579
1465
  const headers = {};
1580
1466
  const queryParameters = {};
@@ -1602,9 +1488,7 @@ function createIngestionClient({
1602
1488
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1603
1489
  */
1604
1490
  runTaskV1({ taskID, runTaskPayload }, requestOptions) {
1605
- if (!taskID) {
1606
- throw new Error("Parameter `taskID` is required when calling `runTaskV1`.");
1607
- }
1491
+ validateRequired("taskID", "runTaskV1", taskID);
1608
1492
  const requestPath = "/1/tasks/{taskID}/run".replace("{taskID}", encodeURIComponent(taskID));
1609
1493
  const headers = {};
1610
1494
  const queryParameters = {};
@@ -1628,14 +1512,12 @@ function createIngestionClient({
1628
1512
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1629
1513
  */
1630
1514
  searchAuthentications(authenticationSearch, requestOptions) {
1631
- if (!authenticationSearch) {
1632
- throw new Error("Parameter `authenticationSearch` is required when calling `searchAuthentications`.");
1633
- }
1634
- if (!authenticationSearch.authenticationIDs) {
1635
- throw new Error(
1636
- "Parameter `authenticationSearch.authenticationIDs` is required when calling `searchAuthentications`."
1637
- );
1638
- }
1515
+ validateRequired("authenticationSearch", "searchAuthentications", authenticationSearch);
1516
+ validateRequired(
1517
+ "authenticationSearch.authenticationIDs",
1518
+ "searchAuthentications",
1519
+ authenticationSearch.authenticationIDs
1520
+ );
1639
1521
  const requestPath = "/1/authentications/search";
1640
1522
  const headers = {};
1641
1523
  const queryParameters = {};
@@ -1659,12 +1541,8 @@ function createIngestionClient({
1659
1541
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1660
1542
  */
1661
1543
  searchDestinations(destinationSearch, requestOptions) {
1662
- if (!destinationSearch) {
1663
- throw new Error("Parameter `destinationSearch` is required when calling `searchDestinations`.");
1664
- }
1665
- if (!destinationSearch.destinationIDs) {
1666
- throw new Error("Parameter `destinationSearch.destinationIDs` is required when calling `searchDestinations`.");
1667
- }
1544
+ validateRequired("destinationSearch", "searchDestinations", destinationSearch);
1545
+ validateRequired("destinationSearch.destinationIDs", "searchDestinations", destinationSearch.destinationIDs);
1668
1546
  const requestPath = "/1/destinations/search";
1669
1547
  const headers = {};
1670
1548
  const queryParameters = {};
@@ -1688,12 +1566,8 @@ function createIngestionClient({
1688
1566
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1689
1567
  */
1690
1568
  searchSources(sourceSearch, requestOptions) {
1691
- if (!sourceSearch) {
1692
- throw new Error("Parameter `sourceSearch` is required when calling `searchSources`.");
1693
- }
1694
- if (!sourceSearch.sourceIDs) {
1695
- throw new Error("Parameter `sourceSearch.sourceIDs` is required when calling `searchSources`.");
1696
- }
1569
+ validateRequired("sourceSearch", "searchSources", sourceSearch);
1570
+ validateRequired("sourceSearch.sourceIDs", "searchSources", sourceSearch.sourceIDs);
1697
1571
  const requestPath = "/1/sources/search";
1698
1572
  const headers = {};
1699
1573
  const queryParameters = {};
@@ -1717,12 +1591,8 @@ function createIngestionClient({
1717
1591
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1718
1592
  */
1719
1593
  searchTasks(taskSearch, requestOptions) {
1720
- if (!taskSearch) {
1721
- throw new Error("Parameter `taskSearch` is required when calling `searchTasks`.");
1722
- }
1723
- if (!taskSearch.taskIDs) {
1724
- throw new Error("Parameter `taskSearch.taskIDs` is required when calling `searchTasks`.");
1725
- }
1594
+ validateRequired("taskSearch", "searchTasks", taskSearch);
1595
+ validateRequired("taskSearch.taskIDs", "searchTasks", taskSearch.taskIDs);
1726
1596
  const requestPath = "/2/tasks/search";
1727
1597
  const headers = {};
1728
1598
  const queryParameters = {};
@@ -1748,12 +1618,8 @@ function createIngestionClient({
1748
1618
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1749
1619
  */
1750
1620
  searchTasksV1(taskSearch, requestOptions) {
1751
- if (!taskSearch) {
1752
- throw new Error("Parameter `taskSearch` is required when calling `searchTasksV1`.");
1753
- }
1754
- if (!taskSearch.taskIDs) {
1755
- throw new Error("Parameter `taskSearch.taskIDs` is required when calling `searchTasksV1`.");
1756
- }
1621
+ validateRequired("taskSearch", "searchTasksV1", taskSearch);
1622
+ validateRequired("taskSearch.taskIDs", "searchTasksV1", taskSearch.taskIDs);
1757
1623
  const requestPath = "/1/tasks/search";
1758
1624
  const headers = {};
1759
1625
  const queryParameters = {};
@@ -1777,14 +1643,12 @@ function createIngestionClient({
1777
1643
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1778
1644
  */
1779
1645
  searchTransformations(transformationSearch, requestOptions) {
1780
- if (!transformationSearch) {
1781
- throw new Error("Parameter `transformationSearch` is required when calling `searchTransformations`.");
1782
- }
1783
- if (!transformationSearch.transformationIDs) {
1784
- throw new Error(
1785
- "Parameter `transformationSearch.transformationIDs` is required when calling `searchTransformations`."
1786
- );
1787
- }
1646
+ validateRequired("transformationSearch", "searchTransformations", transformationSearch);
1647
+ validateRequired(
1648
+ "transformationSearch.transformationIDs",
1649
+ "searchTransformations",
1650
+ transformationSearch.transformationIDs
1651
+ );
1788
1652
  const requestPath = "/1/transformations/search";
1789
1653
  const headers = {};
1790
1654
  const queryParameters = {};
@@ -1809,9 +1673,7 @@ function createIngestionClient({
1809
1673
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1810
1674
  */
1811
1675
  triggerDockerSourceDiscover({ sourceID }, requestOptions) {
1812
- if (!sourceID) {
1813
- throw new Error("Parameter `sourceID` is required when calling `triggerDockerSourceDiscover`.");
1814
- }
1676
+ validateRequired("sourceID", "triggerDockerSourceDiscover", sourceID);
1815
1677
  const requestPath = "/1/sources/{sourceID}/discover".replace("{sourceID}", encodeURIComponent(sourceID));
1816
1678
  const headers = {};
1817
1679
  const queryParameters = {};
@@ -1842,12 +1704,8 @@ function createIngestionClient({
1842
1704
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1843
1705
  */
1844
1706
  tryTransformation(transformationTry, requestOptions) {
1845
- if (!transformationTry) {
1846
- throw new Error("Parameter `transformationTry` is required when calling `tryTransformation`.");
1847
- }
1848
- if (!transformationTry.sampleRecord) {
1849
- throw new Error("Parameter `transformationTry.sampleRecord` is required when calling `tryTransformation`.");
1850
- }
1707
+ validateRequired("transformationTry", "tryTransformation", transformationTry);
1708
+ validateRequired("transformationTry.sampleRecord", "tryTransformation", transformationTry.sampleRecord);
1851
1709
  const requestPath = "/1/transformations/try";
1852
1710
  const headers = {};
1853
1711
  const queryParameters = {};
@@ -1873,17 +1731,13 @@ function createIngestionClient({
1873
1731
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1874
1732
  */
1875
1733
  tryTransformationBeforeUpdate({ transformationID, transformationTry }, requestOptions) {
1876
- if (!transformationID) {
1877
- throw new Error("Parameter `transformationID` is required when calling `tryTransformationBeforeUpdate`.");
1878
- }
1879
- if (!transformationTry) {
1880
- throw new Error("Parameter `transformationTry` is required when calling `tryTransformationBeforeUpdate`.");
1881
- }
1882
- if (!transformationTry.sampleRecord) {
1883
- throw new Error(
1884
- "Parameter `transformationTry.sampleRecord` is required when calling `tryTransformationBeforeUpdate`."
1885
- );
1886
- }
1734
+ validateRequired("transformationID", "tryTransformationBeforeUpdate", transformationID);
1735
+ validateRequired("transformationTry", "tryTransformationBeforeUpdate", transformationTry);
1736
+ validateRequired(
1737
+ "transformationTry.sampleRecord",
1738
+ "tryTransformationBeforeUpdate",
1739
+ transformationTry.sampleRecord
1740
+ );
1887
1741
  const requestPath = "/1/transformations/{transformationID}/try".replace(
1888
1742
  "{transformationID}",
1889
1743
  encodeURIComponent(transformationID)
@@ -1912,12 +1766,8 @@ function createIngestionClient({
1912
1766
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1913
1767
  */
1914
1768
  updateAuthentication({ authenticationID, authenticationUpdate }, requestOptions) {
1915
- if (!authenticationID) {
1916
- throw new Error("Parameter `authenticationID` is required when calling `updateAuthentication`.");
1917
- }
1918
- if (!authenticationUpdate) {
1919
- throw new Error("Parameter `authenticationUpdate` is required when calling `updateAuthentication`.");
1920
- }
1769
+ validateRequired("authenticationID", "updateAuthentication", authenticationID);
1770
+ validateRequired("authenticationUpdate", "updateAuthentication", authenticationUpdate);
1921
1771
  const requestPath = "/1/authentications/{authenticationID}".replace(
1922
1772
  "{authenticationID}",
1923
1773
  encodeURIComponent(authenticationID)
@@ -1946,12 +1796,8 @@ function createIngestionClient({
1946
1796
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1947
1797
  */
1948
1798
  updateDestination({ destinationID, destinationUpdate }, requestOptions) {
1949
- if (!destinationID) {
1950
- throw new Error("Parameter `destinationID` is required when calling `updateDestination`.");
1951
- }
1952
- if (!destinationUpdate) {
1953
- throw new Error("Parameter `destinationUpdate` is required when calling `updateDestination`.");
1954
- }
1799
+ validateRequired("destinationID", "updateDestination", destinationID);
1800
+ validateRequired("destinationUpdate", "updateDestination", destinationUpdate);
1955
1801
  const requestPath = "/1/destinations/{destinationID}".replace(
1956
1802
  "{destinationID}",
1957
1803
  encodeURIComponent(destinationID)
@@ -1980,12 +1826,8 @@ function createIngestionClient({
1980
1826
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1981
1827
  */
1982
1828
  updateSource({ sourceID, sourceUpdate }, requestOptions) {
1983
- if (!sourceID) {
1984
- throw new Error("Parameter `sourceID` is required when calling `updateSource`.");
1985
- }
1986
- if (!sourceUpdate) {
1987
- throw new Error("Parameter `sourceUpdate` is required when calling `updateSource`.");
1988
- }
1829
+ validateRequired("sourceID", "updateSource", sourceID);
1830
+ validateRequired("sourceUpdate", "updateSource", sourceUpdate);
1989
1831
  const requestPath = "/1/sources/{sourceID}".replace("{sourceID}", encodeURIComponent(sourceID));
1990
1832
  const headers = {};
1991
1833
  const queryParameters = {};
@@ -2011,12 +1853,8 @@ function createIngestionClient({
2011
1853
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2012
1854
  */
2013
1855
  updateTask({ taskID, taskUpdate }, requestOptions) {
2014
- if (!taskID) {
2015
- throw new Error("Parameter `taskID` is required when calling `updateTask`.");
2016
- }
2017
- if (!taskUpdate) {
2018
- throw new Error("Parameter `taskUpdate` is required when calling `updateTask`.");
2019
- }
1856
+ validateRequired("taskID", "updateTask", taskID);
1857
+ validateRequired("taskUpdate", "updateTask", taskUpdate);
2020
1858
  const requestPath = "/2/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
2021
1859
  const headers = {};
2022
1860
  const queryParameters = {};
@@ -2044,12 +1882,8 @@ function createIngestionClient({
2044
1882
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2045
1883
  */
2046
1884
  updateTaskV1({ taskID, taskUpdate }, requestOptions) {
2047
- if (!taskID) {
2048
- throw new Error("Parameter `taskID` is required when calling `updateTaskV1`.");
2049
- }
2050
- if (!taskUpdate) {
2051
- throw new Error("Parameter `taskUpdate` is required when calling `updateTaskV1`.");
2052
- }
1885
+ validateRequired("taskID", "updateTaskV1", taskID);
1886
+ validateRequired("taskUpdate", "updateTaskV1", taskUpdate);
2053
1887
  const requestPath = "/1/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
2054
1888
  const headers = {};
2055
1889
  const queryParameters = {};
@@ -2075,15 +1909,9 @@ function createIngestionClient({
2075
1909
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2076
1910
  */
2077
1911
  updateTransformation({ transformationID, transformationCreate }, requestOptions) {
2078
- if (!transformationID) {
2079
- throw new Error("Parameter `transformationID` is required when calling `updateTransformation`.");
2080
- }
2081
- if (!transformationCreate) {
2082
- throw new Error("Parameter `transformationCreate` is required when calling `updateTransformation`.");
2083
- }
2084
- if (!transformationCreate.name) {
2085
- throw new Error("Parameter `transformationCreate.name` is required when calling `updateTransformation`.");
2086
- }
1912
+ validateRequired("transformationID", "updateTransformation", transformationID);
1913
+ validateRequired("transformationCreate", "updateTransformation", transformationCreate);
1914
+ validateRequired("transformationCreate.name", "updateTransformation", transformationCreate.name);
2087
1915
  const requestPath = "/1/transformations/{transformationID}".replace(
2088
1916
  "{transformationID}",
2089
1917
  encodeURIComponent(transformationID)
@@ -2143,12 +1971,8 @@ function createIngestionClient({
2143
1971
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2144
1972
  */
2145
1973
  validateSourceBeforeUpdate({ sourceID, sourceUpdate }, requestOptions) {
2146
- if (!sourceID) {
2147
- throw new Error("Parameter `sourceID` is required when calling `validateSourceBeforeUpdate`.");
2148
- }
2149
- if (!sourceUpdate) {
2150
- throw new Error("Parameter `sourceUpdate` is required when calling `validateSourceBeforeUpdate`.");
2151
- }
1974
+ validateRequired("sourceID", "validateSourceBeforeUpdate", sourceID);
1975
+ validateRequired("sourceUpdate", "validateSourceBeforeUpdate", sourceUpdate);
2152
1976
  const requestPath = "/1/sources/{sourceID}/validate".replace("{sourceID}", encodeURIComponent(sourceID));
2153
1977
  const headers = {};
2154
1978
  const queryParameters = {};