@nomad-media/public 1.1.14 → 1.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -40,6 +40,10 @@ To initialize the sdk, call the NomadMediaSDK class as shown below:
40
40
  const SDK = NomadMediaSDK(config);
41
41
  ```
42
42
 
43
+ ## Logging in
44
+
45
+ To log in to the sdk, in the config, enter the username/email of your user. Then enter your api key if you are using an api key, or your password.
46
+
43
47
  ## Configure Environmental Variables
44
48
 
45
49
  Follow this format for the config:
@@ -48,6 +52,7 @@ Follow this format for the config:
48
52
  const config = {
49
53
  "username": "username",
50
54
  "password": "password",
55
+ "apiKey": "apiKey",
51
56
  "serviceApiUrl": "serverApiUrl",
52
57
  "apiType": "admin",
53
58
  "debugMode": true,
@@ -317,7 +317,10 @@ class NomadMediaSDK {
317
317
  */
318
318
  async _init()
319
319
  {
320
- await this.login();
320
+ if (this.config.username && this.config.password)
321
+ {
322
+ await this.login();
323
+ }
321
324
  }
322
325
 
323
326
  // account functions
@@ -1258,6 +1261,7 @@ async function _sendRequest(instance, FUNCTION_NAME, URL, METHOD_TYPE, PARAMS, B
1258
1261
  };
1259
1262
 
1260
1263
  if (instance.token) HEADERS["Authorization"] = `Bearer ${instance.token}`;
1264
+ else if (instance.config.apiKey) HEADERS["Authorization"] = `ApiKey ${instance.config.apiKey}`;
1261
1265
 
1262
1266
  if (instance.debug && FUNCTION_NAME !== "Login") console.log(`URL: ${URL}\nMETHOD: ${METHOD_TYPE}` + (PARAMS && PARAMS.size === 0 ? `\nPARAMS: ${JSON.stringify(PARAMS, null, 4)}` : "") + (BODY ? `\nBODY: ${JSON.stringify(BODY, null, 4)}` : ""));
1263
1267
 
@@ -1,6 +1,6 @@
1
- class NomadMediaSDK{constructor(t={}){return NomadMediaSDK.instance||(this.config=t,this.token=null,this.refreshTokenVal=null,this.expirationSeconds=null,this.userSessionId=null,this.id=null,this.debug=t.debugMode||!1,"/"===this.config.serviceApiUrl[this.config.serviceApiUrl.length-1]&&(this.config.serviceApiUrl=this.config.serviceApiUrl.slice(0,-1)),this.config.singleton&&(NomadMediaSDK.instance=this),this)}async _init(){await this.login()}async login(){_printDatetime("Logging in as "+this.config.username);try{var t=await _login(this);if(!t)throw new Error("Login failed");this.token=t.token,this.refreshTokenVal=t.refreshToken,this.expirationSeconds=t.expirationSeconds,this.userSessionId=t.userSessionId,this.id=t.id,_printDatetime("Login successful")}catch(t){throw _printDatetime("Login failed"),t}}async logout(){null===this.token&&this.config.username&&await this._init(),_printDatetime("Logging out");try{await _logout(this),this.token=null,this.refreshTokenVal=null,this.expirationSeconds=null,this.userSessionId=null,this.id=null,_printDatetime("Logout successful")}catch(t){throw _printDatetime("Logout failed"),t}}async refreshToken(){_printDatetime("Refreshing token"),null===this.token&&this.config.username&&await this._init();try{await _refreshToken(this)&&_printDatetime("Token refresh successful")}catch(t){throw _printDatetime("Token refresh failed"),t}}async forgotPassword(){var e=this.config.username;_printDatetime("Sending code to "+e);try{await _forgotPassword(this),_printDatetime("Code sent to "+e)}catch(t){throw _printDatetime("Code failed to send to "+e),t}}async resetPassword(t,e){var i=this.config.username;_printDatetime("Resetting password for "+i);try{await _resetPassword(this,t,e),_printDatetime("Password reset for "+i)}catch(t){throw _printDatetime("Password failed to reset for "+i),t}}async clearContinueWatching(t,e){if(null===this.token&&this.config.username&&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,t,e),_printDatetime("Continue watching cleared")}catch(t){throw _printDatetime("Continue watching failed to clear"),t}}async clearWatchlist(t){if(null===this.token&&this.config.username&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Clearing watchlist");try{await _clearWatchlist(this,t=t||this.id),_printDatetime("Watchlist cleared")}catch(t){throw _printDatetime("Watchlist failed to clear"),t}}async createForm(t,e){if(null===this.token&&this.config.username&&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,t,e);return i&&_printDatetime("Form created"),i}catch(t){throw _printDatetime("Form failed to create"),t}}async getContentCookies(t){if(null===this.token&&this.config.username&&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 e=await _getContentCookies(this,t);return e&&_printDatetime("Content cookies gotten"),e}catch(t){throw _printDatetime("Content cookies failed to get"),t}}async getDefaultSiteConfig(){if(null===this.token&&this.config.username&&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 t=await _getDefaultSiteConfig(this);return t&&_printDatetime("Default site config gotten"),t}catch(t){throw _printDatetime("Default site config failed to get"),t}}async getDynamicContent(e){null===this.token&&this.config.username&&await this._init(),_printDatetime("Getting dynamic content: "+e);try{var t=await _getDynamicContent(this,e);return t&&_printDatetime("Dynamic content gotten: "+e),t}catch(t){throw _printDatetime("Dynamic content failed to get: "+e),t}}async getDynamicContents(){if(null===this.token&&this.config.username&&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 t=await _getDynamicContents(this);return t&&_printDatetime("Dynamic contents gotten"),t}catch(t){throw _printDatetime("Dynamic contents failed to get"),t}}async getMediaGroup(e,t){if(null===this.token&&this.config.username&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting media group: "+e);try{var i=await _getMediaGroup(this,e,t);return i&&_printDatetime("Media group gotten: "+e),i}catch(t){throw _printDatetime("Media group failed to get: "+e),t}}async getMediaItem(e){if(null===this.token&&this.config.username&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting media item: "+e);try{var t=await _getMediaItem(this,e);return t&&_printDatetime("Media item gotten: "+e),t}catch(t){throw _printDatetime("Media item failed to get: "+e),t}}async getMyContent(){if(null===this.token&&this.config.username&&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 t=await _getMyContent(this);return t&&_printDatetime("My content gotten"),t}catch(t){throw _printDatetime("My content failed to get"),t}}async getMyGroup(e){null===this.token&&this.config.username&&await this._init(),_printDatetime("Getting my group: "+e);try{var t=await _getMyGroup(this,e);return t&&_printDatetime("My group gotten: "+e),t}catch(t){throw _printDatetime("My group failed to get: "+e),t}}async getSiteConfig(e){null===this.token&&this.config.username&&await this._init(),_printDatetime("Getting site config: "+e);try{var t=await _getSiteConfig(this,e);return t&&_printDatetime("Site config gotten: "+e),t}catch(t){throw _printDatetime("Site config failed to get: "+e),t}}async mediaSearch(t,e,i,n,r){if(null===this.token&&this.config.username&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Searching media...");try{var a=await _mediaSearch(this,t,e,i,n,r);return a&&_printDatetime("Media search complete"),a}catch(t){throw _printDatetime("Media search failed"),t}}async miscFunctions(e,i,n,r){null===this.token&&this.config.username&&await this._init(),_printDatetime("Calling function: "+e);try{let t=this.config.serviceApiUrl+"/"+e;r&&(t=(t=(t=t.replace("/api","")).replace("app-api.","")).replace("admin-app.",""));var a=new Headers,o=(a.append("Content-Type","application/json"),null!==this.token&&a.append("Authorization","Bearer "+this.token),this.debug&&console.log(`URL: ${t}
1
+ class NomadMediaSDK{constructor(t={}){return NomadMediaSDK.instance||(this.config=t,this.token=null,this.refreshTokenVal=null,this.expirationSeconds=null,this.userSessionId=null,this.id=null,this.debug=t.debugMode||!1,"/"===this.config.serviceApiUrl[this.config.serviceApiUrl.length-1]&&(this.config.serviceApiUrl=this.config.serviceApiUrl.slice(0,-1)),this.config.singleton&&(NomadMediaSDK.instance=this),this)}async _init(){this.config.username&&this.config.password&&await this.login()}async login(){_printDatetime("Logging in as "+this.config.username);try{var t=await _login(this);if(!t)throw new Error("Login failed");this.token=t.token,this.refreshTokenVal=t.refreshToken,this.expirationSeconds=t.expirationSeconds,this.userSessionId=t.userSessionId,this.id=t.id,_printDatetime("Login successful")}catch(t){throw _printDatetime("Login failed"),t}}async logout(){null===this.token&&this.config.username&&await this._init(),_printDatetime("Logging out");try{await _logout(this),this.token=null,this.refreshTokenVal=null,this.expirationSeconds=null,this.userSessionId=null,this.id=null,_printDatetime("Logout successful")}catch(t){throw _printDatetime("Logout failed"),t}}async refreshToken(){_printDatetime("Refreshing token"),null===this.token&&this.config.username&&await this._init();try{await _refreshToken(this)&&_printDatetime("Token refresh successful")}catch(t){throw _printDatetime("Token refresh failed"),t}}async forgotPassword(){var e=this.config.username;_printDatetime("Sending code to "+e);try{await _forgotPassword(this),_printDatetime("Code sent to "+e)}catch(t){throw _printDatetime("Code failed to send to "+e),t}}async resetPassword(t,e){var i=this.config.username;_printDatetime("Resetting password for "+i);try{await _resetPassword(this,t,e),_printDatetime("Password reset for "+i)}catch(t){throw _printDatetime("Password failed to reset for "+i),t}}async clearContinueWatching(t,e){if(null===this.token&&this.config.username&&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,t,e),_printDatetime("Continue watching cleared")}catch(t){throw _printDatetime("Continue watching failed to clear"),t}}async clearWatchlist(t){if(null===this.token&&this.config.username&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Clearing watchlist");try{await _clearWatchlist(this,t=t||this.id),_printDatetime("Watchlist cleared")}catch(t){throw _printDatetime("Watchlist failed to clear"),t}}async createForm(t,e){if(null===this.token&&this.config.username&&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,t,e);return i&&_printDatetime("Form created"),i}catch(t){throw _printDatetime("Form failed to create"),t}}async getContentCookies(t){if(null===this.token&&this.config.username&&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 e=await _getContentCookies(this,t);return e&&_printDatetime("Content cookies gotten"),e}catch(t){throw _printDatetime("Content cookies failed to get"),t}}async getDefaultSiteConfig(){if(null===this.token&&this.config.username&&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 t=await _getDefaultSiteConfig(this);return t&&_printDatetime("Default site config gotten"),t}catch(t){throw _printDatetime("Default site config failed to get"),t}}async getDynamicContent(e){null===this.token&&this.config.username&&await this._init(),_printDatetime("Getting dynamic content: "+e);try{var t=await _getDynamicContent(this,e);return t&&_printDatetime("Dynamic content gotten: "+e),t}catch(t){throw _printDatetime("Dynamic content failed to get: "+e),t}}async getDynamicContents(){if(null===this.token&&this.config.username&&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 t=await _getDynamicContents(this);return t&&_printDatetime("Dynamic contents gotten"),t}catch(t){throw _printDatetime("Dynamic contents failed to get"),t}}async getMediaGroup(e,t){if(null===this.token&&this.config.username&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting media group: "+e);try{var i=await _getMediaGroup(this,e,t);return i&&_printDatetime("Media group gotten: "+e),i}catch(t){throw _printDatetime("Media group failed to get: "+e),t}}async getMediaItem(e){if(null===this.token&&this.config.username&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting media item: "+e);try{var t=await _getMediaItem(this,e);return t&&_printDatetime("Media item gotten: "+e),t}catch(t){throw _printDatetime("Media item failed to get: "+e),t}}async getMyContent(){if(null===this.token&&this.config.username&&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 t=await _getMyContent(this);return t&&_printDatetime("My content gotten"),t}catch(t){throw _printDatetime("My content failed to get"),t}}async getMyGroup(e){null===this.token&&this.config.username&&await this._init(),_printDatetime("Getting my group: "+e);try{var t=await _getMyGroup(this,e);return t&&_printDatetime("My group gotten: "+e),t}catch(t){throw _printDatetime("My group failed to get: "+e),t}}async getSiteConfig(e){null===this.token&&this.config.username&&await this._init(),_printDatetime("Getting site config: "+e);try{var t=await _getSiteConfig(this,e);return t&&_printDatetime("Site config gotten: "+e),t}catch(t){throw _printDatetime("Site config failed to get: "+e),t}}async mediaSearch(t,e,i,n,r){if(null===this.token&&this.config.username&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Searching media...");try{var a=await _mediaSearch(this,t,e,i,n,r);return a&&_printDatetime("Media search complete"),a}catch(t){throw _printDatetime("Media search failed"),t}}async miscFunctions(e,i,n,r){null===this.token&&this.config.username&&await this._init(),_printDatetime("Calling function: "+e);try{let t=this.config.serviceApiUrl+"/"+e;r&&(t=(t=(t=t.replace("/api","")).replace("app-api.","")).replace("admin-app.",""));var a=new Headers,o=(a.append("Content-Type","application/json"),null!==this.token&&a.append("Authorization","Bearer "+this.token),this.debug&&console.log(`URL: ${t}
2
2
  METHOD: `+i+(n?`
3
- BODY: `+JSON.stringify(n,null,4):"")),{method:i,headers:a}),s=(n&&(o.body=JSON.stringify(n)),await fetch(t,o)),c=await s.text();if(!s.ok)try{throw JSON.parse(c)}catch(t){throw c}try{return JSON.parse(c)}catch(t){return c}}catch(t){_apiExceptionHandler(t,"API call failed")}}}export default NomadMediaSDK;async function _forgotPassword(t){return _sendRequest(t,"Forgot Password",t.config.serviceApiUrl+"/api/account/forgot-password","POST",void 0,{username:t.config.username})}async function _login(t){var e=t.config.serviceApiUrl+"/api/account/login",i={userName:t.config.username,password:t.config.password};try{return await _sendRequest(t,"Login",e,"POST",void 0,i)}catch(t){throw t.message.includes("409")?new Error("Invalid username or password"):t}}async function _logout(t){return _sendRequest(t,"Logout",t.config.serviceApiUrl+"/api/account/logout","POST",void 0,void 0)}async function _refreshToken(t){var e=await _sendRequest(t,"Refreshing Token",t.config.serviceApiUrl+"/api/account/refresh-token","POST",void 0,{refreshToken:t.refreshTokenVal});return t.token=e.token,!0}async function _resetPassword(t,e,i){return _sendRequest(t,"Reset Password",t.config.serviceApiUrl+"/api/account/reset-password","POST",void 0,{userName:t.username,token:e,newPassword:i})}function _apiExceptionHandler(i,n){if(i||console.error(n),"string"==typeof i)console.error(n+": "+i);else if(i.errors){if(Array.isArray(i.errors)){let e="";for(let t=0;t<i.errors.length;t++)e+=`${i.errors[t].code}: ${i.errors[t].field}: ${i.errors[t].message}\n`;console.error(n+": "+e)}else if("object"==typeof i.errors){let t="";for(var e in i.errors)Object.prototype.hasOwnProperty.call(i.errors,e)&&(t+=`${e}: ${i.errors[e]}\n`);console.error(n+": "+t)}}else console.error(n+": "+i.message);return null}import{getRandomValues}from"crypto";function _newGuid(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,t=>(t^getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16))}function _printDatetime(t){var e=(new Date).toLocaleTimeString();console.log(e+": "+t)}import{promises as fs}from"fs";import path from"path";async function _processFile(t){var e;if("string"==typeof t){if("undefined"!=typeof window)throw new Error("File path is not supported in browser");e=t,(t=await fs.stat(t)).originalName=path.basename(e),t.buffer||(t.buffer=await fs.readFile(e))}else t.originalName=t.name,t.buffer||(t.buffer=await _readFileAsArrayBuffer(t));return t}async function _readFileAsArrayBuffer(n){return new Promise((t,e)=>{let i=new FileReader;i.onload=()=>t(i.result),i.onerror=e,i.readAsArrayBuffer(n)})}import axios from"axios";let MAX_RETRIES=3,TIMEOUT=1e4,SLEEP_TIME=2;async function _sendRequest(e,i,t,n,r,a){var o={"Content-Type":"application/json"};e.token&&(o.Authorization="Bearer "+e.token),e.debug&&"Login"!==i&&console.log(`URL: ${t}
3
+ BODY: `+JSON.stringify(n,null,4):"")),{method:i,headers:a}),s=(n&&(o.body=JSON.stringify(n)),await fetch(t,o)),c=await s.text();if(!s.ok)try{throw JSON.parse(c)}catch(t){throw c}try{return JSON.parse(c)}catch(t){return c}}catch(t){_apiExceptionHandler(t,"API call failed")}}}export default NomadMediaSDK;async function _forgotPassword(t){return _sendRequest(t,"Forgot Password",t.config.serviceApiUrl+"/api/account/forgot-password","POST",void 0,{username:t.config.username})}async function _login(t){var e=t.config.serviceApiUrl+"/api/account/login",i={userName:t.config.username,password:t.config.password};try{return await _sendRequest(t,"Login",e,"POST",void 0,i)}catch(t){throw t.message.includes("409")?new Error("Invalid username or password"):t}}async function _logout(t){return _sendRequest(t,"Logout",t.config.serviceApiUrl+"/api/account/logout","POST",void 0,void 0)}async function _refreshToken(t){var e=await _sendRequest(t,"Refreshing Token",t.config.serviceApiUrl+"/api/account/refresh-token","POST",void 0,{refreshToken:t.refreshTokenVal});return t.token=e.token,!0}async function _resetPassword(t,e,i){return _sendRequest(t,"Reset Password",t.config.serviceApiUrl+"/api/account/reset-password","POST",void 0,{userName:t.username,token:e,newPassword:i})}function _apiExceptionHandler(i,n){if(i||console.error(n),"string"==typeof i)console.error(n+": "+i);else if(i.errors){if(Array.isArray(i.errors)){let e="";for(let t=0;t<i.errors.length;t++)e+=`${i.errors[t].code}: ${i.errors[t].field}: ${i.errors[t].message}\n`;console.error(n+": "+e)}else if("object"==typeof i.errors){let t="";for(var e in i.errors)Object.prototype.hasOwnProperty.call(i.errors,e)&&(t+=`${e}: ${i.errors[e]}\n`);console.error(n+": "+t)}}else console.error(n+": "+i.message);return null}import{getRandomValues}from"crypto";function _newGuid(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,t=>(t^getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16))}function _printDatetime(t){var e=(new Date).toLocaleTimeString();console.log(e+": "+t)}import{promises as fs}from"fs";import path from"path";async function _processFile(t){var e;if("string"==typeof t){if("undefined"!=typeof window)throw new Error("File path is not supported in browser");e=t,(t=await fs.stat(t)).originalName=path.basename(e),t.buffer||(t.buffer=await fs.readFile(e))}else t.originalName=t.name,t.buffer||(t.buffer=await _readFileAsArrayBuffer(t));return t}async function _readFileAsArrayBuffer(n){return new Promise((t,e)=>{let i=new FileReader;i.onload=()=>t(i.result),i.onerror=e,i.readAsArrayBuffer(n)})}import axios from"axios";let MAX_RETRIES=3,TIMEOUT=1e4,SLEEP_TIME=2;async function _sendRequest(e,i,t,n,r,a){var o={"Content-Type":"application/json"};e.token?o.Authorization="Bearer "+e.token:e.config.apiKey&&(o.Authorization="ApiKey "+e.config.apiKey),e.debug&&"Login"!==i&&console.log(`URL: ${t}
4
4
  METHOD: `+n+(r&&0===r.size?`
5
5
  PARAMS: `+JSON.stringify(r,null,4):"")+(a?`
6
6
  BODY: `+JSON.stringify(a,null,4):""));let s=0,c=null,l=!1;do{try{if(200<=(c=await axios({method:n,url:t,headers:o,params:r,data:a,timeout:TIMEOUT})).status&&c.status<300)break;throw new Error}catch(t){if(s>=MAX_RETRIES)return _apiExceptionHandler((t.response?.data.message?t.response.data:t).message,i+" failed");if(403!==t?.response?.status||"Refresh Token"===i||l){if("ECONNABORTED"!==t.code)return _apiExceptionHandler((t.response?.data.message?t.response.data:t).message,i+" failed");await _sleep(SLEEP_TIME*2**(s+1))}else await e.refreshToken(),o.Authorization="Bearer "+e.token,l=!0;++s}}while((!c||c.status<200||300<=c.status)&&s<MAX_RETRIES);try{return c.data}catch(t){}}async function _sleep(e){if(e&&0!==e)return new Promise(t=>{setTimeout(()=>{t()},1e3*e)})}function _slugify(t){return t&&0!==t.trim().length?t.toString().normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/\s+/g,"-").replace(/[^\w-]+/g,"").replace(/--+/g,"-"):""}async function _clearContinueWatching(t,e,i){return _sendRequest(t,"Clear Continue Watching",t.config.serviceApiUrl+"/api/media/clear-watching","POST",{userId:e,assetId:i},void 0)}async function _clearWatchlist(t,e){return _sendRequest(t,"Clear Watchlist",t.config.serviceApiUrl+"/api/media/clear-watchlist?userId="+e,"POST",void 0,void 0)}async function _createForm(t,e,i){return _sendRequest(t,"Creating Form",t.config.serviceApiUrl+"/api/media/form/"+e,"POST",void 0,i)}async function _getContentCookies(t,e){return _sendRequest(t,"Get Content Cookies",t.config.serviceApiUrl+"/api/media/set-cookies/"+e,"GET",void 0,void 0)}async function _getDefaultSiteConfig(t){return _sendRequest(t,"Get Default Site Config",t.config.serviceApiUrl+"/api/media/config","GET",void 0,void 0)}async function _getDynamicContent(t,e){return _sendRequest(t,"Get Dynamic Content",t.config.serviceApiUrl+"/api/media/content/"+e,"GET",void 0,void 0)}async function _getDynamicContents(t){return _sendRequest(t,"Get Dynamic Contents",t.config.serviceApiUrl+"/api/media/content","GET",void 0,void 0)}async function _getMediaGroup(t,e,i){let n=t.config.serviceApiUrl+"/api/media/group/"+e;return i&&0<i.length&&(n+="?"+i.map(t=>"filterIds="+t).join("&")),_sendRequest(t,"Get Media Group",n,"GET",void 0,void 0)}async function _getMediaItem(t,e){return _sendRequest(t,"Get Media Item",t.config.serviceApiUrl+"/api/media/item/"+e,"GET",void 0,void 0)}async function _getMyContent(t){return _sendRequest(t,"Get My Content",t.config.serviceApiUrl+"/api/media/my-content","GET",void 0,void 0)}async function _getMyGroup(t,e){return _sendRequest(t,"Get My Group",t.config.serviceApiUrl+"/api/media/my-group/"+e,"GET",void 0,void 0)}async function _getSiteConfig(t,e){return _sendRequest(t,"Get Site Config",t.config.serviceApiUrl+"/api/media/config/"+e,"GET",void 0,void 0)}async function _mediaSearch(t,e,i,n,r,a){var o=t.config.serviceApiUrl+"/api/media/search",e={searchQuery:e,ids:i,sortFields:n};return e.pageOffset=r||0,e.pageSize=a||100,_sendRequest(t,"Media Search",o,"POST",void 0,e)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nomad-media/public",
3
- "version": "1.1.14",
3
+ "version": "1.1.15",
4
4
  "description": "Nomad Media NPM",
5
5
  "main": "dist/nomad-media-sdk.min.js",
6
6
  "type": "module",