UNPKG

jsforce

Version:

Salesforce API Library for JavaScript

3 lines (2 loc) 4.96 kB
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n=n.jsforce||(n.jsforce={}),n=n.modules||(n.modules={}),n=n.api||(n.api={}),n.Analytics=t()}}(function(){return function(){function t(n,e,o){function r(s,a){if(!e[s]){if(!n[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(i)return i(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var l=e[s]={exports:{}};n[s][0].call(l.exports,function(t){var e=n[s][1][t];return r(e||t)},l,l.exports,t,n,e,o)}return e[s].exports}for(var i="function"==typeof require&&require,s=0;s<o.length;s++)r(o[s]);return r}return t}()({1:[function(t,n,e){"use strict";var o=window.jsforce.require("lodash/core"),r=window.jsforce.require("./core"),i=(window.jsforce.require("./promise"),function(t,n){this._report=t,this._conn=t._conn,this.id=n});i.prototype.retrieve=function(t){var n=this._conn,e=this._report,o=[n._baseUrl(),"analytics","reports",e.id,"instances",this.id].join("/");return n.request(o).thenCall(t)};var s=function(t,n){this._conn=t,this.id=n};s.prototype.describe=function(t){var n=[this._conn._baseUrl(),"analytics","reports",this.id,"describe"].join("/");return this._conn.request(n).thenCall(t)},s.prototype["delete"]=s.prototype.del=s.prototype.destroy=function(t){var n=[this._conn._baseUrl(),"analytics","reports",this.id].join("/");return this._conn.request({method:"DELETE",url:n}).thenCall(t)},s.prototype.clone=function(t,n){var e=[this._conn._baseUrl(),"analytics","reports"].join("/");e+="?cloneId="+this.id;var o={reportMetadata:{name:t}},r={method:"POST",url:e,headers:{"Content-Type":"application/json"},body:JSON.stringify(o)};return this._conn.request(r).thenCall(n)},s.prototype.explain=function(t){var n="/query/?explain="+this.id;return this._conn.request(n).thenCall(t)},s.prototype.run=s.prototype.exec=s.prototype.execute=function(t,n){t=t||{},o.isFunction(t)&&(n=t,t={});var e=[this._conn._baseUrl(),"analytics","reports",this.id].join("/");e+="?includeDetails="+(t.details?"true":"false");var r={method:t.metadata?"POST":"GET",url:e};return t.metadata&&(r.headers={"Content-Type":"application/json"},r.body=JSON.stringify(t.metadata)),this._conn.request(r).thenCall(n)},s.prototype.executeAsync=function(t,n){t=t||{},o.isFunction(t)&&(n=t,t={});var e=[this._conn._baseUrl(),"analytics","reports",this.id,"instances"].join("/");t.details&&(e+="?includeDetails=true");var r={method:"POST",url:e,body:""};return t.metadata&&(r.headers={"Content-Type":"application/json"},r.body=JSON.stringify(t.metadata)),this._conn.request(r).thenCall(n)},s.prototype.instance=function(t){return new i(this,t)},s.prototype.instances=function(t){var n=[this._conn._baseUrl(),"analytics","reports",this.id,"instances"].join("/");return this._conn.request(n).thenCall(t)};var a=function(t,n){this._conn=t,this.id=n};a.prototype.describe=function(t){var n=[this._conn._baseUrl(),"analytics","dashboards",this.id,"describe"].join("/");return this._conn.request(n).thenCall(t)},a.prototype.components=function(t,n){var e=[this._conn._baseUrl(),"analytics","dashboards",this.id].join("/"),r={};o.isFunction(t)?n=t:o.isArray(t)?r.componentIds=t:o.isString(t)&&(r.componentIds=[t]);var i={method:"POST",url:e,headers:{"Content-Type":"application/json"},body:JSON.stringify(r)};return this._conn.request(i).thenCall(n)},a.prototype.status=function(t){var n=[this._conn._baseUrl(),"analytics","dashboards",this.id,"status"].join("/");return this._conn.request(n).thenCall(t)},a.prototype.refresh=function(t){var n=[this._conn._baseUrl(),"analytics","dashboards",this.id].join("/"),e={method:"PUT",url:n,body:""};return this._conn.request(e).thenCall(t)},a.prototype.clone=function(t,n,e){var r=[this._conn._baseUrl(),"analytics","dashboards"].join("/");r+="?cloneId="+this.id;var i={};o.isObject(t)?(i=t,e=n):(i.name=t,i.folderId=n);var s={method:"POST",url:r,headers:{"Content-Type":"application/json"},body:JSON.stringify(i)};return this._conn.request(s).thenCall(e)},a.prototype["delete"]=a.prototype.del=a.prototype.destroy=function(t){var n=[this._conn._baseUrl(),"analytics","dashboards",this.id].join("/");return this._conn.request({method:"DELETE",url:n}).thenCall(t)};var c=function(t){this._conn=t};c.prototype.report=function(t){return new s(this._conn,t)},c.prototype.reports=function(t){var n=[this._conn._baseUrl(),"analytics","reports"].join("/");return this._conn.request(n).thenCall(t)},c.prototype.dashboard=function(t){return new a(this._conn,t)},c.prototype.dashboards=function(t){var n=[this._conn._baseUrl(),"analytics","dashboards"].join("/");return this._conn.request(n).thenCall(t)},r.on("connection:new",function(t){t.analytics=new c(t)}),n.exports=c},{}]},{},[1])(1)}); //# sourceMappingURL=jsforce-api-analytics.min.js.map