@algolia/ingestion 1.53.0 → 1.54.1

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