@nomad-media/full 1.1.14 → 1.1.15

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.
@@ -3250,8 +3250,7 @@ class NomadMediaSDK {
3250
3250
  * @throws {Error} - An error is thrown if the input schedule event fails to add.
3251
3251
  * @throws {Error} - An error is thrown if the API type is not admin.
3252
3252
  */
3253
- async updateInputScheduleEvent(ID, CHANNEL_ID, INPUT, BACKUP_INPUT, FIXED_ON_AIR_TIME_UTC,
3254
- PREVIOUS_ID)
3253
+ async updateInputScheduleEvent(ID, CHANNEL_ID, INPUT, BACKUP_INPUT, FIXED_ON_AIR_TIME_UTC)
3255
3254
  {
3256
3255
  if (this.token === null)
3257
3256
  {
@@ -3269,7 +3268,7 @@ class NomadMediaSDK {
3269
3268
  {
3270
3269
  const ADD_INPUT_SCHEDULE_EVENT_INFO = await _updateInputScheduleEvent(this, this.token,
3271
3270
  this.config.serviceApiUrl, ID, CHANNEL_ID, INPUT, BACKUP_INPUT,
3272
- FIXED_ON_AIR_TIME_UTC, PREVIOUS_ID, this.debugMode);
3271
+ FIXED_ON_AIR_TIME_UTC, this.debugMode);
3273
3272
  _printDatetime(`Input schedule event updated`);
3274
3273
  return ADD_INPUT_SCHEDULE_EVENT_INFO;
3275
3274
  }
@@ -8801,7 +8800,7 @@ class NomadMediaSDK {
8801
8800
 
8802
8801
  try
8803
8802
  {
8804
- const CREATE_MEDIA_BUILDER_ITEM_INFO = await _createMediaBuilderItemsAddAnnotations(
8803
+ const CREATE_MEDIA_BUILDER_ITEM_INFO = await _createMediaBuilderItemsAddAnnotations(this,
8805
8804
  this.token, this.config.serviceApiUrl, MEDIA_BUILDER_ID, SOURCE_ASSET_ID,
8806
8805
  this.debugMode);
8807
8806
 
@@ -9222,7 +9221,7 @@ class NomadMediaSDK {
9222
9221
  * @throws {Error} - An error is thrown if the API type is not portal.
9223
9222
  */
9224
9223
  async updateMediaBuilder(MEDIA_BUILDER_ID, NAME, DESTINATION_FOLDER_ID, COLLECTIONS,
9225
- RELATED_CONTENTS, PROPERTIES)
9224
+ RELATED_CONTENTS, TAGS, PROPERTIES)
9226
9225
  {
9227
9226
  if (this.token === null)
9228
9227
  {
@@ -9240,7 +9239,7 @@ class NomadMediaSDK {
9240
9239
  {
9241
9240
  const UPDATE_MEDIA_BUILDER_INFO = await _updateMediaBuilder(this, this.token,
9242
9241
  this.config.serviceApiUrl, MEDIA_BUILDER_ID, NAME, DESTINATION_FOLDER_ID, COLLECTIONS,
9243
- RELATED_CONTENTS, PROPERTIES, this.debugMode);
9242
+ RELATED_CONTENTS, TAGS, PROPERTIES, this.debugMode);
9244
9243
  _printDatetime(`Media builder updated: ${MEDIA_BUILDER_ID}`);
9245
9244
  return UPDATE_MEDIA_BUILDER_INFO;
9246
9245
  }
@@ -9987,17 +9986,11 @@ async function _startRelatedAssetUpload(instance, AUTH_TOKEN, URL, EXISTING_ASSE
9987
9986
  {
9988
9987
  const API_URL = `${URL}/api/asset/upload/start-related-asset`;
9989
9988
 
9990
- const AWS_MIN_LIMIT = 5242880;
9991
- let chunkSize = FILE.size / 10000;
9992
-
9993
- if (chunkSize < (AWS_MIN_LIMIT * 4))
9994
- {
9995
- chunkSize = 20971520;
9996
- }
9989
+ const CHUNK_SIZE = 8388608;
9997
9990
 
9998
9991
  const BODY = {
9992
+ chunkSize: CHUNK_SIZE,
9999
9993
  contentLength: FILE.size,
10000
- chunkSize: chunkSize,
10001
9994
  existingAssetId: EXISTING_ASSET_ID,
10002
9995
  languageId: LANGUAGE_ID,
10003
9996
  newRelatedAssetMetadataType: NEW_RELATED_ASSET_METADATA_TYPE,
@@ -10006,7 +9999,7 @@ async function _startRelatedAssetUpload(instance, AUTH_TOKEN, URL, EXISTING_ASSE
10006
9999
  uploadOverwriteOption: UPLOAD_OVERWRITE_OPTION,
10007
10000
  };
10008
10001
 
10009
- await _sendRequest(instance, AUTH_TOKEN, "Start related asset upload", API_URL, "POST", null, BODY, DEBUG_MODE);
10002
+ return await _sendRequest(instance, AUTH_TOKEN, "Start related asset upload", API_URL, "POST", null, BODY, DEBUG_MODE);
10010
10003
 
10011
10004
  }
10012
10005
 
@@ -10568,7 +10561,6 @@ async function _clipLiveChannel(instance, AUTH_TOKEN, URL, CHANNEL_ID, START_TIM
10568
10561
 
10569
10562
 
10570
10563
 
10571
-
10572
10564
  async function _createLiveChannel(instance, AUTH_TOKEN, URL, NAME, THUMBNAIL_IMAGE_ID, ARCHIVE_FOLDER_ASSET_ID,
10573
10565
  ENABLE_HIGH_AVAILABILITY, ENABLE_LIVE_CLIPPING, IS_SECURE_OUTPUT, IS_OUTPUT_SCREENSHOTS,
10574
10566
  TYPE, EXTERNAL_URL, EXTERNAL_OUTPUT_PROFILES, SECURITY_GROUPS, DEBUG_MODE)
@@ -10609,7 +10601,7 @@ async function _createLiveChannel(instance, AUTH_TOKEN, URL, NAME, THUMBNAIL_IMA
10609
10601
  if (SECURITY_GROUPS) {
10610
10602
  const NOMAD_SECURITY_GROUPS = await _getSecurityGroups(instance, AUTH_TOKEN, URL, DEBUG_MODE);
10611
10603
 
10612
- BODY.securityGroups = NOMAD_SECURITY_GROUPS
10604
+ BODY.securityGroups = NOMAD_SECURITY_GROUPS.items
10613
10605
  .filter(group => SECURITY_GROUPS.includes(group.description))
10614
10606
  .map(group => ({
10615
10607
  description: group.description,
@@ -10638,7 +10630,7 @@ async function _deleteLiveChannel(instance, AUTH_TOKEN, URL, CHANNEL_ID, DELETE_
10638
10630
  {
10639
10631
  console.log(`Getting Live Channel Inputs IDs...`);
10640
10632
  }
10641
- INPUT_IDS = await _getLiveChannelInputsIds(AUTH_TOKEN, CHANNEL_ID);
10633
+ INPUT_IDS = await _getLiveChannelInputsIds(instance, AUTH_TOKEN, CHANNEL_ID);
10642
10634
  }
10643
10635
  else
10644
10636
  {
@@ -10655,7 +10647,7 @@ async function _deleteLiveChannel(instance, AUTH_TOKEN, URL, CHANNEL_ID, DELETE_
10655
10647
  for (let index = 0; index < INPUT_IDS.length; index++)
10656
10648
  {
10657
10649
  // Delete Live Input
10658
- await _deleteLiveInput(AUTH_TOKEN, INPUT_IDS[index]);
10650
+ await _deleteLiveInput(instance, AUTH_TOKEN, INPUT_IDS[index]);
10659
10651
  }
10660
10652
  }
10661
10653
 
@@ -10702,31 +10694,7 @@ async function _getLiveChannelScheduleEvents(instance, AUTH_TOKEN, URL, CHANNEL_
10702
10694
  {
10703
10695
  const API_URL = `${URL}/api/liveChannel/${CHANNEL_ID}/liveScheduleEvent`
10704
10696
 
10705
- // Create header for the request
10706
- const HEADERS = new Headers();
10707
- HEADERS.append("Content-Type", "application/json");
10708
- HEADERS.append("Authorization", `Bearer ${AUTH_TOKEN}`);
10709
-
10710
- if (DEBUG_MODE) console.log(`URL: ${API_URL}\nMETHOD: GET`);
10711
-
10712
- try
10713
- {
10714
- const RESPONSE = await fetch(API_URL, {
10715
- method: "GET",
10716
- headers: HEADERS
10717
- });
10718
-
10719
- // Check for success
10720
- if (!RESPONSE.ok) {
10721
- throw await RESPONSE.json()
10722
- }
10723
-
10724
- return await RESPONSE.json();
10725
- }
10726
- catch (error)
10727
- {
10728
- _apiExceptionHandler(error, "Get Live Channel Schedule Events Failed");
10729
- }
10697
+ return await _sendRequest(instance, AUTH_TOKEN, "Get Live Channel Schedule Events", API_URL, "GET", null, null, DEBUG_MODE);
10730
10698
  }
10731
10699
 
10732
10700
 
@@ -10872,10 +10840,10 @@ async function _startLiveChannel(instance, AUTH_TOKEN, URL, CHANNEL_ID, WAIT_FOR
10872
10840
  {
10873
10841
  const API_URL = `${URL}/api/liveChannel/${CHANNEL_ID}/start`
10874
10842
 
10875
- if (WAIT_FOR_START === false) return;
10876
- await _waitForLiveChannelStatus(instance, AUTH_TOKEN, URL, CHANNEL_ID, _LIVE_CHANNEL_STATUSES.Running, 1200, 20), DEBUG_MODE;
10843
+ await _sendRequest(instance, AUTH_TOKEN, "Start Live Channel", API_URL, "POST", null, null, DEBUG_MODE);
10877
10844
 
10878
- return await _sendRequest(instance, AUTH_TOKEN, "Start Live Channel", API_URL, "POST", null, null, DEBUG_MODE);
10845
+ if (!WAIT_FOR_START) return;
10846
+ await _waitForLiveChannelStatus(instance, AUTH_TOKEN, URL, CHANNEL_ID, _LIVE_CHANNEL_STATUSES.Running, 1200, 20, DEBUG_MODE);
10879
10847
  }
10880
10848
 
10881
10849
 
@@ -10885,28 +10853,7 @@ async function _startOutputTracking(instance, AUTH_TOKEN, URL, CHANNEL_ID, DEBUG
10885
10853
  {
10886
10854
  const API_URL = `${URL}/api/liveChannel/${CHANNEL_ID}/startOutputTracking`;
10887
10855
 
10888
- // Create header for the request
10889
- const HEADERS = new Headers();
10890
- HEADERS.append("Content-Type", "application/json");
10891
- HEADERS.append("Authorization", `Bearer ${AUTH_TOKEN}`);
10892
-
10893
- if (DEBUG_MODE) console.log(`URL: ${API_URL}\nMETHOD: POST`);
10894
-
10895
- try
10896
- {
10897
- const RESPONSE = await fetch(`${API_URL}`, {
10898
- method: "POST",
10899
- headers: HEADERS
10900
- });
10901
-
10902
- if (!RESPONSE.ok) {
10903
- throw await RESPONSE.json()
10904
- }
10905
- }
10906
- catch (error)
10907
- {
10908
- _apiExceptionHandler(error, "Start Output Tracking Failed");
10909
- }
10856
+ return await _sendRequest(instance, AUTH_TOKEN, "Start Output Tracking", API_URL, "POST", null, null, DEBUG_MODE);
10910
10857
  }
10911
10858
 
10912
10859
 
@@ -10918,30 +10865,10 @@ async function _stopLiveChannel(instance, AUTH_TOKEN, URL, CHANNEL_ID, WAIT_FOR_
10918
10865
  {
10919
10866
  const API_URL = `${URL}/api/liveChannel/${CHANNEL_ID}/stop`
10920
10867
 
10921
- // Create header for the request
10922
- const HEADERS = new Headers();
10923
- HEADERS.append("Authorization", `Bearer ${AUTH_TOKEN}`);
10924
-
10925
- if (DEBUG_MODE) console.log(`URL: ${API_URL}\nMETHOD: POST`);
10926
-
10927
- try
10928
- {
10929
- const RESPONSE = await fetch(API_URL, {
10930
- method: "POST",
10931
- headers: HEADERS
10932
- });
10933
-
10934
- if (!RESPONSE.ok) {
10935
- throw await RESPONSE.json()
10936
- }
10868
+ await _sendRequest(instance, AUTH_TOKEN, "Stop Live Channel", API_URL, "POST", null, null, DEBUG_MODE);
10937
10869
 
10938
- if (WAIT_FOR_STOP === false) return;
10939
- await _waitForLiveChannelStatus(instance, AUTH_TOKEN, URL, CHANNEL_ID, _LIVE_CHANNEL_STATUSES.Idle, 1200, 20, DEBUG_MODE);
10940
- }
10941
- catch (error)
10942
- {
10943
- _apiExceptionHandler(error, "Stop Live Channel Failed");
10944
- }
10870
+ if (!WAIT_FOR_STOP) return;
10871
+ await _waitForLiveChannelStatus(instance, AUTH_TOKEN, URL, CHANNEL_ID, _LIVE_CHANNEL_STATUSES.Idle, 1200, 20, DEBUG_MODE);
10945
10872
  }
10946
10873
 
10947
10874
 
@@ -11007,30 +10934,11 @@ async function _updateLiveChannel(instance, AUTH_TOKEN, URL, ID, NAME, THUMBNAIL
11007
10934
  if (FILTERED_SECURITY_GROUPS !== BODY.securityGroups) BODY.securityGroups = FILTERED_SECURITY_GROUPS;
11008
10935
  }
11009
10936
 
11010
- if (DEBUG_MODE) console.log(`URL: ${API_URL}\nMETHOD: POST\nBODY: ${JSON.stringify(BODY, null, 4 )}`);
11011
-
11012
- try
11013
- {
11014
- const RESPONSE = await fetch(API_URL, {
11015
- method: "PUT",
11016
- headers: HEADERS,
11017
- body: JSON.stringify(BODY)
11018
- });
11019
-
11020
- if (!RESPONSE.ok) {
11021
- throw await RESPONSE.json()
11022
- }
11023
-
11024
- const INFO = await RESPONSE.json();
10937
+ const INFO = await _sendRequest(instance, AUTH_TOKEN, "Update Live Channel", API_URL, "PUT", HEADERS, BODY, DEBUG_MODE);
11025
10938
 
11026
- await _waitForLiveChannelStatus(instance, AUTH_TOKEN, URL, INFO.id, _LIVE_CHANNEL_STATUSES.Idle, 120, 2, DEBUG_MODE);
10939
+ await _waitForLiveChannelStatus(instance, AUTH_TOKEN, URL, INFO.id, _LIVE_CHANNEL_STATUSES.Idle, 120, 2, DEBUG_MODE);
11027
10940
 
11028
- return INFO;
11029
- }
11030
- catch (error)
11031
- {
11032
- _apiExceptionHandler(error, "Updating Live Channel Failed");
11033
- }
10941
+ return INFO;
11034
10942
  }
11035
10943
 
11036
10944
 
@@ -11319,7 +11227,7 @@ async function _waitForLiveInputStatus(instance, AUTH_TOKEN, URL, INPUT_ID, STAT
11319
11227
  // Check for Error status
11320
11228
  if (INPUT_STATUS === "Error") {
11321
11229
  // Get the error message
11322
- const INPUT_STATUS_MESSAGE = await _getLiveInputStatusMessage(AUTH_TOKEN, INPUT_ID,
11230
+ const INPUT_STATUS_MESSAGE = await _getLiveInputStatusMessage(instance, AUTH_TOKEN, INPUT_ID,
11323
11231
  DEBUG_MODE);
11324
11232
 
11325
11233
  // Can't continue if Live Input is in error status
@@ -11606,29 +11514,7 @@ async function _updateLiveOutputProfileGroup(instance, AUTH_TOKEN, URL, LIVE_OUT
11606
11514
  outputProfiles: LIVE_OUTPUT_PROFILES || PROFILE_GROUP_INFO.outputProfiles
11607
11515
  };
11608
11516
 
11609
- if (DEBUG_MODE)
11610
- {
11611
- console.log(`API_URL: ${API_URL}\nMETHOD: PUT\nBODY: ${JSON.stringify(BODY, null, 4)}`);
11612
- }
11613
-
11614
- try
11615
- {
11616
- const RESPONSE = await fetch(API_URL, {
11617
- method: "PUT",
11618
- headers: HEADERS,
11619
- body: JSON.stringify(BODY)
11620
- });
11621
-
11622
- if (!RESPONSE.ok) {
11623
- throw new Error();
11624
- }
11625
-
11626
- return await RESPONSE.json();
11627
- }
11628
- catch (error)
11629
- {
11630
- _apiExceptionHandler(error, "Update Live Output Profile Group Failed");
11631
- }
11517
+ return await _sendRequest(instance, AUTH_TOKEN, "Update Live Output Profile Group", API_URL, "PUT", HEADERS, BODY, DEBUG_MODE);
11632
11518
  }
11633
11519
 
11634
11520
 
@@ -11669,28 +11555,7 @@ async function _deleteLiveOutputProfile(instance, AUTH_TOKEN, URL, OUTPUT_ID, DE
11669
11555
  {
11670
11556
  const API_URL = `${URL}/api/liveOutputProfile/${OUTPUT_ID}`;
11671
11557
 
11672
- // Create header for the request
11673
- const HEADERS = new Headers();
11674
- HEADERS.append("Content-Type", "application/json");
11675
- HEADERS.append("Authorization", `Bearer ${AUTH_TOKEN}`);
11676
-
11677
- if (DEBUG_MODE) console.log(`URL: ${API_URL}\nMETHOD: DELETE`);
11678
-
11679
- try
11680
- {
11681
- const RESPONSE = await fetch(API_URL, {
11682
- method: "DELETE",
11683
- headers: HEADERS
11684
- });
11685
-
11686
- if (!RESPONSE.ok) {
11687
- throw await RESPONSE.json()
11688
- }
11689
- }
11690
- catch (error)
11691
- {
11692
- _apiExceptionHandler(error, "Delete Live Output Profile Failed");
11693
- }
11558
+ return await _sendRequest(instance, AUTH_TOKEN, "Delete Live Output Profile", API_URL, "DELETE", null, null, DEBUG_MODE);
11694
11559
  }
11695
11560
 
11696
11561
 
@@ -11735,7 +11600,7 @@ async function _updateLiveOutputProfile(instance, AUTH_TOKEN, URL, ID, NAME, OUT
11735
11600
  {
11736
11601
  const API_URL = `${URL}/api/liveOutputProfile/${ID}`;
11737
11602
 
11738
- const PROFILE_INFO = await _getLiveOutputProfile(AUTH_TOKEN, URL, ID, DEBUG_MODE);
11603
+ const PROFILE_INFO = await _getLiveOutputProfile(instance, AUTH_TOKEN, URL, ID, DEBUG_MODE);
11739
11604
 
11740
11605
  const BODY = {
11741
11606
  name: NAME || PROFILE_INFO.name,
@@ -11924,8 +11789,33 @@ async function _updateInputScheduleEvent(instance, AUTH_TOKEN, URL, ID, CHANNEL_
11924
11789
  BODY.id = ID && ID !== SCHEDULE_EVENT_INFO.id ? ID : SCHEDULE_EVENT_INFO.id;
11925
11790
  BODY.channelId = CHANNEL_ID && CHANNEL_ID !== SCHEDULE_EVENT_INFO.channelId ? CHANNEL_ID : SCHEDULE_EVENT_INFO.channelId;
11926
11791
  BODY.fixedOnAirTimeUtc = FIXED_ON_AIR_TIME_UTC && FIXED_ON_AIR_TIME_UTC !== SCHEDULE_EVENT_INFO.fixedOnAirTimeUtc ? FIXED_ON_AIR_TIME_UTC : SCHEDULE_EVENT_INFO.fixedOnAirTimeUtc;
11927
- BODY.liveInput = INPUT && INPUT !== SCHEDULE_EVENT_INFO.liveInput ? INPUT : SCHEDULE_EVENT_INFO.liveInput;
11928
- BODY.liveInput2 = BACKUP_INPUT && BACKUP_INPUT !== SCHEDULE_EVENT_INFO.liveInput2 ? BACKUP_INPUT : SCHEDULE_EVENT_INFO.liveInput2;
11792
+
11793
+ if (INPUT && INPUT !== SCHEDULE_EVENT_INFO.liveInput)
11794
+ {
11795
+ BODY.liveInput = {
11796
+ id: INPUT.id,
11797
+ description: INPUT.name
11798
+ };
11799
+ }
11800
+ else
11801
+ {
11802
+ BODY.liveInput = {
11803
+ id: SCHEDULE_EVENT_INFO.liveInput.id,
11804
+ description: SCHEDULE_EVENT_INFO.liveInput.name
11805
+ };
11806
+ }
11807
+
11808
+ if (BACKUP_INPUT && BACKUP_INPUT !== SCHEDULE_EVENT_INFO.liveInput2) {
11809
+ BODY.liveInput2 = {
11810
+ id: BACKUP_INPUT.id,
11811
+ description: BACKUP_INPUT.name
11812
+ };
11813
+ } else if (SCHEDULE_EVENT_INFO.liveInput2) {
11814
+ BODY.liveInput2 = {
11815
+ id: SCHEDULE_EVENT_INFO.liveInput2.id,
11816
+ description: SCHEDULE_EVENT_INFO.liveInput2.name
11817
+ };
11818
+ }
11929
11819
 
11930
11820
  return await _sendRequest(instance, AUTH_TOKEN, "Updating Input Schedule Event", API_URL, "PUT", null, BODY, DEBUG_MODE);
11931
11821
  }
@@ -12345,7 +12235,7 @@ async function _updateIntelligentSchedule(instance, AUTH_TOKEN, URL, SCHEDULE_ID
12345
12235
  {
12346
12236
  const API_URL = `${URL}/api/admin/schedule/${SCHEDULE_ID}`;
12347
12237
 
12348
- const INTELLIGENT_SCHEDULE_INFO = await _getIntelligentSchedule(AUTH_TOKEN, URL, SCHEDULE_ID, DEBUG_MODE);
12238
+ const INTELLIGENT_SCHEDULE_INFO = await _getIntelligentSchedule(instance, AUTH_TOKEN, URL, SCHEDULE_ID, DEBUG_MODE);
12349
12239
 
12350
12240
  const BODY = {
12351
12241
  defaultVideoAsset: DEFAULT_VIDEO_ASSET || INTELLIGENT_SCHEDULE_INFO.defaultVideoAsset,
@@ -12382,7 +12272,7 @@ async function _updatePlaylist(instance, AUTH_TOKEN, URL, SCHEDULE_ID, DEFAULT_V
12382
12272
  {
12383
12273
  const API_URL = `${URL}/api/admin/schedule/${SCHEDULE_ID}`;
12384
12274
 
12385
- const PLAYLIST_INFO = await _getPlaylist(AUTH_TOKEN, URL, SCHEDULE_ID, DEBUG_MODE);
12275
+ const PLAYLIST_INFO = await _getPlaylist(instance, AUTH_TOKEN, URL, SCHEDULE_ID, DEBUG_MODE);
12386
12276
 
12387
12277
  const BODY = {
12388
12278
  defaultVideoAsset: DEFAULT_VIDEO_ASSET || PLAYLIST_INFO.defaultVideoAsset,
@@ -12405,7 +12295,7 @@ async function _updateScheduleItemAsset(instance, AUTH_TOKEN, URL, SCHEDULE_ID,
12405
12295
  {
12406
12296
  const API_URL = `${URL}/api/admin/schedule/${SCHEDULE_ID}/item/${ITEM_ID}`;
12407
12297
 
12408
- const ITEM_INFO = await _getScheduleItem(AUTH_TOKEN, URL, SCHEDULE_ID, ITEM_ID, DEBUG_MODE);
12298
+ const ITEM_INFO = await _getScheduleItem(instance, AUTH_TOKEN, URL, SCHEDULE_ID, ITEM_ID, DEBUG_MODE);
12409
12299
 
12410
12300
  const BODY = {
12411
12301
  asset: ASSET || ITEM_INFO.asset,
@@ -12430,7 +12320,7 @@ async function _updateScheduleItemLiveChannel(instance, AUTH_TOKEN, URL, SCHEDUL
12430
12320
  {
12431
12321
  const API_URL = `${URL}/api/admin/schedule/${SCHEDULE_ID}/item/${ITEM_ID}`;
12432
12322
 
12433
- const ITEM_INFO = await _getScheduleItem(AUTH_TOKEN, URL, SCHEDULE_ID, ITEM_ID, DEBUG_MODE);
12323
+ const ITEM_INFO = await _getScheduleItem(instance, AUTH_TOKEN, URL, SCHEDULE_ID, ITEM_ID, DEBUG_MODE);
12434
12324
 
12435
12325
  const BODY = {
12436
12326
  days: DAYS || ITEM_INFO.days,
@@ -12455,7 +12345,7 @@ async function _updateScheduleItemPlaylistSchedule(instance, AUTH_TOKEN, URL, SC
12455
12345
  {
12456
12346
  const API_URL = `${URL}/api/admin/schedule/${SCHEDULE_ID}/item/${ITEM_ID}`;
12457
12347
 
12458
- const ITEM_INFO = await _getScheduleItem(AUTH_TOKEN, URL, SCHEDULE_ID, ITEM_ID, DEBUG_MODE);
12348
+ const ITEM_INFO = await _getScheduleItem(instance, AUTH_TOKEN, URL, SCHEDULE_ID, ITEM_ID, DEBUG_MODE);
12459
12349
 
12460
12350
  const BODY = {
12461
12351
  days: DAYS || ITEM_INFO.days,
@@ -12482,7 +12372,7 @@ async function _updateScheduleItemSearchFilter(instance, AUTH_TOKEN, URL, SCHEDU
12482
12372
  {
12483
12373
  const API_URL = `${URL}/api/admin/schedule/${SCHEDULE_ID}/item/${ITEM_ID}`;
12484
12374
 
12485
- const ITEM_INFO = await _getScheduleItem(AUTH_TOKEN, URL, SCHEDULE_ID, ITEM_ID, DEBUG_MODE);
12375
+ const ITEM_INFO = await _getScheduleItem(instance, AUTH_TOKEN, URL, SCHEDULE_ID, ITEM_ID, DEBUG_MODE);
12486
12376
 
12487
12377
  const BODY = {
12488
12378
  collections: COLLECTIONS || ITEM_INFO.collections,
@@ -13520,7 +13410,7 @@ async function _bulkUpdateMetadata(instance, AUTH_TOKEN, URL, CONTENT_IDS, COLLE
13520
13410
  {
13521
13411
  const API_URL = `${URL}/api/admin/content/bulk-metadata-update`;
13522
13412
 
13523
- const ASSET_DETAILS = await _getAssetDetails(AUTH_TOKEN, URL, CONTENT_IDS[0], "admin", DEBUG_MODE);
13413
+ const ASSET_DETAILS = await _getAssetDetails(this, AUTH_TOKEN, URL, CONTENT_IDS[0], "admin", DEBUG_MODE);
13524
13414
 
13525
13415
  const BODY = {
13526
13416
  collections: [
@@ -13584,7 +13474,7 @@ async function _deleteTagOrCollection(instance, AUTH_TOKEN, URL, TYPE, TAG_ID, D
13584
13474
  {
13585
13475
  const API_URL = `${URL}/api/admin/${TYPE}/${TAG_ID}`;
13586
13476
 
13587
- return await _sendRequest(instance, AUTH_TOKEN, "Delete Tag or Collection", API_URL, "POST", null, null, DEBUG_MODE);
13477
+ return await _sendRequest(instance, AUTH_TOKEN, "Delete Tag or Collection", API_URL, "DELETE", null, null, DEBUG_MODE);
13588
13478
  }
13589
13479
 
13590
13480
 
@@ -13767,7 +13657,7 @@ async function _sendRequest(instance, AUTH_TOKEN, FUNCTION_NAME, URL, METHOD_TYP
13767
13657
 
13768
13658
  if (AUTH_TOKEN) HEADERS["Authorization"] = `Bearer ${AUTH_TOKEN}`;
13769
13659
 
13770
- if (DEBUG) console.log(`URL: ${URL}\nMETHOD: ${METHOD_TYPE}` + (PARAMS ? `\nPARAMS: ${JSON.stringify(PARAMS, null, 4)}` : "") + (BODY ? `\nBODY: ${JSON.stringify(BODY, null, 4)}` : ""));
13660
+ if (DEBUG) console.log(`URL: ${URL}\nMETHOD: ${METHOD_TYPE}` + (PARAMS && PARAMS.size === 0 ? `\nPARAMS: ${JSON.stringify(PARAMS, null, 4)}` : "") + (BODY ? `\nBODY: ${JSON.stringify(BODY, null, 4)}` : ""));
13771
13661
 
13772
13662
  let retries = 0;
13773
13663
  let RESPONSE = null;
@@ -13804,11 +13694,11 @@ async function _sendRequest(instance, AUTH_TOKEN, FUNCTION_NAME, URL, METHOD_TYP
13804
13694
  if (error.code === 'ECONNABORTED' && retries < MAX_RETRIES)
13805
13695
  {
13806
13696
  retries++;
13807
- await _sleep(SLEEP_TIME * 2 ** retries);
13697
+ await _sleep(SLEEP_TIME);
13808
13698
  }
13809
13699
  else
13810
13700
  {
13811
- _apiExceptionHandler(error.message, `${FUNCTION_NAME} failed`);
13701
+ _apiExceptionHandler(error.response?.data.message ? error.response.data.message : error.message, `${FUNCTION_NAME} failed`);
13812
13702
  }
13813
13703
  }
13814
13704
  } while (!RESPONSE || RESPONSE.status < 200 || RESPONSE.status >= 300);
@@ -14316,7 +14206,7 @@ async function _updateMediaBuilder(instance, AUTH_TOKEN, URL, ID, NAME, DESTINAT
14316
14206
  {
14317
14207
  const API_URL = `${URL}/api/mediaBuilder/${ID}`;
14318
14208
 
14319
- const MEDIA_BUILDER_INFO = await _getMediaBuilder(AUTH_TOKEN, URL, ID, DEBUG_MODE);
14209
+ const MEDIA_BUILDER_INFO = await _getMediaBuilder(this, AUTH_TOKEN, URL, ID, DEBUG_MODE);
14320
14210
 
14321
14211
  const BODY = {
14322
14212
  name: NAME || MEDIA_BUILDER_INFO.name,
@@ -14560,7 +14450,20 @@ async function _getSearchSaved(instance, AUTH_TOKEN, URL, QUERY, OFFSET, SIZE ,
14560
14450
  {
14561
14451
  const API_URL = `${URL}/api/portal/search-saved`;
14562
14452
 
14563
- return await _sendRequest(instance, AUTH_TOKEN, "Get Search Saved", API_URL, "POST\nBODY: ${JSON.stringify(CRITERIA_BODY, null, 4 )}", null, null, DEBUG_MODE);
14453
+ const BODY = {
14454
+ "query": QUERY,
14455
+ "pageOffset": OFFSET,
14456
+ "pageSize": SIZE,
14457
+ "filters": FILTERS,
14458
+ "sortFields": SORT_FIELDS,
14459
+ "searchResultFields": SEARCH_RESULT_FIELDS,
14460
+ "similarAssetId": SIMILAR_ASSET_ID,
14461
+ "minScore": MIN_SCORE,
14462
+ "excludeTotalRecordCount": EXCLUDE_TOTAL_RECORD_COUNT,
14463
+ "filterBinder": FILTER_BINDER
14464
+ };
14465
+
14466
+ return await _sendRequest(instance, AUTH_TOKEN, "Get Search Saved", API_URL, "POST", null, BODY, DEBUG_MODE);
14564
14467
  }
14565
14468
 
14566
14469
 
@@ -14592,7 +14495,7 @@ async function _updateSavedSearch(instance, AUTH_TOKEN, URL, ID, NAME, FEATURED,
14592
14495
  {
14593
14496
  const API_URL = `${URL}/api/portal/savedsearch/${ID}`;
14594
14497
 
14595
- const SAVED_SEARCH_INFO = await _getSavedSearch(AUTH_TOKEN, URL, ID, DEBUG_MODE);
14498
+ const SAVED_SEARCH_INFO = await _getSavedSearch(instance, AUTH_TOKEN, URL, ID, DEBUG_MODE);
14596
14499
 
14597
14500
  const BODY= {
14598
14501
  "id": ID,