@nomad-media/full 1.1.6 → 1.1.8
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.
|
@@ -127,6 +127,9 @@
|
|
|
127
127
|
|
|
128
128
|
|
|
129
129
|
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
130
133
|
|
|
131
134
|
|
|
132
135
|
|
|
@@ -1412,6 +1415,79 @@ class NomadMediaSDK {
|
|
|
1412
1415
|
throw error;
|
|
1413
1416
|
}
|
|
1414
1417
|
}
|
|
1418
|
+
|
|
1419
|
+
// content definition functions
|
|
1420
|
+
/**
|
|
1421
|
+
* @function getContentDefinition
|
|
1422
|
+
* @async
|
|
1423
|
+
* @description Gets the specified content definition.
|
|
1424
|
+
* @param {string} CONTENT_DEFINITION_ID - The ID of the content definition to get.
|
|
1425
|
+
* @returns {Promise<JSON>} - A promise that resolves when the content definition is retrieved.
|
|
1426
|
+
* Returns the information of the retrieved content definition.
|
|
1427
|
+
* @throws {Error} - An error is thrown if the content definition fails to get.
|
|
1428
|
+
* @throws {Error} - An error is thrown if the API type is not admin.
|
|
1429
|
+
*/
|
|
1430
|
+
async getContentDefinition(CONTENT_DEFINITION_ID)
|
|
1431
|
+
{
|
|
1432
|
+
if (this.token === null)
|
|
1433
|
+
{
|
|
1434
|
+
await this._init();
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
_printDatetime(`Getting content definition: ${CONTENT_DEFINITION_ID}`);
|
|
1438
|
+
|
|
1439
|
+
try
|
|
1440
|
+
{
|
|
1441
|
+
const GET_CONTENT_DEFINITION_INFO = await _getContentDefinition(this.token,
|
|
1442
|
+
this.config.serviceApiUrl, CONTENT_DEFINITION_ID, this.debugMode);
|
|
1443
|
+
_printDatetime(`Content definition retrieved: ${CONTENT_DEFINITION_ID}`);
|
|
1444
|
+
return GET_CONTENT_DEFINITION_INFO;
|
|
1445
|
+
}
|
|
1446
|
+
catch (error)
|
|
1447
|
+
{
|
|
1448
|
+
_printDatetime(`Content definition failed to retrieve: ${CONTENT_DEFINITION_ID}`);
|
|
1449
|
+
throw error;
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
/**
|
|
1454
|
+
* @function getContentDefinitions
|
|
1455
|
+
* @async
|
|
1456
|
+
* @description Gets the content definitions.
|
|
1457
|
+
* @param {number | null} CONTENT_MANAGEMENT_TYPE - The type of content management to get.
|
|
1458
|
+
* enum: 1: None, 2: DataSelector, 3: FormSelector
|
|
1459
|
+
* @param {string | null} SORT_COLUMN - The column to sort by.
|
|
1460
|
+
* @param {boolean | null} IS_DESC - Whether to sort descending.
|
|
1461
|
+
* @param {number | null} PAGE_INDEX - The page index to get.
|
|
1462
|
+
* @param {number | null} PAGE_SIZE - The page size to get.
|
|
1463
|
+
* @returns {Promise<JSON>} - A promise that resolves when the content definitions are retrieved.
|
|
1464
|
+
* Returns the information of the retrieved content definitions.
|
|
1465
|
+
* @throws {Error} - An error is thrown if the content definitions fail to get.
|
|
1466
|
+
* @throws {Error} - An error is thrown if the API type is not admin.
|
|
1467
|
+
*/
|
|
1468
|
+
async getContentDefinitions(CONTENT_MANAGEMENT_TYPE, SORT_COLUMN, IS_DESC, PAGE_INDEX, PAGE_SIZE)
|
|
1469
|
+
{
|
|
1470
|
+
if (this.token === null)
|
|
1471
|
+
{
|
|
1472
|
+
await this._init();
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
_printDatetime(`Getting content definitions`);
|
|
1476
|
+
|
|
1477
|
+
try
|
|
1478
|
+
{
|
|
1479
|
+
const GET_CONTENT_DEFINITIONS_INFO = await _getContentDefinitions(this.token,
|
|
1480
|
+
this.config.serviceApiUrl, CONTENT_MANAGEMENT_TYPE, SORT_COLUMN, IS_DESC,
|
|
1481
|
+
PAGE_INDEX, PAGE_SIZE, this.debugMode);
|
|
1482
|
+
_printDatetime(`Content definitions retrieved`);
|
|
1483
|
+
return GET_CONTENT_DEFINITIONS_INFO;
|
|
1484
|
+
}
|
|
1485
|
+
catch (error)
|
|
1486
|
+
{
|
|
1487
|
+
_printDatetime(`Content definitions failed to retrieve`);
|
|
1488
|
+
throw error;
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1415
1491
|
|
|
1416
1492
|
// event functions
|
|
1417
1493
|
/**
|
|
@@ -10110,6 +10186,84 @@ async function _getServerTime(AUTH_TOKEN, URL, DEBUG_MODE)
|
|
|
10110
10186
|
}
|
|
10111
10187
|
|
|
10112
10188
|
|
|
10189
|
+
|
|
10190
|
+
|
|
10191
|
+
async function _getContentDefinition(AUTH_TOKEN, URL, ID, DEBUG)
|
|
10192
|
+
{
|
|
10193
|
+
const API_URL = `${URL}/contentDefinition/${ID}`;
|
|
10194
|
+
|
|
10195
|
+
const HEADERS = new Headers();
|
|
10196
|
+
HEADERS.append("Content-Type", "application/json");
|
|
10197
|
+
HEADERS.append("Authorization", `Bearer ${AUTH_TOKEN}`);
|
|
10198
|
+
|
|
10199
|
+
if (DEBUG)
|
|
10200
|
+
{
|
|
10201
|
+
console.log(`API_URL: ${API_URL}\nMETHOD: GET`);
|
|
10202
|
+
}
|
|
10203
|
+
|
|
10204
|
+
try
|
|
10205
|
+
{
|
|
10206
|
+
const RESPONSE = await fetch(API_URL, {
|
|
10207
|
+
method: "GET",
|
|
10208
|
+
headers: HEADERS
|
|
10209
|
+
});
|
|
10210
|
+
|
|
10211
|
+
if (!RESPONSE.ok) {
|
|
10212
|
+
throw await RESPONSE.json();
|
|
10213
|
+
}
|
|
10214
|
+
|
|
10215
|
+
return await RESPONSE.json();
|
|
10216
|
+
}
|
|
10217
|
+
catch (error)
|
|
10218
|
+
{
|
|
10219
|
+
_apiExceptionHandler(error, `Get Content Definition failed`);
|
|
10220
|
+
}
|
|
10221
|
+
}
|
|
10222
|
+
|
|
10223
|
+
|
|
10224
|
+
|
|
10225
|
+
|
|
10226
|
+
async function _getContentDefinitions(AUTH_TOKEN, URL, CONTENT_MANAGEMENT_TYPE, SORT_COLUMN, IS_DESC, PAGE_INDEX, PAGE_SIZE, DEBUG)
|
|
10227
|
+
{
|
|
10228
|
+
const PARAMS = new URLSearchParams();
|
|
10229
|
+
|
|
10230
|
+
if (CONTENT_MANAGEMENT_TYPE) PARAMS.append("contentManagementType", CONTENT_MANAGEMENT_TYPE);
|
|
10231
|
+
if (SORT_COLUMN) PARAMS.append("sortColumn", SORT_COLUMN);
|
|
10232
|
+
if (IS_DESC) PARAMS.append("isDesc", IS_DESC);
|
|
10233
|
+
if (PAGE_INDEX) PARAMS.append("pageIndex", PAGE_INDEX);
|
|
10234
|
+
if (PAGE_SIZE) PARAMS.append("pageSize", PAGE_SIZE);
|
|
10235
|
+
|
|
10236
|
+
const API_URL = `${URL}/contentDefinition?${PARAMS.toString()}`;
|
|
10237
|
+
|
|
10238
|
+
const HEADERS = new Headers();
|
|
10239
|
+
HEADERS.append("Content-Type", "application/json");
|
|
10240
|
+
HEADERS.append("Authorization", `Bearer ${AUTH_TOKEN}`);
|
|
10241
|
+
|
|
10242
|
+
if (DEBUG)
|
|
10243
|
+
{
|
|
10244
|
+
console.log(`API_URL: ${API_URL}\nMETHOD: GET`);
|
|
10245
|
+
}
|
|
10246
|
+
|
|
10247
|
+
try
|
|
10248
|
+
{
|
|
10249
|
+
const RESPONSE = await fetch(API_URL, {
|
|
10250
|
+
method: "GET",
|
|
10251
|
+
headers: HEADERS
|
|
10252
|
+
});
|
|
10253
|
+
|
|
10254
|
+
if (!RESPONSE.ok) {
|
|
10255
|
+
throw await RESPONSE.json();
|
|
10256
|
+
}
|
|
10257
|
+
|
|
10258
|
+
return await RESPONSE.json();
|
|
10259
|
+
}
|
|
10260
|
+
catch (error)
|
|
10261
|
+
{
|
|
10262
|
+
_apiExceptionHandler(error, `Get Content Definitions failed`);
|
|
10263
|
+
}
|
|
10264
|
+
}
|
|
10265
|
+
|
|
10266
|
+
|
|
10113
10267
|
|
|
10114
10268
|
|
|
10115
10269
|
async function _createContent(AUTH_TOKEN, URL, CONTENT_DEFINITION_ID, LANGUAGE_ID, DEBUG_MODE)
|
|
@@ -10359,7 +10513,7 @@ async function _updateContent(AUTH_TOKEN, URL, CONTENT_ID, CONTENT_DEFINITION_ID
|
|
|
10359
10513
|
|
|
10360
10514
|
if (body.contentDefinitionId !== CONTENT_DEFINITION_ID) body.contentDefinitionId = CONTENT_DEFINITION_ID;
|
|
10361
10515
|
if (body.contentId !== CONTENT_ID) body.contentId = CONTENT_ID;
|
|
10362
|
-
if (body.
|
|
10516
|
+
if (body.language !== LANGUAGE_ID) body.language = LANGUAGE_ID;
|
|
10363
10517
|
|
|
10364
10518
|
_updateProperties(body, PROPERTIES);
|
|
10365
10519
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{promises as fs}from"fs";import path from"path";class NomadMediaSDK{constructor(e={}){return NomadMediaSDK.instance||(this.config=e,this.token=null,this.refreshTokenVal=null,this.expirationSeconds=null,this.userSessionId=null,this.id=null,this.debugMode=e.debugMode||!1,NomadMediaSDK.instance=this)}async _init(){await this.login(),this.__scheduleTokenRefresh()}async login(){_printDatetime("Logging in as "+this.config.username);try{var e=await _login(this.config.username,this.config.password,this.config.serviceApiUrl,this.debugMode);this.token=e.token,this.refreshTokenVal=e.refreshToken,this.expirationSeconds=Date.now()+1e3*e.expirationSeconds,this.userSessionId=e.userSessionId,this.id=e.id,_printDatetime("Login successful")}catch(e){throw _printDatetime("Login failed"),e}}async logout(){null===this.token&&await this._init(),_printDatetime("Logging out");try{await _logout(this.token,this.config.serviceApiUrl,this.debugMode),this.token=null,this.refreshTokenVal=null,this.expirationSeconds=null,this.userSessionId=null,this.id=null,_printDatetime("Logout successful")}catch(e){throw _printDatetime("Loggout failed"),e}}async refreshToken(){_printDatetime("Refreshing token");try{var e=await _refreshToken(this.token,this.config.serviceApiUrl,this.refreshTokenVal,this.debugMode);this.token=e.token,_printDatetime("Token refresh successful")}catch(e){throw _printDatetime("Token refresh failed"),e}}__scheduleTokenRefresh(){var e;this.token&&this.expirationSeconds&&0<(e=this.expirationSeconds-Date.now())&&(this.refreshTimer&&clearTimeout(this.refreshTimer),this.refreshTimer=setTimeout(async()=>{await this.refreshToken(),this.__scheduleTokenRefresh()},e-5e3))}async forgotPassword(){var t=this.config.username;_printDatetime("Sending code to "+t);try{await _forgotPassword(this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Code sent to "+t)}catch(e){throw _printDatetime("Code failed to send to "+t),e}}async resetPassword(e,t){var i=this.config.username;_printDatetime("Resetting password for "+i);try{await _resetPassword(this.config.serviceApiUrl,i,e,t,this.debugMode),_printDatetime("Password reset for "+i)}catch(e){throw _printDatetime("Password failed to reset for "+i),e}}async uploadAsset(t,i,a,n,r,o,s){null===this.token&&await this._init(),_printDatetime("Uploading asset");let l=null;try{let e=null;"string"==typeof r&&(e=r,(r=await fs.stat(r)).originalname=path.basename(e)),_printDatetime("Starting upload"),l=await _startUpload(this.token,this.config.serviceApiUrl,t,i,a,n,r,o,s,this.debugMode),r.buffer||(r.buffer=await fs.readFile(e)),await _multiThreadUpload(this.token,this.config.serviceApiUrl,r,l,this.debugMode),await _completeUpload(this.token,this.config.serviceApiUrl,l.id,this.debugMode);var d=l.assetId;return _printDatetime("Upload successful"),d}catch(e){throw null!==l&&await _cancelUpload(this.token,this.config.serviceApiUrl,l.id,this.debugMode),_printDatetime("Upload failed"),e}}async uploadRelatedAsset(e,i,a,n,r,o){null===this.token&&await this._init(),_printDatetime("Uploading related asset");let s=null;try{let t=null;return"string"==typeof r&&(t=r,(r=await fs.stat(r)).originalname=path.basename(t)),s=await _startRelatedAssetUpload(this.token,this.config.serviceApiUrl,e,i,a,n,r,o,this.debugMode),r.buffer||(r.buffer=await fs.readFile(t)),await _multiThreadUpload(this.token,this.config.serviceApiUrl,r,s,this.debugMode),await _completeUpload(this.token,this.config.serviceApiUrl,s.id,this.debugMode),_printDatetime("Related asset upload successful"),(await _getAssetDetails(this.token,this.config.serviceApiUrl,e,this.config.apiType,this.debugMode)).relatedAssets.find(e=>e.url.includes(path.basename(t))).id}catch(e){throw s&&await _cancelUpload(this.token,this.config.serviceApiUrl,s.id,this.debugMode),_printDatetime("Upload failed"),e}}async getAudit(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting audit for "+t);try{var e=await _getAudit(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Audit retrieved for "+t),e}catch(e){throw _printDatetime("Audit failed to retrieve for "+t),e}}async clearServerCache(){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Clearing server cache");try{await _clearServerCache(this.token,this.config.serviceApiUrl,this.debugMode),_printDatetime("Server cache cleared")}catch(e){throw _printDatetime("Server cache failed to clear"),e}}async getConfig(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting config");try{var t=await _getConfig(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Config retrieved"),t}catch(e){throw _printDatetime("Config failed to retrieve"),e}}async getServerTime(){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting server time");try{var e=await _getServerTime(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Server time retrieved"),e}catch(e){throw _printDatetime("Server time failed to retrieve"),e}}async createContent(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating content");try{var i=await _createContent(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Content created: "+i.contentId),i}catch(e){throw _printDatetime("Content failed to create"),e}}async deactivateContentUserTrack(t,e,i,a){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deactivating content user track: "+t);try{await _deactivateContentUserTrack(this.token,this.config.serviceApiUrl,t,e,i,a,this.debugMode),_printDatetime("Content user track deactivated: "+t)}catch(e){throw _printDatetime("Content user track failed to deactivate: "+t),e}}async deleteContent(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting content: "+t);try{await _deleteContent(this.token,this.config.serviceApiUrl,t,e,this.debugMode),_printDatetime("Content deleted: "+t)}catch(e){throw _printDatetime("Content failed to delete: "+t),e}}async getContent(t,e,i){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting content: "+t);try{var a=await _getContent(this.token,this.config.serviceApiUrl,t,e,i,this.debugMode);return _printDatetime("Content retrieved: "+t),a}catch(e){throw _printDatetime("Content failed to retrieve: "+t),e}}async getContentUserTrack(t,e,i,a,n,r){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting content user track: "+t),n=n||0,r=r||100;try{var o=await _getContentUserTrack(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,this.debugMode);return _printDatetime("Content user track retrieved: "+t),o}catch(e){throw _printDatetime("Content user track failed to retrieve: "+t),e}}async getContentUserTrackTouch(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting content user track touch: "+t);try{var i=await _getContentUserTrackTouch(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Content user track touch retrieved: "+t),i}catch(e){throw _printDatetime("Content user track touch failed to retrieve: "+t),e}}async updateContent(t,e,i,a){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating content: "+t);try{await _updateContent(this.token,this.config.serviceApiUrl,t,e,i,a,this.debugMode),_printDatetime("Content updated: "+t)}catch(e){throw _printDatetime("Content failed to update: "+t),e}}async addCustomProperties(t,e,i,a){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Adding custom properties to content: "+t);try{var n=await _addCustomProperties(this.token,this.config.serviceApiUrl,t,e,i,a,this.debugMode);return _printDatetime("Custom properties added to content: "+t),n}catch(e){throw _printDatetime("Custom properties failed to add to content: "+t),e}}async addRelatedContent(t,e,i){null===this.token&&await this._init(),_printDatetime("Adding related content to content: "+t);try{var a=await _addRelatedContent(this.token,this.config.serviceApiUrl,t,e,i,this.config.apiType,this.debugMode);return _printDatetime("Related content added to content: "+t),a.items[0]}catch(e){throw _printDatetime("Related content failed to add to content: "+t),e}}async addTagOrCollection(t,i,e,a,n,r){null===this.token&&await this._init(),_printDatetime(`Adding ${t} to content `+i);try{var o=await _addTagOrCollection(this.token,this.config.serviceApiUrl,t,i,e,a,n,r,this.config.apiType,this.debugMode);return _printDatetime(t+" added to content: "+i),o.items[0]}catch(e){throw _printDatetime(`Adding ${t} to content: ${i} failed`),e}}async bulkUpdateMetadata(e,t,i,a,n){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating metadata");try{await _bulkUpdateMetadata(this.token,this.config.serviceApiUrl,e,t,i,a,n,this.debugMode),_printDatetime("Metadata updated")}catch(e){throw _printDatetime("Metadata failed to update"),e}}async createTagOrCollection(t,i){null===this.token&&await this._init(),_printDatetime(`Creating ${t}: `+i);try{var e=await _createTagOrCollection(this.token,this.config.serviceApiUrl,t,i,this.debugMode);return _printDatetime(t+" created: "+i),e}catch(e){throw _printDatetime(t+" failed to create: "+i),e}}async deleteRelatedContent(t,e,i){null===this.token&&await this._init(),_printDatetime("Deleting related content from content: "+t);try{var a=await _deleteRelatedContent(this.token,this.config.serviceApiUrl,t,e,i,this.config.apiType,this.debugMode);return _printDatetime("Related content deleted from content: "+t),a.items[0]}catch(e){throw _printDatetime("Related content failed to delete from content: "+t),e}}async deleteTagOrCollection(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting tag or collection: "+t);try{var i=await _deleteTagOrCollection(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Tag or collection deleted: "+t),i}catch(e){throw _printDatetime("Tag or collection failed to delete: "+t),e}}async getTagOrCollection(t,i){null===this.token&&await this._init(),_printDatetime(`Getting ${t}: `+i);try{var e=await _getTagOrCollection(this.token,this.config.serviceApiUrl,t,i,this.debugMode);return _printDatetime(t+" retrieved: "+i),e}catch(e){throw _printDatetime(t+" failed to retrieve: "+i),e}}async removeTagOrCollection(t,i,e,a){null===this.token&&await this._init(),_printDatetime(`Removing ${t} from content: `+i);try{var n=await _removeTagOrCollection(this.token,this.config.serviceApiUrl,t,i,e,a,this.config.apiType,this.debugMode);return _printDatetime(t+" removed from content: "+i),n}catch(e){throw _printDatetime(t+" failed to remove from content: "+i),e}}async createAndUpdateEvent(e,t,i,a,n,r,o,s,l,d){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating/Updating event:");try{var p=await _createAndUpdateEvent(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,this.debugMode);return _printDatetime("Event created/updated"),p}catch(e){throw _printDatetime("Event failed to create/update"),e}}async deleteEvent(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting event: "+t);try{await _deleteEvent(this.token,this.config.serviceApiUrl,t,e,this.debugMode),_printDatetime("Event deleted: "+t)}catch(e){throw _printDatetime("Event failed to delete: "+t),e}}async addLiveScheduleToEvent(t,e,i,a,n,r,o,s,l,d,p){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Adding Live Schedule to Event: "+t);try{await _addLiveScheduleToEvent(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,o,s,l,d,p,this.debugMode),_printDatetime("Live Schedule added to Event: "+t)}catch(e){throw _printDatetime("Live Schedule failed to add to Event: "+t),e}}async extendLiveSchedule(t,e,i,a){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Extending Live Schedule of Event: "+t);try{await _extendLiveSchedule(this.token,this.config.serviceApiUrl,t,e,i,a,this.debugMode),_printDatetime("Live Schedule extended of Event: "+t)}catch(e){throw _printDatetime("Live Schedule failed to extend of Event: "+t),e}}async getLiveSchedule(t){null===this.token&&await this._init(),_printDatetime("Getting Live Schedule of Event: "+t);try{var e=await _getLiveSchedule(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Live Schedule retrieved of Event: "+t),e}catch(e){throw _printDatetime("Live Schedule failed to retrieve of Event: "+t),e}}async startLiveSchedule(t){null===this.token&&await this._init(),_printDatetime("Starting Live Schedule of Event: "+t);try{await _startLiveSchedule(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Live Schedule started of Event: "+t)}catch(e){throw _printDatetime("Live Schedule failed to start of Event: "+t),e}}async stopLiveSchedule(t){null===this.token&&await this._init(),_printDatetime("Stopping Live Schedule of Event: "+t);try{await _stopLiveSchedule(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Live Schedule stopped of Event: "+t)}catch(e){throw _printDatetime("Live Schedule failed to stop of Event: "+t),e}}async clipLiveChannel(t,e,i,a,n,r,o,s,l,d){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Clipping Live Channel: "+t);try{await _clipLiveChannel(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,o,s,l,d,this.debugMode);_printDatetime("Live Channel clipped: "+t)}catch(e){throw _printDatetime("Live Channel failed to clip: "+t),e}}async createLiveChannel(e,t,i,a,n,r,o,s,l,d,p){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating Live Channel: "+e);try{var c=await _createLiveChannel(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,this.debugMode);return _printDatetime("Live Channel created: "+c.id),c}catch(e){throw _printDatetime("Live Channel failed to create"),e}}async deleteLiveChannel(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting Live Channel: "+t);try{await _deleteLiveChannel(this.token,this.config.serviceApiUrl,t,e,this.debugMode),_printDatetime("Live Channel deleted: "+t)}catch(e){throw _printDatetime("Live Channel failed to delete: "+t),e}}async getLiveChannel(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting Live Channel: "+t);try{var e=await _getLiveChannel(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Live Channel gotten: "+t),e}catch(e){throw _printDatetime("Live Channel failed to get: "+t),e}}async getLiveChannels(){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting Live Channels");try{var e=await _getLiveChannels(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Live Channels gotten"),e}catch(e){throw _printDatetime("Live Channels failed to get"),e}}async liveChannelRefresh(){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Refreshing Live Channels");try{await _liveChannelRefresh(this.token,this.config.serviceApiUrl,this.debugMode),_printDatetime("Live Channels refreshed")}catch(e){throw _printDatetime("Live Channels failed to refresh"),e}}async nextEvent(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting Next Event of Live Channel: "+t);try{var e=await _nextEvent(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Next Event gotten of Live Channel: "+t),e}catch(e){throw _printDatetime("Next Event failed to get of Live Channel: "+t),e}}async startLiveChannel(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Starting Live Channel: "+t);try{await _startLiveChannel(this.token,this.config.serviceApiUrl,t,e,this.debugMode),_printDatetime("Live Channel started: "+t)}catch(e){throw _printDatetime("Live Channel failed to start: "+t),e}}async startOutputTracking(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Starting Output Tracking for Live Channel: "+t);try{await _startOutputTracking(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Output Tracking started for Live Channel: "+t)}catch(e){throw _printDatetime("Output Tracking failed to start for Live Channel: "+t),e}}async stopLiveChannel(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Stopping Live Channel: "+t);try{await _stopLiveChannel(this.token,this.config.serviceApiUrl,t,e,this.debugMode),_printDatetime("Live Channel stopped: "+t)}catch(e){throw _printDatetime("Live Channel failed to stop: "+t),e}}async updateLiveChannel(e,t,i,a,n,r,o,s,l,d,p,c){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating Live Channel: "+e);try{var h=await _updateLiveChannel(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,c,this.debugMode);return _printDatetime("Live Channel updated: "+e),h}catch(e){throw _printDatetime("Live Channel failed to update"),e}}async createLiveInput(e,t,i,a,n,r,o){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating Live Input: "+e);try{var s=await _createLiveInput(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,this.debugMode);return _printDatetime("Live Input created: "+s.id),s}catch(e){throw _printDatetime("Live Input failed to create"),e}}async deleteLiveInput(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting Live Input: "+t);try{await _deleteLiveInput(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Live Input deleted: "+t)}catch(e){throw _printDatetime("Live Input failed to delete: "+t),e}}async getLiveInput(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting Live Input: "+t);try{var e=await _getLiveInput(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Live Input gotten: "+t),e}catch(e){throw _printDatetime("Live Input failed to get: "+t),e}}async getLiveInputs(){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting Live Inputs");try{var e=await _getLiveInputs(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Live Inputs gotten"),e}catch(e){throw _printDatetime("Live Inputs failed to get"),e}}async updateLiveInput(e,t,i,a,n,r,o,s){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating Live Input: "+e);try{var l=await _updateLiveInput(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,this.debugMode);return _printDatetime("Live Input updated: "+e),l}catch(e){throw _printDatetime("Live Input failed to update"),e}}async cancelBroadcast(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Cancelling broadcast: "+t);try{await _cancelBroadcast(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Broadcast cancelled: "+t)}catch(e){throw _printDatetime("Broadcast failed to cancel: "+t),e}}async cancelSegment(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Cancelling segment: "+t);try{var e=await _cancelSegment(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Segment cancelled: "+t),e}catch(e){throw _printDatetime("Segment failed to cancel: "+t),e}}async completeSegment(t,e,i){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Completing segment: "+t);try{await _completeSegment(this.token,this.config.serviceApiUrl,t,e,i,this.debugMode),_printDatetime("Segment completed: "+t)}catch(e){throw _printDatetime("Segment failed to complete: "+t),e}}async getCompletedSegments(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting completed segments");try{var t=await _getCompletedSegments(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Completed segments gotten"),t}catch(e){throw _printDatetime("Completed segments failed to get"),e}}async getLiveOperator(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting live operator: "+t);try{var e=await _getLiveOperator(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Live operator gotten: "+t),e}catch(e){throw _printDatetime("Live operator failed to get: "+t),e}}async getLiveOperators(){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting live operators");try{var e=await _getLiveOperators(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Live operators gotten"),e}catch(e){throw _printDatetime("Live operators failed to get"),e}}async startBroadcast(e,t,i,a,n,r){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Starting broadcast");try{var o=await _startBroadcast(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,this.debugMode);return _printDatetime("Broadcast started"),o}catch(e){throw _printDatetime("Broadcast failed to start"),e}}async startSegment(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Starting segment: "+t);try{await _startSegment(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Segment started: "+t)}catch(e){throw _printDatetime("Segment failed to start: "+t),e}}async stopBroadcast(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Stopping broadcast");try{await _stopBroadcast(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("Broadcast stopped")}catch(e){throw _printDatetime("Broadcast failed to stop"),e}}async addAssetScheduleEvent(t,e,i,a,n){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Adding asset schedule event to channel: "+t);try{var r=await _addAssetScheduleEvent(this.token,this.config.serviceApiUrl,t,e,i,a,n,this.debugMode);return _printDatetime("Asset schedule event added to channel: "+t),r}catch(e){throw _printDatetime("Asset schedule event failed to add to channel: "+t),e}}async addInputScheduleEvent(t,e,i,a,n){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Adding input schedule event to channel "+t);try{var r=await _addInputScheduleEvent(this.token,this.config.serviceApiUrl,t,e,i,a,n,this.debugMode);return _printDatetime("Input schedule event added to channel "+t),r}catch(e){throw _printDatetime("Input schedule event failed to add to channel "+t),e}}async getAssetScheduleEvent(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting asset schedule event: "+t);try{var i=await _getAssetScheduleEvent(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Asset schedule event gotten: "+t),i}catch(e){throw _printDatetime("Asset schedule event failed to get: "+t),e}}async getInputScheduleEvent(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting asset schedule event: "+t);try{var i=await _getInputScheduleEvent(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Asset schedule event gotten: "+t),i}catch(e){throw _printDatetime("Input schedule event failed to get: "+t),e}}async moveScheduleEvent(t,e,i){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Moving schedule event: "+t);try{var a=await _moveScheduleEvent(this.token,this.config.serviceApiUrl,t,e,i,this.debugMode);return _printDatetime("Schedule event moved: "+t),a}catch(e){throw _printDatetime("Schedule event failed to move: "+t),e}}async removeAssetScheduleEvent(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Removing asset schedule event: "+t);try{await _removeAssetScheduleEvent(this.token,this.config.serviceApiUrl,t,e,this.debugMode),_printDatetime("Asset schedule event removed: "+t)}catch(e){throw _printDatetime("Asset schedule event failed to remove: "+t),e}}async removeInputScheduleEvent(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Removing input schedule event");try{await _removeInputScheduleEvent(this.token,this.config.serviceApiUrl,e,t,this.debugMode),_printDatetime("Input schedule event removed")}catch(e){throw _printDatetime("Input schedule event failed to remove"),e}}async updateAssetScheduleEvent(t,e,i,a,n,r){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating asset schedule event: "+t);try{var o=await _updateAssetScheduleEvent(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,this.debugMode);return _printDatetime("Asset schedule event updated: "+t),o}catch(e){throw _printDatetime("Asset schedule event failed to update: "+t),e}}async updateInputScheduleEvent(e,t,i,a,n,r){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating input schedule event");try{var o=await _updateInputScheduleEvent(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,this.debugMode);return _printDatetime("Input schedule event updated"),o}catch(e){throw _printDatetime("Input schedule event failed to update"),e}}async createLiveOutputProfile(e,t,i,a,n,r,o,s,l,d,p,c,h,u){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating live output profile");try{var f=await _createLiveOutputProfile(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,c,h,u,this.debugMode);return _printDatetime("Live output profile created"),f}catch(e){throw _printDatetime("Live output profile failed to create"),e}}async deleteLiveOutputProfile(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting live output profile");try{await _deleteLiveOutputProfile(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("Live output profile deleted")}catch(e){throw _printDatetime("Live output profile failed to delete"),e}}async getLiveOutputProfile(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting live output profile");try{var t=await _getLiveOutputProfile(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Live output profile gotten"),t}catch(e){throw _printDatetime("Live output profile failed to get"),e}}async getLiveOutputProfiles(){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting live output profiles");try{var e=await _getLiveOutputProfiles(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Live outputs gotten"),e}catch(e){throw _printDatetime("Live output profiles failed to get"),e}}async getLiveOutputTypes(){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting live output types");try{var e=await _getLiveOutputTypes(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Live output types gotten"),e}catch(e){throw _printDatetime("Live output types failed to get"),e}}async updateLiveOutputProfile(e,t,i,a,n,r,o,s,l,d,p,c,h,u,f){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating live output profile");try{var y=await _updateLiveOutputProfile(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,c,h,u,f,this.debugMode);return _printDatetime("Live output updated"),y}catch(e){throw _printDatetime("Live output profile failed to update"),e}}async createLiveOutputProfileGroup(e,t,i,a,n,r,o){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");null===o&&(o=[]),_printDatetime("Creating live output profile group");try{var s=await _createLiveOutputProfileGroup(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,this.debugMode);return _printDatetime("Live output profile group created"),s}catch(e){throw _printDatetime("Live output profile group failed to create"),e}}async deleteLiveOutputProfileGroup(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting live output profile group");try{await _deleteLiveOutputProfileGroup(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("Live output profile group deleted")}catch(e){throw _printDatetime("Live output profile group failed to delete"),e}}async getLiveOutputProfileGroup(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting live output profile group");try{var t=await _getLiveOutputProfileGroup(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Live output profile group gotten"),t}catch(e){throw _printDatetime("Live output profile group failed to get"),e}}async getLiveOutputProfileGroups(){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting live output profile groups");try{var e=await _getLiveOutputProfileGroups(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Live output profile groups gotten"),e}catch(e){throw _printDatetime("Live output profile groups failed to get"),e}}async updateLiveOutputProfileGroup(e,t,i,a,n,r,o,s){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");null===s&&(s=[]),_printDatetime("Updating live output profile group");try{var l=await _updateLiveOutputProfileGroup(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,this.debugMode);return _printDatetime("Live output profile group updated"),l}catch(e){throw _printDatetime("Live output profile group failed to update"),e}}async createIntelligentPlaylist(e,t,i,a,n,r,o,s,l,d){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");null===e&&(e=[]),null===n&&(n=[]),null===l&&(l=[]),_printDatetime("Creating intelligent playlist");try{var p=await _createIntelligentPlaylist(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,this.debugMode);return _printDatetime("Intelligent playlist created"),p}catch(e){throw _printDatetime("Intelligent playlist failed to create"),e}}async createIntelligentSchedule(e,t,i,a){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating intelligent schedule");try{var n=await _createIntelligentSchedule(this.token,this.config.serviceApiUrl,e,t,i,a,this.debugMode);return _printDatetime("Intelligent schedule created"),n}catch(e){throw _printDatetime("Intelligent schedule failed to create"),e}}async createPlaylist(e,t,i,a){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating playlist");try{var n=await _createPlaylist(this.token,this.config.serviceApiUrl,e,t,i,a,this.debugMode);return _printDatetime("Playlist created"),n}catch(e){throw _printDatetime("Playlist failed to create"),e}}async createPlaylistVideo(e,t,i){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating playlist video");try{var a=await _createPlaylistVideo(this.token,this.config.serviceApiUrl,e,t,i,this.debugMode);return _printDatetime("Playlist video created"),a}catch(e){throw _printDatetime("Playlist video failed to create"),e}}async createScheduleItemAsset(e,t,i,a,n,r,o){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating schedule item asset");try{var s=await _createScheduleItemAsset(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,this.debugMode);return _printDatetime("Schedule item asset created"),s}catch(e){throw _printDatetime("Schedule item asset failed to create"),e}}async createScheduleItemLiveChannel(e,t,i,a,n,r,o){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating schedule item live channel");try{var s=await _createScheduleItemLiveChannel(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,this.debugMode);return _printDatetime("Schedule item live channel created"),s}catch(e){throw _printDatetime("Schedule item live channel failed to create"),e}}async createScheduleItemPlaylistSchedule(e,t,i,a,n,r,o){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating schedule item playlist schedule");try{var s=await _createScheduleItemPlaylistSchedule(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,this.debugMode);return _printDatetime("Schedule item playlist schedule created"),s}catch(e){throw _printDatetime("Schedule item playlist schedule failed to create"),e}}async createScheduleItemSearchFilter(e,t,i,a,n,r,o,s,l,d,p,c,h,u){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");null===t&&(t=[]),null===l&&(l=[]),_printDatetime("Creating schedule item search filter");try{var f=await _createScheduleItemSearchFilter(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,c,h,u,this.debugMode);return _printDatetime("Schedule item search filter created"),f}catch(e){throw _printDatetime("Schedule item search filter failed to create"),e}}async deleteIntelligentPlaylist(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting intelligent playlist");try{await _deleteIntelligentPlaylist(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("Intelligent playlist deleted")}catch(e){throw _printDatetime("Intelligent playlist failed to delete"),e}}async deleteIntelligentSchedule(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting intelligent schedule");try{await _deleteIntelligentSchedule(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("Intelligent schedule deleted")}catch(e){throw _printDatetime("Intelligent schedule failed to delete"),e}}async deletePlaylist(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting playlist");try{await _deletePlaylist(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("Playlist deleted")}catch(e){throw _printDatetime("Playlist failed to delete"),e}}async deleteScheduleItem(e,t){null===this.token&&await this._init(),_printDatetime("Deleting schedule item");try{await _deleteScheduleItem(this.token,this.config.serviceApiUrl,e,t,this.debugMode),_printDatetime("Schedule item deleted")}catch(e){throw _printDatetime("Schedule item failed to delete"),e}}async getIntelligentPlaylist(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting intelligent playlist");try{var t=await _getIntelligentPlaylist(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Intelligent playlist gotten"),t}catch(e){throw _printDatetime("Intelligent playlist failed to get"),e}}async getIntelligentSchedule(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting intelligent schedule");try{var t=await _getIntelligentSchedule(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Intelligent schedule gotten"),t}catch(e){throw _printDatetime("Intelligent schedule failed to get"),e}}async getPlaylist(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting playlist");try{var t=await _getPlaylist(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Playlist gotten"),t}catch(e){throw _printDatetime("Playlist failed to get"),e}}async getScheduleItem(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting schedule item");try{var i=await _getScheduleItem(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Schedule item gotten"),i}catch(e){throw _printDatetime("Schedule item failed to get"),e}}async getScheduleItems(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting schedule items");try{var t=await _getScheduleItems(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Schedule items gotten"),t}catch(e){throw _printDatetime("Schedule items failed to get"),e}}async getSchedulePreview(e){null===this.token&&await this._init(),"admin"!==this.config.apiType&&_printDatetime("Getting schedule preview");try{var t=await _getSchedulePreview(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Schedule preview gotten"),t}catch(e){throw _printDatetime("Schedule preview failed to get"),e}}async moveScheduleItem(e,t,i){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Moving schedule item");try{var a=await _moveScheduleItem(this.token,this.config.serviceApiUrl,e,t,i,this.debugMode);return _printDatetime("Schedule item moved"),a}catch(e){throw _printDatetime("Schedule item failed to move"),e}}async publishIntelligentSchedule(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Publishing intelligent schedule");try{var i=await _publishIntelligentSchedule(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Intelligent schedule published"),i}catch(e){throw _printDatetime("Intelligent schedule failed to publish"),e}}async startSchedule(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Starting schedule");try{var i=await _startSchedule(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Schedule started"),i}catch(e){throw _printDatetime("Schedule failed to start"),e}}async stopSchedule(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Stopping schedule");try{var i=await _stopSchedule(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Schedule stopped"),i}catch(e){throw _printDatetime("Schedule failed to stop"),e}}async updateIntelligentPlaylist(e,t,i,a,n,r,o,s,l,d,p){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");null===t&&(t=[]),null===r&&(r=[]),null===d&&(d=[]),_printDatetime("Updating intelligent playlist");try{var c=await _updateIntelligentPlaylist(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,this.debugMode);return _printDatetime("Intelligent playlist updated"),c}catch(e){throw _printDatetime("Intelligent playlist failed to update"),e}}async updateIntelligentSchedule(e,t,i,a,n){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating intelligent schedule");try{var r=await _updateIntelligentSchedule(this.token,this.config.serviceApiUrl,e,t,i,a,n,this.debugMode);return _printDatetime("Intelligent schedule updated"),r}catch(e){throw _printDatetime("Intelligent schedule failed to update"),e}}async updatePlaylist(e,t,i,a,n){null===this.token&&await this._init(),null===t&&(t={}),null===n&&(n={}),_printDatetime("Updating playlist");try{var r=await _updatePlaylist(this.token,this.config.serviceApiUrl,e,t,i,a,n,this.debugMode);return _printDatetime("Playlist updated"),r}catch(e){throw _printDatetime("Playlist failed to update"),e}}async updatePlaylistVideo(e,t,i){null===this.token&&await this._init(),_printDatetime("Updating playlist video");try{var a=await _updatePlaylistVideo(this.token,this.config.serviceApiUrl,e,t,i,this.debugMode);return _printDatetime("Playlist video updated"),a}catch(e){throw _printDatetime("Playlist video failed to update"),e}}async updateScheduleItemAsset(e,t,i,a,n,r,o){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating schedule item asset");try{var s=await _updateScheduleItemAsset(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,this.debugMode);return _printDatetime("Schedule item asset updated"),s}catch(e){throw _printDatetime("Schedule item asset failed to update"),e}}async updateScheduleItemLiveChannel(e,t,i,a,n,r,o){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating schedule item live channel");try{var s=await _updateScheduleItemLiveChannel(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,this.debugMode);return _printDatetime("Schedule item live channel updated"),s}catch(e){throw _printDatetime("Schedule item live channel failed to update"),e}}async updateScheduleItemPlaylistSchedule(e,t,i,a,n,r,o){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating schedule item playlist schedule");try{var s=await _updateScheduleItemPlaylistSchedule(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,this.debugMode);return _printDatetime("Schedule item playlist schedule updated"),s}catch(e){throw _printDatetime("Schedule item playlist schedule failed to update"),e}}async updateScheduleItemSearchFilter(e,t,i,a,n,r,o,s,l,d,p,c,h,u,f){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating schedule item search filter");try{var y=await _updateScheduleItemSearchFilter(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,c,h,u,f,this.debugMode);return _printDatetime("Schedule item search filter updated"),y}catch(e){throw _printDatetime("Schedule item search filter failed to update"),e}}async deleteUser(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");e=e||this.id,_printDatetime("Deleting user");try{await _deleteUser(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("User deleted")}catch(e){throw _printDatetime("User failed to delete"),e}}async deleteUserContentAttributeData(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user content attribute data");try{e=e||this.id,await _deleteUserContentAttributeData(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("User content attribute data deleted")}catch(e){throw _printDatetime("User content attribute data failed to delete"),e}}async deleteUserContentGroupData(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user content group data");try{e=e||this.id,await _deleteUserContentGroupData(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("User content group data deleted")}catch(e){throw _printDatetime("User content group data failed to delete"),e}}async deleteUserContentSecurityData(e,t,i,a,n,r,o){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user content security data");try{a=a||this.id,await _deleteUserContentSecurityData(this.token,this.config.serviceApiUrl,e,t,a,i,n,r,o,this.debugMode),_printDatetime("User content security data deleted")}catch(e){throw _printDatetime("User content security data failed to delete"),e}}async deleteUserData(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user data");try{e=e||this.id,await _deleteUserData(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("User data deleted")}catch(e){throw _printDatetime("User data failed to delete"),e}}async deleteUserDislikesData(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user dislikes data");try{e=e||this.id,await _deleteUserDislikesData(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("User dislikes data deleted")}catch(e){throw _printDatetime("User dislikes data failed to delete"),e}}async deleteUserFavoritesData(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user favorites data");try{e=e||this.id,await _deleteUserFavoritesData(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("User favorites data deleted")}catch(e){throw _printDatetime("User favorites data failed to delete"),e}}async deleteUserLikesData(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user likes data");try{e=e||this.id,await _deleteUserLikesData(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("User likes data deleted")}catch(e){throw _printDatetime("User likes data failed to delete"),e}}async deleteUserSavedSearchData(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user saved search data");try{e=e||this.id,await _deleteUserSavedSearchData(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("User saved search data deleted")}catch(e){throw _printDatetime("User saved search data failed to delete"),e}}async deleteUserSessionData(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user session data");try{e=e||this.id,await _deleteUserSessionData(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("User session data deleted")}catch(e){throw _printDatetime("User session data failed to delete"),e}}async deleteUserVideoTrackingData(e,t,i,a,n,r,o,s,l,d,p,c,h,u,f,y){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user video tracking data");try{a=a||this.id,await _deleteUserVideoTrackingData(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,c,h,u,f,y,this.debugMode),_printDatetime("User video tracking data deleted")}catch(e){throw _printDatetime("User video tracking data failed to delete"),e}}async changeSessionStatus(e,t,i){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Changing session status"),e=e||this.userSessionId;try{var a=await _changeSessionStatus(this.token,this.config.serviceApiUrl,e,t,i,this.debugMode);return _printDatetime("Session status changed"),a}catch(e){throw _printDatetime("Session status failed to change"),e}}async getUserSession(e){null===this.token&&await this._init(),_printDatetime("Getting user session");try{e=e||this.userSessionId;var t=await _getUserSession(this.token,this.config.serviceApiUrl,this.config.apiType,e,this.debugMode);return _printDatetime("User session gotten"),t}catch(e){throw _printDatetime("User session failed to get"),e}}async register(t,e,i,a){_printDatetime("Registering user: "+t);try{var n=await _register(this.config.serviceApiUrl,t,e,i,a,this.debugMode);return _printDatetime("User registered: "+t),n}catch(e){throw _printDatetime("User failed to register: "+t),e}}async resendCode(t){_printDatetime("Resending code: "+t);try{await _resendCode(this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Code resent: "+t)}catch(e){throw _printDatetime("Code failed to resend: "+t),e}}async verify(t,e){_printDatetime("Verifying user: "+t);try{var i=await _verify(this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("User verified: "+t),i}catch(e){throw _printDatetime("User failed to verify: "+t),e}}async archiveAsset(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Archiving asset: "+t);try{var e=await _archiveAsset(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Asset archived: "+t),e}catch(e){throw _printDatetime("Asset failed to archive: "+t),e}}async buildMedia(e,t,i,a,n,r,o,s){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Building media");try{await _buildMedia(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,this.debugMode),_printDatetime("Media built")}catch(e){throw _printDatetime("Media failed to build"),e}}async clipAsset(t,e,i,a,n,r,o,s,l,d){null===this.token&&await this._init(),_printDatetime("Clipping asset: "+t);try{var p=await _clipAsset(this.token,this.config.serviceApiUrl,t,this.config.apiType,e,i,a,n,r,o,s,l,d,this.debugMode);return _printDatetime("Asset clipped: "+t),p}catch(e){throw _printDatetime("Asset failed to clip: "+t),e}}async copyAsset(t,e,i,a,n,r){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Copying asset(s): "+t);try{var o=await _copyAsset(this.token,this.config.serviceApiUrl,t,e,i,a,n,this.id,r,this.debugMode);return _printDatetime("Asset(s) copied: "+t),o}catch(e){throw _printDatetime("Asset failed to copy: "+t),e}}async createAnnotation(e,t,i,a,n,r,o,s,l){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Creating annotation");try{var d={firstKeyword:a,secondKeyword:n,description:r,country:o},p=await _createAnnotation(this.token,this.config.serviceApiUrl,e,t,i,d,s,l,this.debugMode);return _printDatetime("Annotation created"),p}catch(e){throw _printDatetime("Annotation failed to create"),e}}async createAssetAdBreak(e,t,i,a){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating asset ad break");try{var n=await _createAssetAdBreak(this.token,this.config.serviceApiUrl,e,t,i,a,this.debugMode);return _printDatetime("Asset ad break created"),n}catch(e){throw _printDatetime("Asset ad break failed to create"),e}}async createFolderAsset(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating folder asset");try{var i=await _createFolderAsset(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Folder asset created"),i}catch(e){throw _printDatetime("Folder asset failed to create"),e}}async createPlaceholderAsset(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");if(_printDatetime("Creating placeholder asset"),!t.includes("."))throw new Error("The asset name must contain file extension.");try{var i=await _createPlaceholderAsset(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Placeholder asset created"),i}catch(e){throw _printDatetime("Placeholder asset failed to create"),e}}async createScreenshotAtTimecode(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating screenshot at timecode");try{var i=await _createScreenshotAtTimecode(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Screenshot created at timecode"),i}catch(e){throw _printDatetime("Screenshot failed to create at timecode"),e}}async deleteAnnotation(e,t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Deleting annotation");try{await _deleteAnnotation(this.token,this.config.serviceApiUrl,e,t,this.debugMode),_printDatetime("Annotation deleted")}catch(e){throw _printDatetime("Annotation failed to delete"),e}}async deleteAsset(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting asset: "+t);try{await _deleteAsset(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Asset deleted: "+t)}catch(e){throw _printDatetime("Asset failed to delete: "+t),e}}async deleteAssetAdBreak(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting asset ad break");try{await _deleteAssetAdBreak(this.token,this.config.serviceApiUrl,e,t,this.debugMode),_printDatetime("Asset ad break deleted")}catch(e){throw _printDatetime("Asset ad break failed to delete"),e}}async downloadArchiveAsset(e,t,i){null===this.token&&await this._init(),_printDatetime("Downloading archive asset");try{var a=await _downloadArchiveAsset(this.token,this.config.serviceApiUrl,this.config.apiType,e,t,i,this.debugMode);return _printDatetime("Archive asset downloaded"),a}catch(e){throw _printDatetime("Archive asset failed to download"),e}}async duplicateAsset(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Duplicating asset: "+t);try{var e=await _duplicateAsset(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Asset duplicated: "+t),e}catch(e){throw _printDatetime("Asset failed to duplicate: "+t),e}}async getAnnotations(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting annotations for "+t);try{var e=await _getAnnotations(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Annotations retrieved for "+t),e}catch(e){throw _printDatetime("Annotations failed to retrieve for "+t),e}}async getAsset(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting asset for "+t);try{var e=await _getAsset(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Asset retrieved for "+t),e}catch(e){throw _printDatetime("Asset failed to retrieve for "+t),e}}async getAssetAdBreaks(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting asset ad breaks for "+t);try{var e=await _getAssetAdBreaks(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Asset ad breaks retrieved for "+t),e}catch(e){throw _printDatetime("Asset ad breaks failed to retrieve for "+t),e}}async getAssetChildNodes(t,e,i,a,n,r){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting asset child nodes for "+t);try{var o=await _getAssetChildNodes(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,this.debugMode);return _printDatetime("Asset child nodes retrieved for "+t),o}catch(e){throw _printDatetime("Asset child nodes failed to retrieve for "+t),e}}async getAssetDetails(t){null===this.token&&await this._init(),_printDatetime("Getting asset details for "+t);try{var e=await _getAssetDetails(this.token,this.config.serviceApiUrl,t,this.config.apiType,this.debugMode);return _printDatetime("Asset details retrieved for "+t),e}catch(e){throw _printDatetime("Asset details failed to retrieve for "+t),e}}async getAssetManifestWithCookies(t,e){null===this.token&&await this._init(),_printDatetime("Getting asset manifest with cookies for "+t);try{var i=await _getAssetManifestWithCookies(this.token,this.config.serviceApiUrl,t,e,this.config.apiType,this.debugMode);return _printDatetime("Asset manifest with cookies retrieved for "+t),i}catch(e){throw _printDatetime("Asset manifest with cookies failed to retrieve for "+t),e}}async getAssetMetadataSummary(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting asset metadata summary for "+t);try{var e=await _getAssetMetadataSummary(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Asset metadata summary retrieved for "+t),e}catch(e){throw _printDatetime("Asset metadata summary failed to retrieve for "+t),e}}async getAssetParentFolders(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting asset parent folders for "+t);try{var i=await _getAssetParentFolders(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Asset parent folders retrieved for "+t),i}catch(e){throw _printDatetime("Asset parent folders failed to retrieve for "+t),e}}async getAssetScreenshotDetails(t,e,i){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting asset screenshot details for "+t);try{var a=await _getAssetScreenshotDetails(this.token,this.config.serviceApiUrl,t,e,i,this.debugMode);return _printDatetime("Asset screenshot details retrieved for "+t),a}catch(e){throw _printDatetime("Asset screenshot details failed to retrieve for "+t),e}}async getAssetSegmentDetails(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting asset segment details for "+t);try{var i=await _getAssetSegmentDetails(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Asset segment details retrieved for "+t),i}catch(e){throw _printDatetime("Asset segment details failed to retrieve for "+t),e}}async getUserUploadParts(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting user upload parts for "+t);try{var e=await _getUserUploadParts(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("User upload parts retrieved for "+t),e}catch(e){throw _printDatetime("User upload parts failed to retrieve for "+t),e}}async getUserUploads(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting user uploads");try{var t=await _getUserUploads(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("User uploads retrieved"),t}catch(e){throw _printDatetime("User uploads failed to retrieve"),e}}async importAnnotations(e,t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Importing annotations");try{await _importAnnotations(this.token,this.config.serviceApiUrl,e,t,this.debugMode),_printDatetime("Annotations imported")}catch(e){throw _printDatetime("Annotations failed to import"),e}}async indexAsset(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Indexing asset: "+t);try{await _indexAsset(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Asset indexed: "+t)}catch(e){throw _printDatetime("Asset failed to index: "+t),e}}async localRestoreAsset(t,e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Local restoring asset: "+t);try{var i=await _localRestoreAsset(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Asset local restored: "+t),i}catch(e){throw _printDatetime("Asset failed to local restore: "+t),e}}async moveAsset(t,e,i,a,n,r){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Moving asset: "+t);try{var o=await _moveAsset(this.token,this.config.serviceApiUrl,t,e,i,a,n,this.id,r,this.debugMode);return _printDatetime("Asset moved: "+t),o}catch(e){throw _printDatetime("Asset failed to move: "+t),e}}async recordsAssetTrackingBeacon(e,t,i,a,n){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Recording asset tracking beacon");try{await _recordsAssetTrackingBeacon(this.token,this.config.serviceApiUrl,e,t,i,a,n,this.debugMode),_printDatetime("Asset tracking beacon recorded")}catch(e){throw _printDatetime("Asset tracking beacon failed to record"),e}}async registerAsset(t,e,i,a,n,r,o,s,l,d,p,c,h,u,f,y,w,g,m){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Registering asset: "+t);try{var v=await _registerAsset(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,o,s,l,d,p,c,h,u,f,y,w,g,m,this.debugMode);return _printDatetime("Asset registered: "+t),v}catch(e){throw _printDatetime("Asset failed to register: "+t),e}}async reprocessAsset(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Reprocessing asset");try{var t=await _reprocessAsset(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Asset reprocessed"),t}catch(e){throw _printDatetime("Asset failed to reprocess"),e}}async restoreAsset(t){null===this.token&&await this._init(),_printDatetime("Restoring asset: "+t);try{await _restoreAsset(this.token,this.config.serviceApiUrl,t,this.config.apiType,this.debugMode),_printDatetime("Asset restored: "+t)}catch(e){throw _printDatetime("Asset failed to restore: "+t),e}}async shareAsset(t,e,i,a){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Sharing asset: "+t);try{var n=await _shareAsset(this.token,this.config.serviceApiUrl,t,e,i,a,this.debugMode);return _printDatetime("Asset shared: "+t),n}catch(e){throw _printDatetime("Asset failed to share: "+t),e}}async startWorkflow(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Starting workflow");try{var i=await _startWorkflow(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Workflow started"),i}catch(e){throw _printDatetime("Workflow failed to start"),e}}async transcribeAsset(t,e,i){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Transcribing asset: "+t);try{await _transcribeAsset(this.token,this.config.serviceApiUrl,t,e,i,this.debugMode),_printDatetime("Asset transcribed: "+t)}catch(e){throw _printDatetime("Asset failed to transcribe: "+t),e}}async updateAnnotation(e,t,i,a,n,r,o,s,l,d){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Updating annotation");try{var p=await _updateAnnotation(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,this.debugMode);return _printDatetime("Annotation updated"),p}catch(e){throw _printDatetime("Annotation failed to update"),e}}async updateAsset(e,t,i,a,n,r){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating asset");try{await _updateAsset(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,this.debugMode),_printDatetime("Asset updated")}catch(e){throw _printDatetime("Asset failed to update"),e}}async updateAssetAdBreak(e,t,i,a,n){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating asset ad break");try{var r=await _updateAssetAdBreak(this.token,this.config.serviceApiUrl,e,t,i,a,n,this.debugMode);return _printDatetime("Asset ad break updated"),r}catch(e){throw _printDatetime("Asset ad break failed to update"),e}}async updateAssetLanguage(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating asset language");try{await _updateAssetLanguage(this.token,this.config.serviceApiUrl,e,t,this.debugMode),_printDatetime("Asset language updated")}catch(e){throw _printDatetime("Asset language failed to update"),e}}async ping(e,t){null===this.token&&await this._init(),_printDatetime("Pinging user");try{var i=await _ping(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("User pinged"),i}catch(e){throw _printDatetime("User failed to ping"),e}}async pingAuth(e,t){null===this.token&&await this._init(),_printDatetime("Pinging user");try{var i=await _pingAuth(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("User pinged"),i}catch(e){throw _printDatetime("User failed to ping"),e}}async search(e,t,i,a,n,r,o,s,l,d){null===this.token&&await this._init(),_printDatetime("Searching...");try{var p=await _search(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,this.config.apiType,this.debugMode);return _printDatetime("Search complete"),!!p.hasItems&&p}catch(e){throw _printDatetime("Search failed"),e}}async changeEmail(t,e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Changing email: "+t);try{await _changeEmail(this.token,this.config.serviceApiUrl,t,this.config.password,this.debugMode),_printDatetime("Email changed: "+t)}catch(e){throw _printDatetime("Email failed to change: "+t),e}}async changePassword(e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Changing password");try{await _changePassword(this.token,this.config.serviceApiUrl,this.config.password,e,this.debugMode),_printDatetime("Password changed")}catch(e){throw _printDatetime("Password failed to change"),e}}async getUser(){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting user");try{var e=await _getUser(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("User gotten"),e}catch(e){throw _printDatetime("User failed to get"),e}}async updateUser(e,t,i,a,n,r,o,s,l,d,p){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Updating user");try{var c=await _updateUser(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,this.debugMode);return _printDatetime("User updated"),c}catch(e){throw _printDatetime("User failed to update"),e}}async addContentsToContentGroup(t,e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Adding content to content group: "+t);try{var i=await _addContentsToContentGroup(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Content added to content group: "+t),i}catch(e){throw _printDatetime("Content failed to add to content group: "+t),e}}async createContentGroup(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Creating content group: "+t);try{var e=await _createContentGroup(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Content group created: "+t),e}catch(e){throw _printDatetime("Content group failed to create: "+t),e}}async deleteContentGroup(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Deleting content group: "+t);try{var e=await _deleteContentGroup(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Content group deleted: "+t),e}catch(e){throw _printDatetime("Content group failed to delete: "+t),e}}async getContentGroup(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting content group: "+t);try{var e=await _getContentGroup(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Content group gotten: "+t),e}catch(e){throw _printDatetime("Content group failed to get: "+t),e}}async getContentGroups(){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting content groups");try{var e=await _getContentGroups(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Content groups gotten"),e}catch(e){throw _printDatetime("Content groups failed to get"),e}}async getPortalGroups(e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting portal groups");try{var t=await _getPortalGroups(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Portal groups gotten"),t}catch(e){throw _printDatetime("Portal groups failed to get"),e}}async removeContentsFromContentGroup(t,e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Removing content from content group: "+t);try{var i=await _removeContentsFromContentGroup(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Content removed from content group: "+t),i}catch(e){throw _printDatetime("Content failed to remove from content group: "+t),e}}async renameContentGroup(t,e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Renaming content group: "+t);try{var i=await _renameContentGroup(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Content group renamed: "+t),i}catch(e){throw _printDatetime("Content group failed to rename: "+t),e}}async shareContentGroupWithUsers(t,e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Sharing content group with users: "+t);try{var i=await _shareContentGroupWithUsers(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Content group shared with users: "+t),i}catch(e){throw _printDatetime("Content group failed to share with users: "+t),e}}async stopSharingContentGroupWithUsers(t,e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Stopping sharing content group with users: "+t);try{var i=await _stopSharingContentGroupWithUsers(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Content group stopped sharing with users: "+t),i}catch(e){throw _printDatetime("Content group failed to stop sharing with users: "+t),e}}async clearContinueWatching(e,t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Clearing continue watching");try{await _clearContinueWatching(this.token,this.config.serviceApiUrl,e,t,this.debugMode),_printDatetime("Continue watching cleared")}catch(e){throw _printDatetime("Continue watching failed to clear"),e}}async clearWatchlist(e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Clearing watchlist");try{e=e||this.id,await _clearWatchlist(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("Watchlist cleared")}catch(e){throw _printDatetime("Watchlist failed to clear"),e}}async createForm(e,t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Creating form");try{var i=await _createForm(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Form created"),i}catch(e){throw _printDatetime("Form failed to create"),e}}async getContentCookies(e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting content cookies");try{var t=await _getContentCookies(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Content cookies gotten"),t}catch(e){throw _printDatetime("Content cookies failed to get"),e}}async getDefaultSiteConfig(){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting default site config");try{var e=await _getDefaultSiteConfig(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Default site config gotten"),e}catch(e){throw _printDatetime("Default site config failed to get"),e}}async getDynamicContent(t){null===this.token&&await this._init(),_printDatetime("Getting dynamic content: "+t);try{var e=await _getDynamicContent(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Dynamic content gotten: "+t),e}catch(e){throw _printDatetime("Dynamic content failed to get: "+t),e}}async getDynamicContents(){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting dynamic contents");try{var e=await _getDynamicContents(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Dynamic contents gotten"),e}catch(e){throw _printDatetime("Dynamic contents failed to get"),e}}async getMediaGroup(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting media group: "+t);try{var e=await _getMediaGroup(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Media group gotten: "+t),e}catch(e){throw _printDatetime("Media group failed to get: "+t),e}}async getMediaItem(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting media item: "+t);try{var e=await _getMediaItem(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Media item gotten: "+t),e}catch(e){throw _printDatetime("Media item failed to get: "+t),e}}async getMyContent(){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is not available for portal API type.");_printDatetime("Getting my content");try{var e=await _getMyContent(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("My content gotten"),e}catch(e){throw _printDatetime("My content failed to get"),e}}async getMyGroup(t){null===this.token&&await this._init(),_printDatetime("Getting my group: "+t);try{var e=await _getMyGroup(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("My group gotten: "+t),e}catch(e){throw _printDatetime("My group failed to get: "+t),e}}async getSiteConfig(t){null===this.token&&await this._init(),_printDatetime("Getting site config: "+t);try{var e=await _getSiteConfig(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Site config gotten: "+t),e}catch(e){throw _printDatetime("Site config failed to get: "+t),e}}async mediaSearch(e,t,i,a,n){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Searching media...");try{var r=await _mediaSearch(this.token,this.config.serviceApiUrl,e,t,i,a,n,this.debugMode);return _printDatetime("Media search complete"),r}catch(e){throw _printDatetime("Media search failed"),e}}async createMediaBuilder(e,t,i,a,n,r){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Creating media builder");try{var o=await _createMediaBuilder(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,this.debugMode);return _printDatetime("Media builder created"),o}catch(e){throw _printDatetime("Media builder failed to create"),e}}async createMediaBuilderItem(e,t,i,a,n,r){null===this.token&&await this._init(),_printDatetime("Creating media builder item");try{var o=await _createMediaBuilderItem(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,this.debugMode);return _printDatetime("Media builder item created"),o}catch(e){throw _printDatetime("Media builder item failed to create"),e}}async createMediaBuilderItemsAddAnnotations(e,t){null===this.token&&await this._init(),_printDatetime("Creating media builder item and adding annotations");try{var i=await _createMediaBuilderItemsAddAnnotations(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Media builder item created and annotations added"),i}catch(e){throw _printDatetime("Media builder item failed to create and annotations failed to add"),e}}async createMediaBuilderItemsBulk(e,t){null===this.token&&await this._init(),_printDatetime("Creating media builder items");try{var i=await _createMediaBuilderItemsBulk(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Media builder items created"),i}catch(e){throw _printDatetime("Media builder items failed to create"),e}}async deleteMediaBuilder(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Deleting media builder: "+t);try{await _deleteMediaBuilder(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Media builder deleted: "+t)}catch(e){throw _printDatetime("Media builder failed to delete: "+t),e}}async deleteMediaBuilderItem(e,t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Deleting media builder item: "+t);try{await _deleteMediaBuilderItem(this.token,this.config.serviceApiUrl,e,t,this.debugMode),_printDatetime("Media builder item deleted: "+t)}catch(e){throw _printDatetime("Media builder item failed to delete: "+t),e}}async duplicateMediaBuilder(t,e,i,a,n,r){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Duplicating media builder: "+t);try{var o=await _duplicateMediaBuilder(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,this.debugMode);return _printDatetime("Media builder duplicated: "+t),o}catch(e){throw _printDatetime("Media builder failed to duplicate: "+t),e}}async getMediaBuilder(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting media builder: "+t);try{var e=await _getMediaBuilder(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Media builder gotten: "+t),e}catch(e){throw _printDatetime("Media builder failed to get: "+t),e}}async getMediaBuilderIdsFromAsset(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting media builder ids from asset: "+t);try{var e=await _getMediaBuilderIdsFromAsset(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Media builder ids from asset gotten: "+t),e}catch(e){throw _printDatetime("Media builder ids from asset failed to get: "+t),e}}async getMediaBuilders(){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting media builders");try{var e=await _getMediaBuilders(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Media builders gotten"),e}catch(e){throw _printDatetime("Media builders failed to get"),e}}async getMediaBuilderItems(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting media builder items: "+t);try{var e=await _getMediaBuilderItems(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Media builder items gotten: "+t),e}catch(e){throw _printDatetime("Media builder items failed to get: "+t),e}}async moveMediaBuilderItem(t,e,i){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Moving media builder: "+t);try{await _moveMediaBuilderItem(this.token,this.config.serviceApiUrl,t,e,i,this.debugMode),_printDatetime("Media builder moved: "+t)}catch(e){throw _printDatetime("Media builder failed to move: "+t),e}}async renderMediaBuilder(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Rendering media builder: "+t);try{var e=await _renderMediaBuilder(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Media builder rendered: "+t),e}catch(e){throw _printDatetime("Media builder failed to render: "+t),e}}async updateMediaBuilder(t,e,i,a,n,r){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Updating media builder: "+t);try{var o=await _updateMediaBuilder(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,this.debugMode);return _printDatetime("Media builder updated: "+t),o}catch(e){throw _printDatetime("Media builder failed to update: "+t),e}}async guestInvite(t,e,i,a,n){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Inviting guest");try{var r=await _guestInvite(this.token,this.config.serviceApiUrl,t,e,i,a,n,this.debugMode);return _printDatetime("Guest invited"),r}catch(e){throw _printDatetime("Guest failed to invite: "+t),e}}async registerGuest(t,e,i,a){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Registering guest: "+t);try{var n=await _registerGuest(this.token,this.config.serviceApiUrl,t,e,i,a,this.debugMode);return _printDatetime("Guest registered: "+t),n}catch(e){throw _printDatetime("Guest failed to register: "+t),e}}async removeGuest(t,e,i,a,n){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Removing guest");try{var r=await _removeGuest(this.token,this.config.serviceApiUrl,t,e,i,a,n,this.debugMode);return _printDatetime("Guest removed"),r}catch(e){throw _printDatetime("Guest failed to remove: "+t),e}}async addSavedSearch(e,t,i,a,n,r,o,s,l,d,p,c,h,u,f,y){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Adding saved search");try{var w=await _addSavedSearch(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,c,h,u,f,y,this.debugMode);return _printDatetime("Saved search added"),w}catch(e){throw _printDatetime("Saved search failed to add"),e}}async deleteSavedSearch(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Deleting saved search: "+t);try{await _deleteSavedSearch(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Saved search deleted: "+t)}catch(e){throw _printDatetime("Saved search failed to delete: "+t),e}}async getSavedSearch(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting saved search: "+t);try{var e=await _getSavedSearch(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Saved search gotten: "+t),e}catch(e){throw _printDatetime("Saved search failed to get: "+t),e}}async getSavedSearches(){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting saved searches");try{var e=await _getSavedSearches(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Saved searches gotten"),e}catch(e){throw _printDatetime("Saved searches failed to get"),e}}async getSearchSaved(e,t,i,a,n,r,o,s,l,d){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting search saved");try{var p=await _getSearchSaved(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,this.debugMode);return _printDatetime("Search saved gotten"),p}catch(e){throw _printDatetime("Search saved failed to get"),e}}async getSearchSavedById(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting search saved by ID: "+t);try{var e=await _getSearchSavedById(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Search saved by ID gotten: "+t),e}catch(e){throw _printDatetime("Search saved by ID failed to get: "+t),e}}async patchSavedSearch(t,e,i,a,n,r){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Patching saved search: "+t);try{var o=await _patchSavedSearch(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,this.debugMode);return _printDatetime("Saved search patched: "+t),o}catch(e){throw _printDatetime("Saved search failed to patch: "+t),e}}async updateSavedSearch(t,e,i,a,n,r,o,s,l,d,p,c,h,u,f,y,w){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Updating saved search: "+t);try{var g=await _updateSavedSearch(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,o,s,l,d,p,c,h,u,f,y,w,this.debugMode);return _printDatetime("Saved search updated: "+t),g}catch(e){throw _printDatetime("Saved search failed to update: "+t),e}}async getVideoTracking(t,e,i){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting video tracking: "+t);try{await _getVideoTracking(this.token,this.config.serviceApiUrl,t,e,i,this.debugMode),_printDatetime("Video tracking gotten: "+t)}catch(e){throw _printDatetime("Video tracking failed to get: "+t),e}}async miscFunctions(t,i,a,n){null===this.token&&await this._init(),_printDatetime("Calling function: "+t);try{let e=this.config.serviceApiUrl+"/"+t;n&&(e=(e=(e=e.replace("/api","")).replace("app-api.","")).replace("admin-app.",""));var r=new Headers,o=(r.append("Content-Type","application/json"),r.append("Authorization","Bearer "+this.token),this.debugMode&&(console.log(`URL: ${e}
|
|
1
|
+
import{promises as fs}from"fs";import path from"path";class NomadMediaSDK{constructor(e={}){return NomadMediaSDK.instance||(this.config=e,this.token=null,this.refreshTokenVal=null,this.expirationSeconds=null,this.userSessionId=null,this.id=null,this.debugMode=e.debugMode||!1,NomadMediaSDK.instance=this)}async _init(){await this.login(),this.__scheduleTokenRefresh()}async login(){_printDatetime("Logging in as "+this.config.username);try{var e=await _login(this.config.username,this.config.password,this.config.serviceApiUrl,this.debugMode);this.token=e.token,this.refreshTokenVal=e.refreshToken,this.expirationSeconds=Date.now()+1e3*e.expirationSeconds,this.userSessionId=e.userSessionId,this.id=e.id,_printDatetime("Login successful")}catch(e){throw _printDatetime("Login failed"),e}}async logout(){null===this.token&&await this._init(),_printDatetime("Logging out");try{await _logout(this.token,this.config.serviceApiUrl,this.debugMode),this.token=null,this.refreshTokenVal=null,this.expirationSeconds=null,this.userSessionId=null,this.id=null,_printDatetime("Logout successful")}catch(e){throw _printDatetime("Loggout failed"),e}}async refreshToken(){_printDatetime("Refreshing token");try{var e=await _refreshToken(this.token,this.config.serviceApiUrl,this.refreshTokenVal,this.debugMode);this.token=e.token,_printDatetime("Token refresh successful")}catch(e){throw _printDatetime("Token refresh failed"),e}}__scheduleTokenRefresh(){var e;this.token&&this.expirationSeconds&&0<(e=this.expirationSeconds-Date.now())&&(this.refreshTimer&&clearTimeout(this.refreshTimer),this.refreshTimer=setTimeout(async()=>{await this.refreshToken(),this.__scheduleTokenRefresh()},e-5e3))}async forgotPassword(){var t=this.config.username;_printDatetime("Sending code to "+t);try{await _forgotPassword(this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Code sent to "+t)}catch(e){throw _printDatetime("Code failed to send to "+t),e}}async resetPassword(e,t){var i=this.config.username;_printDatetime("Resetting password for "+i);try{await _resetPassword(this.config.serviceApiUrl,i,e,t,this.debugMode),_printDatetime("Password reset for "+i)}catch(e){throw _printDatetime("Password failed to reset for "+i),e}}async uploadAsset(t,i,a,n,r,o,s){null===this.token&&await this._init(),_printDatetime("Uploading asset");let l=null;try{let e=null;"string"==typeof r&&(e=r,(r=await fs.stat(r)).originalname=path.basename(e)),_printDatetime("Starting upload"),l=await _startUpload(this.token,this.config.serviceApiUrl,t,i,a,n,r,o,s,this.debugMode),r.buffer||(r.buffer=await fs.readFile(e)),await _multiThreadUpload(this.token,this.config.serviceApiUrl,r,l,this.debugMode),await _completeUpload(this.token,this.config.serviceApiUrl,l.id,this.debugMode);var d=l.assetId;return _printDatetime("Upload successful"),d}catch(e){throw null!==l&&await _cancelUpload(this.token,this.config.serviceApiUrl,l.id,this.debugMode),_printDatetime("Upload failed"),e}}async uploadRelatedAsset(e,i,a,n,r,o){null===this.token&&await this._init(),_printDatetime("Uploading related asset");let s=null;try{let t=null;return"string"==typeof r&&(t=r,(r=await fs.stat(r)).originalname=path.basename(t)),s=await _startRelatedAssetUpload(this.token,this.config.serviceApiUrl,e,i,a,n,r,o,this.debugMode),r.buffer||(r.buffer=await fs.readFile(t)),await _multiThreadUpload(this.token,this.config.serviceApiUrl,r,s,this.debugMode),await _completeUpload(this.token,this.config.serviceApiUrl,s.id,this.debugMode),_printDatetime("Related asset upload successful"),(await _getAssetDetails(this.token,this.config.serviceApiUrl,e,this.config.apiType,this.debugMode)).relatedAssets.find(e=>e.url.includes(path.basename(t))).id}catch(e){throw s&&await _cancelUpload(this.token,this.config.serviceApiUrl,s.id,this.debugMode),_printDatetime("Upload failed"),e}}async getAudit(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting audit for "+t);try{var e=await _getAudit(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Audit retrieved for "+t),e}catch(e){throw _printDatetime("Audit failed to retrieve for "+t),e}}async clearServerCache(){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Clearing server cache");try{await _clearServerCache(this.token,this.config.serviceApiUrl,this.debugMode),_printDatetime("Server cache cleared")}catch(e){throw _printDatetime("Server cache failed to clear"),e}}async getConfig(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting config");try{var t=await _getConfig(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Config retrieved"),t}catch(e){throw _printDatetime("Config failed to retrieve"),e}}async getServerTime(){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting server time");try{var e=await _getServerTime(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Server time retrieved"),e}catch(e){throw _printDatetime("Server time failed to retrieve"),e}}async createContent(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating content");try{var i=await _createContent(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Content created: "+i.contentId),i}catch(e){throw _printDatetime("Content failed to create"),e}}async deactivateContentUserTrack(t,e,i,a){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deactivating content user track: "+t);try{await _deactivateContentUserTrack(this.token,this.config.serviceApiUrl,t,e,i,a,this.debugMode),_printDatetime("Content user track deactivated: "+t)}catch(e){throw _printDatetime("Content user track failed to deactivate: "+t),e}}async deleteContent(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting content: "+t);try{await _deleteContent(this.token,this.config.serviceApiUrl,t,e,this.debugMode),_printDatetime("Content deleted: "+t)}catch(e){throw _printDatetime("Content failed to delete: "+t),e}}async getContent(t,e,i){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting content: "+t);try{var a=await _getContent(this.token,this.config.serviceApiUrl,t,e,i,this.debugMode);return _printDatetime("Content retrieved: "+t),a}catch(e){throw _printDatetime("Content failed to retrieve: "+t),e}}async getContentUserTrack(t,e,i,a,n,r){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting content user track: "+t),n=n||0,r=r||100;try{var o=await _getContentUserTrack(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,this.debugMode);return _printDatetime("Content user track retrieved: "+t),o}catch(e){throw _printDatetime("Content user track failed to retrieve: "+t),e}}async getContentUserTrackTouch(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting content user track touch: "+t);try{var i=await _getContentUserTrackTouch(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Content user track touch retrieved: "+t),i}catch(e){throw _printDatetime("Content user track touch failed to retrieve: "+t),e}}async updateContent(t,e,i,a){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating content: "+t);try{await _updateContent(this.token,this.config.serviceApiUrl,t,e,i,a,this.debugMode),_printDatetime("Content updated: "+t)}catch(e){throw _printDatetime("Content failed to update: "+t),e}}async addCustomProperties(t,e,i,a){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Adding custom properties to content: "+t);try{var n=await _addCustomProperties(this.token,this.config.serviceApiUrl,t,e,i,a,this.debugMode);return _printDatetime("Custom properties added to content: "+t),n}catch(e){throw _printDatetime("Custom properties failed to add to content: "+t),e}}async addRelatedContent(t,e,i){null===this.token&&await this._init(),_printDatetime("Adding related content to content: "+t);try{var a=await _addRelatedContent(this.token,this.config.serviceApiUrl,t,e,i,this.config.apiType,this.debugMode);return _printDatetime("Related content added to content: "+t),a.items[0]}catch(e){throw _printDatetime("Related content failed to add to content: "+t),e}}async addTagOrCollection(t,i,e,a,n,r){null===this.token&&await this._init(),_printDatetime(`Adding ${t} to content `+i);try{var o=await _addTagOrCollection(this.token,this.config.serviceApiUrl,t,i,e,a,n,r,this.config.apiType,this.debugMode);return _printDatetime(t+" added to content: "+i),o.items[0]}catch(e){throw _printDatetime(`Adding ${t} to content: ${i} failed`),e}}async bulkUpdateMetadata(e,t,i,a,n){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating metadata");try{await _bulkUpdateMetadata(this.token,this.config.serviceApiUrl,e,t,i,a,n,this.debugMode),_printDatetime("Metadata updated")}catch(e){throw _printDatetime("Metadata failed to update"),e}}async createTagOrCollection(t,i){null===this.token&&await this._init(),_printDatetime(`Creating ${t}: `+i);try{var e=await _createTagOrCollection(this.token,this.config.serviceApiUrl,t,i,this.debugMode);return _printDatetime(t+" created: "+i),e}catch(e){throw _printDatetime(t+" failed to create: "+i),e}}async deleteRelatedContent(t,e,i){null===this.token&&await this._init(),_printDatetime("Deleting related content from content: "+t);try{var a=await _deleteRelatedContent(this.token,this.config.serviceApiUrl,t,e,i,this.config.apiType,this.debugMode);return _printDatetime("Related content deleted from content: "+t),a.items[0]}catch(e){throw _printDatetime("Related content failed to delete from content: "+t),e}}async deleteTagOrCollection(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting tag or collection: "+t);try{var i=await _deleteTagOrCollection(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Tag or collection deleted: "+t),i}catch(e){throw _printDatetime("Tag or collection failed to delete: "+t),e}}async getTagOrCollection(t,i){null===this.token&&await this._init(),_printDatetime(`Getting ${t}: `+i);try{var e=await _getTagOrCollection(this.token,this.config.serviceApiUrl,t,i,this.debugMode);return _printDatetime(t+" retrieved: "+i),e}catch(e){throw _printDatetime(t+" failed to retrieve: "+i),e}}async removeTagOrCollection(t,i,e,a){null===this.token&&await this._init(),_printDatetime(`Removing ${t} from content: `+i);try{var n=await _removeTagOrCollection(this.token,this.config.serviceApiUrl,t,i,e,a,this.config.apiType,this.debugMode);return _printDatetime(t+" removed from content: "+i),n}catch(e){throw _printDatetime(t+" failed to remove from content: "+i),e}}async getContentDefinition(t){null===this.token&&await this._init(),_printDatetime("Getting content definition: "+t);try{var e=await _getContentDefinition(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Content definition retrieved: "+t),e}catch(e){throw _printDatetime("Content definition failed to retrieve: "+t),e}}async getContentDefinitions(e,t,i,a,n){null===this.token&&await this._init(),_printDatetime("Getting content definitions");try{var r=await _getContentDefinitions(this.token,this.config.serviceApiUrl,e,t,i,a,n,this.debugMode);return _printDatetime("Content definitions retrieved"),r}catch(e){throw _printDatetime("Content definitions failed to retrieve"),e}}async createAndUpdateEvent(e,t,i,a,n,r,o,s,l,d){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating/Updating event:");try{var p=await _createAndUpdateEvent(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,this.debugMode);return _printDatetime("Event created/updated"),p}catch(e){throw _printDatetime("Event failed to create/update"),e}}async deleteEvent(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting event: "+t);try{await _deleteEvent(this.token,this.config.serviceApiUrl,t,e,this.debugMode),_printDatetime("Event deleted: "+t)}catch(e){throw _printDatetime("Event failed to delete: "+t),e}}async addLiveScheduleToEvent(t,e,i,a,n,r,o,s,l,d,p){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Adding Live Schedule to Event: "+t);try{await _addLiveScheduleToEvent(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,o,s,l,d,p,this.debugMode),_printDatetime("Live Schedule added to Event: "+t)}catch(e){throw _printDatetime("Live Schedule failed to add to Event: "+t),e}}async extendLiveSchedule(t,e,i,a){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Extending Live Schedule of Event: "+t);try{await _extendLiveSchedule(this.token,this.config.serviceApiUrl,t,e,i,a,this.debugMode),_printDatetime("Live Schedule extended of Event: "+t)}catch(e){throw _printDatetime("Live Schedule failed to extend of Event: "+t),e}}async getLiveSchedule(t){null===this.token&&await this._init(),_printDatetime("Getting Live Schedule of Event: "+t);try{var e=await _getLiveSchedule(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Live Schedule retrieved of Event: "+t),e}catch(e){throw _printDatetime("Live Schedule failed to retrieve of Event: "+t),e}}async startLiveSchedule(t){null===this.token&&await this._init(),_printDatetime("Starting Live Schedule of Event: "+t);try{await _startLiveSchedule(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Live Schedule started of Event: "+t)}catch(e){throw _printDatetime("Live Schedule failed to start of Event: "+t),e}}async stopLiveSchedule(t){null===this.token&&await this._init(),_printDatetime("Stopping Live Schedule of Event: "+t);try{await _stopLiveSchedule(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Live Schedule stopped of Event: "+t)}catch(e){throw _printDatetime("Live Schedule failed to stop of Event: "+t),e}}async clipLiveChannel(t,e,i,a,n,r,o,s,l,d){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Clipping Live Channel: "+t);try{await _clipLiveChannel(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,o,s,l,d,this.debugMode);_printDatetime("Live Channel clipped: "+t)}catch(e){throw _printDatetime("Live Channel failed to clip: "+t),e}}async createLiveChannel(e,t,i,a,n,r,o,s,l,d,p){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating Live Channel: "+e);try{var c=await _createLiveChannel(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,this.debugMode);return _printDatetime("Live Channel created: "+c.id),c}catch(e){throw _printDatetime("Live Channel failed to create"),e}}async deleteLiveChannel(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting Live Channel: "+t);try{await _deleteLiveChannel(this.token,this.config.serviceApiUrl,t,e,this.debugMode),_printDatetime("Live Channel deleted: "+t)}catch(e){throw _printDatetime("Live Channel failed to delete: "+t),e}}async getLiveChannel(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting Live Channel: "+t);try{var e=await _getLiveChannel(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Live Channel gotten: "+t),e}catch(e){throw _printDatetime("Live Channel failed to get: "+t),e}}async getLiveChannels(){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting Live Channels");try{var e=await _getLiveChannels(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Live Channels gotten"),e}catch(e){throw _printDatetime("Live Channels failed to get"),e}}async liveChannelRefresh(){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Refreshing Live Channels");try{await _liveChannelRefresh(this.token,this.config.serviceApiUrl,this.debugMode),_printDatetime("Live Channels refreshed")}catch(e){throw _printDatetime("Live Channels failed to refresh"),e}}async nextEvent(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting Next Event of Live Channel: "+t);try{var e=await _nextEvent(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Next Event gotten of Live Channel: "+t),e}catch(e){throw _printDatetime("Next Event failed to get of Live Channel: "+t),e}}async startLiveChannel(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Starting Live Channel: "+t);try{await _startLiveChannel(this.token,this.config.serviceApiUrl,t,e,this.debugMode),_printDatetime("Live Channel started: "+t)}catch(e){throw _printDatetime("Live Channel failed to start: "+t),e}}async startOutputTracking(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Starting Output Tracking for Live Channel: "+t);try{await _startOutputTracking(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Output Tracking started for Live Channel: "+t)}catch(e){throw _printDatetime("Output Tracking failed to start for Live Channel: "+t),e}}async stopLiveChannel(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Stopping Live Channel: "+t);try{await _stopLiveChannel(this.token,this.config.serviceApiUrl,t,e,this.debugMode),_printDatetime("Live Channel stopped: "+t)}catch(e){throw _printDatetime("Live Channel failed to stop: "+t),e}}async updateLiveChannel(e,t,i,a,n,r,o,s,l,d,p,c){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating Live Channel: "+e);try{var h=await _updateLiveChannel(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,c,this.debugMode);return _printDatetime("Live Channel updated: "+e),h}catch(e){throw _printDatetime("Live Channel failed to update"),e}}async createLiveInput(e,t,i,a,n,r,o){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating Live Input: "+e);try{var s=await _createLiveInput(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,this.debugMode);return _printDatetime("Live Input created: "+s.id),s}catch(e){throw _printDatetime("Live Input failed to create"),e}}async deleteLiveInput(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting Live Input: "+t);try{await _deleteLiveInput(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Live Input deleted: "+t)}catch(e){throw _printDatetime("Live Input failed to delete: "+t),e}}async getLiveInput(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting Live Input: "+t);try{var e=await _getLiveInput(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Live Input gotten: "+t),e}catch(e){throw _printDatetime("Live Input failed to get: "+t),e}}async getLiveInputs(){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting Live Inputs");try{var e=await _getLiveInputs(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Live Inputs gotten"),e}catch(e){throw _printDatetime("Live Inputs failed to get"),e}}async updateLiveInput(e,t,i,a,n,r,o,s){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating Live Input: "+e);try{var l=await _updateLiveInput(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,this.debugMode);return _printDatetime("Live Input updated: "+e),l}catch(e){throw _printDatetime("Live Input failed to update"),e}}async cancelBroadcast(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Cancelling broadcast: "+t);try{await _cancelBroadcast(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Broadcast cancelled: "+t)}catch(e){throw _printDatetime("Broadcast failed to cancel: "+t),e}}async cancelSegment(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Cancelling segment: "+t);try{var e=await _cancelSegment(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Segment cancelled: "+t),e}catch(e){throw _printDatetime("Segment failed to cancel: "+t),e}}async completeSegment(t,e,i){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Completing segment: "+t);try{await _completeSegment(this.token,this.config.serviceApiUrl,t,e,i,this.debugMode),_printDatetime("Segment completed: "+t)}catch(e){throw _printDatetime("Segment failed to complete: "+t),e}}async getCompletedSegments(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting completed segments");try{var t=await _getCompletedSegments(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Completed segments gotten"),t}catch(e){throw _printDatetime("Completed segments failed to get"),e}}async getLiveOperator(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting live operator: "+t);try{var e=await _getLiveOperator(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Live operator gotten: "+t),e}catch(e){throw _printDatetime("Live operator failed to get: "+t),e}}async getLiveOperators(){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting live operators");try{var e=await _getLiveOperators(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Live operators gotten"),e}catch(e){throw _printDatetime("Live operators failed to get"),e}}async startBroadcast(e,t,i,a,n,r){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Starting broadcast");try{var o=await _startBroadcast(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,this.debugMode);return _printDatetime("Broadcast started"),o}catch(e){throw _printDatetime("Broadcast failed to start"),e}}async startSegment(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Starting segment: "+t);try{await _startSegment(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Segment started: "+t)}catch(e){throw _printDatetime("Segment failed to start: "+t),e}}async stopBroadcast(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Stopping broadcast");try{await _stopBroadcast(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("Broadcast stopped")}catch(e){throw _printDatetime("Broadcast failed to stop"),e}}async addAssetScheduleEvent(t,e,i,a,n){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Adding asset schedule event to channel: "+t);try{var r=await _addAssetScheduleEvent(this.token,this.config.serviceApiUrl,t,e,i,a,n,this.debugMode);return _printDatetime("Asset schedule event added to channel: "+t),r}catch(e){throw _printDatetime("Asset schedule event failed to add to channel: "+t),e}}async addInputScheduleEvent(t,e,i,a,n){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Adding input schedule event to channel "+t);try{var r=await _addInputScheduleEvent(this.token,this.config.serviceApiUrl,t,e,i,a,n,this.debugMode);return _printDatetime("Input schedule event added to channel "+t),r}catch(e){throw _printDatetime("Input schedule event failed to add to channel "+t),e}}async getAssetScheduleEvent(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting asset schedule event: "+t);try{var i=await _getAssetScheduleEvent(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Asset schedule event gotten: "+t),i}catch(e){throw _printDatetime("Asset schedule event failed to get: "+t),e}}async getInputScheduleEvent(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting asset schedule event: "+t);try{var i=await _getInputScheduleEvent(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Asset schedule event gotten: "+t),i}catch(e){throw _printDatetime("Input schedule event failed to get: "+t),e}}async moveScheduleEvent(t,e,i){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Moving schedule event: "+t);try{var a=await _moveScheduleEvent(this.token,this.config.serviceApiUrl,t,e,i,this.debugMode);return _printDatetime("Schedule event moved: "+t),a}catch(e){throw _printDatetime("Schedule event failed to move: "+t),e}}async removeAssetScheduleEvent(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Removing asset schedule event: "+t);try{await _removeAssetScheduleEvent(this.token,this.config.serviceApiUrl,t,e,this.debugMode),_printDatetime("Asset schedule event removed: "+t)}catch(e){throw _printDatetime("Asset schedule event failed to remove: "+t),e}}async removeInputScheduleEvent(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Removing input schedule event");try{await _removeInputScheduleEvent(this.token,this.config.serviceApiUrl,e,t,this.debugMode),_printDatetime("Input schedule event removed")}catch(e){throw _printDatetime("Input schedule event failed to remove"),e}}async updateAssetScheduleEvent(t,e,i,a,n,r){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating asset schedule event: "+t);try{var o=await _updateAssetScheduleEvent(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,this.debugMode);return _printDatetime("Asset schedule event updated: "+t),o}catch(e){throw _printDatetime("Asset schedule event failed to update: "+t),e}}async updateInputScheduleEvent(e,t,i,a,n,r){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating input schedule event");try{var o=await _updateInputScheduleEvent(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,this.debugMode);return _printDatetime("Input schedule event updated"),o}catch(e){throw _printDatetime("Input schedule event failed to update"),e}}async createLiveOutputProfile(e,t,i,a,n,r,o,s,l,d,p,c,h,u){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating live output profile");try{var f=await _createLiveOutputProfile(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,c,h,u,this.debugMode);return _printDatetime("Live output profile created"),f}catch(e){throw _printDatetime("Live output profile failed to create"),e}}async deleteLiveOutputProfile(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting live output profile");try{await _deleteLiveOutputProfile(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("Live output profile deleted")}catch(e){throw _printDatetime("Live output profile failed to delete"),e}}async getLiveOutputProfile(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting live output profile");try{var t=await _getLiveOutputProfile(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Live output profile gotten"),t}catch(e){throw _printDatetime("Live output profile failed to get"),e}}async getLiveOutputProfiles(){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting live output profiles");try{var e=await _getLiveOutputProfiles(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Live outputs gotten"),e}catch(e){throw _printDatetime("Live output profiles failed to get"),e}}async getLiveOutputTypes(){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting live output types");try{var e=await _getLiveOutputTypes(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Live output types gotten"),e}catch(e){throw _printDatetime("Live output types failed to get"),e}}async updateLiveOutputProfile(e,t,i,a,n,r,o,s,l,d,p,c,h,u,f){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating live output profile");try{var y=await _updateLiveOutputProfile(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,c,h,u,f,this.debugMode);return _printDatetime("Live output updated"),y}catch(e){throw _printDatetime("Live output profile failed to update"),e}}async createLiveOutputProfileGroup(e,t,i,a,n,r,o){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");null===o&&(o=[]),_printDatetime("Creating live output profile group");try{var s=await _createLiveOutputProfileGroup(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,this.debugMode);return _printDatetime("Live output profile group created"),s}catch(e){throw _printDatetime("Live output profile group failed to create"),e}}async deleteLiveOutputProfileGroup(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting live output profile group");try{await _deleteLiveOutputProfileGroup(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("Live output profile group deleted")}catch(e){throw _printDatetime("Live output profile group failed to delete"),e}}async getLiveOutputProfileGroup(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting live output profile group");try{var t=await _getLiveOutputProfileGroup(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Live output profile group gotten"),t}catch(e){throw _printDatetime("Live output profile group failed to get"),e}}async getLiveOutputProfileGroups(){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting live output profile groups");try{var e=await _getLiveOutputProfileGroups(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Live output profile groups gotten"),e}catch(e){throw _printDatetime("Live output profile groups failed to get"),e}}async updateLiveOutputProfileGroup(e,t,i,a,n,r,o,s){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");null===s&&(s=[]),_printDatetime("Updating live output profile group");try{var l=await _updateLiveOutputProfileGroup(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,this.debugMode);return _printDatetime("Live output profile group updated"),l}catch(e){throw _printDatetime("Live output profile group failed to update"),e}}async createIntelligentPlaylist(e,t,i,a,n,r,o,s,l,d){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");null===e&&(e=[]),null===n&&(n=[]),null===l&&(l=[]),_printDatetime("Creating intelligent playlist");try{var p=await _createIntelligentPlaylist(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,this.debugMode);return _printDatetime("Intelligent playlist created"),p}catch(e){throw _printDatetime("Intelligent playlist failed to create"),e}}async createIntelligentSchedule(e,t,i,a){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating intelligent schedule");try{var n=await _createIntelligentSchedule(this.token,this.config.serviceApiUrl,e,t,i,a,this.debugMode);return _printDatetime("Intelligent schedule created"),n}catch(e){throw _printDatetime("Intelligent schedule failed to create"),e}}async createPlaylist(e,t,i,a){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating playlist");try{var n=await _createPlaylist(this.token,this.config.serviceApiUrl,e,t,i,a,this.debugMode);return _printDatetime("Playlist created"),n}catch(e){throw _printDatetime("Playlist failed to create"),e}}async createPlaylistVideo(e,t,i){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating playlist video");try{var a=await _createPlaylistVideo(this.token,this.config.serviceApiUrl,e,t,i,this.debugMode);return _printDatetime("Playlist video created"),a}catch(e){throw _printDatetime("Playlist video failed to create"),e}}async createScheduleItemAsset(e,t,i,a,n,r,o){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating schedule item asset");try{var s=await _createScheduleItemAsset(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,this.debugMode);return _printDatetime("Schedule item asset created"),s}catch(e){throw _printDatetime("Schedule item asset failed to create"),e}}async createScheduleItemLiveChannel(e,t,i,a,n,r,o){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating schedule item live channel");try{var s=await _createScheduleItemLiveChannel(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,this.debugMode);return _printDatetime("Schedule item live channel created"),s}catch(e){throw _printDatetime("Schedule item live channel failed to create"),e}}async createScheduleItemPlaylistSchedule(e,t,i,a,n,r,o){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating schedule item playlist schedule");try{var s=await _createScheduleItemPlaylistSchedule(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,this.debugMode);return _printDatetime("Schedule item playlist schedule created"),s}catch(e){throw _printDatetime("Schedule item playlist schedule failed to create"),e}}async createScheduleItemSearchFilter(e,t,i,a,n,r,o,s,l,d,p,c,h,u){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");null===t&&(t=[]),null===l&&(l=[]),_printDatetime("Creating schedule item search filter");try{var f=await _createScheduleItemSearchFilter(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,c,h,u,this.debugMode);return _printDatetime("Schedule item search filter created"),f}catch(e){throw _printDatetime("Schedule item search filter failed to create"),e}}async deleteIntelligentPlaylist(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting intelligent playlist");try{await _deleteIntelligentPlaylist(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("Intelligent playlist deleted")}catch(e){throw _printDatetime("Intelligent playlist failed to delete"),e}}async deleteIntelligentSchedule(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting intelligent schedule");try{await _deleteIntelligentSchedule(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("Intelligent schedule deleted")}catch(e){throw _printDatetime("Intelligent schedule failed to delete"),e}}async deletePlaylist(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting playlist");try{await _deletePlaylist(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("Playlist deleted")}catch(e){throw _printDatetime("Playlist failed to delete"),e}}async deleteScheduleItem(e,t){null===this.token&&await this._init(),_printDatetime("Deleting schedule item");try{await _deleteScheduleItem(this.token,this.config.serviceApiUrl,e,t,this.debugMode),_printDatetime("Schedule item deleted")}catch(e){throw _printDatetime("Schedule item failed to delete"),e}}async getIntelligentPlaylist(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting intelligent playlist");try{var t=await _getIntelligentPlaylist(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Intelligent playlist gotten"),t}catch(e){throw _printDatetime("Intelligent playlist failed to get"),e}}async getIntelligentSchedule(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting intelligent schedule");try{var t=await _getIntelligentSchedule(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Intelligent schedule gotten"),t}catch(e){throw _printDatetime("Intelligent schedule failed to get"),e}}async getPlaylist(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting playlist");try{var t=await _getPlaylist(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Playlist gotten"),t}catch(e){throw _printDatetime("Playlist failed to get"),e}}async getScheduleItem(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting schedule item");try{var i=await _getScheduleItem(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Schedule item gotten"),i}catch(e){throw _printDatetime("Schedule item failed to get"),e}}async getScheduleItems(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting schedule items");try{var t=await _getScheduleItems(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Schedule items gotten"),t}catch(e){throw _printDatetime("Schedule items failed to get"),e}}async getSchedulePreview(e){null===this.token&&await this._init(),"admin"!==this.config.apiType&&_printDatetime("Getting schedule preview");try{var t=await _getSchedulePreview(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Schedule preview gotten"),t}catch(e){throw _printDatetime("Schedule preview failed to get"),e}}async moveScheduleItem(e,t,i){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Moving schedule item");try{var a=await _moveScheduleItem(this.token,this.config.serviceApiUrl,e,t,i,this.debugMode);return _printDatetime("Schedule item moved"),a}catch(e){throw _printDatetime("Schedule item failed to move"),e}}async publishIntelligentSchedule(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Publishing intelligent schedule");try{var i=await _publishIntelligentSchedule(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Intelligent schedule published"),i}catch(e){throw _printDatetime("Intelligent schedule failed to publish"),e}}async startSchedule(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Starting schedule");try{var i=await _startSchedule(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Schedule started"),i}catch(e){throw _printDatetime("Schedule failed to start"),e}}async stopSchedule(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Stopping schedule");try{var i=await _stopSchedule(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Schedule stopped"),i}catch(e){throw _printDatetime("Schedule failed to stop"),e}}async updateIntelligentPlaylist(e,t,i,a,n,r,o,s,l,d,p){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");null===t&&(t=[]),null===r&&(r=[]),null===d&&(d=[]),_printDatetime("Updating intelligent playlist");try{var c=await _updateIntelligentPlaylist(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,this.debugMode);return _printDatetime("Intelligent playlist updated"),c}catch(e){throw _printDatetime("Intelligent playlist failed to update"),e}}async updateIntelligentSchedule(e,t,i,a,n){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating intelligent schedule");try{var r=await _updateIntelligentSchedule(this.token,this.config.serviceApiUrl,e,t,i,a,n,this.debugMode);return _printDatetime("Intelligent schedule updated"),r}catch(e){throw _printDatetime("Intelligent schedule failed to update"),e}}async updatePlaylist(e,t,i,a,n){null===this.token&&await this._init(),null===t&&(t={}),null===n&&(n={}),_printDatetime("Updating playlist");try{var r=await _updatePlaylist(this.token,this.config.serviceApiUrl,e,t,i,a,n,this.debugMode);return _printDatetime("Playlist updated"),r}catch(e){throw _printDatetime("Playlist failed to update"),e}}async updatePlaylistVideo(e,t,i){null===this.token&&await this._init(),_printDatetime("Updating playlist video");try{var a=await _updatePlaylistVideo(this.token,this.config.serviceApiUrl,e,t,i,this.debugMode);return _printDatetime("Playlist video updated"),a}catch(e){throw _printDatetime("Playlist video failed to update"),e}}async updateScheduleItemAsset(e,t,i,a,n,r,o){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating schedule item asset");try{var s=await _updateScheduleItemAsset(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,this.debugMode);return _printDatetime("Schedule item asset updated"),s}catch(e){throw _printDatetime("Schedule item asset failed to update"),e}}async updateScheduleItemLiveChannel(e,t,i,a,n,r,o){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating schedule item live channel");try{var s=await _updateScheduleItemLiveChannel(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,this.debugMode);return _printDatetime("Schedule item live channel updated"),s}catch(e){throw _printDatetime("Schedule item live channel failed to update"),e}}async updateScheduleItemPlaylistSchedule(e,t,i,a,n,r,o){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating schedule item playlist schedule");try{var s=await _updateScheduleItemPlaylistSchedule(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,this.debugMode);return _printDatetime("Schedule item playlist schedule updated"),s}catch(e){throw _printDatetime("Schedule item playlist schedule failed to update"),e}}async updateScheduleItemSearchFilter(e,t,i,a,n,r,o,s,l,d,p,c,h,u,f){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating schedule item search filter");try{var y=await _updateScheduleItemSearchFilter(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,c,h,u,f,this.debugMode);return _printDatetime("Schedule item search filter updated"),y}catch(e){throw _printDatetime("Schedule item search filter failed to update"),e}}async deleteUser(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");e=e||this.id,_printDatetime("Deleting user");try{await _deleteUser(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("User deleted")}catch(e){throw _printDatetime("User failed to delete"),e}}async deleteUserContentAttributeData(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user content attribute data");try{e=e||this.id,await _deleteUserContentAttributeData(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("User content attribute data deleted")}catch(e){throw _printDatetime("User content attribute data failed to delete"),e}}async deleteUserContentGroupData(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user content group data");try{e=e||this.id,await _deleteUserContentGroupData(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("User content group data deleted")}catch(e){throw _printDatetime("User content group data failed to delete"),e}}async deleteUserContentSecurityData(e,t,i,a,n,r,o){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user content security data");try{a=a||this.id,await _deleteUserContentSecurityData(this.token,this.config.serviceApiUrl,e,t,a,i,n,r,o,this.debugMode),_printDatetime("User content security data deleted")}catch(e){throw _printDatetime("User content security data failed to delete"),e}}async deleteUserData(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user data");try{e=e||this.id,await _deleteUserData(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("User data deleted")}catch(e){throw _printDatetime("User data failed to delete"),e}}async deleteUserDislikesData(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user dislikes data");try{e=e||this.id,await _deleteUserDislikesData(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("User dislikes data deleted")}catch(e){throw _printDatetime("User dislikes data failed to delete"),e}}async deleteUserFavoritesData(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user favorites data");try{e=e||this.id,await _deleteUserFavoritesData(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("User favorites data deleted")}catch(e){throw _printDatetime("User favorites data failed to delete"),e}}async deleteUserLikesData(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user likes data");try{e=e||this.id,await _deleteUserLikesData(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("User likes data deleted")}catch(e){throw _printDatetime("User likes data failed to delete"),e}}async deleteUserSavedSearchData(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user saved search data");try{e=e||this.id,await _deleteUserSavedSearchData(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("User saved search data deleted")}catch(e){throw _printDatetime("User saved search data failed to delete"),e}}async deleteUserSessionData(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user session data");try{e=e||this.id,await _deleteUserSessionData(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("User session data deleted")}catch(e){throw _printDatetime("User session data failed to delete"),e}}async deleteUserVideoTrackingData(e,t,i,a,n,r,o,s,l,d,p,c,h,u,f,y){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user video tracking data");try{a=a||this.id,await _deleteUserVideoTrackingData(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,c,h,u,f,y,this.debugMode),_printDatetime("User video tracking data deleted")}catch(e){throw _printDatetime("User video tracking data failed to delete"),e}}async changeSessionStatus(e,t,i){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Changing session status"),e=e||this.userSessionId;try{var a=await _changeSessionStatus(this.token,this.config.serviceApiUrl,e,t,i,this.debugMode);return _printDatetime("Session status changed"),a}catch(e){throw _printDatetime("Session status failed to change"),e}}async getUserSession(e){null===this.token&&await this._init(),_printDatetime("Getting user session");try{e=e||this.userSessionId;var t=await _getUserSession(this.token,this.config.serviceApiUrl,this.config.apiType,e,this.debugMode);return _printDatetime("User session gotten"),t}catch(e){throw _printDatetime("User session failed to get"),e}}async register(t,e,i,a){_printDatetime("Registering user: "+t);try{var n=await _register(this.config.serviceApiUrl,t,e,i,a,this.debugMode);return _printDatetime("User registered: "+t),n}catch(e){throw _printDatetime("User failed to register: "+t),e}}async resendCode(t){_printDatetime("Resending code: "+t);try{await _resendCode(this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Code resent: "+t)}catch(e){throw _printDatetime("Code failed to resend: "+t),e}}async verify(t,e){_printDatetime("Verifying user: "+t);try{var i=await _verify(this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("User verified: "+t),i}catch(e){throw _printDatetime("User failed to verify: "+t),e}}async archiveAsset(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Archiving asset: "+t);try{var e=await _archiveAsset(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Asset archived: "+t),e}catch(e){throw _printDatetime("Asset failed to archive: "+t),e}}async buildMedia(e,t,i,a,n,r,o,s){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Building media");try{await _buildMedia(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,this.debugMode),_printDatetime("Media built")}catch(e){throw _printDatetime("Media failed to build"),e}}async clipAsset(t,e,i,a,n,r,o,s,l,d){null===this.token&&await this._init(),_printDatetime("Clipping asset: "+t);try{var p=await _clipAsset(this.token,this.config.serviceApiUrl,t,this.config.apiType,e,i,a,n,r,o,s,l,d,this.debugMode);return _printDatetime("Asset clipped: "+t),p}catch(e){throw _printDatetime("Asset failed to clip: "+t),e}}async copyAsset(t,e,i,a,n,r){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Copying asset(s): "+t);try{var o=await _copyAsset(this.token,this.config.serviceApiUrl,t,e,i,a,n,this.id,r,this.debugMode);return _printDatetime("Asset(s) copied: "+t),o}catch(e){throw _printDatetime("Asset failed to copy: "+t),e}}async createAnnotation(e,t,i,a,n,r,o,s,l){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Creating annotation");try{var d={firstKeyword:a,secondKeyword:n,description:r,country:o},p=await _createAnnotation(this.token,this.config.serviceApiUrl,e,t,i,d,s,l,this.debugMode);return _printDatetime("Annotation created"),p}catch(e){throw _printDatetime("Annotation failed to create"),e}}async createAssetAdBreak(e,t,i,a){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating asset ad break");try{var n=await _createAssetAdBreak(this.token,this.config.serviceApiUrl,e,t,i,a,this.debugMode);return _printDatetime("Asset ad break created"),n}catch(e){throw _printDatetime("Asset ad break failed to create"),e}}async createFolderAsset(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating folder asset");try{var i=await _createFolderAsset(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Folder asset created"),i}catch(e){throw _printDatetime("Folder asset failed to create"),e}}async createPlaceholderAsset(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");if(_printDatetime("Creating placeholder asset"),!t.includes("."))throw new Error("The asset name must contain file extension.");try{var i=await _createPlaceholderAsset(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Placeholder asset created"),i}catch(e){throw _printDatetime("Placeholder asset failed to create"),e}}async createScreenshotAtTimecode(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating screenshot at timecode");try{var i=await _createScreenshotAtTimecode(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Screenshot created at timecode"),i}catch(e){throw _printDatetime("Screenshot failed to create at timecode"),e}}async deleteAnnotation(e,t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Deleting annotation");try{await _deleteAnnotation(this.token,this.config.serviceApiUrl,e,t,this.debugMode),_printDatetime("Annotation deleted")}catch(e){throw _printDatetime("Annotation failed to delete"),e}}async deleteAsset(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting asset: "+t);try{await _deleteAsset(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Asset deleted: "+t)}catch(e){throw _printDatetime("Asset failed to delete: "+t),e}}async deleteAssetAdBreak(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting asset ad break");try{await _deleteAssetAdBreak(this.token,this.config.serviceApiUrl,e,t,this.debugMode),_printDatetime("Asset ad break deleted")}catch(e){throw _printDatetime("Asset ad break failed to delete"),e}}async downloadArchiveAsset(e,t,i){null===this.token&&await this._init(),_printDatetime("Downloading archive asset");try{var a=await _downloadArchiveAsset(this.token,this.config.serviceApiUrl,this.config.apiType,e,t,i,this.debugMode);return _printDatetime("Archive asset downloaded"),a}catch(e){throw _printDatetime("Archive asset failed to download"),e}}async duplicateAsset(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Duplicating asset: "+t);try{var e=await _duplicateAsset(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Asset duplicated: "+t),e}catch(e){throw _printDatetime("Asset failed to duplicate: "+t),e}}async getAnnotations(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting annotations for "+t);try{var e=await _getAnnotations(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Annotations retrieved for "+t),e}catch(e){throw _printDatetime("Annotations failed to retrieve for "+t),e}}async getAsset(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting asset for "+t);try{var e=await _getAsset(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Asset retrieved for "+t),e}catch(e){throw _printDatetime("Asset failed to retrieve for "+t),e}}async getAssetAdBreaks(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting asset ad breaks for "+t);try{var e=await _getAssetAdBreaks(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Asset ad breaks retrieved for "+t),e}catch(e){throw _printDatetime("Asset ad breaks failed to retrieve for "+t),e}}async getAssetChildNodes(t,e,i,a,n,r){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting asset child nodes for "+t);try{var o=await _getAssetChildNodes(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,this.debugMode);return _printDatetime("Asset child nodes retrieved for "+t),o}catch(e){throw _printDatetime("Asset child nodes failed to retrieve for "+t),e}}async getAssetDetails(t){null===this.token&&await this._init(),_printDatetime("Getting asset details for "+t);try{var e=await _getAssetDetails(this.token,this.config.serviceApiUrl,t,this.config.apiType,this.debugMode);return _printDatetime("Asset details retrieved for "+t),e}catch(e){throw _printDatetime("Asset details failed to retrieve for "+t),e}}async getAssetManifestWithCookies(t,e){null===this.token&&await this._init(),_printDatetime("Getting asset manifest with cookies for "+t);try{var i=await _getAssetManifestWithCookies(this.token,this.config.serviceApiUrl,t,e,this.config.apiType,this.debugMode);return _printDatetime("Asset manifest with cookies retrieved for "+t),i}catch(e){throw _printDatetime("Asset manifest with cookies failed to retrieve for "+t),e}}async getAssetMetadataSummary(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting asset metadata summary for "+t);try{var e=await _getAssetMetadataSummary(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Asset metadata summary retrieved for "+t),e}catch(e){throw _printDatetime("Asset metadata summary failed to retrieve for "+t),e}}async getAssetParentFolders(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting asset parent folders for "+t);try{var i=await _getAssetParentFolders(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Asset parent folders retrieved for "+t),i}catch(e){throw _printDatetime("Asset parent folders failed to retrieve for "+t),e}}async getAssetScreenshotDetails(t,e,i){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting asset screenshot details for "+t);try{var a=await _getAssetScreenshotDetails(this.token,this.config.serviceApiUrl,t,e,i,this.debugMode);return _printDatetime("Asset screenshot details retrieved for "+t),a}catch(e){throw _printDatetime("Asset screenshot details failed to retrieve for "+t),e}}async getAssetSegmentDetails(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting asset segment details for "+t);try{var i=await _getAssetSegmentDetails(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Asset segment details retrieved for "+t),i}catch(e){throw _printDatetime("Asset segment details failed to retrieve for "+t),e}}async getUserUploadParts(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting user upload parts for "+t);try{var e=await _getUserUploadParts(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("User upload parts retrieved for "+t),e}catch(e){throw _printDatetime("User upload parts failed to retrieve for "+t),e}}async getUserUploads(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting user uploads");try{var t=await _getUserUploads(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("User uploads retrieved"),t}catch(e){throw _printDatetime("User uploads failed to retrieve"),e}}async importAnnotations(e,t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Importing annotations");try{await _importAnnotations(this.token,this.config.serviceApiUrl,e,t,this.debugMode),_printDatetime("Annotations imported")}catch(e){throw _printDatetime("Annotations failed to import"),e}}async indexAsset(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Indexing asset: "+t);try{await _indexAsset(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Asset indexed: "+t)}catch(e){throw _printDatetime("Asset failed to index: "+t),e}}async localRestoreAsset(t,e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Local restoring asset: "+t);try{var i=await _localRestoreAsset(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Asset local restored: "+t),i}catch(e){throw _printDatetime("Asset failed to local restore: "+t),e}}async moveAsset(t,e,i,a,n,r){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Moving asset: "+t);try{var o=await _moveAsset(this.token,this.config.serviceApiUrl,t,e,i,a,n,this.id,r,this.debugMode);return _printDatetime("Asset moved: "+t),o}catch(e){throw _printDatetime("Asset failed to move: "+t),e}}async recordsAssetTrackingBeacon(e,t,i,a,n){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Recording asset tracking beacon");try{await _recordsAssetTrackingBeacon(this.token,this.config.serviceApiUrl,e,t,i,a,n,this.debugMode),_printDatetime("Asset tracking beacon recorded")}catch(e){throw _printDatetime("Asset tracking beacon failed to record"),e}}async registerAsset(t,e,i,a,n,r,o,s,l,d,p,c,h,u,f,y,w,g,m){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Registering asset: "+t);try{var v=await _registerAsset(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,o,s,l,d,p,c,h,u,f,y,w,g,m,this.debugMode);return _printDatetime("Asset registered: "+t),v}catch(e){throw _printDatetime("Asset failed to register: "+t),e}}async reprocessAsset(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Reprocessing asset");try{var t=await _reprocessAsset(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Asset reprocessed"),t}catch(e){throw _printDatetime("Asset failed to reprocess"),e}}async restoreAsset(t){null===this.token&&await this._init(),_printDatetime("Restoring asset: "+t);try{await _restoreAsset(this.token,this.config.serviceApiUrl,t,this.config.apiType,this.debugMode),_printDatetime("Asset restored: "+t)}catch(e){throw _printDatetime("Asset failed to restore: "+t),e}}async shareAsset(t,e,i,a){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Sharing asset: "+t);try{var n=await _shareAsset(this.token,this.config.serviceApiUrl,t,e,i,a,this.debugMode);return _printDatetime("Asset shared: "+t),n}catch(e){throw _printDatetime("Asset failed to share: "+t),e}}async startWorkflow(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Starting workflow");try{var i=await _startWorkflow(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Workflow started"),i}catch(e){throw _printDatetime("Workflow failed to start"),e}}async transcribeAsset(t,e,i){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Transcribing asset: "+t);try{await _transcribeAsset(this.token,this.config.serviceApiUrl,t,e,i,this.debugMode),_printDatetime("Asset transcribed: "+t)}catch(e){throw _printDatetime("Asset failed to transcribe: "+t),e}}async updateAnnotation(e,t,i,a,n,r,o,s,l,d){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Updating annotation");try{var p=await _updateAnnotation(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,this.debugMode);return _printDatetime("Annotation updated"),p}catch(e){throw _printDatetime("Annotation failed to update"),e}}async updateAsset(e,t,i,a,n,r){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating asset");try{await _updateAsset(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,this.debugMode),_printDatetime("Asset updated")}catch(e){throw _printDatetime("Asset failed to update"),e}}async updateAssetAdBreak(e,t,i,a,n){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating asset ad break");try{var r=await _updateAssetAdBreak(this.token,this.config.serviceApiUrl,e,t,i,a,n,this.debugMode);return _printDatetime("Asset ad break updated"),r}catch(e){throw _printDatetime("Asset ad break failed to update"),e}}async updateAssetLanguage(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating asset language");try{await _updateAssetLanguage(this.token,this.config.serviceApiUrl,e,t,this.debugMode),_printDatetime("Asset language updated")}catch(e){throw _printDatetime("Asset language failed to update"),e}}async ping(e,t){null===this.token&&await this._init(),_printDatetime("Pinging user");try{var i=await _ping(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("User pinged"),i}catch(e){throw _printDatetime("User failed to ping"),e}}async pingAuth(e,t){null===this.token&&await this._init(),_printDatetime("Pinging user");try{var i=await _pingAuth(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("User pinged"),i}catch(e){throw _printDatetime("User failed to ping"),e}}async search(e,t,i,a,n,r,o,s,l,d){null===this.token&&await this._init(),_printDatetime("Searching...");try{var p=await _search(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,this.config.apiType,this.debugMode);return _printDatetime("Search complete"),!!p.hasItems&&p}catch(e){throw _printDatetime("Search failed"),e}}async changeEmail(t,e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Changing email: "+t);try{await _changeEmail(this.token,this.config.serviceApiUrl,t,this.config.password,this.debugMode),_printDatetime("Email changed: "+t)}catch(e){throw _printDatetime("Email failed to change: "+t),e}}async changePassword(e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Changing password");try{await _changePassword(this.token,this.config.serviceApiUrl,this.config.password,e,this.debugMode),_printDatetime("Password changed")}catch(e){throw _printDatetime("Password failed to change"),e}}async getUser(){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting user");try{var e=await _getUser(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("User gotten"),e}catch(e){throw _printDatetime("User failed to get"),e}}async updateUser(e,t,i,a,n,r,o,s,l,d,p){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Updating user");try{var c=await _updateUser(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,this.debugMode);return _printDatetime("User updated"),c}catch(e){throw _printDatetime("User failed to update"),e}}async addContentsToContentGroup(t,e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Adding content to content group: "+t);try{var i=await _addContentsToContentGroup(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Content added to content group: "+t),i}catch(e){throw _printDatetime("Content failed to add to content group: "+t),e}}async createContentGroup(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Creating content group: "+t);try{var e=await _createContentGroup(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Content group created: "+t),e}catch(e){throw _printDatetime("Content group failed to create: "+t),e}}async deleteContentGroup(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Deleting content group: "+t);try{var e=await _deleteContentGroup(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Content group deleted: "+t),e}catch(e){throw _printDatetime("Content group failed to delete: "+t),e}}async getContentGroup(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting content group: "+t);try{var e=await _getContentGroup(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Content group gotten: "+t),e}catch(e){throw _printDatetime("Content group failed to get: "+t),e}}async getContentGroups(){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting content groups");try{var e=await _getContentGroups(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Content groups gotten"),e}catch(e){throw _printDatetime("Content groups failed to get"),e}}async getPortalGroups(e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting portal groups");try{var t=await _getPortalGroups(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Portal groups gotten"),t}catch(e){throw _printDatetime("Portal groups failed to get"),e}}async removeContentsFromContentGroup(t,e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Removing content from content group: "+t);try{var i=await _removeContentsFromContentGroup(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Content removed from content group: "+t),i}catch(e){throw _printDatetime("Content failed to remove from content group: "+t),e}}async renameContentGroup(t,e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Renaming content group: "+t);try{var i=await _renameContentGroup(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Content group renamed: "+t),i}catch(e){throw _printDatetime("Content group failed to rename: "+t),e}}async shareContentGroupWithUsers(t,e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Sharing content group with users: "+t);try{var i=await _shareContentGroupWithUsers(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Content group shared with users: "+t),i}catch(e){throw _printDatetime("Content group failed to share with users: "+t),e}}async stopSharingContentGroupWithUsers(t,e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Stopping sharing content group with users: "+t);try{var i=await _stopSharingContentGroupWithUsers(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Content group stopped sharing with users: "+t),i}catch(e){throw _printDatetime("Content group failed to stop sharing with users: "+t),e}}async clearContinueWatching(e,t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Clearing continue watching");try{await _clearContinueWatching(this.token,this.config.serviceApiUrl,e,t,this.debugMode),_printDatetime("Continue watching cleared")}catch(e){throw _printDatetime("Continue watching failed to clear"),e}}async clearWatchlist(e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Clearing watchlist");try{e=e||this.id,await _clearWatchlist(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("Watchlist cleared")}catch(e){throw _printDatetime("Watchlist failed to clear"),e}}async createForm(e,t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Creating form");try{var i=await _createForm(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Form created"),i}catch(e){throw _printDatetime("Form failed to create"),e}}async getContentCookies(e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting content cookies");try{var t=await _getContentCookies(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Content cookies gotten"),t}catch(e){throw _printDatetime("Content cookies failed to get"),e}}async getDefaultSiteConfig(){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting default site config");try{var e=await _getDefaultSiteConfig(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Default site config gotten"),e}catch(e){throw _printDatetime("Default site config failed to get"),e}}async getDynamicContent(t){null===this.token&&await this._init(),_printDatetime("Getting dynamic content: "+t);try{var e=await _getDynamicContent(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Dynamic content gotten: "+t),e}catch(e){throw _printDatetime("Dynamic content failed to get: "+t),e}}async getDynamicContents(){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting dynamic contents");try{var e=await _getDynamicContents(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Dynamic contents gotten"),e}catch(e){throw _printDatetime("Dynamic contents failed to get"),e}}async getMediaGroup(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting media group: "+t);try{var e=await _getMediaGroup(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Media group gotten: "+t),e}catch(e){throw _printDatetime("Media group failed to get: "+t),e}}async getMediaItem(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting media item: "+t);try{var e=await _getMediaItem(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Media item gotten: "+t),e}catch(e){throw _printDatetime("Media item failed to get: "+t),e}}async getMyContent(){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is not available for portal API type.");_printDatetime("Getting my content");try{var e=await _getMyContent(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("My content gotten"),e}catch(e){throw _printDatetime("My content failed to get"),e}}async getMyGroup(t){null===this.token&&await this._init(),_printDatetime("Getting my group: "+t);try{var e=await _getMyGroup(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("My group gotten: "+t),e}catch(e){throw _printDatetime("My group failed to get: "+t),e}}async getSiteConfig(t){null===this.token&&await this._init(),_printDatetime("Getting site config: "+t);try{var e=await _getSiteConfig(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Site config gotten: "+t),e}catch(e){throw _printDatetime("Site config failed to get: "+t),e}}async mediaSearch(e,t,i,a,n){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Searching media...");try{var r=await _mediaSearch(this.token,this.config.serviceApiUrl,e,t,i,a,n,this.debugMode);return _printDatetime("Media search complete"),r}catch(e){throw _printDatetime("Media search failed"),e}}async createMediaBuilder(e,t,i,a,n,r){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Creating media builder");try{var o=await _createMediaBuilder(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,this.debugMode);return _printDatetime("Media builder created"),o}catch(e){throw _printDatetime("Media builder failed to create"),e}}async createMediaBuilderItem(e,t,i,a,n,r){null===this.token&&await this._init(),_printDatetime("Creating media builder item");try{var o=await _createMediaBuilderItem(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,this.debugMode);return _printDatetime("Media builder item created"),o}catch(e){throw _printDatetime("Media builder item failed to create"),e}}async createMediaBuilderItemsAddAnnotations(e,t){null===this.token&&await this._init(),_printDatetime("Creating media builder item and adding annotations");try{var i=await _createMediaBuilderItemsAddAnnotations(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Media builder item created and annotations added"),i}catch(e){throw _printDatetime("Media builder item failed to create and annotations failed to add"),e}}async createMediaBuilderItemsBulk(e,t){null===this.token&&await this._init(),_printDatetime("Creating media builder items");try{var i=await _createMediaBuilderItemsBulk(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Media builder items created"),i}catch(e){throw _printDatetime("Media builder items failed to create"),e}}async deleteMediaBuilder(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Deleting media builder: "+t);try{await _deleteMediaBuilder(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Media builder deleted: "+t)}catch(e){throw _printDatetime("Media builder failed to delete: "+t),e}}async deleteMediaBuilderItem(e,t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Deleting media builder item: "+t);try{await _deleteMediaBuilderItem(this.token,this.config.serviceApiUrl,e,t,this.debugMode),_printDatetime("Media builder item deleted: "+t)}catch(e){throw _printDatetime("Media builder item failed to delete: "+t),e}}async duplicateMediaBuilder(t,e,i,a,n,r){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Duplicating media builder: "+t);try{var o=await _duplicateMediaBuilder(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,this.debugMode);return _printDatetime("Media builder duplicated: "+t),o}catch(e){throw _printDatetime("Media builder failed to duplicate: "+t),e}}async getMediaBuilder(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting media builder: "+t);try{var e=await _getMediaBuilder(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Media builder gotten: "+t),e}catch(e){throw _printDatetime("Media builder failed to get: "+t),e}}async getMediaBuilderIdsFromAsset(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting media builder ids from asset: "+t);try{var e=await _getMediaBuilderIdsFromAsset(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Media builder ids from asset gotten: "+t),e}catch(e){throw _printDatetime("Media builder ids from asset failed to get: "+t),e}}async getMediaBuilders(){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting media builders");try{var e=await _getMediaBuilders(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Media builders gotten"),e}catch(e){throw _printDatetime("Media builders failed to get"),e}}async getMediaBuilderItems(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting media builder items: "+t);try{var e=await _getMediaBuilderItems(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Media builder items gotten: "+t),e}catch(e){throw _printDatetime("Media builder items failed to get: "+t),e}}async moveMediaBuilderItem(t,e,i){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Moving media builder: "+t);try{await _moveMediaBuilderItem(this.token,this.config.serviceApiUrl,t,e,i,this.debugMode),_printDatetime("Media builder moved: "+t)}catch(e){throw _printDatetime("Media builder failed to move: "+t),e}}async renderMediaBuilder(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Rendering media builder: "+t);try{var e=await _renderMediaBuilder(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Media builder rendered: "+t),e}catch(e){throw _printDatetime("Media builder failed to render: "+t),e}}async updateMediaBuilder(t,e,i,a,n,r){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Updating media builder: "+t);try{var o=await _updateMediaBuilder(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,this.debugMode);return _printDatetime("Media builder updated: "+t),o}catch(e){throw _printDatetime("Media builder failed to update: "+t),e}}async guestInvite(t,e,i,a,n){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Inviting guest");try{var r=await _guestInvite(this.token,this.config.serviceApiUrl,t,e,i,a,n,this.debugMode);return _printDatetime("Guest invited"),r}catch(e){throw _printDatetime("Guest failed to invite: "+t),e}}async registerGuest(t,e,i,a){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Registering guest: "+t);try{var n=await _registerGuest(this.token,this.config.serviceApiUrl,t,e,i,a,this.debugMode);return _printDatetime("Guest registered: "+t),n}catch(e){throw _printDatetime("Guest failed to register: "+t),e}}async removeGuest(t,e,i,a,n){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Removing guest");try{var r=await _removeGuest(this.token,this.config.serviceApiUrl,t,e,i,a,n,this.debugMode);return _printDatetime("Guest removed"),r}catch(e){throw _printDatetime("Guest failed to remove: "+t),e}}async addSavedSearch(e,t,i,a,n,r,o,s,l,d,p,c,h,u,f,y){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Adding saved search");try{var w=await _addSavedSearch(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,c,h,u,f,y,this.debugMode);return _printDatetime("Saved search added"),w}catch(e){throw _printDatetime("Saved search failed to add"),e}}async deleteSavedSearch(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Deleting saved search: "+t);try{await _deleteSavedSearch(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Saved search deleted: "+t)}catch(e){throw _printDatetime("Saved search failed to delete: "+t),e}}async getSavedSearch(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting saved search: "+t);try{var e=await _getSavedSearch(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Saved search gotten: "+t),e}catch(e){throw _printDatetime("Saved search failed to get: "+t),e}}async getSavedSearches(){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting saved searches");try{var e=await _getSavedSearches(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Saved searches gotten"),e}catch(e){throw _printDatetime("Saved searches failed to get"),e}}async getSearchSaved(e,t,i,a,n,r,o,s,l,d){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting search saved");try{var p=await _getSearchSaved(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,this.debugMode);return _printDatetime("Search saved gotten"),p}catch(e){throw _printDatetime("Search saved failed to get"),e}}async getSearchSavedById(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting search saved by ID: "+t);try{var e=await _getSearchSavedById(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Search saved by ID gotten: "+t),e}catch(e){throw _printDatetime("Search saved by ID failed to get: "+t),e}}async patchSavedSearch(t,e,i,a,n,r){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Patching saved search: "+t);try{var o=await _patchSavedSearch(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,this.debugMode);return _printDatetime("Saved search patched: "+t),o}catch(e){throw _printDatetime("Saved search failed to patch: "+t),e}}async updateSavedSearch(t,e,i,a,n,r,o,s,l,d,p,c,h,u,f,y,w){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Updating saved search: "+t);try{var g=await _updateSavedSearch(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,o,s,l,d,p,c,h,u,f,y,w,this.debugMode);return _printDatetime("Saved search updated: "+t),g}catch(e){throw _printDatetime("Saved search failed to update: "+t),e}}async getVideoTracking(t,e,i){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting video tracking: "+t);try{await _getVideoTracking(this.token,this.config.serviceApiUrl,t,e,i,this.debugMode),_printDatetime("Video tracking gotten: "+t)}catch(e){throw _printDatetime("Video tracking failed to get: "+t),e}}async miscFunctions(t,i,a,n){null===this.token&&await this._init(),_printDatetime("Calling function: "+t);try{let e=this.config.serviceApiUrl+"/"+t;n&&(e=(e=(e=e.replace("/api","")).replace("app-api.","")).replace("admin-app.",""));var r=new Headers,o=(r.append("Content-Type","application/json"),r.append("Authorization","Bearer "+this.token),this.debugMode&&(console.log(`URL: ${e}
|
|
2
2
|
METHOD: `+i),a)&&console.log("BODY: "+JSON.stringify(a,null,4)),{method:i,headers:r}),s=(a&&(o.body=JSON.stringify(a)),await fetch(e,o));if(s.ok)return await s.json();throw await s.json()}catch(e){_apiExceptionHandler(e,"API call failed")}}}export default NomadMediaSDK;async function _cancelUpload(e,t,i,a){t+=`/api/asset/upload/${i}/cancel`,i=new Headers;i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
|
|
3
3
|
METHOD: POST`);try{var n=await fetch(t,{method:"POST",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Cancel asset upload failed")}}const MAX_CONCURRENT_PROMISES=8;async function _multiThreadUpload(a,n,r,e,o){var t=e.parts;const s=t.length;for(let e=0;e<s;e+=MAX_CONCURRENT_PROMISES){var i=t.slice(e,e+MAX_CONCURRENT_PROMISES).map(async(e,t)=>{console.log(`Uploading part ${t+1} of ${s}...`);var i=await _uploadPart(r,e,o);await _uploadPartComplete(a,n,e.id,i,o),console.log(`Uploaded part ${t+1} of ${s} successfully`)});await Promise.all(i)}}async function _startUpload(e,t,i,a,n,r,o,s,l,d){var t=t+"/api/asset/upload/start",p=new Headers,e=(p.append("Content-Type","application/json"),p.append("Authorization","Bearer "+e),{displayName:i||o.originalname,contentLength:o.size,uploadOverwriteOption:r,relativePath:o.originalname,parentId:s,chunkSize:8388608,relatedContentId:n,languageId:l,existingAssetId:a});d&&console.log(`URL: ${t}
|
|
4
4
|
METHOD: POST
|
|
@@ -12,13 +12,15 @@ METHOD: PUT`),await fetch(i.url,{method:"PUT",headers:o,body:r}));if(s.ok)return
|
|
|
12
12
|
METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Audit Failed")}}async function _clearServerCache(e,t,i){var t=t+"/api/config/clearServerCache",a=new Headers;a.append("Content-Type","application/json"),a.append("Authorization","Bearer "+e),i&&console.log(`URL: ${t}
|
|
13
13
|
METHOD: POST`);try{var n=await fetch(t,{method:"POST",headers:a});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Clear Server Cache Failed")}}async function _getConfig(e,t,i,a){t=t+"/api/config?configType="+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
|
|
14
14
|
METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Config Failed")}}async function _getServerTime(e,t,i){var t=t+"/api/config/serverTime",a=new Headers;a.append("Content-Type","application/json"),a.append("Authorization","Bearer "+e),i&&console.log(`URL: ${t}
|
|
15
|
-
METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:a});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Server Time Failed")}}async function
|
|
15
|
+
METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:a});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Server Time Failed")}}async function _getContentDefinition(e,t,i,a){t=t+"/contentDefinition/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`API_URL: ${t}
|
|
16
|
+
METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Content Definition failed")}}async function _getContentDefinitions(e,t,i,a,n,r,o,s){var l=new URLSearchParams,i=(i&&l.append("contentManagementType",i),a&&l.append("sortColumn",a),n&&l.append("isDesc",n),r&&l.append("pageIndex",r),o&&l.append("pageSize",o),t+"/contentDefinition?"+l.toString()),a=new Headers;a.append("Content-Type","application/json"),a.append("Authorization","Bearer "+e),s&&console.log(`API_URL: ${i}
|
|
17
|
+
METHOD: GET`);try{var d=await fetch(i,{method:"GET",headers:a});if(d.ok)return await d.json();throw await d.json()}catch(e){_apiExceptionHandler(e,"Get Content Definitions failed")}}async function _createContent(e,t,i,a,n){let r=t+"/api/content/new?contentDefinitionId="+i;t=new Headers;t.append("Content-Type","application/json"),t.append("Authorization","Bearer "+e),a&&(r+="&language="+a),n&&console.log(`URL: ${r}
|
|
16
18
|
METHOD: GET`);try{var o=await fetch(r,{method:"GET",headers:t});if(o.ok)return await o.json();throw await o.json()}catch(e){_apiExceptionHandler(e,"Create Content Failed")}}async function _deactivateContentUserTrack(e,t,i,a,n,r,o){t=t+`/api/content/${n}/user-track/${a}/${i}/`+r,n=new Headers;n.append("Content-Type","application/json"),n.append("Authorization","Bearer "+e),o&&console.log(`URL: ${t}
|
|
17
19
|
METHOD: POST`);try{var s=await fetch(t,{method:"POST",headers:n});if(!s.ok)throw await s.json()}catch(e){_apiExceptionHandler(e,"Deactivate User Track Failed")}}async function _deleteContent(e,t,i,a,n){t=t+`/api/content/${i}?contentDefinitionId=`+a,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e);try{n&&console.log(`URL: ${t}
|
|
18
20
|
METHOD: DELETE`);var r=await fetch(t,{method:"DELETE",headers:i});if(!r.ok)throw await r.json()}catch(e){_apiExceptionHandler(e,"Delete Content Failed")}}async function _getContentUserTrackTouch(e,t,i,a,n){t+=`/api/content/${a}/user-track/${i}/touch`,a=new Headers;a.append("Content-Type","application/json"),a.append("Authorization","Bearer "+e),n&&console.log(`URL: ${t}
|
|
19
21
|
METHOD: GET`);try{var r=await fetch(t,{method:"GET",headers:a});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Get Content User Track Touch Failed")}}async function _getContentUserTrack(e,t,i,a,n,r,o,s,l){t=new URL(t+`/content/${a}/user-track/`+i),a=new URLSearchParams,a.append("sortColumn",n),a.append("isDesc",r),a.append("pageIndex",o),a.append("sizeIndex",s),t.search=a.toString(),i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),l&&console.log(`URL: ${t}
|
|
20
22
|
METHOD: GET`);try{var d=await fetch(t,{method:"GET",headers:i});if(d.ok)return await d.json();throw await d.json()}catch(e){_apiExceptionHandler(e,"Get Content User Track Failed")}}async function _getContent(e,t,i,a,n,r){let o=t+`/api/content/${i}?contentDefinitionId=`+a;null!=n&&(o+="&isRevision="+n);t=new Headers;t.append("Authorization","Bearer "+e),t.append("Content-Type","application/json"),r&&console.log(`URL: ${o}
|
|
21
|
-
METHOD: GET`);try{var s=await fetch(o,{method:"GET",headers:t});if(s.ok)return await s.json();throw await s.json()}catch(e){_apiExceptionHandler(e,"Get Content Failed")}}import deepEqual from"deep-equal";async function _updateContent(e,t,i,a,n,r,o){var s=t+"/api/content/"+i,l=new Headers;l.append("Content-Type","application/json"),l.append("Authorization","Bearer "+e);let d=null;try{(d=await _getContent(e,t,i,a,null,o)).contentDefinitionId!==a&&(d.contentDefinitionId=a),d.contentId!==i&&(d.contentId=i),d.
|
|
23
|
+
METHOD: GET`);try{var s=await fetch(o,{method:"GET",headers:t});if(s.ok)return await s.json();throw await s.json()}catch(e){_apiExceptionHandler(e,"Get Content Failed")}}import deepEqual from"deep-equal";async function _updateContent(e,t,i,a,n,r,o){var s=t+"/api/content/"+i,l=new Headers;l.append("Content-Type","application/json"),l.append("Authorization","Bearer "+e);let d=null;try{(d=await _getContent(e,t,i,a,null,o)).contentDefinitionId!==a&&(d.contentDefinitionId=a),d.contentId!==i&&(d.contentId=i),d.language!==r&&(d.language=r),_updateProperties(d,n)}catch(e){d={contentDefinitionId:a,contentId:i,languageId:r,properties:n}}o&&console.log(`URL: ${s}
|
|
22
24
|
METHOD: PUT
|
|
23
25
|
BODY: `+JSON.stringify(d,null,4));try{var p=await fetch(s,{method:"PUT",headers:l,body:JSON.stringify(d)});if(p.ok)return await p.json();throw await p.json()}catch(e){_apiExceptionHandler(e,"Update Content Failed")}}function _updateProperties(t,i){for(const a in i)if(Array.isArray(i[a]))for(let e=0;e<i[a].length;++e)deepEqual(t.properties[a][e],i[a][e])||(t.properties[a][e]=i[a][e]);else"object"==typeof i[a]?deepEqual(t.properties[a],i[a])||(t.properties[a]=i[a]):t.properties[a]!==i[a]&&(t.properties[a]=i[a])}async function _addLiveScheduleToEvent(e,t,i,a,n,r,o,s,l,d,p,c,h,u){var t=t+"/api/admin/liveSchedule",f=new Headers,e=(f.append("Content-Type","application/json"),f.append("Authorization","Bearer "+e),{contentId:i,slateVideo:null!==a?a:"",prerollVideo:null!==n?n:"",postrollVideo:null!==r?r:"",isSecureOutput:null!==o?o:"",archiveFolderAsset:null!==s?s:"",primaryLiveInput:null!==l?l:"",backupLiveInput:null!==d?d:"",primaryLivestreamInputUrl:null!==p?p:"",backupLivestreamInputUrl:null!==c?c:"",externalOutputProfiles:null!==h?h:""});u&&console.log(`URL: ${t}
|
|
24
26
|
METHOD: POST
|