@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.
@@ -8,8 +8,14 @@ import {
8
8
  import { createXhrRequester } from "@algolia/requester-browser-xhr";
9
9
 
10
10
  // src/ingestionClient.ts
11
- import { createAuth, createIterablePromise, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
12
- var apiClientVersion = "1.53.0";
11
+ import {
12
+ createAuth,
13
+ createIterablePromise,
14
+ createTransporter,
15
+ getAlgoliaAgent,
16
+ validateRequired
17
+ } from "@algolia/client-common";
18
+ var apiClientVersion = "1.54.1";
13
19
  var REGIONS = ["eu", "us"];
14
20
  function getDefaultHosts(region) {
15
21
  const url = "data.{region}.algolia.com".replace("{region}", region);
@@ -174,18 +180,10 @@ function createIngestionClient({
174
180
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
175
181
  */
176
182
  createAuthentication(authenticationCreate, requestOptions) {
177
- if (!authenticationCreate) {
178
- throw new Error("Parameter `authenticationCreate` is required when calling `createAuthentication`.");
179
- }
180
- if (!authenticationCreate.type) {
181
- throw new Error("Parameter `authenticationCreate.type` is required when calling `createAuthentication`.");
182
- }
183
- if (!authenticationCreate.name) {
184
- throw new Error("Parameter `authenticationCreate.name` is required when calling `createAuthentication`.");
185
- }
186
- if (!authenticationCreate.input) {
187
- throw new Error("Parameter `authenticationCreate.input` is required when calling `createAuthentication`.");
188
- }
183
+ validateRequired("authenticationCreate", "createAuthentication", authenticationCreate);
184
+ validateRequired("authenticationCreate.type", "createAuthentication", authenticationCreate.type);
185
+ validateRequired("authenticationCreate.name", "createAuthentication", authenticationCreate.name);
186
+ validateRequired("authenticationCreate.input", "createAuthentication", authenticationCreate.input);
189
187
  const requestPath = "/1/authentications";
190
188
  const headers = {};
191
189
  const queryParameters = {};
@@ -209,18 +207,10 @@ function createIngestionClient({
209
207
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
210
208
  */
211
209
  createDestination(destinationCreate, requestOptions) {
212
- if (!destinationCreate) {
213
- throw new Error("Parameter `destinationCreate` is required when calling `createDestination`.");
214
- }
215
- if (!destinationCreate.type) {
216
- throw new Error("Parameter `destinationCreate.type` is required when calling `createDestination`.");
217
- }
218
- if (!destinationCreate.name) {
219
- throw new Error("Parameter `destinationCreate.name` is required when calling `createDestination`.");
220
- }
221
- if (!destinationCreate.input) {
222
- throw new Error("Parameter `destinationCreate.input` is required when calling `createDestination`.");
223
- }
210
+ validateRequired("destinationCreate", "createDestination", destinationCreate);
211
+ validateRequired("destinationCreate.type", "createDestination", destinationCreate.type);
212
+ validateRequired("destinationCreate.name", "createDestination", destinationCreate.name);
213
+ validateRequired("destinationCreate.input", "createDestination", destinationCreate.input);
224
214
  const requestPath = "/1/destinations";
225
215
  const headers = {};
226
216
  const queryParameters = {};
@@ -244,15 +234,9 @@ function createIngestionClient({
244
234
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
245
235
  */
246
236
  createSource(sourceCreate, requestOptions) {
247
- if (!sourceCreate) {
248
- throw new Error("Parameter `sourceCreate` is required when calling `createSource`.");
249
- }
250
- if (!sourceCreate.type) {
251
- throw new Error("Parameter `sourceCreate.type` is required when calling `createSource`.");
252
- }
253
- if (!sourceCreate.name) {
254
- throw new Error("Parameter `sourceCreate.name` is required when calling `createSource`.");
255
- }
237
+ validateRequired("sourceCreate", "createSource", sourceCreate);
238
+ validateRequired("sourceCreate.type", "createSource", sourceCreate.type);
239
+ validateRequired("sourceCreate.name", "createSource", sourceCreate.name);
256
240
  const requestPath = "/1/sources";
257
241
  const headers = {};
258
242
  const queryParameters = {};
@@ -276,18 +260,10 @@ function createIngestionClient({
276
260
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
277
261
  */
278
262
  createTask(taskCreate, requestOptions) {
279
- if (!taskCreate) {
280
- throw new Error("Parameter `taskCreate` is required when calling `createTask`.");
281
- }
282
- if (!taskCreate.sourceID) {
283
- throw new Error("Parameter `taskCreate.sourceID` is required when calling `createTask`.");
284
- }
285
- if (!taskCreate.destinationID) {
286
- throw new Error("Parameter `taskCreate.destinationID` is required when calling `createTask`.");
287
- }
288
- if (!taskCreate.action) {
289
- throw new Error("Parameter `taskCreate.action` is required when calling `createTask`.");
290
- }
263
+ validateRequired("taskCreate", "createTask", taskCreate);
264
+ validateRequired("taskCreate.sourceID", "createTask", taskCreate.sourceID);
265
+ validateRequired("taskCreate.destinationID", "createTask", taskCreate.destinationID);
266
+ validateRequired("taskCreate.action", "createTask", taskCreate.action);
291
267
  const requestPath = "/2/tasks";
292
268
  const headers = {};
293
269
  const queryParameters = {};
@@ -313,21 +289,11 @@ function createIngestionClient({
313
289
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
314
290
  */
315
291
  createTaskV1(taskCreate, requestOptions) {
316
- if (!taskCreate) {
317
- throw new Error("Parameter `taskCreate` is required when calling `createTaskV1`.");
318
- }
319
- if (!taskCreate.sourceID) {
320
- throw new Error("Parameter `taskCreate.sourceID` is required when calling `createTaskV1`.");
321
- }
322
- if (!taskCreate.destinationID) {
323
- throw new Error("Parameter `taskCreate.destinationID` is required when calling `createTaskV1`.");
324
- }
325
- if (!taskCreate.trigger) {
326
- throw new Error("Parameter `taskCreate.trigger` is required when calling `createTaskV1`.");
327
- }
328
- if (!taskCreate.action) {
329
- throw new Error("Parameter `taskCreate.action` is required when calling `createTaskV1`.");
330
- }
292
+ validateRequired("taskCreate", "createTaskV1", taskCreate);
293
+ validateRequired("taskCreate.sourceID", "createTaskV1", taskCreate.sourceID);
294
+ validateRequired("taskCreate.destinationID", "createTaskV1", taskCreate.destinationID);
295
+ validateRequired("taskCreate.trigger", "createTaskV1", taskCreate.trigger);
296
+ validateRequired("taskCreate.action", "createTaskV1", taskCreate.action);
331
297
  const requestPath = "/1/tasks";
332
298
  const headers = {};
333
299
  const queryParameters = {};
@@ -351,12 +317,8 @@ function createIngestionClient({
351
317
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
352
318
  */
353
319
  createTransformation(transformationCreate, requestOptions) {
354
- if (!transformationCreate) {
355
- throw new Error("Parameter `transformationCreate` is required when calling `createTransformation`.");
356
- }
357
- if (!transformationCreate.name) {
358
- throw new Error("Parameter `transformationCreate.name` is required when calling `createTransformation`.");
359
- }
320
+ validateRequired("transformationCreate", "createTransformation", transformationCreate);
321
+ validateRequired("transformationCreate.name", "createTransformation", transformationCreate.name);
360
322
  const requestPath = "/1/transformations";
361
323
  const headers = {};
362
324
  const queryParameters = {};
@@ -377,9 +339,7 @@ function createIngestionClient({
377
339
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
378
340
  */
379
341
  customDelete({ path, parameters }, requestOptions) {
380
- if (!path) {
381
- throw new Error("Parameter `path` is required when calling `customDelete`.");
382
- }
342
+ validateRequired("path", "customDelete", path);
383
343
  const requestPath = "/{path}".replace("{path}", path);
384
344
  const headers = {};
385
345
  const queryParameters = parameters ? parameters : {};
@@ -399,9 +359,7 @@ function createIngestionClient({
399
359
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
400
360
  */
401
361
  customGet({ path, parameters }, requestOptions) {
402
- if (!path) {
403
- throw new Error("Parameter `path` is required when calling `customGet`.");
404
- }
362
+ validateRequired("path", "customGet", path);
405
363
  const requestPath = "/{path}".replace("{path}", path);
406
364
  const headers = {};
407
365
  const queryParameters = parameters ? parameters : {};
@@ -422,9 +380,7 @@ function createIngestionClient({
422
380
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
423
381
  */
424
382
  customPost({ path, parameters, body }, requestOptions) {
425
- if (!path) {
426
- throw new Error("Parameter `path` is required when calling `customPost`.");
427
- }
383
+ validateRequired("path", "customPost", path);
428
384
  const requestPath = "/{path}".replace("{path}", path);
429
385
  const headers = {};
430
386
  const queryParameters = parameters ? parameters : {};
@@ -446,9 +402,7 @@ function createIngestionClient({
446
402
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
447
403
  */
448
404
  customPut({ path, parameters, body }, requestOptions) {
449
- if (!path) {
450
- throw new Error("Parameter `path` is required when calling `customPut`.");
451
- }
405
+ validateRequired("path", "customPut", path);
452
406
  const requestPath = "/{path}".replace("{path}", path);
453
407
  const headers = {};
454
408
  const queryParameters = parameters ? parameters : {};
@@ -473,9 +427,7 @@ function createIngestionClient({
473
427
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
474
428
  */
475
429
  deleteAuthentication({ authenticationID }, requestOptions) {
476
- if (!authenticationID) {
477
- throw new Error("Parameter `authenticationID` is required when calling `deleteAuthentication`.");
478
- }
430
+ validateRequired("authenticationID", "deleteAuthentication", authenticationID);
479
431
  const requestPath = "/1/authentications/{authenticationID}".replace(
480
432
  "{authenticationID}",
481
433
  encodeURIComponent(authenticationID)
@@ -502,9 +454,7 @@ function createIngestionClient({
502
454
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
503
455
  */
504
456
  deleteDestination({ destinationID }, requestOptions) {
505
- if (!destinationID) {
506
- throw new Error("Parameter `destinationID` is required when calling `deleteDestination`.");
507
- }
457
+ validateRequired("destinationID", "deleteDestination", destinationID);
508
458
  const requestPath = "/1/destinations/{destinationID}".replace(
509
459
  "{destinationID}",
510
460
  encodeURIComponent(destinationID)
@@ -531,9 +481,7 @@ function createIngestionClient({
531
481
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
532
482
  */
533
483
  deleteSource({ sourceID }, requestOptions) {
534
- if (!sourceID) {
535
- throw new Error("Parameter `sourceID` is required when calling `deleteSource`.");
536
- }
484
+ validateRequired("sourceID", "deleteSource", sourceID);
537
485
  const requestPath = "/1/sources/{sourceID}".replace("{sourceID}", encodeURIComponent(sourceID));
538
486
  const headers = {};
539
487
  const queryParameters = {};
@@ -557,9 +505,7 @@ function createIngestionClient({
557
505
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
558
506
  */
559
507
  deleteTask({ taskID }, requestOptions) {
560
- if (!taskID) {
561
- throw new Error("Parameter `taskID` is required when calling `deleteTask`.");
562
- }
508
+ validateRequired("taskID", "deleteTask", taskID);
563
509
  const requestPath = "/2/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
564
510
  const headers = {};
565
511
  const queryParameters = {};
@@ -585,9 +531,7 @@ function createIngestionClient({
585
531
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
586
532
  */
587
533
  deleteTaskV1({ taskID }, requestOptions) {
588
- if (!taskID) {
589
- throw new Error("Parameter `taskID` is required when calling `deleteTaskV1`.");
590
- }
534
+ validateRequired("taskID", "deleteTaskV1", taskID);
591
535
  const requestPath = "/1/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
592
536
  const headers = {};
593
537
  const queryParameters = {};
@@ -611,9 +555,7 @@ function createIngestionClient({
611
555
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
612
556
  */
613
557
  deleteTransformation({ transformationID }, requestOptions) {
614
- if (!transformationID) {
615
- throw new Error("Parameter `transformationID` is required when calling `deleteTransformation`.");
616
- }
558
+ validateRequired("transformationID", "deleteTransformation", transformationID);
617
559
  const requestPath = "/1/transformations/{transformationID}".replace(
618
560
  "{transformationID}",
619
561
  encodeURIComponent(transformationID)
@@ -640,9 +582,7 @@ function createIngestionClient({
640
582
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
641
583
  */
642
584
  disableTask({ taskID }, requestOptions) {
643
- if (!taskID) {
644
- throw new Error("Parameter `taskID` is required when calling `disableTask`.");
645
- }
585
+ validateRequired("taskID", "disableTask", taskID);
646
586
  const requestPath = "/2/tasks/{taskID}/disable".replace("{taskID}", encodeURIComponent(taskID));
647
587
  const headers = {};
648
588
  const queryParameters = {};
@@ -668,9 +608,7 @@ function createIngestionClient({
668
608
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
669
609
  */
670
610
  disableTaskV1({ taskID }, requestOptions) {
671
- if (!taskID) {
672
- throw new Error("Parameter `taskID` is required when calling `disableTaskV1`.");
673
- }
611
+ validateRequired("taskID", "disableTaskV1", taskID);
674
612
  const requestPath = "/1/tasks/{taskID}/disable".replace("{taskID}", encodeURIComponent(taskID));
675
613
  const headers = {};
676
614
  const queryParameters = {};
@@ -694,9 +632,7 @@ function createIngestionClient({
694
632
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
695
633
  */
696
634
  enableTask({ taskID }, requestOptions) {
697
- if (!taskID) {
698
- throw new Error("Parameter `taskID` is required when calling `enableTask`.");
699
- }
635
+ validateRequired("taskID", "enableTask", taskID);
700
636
  const requestPath = "/2/tasks/{taskID}/enable".replace("{taskID}", encodeURIComponent(taskID));
701
637
  const headers = {};
702
638
  const queryParameters = {};
@@ -722,9 +658,7 @@ function createIngestionClient({
722
658
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
723
659
  */
724
660
  enableTaskV1({ taskID }, requestOptions) {
725
- if (!taskID) {
726
- throw new Error("Parameter `taskID` is required when calling `enableTaskV1`.");
727
- }
661
+ validateRequired("taskID", "enableTaskV1", taskID);
728
662
  const requestPath = "/1/tasks/{taskID}/enable".replace("{taskID}", encodeURIComponent(taskID));
729
663
  const headers = {};
730
664
  const queryParameters = {};
@@ -748,9 +682,7 @@ function createIngestionClient({
748
682
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
749
683
  */
750
684
  getAuthentication({ authenticationID }, requestOptions) {
751
- if (!authenticationID) {
752
- throw new Error("Parameter `authenticationID` is required when calling `getAuthentication`.");
753
- }
685
+ validateRequired("authenticationID", "getAuthentication", authenticationID);
754
686
  const requestPath = "/1/authentications/{authenticationID}".replace(
755
687
  "{authenticationID}",
756
688
  encodeURIComponent(authenticationID)
@@ -777,9 +709,7 @@ function createIngestionClient({
777
709
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
778
710
  */
779
711
  getDestination({ destinationID }, requestOptions) {
780
- if (!destinationID) {
781
- throw new Error("Parameter `destinationID` is required when calling `getDestination`.");
782
- }
712
+ validateRequired("destinationID", "getDestination", destinationID);
783
713
  const requestPath = "/1/destinations/{destinationID}".replace(
784
714
  "{destinationID}",
785
715
  encodeURIComponent(destinationID)
@@ -807,12 +737,8 @@ function createIngestionClient({
807
737
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
808
738
  */
809
739
  getEvent({ runID, eventID }, requestOptions) {
810
- if (!runID) {
811
- throw new Error("Parameter `runID` is required when calling `getEvent`.");
812
- }
813
- if (!eventID) {
814
- throw new Error("Parameter `eventID` is required when calling `getEvent`.");
815
- }
740
+ validateRequired("runID", "getEvent", runID);
741
+ validateRequired("eventID", "getEvent", eventID);
816
742
  const requestPath = "/1/runs/{runID}/events/{eventID}".replace("{runID}", encodeURIComponent(runID)).replace("{eventID}", encodeURIComponent(eventID));
817
743
  const headers = {};
818
744
  const queryParameters = {};
@@ -836,9 +762,7 @@ function createIngestionClient({
836
762
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
837
763
  */
838
764
  getRun({ runID }, requestOptions) {
839
- if (!runID) {
840
- throw new Error("Parameter `runID` is required when calling `getRun`.");
841
- }
765
+ validateRequired("runID", "getRun", runID);
842
766
  const requestPath = "/1/runs/{runID}".replace("{runID}", encodeURIComponent(runID));
843
767
  const headers = {};
844
768
  const queryParameters = {};
@@ -862,9 +786,7 @@ function createIngestionClient({
862
786
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
863
787
  */
864
788
  getSource({ sourceID }, requestOptions) {
865
- if (!sourceID) {
866
- throw new Error("Parameter `sourceID` is required when calling `getSource`.");
867
- }
789
+ validateRequired("sourceID", "getSource", sourceID);
868
790
  const requestPath = "/1/sources/{sourceID}".replace("{sourceID}", encodeURIComponent(sourceID));
869
791
  const headers = {};
870
792
  const queryParameters = {};
@@ -888,9 +810,7 @@ function createIngestionClient({
888
810
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
889
811
  */
890
812
  getTask({ taskID }, requestOptions) {
891
- if (!taskID) {
892
- throw new Error("Parameter `taskID` is required when calling `getTask`.");
893
- }
813
+ validateRequired("taskID", "getTask", taskID);
894
814
  const requestPath = "/2/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
895
815
  const headers = {};
896
816
  const queryParameters = {};
@@ -916,9 +836,7 @@ function createIngestionClient({
916
836
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
917
837
  */
918
838
  getTaskV1({ taskID }, requestOptions) {
919
- if (!taskID) {
920
- throw new Error("Parameter `taskID` is required when calling `getTaskV1`.");
921
- }
839
+ validateRequired("taskID", "getTaskV1", taskID);
922
840
  const requestPath = "/1/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
923
841
  const headers = {};
924
842
  const queryParameters = {};
@@ -942,9 +860,7 @@ function createIngestionClient({
942
860
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
943
861
  */
944
862
  getTransformation({ transformationID }, requestOptions) {
945
- if (!transformationID) {
946
- throw new Error("Parameter `transformationID` is required when calling `getTransformation`.");
947
- }
863
+ validateRequired("transformationID", "getTransformation", transformationID);
948
864
  const requestPath = "/1/transformations/{transformationID}".replace(
949
865
  "{transformationID}",
950
866
  encodeURIComponent(transformationID)
@@ -1075,9 +991,7 @@ function createIngestionClient({
1075
991
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1076
992
  */
1077
993
  listEvents({ runID, itemsPerPage, page, status, type, sort, order, startDate, endDate }, requestOptions) {
1078
- if (!runID) {
1079
- throw new Error("Parameter `runID` is required when calling `listEvents`.");
1080
- }
994
+ validateRequired("runID", "listEvents", runID);
1081
995
  const requestPath = "/1/runs/{runID}/events".replace("{runID}", encodeURIComponent(runID));
1082
996
  const headers = {};
1083
997
  const queryParameters = {};
@@ -1412,18 +1326,10 @@ function createIngestionClient({
1412
1326
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1413
1327
  */
1414
1328
  push({ indexName, pushTaskPayload, watch, referenceIndexName }, requestOptions) {
1415
- if (!indexName) {
1416
- throw new Error("Parameter `indexName` is required when calling `push`.");
1417
- }
1418
- if (!pushTaskPayload) {
1419
- throw new Error("Parameter `pushTaskPayload` is required when calling `push`.");
1420
- }
1421
- if (!pushTaskPayload.action) {
1422
- throw new Error("Parameter `pushTaskPayload.action` is required when calling `push`.");
1423
- }
1424
- if (!pushTaskPayload.records) {
1425
- throw new Error("Parameter `pushTaskPayload.records` is required when calling `push`.");
1426
- }
1329
+ validateRequired("indexName", "push", indexName);
1330
+ validateRequired("pushTaskPayload", "push", pushTaskPayload);
1331
+ validateRequired("pushTaskPayload.action", "push", pushTaskPayload.action);
1332
+ validateRequired("pushTaskPayload.records", "push", pushTaskPayload.records);
1427
1333
  const requestPath = "/1/push/{indexName}".replace("{indexName}", encodeURIComponent(indexName));
1428
1334
  const headers = {};
1429
1335
  const queryParameters = {};
@@ -1464,18 +1370,10 @@ function createIngestionClient({
1464
1370
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1465
1371
  */
1466
1372
  pushTask({ taskID, pushTaskPayload, watch }, requestOptions) {
1467
- if (!taskID) {
1468
- throw new Error("Parameter `taskID` is required when calling `pushTask`.");
1469
- }
1470
- if (!pushTaskPayload) {
1471
- throw new Error("Parameter `pushTaskPayload` is required when calling `pushTask`.");
1472
- }
1473
- if (!pushTaskPayload.action) {
1474
- throw new Error("Parameter `pushTaskPayload.action` is required when calling `pushTask`.");
1475
- }
1476
- if (!pushTaskPayload.records) {
1477
- throw new Error("Parameter `pushTaskPayload.records` is required when calling `pushTask`.");
1478
- }
1373
+ validateRequired("taskID", "pushTask", taskID);
1374
+ validateRequired("pushTaskPayload", "pushTask", pushTaskPayload);
1375
+ validateRequired("pushTaskPayload.action", "pushTask", pushTaskPayload.action);
1376
+ validateRequired("pushTaskPayload.records", "pushTask", pushTaskPayload.records);
1479
1377
  const requestPath = "/2/tasks/{taskID}/push".replace("{taskID}", encodeURIComponent(taskID));
1480
1378
  const headers = {};
1481
1379
  const queryParameters = {};
@@ -1512,18 +1410,10 @@ function createIngestionClient({
1512
1410
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1513
1411
  */
1514
1412
  replaceTask({ taskID, taskReplace }, requestOptions) {
1515
- if (!taskID) {
1516
- throw new Error("Parameter `taskID` is required when calling `replaceTask`.");
1517
- }
1518
- if (!taskReplace) {
1519
- throw new Error("Parameter `taskReplace` is required when calling `replaceTask`.");
1520
- }
1521
- if (!taskReplace.destinationID) {
1522
- throw new Error("Parameter `taskReplace.destinationID` is required when calling `replaceTask`.");
1523
- }
1524
- if (!taskReplace.action) {
1525
- throw new Error("Parameter `taskReplace.action` is required when calling `replaceTask`.");
1526
- }
1413
+ validateRequired("taskID", "replaceTask", taskID);
1414
+ validateRequired("taskReplace", "replaceTask", taskReplace);
1415
+ validateRequired("taskReplace.destinationID", "replaceTask", taskReplace.destinationID);
1416
+ validateRequired("taskReplace.action", "replaceTask", taskReplace.action);
1527
1417
  const requestPath = "/2/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
1528
1418
  const headers = {};
1529
1419
  const queryParameters = {};
@@ -1549,9 +1439,7 @@ function createIngestionClient({
1549
1439
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1550
1440
  */
1551
1441
  runSource({ sourceID, runSourcePayload }, requestOptions) {
1552
- if (!sourceID) {
1553
- throw new Error("Parameter `sourceID` is required when calling `runSource`.");
1554
- }
1442
+ validateRequired("sourceID", "runSource", sourceID);
1555
1443
  const requestPath = "/1/sources/{sourceID}/run".replace("{sourceID}", encodeURIComponent(sourceID));
1556
1444
  const headers = {};
1557
1445
  const queryParameters = {};
@@ -1577,9 +1465,7 @@ function createIngestionClient({
1577
1465
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1578
1466
  */
1579
1467
  runTask({ taskID, runTaskPayload }, requestOptions) {
1580
- if (!taskID) {
1581
- throw new Error("Parameter `taskID` is required when calling `runTask`.");
1582
- }
1468
+ validateRequired("taskID", "runTask", taskID);
1583
1469
  const requestPath = "/2/tasks/{taskID}/run".replace("{taskID}", encodeURIComponent(taskID));
1584
1470
  const headers = {};
1585
1471
  const queryParameters = {};
@@ -1607,9 +1493,7 @@ function createIngestionClient({
1607
1493
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1608
1494
  */
1609
1495
  runTaskV1({ taskID, runTaskPayload }, requestOptions) {
1610
- if (!taskID) {
1611
- throw new Error("Parameter `taskID` is required when calling `runTaskV1`.");
1612
- }
1496
+ validateRequired("taskID", "runTaskV1", taskID);
1613
1497
  const requestPath = "/1/tasks/{taskID}/run".replace("{taskID}", encodeURIComponent(taskID));
1614
1498
  const headers = {};
1615
1499
  const queryParameters = {};
@@ -1633,14 +1517,12 @@ function createIngestionClient({
1633
1517
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1634
1518
  */
1635
1519
  searchAuthentications(authenticationSearch, requestOptions) {
1636
- if (!authenticationSearch) {
1637
- throw new Error("Parameter `authenticationSearch` is required when calling `searchAuthentications`.");
1638
- }
1639
- if (!authenticationSearch.authenticationIDs) {
1640
- throw new Error(
1641
- "Parameter `authenticationSearch.authenticationIDs` is required when calling `searchAuthentications`."
1642
- );
1643
- }
1520
+ validateRequired("authenticationSearch", "searchAuthentications", authenticationSearch);
1521
+ validateRequired(
1522
+ "authenticationSearch.authenticationIDs",
1523
+ "searchAuthentications",
1524
+ authenticationSearch.authenticationIDs
1525
+ );
1644
1526
  const requestPath = "/1/authentications/search";
1645
1527
  const headers = {};
1646
1528
  const queryParameters = {};
@@ -1664,12 +1546,8 @@ function createIngestionClient({
1664
1546
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1665
1547
  */
1666
1548
  searchDestinations(destinationSearch, requestOptions) {
1667
- if (!destinationSearch) {
1668
- throw new Error("Parameter `destinationSearch` is required when calling `searchDestinations`.");
1669
- }
1670
- if (!destinationSearch.destinationIDs) {
1671
- throw new Error("Parameter `destinationSearch.destinationIDs` is required when calling `searchDestinations`.");
1672
- }
1549
+ validateRequired("destinationSearch", "searchDestinations", destinationSearch);
1550
+ validateRequired("destinationSearch.destinationIDs", "searchDestinations", destinationSearch.destinationIDs);
1673
1551
  const requestPath = "/1/destinations/search";
1674
1552
  const headers = {};
1675
1553
  const queryParameters = {};
@@ -1693,12 +1571,8 @@ function createIngestionClient({
1693
1571
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1694
1572
  */
1695
1573
  searchSources(sourceSearch, requestOptions) {
1696
- if (!sourceSearch) {
1697
- throw new Error("Parameter `sourceSearch` is required when calling `searchSources`.");
1698
- }
1699
- if (!sourceSearch.sourceIDs) {
1700
- throw new Error("Parameter `sourceSearch.sourceIDs` is required when calling `searchSources`.");
1701
- }
1574
+ validateRequired("sourceSearch", "searchSources", sourceSearch);
1575
+ validateRequired("sourceSearch.sourceIDs", "searchSources", sourceSearch.sourceIDs);
1702
1576
  const requestPath = "/1/sources/search";
1703
1577
  const headers = {};
1704
1578
  const queryParameters = {};
@@ -1722,12 +1596,8 @@ function createIngestionClient({
1722
1596
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1723
1597
  */
1724
1598
  searchTasks(taskSearch, requestOptions) {
1725
- if (!taskSearch) {
1726
- throw new Error("Parameter `taskSearch` is required when calling `searchTasks`.");
1727
- }
1728
- if (!taskSearch.taskIDs) {
1729
- throw new Error("Parameter `taskSearch.taskIDs` is required when calling `searchTasks`.");
1730
- }
1599
+ validateRequired("taskSearch", "searchTasks", taskSearch);
1600
+ validateRequired("taskSearch.taskIDs", "searchTasks", taskSearch.taskIDs);
1731
1601
  const requestPath = "/2/tasks/search";
1732
1602
  const headers = {};
1733
1603
  const queryParameters = {};
@@ -1753,12 +1623,8 @@ function createIngestionClient({
1753
1623
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1754
1624
  */
1755
1625
  searchTasksV1(taskSearch, requestOptions) {
1756
- if (!taskSearch) {
1757
- throw new Error("Parameter `taskSearch` is required when calling `searchTasksV1`.");
1758
- }
1759
- if (!taskSearch.taskIDs) {
1760
- throw new Error("Parameter `taskSearch.taskIDs` is required when calling `searchTasksV1`.");
1761
- }
1626
+ validateRequired("taskSearch", "searchTasksV1", taskSearch);
1627
+ validateRequired("taskSearch.taskIDs", "searchTasksV1", taskSearch.taskIDs);
1762
1628
  const requestPath = "/1/tasks/search";
1763
1629
  const headers = {};
1764
1630
  const queryParameters = {};
@@ -1782,14 +1648,12 @@ function createIngestionClient({
1782
1648
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1783
1649
  */
1784
1650
  searchTransformations(transformationSearch, requestOptions) {
1785
- if (!transformationSearch) {
1786
- throw new Error("Parameter `transformationSearch` is required when calling `searchTransformations`.");
1787
- }
1788
- if (!transformationSearch.transformationIDs) {
1789
- throw new Error(
1790
- "Parameter `transformationSearch.transformationIDs` is required when calling `searchTransformations`."
1791
- );
1792
- }
1651
+ validateRequired("transformationSearch", "searchTransformations", transformationSearch);
1652
+ validateRequired(
1653
+ "transformationSearch.transformationIDs",
1654
+ "searchTransformations",
1655
+ transformationSearch.transformationIDs
1656
+ );
1793
1657
  const requestPath = "/1/transformations/search";
1794
1658
  const headers = {};
1795
1659
  const queryParameters = {};
@@ -1814,9 +1678,7 @@ function createIngestionClient({
1814
1678
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1815
1679
  */
1816
1680
  triggerDockerSourceDiscover({ sourceID }, requestOptions) {
1817
- if (!sourceID) {
1818
- throw new Error("Parameter `sourceID` is required when calling `triggerDockerSourceDiscover`.");
1819
- }
1681
+ validateRequired("sourceID", "triggerDockerSourceDiscover", sourceID);
1820
1682
  const requestPath = "/1/sources/{sourceID}/discover".replace("{sourceID}", encodeURIComponent(sourceID));
1821
1683
  const headers = {};
1822
1684
  const queryParameters = {};
@@ -1847,12 +1709,8 @@ function createIngestionClient({
1847
1709
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1848
1710
  */
1849
1711
  tryTransformation(transformationTry, requestOptions) {
1850
- if (!transformationTry) {
1851
- throw new Error("Parameter `transformationTry` is required when calling `tryTransformation`.");
1852
- }
1853
- if (!transformationTry.sampleRecord) {
1854
- throw new Error("Parameter `transformationTry.sampleRecord` is required when calling `tryTransformation`.");
1855
- }
1712
+ validateRequired("transformationTry", "tryTransformation", transformationTry);
1713
+ validateRequired("transformationTry.sampleRecord", "tryTransformation", transformationTry.sampleRecord);
1856
1714
  const requestPath = "/1/transformations/try";
1857
1715
  const headers = {};
1858
1716
  const queryParameters = {};
@@ -1878,17 +1736,13 @@ function createIngestionClient({
1878
1736
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1879
1737
  */
1880
1738
  tryTransformationBeforeUpdate({ transformationID, transformationTry }, requestOptions) {
1881
- if (!transformationID) {
1882
- throw new Error("Parameter `transformationID` is required when calling `tryTransformationBeforeUpdate`.");
1883
- }
1884
- if (!transformationTry) {
1885
- throw new Error("Parameter `transformationTry` is required when calling `tryTransformationBeforeUpdate`.");
1886
- }
1887
- if (!transformationTry.sampleRecord) {
1888
- throw new Error(
1889
- "Parameter `transformationTry.sampleRecord` is required when calling `tryTransformationBeforeUpdate`."
1890
- );
1891
- }
1739
+ validateRequired("transformationID", "tryTransformationBeforeUpdate", transformationID);
1740
+ validateRequired("transformationTry", "tryTransformationBeforeUpdate", transformationTry);
1741
+ validateRequired(
1742
+ "transformationTry.sampleRecord",
1743
+ "tryTransformationBeforeUpdate",
1744
+ transformationTry.sampleRecord
1745
+ );
1892
1746
  const requestPath = "/1/transformations/{transformationID}/try".replace(
1893
1747
  "{transformationID}",
1894
1748
  encodeURIComponent(transformationID)
@@ -1917,12 +1771,8 @@ function createIngestionClient({
1917
1771
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1918
1772
  */
1919
1773
  updateAuthentication({ authenticationID, authenticationUpdate }, requestOptions) {
1920
- if (!authenticationID) {
1921
- throw new Error("Parameter `authenticationID` is required when calling `updateAuthentication`.");
1922
- }
1923
- if (!authenticationUpdate) {
1924
- throw new Error("Parameter `authenticationUpdate` is required when calling `updateAuthentication`.");
1925
- }
1774
+ validateRequired("authenticationID", "updateAuthentication", authenticationID);
1775
+ validateRequired("authenticationUpdate", "updateAuthentication", authenticationUpdate);
1926
1776
  const requestPath = "/1/authentications/{authenticationID}".replace(
1927
1777
  "{authenticationID}",
1928
1778
  encodeURIComponent(authenticationID)
@@ -1951,12 +1801,8 @@ function createIngestionClient({
1951
1801
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1952
1802
  */
1953
1803
  updateDestination({ destinationID, destinationUpdate }, requestOptions) {
1954
- if (!destinationID) {
1955
- throw new Error("Parameter `destinationID` is required when calling `updateDestination`.");
1956
- }
1957
- if (!destinationUpdate) {
1958
- throw new Error("Parameter `destinationUpdate` is required when calling `updateDestination`.");
1959
- }
1804
+ validateRequired("destinationID", "updateDestination", destinationID);
1805
+ validateRequired("destinationUpdate", "updateDestination", destinationUpdate);
1960
1806
  const requestPath = "/1/destinations/{destinationID}".replace(
1961
1807
  "{destinationID}",
1962
1808
  encodeURIComponent(destinationID)
@@ -1985,12 +1831,8 @@ function createIngestionClient({
1985
1831
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1986
1832
  */
1987
1833
  updateSource({ sourceID, sourceUpdate }, requestOptions) {
1988
- if (!sourceID) {
1989
- throw new Error("Parameter `sourceID` is required when calling `updateSource`.");
1990
- }
1991
- if (!sourceUpdate) {
1992
- throw new Error("Parameter `sourceUpdate` is required when calling `updateSource`.");
1993
- }
1834
+ validateRequired("sourceID", "updateSource", sourceID);
1835
+ validateRequired("sourceUpdate", "updateSource", sourceUpdate);
1994
1836
  const requestPath = "/1/sources/{sourceID}".replace("{sourceID}", encodeURIComponent(sourceID));
1995
1837
  const headers = {};
1996
1838
  const queryParameters = {};
@@ -2016,12 +1858,8 @@ function createIngestionClient({
2016
1858
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2017
1859
  */
2018
1860
  updateTask({ taskID, taskUpdate }, requestOptions) {
2019
- if (!taskID) {
2020
- throw new Error("Parameter `taskID` is required when calling `updateTask`.");
2021
- }
2022
- if (!taskUpdate) {
2023
- throw new Error("Parameter `taskUpdate` is required when calling `updateTask`.");
2024
- }
1861
+ validateRequired("taskID", "updateTask", taskID);
1862
+ validateRequired("taskUpdate", "updateTask", taskUpdate);
2025
1863
  const requestPath = "/2/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
2026
1864
  const headers = {};
2027
1865
  const queryParameters = {};
@@ -2049,12 +1887,8 @@ function createIngestionClient({
2049
1887
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2050
1888
  */
2051
1889
  updateTaskV1({ taskID, taskUpdate }, requestOptions) {
2052
- if (!taskID) {
2053
- throw new Error("Parameter `taskID` is required when calling `updateTaskV1`.");
2054
- }
2055
- if (!taskUpdate) {
2056
- throw new Error("Parameter `taskUpdate` is required when calling `updateTaskV1`.");
2057
- }
1890
+ validateRequired("taskID", "updateTaskV1", taskID);
1891
+ validateRequired("taskUpdate", "updateTaskV1", taskUpdate);
2058
1892
  const requestPath = "/1/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
2059
1893
  const headers = {};
2060
1894
  const queryParameters = {};
@@ -2080,15 +1914,9 @@ function createIngestionClient({
2080
1914
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2081
1915
  */
2082
1916
  updateTransformation({ transformationID, transformationCreate }, requestOptions) {
2083
- if (!transformationID) {
2084
- throw new Error("Parameter `transformationID` is required when calling `updateTransformation`.");
2085
- }
2086
- if (!transformationCreate) {
2087
- throw new Error("Parameter `transformationCreate` is required when calling `updateTransformation`.");
2088
- }
2089
- if (!transformationCreate.name) {
2090
- throw new Error("Parameter `transformationCreate.name` is required when calling `updateTransformation`.");
2091
- }
1917
+ validateRequired("transformationID", "updateTransformation", transformationID);
1918
+ validateRequired("transformationCreate", "updateTransformation", transformationCreate);
1919
+ validateRequired("transformationCreate.name", "updateTransformation", transformationCreate.name);
2092
1920
  const requestPath = "/1/transformations/{transformationID}".replace(
2093
1921
  "{transformationID}",
2094
1922
  encodeURIComponent(transformationID)
@@ -2148,12 +1976,8 @@ function createIngestionClient({
2148
1976
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2149
1977
  */
2150
1978
  validateSourceBeforeUpdate({ sourceID, sourceUpdate }, requestOptions) {
2151
- if (!sourceID) {
2152
- throw new Error("Parameter `sourceID` is required when calling `validateSourceBeforeUpdate`.");
2153
- }
2154
- if (!sourceUpdate) {
2155
- throw new Error("Parameter `sourceUpdate` is required when calling `validateSourceBeforeUpdate`.");
2156
- }
1979
+ validateRequired("sourceID", "validateSourceBeforeUpdate", sourceID);
1980
+ validateRequired("sourceUpdate", "validateSourceBeforeUpdate", sourceUpdate);
2157
1981
  const requestPath = "/1/sources/{sourceID}/validate".replace("{sourceID}", encodeURIComponent(sourceID));
2158
1982
  const headers = {};
2159
1983
  const queryParameters = {};