@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.
@@ -1,6 +1,12 @@
1
1
  // src/ingestionClient.ts
2
- import { createAuth, createIterablePromise, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
3
- var apiClientVersion = "1.53.0";
2
+ import {
3
+ createAuth,
4
+ createIterablePromise,
5
+ createTransporter,
6
+ getAlgoliaAgent,
7
+ validateRequired
8
+ } from "@algolia/client-common";
9
+ var apiClientVersion = "1.54.0";
4
10
  var REGIONS = ["eu", "us"];
5
11
  function getDefaultHosts(region) {
6
12
  const url = "data.{region}.algolia.com".replace("{region}", region);
@@ -165,18 +171,10 @@ function createIngestionClient({
165
171
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
166
172
  */
167
173
  createAuthentication(authenticationCreate, requestOptions) {
168
- if (!authenticationCreate) {
169
- throw new Error("Parameter `authenticationCreate` is required when calling `createAuthentication`.");
170
- }
171
- if (!authenticationCreate.type) {
172
- throw new Error("Parameter `authenticationCreate.type` is required when calling `createAuthentication`.");
173
- }
174
- if (!authenticationCreate.name) {
175
- throw new Error("Parameter `authenticationCreate.name` is required when calling `createAuthentication`.");
176
- }
177
- if (!authenticationCreate.input) {
178
- throw new Error("Parameter `authenticationCreate.input` is required when calling `createAuthentication`.");
179
- }
174
+ validateRequired("authenticationCreate", "createAuthentication", authenticationCreate);
175
+ validateRequired("authenticationCreate.type", "createAuthentication", authenticationCreate.type);
176
+ validateRequired("authenticationCreate.name", "createAuthentication", authenticationCreate.name);
177
+ validateRequired("authenticationCreate.input", "createAuthentication", authenticationCreate.input);
180
178
  const requestPath = "/1/authentications";
181
179
  const headers = {};
182
180
  const queryParameters = {};
@@ -200,18 +198,10 @@ function createIngestionClient({
200
198
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
201
199
  */
202
200
  createDestination(destinationCreate, requestOptions) {
203
- if (!destinationCreate) {
204
- throw new Error("Parameter `destinationCreate` is required when calling `createDestination`.");
205
- }
206
- if (!destinationCreate.type) {
207
- throw new Error("Parameter `destinationCreate.type` is required when calling `createDestination`.");
208
- }
209
- if (!destinationCreate.name) {
210
- throw new Error("Parameter `destinationCreate.name` is required when calling `createDestination`.");
211
- }
212
- if (!destinationCreate.input) {
213
- throw new Error("Parameter `destinationCreate.input` is required when calling `createDestination`.");
214
- }
201
+ validateRequired("destinationCreate", "createDestination", destinationCreate);
202
+ validateRequired("destinationCreate.type", "createDestination", destinationCreate.type);
203
+ validateRequired("destinationCreate.name", "createDestination", destinationCreate.name);
204
+ validateRequired("destinationCreate.input", "createDestination", destinationCreate.input);
215
205
  const requestPath = "/1/destinations";
216
206
  const headers = {};
217
207
  const queryParameters = {};
@@ -235,15 +225,9 @@ function createIngestionClient({
235
225
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
236
226
  */
237
227
  createSource(sourceCreate, requestOptions) {
238
- if (!sourceCreate) {
239
- throw new Error("Parameter `sourceCreate` is required when calling `createSource`.");
240
- }
241
- if (!sourceCreate.type) {
242
- throw new Error("Parameter `sourceCreate.type` is required when calling `createSource`.");
243
- }
244
- if (!sourceCreate.name) {
245
- throw new Error("Parameter `sourceCreate.name` is required when calling `createSource`.");
246
- }
228
+ validateRequired("sourceCreate", "createSource", sourceCreate);
229
+ validateRequired("sourceCreate.type", "createSource", sourceCreate.type);
230
+ validateRequired("sourceCreate.name", "createSource", sourceCreate.name);
247
231
  const requestPath = "/1/sources";
248
232
  const headers = {};
249
233
  const queryParameters = {};
@@ -267,18 +251,10 @@ function createIngestionClient({
267
251
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
268
252
  */
269
253
  createTask(taskCreate, requestOptions) {
270
- if (!taskCreate) {
271
- throw new Error("Parameter `taskCreate` is required when calling `createTask`.");
272
- }
273
- if (!taskCreate.sourceID) {
274
- throw new Error("Parameter `taskCreate.sourceID` is required when calling `createTask`.");
275
- }
276
- if (!taskCreate.destinationID) {
277
- throw new Error("Parameter `taskCreate.destinationID` is required when calling `createTask`.");
278
- }
279
- if (!taskCreate.action) {
280
- throw new Error("Parameter `taskCreate.action` is required when calling `createTask`.");
281
- }
254
+ validateRequired("taskCreate", "createTask", taskCreate);
255
+ validateRequired("taskCreate.sourceID", "createTask", taskCreate.sourceID);
256
+ validateRequired("taskCreate.destinationID", "createTask", taskCreate.destinationID);
257
+ validateRequired("taskCreate.action", "createTask", taskCreate.action);
282
258
  const requestPath = "/2/tasks";
283
259
  const headers = {};
284
260
  const queryParameters = {};
@@ -304,21 +280,11 @@ function createIngestionClient({
304
280
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
305
281
  */
306
282
  createTaskV1(taskCreate, requestOptions) {
307
- if (!taskCreate) {
308
- throw new Error("Parameter `taskCreate` is required when calling `createTaskV1`.");
309
- }
310
- if (!taskCreate.sourceID) {
311
- throw new Error("Parameter `taskCreate.sourceID` is required when calling `createTaskV1`.");
312
- }
313
- if (!taskCreate.destinationID) {
314
- throw new Error("Parameter `taskCreate.destinationID` is required when calling `createTaskV1`.");
315
- }
316
- if (!taskCreate.trigger) {
317
- throw new Error("Parameter `taskCreate.trigger` is required when calling `createTaskV1`.");
318
- }
319
- if (!taskCreate.action) {
320
- throw new Error("Parameter `taskCreate.action` is required when calling `createTaskV1`.");
321
- }
283
+ validateRequired("taskCreate", "createTaskV1", taskCreate);
284
+ validateRequired("taskCreate.sourceID", "createTaskV1", taskCreate.sourceID);
285
+ validateRequired("taskCreate.destinationID", "createTaskV1", taskCreate.destinationID);
286
+ validateRequired("taskCreate.trigger", "createTaskV1", taskCreate.trigger);
287
+ validateRequired("taskCreate.action", "createTaskV1", taskCreate.action);
322
288
  const requestPath = "/1/tasks";
323
289
  const headers = {};
324
290
  const queryParameters = {};
@@ -342,12 +308,8 @@ function createIngestionClient({
342
308
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
343
309
  */
344
310
  createTransformation(transformationCreate, requestOptions) {
345
- if (!transformationCreate) {
346
- throw new Error("Parameter `transformationCreate` is required when calling `createTransformation`.");
347
- }
348
- if (!transformationCreate.name) {
349
- throw new Error("Parameter `transformationCreate.name` is required when calling `createTransformation`.");
350
- }
311
+ validateRequired("transformationCreate", "createTransformation", transformationCreate);
312
+ validateRequired("transformationCreate.name", "createTransformation", transformationCreate.name);
351
313
  const requestPath = "/1/transformations";
352
314
  const headers = {};
353
315
  const queryParameters = {};
@@ -368,9 +330,7 @@ function createIngestionClient({
368
330
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
369
331
  */
370
332
  customDelete({ path, parameters }, requestOptions) {
371
- if (!path) {
372
- throw new Error("Parameter `path` is required when calling `customDelete`.");
373
- }
333
+ validateRequired("path", "customDelete", path);
374
334
  const requestPath = "/{path}".replace("{path}", path);
375
335
  const headers = {};
376
336
  const queryParameters = parameters ? parameters : {};
@@ -390,9 +350,7 @@ function createIngestionClient({
390
350
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
391
351
  */
392
352
  customGet({ path, parameters }, requestOptions) {
393
- if (!path) {
394
- throw new Error("Parameter `path` is required when calling `customGet`.");
395
- }
353
+ validateRequired("path", "customGet", path);
396
354
  const requestPath = "/{path}".replace("{path}", path);
397
355
  const headers = {};
398
356
  const queryParameters = parameters ? parameters : {};
@@ -413,9 +371,7 @@ function createIngestionClient({
413
371
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
414
372
  */
415
373
  customPost({ path, parameters, body }, requestOptions) {
416
- if (!path) {
417
- throw new Error("Parameter `path` is required when calling `customPost`.");
418
- }
374
+ validateRequired("path", "customPost", path);
419
375
  const requestPath = "/{path}".replace("{path}", path);
420
376
  const headers = {};
421
377
  const queryParameters = parameters ? parameters : {};
@@ -437,9 +393,7 @@ function createIngestionClient({
437
393
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
438
394
  */
439
395
  customPut({ path, parameters, body }, requestOptions) {
440
- if (!path) {
441
- throw new Error("Parameter `path` is required when calling `customPut`.");
442
- }
396
+ validateRequired("path", "customPut", path);
443
397
  const requestPath = "/{path}".replace("{path}", path);
444
398
  const headers = {};
445
399
  const queryParameters = parameters ? parameters : {};
@@ -464,9 +418,7 @@ function createIngestionClient({
464
418
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
465
419
  */
466
420
  deleteAuthentication({ authenticationID }, requestOptions) {
467
- if (!authenticationID) {
468
- throw new Error("Parameter `authenticationID` is required when calling `deleteAuthentication`.");
469
- }
421
+ validateRequired("authenticationID", "deleteAuthentication", authenticationID);
470
422
  const requestPath = "/1/authentications/{authenticationID}".replace(
471
423
  "{authenticationID}",
472
424
  encodeURIComponent(authenticationID)
@@ -493,9 +445,7 @@ function createIngestionClient({
493
445
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
494
446
  */
495
447
  deleteDestination({ destinationID }, requestOptions) {
496
- if (!destinationID) {
497
- throw new Error("Parameter `destinationID` is required when calling `deleteDestination`.");
498
- }
448
+ validateRequired("destinationID", "deleteDestination", destinationID);
499
449
  const requestPath = "/1/destinations/{destinationID}".replace(
500
450
  "{destinationID}",
501
451
  encodeURIComponent(destinationID)
@@ -522,9 +472,7 @@ function createIngestionClient({
522
472
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
523
473
  */
524
474
  deleteSource({ sourceID }, requestOptions) {
525
- if (!sourceID) {
526
- throw new Error("Parameter `sourceID` is required when calling `deleteSource`.");
527
- }
475
+ validateRequired("sourceID", "deleteSource", sourceID);
528
476
  const requestPath = "/1/sources/{sourceID}".replace("{sourceID}", encodeURIComponent(sourceID));
529
477
  const headers = {};
530
478
  const queryParameters = {};
@@ -548,9 +496,7 @@ function createIngestionClient({
548
496
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
549
497
  */
550
498
  deleteTask({ taskID }, requestOptions) {
551
- if (!taskID) {
552
- throw new Error("Parameter `taskID` is required when calling `deleteTask`.");
553
- }
499
+ validateRequired("taskID", "deleteTask", taskID);
554
500
  const requestPath = "/2/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
555
501
  const headers = {};
556
502
  const queryParameters = {};
@@ -576,9 +522,7 @@ function createIngestionClient({
576
522
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
577
523
  */
578
524
  deleteTaskV1({ taskID }, requestOptions) {
579
- if (!taskID) {
580
- throw new Error("Parameter `taskID` is required when calling `deleteTaskV1`.");
581
- }
525
+ validateRequired("taskID", "deleteTaskV1", taskID);
582
526
  const requestPath = "/1/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
583
527
  const headers = {};
584
528
  const queryParameters = {};
@@ -602,9 +546,7 @@ function createIngestionClient({
602
546
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
603
547
  */
604
548
  deleteTransformation({ transformationID }, requestOptions) {
605
- if (!transformationID) {
606
- throw new Error("Parameter `transformationID` is required when calling `deleteTransformation`.");
607
- }
549
+ validateRequired("transformationID", "deleteTransformation", transformationID);
608
550
  const requestPath = "/1/transformations/{transformationID}".replace(
609
551
  "{transformationID}",
610
552
  encodeURIComponent(transformationID)
@@ -631,9 +573,7 @@ function createIngestionClient({
631
573
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
632
574
  */
633
575
  disableTask({ taskID }, requestOptions) {
634
- if (!taskID) {
635
- throw new Error("Parameter `taskID` is required when calling `disableTask`.");
636
- }
576
+ validateRequired("taskID", "disableTask", taskID);
637
577
  const requestPath = "/2/tasks/{taskID}/disable".replace("{taskID}", encodeURIComponent(taskID));
638
578
  const headers = {};
639
579
  const queryParameters = {};
@@ -659,9 +599,7 @@ function createIngestionClient({
659
599
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
660
600
  */
661
601
  disableTaskV1({ taskID }, requestOptions) {
662
- if (!taskID) {
663
- throw new Error("Parameter `taskID` is required when calling `disableTaskV1`.");
664
- }
602
+ validateRequired("taskID", "disableTaskV1", taskID);
665
603
  const requestPath = "/1/tasks/{taskID}/disable".replace("{taskID}", encodeURIComponent(taskID));
666
604
  const headers = {};
667
605
  const queryParameters = {};
@@ -685,9 +623,7 @@ function createIngestionClient({
685
623
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
686
624
  */
687
625
  enableTask({ taskID }, requestOptions) {
688
- if (!taskID) {
689
- throw new Error("Parameter `taskID` is required when calling `enableTask`.");
690
- }
626
+ validateRequired("taskID", "enableTask", taskID);
691
627
  const requestPath = "/2/tasks/{taskID}/enable".replace("{taskID}", encodeURIComponent(taskID));
692
628
  const headers = {};
693
629
  const queryParameters = {};
@@ -713,9 +649,7 @@ function createIngestionClient({
713
649
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
714
650
  */
715
651
  enableTaskV1({ taskID }, requestOptions) {
716
- if (!taskID) {
717
- throw new Error("Parameter `taskID` is required when calling `enableTaskV1`.");
718
- }
652
+ validateRequired("taskID", "enableTaskV1", taskID);
719
653
  const requestPath = "/1/tasks/{taskID}/enable".replace("{taskID}", encodeURIComponent(taskID));
720
654
  const headers = {};
721
655
  const queryParameters = {};
@@ -739,9 +673,7 @@ function createIngestionClient({
739
673
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
740
674
  */
741
675
  getAuthentication({ authenticationID }, requestOptions) {
742
- if (!authenticationID) {
743
- throw new Error("Parameter `authenticationID` is required when calling `getAuthentication`.");
744
- }
676
+ validateRequired("authenticationID", "getAuthentication", authenticationID);
745
677
  const requestPath = "/1/authentications/{authenticationID}".replace(
746
678
  "{authenticationID}",
747
679
  encodeURIComponent(authenticationID)
@@ -768,9 +700,7 @@ function createIngestionClient({
768
700
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
769
701
  */
770
702
  getDestination({ destinationID }, requestOptions) {
771
- if (!destinationID) {
772
- throw new Error("Parameter `destinationID` is required when calling `getDestination`.");
773
- }
703
+ validateRequired("destinationID", "getDestination", destinationID);
774
704
  const requestPath = "/1/destinations/{destinationID}".replace(
775
705
  "{destinationID}",
776
706
  encodeURIComponent(destinationID)
@@ -798,12 +728,8 @@ function createIngestionClient({
798
728
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
799
729
  */
800
730
  getEvent({ runID, eventID }, requestOptions) {
801
- if (!runID) {
802
- throw new Error("Parameter `runID` is required when calling `getEvent`.");
803
- }
804
- if (!eventID) {
805
- throw new Error("Parameter `eventID` is required when calling `getEvent`.");
806
- }
731
+ validateRequired("runID", "getEvent", runID);
732
+ validateRequired("eventID", "getEvent", eventID);
807
733
  const requestPath = "/1/runs/{runID}/events/{eventID}".replace("{runID}", encodeURIComponent(runID)).replace("{eventID}", encodeURIComponent(eventID));
808
734
  const headers = {};
809
735
  const queryParameters = {};
@@ -827,9 +753,7 @@ function createIngestionClient({
827
753
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
828
754
  */
829
755
  getRun({ runID }, requestOptions) {
830
- if (!runID) {
831
- throw new Error("Parameter `runID` is required when calling `getRun`.");
832
- }
756
+ validateRequired("runID", "getRun", runID);
833
757
  const requestPath = "/1/runs/{runID}".replace("{runID}", encodeURIComponent(runID));
834
758
  const headers = {};
835
759
  const queryParameters = {};
@@ -853,9 +777,7 @@ function createIngestionClient({
853
777
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
854
778
  */
855
779
  getSource({ sourceID }, requestOptions) {
856
- if (!sourceID) {
857
- throw new Error("Parameter `sourceID` is required when calling `getSource`.");
858
- }
780
+ validateRequired("sourceID", "getSource", sourceID);
859
781
  const requestPath = "/1/sources/{sourceID}".replace("{sourceID}", encodeURIComponent(sourceID));
860
782
  const headers = {};
861
783
  const queryParameters = {};
@@ -879,9 +801,7 @@ function createIngestionClient({
879
801
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
880
802
  */
881
803
  getTask({ taskID }, requestOptions) {
882
- if (!taskID) {
883
- throw new Error("Parameter `taskID` is required when calling `getTask`.");
884
- }
804
+ validateRequired("taskID", "getTask", taskID);
885
805
  const requestPath = "/2/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
886
806
  const headers = {};
887
807
  const queryParameters = {};
@@ -907,9 +827,7 @@ function createIngestionClient({
907
827
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
908
828
  */
909
829
  getTaskV1({ taskID }, requestOptions) {
910
- if (!taskID) {
911
- throw new Error("Parameter `taskID` is required when calling `getTaskV1`.");
912
- }
830
+ validateRequired("taskID", "getTaskV1", taskID);
913
831
  const requestPath = "/1/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
914
832
  const headers = {};
915
833
  const queryParameters = {};
@@ -933,9 +851,7 @@ function createIngestionClient({
933
851
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
934
852
  */
935
853
  getTransformation({ transformationID }, requestOptions) {
936
- if (!transformationID) {
937
- throw new Error("Parameter `transformationID` is required when calling `getTransformation`.");
938
- }
854
+ validateRequired("transformationID", "getTransformation", transformationID);
939
855
  const requestPath = "/1/transformations/{transformationID}".replace(
940
856
  "{transformationID}",
941
857
  encodeURIComponent(transformationID)
@@ -1066,9 +982,7 @@ function createIngestionClient({
1066
982
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1067
983
  */
1068
984
  listEvents({ runID, itemsPerPage, page, status, type, sort, order, startDate, endDate }, requestOptions) {
1069
- if (!runID) {
1070
- throw new Error("Parameter `runID` is required when calling `listEvents`.");
1071
- }
985
+ validateRequired("runID", "listEvents", runID);
1072
986
  const requestPath = "/1/runs/{runID}/events".replace("{runID}", encodeURIComponent(runID));
1073
987
  const headers = {};
1074
988
  const queryParameters = {};
@@ -1403,18 +1317,10 @@ function createIngestionClient({
1403
1317
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1404
1318
  */
1405
1319
  push({ indexName, pushTaskPayload, watch, referenceIndexName }, requestOptions) {
1406
- if (!indexName) {
1407
- throw new Error("Parameter `indexName` is required when calling `push`.");
1408
- }
1409
- if (!pushTaskPayload) {
1410
- throw new Error("Parameter `pushTaskPayload` is required when calling `push`.");
1411
- }
1412
- if (!pushTaskPayload.action) {
1413
- throw new Error("Parameter `pushTaskPayload.action` is required when calling `push`.");
1414
- }
1415
- if (!pushTaskPayload.records) {
1416
- throw new Error("Parameter `pushTaskPayload.records` is required when calling `push`.");
1417
- }
1320
+ validateRequired("indexName", "push", indexName);
1321
+ validateRequired("pushTaskPayload", "push", pushTaskPayload);
1322
+ validateRequired("pushTaskPayload.action", "push", pushTaskPayload.action);
1323
+ validateRequired("pushTaskPayload.records", "push", pushTaskPayload.records);
1418
1324
  const requestPath = "/1/push/{indexName}".replace("{indexName}", encodeURIComponent(indexName));
1419
1325
  const headers = {};
1420
1326
  const queryParameters = {};
@@ -1455,18 +1361,10 @@ function createIngestionClient({
1455
1361
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1456
1362
  */
1457
1363
  pushTask({ taskID, pushTaskPayload, watch }, requestOptions) {
1458
- if (!taskID) {
1459
- throw new Error("Parameter `taskID` is required when calling `pushTask`.");
1460
- }
1461
- if (!pushTaskPayload) {
1462
- throw new Error("Parameter `pushTaskPayload` is required when calling `pushTask`.");
1463
- }
1464
- if (!pushTaskPayload.action) {
1465
- throw new Error("Parameter `pushTaskPayload.action` is required when calling `pushTask`.");
1466
- }
1467
- if (!pushTaskPayload.records) {
1468
- throw new Error("Parameter `pushTaskPayload.records` is required when calling `pushTask`.");
1469
- }
1364
+ validateRequired("taskID", "pushTask", taskID);
1365
+ validateRequired("pushTaskPayload", "pushTask", pushTaskPayload);
1366
+ validateRequired("pushTaskPayload.action", "pushTask", pushTaskPayload.action);
1367
+ validateRequired("pushTaskPayload.records", "pushTask", pushTaskPayload.records);
1470
1368
  const requestPath = "/2/tasks/{taskID}/push".replace("{taskID}", encodeURIComponent(taskID));
1471
1369
  const headers = {};
1472
1370
  const queryParameters = {};
@@ -1503,18 +1401,10 @@ function createIngestionClient({
1503
1401
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1504
1402
  */
1505
1403
  replaceTask({ taskID, taskReplace }, requestOptions) {
1506
- if (!taskID) {
1507
- throw new Error("Parameter `taskID` is required when calling `replaceTask`.");
1508
- }
1509
- if (!taskReplace) {
1510
- throw new Error("Parameter `taskReplace` is required when calling `replaceTask`.");
1511
- }
1512
- if (!taskReplace.destinationID) {
1513
- throw new Error("Parameter `taskReplace.destinationID` is required when calling `replaceTask`.");
1514
- }
1515
- if (!taskReplace.action) {
1516
- throw new Error("Parameter `taskReplace.action` is required when calling `replaceTask`.");
1517
- }
1404
+ validateRequired("taskID", "replaceTask", taskID);
1405
+ validateRequired("taskReplace", "replaceTask", taskReplace);
1406
+ validateRequired("taskReplace.destinationID", "replaceTask", taskReplace.destinationID);
1407
+ validateRequired("taskReplace.action", "replaceTask", taskReplace.action);
1518
1408
  const requestPath = "/2/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
1519
1409
  const headers = {};
1520
1410
  const queryParameters = {};
@@ -1540,9 +1430,7 @@ function createIngestionClient({
1540
1430
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1541
1431
  */
1542
1432
  runSource({ sourceID, runSourcePayload }, requestOptions) {
1543
- if (!sourceID) {
1544
- throw new Error("Parameter `sourceID` is required when calling `runSource`.");
1545
- }
1433
+ validateRequired("sourceID", "runSource", sourceID);
1546
1434
  const requestPath = "/1/sources/{sourceID}/run".replace("{sourceID}", encodeURIComponent(sourceID));
1547
1435
  const headers = {};
1548
1436
  const queryParameters = {};
@@ -1568,9 +1456,7 @@ function createIngestionClient({
1568
1456
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1569
1457
  */
1570
1458
  runTask({ taskID, runTaskPayload }, requestOptions) {
1571
- if (!taskID) {
1572
- throw new Error("Parameter `taskID` is required when calling `runTask`.");
1573
- }
1459
+ validateRequired("taskID", "runTask", taskID);
1574
1460
  const requestPath = "/2/tasks/{taskID}/run".replace("{taskID}", encodeURIComponent(taskID));
1575
1461
  const headers = {};
1576
1462
  const queryParameters = {};
@@ -1598,9 +1484,7 @@ function createIngestionClient({
1598
1484
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1599
1485
  */
1600
1486
  runTaskV1({ taskID, runTaskPayload }, requestOptions) {
1601
- if (!taskID) {
1602
- throw new Error("Parameter `taskID` is required when calling `runTaskV1`.");
1603
- }
1487
+ validateRequired("taskID", "runTaskV1", taskID);
1604
1488
  const requestPath = "/1/tasks/{taskID}/run".replace("{taskID}", encodeURIComponent(taskID));
1605
1489
  const headers = {};
1606
1490
  const queryParameters = {};
@@ -1624,14 +1508,12 @@ function createIngestionClient({
1624
1508
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1625
1509
  */
1626
1510
  searchAuthentications(authenticationSearch, requestOptions) {
1627
- if (!authenticationSearch) {
1628
- throw new Error("Parameter `authenticationSearch` is required when calling `searchAuthentications`.");
1629
- }
1630
- if (!authenticationSearch.authenticationIDs) {
1631
- throw new Error(
1632
- "Parameter `authenticationSearch.authenticationIDs` is required when calling `searchAuthentications`."
1633
- );
1634
- }
1511
+ validateRequired("authenticationSearch", "searchAuthentications", authenticationSearch);
1512
+ validateRequired(
1513
+ "authenticationSearch.authenticationIDs",
1514
+ "searchAuthentications",
1515
+ authenticationSearch.authenticationIDs
1516
+ );
1635
1517
  const requestPath = "/1/authentications/search";
1636
1518
  const headers = {};
1637
1519
  const queryParameters = {};
@@ -1655,12 +1537,8 @@ function createIngestionClient({
1655
1537
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1656
1538
  */
1657
1539
  searchDestinations(destinationSearch, requestOptions) {
1658
- if (!destinationSearch) {
1659
- throw new Error("Parameter `destinationSearch` is required when calling `searchDestinations`.");
1660
- }
1661
- if (!destinationSearch.destinationIDs) {
1662
- throw new Error("Parameter `destinationSearch.destinationIDs` is required when calling `searchDestinations`.");
1663
- }
1540
+ validateRequired("destinationSearch", "searchDestinations", destinationSearch);
1541
+ validateRequired("destinationSearch.destinationIDs", "searchDestinations", destinationSearch.destinationIDs);
1664
1542
  const requestPath = "/1/destinations/search";
1665
1543
  const headers = {};
1666
1544
  const queryParameters = {};
@@ -1684,12 +1562,8 @@ function createIngestionClient({
1684
1562
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1685
1563
  */
1686
1564
  searchSources(sourceSearch, requestOptions) {
1687
- if (!sourceSearch) {
1688
- throw new Error("Parameter `sourceSearch` is required when calling `searchSources`.");
1689
- }
1690
- if (!sourceSearch.sourceIDs) {
1691
- throw new Error("Parameter `sourceSearch.sourceIDs` is required when calling `searchSources`.");
1692
- }
1565
+ validateRequired("sourceSearch", "searchSources", sourceSearch);
1566
+ validateRequired("sourceSearch.sourceIDs", "searchSources", sourceSearch.sourceIDs);
1693
1567
  const requestPath = "/1/sources/search";
1694
1568
  const headers = {};
1695
1569
  const queryParameters = {};
@@ -1713,12 +1587,8 @@ function createIngestionClient({
1713
1587
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1714
1588
  */
1715
1589
  searchTasks(taskSearch, requestOptions) {
1716
- if (!taskSearch) {
1717
- throw new Error("Parameter `taskSearch` is required when calling `searchTasks`.");
1718
- }
1719
- if (!taskSearch.taskIDs) {
1720
- throw new Error("Parameter `taskSearch.taskIDs` is required when calling `searchTasks`.");
1721
- }
1590
+ validateRequired("taskSearch", "searchTasks", taskSearch);
1591
+ validateRequired("taskSearch.taskIDs", "searchTasks", taskSearch.taskIDs);
1722
1592
  const requestPath = "/2/tasks/search";
1723
1593
  const headers = {};
1724
1594
  const queryParameters = {};
@@ -1744,12 +1614,8 @@ function createIngestionClient({
1744
1614
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1745
1615
  */
1746
1616
  searchTasksV1(taskSearch, requestOptions) {
1747
- if (!taskSearch) {
1748
- throw new Error("Parameter `taskSearch` is required when calling `searchTasksV1`.");
1749
- }
1750
- if (!taskSearch.taskIDs) {
1751
- throw new Error("Parameter `taskSearch.taskIDs` is required when calling `searchTasksV1`.");
1752
- }
1617
+ validateRequired("taskSearch", "searchTasksV1", taskSearch);
1618
+ validateRequired("taskSearch.taskIDs", "searchTasksV1", taskSearch.taskIDs);
1753
1619
  const requestPath = "/1/tasks/search";
1754
1620
  const headers = {};
1755
1621
  const queryParameters = {};
@@ -1773,14 +1639,12 @@ function createIngestionClient({
1773
1639
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1774
1640
  */
1775
1641
  searchTransformations(transformationSearch, requestOptions) {
1776
- if (!transformationSearch) {
1777
- throw new Error("Parameter `transformationSearch` is required when calling `searchTransformations`.");
1778
- }
1779
- if (!transformationSearch.transformationIDs) {
1780
- throw new Error(
1781
- "Parameter `transformationSearch.transformationIDs` is required when calling `searchTransformations`."
1782
- );
1783
- }
1642
+ validateRequired("transformationSearch", "searchTransformations", transformationSearch);
1643
+ validateRequired(
1644
+ "transformationSearch.transformationIDs",
1645
+ "searchTransformations",
1646
+ transformationSearch.transformationIDs
1647
+ );
1784
1648
  const requestPath = "/1/transformations/search";
1785
1649
  const headers = {};
1786
1650
  const queryParameters = {};
@@ -1805,9 +1669,7 @@ function createIngestionClient({
1805
1669
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1806
1670
  */
1807
1671
  triggerDockerSourceDiscover({ sourceID }, requestOptions) {
1808
- if (!sourceID) {
1809
- throw new Error("Parameter `sourceID` is required when calling `triggerDockerSourceDiscover`.");
1810
- }
1672
+ validateRequired("sourceID", "triggerDockerSourceDiscover", sourceID);
1811
1673
  const requestPath = "/1/sources/{sourceID}/discover".replace("{sourceID}", encodeURIComponent(sourceID));
1812
1674
  const headers = {};
1813
1675
  const queryParameters = {};
@@ -1838,12 +1700,8 @@ function createIngestionClient({
1838
1700
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1839
1701
  */
1840
1702
  tryTransformation(transformationTry, requestOptions) {
1841
- if (!transformationTry) {
1842
- throw new Error("Parameter `transformationTry` is required when calling `tryTransformation`.");
1843
- }
1844
- if (!transformationTry.sampleRecord) {
1845
- throw new Error("Parameter `transformationTry.sampleRecord` is required when calling `tryTransformation`.");
1846
- }
1703
+ validateRequired("transformationTry", "tryTransformation", transformationTry);
1704
+ validateRequired("transformationTry.sampleRecord", "tryTransformation", transformationTry.sampleRecord);
1847
1705
  const requestPath = "/1/transformations/try";
1848
1706
  const headers = {};
1849
1707
  const queryParameters = {};
@@ -1869,17 +1727,13 @@ function createIngestionClient({
1869
1727
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1870
1728
  */
1871
1729
  tryTransformationBeforeUpdate({ transformationID, transformationTry }, requestOptions) {
1872
- if (!transformationID) {
1873
- throw new Error("Parameter `transformationID` is required when calling `tryTransformationBeforeUpdate`.");
1874
- }
1875
- if (!transformationTry) {
1876
- throw new Error("Parameter `transformationTry` is required when calling `tryTransformationBeforeUpdate`.");
1877
- }
1878
- if (!transformationTry.sampleRecord) {
1879
- throw new Error(
1880
- "Parameter `transformationTry.sampleRecord` is required when calling `tryTransformationBeforeUpdate`."
1881
- );
1882
- }
1730
+ validateRequired("transformationID", "tryTransformationBeforeUpdate", transformationID);
1731
+ validateRequired("transformationTry", "tryTransformationBeforeUpdate", transformationTry);
1732
+ validateRequired(
1733
+ "transformationTry.sampleRecord",
1734
+ "tryTransformationBeforeUpdate",
1735
+ transformationTry.sampleRecord
1736
+ );
1883
1737
  const requestPath = "/1/transformations/{transformationID}/try".replace(
1884
1738
  "{transformationID}",
1885
1739
  encodeURIComponent(transformationID)
@@ -1908,12 +1762,8 @@ function createIngestionClient({
1908
1762
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1909
1763
  */
1910
1764
  updateAuthentication({ authenticationID, authenticationUpdate }, requestOptions) {
1911
- if (!authenticationID) {
1912
- throw new Error("Parameter `authenticationID` is required when calling `updateAuthentication`.");
1913
- }
1914
- if (!authenticationUpdate) {
1915
- throw new Error("Parameter `authenticationUpdate` is required when calling `updateAuthentication`.");
1916
- }
1765
+ validateRequired("authenticationID", "updateAuthentication", authenticationID);
1766
+ validateRequired("authenticationUpdate", "updateAuthentication", authenticationUpdate);
1917
1767
  const requestPath = "/1/authentications/{authenticationID}".replace(
1918
1768
  "{authenticationID}",
1919
1769
  encodeURIComponent(authenticationID)
@@ -1942,12 +1792,8 @@ function createIngestionClient({
1942
1792
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1943
1793
  */
1944
1794
  updateDestination({ destinationID, destinationUpdate }, requestOptions) {
1945
- if (!destinationID) {
1946
- throw new Error("Parameter `destinationID` is required when calling `updateDestination`.");
1947
- }
1948
- if (!destinationUpdate) {
1949
- throw new Error("Parameter `destinationUpdate` is required when calling `updateDestination`.");
1950
- }
1795
+ validateRequired("destinationID", "updateDestination", destinationID);
1796
+ validateRequired("destinationUpdate", "updateDestination", destinationUpdate);
1951
1797
  const requestPath = "/1/destinations/{destinationID}".replace(
1952
1798
  "{destinationID}",
1953
1799
  encodeURIComponent(destinationID)
@@ -1976,12 +1822,8 @@ function createIngestionClient({
1976
1822
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1977
1823
  */
1978
1824
  updateSource({ sourceID, sourceUpdate }, requestOptions) {
1979
- if (!sourceID) {
1980
- throw new Error("Parameter `sourceID` is required when calling `updateSource`.");
1981
- }
1982
- if (!sourceUpdate) {
1983
- throw new Error("Parameter `sourceUpdate` is required when calling `updateSource`.");
1984
- }
1825
+ validateRequired("sourceID", "updateSource", sourceID);
1826
+ validateRequired("sourceUpdate", "updateSource", sourceUpdate);
1985
1827
  const requestPath = "/1/sources/{sourceID}".replace("{sourceID}", encodeURIComponent(sourceID));
1986
1828
  const headers = {};
1987
1829
  const queryParameters = {};
@@ -2007,12 +1849,8 @@ function createIngestionClient({
2007
1849
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2008
1850
  */
2009
1851
  updateTask({ taskID, taskUpdate }, requestOptions) {
2010
- if (!taskID) {
2011
- throw new Error("Parameter `taskID` is required when calling `updateTask`.");
2012
- }
2013
- if (!taskUpdate) {
2014
- throw new Error("Parameter `taskUpdate` is required when calling `updateTask`.");
2015
- }
1852
+ validateRequired("taskID", "updateTask", taskID);
1853
+ validateRequired("taskUpdate", "updateTask", taskUpdate);
2016
1854
  const requestPath = "/2/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
2017
1855
  const headers = {};
2018
1856
  const queryParameters = {};
@@ -2040,12 +1878,8 @@ function createIngestionClient({
2040
1878
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2041
1879
  */
2042
1880
  updateTaskV1({ taskID, taskUpdate }, requestOptions) {
2043
- if (!taskID) {
2044
- throw new Error("Parameter `taskID` is required when calling `updateTaskV1`.");
2045
- }
2046
- if (!taskUpdate) {
2047
- throw new Error("Parameter `taskUpdate` is required when calling `updateTaskV1`.");
2048
- }
1881
+ validateRequired("taskID", "updateTaskV1", taskID);
1882
+ validateRequired("taskUpdate", "updateTaskV1", taskUpdate);
2049
1883
  const requestPath = "/1/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
2050
1884
  const headers = {};
2051
1885
  const queryParameters = {};
@@ -2071,15 +1905,9 @@ function createIngestionClient({
2071
1905
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2072
1906
  */
2073
1907
  updateTransformation({ transformationID, transformationCreate }, requestOptions) {
2074
- if (!transformationID) {
2075
- throw new Error("Parameter `transformationID` is required when calling `updateTransformation`.");
2076
- }
2077
- if (!transformationCreate) {
2078
- throw new Error("Parameter `transformationCreate` is required when calling `updateTransformation`.");
2079
- }
2080
- if (!transformationCreate.name) {
2081
- throw new Error("Parameter `transformationCreate.name` is required when calling `updateTransformation`.");
2082
- }
1908
+ validateRequired("transformationID", "updateTransformation", transformationID);
1909
+ validateRequired("transformationCreate", "updateTransformation", transformationCreate);
1910
+ validateRequired("transformationCreate.name", "updateTransformation", transformationCreate.name);
2083
1911
  const requestPath = "/1/transformations/{transformationID}".replace(
2084
1912
  "{transformationID}",
2085
1913
  encodeURIComponent(transformationID)
@@ -2139,12 +1967,8 @@ function createIngestionClient({
2139
1967
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2140
1968
  */
2141
1969
  validateSourceBeforeUpdate({ sourceID, sourceUpdate }, requestOptions) {
2142
- if (!sourceID) {
2143
- throw new Error("Parameter `sourceID` is required when calling `validateSourceBeforeUpdate`.");
2144
- }
2145
- if (!sourceUpdate) {
2146
- throw new Error("Parameter `sourceUpdate` is required when calling `validateSourceBeforeUpdate`.");
2147
- }
1970
+ validateRequired("sourceID", "validateSourceBeforeUpdate", sourceID);
1971
+ validateRequired("sourceUpdate", "validateSourceBeforeUpdate", sourceUpdate);
2148
1972
  const requestPath = "/1/sources/{sourceID}/validate".replace("{sourceID}", encodeURIComponent(sourceID));
2149
1973
  const headers = {};
2150
1974
  const queryParameters = {};