jsforce2
Version:
Salesforce API Library for JavaScript
3 lines (2 loc) • 4.86 kB
JavaScript
!function(t){var n;"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):(n=(n=(n=(n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).jsforce||(n.jsforce={})).modules||(n.modules={})).api||(n.api={})).Analytics=t()}(function(){return function o(r,i,s){function a(n,t){if(!i[n]){if(!r[n]){var e="function"==typeof require&&require;if(!t&&e)return e(n,!0);if(c)return c(n,!0);throw(e=new Error("Cannot find module '"+n+"'")).code="MODULE_NOT_FOUND",e}e=i[n]={exports:{}},r[n][0].call(e.exports,function(t){return a(r[n][1][t]||t)},e,e.exports,o,r,i,s)}return i[n].exports}for(var c="function"==typeof require&&require,t=0;t<s.length;t++)a(s[t]);return a}({1:[function(t,n,e){"use strict";function o(t,n){this._report=t,this._conn=t._conn,this.id=n}var i=window.jsforce.require("lodash/core"),r=window.jsforce.require("./core");window.jsforce.require("./promise");o.prototype.retrieve=function(t){var n=this._conn,e=this._report,e=[n._baseUrl(),"analytics","reports",e.id,"instances",this.id].join("/");return n.request(e).thenCall(t)};function s(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("/"),t={reportMetadata:{name:t}},t={method:"POST",url:e+="?cloneId="+this.id,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)};return this._conn.request(t).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||{},i.isFunction(t)&&(n=t,t={});var e=[this._conn._baseUrl(),"analytics","reports",this.id].join("/");e+="?includeDetails="+(t.details?"true":"false");e={method:t.metadata?"POST":"GET",url:e};return t.metadata&&(e.headers={"Content-Type":"application/json"},e.body=JSON.stringify(t.metadata)),this._conn.request(e).thenCall(n)},s.prototype.executeAsync=function(t,n){t=t||{},i.isFunction(t)&&(n=t,t={});var e=[this._conn._baseUrl(),"analytics","reports",this.id,"instances"].join("/");t.details&&(e+="?includeDetails=true");e={method:"POST",url:e,body:""};return t.metadata&&(e.headers={"Content-Type":"application/json"},e.body=JSON.stringify(t.metadata)),this._conn.request(e).thenCall(n)},s.prototype.instance=function(t){return new o(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)};function a(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("/"),o={};i.isFunction(t)?n=t:i.isArray(t)?o.componentIds=t:i.isString(t)&&(o.componentIds=[t]);o={method:"POST",url:e,headers:{"Content-Type":"application/json"},body:JSON.stringify(o)};return this._conn.request(o).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={method:"PUT",url:[this._conn._baseUrl(),"analytics","dashboards",this.id].join("/"),body:""};return this._conn.request(n).thenCall(t)},a.prototype.clone=function(t,n,e){var o=[this._conn._baseUrl(),"analytics","dashboards"].join("/");o+="?cloneId="+this.id;var r={};i.isObject(t)?(r=t,e=n):(r.name=t,r.folderId=n);r={method:"POST",url:o,headers:{"Content-Type":"application/json"},body:JSON.stringify(r)};return this._conn.request(r).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)};function c(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