rehive 1.28.0 → 1.30.0
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/build/rehive.min.js +1 -1
- package/package.json +1 -1
- package/rehive.js +153 -4
package/build/rehive.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(n){var t=setTimeout;function i(){}function o(n){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof n)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],f(n,this)}function s(e,i){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,o._immediateFn(function(){var n=1===e._state?i.onFulfilled:i.onRejected;if(null!==n){var t;try{t=n(e._value)}catch(n){return void r(i.promise,n)}u(i.promise,t)}else(1===e._state?u:r)(i.promise,e._value)})):e._deferreds.push(i)}function u(t,n){try{if(n===t)throw new TypeError("A promise cannot be resolved with itself.");if(n&&("object"==typeof n||"function"==typeof n)){var e=n.then;if(n instanceof o)return t._state=3,t._value=n,void c(t);if("function"==typeof e)return void f((i=e,s=n,function(){i.apply(s,arguments)}),t)}t._state=1,t._value=n,c(t)}catch(n){r(t,n)}var i,s}function r(n,t){n._state=2,n._value=t,c(n)}function c(n){2===n._state&&0===n._deferreds.length&&o._immediateFn(function(){n._handled||o._unhandledRejectionFn(n._value)});for(var t=0,e=n._deferreds.length;t<e;t++)s(n,n._deferreds[t]);n._deferreds=null}function a(n,t,e){this.onFulfilled="function"==typeof n?n:null,this.onRejected="function"==typeof t?t:null,this.promise=e}function f(n,t){var e=!1;try{n(function(n){e||(e=!0,u(t,n))},function(n){e||(e=!0,r(t,n))})}catch(n){if(e)return;e=!0,r(t,n)}}o.prototype.catch=function(n){return this.then(null,n)},o.prototype.then=function(n,t){var e=new this.constructor(i);return s(this,new a(n,t,e)),e},o.all=function(n){var r=Array.prototype.slice.call(n);return new o(function(i,s){if(0===r.length)return i([]);var o=r.length;function u(t,n){try{if(n&&("object"==typeof n||"function"==typeof n)){var e=n.then;if("function"==typeof e)return void e.call(n,function(n){u(t,n)},s)}r[t]=n,0==--o&&i(r)}catch(n){s(n)}}for(var n=0;n<r.length;n++)u(n,r[n])})},o.resolve=function(t){return t&&"object"==typeof t&&t.constructor===o?t:new o(function(n){n(t)})},o.reject=function(e){return new o(function(n,t){t(e)})},o.race=function(s){return new o(function(n,t){for(var e=0,i=s.length;e<i;e++)s[e].then(n,t)})},o._immediateFn="function"==typeof setImmediate&&function(n){setImmediate(n)}||function(n){t(n,0)},o._unhandledRejectionFn=function(n){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",n)},o._setImmediateFn=function(n){o._immediateFn=n},o._setUnhandledRejectionFn=function(n){o._unhandledRejectionFn=n},"undefined"!=typeof module&&module.exports?module.exports=o:n.Promise||(n.Promise=o)}(this),function(n){"use strict";if(!n.fetch){var t="URLSearchParams"in n,e="Symbol"in n&&"iterator"in Symbol,u="FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch(n){return!1}}(),i="FormData"in n,s="ArrayBuffer"in n;if(s)var o=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],r=function(n){return n&&DataView.prototype.isPrototypeOf(n)},c=ArrayBuffer.isView||function(n){return n&&-1<o.indexOf(Object.prototype.toString.call(n))};l.prototype.append=function(n,t){n=m(n),t=d(t);var e=this.map[n];this.map[n]=e?e+","+t:t},l.prototype.delete=function(n){delete this.map[m(n)]},l.prototype.get=function(n){return n=m(n),this.has(n)?this.map[n]:null},l.prototype.has=function(n){return this.map.hasOwnProperty(m(n))},l.prototype.set=function(n,t){this.map[m(n)]=d(t)},l.prototype.forEach=function(n,t){for(var e in this.map)this.map.hasOwnProperty(e)&&n.call(t,this.map[e],e,this)},l.prototype.keys=function(){var e=[];return this.forEach(function(n,t){e.push(t)}),h(e)},l.prototype.values=function(){var t=[];return this.forEach(function(n){t.push(n)}),h(t)},l.prototype.entries=function(){var e=[];return this.forEach(function(n,t){e.push([t,n])}),h(e)},e&&(l.prototype[Symbol.iterator]=l.prototype.entries);var a=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},P.call(b.prototype),P.call(N.prototype),N.prototype.clone=function(){return new N(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},N.error=function(){var n=new N(null,{status:0,statusText:""});return n.type="error",n};var f=[301,302,303,307,308];N.redirect=function(n,t){if(-1===f.indexOf(t))throw new RangeError("Invalid status code");return new N(null,{status:t,headers:{location:n}})},n.Headers=l,n.Request=b,n.Response=N,n.fetch=function(e,s){return new Promise(function(i,n){var t=new b(e,s),o=new XMLHttpRequest;o.onload=function(){var n,s,t={status:o.status,statusText:o.statusText,headers:(n=o.getAllResponseHeaders()||"",s=new l,n.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(n){var t=n.split(":"),e=t.shift().trim();if(e){var i=t.join(":").trim();s.append(e,i)}}),s)};t.url="responseURL"in o?o.responseURL:t.headers.get("X-Request-URL");var e="response"in o?o.response:o.responseText;i(new N(e,t))},o.onerror=function(){n(new TypeError("Network request failed"))},o.ontimeout=function(){n(new TypeError("Network request failed"))},o.open(t.method,t.url,!0),"include"===t.credentials?o.withCredentials=!0:"omit"===t.credentials&&(o.withCredentials=!1),"responseType"in o&&u&&(o.responseType="blob"),t.headers.forEach(function(n,t){o.setRequestHeader(t,n)}),o.send(void 0===t._bodyInit?null:t._bodyInit)})},n.fetch.polyfill=!0}function m(n){if("string"!=typeof n&&(n=String(n)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(n))throw new TypeError("Invalid character in header field name");return n.toLowerCase()}function d(n){return"string"!=typeof n&&(n=String(n)),n}function h(t){var n={next:function(){var n=t.shift();return{done:void 0===n,value:n}}};return e&&(n[Symbol.iterator]=function(){return n}),n}function l(t){this.map={},t instanceof l?t.forEach(function(n,t){this.append(t,n)},this):Array.isArray(t)?t.forEach(function(n){this.append(n[0],n[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(n){this.append(n,t[n])},this)}function g(n){if(n.bodyUsed)return Promise.reject(new TypeError("Already read"));n.bodyUsed=!0}function p(e){return new Promise(function(n,t){e.onload=function(){n(e.result)},e.onerror=function(){t(e.error)}})}function w(n){var t=new FileReader,e=p(t);return t.readAsArrayBuffer(n),e}function v(n){if(n.slice)return n.slice(0);var t=new Uint8Array(n.byteLength);return t.set(new Uint8Array(n)),t.buffer}function P(){return this.bodyUsed=!1,this._initBody=function(n){if(this._bodyInit=n)if("string"==typeof n)this._bodyText=n;else if(u&&Blob.prototype.isPrototypeOf(n))this._bodyBlob=n;else if(i&&FormData.prototype.isPrototypeOf(n))this._bodyFormData=n;else if(t&&URLSearchParams.prototype.isPrototypeOf(n))this._bodyText=n.toString();else if(s&&u&&r(n))this._bodyArrayBuffer=v(n.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!s||!ArrayBuffer.prototype.isPrototypeOf(n)&&!c(n))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=v(n)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof n?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):t&&URLSearchParams.prototype.isPrototypeOf(n)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},u&&(this.blob=function(){var n=g(this);if(n)return n;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?g(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(w)}),this.text=function(){var n,t,e,i=g(this);if(i)return i;if(this._bodyBlob)return n=this._bodyBlob,t=new FileReader,e=p(t),t.readAsText(n),e;if(this._bodyArrayBuffer)return Promise.resolve(function(n){for(var t=new Uint8Array(n),e=new Array(t.length),i=0;i<t.length;i++)e[i]=String.fromCharCode(t[i]);return e.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i&&(this.formData=function(){return this.text().then(y)}),this.json=function(){return this.text().then(JSON.parse)},this}function b(n,t){var e,i,s=(t=t||{}).body;if(n instanceof b){if(n.bodyUsed)throw new TypeError("Already read");this.url=n.url,this.credentials=n.credentials,t.headers||(this.headers=new l(n.headers)),this.method=n.method,this.mode=n.mode,s||null==n._bodyInit||(s=n._bodyInit,n.bodyUsed=!0)}else this.url=String(n);if(this.credentials=t.credentials||this.credentials||"omit",!t.headers&&this.headers||(this.headers=new l(t.headers)),this.method=(e=t.method||this.method||"GET",i=e.toUpperCase(),-1<a.indexOf(i)?i:e),this.mode=t.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&s)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(s)}function y(n){var s=new FormData;return n.trim().split("&").forEach(function(n){if(n){var t=n.split("="),e=t.shift().replace(/\+/g," "),i=t.join("=").replace(/\+/g," ");s.append(decodeURIComponent(e),decodeURIComponent(i))}}),s}function N(n,t){t||(t={}),this.type="default",this.status="status"in t?t.status:200,this.ok=200<=this.status&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new l(t.headers),this.url=t.url||"",this._initBody(n)}}("undefined"!=typeof self?self:this);var fetch,isNode=!1;function Rehive(t){this.public={companies:[]},this.auth={password:{},email:{},mobile:{},tokens:{},mfa:{sms:{},token:{},status:{}}},this.user={addresses:[],bankAccounts:{},cryptoAccounts:{},documents:{},emails:{},mobiles:{}},this.transactions={totals:{}},this.transaction_collections={},this.accounts={currencies:{}},this.company={currencies:{},bankAccounts:{}},this.groups={},this.permissions={},this.admin={auth:{login:{},register:{}},accessControlRules:{},users:{overview:{},tiers:{},addresses:{},bankAccounts:{currencies:{}},settings:{},cryptoAccounts:{},documents:{},emails:{},mobiles:{},permissions:{},groups:{},kyc:{},mfa:{token:{},sms:{}}},requests:{},transactions:{totals:{}},transaction_collections:{},accounts:{currencies:{limits:{},fees:{},settings:{}}},account:{currencies:{},definitions:{groups:{currencies:{}}}},currencies:{overview:{},bankAccounts:{}},company:{settings:{},address:{}},bankAccounts:{currencies:{}},webhooks:{},subtypes:{},notifications:{},services:{},groups:{tiers:{requirements:{},limits:{},fees:{},settings:{}},permissions:{},accountConfigurations:{currencies:{}},settings:{}},webhookTasks:{requests:{}},exports:{sets:{}},metrics:{points:{}}};var u,n="3",i="public/companies/",s="auth/mfa/sms/",o="auth/mfa/token/",r="auth/tokens/",c="user/addresses/",a="user/bank-accounts/",f="user/crypto-accounts/",m="user/documents/",d="user/emails/",h="user/mobiles/",l="transactions/",g="transaction-collections/",p="accounts/",w="/currencies/",v="company/currencies/",P="permissions/",b="groups/",y={"Content-Type":"application/json",Accept:"application/json"},N="admin/users/",k="admin/access-control-rules/",A="/settings/",_="admin/users/overview/",T="/permissions/",x="/groups/",C="admin/users/addresses/",S="admin/users/bank-accounts/",E="admin/users/crypto-accounts/",R="admin/users/documents/",j="admin/users/emails/",q="admin/users/mobiles/",O="admin/transactions/",B="admin/exports/",I="admin/transaction-collections/",U="admin/accounts/",F="/currencies/",z="/limits/",D="/fees/",L="/settings/",M="admin/account-currencies/",G="admin/account-definitions/",H="admin/currencies/",J="/bank-accounts/",V="admin/company/",X="settings/",K="address/",W="admin/webhooks/",$="admin/webhook-tasks/",Q="/requests/",Y="admin/subtypes/",Z="admin/notifications/",nn="/requirements/",tn="/limits/",en="/fees/",sn="admin/bank-accounts/",on="admin/services/",un="admin/groups/",rn="admin/requests/",cn="/permissions/",an="/settings/",fn="/tiers/",mn="/account-configurations/",dn="/currencies/",hn="/settings/",ln="admin/metrics/";t||(t={}),u=0<Object.keys(t).length?t.customAPIURL?t.customAPIURL:(n=t.apiVersion?t.apiVersion:"3",t.apiToken&&bn(t.apiToken),t.network&&"staging"==t.network?t.network="api.staging.rehive.com":t.network="api.rehive.com","https://"+t.network+"/"+n+"/"):(n="3",t.network="api.rehive.com","https://"+t.network+"/"+n+"/");var e,gn,pn,wn={},vn={};function Pn(n){var t=[];for(var e in n)n.hasOwnProperty(e)&&t.push(encodeURIComponent(e)+"="+encodeURIComponent(n[e]));return t.join("&")}function bn(n){if(t&&t.storageMethod){if(void 0===sessionStorage||void 0===localStorage)return void console.log("sessionStorage and localStorage not supported.");"local"===t.storageMethod?localStorage.setItem("token",n):"session"===t.storageMethod&&sessionStorage.setItem("token",n)}e=n}function yn(){return t&&"local"===t.storageMethod?e=localStorage.getItem("token"):t&&"session"===t.storageMethod&&(e=sessionStorage.getItem("token")),e||""}function Nn(){t&&"local"===t.storageMethod?e=localStorage.removeItem("token"):t&&"session"===t.storageMethod&&(e=sessionStorage.removeItem("token")),delete y.Authorization,e=""}function kn(e){return e.json().then(function(t){return new Promise(function(n){e.ok||(t.status_code=e.status,t.ok=e.ok),n(t)})})}function An(n){gn=n.next?n.next:null,pn=n.previous?n.previous:null}function _n(n,t){n.next?wn[t]=n.next:delete wn[t],n.previous?vn[t]=n.previous:delete vn[t]}var Tn=function(i,s,o){return new Promise(function(t,e){var n=yn();n&&!o?y.Authorization="Token "+n:delete y.Authorization,fetch(u+i,{method:"POST",headers:y,body:JSON.stringify(s)}).then(kn).then(function(n){"success"==n.status?n.data&&n.data.data?t(n.data.data):n.data?t(n.data):n.message?t({message:n.message}):t({}):"error"==n.status&&(n.data?e({status:n.status_code,message:n.message,data:n.data}):e({status:n.status_code,message:n.message}))})})},xn=function(i,s){return new Promise(function(t,e){var n=s||yn();n?y.Authorization="Token "+n:delete y.Authorization,fetch(u+i,{method:"GET",headers:y}).then(kn).then(function(n){"success"==n.status?n.data&&n.data.data?t(n.data.data):n.data?t(n.data):n.message?t({message:n.message}):t({}):"error"==n.status&&(n.data?e({status:n.status_code,message:n.message,data:n.data}):e({status:n.status_code,message:n.message}))})})},Cn=function(i,s){return new Promise(function(t,e){var n=yn();n?y.Authorization="Token "+n:delete y.Authorization,!isNode&&s instanceof FormData?delete y["Content-Type"]:(y["Content-Type"]="application/json",s=JSON.stringify(s)),fetch(u+i,{method:"PATCH",headers:y,body:s}).then(kn).then(function(n){y["Content-Type"]="application/json","success"==n.status?n.data&&n.data.data?t(n.data.data):n.data?t(n.data):n.message?t({message:n.message}):t({}):"error"==n.status&&(n.data?e({status:n.status_code,message:n.message,data:n.data}):e({status:n.status_code,message:n.message}))})})},Sn=function(i,s){return new Promise(function(t,e){var n=yn();n?y.Authorization="Token "+n:delete y.Authorization,fetch(u+i,{method:"DELETE",headers:y,body:JSON.stringify(s)}).then(kn).then(function(n){"success"==n.status?n.data&&n.data.data?t(n.data.data):n.data?t(n.data):n.message?t({message:n.message}):t({}):"error"==n.status&&(n.data?e({status:n.status_code,message:n.message,data:n.data}):e({status:n.status_code,message:n.message}))})})};this.removeToken=function(){return t&&"local"===t.storageMethod?e=localStorage.removeItem("token"):t&&"session"===t.storageMethod&&(e=sessionStorage.removeItem("token")),delete y.Authorization,e="","Token removed"},this.public.companies.get=function(n){return new Promise(function(t,e){xn(n?i+n+"/":i).then(function(n){t(n)},function(n){e(n)})})},this.auth.register=function(n){return new Promise(function(t,e){fetch(u+"auth/register/",{method:"POST",headers:y,body:JSON.stringify(n)}).then(kn).then(function(n){"success"==n.status?(bn(n.data.token),t({user:n.data.user,token:n.data.token})):"error"==n.status&&(n.data?e({status:n.status_code,message:n.message,data:n.data}):e({status:n.status_code,message:n.message}))})})},this.auth.registerCompany=function(n){return new Promise(function(t,e){fetch(u+"auth/company/register/",{method:"POST",headers:y,body:JSON.stringify(n)}).then(kn).then(function(n){"success"==n.status?(bn(n.data.token),t(n.data.user)):"error"==n.status&&(n.data?e({status:n.status_code,message:n.message,data:n.data}):e({status:n.status_code,message:n.message}))})})},this.auth.login=function(n){return new Promise(function(t,e){fetch(u+"auth/login/",{method:"POST",headers:y,body:JSON.stringify(n)}).then(kn).then(function(n){"success"==n.status?(bn(n.data.token),t({user:n.data.user,token:n.data.token,mfa:void 0!==n.data.mfa?n.data.mfa:null})):"error"==n.status&&(n.data?e({status:n.status_code,message:n.message,data:n.data}):e({status:n.status_code,message:n.message}))})})},this.auth.logout=function(){return new Promise(function(t,e){var n=yn();n?y.Authorization="Token "+n:delete y.Authorization,fetch(u+"auth/logout/",{method:"POST",headers:y}).then(kn).then(function(n){"success"==n.status?(Nn(),t({})):"error"==n.status&&(n.data?e(n.data):e({status:n.status_code,message:n.message}))})})},this.auth.logoutAll=function(){return new Promise(function(t,e){var n=yn();n?y.Authorization="Token "+n:delete y.Authorization,fetch(u+"auth/logout/all/",{method:"POST",headers:y}).then(kn).then(function(n){"success"==n.status?(Nn(),t({})):"error"==n.status&&(n.data?e({status:n.status_code,message:n.message,data:n.data}):e({status:n.status_code,message:n.message}))})})},this.auth.password.change=function(n){return new Promise(function(t,e){Tn("auth/password/change/",n).then(function(n){t(n)},function(n){e(n)})})},this.auth.password.reset=function(n){return new Promise(function(t,e){Tn("auth/password/reset/",n,!0).then(function(n){t(n)},function(n){e(n)})})},this.auth.password.resetConfirm=function(n){return new Promise(function(t,e){Tn("auth/password/reset/confirm/",n,!0).then(function(n){t(n)},function(n){e(n)})})},this.auth.email.resendEmailVerification=function(n){return new Promise(function(t,e){Tn("auth/email/verify/resend/",n,!0).then(function(n){t(n)},function(n){e(n)})})},this.auth.mobile.resendMobileVerification=function(n){return new Promise(function(t,e){Tn("auth/mobile/verify/resend/",n).then(function(n){t(n)},function(n){e(n)})})},this.auth.mobile.verify=function(n){return new Promise(function(t,e){Tn("auth/mobile/verify/",n).then(function(n){t(n)},function(n){e(n)})})},this.auth.email.verify=function(n){return new Promise(function(t,e){Tn("auth/email/verify/",n).then(function(n){t(n)},function(n){e(n)})})},this.auth.tokens.get=function(n){var i;return i=n?r+n:r,new Promise(function(t,e){xn(i).then(function(n){t(n)},function(n){e(n)})})},this.auth.tokens.create=function(n){return new Promise(function(t,e){Tn(r,n).then(function(n){t(n)},function(n){e(n)})})},this.auth.tokens.delete=function(i){return new Promise(function(t,e){var n;i?n=r+i:e({status:"error",message:"A token is required"}),Sn(n,{}).then(function(n){t(n)},function(n){e(n)})})},this.auth.tokens.verify=function(n){return new Promise(function(t,e){xn("auth/",n).then(function(n){t(n)},function(n){e(n)})})},this.auth.mfa.status.get=function(){return new Promise(function(t,e){xn("auth/mfa/").then(function(n){t(n)},function(n){e(n)})})},this.auth.mfa.sms.get=function(){return new Promise(function(t,e){xn(s).then(function(n){t(n)},function(n){e(n)})})},this.auth.mfa.sms.enable=function(n){return new Promise(function(t,e){Tn(s,n).then(function(n){t(n)},function(n){e(n)})})},this.auth.mfa.sms.send=function(n){return new Promise(function(t,e){Tn("auth/mfa/sms/send/",n).then(function(n){t(n)},function(n){e(n)})})},this.auth.mfa.sms.disable=function(n){return new Promise(function(t,e){Sn(s,n).then(function(n){t(n)},function(n){e(n)})})},this.auth.mfa.token.get=function(){return new Promise(function(t,e){xn(o).then(function(n){t(n)},function(n){e(n)})})},this.auth.mfa.token.enable=function(n){return new Promise(function(t,e){Tn(o,n).then(function(n){t(n)},function(n){e(n)})})},this.auth.mfa.token.disable=function(){return new Promise(function(t,e){Sn(o).then(function(n){t(n)},function(n){e(n)})})},this.auth.mfa.verify=function(n){return new Promise(function(t,e){Tn("auth/mfa/verify/",n).then(function(n){t(n)},function(n){e(n)})})},this.transactions.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?l+s.id+"/":s&&s.filters?(i="?"+Pn(s.filters),l+i):l,xn(n).then(function(n){_n(n,"Transaction"),t(n)},function(n){e(n)})})},this.transactions.getNext=function(){return new Promise(function(t,e){var n,i=wn.Transaction;i?(n=i.split(u)[1],xn(n).then(function(n){_n(n,"Transaction"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.transactions.getPrevious=function(){return new Promise(function(t,e){var n,i=vn.Transaction;i?(n=i.split(u)[1],xn(n).then(function(n){_n(n,"Transaction"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.transactions.totals.get=function(n){return new Promise(function(t,e){n=n?"?"+Pn(n):"",xn(l+"totals/"+n).then(function(n){t(n)},function(n){e(n)})})},this.transactions.createDebit=function(n){return new Promise(function(t,e){Tn("transactions/debit/",n).then(function(n){t(n)},function(n){e(n)})})},this.transactions.createCredit=function(n){return new Promise(function(t,e){Tn("transactions/credit/",n).then(function(n){t(n)},function(n){e(n)})})},this.transactions.createTransfer=function(n){return new Promise(function(t,e){Tn("transactions/transfer/",n).then(function(n){t(n)},function(n){e(n)})})},this.transaction_collections.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?g+s.id+"/":s&&s.filters?(i="?"+Pn(s.filters),g+i):g,xn(n).then(function(n){_n(n,"Transaction Collection"),t(n)},function(n){e(n)})})},this.transaction_collections.getNext=function(){return new Promise(function(t,e){var n,i=wn["Transaction Collection"];i?(n=i.split(u)[1],xn(n).then(function(n){_n(n,"Transaction Collection"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.transaction_collections.getPrevious=function(){return new Promise(function(t,e){var n,i=vn["Transaction Collection"];i?(n=i.split(u)[1],xn(n).then(function(n){_n(n,"Transaction Collection"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.transaction_collections.create=function(n){return new Promise(function(t,e){Tn(g,n).then(function(n){t(n)},function(n){e(n)})})},this.accounts.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.reference?p+s.reference+"/":s&&s.filters?(i="?"+Pn(s.filters),p+i):p,xn(n).then(function(n){_n(n,"Account"),t(n)},function(n){e(n)})})},this.accounts.getNext=function(){return new Promise(function(t,e){var n,i=wn.Account;i?(n=i.split(u)[1],xn(n).then(function(n){_n(n,"Account"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.accounts.getPrevious=function(){return new Promise(function(t,e){var n,i=vn.Account;i?(n=i.split(u)[1],xn(n).then(function(n){_n(n,"Account"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.accounts.create=function(n){return new Promise(function(t,e){Tn(p,n).then(function(n){t(n)},function(n){e(n)})})},this.accounts.currencies.get=function(s,o){return new Promise(function(t,e){var n,i;s&&"string"==typeof s?(n=o&&o.code?p+s+w+o.code+"/":o&&o.filters?(i="?"+Pn(o.filters),p+s+w+i):p+s+w,xn(n).then(function(n){_n(n,"AccountCurrencies"),t(n)},function(n){e(n)})):e({status:"error",message:"Reference is required"})})},this.accounts.currencies.getNext=function(){return new Promise(function(t,e){var n,i=wn.AccountCurrencies;i?(n=i.split(u)[1],xn(n).then(function(n){_n(n,"AccountCurrencies"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.accounts.currencies.getPrevious=function(){return new Promise(function(t,e){var n,i=vn.AccountCurrencies;i?(n=i.split(u)[1],xn(n).then(function(n){_n(n,"AccountCurrencies"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.accounts.currencies.update=function(n,i,s){return new Promise(function(t,e){n&&"string"==typeof n?i&&"string"==typeof i?Cn(p+n+w+i+"/",s).then(function(n){t(n)},function(n){e(n)}):e({status:"error",message:"Currency Code is required"}):e({status:"error",message:"Reference is required"})})},this.company.get=function(){return new Promise(function(t,e){xn("company/").then(function(n){t(n)},function(n){e(n)})})},this.company.currencies.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.code?v+s.code+"/":s&&s.filters?(i="?"+Pn(s.filters),v+i):v,xn(n).then(function(n){_n(n,"CompanyCurrencies"),t(n)},function(n){e(n)})})},this.company.currencies.getNext=function(){return new Promise(function(t,e){var n,i=wn.CompanyCurrencies;i?(n=i.split(u)[1],xn(n).then(function(n){_n(n,"CompanyCurrencies"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.company.currencies.getPrevious=function(){return new Promise(function(t,e){var n,i=vn.CompanyCurrencies;i?(n=i.split(u)[1],xn(n).then(function(n){_n(n,"CompanyCurrencies"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.company.bankAccounts.get=function(){return new Promise(function(t,e){xn("company/bank-accounts/").then(function(n){t(n)},function(n){e(n)})})},this.permissions.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?P+s.id+"/":s&&s.filters?(i="?"+Pn(s.filters),P+i):P,xn(n).then(function(n){_n(n,"Permissions"),t(n)},function(n){e(n)})})},this.permissions.getNext=function(){return new Promise(function(t,e){var n,i=wn.Permissions;i?(n=i.split(u)[1],xn(n).then(function(n){_n(n,"Permissions"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.permissions.getPrevious=function(){return new Promise(function(t,e){var n,i=vn.Permissions;i?(n=i.split(u)[1],xn(n).then(function(n){_n(n,"Permissions"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.groups.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.name?b+s.name+"/":s&&s.filters?(i="?"+Pn(s.filters),b+i):b,xn(n).then(function(n){_n(n,"Groups"),t(n)},function(n){e(n)})})},this.groups.getNext=function(){return new Promise(function(t,e){var n,i=wn.Groups;i?(n=i.split(u)[1],xn(n).then(function(n){_n(n,"Groups"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.groups.getPrevious=function(){return new Promise(function(t,e){var n,i=vn.Groups;i?(n=i.split(u)[1],xn(n).then(function(n){_n(n,"CompanyCurrencies"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.user.get=function(){return new Promise(function(t,e){xn("user/").then(function(n){t(n)},function(n){e(n)})})},this.user.update=function(n){return new Promise(function(t,e){Cn("user/",n).then(function(n){t(n)},function(n){e(n)})})},this.user.addresses.get=function(n){return new Promise(function(t,e){xn(n?c+n:c).then(function(n){t(n)},function(n){e(n)})})},this.user.addresses.update=function(i){return new Promise(function(t,e){var n;i.id?n=c+i.id+"/":e({status:400,message:"No id has been given"}),Cn(n,i).then(function(n){t(n)},function(n){e(n)})})},this.user.addresses.create=function(n){return new Promise(function(t,e){Tn(c,n).then(function(n){t(n)},function(n){e(n)})})},this.user.addresses.delete=function(n){return new Promise(function(t,e){n?Sn(c+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.user.bankAccounts.get=function(n){return new Promise(function(t,e){xn(n?a+n+"/":a).then(function(n){t(n)},function(n){e(n)})})},this.user.bankAccounts.create=function(n){return new Promise(function(t,e){Tn(a,n).then(function(n){t(n)},function(n){e(n)})})},this.user.bankAccounts.update=function(n,i){return new Promise(function(t,e){n?Cn(a+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:"error",message:"Account id is required"})})},this.user.bankAccounts.delete=function(n){return new Promise(function(t,e){n?Sn(a+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:"error",message:"Bank id is required"})})},this.user.cryptoAccounts.get=function(n){return new Promise(function(t,e){xn(n?f+n+"/":f).then(function(n){t(n)},function(n){e(n)})})},this.user.cryptoAccounts.create=function(n){return new Promise(function(t,e){Tn(f,n).then(function(n){t(n)},function(n){e(n)})})},this.user.cryptoAccounts.update=function(n,i){return new Promise(function(t,e){n?Cn(f+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:"error",message:"Crypto account id is required"})})},this.user.cryptoAccounts.delete=function(n){return new Promise(function(t,e){n?Sn(f+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:"error",message:"Crypto account id is required"})})},this.user.documents.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?m+s.id+"/":s&&s.filters?(i="?"+Pn(s.filters),m+i):m,xn(n).then(function(n){_n(n,"Documents"),t(n)},function(n){e(n)})})},this.user.documents.getNext=function(){return new Promise(function(t,e){var n,i=wn.Documents;i?(n=i.split(u)[1],xn(n).then(function(n){_n(n,"Documents"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.user.documents.getPrevious=function(){return new Promise(function(t,e){var n,i=vn.Documents;i?(n=i.split(u)[1],xn(n).then(function(n){_n(n,"Documents"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.user.documents.create=function(s){return new Promise(function(t,e){var n=yn(),i={};n?i.Authorization="Token "+n:delete i.Authorization,fetch(u+m,{method:"POST",headers:i,body:s}).then(kn).then(function(n){"success"==n.status?n.data&&n.data.data?t(n.data.data):n.data?t(n.data):t(n):"error"==n.status&&(n.data?e(n.data):e({status:n.status_code,message:n.message}))})})},this.user.emails.get=function(n){return new Promise(function(t,e){xn(n?d+n+"/":d).then(function(n){t(n)},function(n){e(n)})})},this.user.emails.create=function(n){return new Promise(function(t,e){Tn(d,n).then(function(n){t(n)},function(n){e(n)})})},this.user.emails.update=function(n,i){return new Promise(function(t,e){n&&i?Cn(d+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:"error",message:"Email address id is required"},null)})},this.user.emails.delete=function(n){return new Promise(function(t,e){n?Sn(d+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:"error",message:"Email address id is required"})})},this.user.mobiles.get=function(n){return new Promise(function(t,e){xn(n?h+n+"/":h).then(function(n){t(n)},function(n){e(n)})})},this.user.mobiles.create=function(n){return new Promise(function(t,e){Tn(h,n).then(function(n){t(n)},function(n){e(n)})})},this.user.mobiles.update=function(n,i){return new Promise(function(t,e){n&&i?Cn(h+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:"error",message:"Mobile number id is required"})})},this.user.mobiles.delete=function(n){return new Promise(function(t,e){n?Sn(h+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:"error",message:"Mobile number id is required"})})},this.admin.auth.login=function(n){return new Promise(function(t,e){Tn("admin/auth/login/",n).then(function(n){t(n)},function(n){e(n)})})},this.admin.auth.register=function(n){return new Promise(function(t,e){Tn("admin/auth/register/",n).then(function(n){t(n)},function(n){e(n)})})},this.admin.metrics.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?ln+s.id+"/":s&&s.filters?(i="?"+Pn(s.filters),ln+i):ln,xn(n).then(function(n){An(n),t(n)},function(n){e(n)})})},this.admin.metrics.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.metrics.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.metrics.create=function(n){return new Promise(function(t,e){Tn(ln,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.metrics.delete=function(n){return new Promise(function(t,e){n?Sn(ln+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.metrics.points.get=function(n){return new Promise(function(t,e){n?xn(ln+n+"/points/").then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.exports.sets.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?B+s.id+"/":s&&s.filters?(i="?"+Pn(s.filters),B+i):B,xn(n).then(function(n){An(n),t(n)},function(n){e(n)})})},this.admin.exports.sets.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.exports.sets.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.exports.sets.create=function(n){return new Promise(function(t,e){Tn(B,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.exports.sets.delete=function(n){return new Promise(function(t,e){n?Sn(B+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.accessControlRules.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?k+s.id+"/":s&&s.filters?(i="?"+Pn(s.filters),k+i):k,xn(n).then(function(n){An(n),t(n)},function(n){e(n)})})},this.admin.accessControlRules.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.accessControlRules.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.accessControlRules.create=function(n){return new Promise(function(t,e){n?Tn(k,n).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No data has been given"})})},this.admin.accessControlRules.update=function(n,i){return new Promise(function(t,e){n?Cn(k+n,i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.accessControlRules.delete=function(n){return new Promise(function(t,e){n?Sn(k+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.overview.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.filters?(i="?"+Pn(s.filters),_+i):_,xn(n).then(function(n){t(n)},function(n){e(n)})})},this.admin.users.settings.get=function(n){return new Promise(function(t,e){n?xn(N+n+A).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.settings.update=function(n,i){return new Promise(function(t,e){n?Cn(N+n+A,i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.kyc.get=function(n){return new Promise(function(t,e){n?xn(N+n+"/kyc/").then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.kyc.update=function(n,i){return new Promise(function(t,e){n?Cn(N+n+"/kyc/",i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?N+s.id+"/":s&&s.filters?(i="?"+Pn(s.filters),N+i):N,xn(n).then(function(n){An(n),t(n)},function(n){e(n)})})},this.admin.users.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.create=function(i){return new Promise(function(t,e){var n=yn();n?y.Authorization="Token "+n:delete y.Authorization,!isNode&&i instanceof FormData?delete y["Content-Type"]:i=JSON.stringify(i),fetch(u+N,{method:"POST",headers:y,body:i}).then(kn).then(function(n){y["Content-Type"]="application/json","success"==n.status?n.data&&n.data.data?t(n.data.data):n.data?t(n.data):t(n):"error"==n.status&&(n.data?e(n.data):e({status:n.status_code,message:n.message}))})})},this.admin.users.update=function(s,o){return new Promise(function(t,e){if(s){var n=yn(),i={};n?i.Authorization="Token "+n:delete i.Authorization,fetch(u+N+s+"/",{method:"PATCH",headers:i,body:o}).then(kn).then(function(n){"success"==n.status?n.data&&n.data.data?t(n.data.data):n.data?t(n.data):t(n):"error"==n.status&&(n.data?e(n.data):e({status:n.status_code,message:n.message}))})}else e({status:400,message:"No id has been given"})})},this.admin.users.delete=function(n){return new Promise(function(t,e){n?Sn(N+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.permissions.get=function(s,o){return new Promise(function(t,e){var n,i;s?(n=o&&o.id?N+s+T+o.id+"/":o&&o.filters?(i="?"+Pn(o.filters),N+s+T+i):N+s+T,xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"No id has been given"})})},this.admin.users.permissions.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.permissions.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.permissions.create=function(n,i){return new Promise(function(t,e){Tn(N+n+T,i).then(function(n){t(n)},function(n){e(n)})})},this.admin.users.permissions.delete=function(n,i){return new Promise(function(t,e){Sn(N+n+T+i+"/",{}).then(function(n){t(n)},function(n){e(n)})})},this.admin.users.groups.get=function(s,o){return new Promise(function(t,e){var n,i;s?(n=o&&o.name?N+s+x+o.name+"/":o&&o.filters?(i="?"+Pn(o.filters),N+s+x+i):N+s+x,xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"No id has been given"})})},this.admin.users.groups.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.groups.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.groups.create=function(n,i){return new Promise(function(t,e){Tn(N+n+x,i).then(function(n){t(n)},function(n){e(n)})})},this.admin.users.groups.delete=function(n,i){return new Promise(function(t,e){Sn(N+n+x+i+"/",{}).then(function(n){t(n)},function(n){e(n)})})},this.admin.users.addresses.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?C+s.id+"/":s&&s.filters?(i="?"+Pn(s.filters),C+i):C,xn(n).then(function(n){An(n),t(n)},function(n){e(n)})})},this.admin.users.addresses.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.addresses.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.addresses.create=function(n){return new Promise(function(t,e){Tn(C,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.users.addresses.update=function(n,i){return new Promise(function(t,e){n?Cn(C+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.addresses.delete=function(n){return new Promise(function(t,e){n?Sn(C+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.bankAccounts.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?S+s.id+"/":s&&s.filters?(i="?"+Pn(s.filters),S+i):S,xn(n).then(function(n){An(n),t(n)},function(n){e(n)})})},this.admin.users.bankAccounts.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.bankAccounts.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.bankAccounts.create=function(n){return new Promise(function(t,e){Tn(S,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.users.bankAccounts.update=function(n,i){return new Promise(function(t,e){n?Cn(S+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.bankAccounts.delete=function(n){return new Promise(function(t,e){n?Sn(S+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.bankAccounts.currencies.get=function(s,o){return new Promise(function(t,e){var n,i;n=o&&o.code?S+s+"/currencies/"+o.code+"/":o&&o.filters?(i="?"+Pn(o.filters),S+s+"/currencies/"+i):S+s+"/currencies/",xn(n).then(function(n){An(n),t(n)},function(n){e(n)})})},this.admin.users.bankAccounts.currencies.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.bankAccounts.currencies.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.bankAccounts.currencies.create=function(n,i){return new Promise(function(t,e){n?Tn(S+n+"/currencies/",i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.bankAccounts.currencies.update=function(n,i,s){return new Promise(function(t,e){n?i?Cn(S+n+"/currencies/"+i+"/",s).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No currency code has been given"}):e({status:400,message:"No id has been given"})})},this.admin.users.bankAccounts.currencies.delete=function(n,i){return new Promise(function(t,e){n?i?Sn(S+n+"/currencies/"+i+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No currency code has been given"}):e({status:400,message:"No id has been given"})})},this.admin.users.cryptoAccounts.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?E+s.id+"/":s&&s.filters?(i="?"+Pn(s.filters),E+i):E,xn(n).then(function(n){An(n),t(n)},function(n){e(n)})})},this.admin.users.cryptoAccounts.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.cryptoAccounts.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.cryptoAccounts.create=function(n){return new Promise(function(t,e){Tn(E,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.users.cryptoAccounts.update=function(n,i){return new Promise(function(t,e){n?Cn(E+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.cryptoAccounts.delete=function(n){return new Promise(function(t,e){n?Sn(E+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.documents.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?R+s.id+"/":s&&s.filters?(i="?"+Pn(s.filters),R+i):R,xn(n).then(function(n){An(n),t(n)},function(n){e(n)})})},this.admin.users.documents.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.documents.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.documents.create=function(s){return new Promise(function(t,e){var n=yn(),i={};n?i.Authorization="Token "+n:delete i.Authorization,fetch(u+R,{method:"POST",headers:i,body:s}).then(kn).then(function(n){"success"==n.status?n.data&&n.data.data?t(n.data.data):n.data?t(n.data):t(n):"error"==n.status&&(n.data?e(n.data):e({status:n.status_code,message:n.message}))})})},this.admin.users.documents.update=function(s,o){return new Promise(function(t,e){if(s){var n=yn(),i={};n?i.Authorization="Token "+n:delete i.Authorization,fetch(u+R+s+"/",{method:"PATCH",headers:i,body:o}).then(kn).then(function(n){"success"==n.status?n.data&&n.data.data?t(n.data.data):n.data?t(n.data):t(n):"error"==n.status&&(n.data?e(n.data):e({status:n.status_code,message:n.message}))})}else e({status:400,message:"No id has been given"})})},this.admin.users.documents.delete=function(n){return new Promise(function(t,e){n?Sn(R+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.emails.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?j+s.id+"/":s&&s.filters?(i="?"+Pn(s.filters),j+i):j,xn(n).then(function(n){An(n),t(n)},function(n){e(n)})})},this.admin.users.emails.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.emails.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.emails.create=function(n){return new Promise(function(t,e){Tn(j,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.users.emails.update=function(n,i){return new Promise(function(t,e){n?Cn(j+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.emails.delete=function(n){return new Promise(function(t,e){n?Sn(j+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.mobiles.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?q+s.id+"/":s&&s.filters?(i="?"+Pn(s.filters),q+i):q,xn(n).then(function(n){An(n),t(n)},function(n){e(n)})})},this.admin.users.mobiles.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.mobiles.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.mobiles.create=function(n){return new Promise(function(t,e){Tn(q,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.users.mobiles.update=function(n,i){return new Promise(function(t,e){n?Cn(q+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.mobiles.delete=function(n){return new Promise(function(t,e){n?Sn(q+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.mfa.get=function(n){return new Promise(function(t,e){n?xn(N+n+"/mfa/").then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.mfa.sms.delete=function(n){return new Promise(function(t,e){n?Sn(N+n+"/mfa/sms/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.mfa.token.delete=function(n){return new Promise(function(t,e){n?Sn(N+n+"/mfa/token/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.transactions.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?O+s.id+"/":s&&s.filters?(i="?"+Pn(s.filters),O+i):O,xn(n).then(function(n){An(n),t(n)},function(n){e(n)})})},this.admin.transactions.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.transactions.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.transactions.totals.get=function(i){return new Promise(function(t,e){var n;n=i?"?"+Pn(i.filters):"",xn("admin/transactions/totals/"+n).then(function(n){An(n),t(n)},function(n){e(n)})})},this.admin.transactions.update=function(n,i){return new Promise(function(t,e){n?Cn(O+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.transactions.createCredit=function(n){return new Promise(function(t,e){Tn("admin/transactions/credit/",n).then(function(n){t(n)},function(n){e(n)})})},this.admin.transactions.createDebit=function(n){return new Promise(function(t,e){Tn("admin/transactions/debit/",n).then(function(n){t(n)},function(n){e(n)})})},this.admin.transactions.createTransfer=function(n){return new Promise(function(t,e){Tn("admin/transactions/transfer/",n).then(function(n){t(n)},function(n){e(n)})})},this.admin.transaction_collections.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?I+s.id+"/":s&&s.filters?(i="?"+Pn(s.filters),I+i):I,xn(n).then(function(n){An(n),t(n)},function(n){e(n)})})},this.admin.transaction_collections.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.transaction_collections.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.transaction_collections.create=function(n){return new Promise(function(t,e){Tn(I,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.transaction_collections.update=function(n,i){return new Promise(function(t,e){n?Cn(I+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No reference has been given"})})},this.admin.transaction_collections.delete=function(n){return new Promise(function(t,e){n?Sn(I+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.accounts.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.reference?U+s.reference+"/":s&&s.filters?(i="?"+Pn(s.filters),U+i):U,xn(n).then(function(n){An(n),t(n)},function(n){e(n)})})},this.admin.accounts.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.accounts.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.account.definitions.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.name?G+s.name+"/":s&&s.filters?(i="?"+Pn(s.filters),G+i):G,xn(n).then(function(n){An(n),t(n)},function(n){e(n)})})},this.admin.account.definitions.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.account.definitions.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.account.definitions.create=function(n){return new Promise(function(t,e){Tn(G,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.account.definitions.update=function(n,i){return new Promise(function(t,e){n?Cn(G+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No account name has been given"})})},this.admin.account.definitions.delete=function(n){return new Promise(function(t,e){n?Sn(G+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No account name has been given"})})},this.admin.account.definitions.groups.get=function(s,o){return new Promise(function(t,e){var n,i;s?(n=o&&o.name?G+s+"/groups/"+o.name+"/":o&&o.filters?(i="?"+Pn(o.filters),G+s+"/groups/"+i):G+s+"/groups/",xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"No account name has been given"})})},this.admin.account.definitions.groups.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.account.definitions.groups.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.account.definitions.groups.create=function(n,i){return new Promise(function(t,e){n?Tn(G+n+"/groups/",i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No account name has been given"})})},this.admin.account.definitions.groups.update=function(n,i,s){return new Promise(function(t,e){n?i?Cn(G+n+"/groups/"+i+"/",s).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No group name has been given"}):e({status:400,message:"No account name has been given"})})},this.admin.account.definitions.groups.delete=function(n,i){return new Promise(function(t,e){n?i?Sn(G+n+"/groups/"+i+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No group name has been given"}):e({status:400,message:"No account name has been given"})})},this.admin.account.definitions.groups.currencies.get=function(s,o,u){return new Promise(function(t,e){var n,i;s?o?(n=u&&u.code?G+s+"/groups/"+o+"/currencies/"+u.code+"/":u&&u.filters?(i="?"+Pn(u.filters),G+s+"/groups/"+o+"/currencies/"+i):G+s+"/groups/"+o+"/currencies/",xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"No group name has been given"}):e({status:400,message:"No account name has been given"})})},this.admin.account.definitions.groups.currencies.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.account.definitions.groups.currencies.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.account.definitions.groups.currencies.create=function(n,i,s){return new Promise(function(t,e){n?i?Tn(G+n+"/groups/"+i+"/currencies/",s).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No group name has been given"}):e({status:400,message:"No account name has been given"})})},this.admin.account.definitions.groups.currencies.update=function(n,i,s,o){return new Promise(function(t,e){n?i?s?Cn(G+n+"/groups/"+i+"/currencies/"+s+"/",o).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No currency code has been given"}):e({status:400,message:"No group name has been given"}):e({status:400,message:"No account name has been given"})})},this.admin.account.definitions.groups.currencies.delete=function(n,i,s){return new Promise(function(t,e){n?i?s?Sn(G+n+"/groups/"+i+"/currencies/"+s+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No currency code has been given"}):e({status:400,message:"No group name has been given"}):e({status:400,message:"No account name has been given"})})},this.admin.account.currencies.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.reference?M+s.reference+"/":s&&s.filters?(i="?"+Pn(s.filters),M+i):M,xn(n).then(function(n){An(n),t(n)},function(n){e(n)})})},this.admin.account.currencies.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.account.currencies.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.accounts.create=function(n){return new Promise(function(t,e){Tn(U,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.accounts.update=function(n,i){return new Promise(function(t,e){n?Cn(U+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No reference has been given"})})},this.admin.accounts.currencies.get=function(s,o){return new Promise(function(t,e){var n,i;s?(n=o&&o.code?U+s+F+o.code+"/":o&&o.filters?(i="?"+Pn(o.filters),U+s+F+i):U+s+F,xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"No reference has been given"})})},this.admin.accounts.currencies.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.accounts.currencies.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.accounts.currencies.create=function(n,i){return new Promise(function(t,e){Tn(U+n+F,i).then(function(n){t(n)},function(n){e(n)})})},this.admin.accounts.currencies.update=function(n,i,s){return new Promise(function(t,e){n&&i?Cn(U+n+F+i+"/",s).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No reference or code has been given"})})},this.admin.accounts.currencies.limits.get=function(i,s,o){return new Promise(function(t,e){var n;i&&s?(n=o&&o.id?U+i+F+s+z+o.id+"/":U+i+F+s+z,xn(n).then(function(n){t(n)},function(n){e(n)})):e({status:400,message:"No reference or code has been given"})})},this.admin.accounts.currencies.limits.create=function(n,i,s){return new Promise(function(t,e){Tn(U+n+F+i+z,s).then(function(n){t(n)},function(n){e(n)})})},this.admin.accounts.currencies.limits.update=function(n,i,s,o){return new Promise(function(t,e){n&&i&&s?Cn(U+n+F+i+z+s+"/",o).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No reference or code or id has been given"})})},this.admin.accounts.currencies.limits.delete=function(n,i,s){return new Promise(function(t,e){n&&i&&s?Sn(U+n+F+i+z+s+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No reference or code or id has been given"})})},this.admin.accounts.currencies.fees.get=function(i,s,o){return new Promise(function(t,e){var n;i&&s?(n=o&&o.id?U+i+F+s+D+o.id+"/":U+i+F+s+D,xn(n).then(function(n){t(n)},function(n){e(n)})):e({status:400,message:"No reference or code has been given"})})},this.admin.accounts.currencies.fees.create=function(n,i,s){return new Promise(function(t,e){Tn(U+n+F+i+D,s).then(function(n){t(n)},function(n){e(n)})})},this.admin.accounts.currencies.fees.update=function(n,i,s,o){return new Promise(function(t,e){n&&i&&s?Cn(U+n+F+i+D+s+"/",o).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No reference or code or id has been given"})})},this.admin.accounts.currencies.fees.delete=function(n,i,s){return new Promise(function(t,e){n&&i&&s?Sn(U+n+F+i+D+s+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No reference or code or id has been given"})})},this.admin.accounts.currencies.settings.get=function(n,i){return new Promise(function(t,e){n&&i?xn(U+n+F+i+L).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No reference or code has been given"})})},this.admin.accounts.currencies.settings.update=function(n,i,s){return new Promise(function(t,e){n&&i?Cn(U+n+F+i+L,s).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No reference or code has been given"})})},this.admin.currencies.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.code?H+s.code+"/":s&&s.filters?(i="?"+Pn(s.filters),H+i):H,xn(n).then(function(n){An(n),t(n)},function(n){e(n)})})},this.admin.currencies.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.currencies.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.currencies.create=function(n){return new Promise(function(t,e){Tn(H,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.currencies.update=function(n,i){return new Promise(function(t,e){if(!n)return currencies.update,void e({status:400,message:"No code has been given"});Cn(H+n+"/",i).then(function(n){t(n)},function(n){e(n)})})},this.admin.currencies.delete=function(n){return new Promise(function(t,e){n?Sn(H+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No code has been given"})})},this.admin.currencies.overview.get=function(n){return new Promise(function(t,e){n||e({status:400,message:"No code provided"}),xn(H+n+"/overview/").then(function(n){t(n)},function(n){e(n)})})},this.admin.currencies.bankAccounts.get=function(s,o){return new Promise(function(t,e){var n,i;n=o&&o.id?H+s+J+o.id+"/":o&&o.filters?(i="?"+Pn(o.filters),H+s+J+i):H+s+J,xn(n).then(function(n){An(n),t(n)},function(n){e(n)})})},this.admin.currencies.bankAccounts.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.currencies.bankAccounts.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.currencies.bankAccounts.create=function(n,i){return new Promise(function(t,e){Tn(H+n+J,i).then(function(n){t(n)},function(n){e(n)})})},this.admin.currencies.bankAccounts.delete=function(n,i){return new Promise(function(t,e){Sn(H+n+J+i+"/").then(function(n){t(n)},function(n){e(n)})})},this.admin.company.get=function(){return new Promise(function(t,e){xn(V).then(function(n){t(n)},function(n){e(n)})})},this.admin.company.update=function(n){return new Promise(function(t,e){Cn(V,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.company.settings.get=function(){return new Promise(function(t,e){xn(V+X).then(function(n){t(n)},function(n){e(n)})})},this.admin.company.settings.update=function(n){return new Promise(function(t,e){Cn(V+X,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.company.address.get=function(){return new Promise(function(t,e){xn(V+K).then(function(n){t(n)},function(n){e(n)})})},this.admin.company.address.update=function(n){return new Promise(function(t,e){Cn(V+K,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.bankAccounts.get=function(n){var i;return i=n&&n.id?sn+n.id+"/":sn,new Promise(function(t,e){xn(i).then(function(n){t(n)},function(n){e(n)})})},this.admin.bankAccounts.create=function(n){return new Promise(function(t,e){Tn(sn,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.bankAccounts.update=function(n,i){return new Promise(function(t,e){Cn(sn+n+"/",i).then(function(n){t(n)},function(n){e(n)})})},this.admin.bankAccounts.delete=function(n){return new Promise(function(t,e){Sn(sn+n+"/",{}).then(function(n){t(n)},function(n){e(n)})})},this.admin.bankAccounts.currencies.get=function(i,s){return new Promise(function(t,e){if(i){var n=sn+i+"/currencies/";s&&(n+=s),xn(n).then(function(n){An(n),t(n)},function(n){e(n)})}else e({status:400,message:"No bank ID has been given"})})},this.admin.bankAccounts.currencies.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){n.next&&An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.bankAccounts.currencies.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.bankAccounts.currencies.create=function(n,i){if(i.currency)return new Promise(function(t,e){Tn(sn+n+"/currencies/",i).then(function(n){t(n)},function(n){e(n)})});reject({status:400,message:"No currency has been given"})},this.admin.bankAccounts.currencies.delete=function(n,i){if(n){if(i)return new Promise(function(t,e){Sn(sn+n+"/currencies/"+i,{}).then(function(n){t(n)},function(n){e(n)})});reject({status:400,message:"No currency has been given"})}else reject({status:400,message:"No bank ID has been given"})},this.admin.webhooks.get=function(n){var i,t;return i=n&&n.id?W+n.id+"/":n&&n.filters?(t="?"+Pn(n.filters),W+t):W,new Promise(function(t,e){xn(i).then(function(n){An(n),t(n)},function(n){e(n)})})},this.admin.webhooks.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.webhooks.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.webhooks.create=function(n){return new Promise(function(t,e){Tn(W,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.webhooks.update=function(n,i){return new Promise(function(t,e){Cn(W+n+"/",i).then(function(n){t(n)},function(n){e(n)})})},this.admin.webhooks.delete=function(n){return new Promise(function(t,e){Sn(W+n+"/",{}).then(function(n){t(n)},function(n){e(n)})})},this.admin.webhookTasks.get=function(n){var i,t;return i=n&&n.id?$+n.id+"/":n&&n.filters?(t="?"+Pn(n.filters),$+t):$,n&&n.id?new Promise(function(t,e){var n=yn();n?y.Authorization="Token "+n:delete y.Authorization,fetch(u+i,{method:"GET",headers:y}).then(kn).then(function(n){"success"==n.status?n.data&&t(n.data):"error"==n.status&&(n.data?e(n.data):e({status:n.status_code,message:n.message}))})}):new Promise(function(t,e){xn(i).then(function(n){An(n),t(n)},function(n){e(n)})})},this.admin.webhookTasks.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.webhookTasks.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.webhookTasks.requests.get=function(n,t){var i,e;return i=t&&t.id?$+n+Q+t.id+"/":t&&t.filters?(e="?"+Pn(t.filters),$+n+Q+e):$,new Promise(function(t,e){xn(i).then(function(n){An(n),t(n)},function(n){e(n)})})},this.admin.webhookTasks.requests.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.webhookTasks.requests.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.subtypes.get=function(n){var i;return i=n&&n.id?Y+n.id+"/":Y,new Promise(function(t,e){xn(i).then(function(n){t(n)},function(n){e(n)})})},this.admin.subtypes.create=function(n){return new Promise(function(t,e){Tn(Y,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.subtypes.update=function(n,i){return new Promise(function(t,e){Cn(Y+n+"/",i).then(function(n){t(n)},function(n){e(n)})})},this.admin.subtypes.delete=function(n){return new Promise(function(t,e){Sn(Y+n+"/",{}).then(function(n){t(n)},function(n){e(n)})})},this.admin.notifications.get=function(n){var i;return i=n&&n.id?Z+n.id+"/":Z,new Promise(function(t,e){xn(i).then(function(n){t(n)},function(n){e(n)})})},this.admin.notifications.update=function(n,i){return new Promise(function(t,e){Cn(Z+n+"/",i).then(function(n){t(n)},function(n){e(n)})})},this.admin.services.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?on+s.id+"/":s&&s.filters?(i="?"+Pn(s.filters),on+i):on,xn(n).then(function(n){An(n),t(n)},function(n){e(n)})})},this.admin.services.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.services.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.services.update=function(n,i){return new Promise(function(t,e){Cn(on+n+"/",i).then(function(n){t(n)},function(n){e(n)})})},this.admin.services.create=function(n){return new Promise(function(t,e){Tn(on,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.services.delete=function(n){return new Promise(function(t,e){n?Sn(on+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.requests.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?rn+s.id+"/":s&&s.filters?(i="?"+Pn(s.filters),rn+i):rn,xn(n).then(function(n){An(n),t(n)},function(n){e(n)})})},this.admin.requests.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){n.next&&An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.requests.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.groups.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.name?un+s.name+"/":s&&s.filters?(i="?"+Pn(s.filters),un+i):un,xn(n).then(function(n){An(n),t(n)},function(n){e(n)})})},this.admin.groups.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.groups.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.groups.create=function(n){return new Promise(function(t,e){Tn(un,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.groups.update=function(n,i){return new Promise(function(t,e){n?Cn(un+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No group name has been given"})})},this.admin.groups.delete=function(n){return new Promise(function(t,e){n?Sn(un+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No group name has been given"})})},this.admin.groups.permissions.get=function(s,o){return new Promise(function(t,e){var n,i;n=o&&o.id?un+s+cn+o.id+"/":o&&o.filters?(i="?"+Pn(o.filters),un+s+cn+i):un+s+cn,xn(n).then(function(n){An(n),t(n)},function(n){e(n)})})},this.admin.groups.permissions.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.groups.permissions.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.groups.permissions.create=function(n,i){return new Promise(function(t,e){n?Tn(un+n+cn,i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No group name has been given"})})},this.admin.groups.permissions.delete=function(n,i){return new Promise(function(t,e){n&&i?Sn(un+n+cn+i+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No group name or permission id has been given"})})},this.admin.groups.settings.get=function(n){return new Promise(function(t,e){n?xn(un+n+an).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No group name has been given"})})},this.admin.groups.settings.update=function(n,i){if(n)return new Promise(function(t,e){Cn(un+n+an,i).then(function(n){t(n)},function(n){e(n)})});reject({status:400,message:"No group name has been given"})},this.admin.groups.tiers.get=function(n,t){var i;return i=t&&t.id?un+n+fn+t.id+"/":un+n+fn,new Promise(function(t,e){xn(i).then(function(n){t(n)},function(n){e(n)})})},this.admin.groups.tiers.create=function(n,i){return new Promise(function(t,e){Tn(un+n+fn,i).then(function(n){t(n)},function(n){e(n)})})},this.admin.groups.tiers.update=function(n,i,s){return new Promise(function(t,e){Cn(un+n+fn+i+"/",s).then(function(n){t(n)},function(n){e(n)})})},this.admin.groups.tiers.delete=function(n,i){return new Promise(function(t,e){Sn(un+n+fn+i+"/",{}).then(function(n){t(n)},function(n){e(n)})})},this.admin.groups.tiers.requirements.get=function(i,s,o){return new Promise(function(t,e){var n;s?(n=o&&o.id?un+i+fn+s+nn+o.id+"/":un+i+fn+s+nn,xn(n).then(function(n){t(n)},function(n){e(n)})):e({status:400,message:"No tier id is provided"})})},this.admin.groups.tiers.requirements.create=function(n,i,s){return new Promise(function(t,e){i?Tn(un+n+fn+i+nn,s).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No tier id is provided"})})},this.admin.groups.tiers.requirements.update=function(n,i,s,o){return new Promise(function(t,e){i?s?Cn(un+n+fn+i+nn+s+"/",o).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No requirement id is provided"}):e({status:400,message:"No tier id is provided"})})},this.admin.groups.tiers.requirements.delete=function(n,i,s){return new Promise(function(t,e){i?s?Sn(un+n+fn+i+nn+s+"/").then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No requirement id is provided"}):e({status:400,message:"No tier id is provided"})})},this.admin.groups.tiers.fees.get=function(i,s,o){return new Promise(function(t,e){var n;s?(n=o&&o.id?un+i+fn+s+en+o.id+"/":un+i+fn+s+en,xn(n).then(function(n){t(n)},function(n){e(n)})):e({status:400,message:"No tier id is provided"})})},this.admin.groups.tiers.fees.create=function(n,i,s){return new Promise(function(t,e){i?Tn(un+n+fn+i+en,s).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No tier id is provided"})})},this.admin.groups.tiers.fees.update=function(n,i,s,o){return new Promise(function(t,e){i?s?Cn(un+n+fn+i+en+s+"/",o).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No fee id is provided"}):e({status:400,message:"No tier id is provided"})})},this.admin.groups.tiers.fees.delete=function(n,i,s){return new Promise(function(t,e){i?s?Sn(un+n+fn+i+en+s+"/").then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No fee id is provided"}):e({status:400,message:"No tier id is provided"})})},this.admin.groups.tiers.limits.get=function(i,s,o){return new Promise(function(t,e){var n;s?(n=o&&o.id?un+i+fn+s+tn+o.id+"/":un+i+fn+s+tn,xn(n).then(function(n){t(n)},function(n){e(n)})):e({status:400,message:"No tier id is provided"})})},this.admin.groups.tiers.limits.create=function(n,i,s){return new Promise(function(t,e){i?Tn(un+n+fn+i+tn,s).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No tier id is provided"})})},this.admin.groups.tiers.limits.update=function(n,i,s,o){return new Promise(function(t,e){i?s?Cn(un+n+fn+i+tn+s+"/",o).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No limit id is provided"}):e({status:400,message:"No tier id is provided"})})},this.admin.groups.tiers.limits.delete=function(n,i,s){return new Promise(function(t,e){i?s?Sn(un+n+fn+i+tn+s+"/").then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No limit id is provided"}):e({status:400,message:"No tier id is provided"})})},this.admin.groups.tiers.settings.get=function(n,i){return new Promise(function(t,e){n?xn(un+n+fn+i+hn).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No group name has been given"})})},this.admin.groups.tiers.settings.update=function(n,i,s){if(n)return new Promise(function(t,e){Cn(un+n+fn+i+hn,s).then(function(n){t(n)},function(n){e(n)})});reject({status:400,message:"No group name has been given"})},this.admin.groups.accountConfigurations.get=function(s,o){return new Promise(function(t,e){var n,i;n=o&&o.name?un+s+mn+o.name+"/":o&&o.filters?(i="?"+Pn(o.filters),un+s+mn+i):un+s+mn,xn(n).then(function(n){An(n),t(n)},function(n){e(n)})})},this.admin.groups.accountConfigurations.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.groups.accountConfigurations.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.groups.accountConfigurations.create=function(n,i){return new Promise(function(t,e){Tn(un+n+mn,i).then(function(n){t(n)},function(n){e(n)})})},this.admin.groups.accountConfigurations.update=function(n,i,s){return new Promise(function(t,e){n?Cn(un+n+mn+i+"/",s).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No group name has been given"})})},this.admin.groups.accountConfigurations.delete=function(n,i){return new Promise(function(t,e){n?Sn(un+n+mn+i+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No group name has been given"})})},this.admin.groups.accountConfigurations.currencies.get=function(s,o,u){return new Promise(function(t,e){var n,i;n=u&&u.code?un+s+mn+o+dn+u.code+"/":u&&u.filters?(i="?"+Pn(u.filters),un+s+mn+o+dn+i):un+s+mn+o+dn,xn(n).then(function(n){An(n),t(n)},function(n){e(n)})})},this.admin.groups.accountConfigurations.currencies.getNext=function(){return new Promise(function(t,e){var n;gn?(n=gn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.groups.accountConfigurations.currencies.getPrevious=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],xn(n).then(function(n){An(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.groups.accountConfigurations.currencies.create=function(n,i,s){return new Promise(function(t,e){Tn(un+n+mn+i+dn,s).then(function(n){t(n)},function(n){e(n)})})},this.admin.groups.accountConfigurations.currencies.delete=function(n,i,s){return new Promise(function(t,e){n?Sn(un+n+mn+i+dn+s+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No group name has been given"})})}}"undefined"!=typeof module&&module.exports?(module.exports=Rehive,global.fetch&&!process.env.IS_BROWSER?fetch=global.fetch:(fetch=require("node-fetch"),isNode=!0)):(window.this,isNode=!1,fetch=window.fetch);
|
|
1
|
+
!function(n){var t=setTimeout;function i(){}function o(n){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof n)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],f(n,this)}function s(e,i){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,o._immediateFn(function(){var n=1===e._state?i.onFulfilled:i.onRejected;if(null!==n){var t;try{t=n(e._value)}catch(n){return void r(i.promise,n)}u(i.promise,t)}else(1===e._state?u:r)(i.promise,e._value)})):e._deferreds.push(i)}function u(t,n){try{if(n===t)throw new TypeError("A promise cannot be resolved with itself.");if(n&&("object"==typeof n||"function"==typeof n)){var e=n.then;if(n instanceof o)return t._state=3,t._value=n,void c(t);if("function"==typeof e)return void f((i=e,s=n,function(){i.apply(s,arguments)}),t)}t._state=1,t._value=n,c(t)}catch(n){r(t,n)}var i,s}function r(n,t){n._state=2,n._value=t,c(n)}function c(n){2===n._state&&0===n._deferreds.length&&o._immediateFn(function(){n._handled||o._unhandledRejectionFn(n._value)});for(var t=0,e=n._deferreds.length;t<e;t++)s(n,n._deferreds[t]);n._deferreds=null}function a(n,t,e){this.onFulfilled="function"==typeof n?n:null,this.onRejected="function"==typeof t?t:null,this.promise=e}function f(n,t){var e=!1;try{n(function(n){e||(e=!0,u(t,n))},function(n){e||(e=!0,r(t,n))})}catch(n){if(e)return;e=!0,r(t,n)}}o.prototype.catch=function(n){return this.then(null,n)},o.prototype.then=function(n,t){var e=new this.constructor(i);return s(this,new a(n,t,e)),e},o.all=function(n){var r=Array.prototype.slice.call(n);return new o(function(i,s){if(0===r.length)return i([]);var o=r.length;function u(t,n){try{if(n&&("object"==typeof n||"function"==typeof n)){var e=n.then;if("function"==typeof e)return void e.call(n,function(n){u(t,n)},s)}r[t]=n,0==--o&&i(r)}catch(n){s(n)}}for(var n=0;n<r.length;n++)u(n,r[n])})},o.resolve=function(t){return t&&"object"==typeof t&&t.constructor===o?t:new o(function(n){n(t)})},o.reject=function(e){return new o(function(n,t){t(e)})},o.race=function(s){return new o(function(n,t){for(var e=0,i=s.length;e<i;e++)s[e].then(n,t)})},o._immediateFn="function"==typeof setImmediate&&function(n){setImmediate(n)}||function(n){t(n,0)},o._unhandledRejectionFn=function(n){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",n)},o._setImmediateFn=function(n){o._immediateFn=n},o._setUnhandledRejectionFn=function(n){o._unhandledRejectionFn=n},"undefined"!=typeof module&&module.exports?module.exports=o:n.Promise||(n.Promise=o)}(this),function(n){"use strict";if(!n.fetch){var t="URLSearchParams"in n,e="Symbol"in n&&"iterator"in Symbol,u="FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch(n){return!1}}(),i="FormData"in n,s="ArrayBuffer"in n;if(s)var o=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],r=function(n){return n&&DataView.prototype.isPrototypeOf(n)},c=ArrayBuffer.isView||function(n){return n&&-1<o.indexOf(Object.prototype.toString.call(n))};l.prototype.append=function(n,t){n=m(n),t=d(t);var e=this.map[n];this.map[n]=e?e+","+t:t},l.prototype.delete=function(n){delete this.map[m(n)]},l.prototype.get=function(n){return n=m(n),this.has(n)?this.map[n]:null},l.prototype.has=function(n){return this.map.hasOwnProperty(m(n))},l.prototype.set=function(n,t){this.map[m(n)]=d(t)},l.prototype.forEach=function(n,t){for(var e in this.map)this.map.hasOwnProperty(e)&&n.call(t,this.map[e],e,this)},l.prototype.keys=function(){var e=[];return this.forEach(function(n,t){e.push(t)}),h(e)},l.prototype.values=function(){var t=[];return this.forEach(function(n){t.push(n)}),h(t)},l.prototype.entries=function(){var e=[];return this.forEach(function(n,t){e.push([t,n])}),h(e)},e&&(l.prototype[Symbol.iterator]=l.prototype.entries);var a=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},P.call(b.prototype),P.call(N.prototype),N.prototype.clone=function(){return new N(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},N.error=function(){var n=new N(null,{status:0,statusText:""});return n.type="error",n};var f=[301,302,303,307,308];N.redirect=function(n,t){if(-1===f.indexOf(t))throw new RangeError("Invalid status code");return new N(null,{status:t,headers:{location:n}})},n.Headers=l,n.Request=b,n.Response=N,n.fetch=function(e,s){return new Promise(function(i,n){var t=new b(e,s),o=new XMLHttpRequest;o.onload=function(){var n,s,t={status:o.status,statusText:o.statusText,headers:(n=o.getAllResponseHeaders()||"",s=new l,n.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(n){var t=n.split(":"),e=t.shift().trim();if(e){var i=t.join(":").trim();s.append(e,i)}}),s)};t.url="responseURL"in o?o.responseURL:t.headers.get("X-Request-URL");var e="response"in o?o.response:o.responseText;i(new N(e,t))},o.onerror=function(){n(new TypeError("Network request failed"))},o.ontimeout=function(){n(new TypeError("Network request failed"))},o.open(t.method,t.url,!0),"include"===t.credentials?o.withCredentials=!0:"omit"===t.credentials&&(o.withCredentials=!1),"responseType"in o&&u&&(o.responseType="blob"),t.headers.forEach(function(n,t){o.setRequestHeader(t,n)}),o.send(void 0===t._bodyInit?null:t._bodyInit)})},n.fetch.polyfill=!0}function m(n){if("string"!=typeof n&&(n=String(n)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(n))throw new TypeError("Invalid character in header field name");return n.toLowerCase()}function d(n){return"string"!=typeof n&&(n=String(n)),n}function h(t){var n={next:function(){var n=t.shift();return{done:void 0===n,value:n}}};return e&&(n[Symbol.iterator]=function(){return n}),n}function l(t){this.map={},t instanceof l?t.forEach(function(n,t){this.append(t,n)},this):Array.isArray(t)?t.forEach(function(n){this.append(n[0],n[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(n){this.append(n,t[n])},this)}function g(n){if(n.bodyUsed)return Promise.reject(new TypeError("Already read"));n.bodyUsed=!0}function p(e){return new Promise(function(n,t){e.onload=function(){n(e.result)},e.onerror=function(){t(e.error)}})}function w(n){var t=new FileReader,e=p(t);return t.readAsArrayBuffer(n),e}function v(n){if(n.slice)return n.slice(0);var t=new Uint8Array(n.byteLength);return t.set(new Uint8Array(n)),t.buffer}function P(){return this.bodyUsed=!1,this._initBody=function(n){if(this._bodyInit=n)if("string"==typeof n)this._bodyText=n;else if(u&&Blob.prototype.isPrototypeOf(n))this._bodyBlob=n;else if(i&&FormData.prototype.isPrototypeOf(n))this._bodyFormData=n;else if(t&&URLSearchParams.prototype.isPrototypeOf(n))this._bodyText=n.toString();else if(s&&u&&r(n))this._bodyArrayBuffer=v(n.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!s||!ArrayBuffer.prototype.isPrototypeOf(n)&&!c(n))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=v(n)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof n?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):t&&URLSearchParams.prototype.isPrototypeOf(n)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},u&&(this.blob=function(){var n=g(this);if(n)return n;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?g(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(w)}),this.text=function(){var n,t,e,i=g(this);if(i)return i;if(this._bodyBlob)return n=this._bodyBlob,t=new FileReader,e=p(t),t.readAsText(n),e;if(this._bodyArrayBuffer)return Promise.resolve(function(n){for(var t=new Uint8Array(n),e=new Array(t.length),i=0;i<t.length;i++)e[i]=String.fromCharCode(t[i]);return e.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i&&(this.formData=function(){return this.text().then(y)}),this.json=function(){return this.text().then(JSON.parse)},this}function b(n,t){var e,i,s=(t=t||{}).body;if(n instanceof b){if(n.bodyUsed)throw new TypeError("Already read");this.url=n.url,this.credentials=n.credentials,t.headers||(this.headers=new l(n.headers)),this.method=n.method,this.mode=n.mode,s||null==n._bodyInit||(s=n._bodyInit,n.bodyUsed=!0)}else this.url=String(n);if(this.credentials=t.credentials||this.credentials||"omit",!t.headers&&this.headers||(this.headers=new l(t.headers)),this.method=(e=t.method||this.method||"GET",i=e.toUpperCase(),-1<a.indexOf(i)?i:e),this.mode=t.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&s)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(s)}function y(n){var s=new FormData;return n.trim().split("&").forEach(function(n){if(n){var t=n.split("="),e=t.shift().replace(/\+/g," "),i=t.join("=").replace(/\+/g," ");s.append(decodeURIComponent(e),decodeURIComponent(i))}}),s}function N(n,t){t||(t={}),this.type="default",this.status="status"in t?t.status:200,this.ok=200<=this.status&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new l(t.headers),this.url=t.url||"",this._initBody(n)}}("undefined"!=typeof self?self:this);var fetch,isNode=!1;function Rehive(t){this.public={companies:[]},this.auth={password:{},email:{},mobile:{},tokens:{},mfa:{sms:{},token:{},status:{}}},this.user={addresses:[],bankAccounts:{},cryptoAccounts:{},documents:{},emails:{},mobiles:{}},this.transactions={totals:{}},this.transaction_collections={},this.accounts={currencies:{}},this.company={currencies:{},bankAccounts:{}},this.groups={},this.permissions={},this.admin={auth:{login:{},register:{}},accessControlRules:{},users:{overview:{},tiers:{},addresses:{},bankAccounts:{currencies:{}},settings:{},cryptoAccounts:{},documents:{},emails:{},mobiles:{},permissions:{},groups:{},kyc:{},mfa:{token:{},sms:{}}},requests:{},transactions:{totals:{}},transaction_collections:{},accounts:{currencies:{limits:{},fees:{},settings:{}}},account:{currencies:{},definitions:{groups:{currencies:{}}}},currencies:{overview:{},bankAccounts:{}},company:{settings:{},address:{},links:{}},bankAccounts:{currencies:{}},webhooks:{},subtypes:{},notifications:{},services:{},groups:{tiers:{requirements:{},limits:{},fees:{},settings:{}},permissions:{},accountConfigurations:{currencies:{}},settings:{}},webhookTasks:{requests:{}},exports:{sets:{}},metrics:{points:{}}};var u,n="3",i="public/companies/",s="auth/mfa/sms/",o="auth/mfa/token/",r="auth/tokens/",c="user/addresses/",a="user/bank-accounts/",f="user/crypto-accounts/",m="user/documents/",d="user/emails/",h="user/mobiles/",l="transactions/",g="transaction-collections/",p="accounts/",w="/currencies/",v="company/currencies/",P="permissions/",b="groups/",y={"Content-Type":"application/json",Accept:"application/json"},N="admin/users/",k="admin/access-control-rules/",A="/settings/",_="admin/users/overview/",T="/permissions/",x="/groups/",C="admin/users/addresses/",S="admin/users/bank-accounts/",E="admin/users/crypto-accounts/",R="admin/users/documents/",j="admin/users/emails/",q="admin/users/mobiles/",O="admin/transactions/",B="admin/exports/",I="admin/transaction-collections/",U="admin/accounts/",F="/currencies/",z="/limits/",D="/fees/",L="/settings/",M="admin/account-currencies/",G="admin/account-definitions/",H="admin/currencies/",J="/bank-accounts/",V="admin/company/",X="admin/company/links/",K="settings/",W="address/",$="admin/webhooks/",Q="admin/webhook-tasks/",Y="/requests/",Z="admin/subtypes/",nn="admin/notifications/",tn="/requirements/",en="/limits/",sn="/fees/",on="admin/bank-accounts/",un="admin/services/",rn="admin/groups/",cn="admin/requests/",an="/permissions/",fn="/settings/",mn="/tiers/",dn="/account-configurations/",hn="/currencies/",ln="/settings/",gn="admin/metrics/";t||(t={}),u=0<Object.keys(t).length?t.customAPIURL?t.customAPIURL:(n=t.apiVersion?t.apiVersion:"3",t.apiToken&&yn(t.apiToken),t.network&&"staging"==t.network?t.network="api.staging.rehive.com":t.network="api.rehive.com","https://"+t.network+"/"+n+"/"):(n="3",t.network="api.rehive.com","https://"+t.network+"/"+n+"/");var e,pn,wn,vn={},Pn={};function bn(n){var t=[];for(var e in n)n.hasOwnProperty(e)&&t.push(encodeURIComponent(e)+"="+encodeURIComponent(n[e]));return t.join("&")}function yn(n){if(t&&t.storageMethod){if(void 0===sessionStorage||void 0===localStorage)return void console.log("sessionStorage and localStorage not supported.");"local"===t.storageMethod?localStorage.setItem("token",n):"session"===t.storageMethod&&sessionStorage.setItem("token",n)}e=n}function Nn(){return t&&"local"===t.storageMethod?e=localStorage.getItem("token"):t&&"session"===t.storageMethod&&(e=sessionStorage.getItem("token")),e||""}function kn(){t&&"local"===t.storageMethod?e=localStorage.removeItem("token"):t&&"session"===t.storageMethod&&(e=sessionStorage.removeItem("token")),delete y.Authorization,e=""}function An(e){return e.json().then(function(t){return new Promise(function(n){e.ok||(t.status_code=e.status,t.ok=e.ok),n(t)})})}function _n(n){pn=n.next?n.next:null,wn=n.previous?n.previous:null}function Tn(n,t){n.next?vn[t]=n.next:delete vn[t],n.previous?Pn[t]=n.previous:delete Pn[t]}var xn=function(i,s,o){return new Promise(function(t,e){var n=Nn();n&&!o?y.Authorization="Token "+n:delete y.Authorization,fetch(u+i,{method:"POST",headers:y,body:JSON.stringify(s)}).then(An).then(function(n){"success"==n.status?n.data&&n.data.data?t(n.data.data):n.data?t(n.data):n.message?t({message:n.message}):t({}):"error"==n.status&&(n.data?e({status:n.status_code,message:n.message,data:n.data}):e({status:n.status_code,message:n.message}))})})},Cn=function(i,s){return new Promise(function(t,e){var n=s||Nn();n?y.Authorization="Token "+n:delete y.Authorization,fetch(u+i,{method:"GET",headers:y}).then(An).then(function(n){"success"==n.status?n.data&&n.data.data?t(n.data.data):n.data?t(n.data):n.message?t({message:n.message}):t({}):"error"==n.status&&(n.data?e({status:n.status_code,message:n.message,data:n.data}):e({status:n.status_code,message:n.message}))})})},Sn=function(i,s){return new Promise(function(t,e){var n=Nn();n?y.Authorization="Token "+n:delete y.Authorization,!isNode&&s instanceof FormData?delete y["Content-Type"]:(y["Content-Type"]="application/json",s=JSON.stringify(s)),fetch(u+i,{method:"PATCH",headers:y,body:s}).then(An).then(function(n){y["Content-Type"]="application/json","success"==n.status?n.data&&n.data.data?t(n.data.data):n.data?t(n.data):n.message?t({message:n.message}):t({}):"error"==n.status&&(n.data?e({status:n.status_code,message:n.message,data:n.data}):e({status:n.status_code,message:n.message}))})})},En=function(i,s){return new Promise(function(t,e){var n=Nn();n?y.Authorization="Token "+n:delete y.Authorization,fetch(u+i,{method:"DELETE",headers:y,body:JSON.stringify(s)}).then(An).then(function(n){"success"==n.status?n.data&&n.data.data?t(n.data.data):n.data?t(n.data):n.message?t({message:n.message}):t({}):"error"==n.status&&(n.data?e({status:n.status_code,message:n.message,data:n.data}):e({status:n.status_code,message:n.message}))})})};this.removeToken=function(){return t&&"local"===t.storageMethod?e=localStorage.removeItem("token"):t&&"session"===t.storageMethod&&(e=sessionStorage.removeItem("token")),delete y.Authorization,e="","Token removed"},this.public.companies.get=function(n){return new Promise(function(t,e){Cn(n?i+n+"/":i).then(function(n){t(n)},function(n){e(n)})})},this.auth.register=function(n){return new Promise(function(t,e){fetch(u+"auth/register/",{method:"POST",headers:y,body:JSON.stringify(n)}).then(An).then(function(n){"success"==n.status?(yn(n.data.token),t({user:n.data.user,token:n.data.token})):"error"==n.status&&(n.data?e({status:n.status_code,message:n.message,data:n.data}):e({status:n.status_code,message:n.message}))})})},this.auth.registerCompany=function(n){return new Promise(function(t,e){fetch(u+"auth/company/register/",{method:"POST",headers:y,body:JSON.stringify(n)}).then(An).then(function(n){"success"==n.status?(yn(n.data.token),t(n.data.user)):"error"==n.status&&(n.data?e({status:n.status_code,message:n.message,data:n.data}):e({status:n.status_code,message:n.message}))})})},this.auth.login=function(n){return new Promise(function(t,e){fetch(u+"auth/login/",{method:"POST",headers:y,body:JSON.stringify(n)}).then(An).then(function(n){"success"==n.status?(yn(n.data.token),t({user:n.data.user,token:n.data.token,mfa:void 0!==n.data.mfa?n.data.mfa:null})):"error"==n.status&&(n.data?e({status:n.status_code,message:n.message,data:n.data}):e({status:n.status_code,message:n.message}))})})},this.auth.logout=function(){return new Promise(function(t,e){var n=Nn();n?y.Authorization="Token "+n:delete y.Authorization,fetch(u+"auth/logout/",{method:"POST",headers:y}).then(An).then(function(n){"success"==n.status?(kn(),t({})):"error"==n.status&&(n.data?e(n.data):e({status:n.status_code,message:n.message}))})})},this.auth.logoutAll=function(){return new Promise(function(t,e){var n=Nn();n?y.Authorization="Token "+n:delete y.Authorization,fetch(u+"auth/logout/all/",{method:"POST",headers:y}).then(An).then(function(n){"success"==n.status?(kn(),t({})):"error"==n.status&&(n.data?e({status:n.status_code,message:n.message,data:n.data}):e({status:n.status_code,message:n.message}))})})},this.auth.password.change=function(n){return new Promise(function(t,e){xn("auth/password/change/",n).then(function(n){t(n)},function(n){e(n)})})},this.auth.password.reset=function(n){return new Promise(function(t,e){xn("auth/password/reset/",n,!0).then(function(n){t(n)},function(n){e(n)})})},this.auth.password.resetConfirm=function(n){return new Promise(function(t,e){xn("auth/password/reset/confirm/",n,!0).then(function(n){t(n)},function(n){e(n)})})},this.auth.email.resendEmailVerification=function(n){return new Promise(function(t,e){xn("auth/email/verify/resend/",n,!0).then(function(n){t(n)},function(n){e(n)})})},this.auth.mobile.resendMobileVerification=function(n){return new Promise(function(t,e){xn("auth/mobile/verify/resend/",n).then(function(n){t(n)},function(n){e(n)})})},this.auth.mobile.verify=function(n){return new Promise(function(t,e){xn("auth/mobile/verify/",n).then(function(n){t(n)},function(n){e(n)})})},this.auth.email.verify=function(n){return new Promise(function(t,e){xn("auth/email/verify/",n).then(function(n){t(n)},function(n){e(n)})})},this.auth.tokens.get=function(n){var i;return i=n?r+n:r,new Promise(function(t,e){Cn(i).then(function(n){t(n)},function(n){e(n)})})},this.auth.tokens.create=function(n){return new Promise(function(t,e){xn(r,n).then(function(n){t(n)},function(n){e(n)})})},this.auth.tokens.delete=function(i){return new Promise(function(t,e){var n;i?n=r+i:e({status:"error",message:"A token is required"}),En(n,{}).then(function(n){t(n)},function(n){e(n)})})},this.auth.tokens.verify=function(n){return new Promise(function(t,e){Cn("auth/",n).then(function(n){t(n)},function(n){e(n)})})},this.auth.mfa.status.get=function(){return new Promise(function(t,e){Cn("auth/mfa/").then(function(n){t(n)},function(n){e(n)})})},this.auth.mfa.sms.get=function(){return new Promise(function(t,e){Cn(s).then(function(n){t(n)},function(n){e(n)})})},this.auth.mfa.sms.enable=function(n){return new Promise(function(t,e){xn(s,n).then(function(n){t(n)},function(n){e(n)})})},this.auth.mfa.sms.send=function(n){return new Promise(function(t,e){xn("auth/mfa/sms/send/",n).then(function(n){t(n)},function(n){e(n)})})},this.auth.mfa.sms.disable=function(n){return new Promise(function(t,e){En(s,n).then(function(n){t(n)},function(n){e(n)})})},this.auth.mfa.token.get=function(){return new Promise(function(t,e){Cn(o).then(function(n){t(n)},function(n){e(n)})})},this.auth.mfa.token.enable=function(n){return new Promise(function(t,e){xn(o,n).then(function(n){t(n)},function(n){e(n)})})},this.auth.mfa.token.disable=function(){return new Promise(function(t,e){En(o).then(function(n){t(n)},function(n){e(n)})})},this.auth.mfa.verify=function(n){return new Promise(function(t,e){xn("auth/mfa/verify/",n).then(function(n){t(n)},function(n){e(n)})})},this.transactions.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?l+s.id+"/":s&&s.filters?(i="?"+bn(s.filters),l+i):l,Cn(n).then(function(n){Tn(n,"Transaction"),t(n)},function(n){e(n)})})},this.transactions.getNext=function(){return new Promise(function(t,e){var n,i=vn.Transaction;i?(n=i.split(u)[1],Cn(n).then(function(n){Tn(n,"Transaction"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.transactions.getPrevious=function(){return new Promise(function(t,e){var n,i=Pn.Transaction;i?(n=i.split(u)[1],Cn(n).then(function(n){Tn(n,"Transaction"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.transactions.totals.get=function(n){return new Promise(function(t,e){n=n?"?"+bn(n):"",Cn(l+"totals/"+n).then(function(n){t(n)},function(n){e(n)})})},this.transactions.createDebit=function(n){return new Promise(function(t,e){xn("transactions/debit/",n).then(function(n){t(n)},function(n){e(n)})})},this.transactions.createCredit=function(n){return new Promise(function(t,e){xn("transactions/credit/",n).then(function(n){t(n)},function(n){e(n)})})},this.transactions.createTransfer=function(n){return new Promise(function(t,e){xn("transactions/transfer/",n).then(function(n){t(n)},function(n){e(n)})})},this.transaction_collections.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?g+s.id+"/":s&&s.filters?(i="?"+bn(s.filters),g+i):g,Cn(n).then(function(n){Tn(n,"Transaction Collection"),t(n)},function(n){e(n)})})},this.transaction_collections.getNext=function(){return new Promise(function(t,e){var n,i=vn["Transaction Collection"];i?(n=i.split(u)[1],Cn(n).then(function(n){Tn(n,"Transaction Collection"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.transaction_collections.getPrevious=function(){return new Promise(function(t,e){var n,i=Pn["Transaction Collection"];i?(n=i.split(u)[1],Cn(n).then(function(n){Tn(n,"Transaction Collection"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.transaction_collections.create=function(n){return new Promise(function(t,e){xn(g,n).then(function(n){t(n)},function(n){e(n)})})},this.accounts.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.reference?p+s.reference+"/":s&&s.filters?(i="?"+bn(s.filters),p+i):p,Cn(n).then(function(n){Tn(n,"Account"),t(n)},function(n){e(n)})})},this.accounts.getNext=function(){return new Promise(function(t,e){var n,i=vn.Account;i?(n=i.split(u)[1],Cn(n).then(function(n){Tn(n,"Account"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.accounts.getPrevious=function(){return new Promise(function(t,e){var n,i=Pn.Account;i?(n=i.split(u)[1],Cn(n).then(function(n){Tn(n,"Account"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.accounts.create=function(n){return new Promise(function(t,e){xn(p,n).then(function(n){t(n)},function(n){e(n)})})},this.accounts.currencies.get=function(s,o){return new Promise(function(t,e){var n,i;s&&"string"==typeof s?(n=o&&o.code?p+s+w+o.code+"/":o&&o.filters?(i="?"+bn(o.filters),p+s+w+i):p+s+w,Cn(n).then(function(n){Tn(n,"AccountCurrencies"),t(n)},function(n){e(n)})):e({status:"error",message:"Reference is required"})})},this.accounts.currencies.getNext=function(){return new Promise(function(t,e){var n,i=vn.AccountCurrencies;i?(n=i.split(u)[1],Cn(n).then(function(n){Tn(n,"AccountCurrencies"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.accounts.currencies.getPrevious=function(){return new Promise(function(t,e){var n,i=Pn.AccountCurrencies;i?(n=i.split(u)[1],Cn(n).then(function(n){Tn(n,"AccountCurrencies"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.accounts.currencies.update=function(n,i,s){return new Promise(function(t,e){n&&"string"==typeof n?i&&"string"==typeof i?Sn(p+n+w+i+"/",s).then(function(n){t(n)},function(n){e(n)}):e({status:"error",message:"Currency Code is required"}):e({status:"error",message:"Reference is required"})})},this.company.get=function(){return new Promise(function(t,e){Cn("company/").then(function(n){t(n)},function(n){e(n)})})},this.company.currencies.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.code?v+s.code+"/":s&&s.filters?(i="?"+bn(s.filters),v+i):v,Cn(n).then(function(n){Tn(n,"CompanyCurrencies"),t(n)},function(n){e(n)})})},this.company.currencies.getNext=function(){return new Promise(function(t,e){var n,i=vn.CompanyCurrencies;i?(n=i.split(u)[1],Cn(n).then(function(n){Tn(n,"CompanyCurrencies"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.company.currencies.getPrevious=function(){return new Promise(function(t,e){var n,i=Pn.CompanyCurrencies;i?(n=i.split(u)[1],Cn(n).then(function(n){Tn(n,"CompanyCurrencies"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.company.bankAccounts.get=function(){return new Promise(function(t,e){Cn("company/bank-accounts/").then(function(n){t(n)},function(n){e(n)})})},this.permissions.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?P+s.id+"/":s&&s.filters?(i="?"+bn(s.filters),P+i):P,Cn(n).then(function(n){Tn(n,"Permissions"),t(n)},function(n){e(n)})})},this.permissions.getNext=function(){return new Promise(function(t,e){var n,i=vn.Permissions;i?(n=i.split(u)[1],Cn(n).then(function(n){Tn(n,"Permissions"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.permissions.getPrevious=function(){return new Promise(function(t,e){var n,i=Pn.Permissions;i?(n=i.split(u)[1],Cn(n).then(function(n){Tn(n,"Permissions"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.groups.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.name?b+s.name+"/":s&&s.filters?(i="?"+bn(s.filters),b+i):b,Cn(n).then(function(n){Tn(n,"Groups"),t(n)},function(n){e(n)})})},this.groups.getNext=function(){return new Promise(function(t,e){var n,i=vn.Groups;i?(n=i.split(u)[1],Cn(n).then(function(n){Tn(n,"Groups"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.groups.getPrevious=function(){return new Promise(function(t,e){var n,i=Pn.Groups;i?(n=i.split(u)[1],Cn(n).then(function(n){Tn(n,"CompanyCurrencies"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.user.get=function(){return new Promise(function(t,e){Cn("user/").then(function(n){t(n)},function(n){e(n)})})},this.user.update=function(n){return new Promise(function(t,e){Sn("user/",n).then(function(n){t(n)},function(n){e(n)})})},this.user.addresses.get=function(n){return new Promise(function(t,e){Cn(n?c+n:c).then(function(n){t(n)},function(n){e(n)})})},this.user.addresses.update=function(i){return new Promise(function(t,e){var n;i.id?n=c+i.id+"/":e({status:400,message:"No id has been given"}),Sn(n,i).then(function(n){t(n)},function(n){e(n)})})},this.user.addresses.create=function(n){return new Promise(function(t,e){xn(c,n).then(function(n){t(n)},function(n){e(n)})})},this.user.addresses.delete=function(n){return new Promise(function(t,e){n?En(c+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.user.bankAccounts.get=function(n){return new Promise(function(t,e){Cn(n?a+n+"/":a).then(function(n){t(n)},function(n){e(n)})})},this.user.bankAccounts.create=function(n){return new Promise(function(t,e){xn(a,n).then(function(n){t(n)},function(n){e(n)})})},this.user.bankAccounts.update=function(n,i){return new Promise(function(t,e){n?Sn(a+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:"error",message:"Account id is required"})})},this.user.bankAccounts.delete=function(n){return new Promise(function(t,e){n?En(a+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:"error",message:"Bank id is required"})})},this.user.cryptoAccounts.get=function(n){return new Promise(function(t,e){Cn(n?f+n+"/":f).then(function(n){t(n)},function(n){e(n)})})},this.user.cryptoAccounts.create=function(n){return new Promise(function(t,e){xn(f,n).then(function(n){t(n)},function(n){e(n)})})},this.user.cryptoAccounts.update=function(n,i){return new Promise(function(t,e){n?Sn(f+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:"error",message:"Crypto account id is required"})})},this.user.cryptoAccounts.delete=function(n){return new Promise(function(t,e){n?En(f+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:"error",message:"Crypto account id is required"})})},this.user.documents.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?m+s.id+"/":s&&s.filters?(i="?"+bn(s.filters),m+i):m,Cn(n).then(function(n){Tn(n,"Documents"),t(n)},function(n){e(n)})})},this.user.documents.getNext=function(){return new Promise(function(t,e){var n,i=vn.Documents;i?(n=i.split(u)[1],Cn(n).then(function(n){Tn(n,"Documents"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.user.documents.getPrevious=function(){return new Promise(function(t,e){var n,i=Pn.Documents;i?(n=i.split(u)[1],Cn(n).then(function(n){Tn(n,"Documents"),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.user.documents.create=function(s){return new Promise(function(t,e){var n=Nn(),i={};n?i.Authorization="Token "+n:delete i.Authorization,fetch(u+m,{method:"POST",headers:i,body:s}).then(An).then(function(n){"success"==n.status?n.data&&n.data.data?t(n.data.data):n.data?t(n.data):t(n):"error"==n.status&&(n.data?e(n.data):e({status:n.status_code,message:n.message}))})})},this.user.emails.get=function(n){return new Promise(function(t,e){Cn(n?d+n+"/":d).then(function(n){t(n)},function(n){e(n)})})},this.user.emails.create=function(n){return new Promise(function(t,e){xn(d,n).then(function(n){t(n)},function(n){e(n)})})},this.user.emails.update=function(n,i){return new Promise(function(t,e){n&&i?Sn(d+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:"error",message:"Email address id is required"},null)})},this.user.emails.delete=function(n){return new Promise(function(t,e){n?En(d+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:"error",message:"Email address id is required"})})},this.user.mobiles.get=function(n){return new Promise(function(t,e){Cn(n?h+n+"/":h).then(function(n){t(n)},function(n){e(n)})})},this.user.mobiles.create=function(n){return new Promise(function(t,e){xn(h,n).then(function(n){t(n)},function(n){e(n)})})},this.user.mobiles.update=function(n,i){return new Promise(function(t,e){n&&i?Sn(h+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:"error",message:"Mobile number id is required"})})},this.user.mobiles.delete=function(n){return new Promise(function(t,e){n?En(h+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:"error",message:"Mobile number id is required"})})},this.admin.auth.login=function(n){return new Promise(function(t,e){xn("admin/auth/login/",n).then(function(n){t(n)},function(n){e(n)})})},this.admin.auth.register=function(n){return new Promise(function(t,e){xn("admin/auth/register/",n).then(function(n){t(n)},function(n){e(n)})})},this.admin.metrics.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?gn+s.id+"/":s&&s.filters?(i="?"+bn(s.filters),gn+i):gn,Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.metrics.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.metrics.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.metrics.create=function(n){return new Promise(function(t,e){xn(gn,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.metrics.delete=function(n){return new Promise(function(t,e){n?En(gn+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.metrics.points.get=function(i,s){return new Promise(function(t,e){var n;i?(n=gn+i+"/points/",s.filters&&(n+="?"+bn(s.filters)),Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"No id has been given"})})},this.admin.metrics.points.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.metrics.points.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.exports.sets.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?B+s.id+"/":s&&s.filters?(i="?"+bn(s.filters),B+i):B,Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.exports.sets.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.exports.sets.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.exports.sets.create=function(n){return new Promise(function(t,e){xn(B,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.exports.sets.delete=function(n){return new Promise(function(t,e){n?En(B+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.accessControlRules.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?k+s.id+"/":s&&s.filters?(i="?"+bn(s.filters),k+i):k,Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.accessControlRules.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.accessControlRules.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.accessControlRules.create=function(n){return new Promise(function(t,e){n?xn(k,n).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No data has been given"})})},this.admin.accessControlRules.update=function(n,i){return new Promise(function(t,e){n?Sn(k+n,i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.accessControlRules.delete=function(n){return new Promise(function(t,e){n?En(k+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.overview.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.filters?(i="?"+bn(s.filters),_+i):_,Cn(n).then(function(n){t(n)},function(n){e(n)})})},this.admin.users.settings.get=function(n){return new Promise(function(t,e){n?Cn(N+n+A).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.settings.update=function(n,i){return new Promise(function(t,e){n?Sn(N+n+A,i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.kyc.get=function(n){return new Promise(function(t,e){n?Cn(N+n+"/kyc/").then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.kyc.update=function(n,i){return new Promise(function(t,e){n?Sn(N+n+"/kyc/",i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?N+s.id+"/":s&&s.filters?(i="?"+bn(s.filters),N+i):N,Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.users.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.create=function(i){return new Promise(function(t,e){var n=Nn();n?y.Authorization="Token "+n:delete y.Authorization,!isNode&&i instanceof FormData?delete y["Content-Type"]:i=JSON.stringify(i),fetch(u+N,{method:"POST",headers:y,body:i}).then(An).then(function(n){y["Content-Type"]="application/json","success"==n.status?n.data&&n.data.data?t(n.data.data):n.data?t(n.data):t(n):"error"==n.status&&(n.data?e(n.data):e({status:n.status_code,message:n.message}))})})},this.admin.users.update=function(s,o){return new Promise(function(t,e){if(s){var n=Nn(),i={};n?i.Authorization="Token "+n:delete i.Authorization,fetch(u+N+s+"/",{method:"PATCH",headers:i,body:o}).then(An).then(function(n){"success"==n.status?n.data&&n.data.data?t(n.data.data):n.data?t(n.data):t(n):"error"==n.status&&(n.data?e(n.data):e({status:n.status_code,message:n.message}))})}else e({status:400,message:"No id has been given"})})},this.admin.users.delete=function(n){return new Promise(function(t,e){n?En(N+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.permissions.get=function(s,o){return new Promise(function(t,e){var n,i;s?(n=o&&o.id?N+s+T+o.id+"/":o&&o.filters?(i="?"+bn(o.filters),N+s+T+i):N+s+T,Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"No id has been given"})})},this.admin.users.permissions.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.permissions.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.permissions.create=function(n,i){return new Promise(function(t,e){xn(N+n+T,i).then(function(n){t(n)},function(n){e(n)})})},this.admin.users.permissions.delete=function(n,i){return new Promise(function(t,e){En(N+n+T+i+"/",{}).then(function(n){t(n)},function(n){e(n)})})},this.admin.users.groups.get=function(s,o){return new Promise(function(t,e){var n,i;s?(n=o&&o.name?N+s+x+o.name+"/":o&&o.filters?(i="?"+bn(o.filters),N+s+x+i):N+s+x,Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"No id has been given"})})},this.admin.users.groups.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.groups.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.groups.create=function(n,i){return new Promise(function(t,e){xn(N+n+x,i).then(function(n){t(n)},function(n){e(n)})})},this.admin.users.groups.delete=function(n,i){return new Promise(function(t,e){En(N+n+x+i+"/",{}).then(function(n){t(n)},function(n){e(n)})})},this.admin.users.addresses.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?C+s.id+"/":s&&s.filters?(i="?"+bn(s.filters),C+i):C,Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.users.addresses.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.addresses.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.addresses.create=function(n){return new Promise(function(t,e){xn(C,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.users.addresses.update=function(n,i){return new Promise(function(t,e){n?Sn(C+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.addresses.delete=function(n){return new Promise(function(t,e){n?En(C+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.bankAccounts.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?S+s.id+"/":s&&s.filters?(i="?"+bn(s.filters),S+i):S,Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.users.bankAccounts.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.bankAccounts.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.bankAccounts.create=function(n){return new Promise(function(t,e){xn(S,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.users.bankAccounts.update=function(n,i){return new Promise(function(t,e){n?Sn(S+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.bankAccounts.delete=function(n){return new Promise(function(t,e){n?En(S+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.bankAccounts.currencies.get=function(s,o){return new Promise(function(t,e){var n,i;n=o&&o.code?S+s+"/currencies/"+o.code+"/":o&&o.filters?(i="?"+bn(o.filters),S+s+"/currencies/"+i):S+s+"/currencies/",Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.users.bankAccounts.currencies.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.bankAccounts.currencies.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.bankAccounts.currencies.create=function(n,i){return new Promise(function(t,e){n?xn(S+n+"/currencies/",i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.bankAccounts.currencies.update=function(n,i,s){return new Promise(function(t,e){n?i?Sn(S+n+"/currencies/"+i+"/",s).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No currency code has been given"}):e({status:400,message:"No id has been given"})})},this.admin.users.bankAccounts.currencies.delete=function(n,i){return new Promise(function(t,e){n?i?En(S+n+"/currencies/"+i+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No currency code has been given"}):e({status:400,message:"No id has been given"})})},this.admin.users.cryptoAccounts.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?E+s.id+"/":s&&s.filters?(i="?"+bn(s.filters),E+i):E,Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.users.cryptoAccounts.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.cryptoAccounts.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.cryptoAccounts.create=function(n){return new Promise(function(t,e){xn(E,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.users.cryptoAccounts.update=function(n,i){return new Promise(function(t,e){n?Sn(E+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.cryptoAccounts.delete=function(n){return new Promise(function(t,e){n?En(E+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.documents.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?R+s.id+"/":s&&s.filters?(i="?"+bn(s.filters),R+i):R,Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.users.documents.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.documents.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.documents.create=function(s){return new Promise(function(t,e){var n=Nn(),i={};n?i.Authorization="Token "+n:delete i.Authorization,fetch(u+R,{method:"POST",headers:i,body:s}).then(An).then(function(n){"success"==n.status?n.data&&n.data.data?t(n.data.data):n.data?t(n.data):t(n):"error"==n.status&&(n.data?e(n.data):e({status:n.status_code,message:n.message}))})})},this.admin.users.documents.update=function(s,o){return new Promise(function(t,e){if(s){var n=Nn(),i={};n?i.Authorization="Token "+n:delete i.Authorization,fetch(u+R+s+"/",{method:"PATCH",headers:i,body:o}).then(An).then(function(n){"success"==n.status?n.data&&n.data.data?t(n.data.data):n.data?t(n.data):t(n):"error"==n.status&&(n.data?e(n.data):e({status:n.status_code,message:n.message}))})}else e({status:400,message:"No id has been given"})})},this.admin.users.documents.delete=function(n){return new Promise(function(t,e){n?En(R+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.emails.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?j+s.id+"/":s&&s.filters?(i="?"+bn(s.filters),j+i):j,Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.users.emails.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.emails.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.emails.create=function(n){return new Promise(function(t,e){xn(j,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.users.emails.update=function(n,i){return new Promise(function(t,e){n?Sn(j+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.emails.delete=function(n){return new Promise(function(t,e){n?En(j+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.mobiles.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?q+s.id+"/":s&&s.filters?(i="?"+bn(s.filters),q+i):q,Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.users.mobiles.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.mobiles.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.users.mobiles.create=function(n){return new Promise(function(t,e){xn(q,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.users.mobiles.update=function(n,i){return new Promise(function(t,e){n?Sn(q+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.mobiles.delete=function(n){return new Promise(function(t,e){n?En(q+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.mfa.get=function(n){return new Promise(function(t,e){n?Cn(N+n+"/mfa/").then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.mfa.sms.delete=function(n){return new Promise(function(t,e){n?En(N+n+"/mfa/sms/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.users.mfa.token.delete=function(n){return new Promise(function(t,e){n?En(N+n+"/mfa/token/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.transactions.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?O+s.id+"/":s&&s.filters?(i="?"+bn(s.filters),O+i):O,Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.transactions.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.transactions.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.transactions.totals.get=function(i){return new Promise(function(t,e){var n;n=i?"?"+bn(i.filters):"",Cn("admin/transactions/totals/"+n).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.transactions.update=function(n,i){return new Promise(function(t,e){n?Sn(O+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.transactions.createCredit=function(n){return new Promise(function(t,e){xn("admin/transactions/credit/",n).then(function(n){t(n)},function(n){e(n)})})},this.admin.transactions.createDebit=function(n){return new Promise(function(t,e){xn("admin/transactions/debit/",n).then(function(n){t(n)},function(n){e(n)})})},this.admin.transactions.createTransfer=function(n){return new Promise(function(t,e){xn("admin/transactions/transfer/",n).then(function(n){t(n)},function(n){e(n)})})},this.admin.transaction_collections.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?I+s.id+"/":s&&s.filters?(i="?"+bn(s.filters),I+i):I,Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.transaction_collections.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.transaction_collections.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.transaction_collections.create=function(n){return new Promise(function(t,e){xn(I,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.transaction_collections.update=function(n,i){return new Promise(function(t,e){n?Sn(I+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No reference has been given"})})},this.admin.transaction_collections.delete=function(n){return new Promise(function(t,e){n?En(I+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.accounts.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.reference?U+s.reference+"/":s&&s.filters?(i="?"+bn(s.filters),U+i):U,Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.accounts.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.accounts.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.account.definitions.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.name?G+s.name+"/":s&&s.filters?(i="?"+bn(s.filters),G+i):G,Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.account.definitions.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.account.definitions.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.account.definitions.create=function(n){return new Promise(function(t,e){xn(G,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.account.definitions.update=function(n,i){return new Promise(function(t,e){n?Sn(G+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No account name has been given"})})},this.admin.account.definitions.delete=function(n){return new Promise(function(t,e){n?En(G+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No account name has been given"})})},this.admin.account.definitions.groups.get=function(s,o){return new Promise(function(t,e){var n,i;s?(n=o&&o.name?G+s+"/groups/"+o.name+"/":o&&o.filters?(i="?"+bn(o.filters),G+s+"/groups/"+i):G+s+"/groups/",Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"No account name has been given"})})},this.admin.account.definitions.groups.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.account.definitions.groups.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.account.definitions.groups.create=function(n,i){return new Promise(function(t,e){n?xn(G+n+"/groups/",i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No account name has been given"})})},this.admin.account.definitions.groups.update=function(n,i,s){return new Promise(function(t,e){n?i?Sn(G+n+"/groups/"+i+"/",s).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No group name has been given"}):e({status:400,message:"No account name has been given"})})},this.admin.account.definitions.groups.delete=function(n,i){return new Promise(function(t,e){n?i?En(G+n+"/groups/"+i+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No group name has been given"}):e({status:400,message:"No account name has been given"})})},this.admin.account.definitions.groups.currencies.get=function(s,o,u){return new Promise(function(t,e){var n,i;s?o?(n=u&&u.code?G+s+"/groups/"+o+"/currencies/"+u.code+"/":u&&u.filters?(i="?"+bn(u.filters),G+s+"/groups/"+o+"/currencies/"+i):G+s+"/groups/"+o+"/currencies/",Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"No group name has been given"}):e({status:400,message:"No account name has been given"})})},this.admin.account.definitions.groups.currencies.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.account.definitions.groups.currencies.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.account.definitions.groups.currencies.create=function(n,i,s){return new Promise(function(t,e){n?i?xn(G+n+"/groups/"+i+"/currencies/",s).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No group name has been given"}):e({status:400,message:"No account name has been given"})})},this.admin.account.definitions.groups.currencies.update=function(n,i,s,o){return new Promise(function(t,e){n?i?s?Sn(G+n+"/groups/"+i+"/currencies/"+s+"/",o).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No currency code has been given"}):e({status:400,message:"No group name has been given"}):e({status:400,message:"No account name has been given"})})},this.admin.account.definitions.groups.currencies.delete=function(n,i,s){return new Promise(function(t,e){n?i?s?En(G+n+"/groups/"+i+"/currencies/"+s+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No currency code has been given"}):e({status:400,message:"No group name has been given"}):e({status:400,message:"No account name has been given"})})},this.admin.account.currencies.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.reference?M+s.reference+"/":s&&s.filters?(i="?"+bn(s.filters),M+i):M,Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.account.currencies.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.account.currencies.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.accounts.create=function(n){return new Promise(function(t,e){xn(U,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.accounts.update=function(n,i){return new Promise(function(t,e){n?Sn(U+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No reference has been given"})})},this.admin.accounts.currencies.get=function(s,o){return new Promise(function(t,e){var n,i;s?(n=o&&o.code?U+s+F+o.code+"/":o&&o.filters?(i="?"+bn(o.filters),U+s+F+i):U+s+F,Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"No reference has been given"})})},this.admin.accounts.currencies.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.accounts.currencies.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.accounts.currencies.create=function(n,i){return new Promise(function(t,e){xn(U+n+F,i).then(function(n){t(n)},function(n){e(n)})})},this.admin.accounts.currencies.update=function(n,i,s){return new Promise(function(t,e){n&&i?Sn(U+n+F+i+"/",s).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No reference or code has been given"})})},this.admin.accounts.currencies.limits.get=function(i,s,o){return new Promise(function(t,e){var n;i&&s?(n=o&&o.id?U+i+F+s+z+o.id+"/":U+i+F+s+z,Cn(n).then(function(n){t(n)},function(n){e(n)})):e({status:400,message:"No reference or code has been given"})})},this.admin.accounts.currencies.limits.create=function(n,i,s){return new Promise(function(t,e){xn(U+n+F+i+z,s).then(function(n){t(n)},function(n){e(n)})})},this.admin.accounts.currencies.limits.update=function(n,i,s,o){return new Promise(function(t,e){n&&i&&s?Sn(U+n+F+i+z+s+"/",o).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No reference or code or id has been given"})})},this.admin.accounts.currencies.limits.delete=function(n,i,s){return new Promise(function(t,e){n&&i&&s?En(U+n+F+i+z+s+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No reference or code or id has been given"})})},this.admin.accounts.currencies.fees.get=function(i,s,o){return new Promise(function(t,e){var n;i&&s?(n=o&&o.id?U+i+F+s+D+o.id+"/":U+i+F+s+D,Cn(n).then(function(n){t(n)},function(n){e(n)})):e({status:400,message:"No reference or code has been given"})})},this.admin.accounts.currencies.fees.create=function(n,i,s){return new Promise(function(t,e){xn(U+n+F+i+D,s).then(function(n){t(n)},function(n){e(n)})})},this.admin.accounts.currencies.fees.update=function(n,i,s,o){return new Promise(function(t,e){n&&i&&s?Sn(U+n+F+i+D+s+"/",o).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No reference or code or id has been given"})})},this.admin.accounts.currencies.fees.delete=function(n,i,s){return new Promise(function(t,e){n&&i&&s?En(U+n+F+i+D+s+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No reference or code or id has been given"})})},this.admin.accounts.currencies.settings.get=function(n,i){return new Promise(function(t,e){n&&i?Cn(U+n+F+i+L).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No reference or code has been given"})})},this.admin.accounts.currencies.settings.update=function(n,i,s){return new Promise(function(t,e){n&&i?Sn(U+n+F+i+L,s).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No reference or code has been given"})})},this.admin.currencies.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.code?H+s.code+"/":s&&s.filters?(i="?"+bn(s.filters),H+i):H,Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.currencies.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.currencies.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.currencies.create=function(n){return new Promise(function(t,e){xn(H,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.currencies.update=function(n,i){return new Promise(function(t,e){if(!n)return currencies.update,void e({status:400,message:"No code has been given"});Sn(H+n+"/",i).then(function(n){t(n)},function(n){e(n)})})},this.admin.currencies.delete=function(n){return new Promise(function(t,e){n?En(H+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No code has been given"})})},this.admin.currencies.overview.get=function(n){return new Promise(function(t,e){n||e({status:400,message:"No code provided"}),Cn(H+n+"/overview/").then(function(n){t(n)},function(n){e(n)})})},this.admin.currencies.bankAccounts.get=function(s,o){return new Promise(function(t,e){var n,i;n=o&&o.id?H+s+J+o.id+"/":o&&o.filters?(i="?"+bn(o.filters),H+s+J+i):H+s+J,Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.currencies.bankAccounts.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.currencies.bankAccounts.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.currencies.bankAccounts.create=function(n,i){return new Promise(function(t,e){xn(H+n+J,i).then(function(n){t(n)},function(n){e(n)})})},this.admin.currencies.bankAccounts.delete=function(n,i){return new Promise(function(t,e){En(H+n+J+i+"/").then(function(n){t(n)},function(n){e(n)})})},this.admin.company.get=function(){return new Promise(function(t,e){Cn(V).then(function(n){t(n)},function(n){e(n)})})},this.admin.company.update=function(n){return new Promise(function(t,e){Sn(V,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.company.settings.get=function(){return new Promise(function(t,e){Cn(V+K).then(function(n){t(n)},function(n){e(n)})})},this.admin.company.settings.update=function(n){return new Promise(function(t,e){Sn(V+K,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.company.address.get=function(){return new Promise(function(t,e){Cn(V+W).then(function(n){t(n)},function(n){e(n)})})},this.admin.company.address.update=function(n){return new Promise(function(t,e){Sn(V+W,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.company.links.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?X+s.id+"/":s&&s.filters?(i="?"+bn(s.filters),X+i):X,Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.company.links.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.company.links.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.company.links.create=function(n){return new Promise(function(t,e){xn(X,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.company.links.update=function(n,i){return new Promise(function(t,e){n?Sn(X+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.company.links.delete=function(n){return new Promise(function(t,e){n?En(X+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.bankAccounts.get=function(n){var i;return i=n&&n.id?on+n.id+"/":on,new Promise(function(t,e){Cn(i).then(function(n){t(n)},function(n){e(n)})})},this.admin.bankAccounts.create=function(n){return new Promise(function(t,e){xn(on,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.bankAccounts.update=function(n,i){return new Promise(function(t,e){Sn(on+n+"/",i).then(function(n){t(n)},function(n){e(n)})})},this.admin.bankAccounts.delete=function(n){return new Promise(function(t,e){En(on+n+"/",{}).then(function(n){t(n)},function(n){e(n)})})},this.admin.bankAccounts.currencies.get=function(i,s){return new Promise(function(t,e){if(i){var n=on+i+"/currencies/";s&&(n+=s),Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})}else e({status:400,message:"No bank ID has been given"})})},this.admin.bankAccounts.currencies.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){n.next&&_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.bankAccounts.currencies.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.bankAccounts.currencies.create=function(n,i){if(i.currency)return new Promise(function(t,e){xn(on+n+"/currencies/",i).then(function(n){t(n)},function(n){e(n)})});reject({status:400,message:"No currency has been given"})},this.admin.bankAccounts.currencies.delete=function(n,i){if(n){if(i)return new Promise(function(t,e){En(on+n+"/currencies/"+i,{}).then(function(n){t(n)},function(n){e(n)})});reject({status:400,message:"No currency has been given"})}else reject({status:400,message:"No bank ID has been given"})},this.admin.webhooks.get=function(n){var i,t;return i=n&&n.id?$+n.id+"/":n&&n.filters?(t="?"+bn(n.filters),$+t):$,new Promise(function(t,e){Cn(i).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.webhooks.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.webhooks.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.webhooks.create=function(n){return new Promise(function(t,e){xn($,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.webhooks.update=function(n,i){return new Promise(function(t,e){Sn($+n+"/",i).then(function(n){t(n)},function(n){e(n)})})},this.admin.webhooks.delete=function(n){return new Promise(function(t,e){En($+n+"/",{}).then(function(n){t(n)},function(n){e(n)})})},this.admin.webhookTasks.get=function(n){var i,t;return i=n&&n.id?Q+n.id+"/":n&&n.filters?(t="?"+bn(n.filters),Q+t):Q,n&&n.id?new Promise(function(t,e){var n=Nn();n?y.Authorization="Token "+n:delete y.Authorization,fetch(u+i,{method:"GET",headers:y}).then(An).then(function(n){"success"==n.status?n.data&&t(n.data):"error"==n.status&&(n.data?e(n.data):e({status:n.status_code,message:n.message}))})}):new Promise(function(t,e){Cn(i).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.webhookTasks.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.webhookTasks.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.webhookTasks.requests.get=function(n,t){var i,e;return i=t&&t.id?Q+n+Y+t.id+"/":t&&t.filters?(e="?"+bn(t.filters),Q+n+Y+e):Q,new Promise(function(t,e){Cn(i).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.webhookTasks.requests.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.webhookTasks.requests.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.subtypes.get=function(n){var i;return i=n&&n.id?Z+n.id+"/":Z,new Promise(function(t,e){Cn(i).then(function(n){t(n)},function(n){e(n)})})},this.admin.subtypes.create=function(n){return new Promise(function(t,e){xn(Z,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.subtypes.update=function(n,i){return new Promise(function(t,e){Sn(Z+n+"/",i).then(function(n){t(n)},function(n){e(n)})})},this.admin.subtypes.delete=function(n){return new Promise(function(t,e){En(Z+n+"/",{}).then(function(n){t(n)},function(n){e(n)})})},this.admin.notifications.get=function(n){var i;return i=n&&n.id?nn+n.id+"/":nn,new Promise(function(t,e){Cn(i).then(function(n){t(n)},function(n){e(n)})})},this.admin.notifications.update=function(n,i){return new Promise(function(t,e){Sn(nn+n+"/",i).then(function(n){t(n)},function(n){e(n)})})},this.admin.services.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?un+s.id+"/":s&&s.filters?(i="?"+bn(s.filters),un+i):un,Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.services.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.services.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.services.update=function(n,i){return new Promise(function(t,e){Sn(un+n+"/",i).then(function(n){t(n)},function(n){e(n)})})},this.admin.services.create=function(n){return new Promise(function(t,e){xn(un,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.services.delete=function(n){return new Promise(function(t,e){n?En(un+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No id has been given"})})},this.admin.requests.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.id?cn+s.id+"/":s&&s.filters?(i="?"+bn(s.filters),cn+i):cn,Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.requests.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){n.next&&_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.requests.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.groups.get=function(s){return new Promise(function(t,e){var n,i;n=s&&s.name?rn+s.name+"/":s&&s.filters?(i="?"+bn(s.filters),rn+i):rn,Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.groups.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.groups.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.groups.create=function(n){return new Promise(function(t,e){xn(rn,n).then(function(n){t(n)},function(n){e(n)})})},this.admin.groups.update=function(n,i){return new Promise(function(t,e){n?Sn(rn+n+"/",i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No group name has been given"})})},this.admin.groups.delete=function(n){return new Promise(function(t,e){n?En(rn+n+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No group name has been given"})})},this.admin.groups.permissions.get=function(s,o){return new Promise(function(t,e){var n,i;n=o&&o.id?rn+s+an+o.id+"/":o&&o.filters?(i="?"+bn(o.filters),rn+s+an+i):rn+s+an,Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.groups.permissions.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.groups.permissions.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.groups.permissions.create=function(n,i){return new Promise(function(t,e){n?xn(rn+n+an,i).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No group name has been given"})})},this.admin.groups.permissions.delete=function(n,i){return new Promise(function(t,e){n&&i?En(rn+n+an+i+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No group name or permission id has been given"})})},this.admin.groups.settings.get=function(n){return new Promise(function(t,e){n?Cn(rn+n+fn).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No group name has been given"})})},this.admin.groups.settings.update=function(n,i){if(n)return new Promise(function(t,e){Sn(rn+n+fn,i).then(function(n){t(n)},function(n){e(n)})});reject({status:400,message:"No group name has been given"})},this.admin.groups.tiers.get=function(n,t){var i;return i=t&&t.id?rn+n+mn+t.id+"/":rn+n+mn,new Promise(function(t,e){Cn(i).then(function(n){t(n)},function(n){e(n)})})},this.admin.groups.tiers.create=function(n,i){return new Promise(function(t,e){xn(rn+n+mn,i).then(function(n){t(n)},function(n){e(n)})})},this.admin.groups.tiers.update=function(n,i,s){return new Promise(function(t,e){Sn(rn+n+mn+i+"/",s).then(function(n){t(n)},function(n){e(n)})})},this.admin.groups.tiers.delete=function(n,i){return new Promise(function(t,e){En(rn+n+mn+i+"/",{}).then(function(n){t(n)},function(n){e(n)})})},this.admin.groups.tiers.requirements.get=function(i,s,o){return new Promise(function(t,e){var n;s?(n=o&&o.id?rn+i+mn+s+tn+o.id+"/":rn+i+mn+s+tn,Cn(n).then(function(n){t(n)},function(n){e(n)})):e({status:400,message:"No tier id is provided"})})},this.admin.groups.tiers.requirements.create=function(n,i,s){return new Promise(function(t,e){i?xn(rn+n+mn+i+tn,s).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No tier id is provided"})})},this.admin.groups.tiers.requirements.update=function(n,i,s,o){return new Promise(function(t,e){i?s?Sn(rn+n+mn+i+tn+s+"/",o).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No requirement id is provided"}):e({status:400,message:"No tier id is provided"})})},this.admin.groups.tiers.requirements.delete=function(n,i,s){return new Promise(function(t,e){i?s?En(rn+n+mn+i+tn+s+"/").then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No requirement id is provided"}):e({status:400,message:"No tier id is provided"})})},this.admin.groups.tiers.fees.get=function(i,s,o){return new Promise(function(t,e){var n;s?(n=o&&o.id?rn+i+mn+s+sn+o.id+"/":rn+i+mn+s+sn,Cn(n).then(function(n){t(n)},function(n){e(n)})):e({status:400,message:"No tier id is provided"})})},this.admin.groups.tiers.fees.create=function(n,i,s){return new Promise(function(t,e){i?xn(rn+n+mn+i+sn,s).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No tier id is provided"})})},this.admin.groups.tiers.fees.update=function(n,i,s,o){return new Promise(function(t,e){i?s?Sn(rn+n+mn+i+sn+s+"/",o).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No fee id is provided"}):e({status:400,message:"No tier id is provided"})})},this.admin.groups.tiers.fees.delete=function(n,i,s){return new Promise(function(t,e){i?s?En(rn+n+mn+i+sn+s+"/").then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No fee id is provided"}):e({status:400,message:"No tier id is provided"})})},this.admin.groups.tiers.limits.get=function(i,s,o){return new Promise(function(t,e){var n;s?(n=o&&o.id?rn+i+mn+s+en+o.id+"/":rn+i+mn+s+en,Cn(n).then(function(n){t(n)},function(n){e(n)})):e({status:400,message:"No tier id is provided"})})},this.admin.groups.tiers.limits.create=function(n,i,s){return new Promise(function(t,e){i?xn(rn+n+mn+i+en,s).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No tier id is provided"})})},this.admin.groups.tiers.limits.update=function(n,i,s,o){return new Promise(function(t,e){i?s?Sn(rn+n+mn+i+en+s+"/",o).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No limit id is provided"}):e({status:400,message:"No tier id is provided"})})},this.admin.groups.tiers.limits.delete=function(n,i,s){return new Promise(function(t,e){i?s?En(rn+n+mn+i+en+s+"/").then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No limit id is provided"}):e({status:400,message:"No tier id is provided"})})},this.admin.groups.tiers.settings.get=function(n,i){return new Promise(function(t,e){n?Cn(rn+n+mn+i+ln).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No group name has been given"})})},this.admin.groups.tiers.settings.update=function(n,i,s){if(n)return new Promise(function(t,e){Sn(rn+n+mn+i+ln,s).then(function(n){t(n)},function(n){e(n)})});reject({status:400,message:"No group name has been given"})},this.admin.groups.accountConfigurations.get=function(s,o){return new Promise(function(t,e){var n,i;n=o&&o.name?rn+s+dn+o.name+"/":o&&o.filters?(i="?"+bn(o.filters),rn+s+dn+i):rn+s+dn,Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.groups.accountConfigurations.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.groups.accountConfigurations.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.groups.accountConfigurations.create=function(n,i){return new Promise(function(t,e){xn(rn+n+dn,i).then(function(n){t(n)},function(n){e(n)})})},this.admin.groups.accountConfigurations.update=function(n,i,s){return new Promise(function(t,e){n?Sn(rn+n+dn+i+"/",s).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No group name has been given"})})},this.admin.groups.accountConfigurations.delete=function(n,i){return new Promise(function(t,e){n?En(rn+n+dn+i+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No group name has been given"})})},this.admin.groups.accountConfigurations.currencies.get=function(s,o,u){return new Promise(function(t,e){var n,i;n=u&&u.code?rn+s+dn+o+hn+u.code+"/":u&&u.filters?(i="?"+bn(u.filters),rn+s+dn+o+hn+i):rn+s+dn+o+hn,Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})})},this.admin.groups.accountConfigurations.currencies.getNext=function(){return new Promise(function(t,e){var n;pn?(n=pn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.groups.accountConfigurations.currencies.getPrevious=function(){return new Promise(function(t,e){var n;wn?(n=wn.split(u)[1],Cn(n).then(function(n){_n(n),t(n)},function(n){e(n)})):e({status:400,message:"Not allowed"})})},this.admin.groups.accountConfigurations.currencies.create=function(n,i,s){return new Promise(function(t,e){xn(rn+n+dn+i+hn,s).then(function(n){t(n)},function(n){e(n)})})},this.admin.groups.accountConfigurations.currencies.delete=function(n,i,s){return new Promise(function(t,e){n?En(rn+n+dn+i+hn+s+"/",{}).then(function(n){t(n)},function(n){e(n)}):e({status:400,message:"No group name has been given"})})}}"undefined"!=typeof module&&module.exports?(module.exports=Rehive,global.fetch&&!process.env.IS_BROWSER?fetch=global.fetch:(fetch=require("node-fetch"),isNode=!0)):(window.this,isNode=!1,fetch=window.fetch);
|
package/package.json
CHANGED
package/rehive.js
CHANGED
|
@@ -112,7 +112,8 @@ function Rehive(config) {
|
|
|
112
112
|
},
|
|
113
113
|
company: {
|
|
114
114
|
settings: {},
|
|
115
|
-
address: {}
|
|
115
|
+
address: {},
|
|
116
|
+
links: {}
|
|
116
117
|
},
|
|
117
118
|
bankAccounts: {
|
|
118
119
|
currencies: {}
|
|
@@ -225,6 +226,7 @@ function Rehive(config) {
|
|
|
225
226
|
adminCurrenciesBankAccountsAPI = '/bank-accounts/',
|
|
226
227
|
adminCurrenciesOverviewAPI = '/overview/',
|
|
227
228
|
adminCompanyAPI = 'admin/company/',
|
|
229
|
+
adminCompanyLinksAPI = 'admin/company/links/',
|
|
228
230
|
adminCompanySettingsAPI = 'settings/',
|
|
229
231
|
adminCompanyAddressAPI = 'address/',
|
|
230
232
|
adminWebhooksAPI = 'admin/webhooks/',
|
|
@@ -1994,20 +1996,67 @@ function Rehive(config) {
|
|
|
1994
1996
|
});
|
|
1995
1997
|
});
|
|
1996
1998
|
};
|
|
1997
|
-
|
|
1998
|
-
this.admin.metrics.points.get = function (id) {
|
|
1999
|
+
|
|
2000
|
+
this.admin.metrics.points.get = function (id, obj) {
|
|
1999
2001
|
return new Promise(function (resolve, reject) {
|
|
2002
|
+
var url,filters;
|
|
2000
2003
|
if(!id){
|
|
2001
2004
|
reject({ status: 400, message: 'No id has been given' });
|
|
2002
2005
|
return;
|
|
2003
2006
|
}
|
|
2004
|
-
|
|
2007
|
+
|
|
2008
|
+
url = adminMetricsAPI + id + '/points/';
|
|
2009
|
+
if(obj.filters){
|
|
2010
|
+
filters = '?' + serialize(obj.filters);
|
|
2011
|
+
url += filters;
|
|
2012
|
+
}
|
|
2013
|
+
|
|
2014
|
+
httpGetRehive(url).then(function (response) {
|
|
2015
|
+
saveFilter(response);
|
|
2005
2016
|
resolve(response);
|
|
2006
2017
|
}, function (error) {
|
|
2007
2018
|
reject(error);
|
|
2008
2019
|
});
|
|
2009
2020
|
});
|
|
2010
2021
|
};
|
|
2022
|
+
|
|
2023
|
+
this.admin.metrics.points.getNext = function () {
|
|
2024
|
+
return new Promise(function (resolve, reject) {
|
|
2025
|
+
var url = nextFilterForLists, mainUrl;
|
|
2026
|
+
if (url) {
|
|
2027
|
+
var urlArray = url.split(baseAPI);
|
|
2028
|
+
mainUrl = urlArray[1];
|
|
2029
|
+
|
|
2030
|
+
httpGetRehive(mainUrl).then(function (response) {
|
|
2031
|
+
saveFilter(response);
|
|
2032
|
+
resolve(response);
|
|
2033
|
+
}, function (error) {
|
|
2034
|
+
reject(error);
|
|
2035
|
+
});
|
|
2036
|
+
} else {
|
|
2037
|
+
reject({ status: 400, message: 'Not allowed' });
|
|
2038
|
+
}
|
|
2039
|
+
});
|
|
2040
|
+
};
|
|
2041
|
+
|
|
2042
|
+
this.admin.metrics.points.getPrevious = function () {
|
|
2043
|
+
return new Promise(function (resolve, reject) {
|
|
2044
|
+
var url = previousFilterForLists, mainUrl;
|
|
2045
|
+
if (url) {
|
|
2046
|
+
var urlArray = url.split(baseAPI);
|
|
2047
|
+
mainUrl = urlArray[1];
|
|
2048
|
+
|
|
2049
|
+
httpGetRehive(mainUrl).then(function (response) {
|
|
2050
|
+
saveFilter(response)
|
|
2051
|
+
resolve(response);
|
|
2052
|
+
}, function (error) {
|
|
2053
|
+
reject(error);
|
|
2054
|
+
});
|
|
2055
|
+
} else {
|
|
2056
|
+
reject({ status: 400, message: 'Not allowed' });
|
|
2057
|
+
}
|
|
2058
|
+
});
|
|
2059
|
+
};
|
|
2011
2060
|
//#endregion
|
|
2012
2061
|
|
|
2013
2062
|
//#region Admin Export methods
|
|
@@ -4645,6 +4694,106 @@ function Rehive(config) {
|
|
|
4645
4694
|
});
|
|
4646
4695
|
});
|
|
4647
4696
|
};
|
|
4697
|
+
|
|
4698
|
+
this.admin.company.links.get = function (obj) {
|
|
4699
|
+
return new Promise(function (resolve, reject) {
|
|
4700
|
+
var url,filters;
|
|
4701
|
+
|
|
4702
|
+
if(obj && obj.id) {
|
|
4703
|
+
url = adminCompanyLinksAPI + obj.id + '/';
|
|
4704
|
+
} else if(obj && obj.filters){
|
|
4705
|
+
filters = '?' + serialize(obj.filters);
|
|
4706
|
+
url = adminCompanyLinksAPI + filters;
|
|
4707
|
+
} else {
|
|
4708
|
+
url = adminCompanyLinksAPI;
|
|
4709
|
+
}
|
|
4710
|
+
|
|
4711
|
+
httpGetRehive(url).then(function (response) {
|
|
4712
|
+
saveFilter(response);
|
|
4713
|
+
resolve(response);
|
|
4714
|
+
}, function (error) {
|
|
4715
|
+
reject(error);
|
|
4716
|
+
});
|
|
4717
|
+
});
|
|
4718
|
+
};
|
|
4719
|
+
|
|
4720
|
+
this.admin.company.links.getNext = function () {
|
|
4721
|
+
return new Promise(function (resolve, reject) {
|
|
4722
|
+
var url = nextFilterForLists, mainUrl;
|
|
4723
|
+
if (url) {
|
|
4724
|
+
var urlArray = url.split(baseAPI);
|
|
4725
|
+
mainUrl = urlArray[1];
|
|
4726
|
+
|
|
4727
|
+
httpGetRehive(mainUrl).then(function (response) {
|
|
4728
|
+
saveFilter(response);
|
|
4729
|
+
resolve(response);
|
|
4730
|
+
}, function (error) {
|
|
4731
|
+
reject(error);
|
|
4732
|
+
});
|
|
4733
|
+
} else {
|
|
4734
|
+
reject({ status: 400, message: 'Not allowed' });
|
|
4735
|
+
}
|
|
4736
|
+
});
|
|
4737
|
+
};
|
|
4738
|
+
|
|
4739
|
+
this.admin.company.links.getPrevious = function () {
|
|
4740
|
+
return new Promise(function (resolve, reject) {
|
|
4741
|
+
var url = previousFilterForLists, mainUrl;
|
|
4742
|
+
if (url) {
|
|
4743
|
+
var urlArray = url.split(baseAPI);
|
|
4744
|
+
mainUrl = urlArray[1];
|
|
4745
|
+
|
|
4746
|
+
httpGetRehive(mainUrl).then(function (response) {
|
|
4747
|
+
saveFilter(response)
|
|
4748
|
+
resolve(response);
|
|
4749
|
+
}, function (error) {
|
|
4750
|
+
reject(error);
|
|
4751
|
+
});
|
|
4752
|
+
} else {
|
|
4753
|
+
reject({ status: 400, message: 'Not allowed' });
|
|
4754
|
+
}
|
|
4755
|
+
});
|
|
4756
|
+
};
|
|
4757
|
+
|
|
4758
|
+
this.admin.company.links.create = function (data) {
|
|
4759
|
+
return new Promise(function (resolve, reject) {
|
|
4760
|
+
httpPostRehive(adminCompanyLinksAPI, data).then(function (response) {
|
|
4761
|
+
resolve(response);
|
|
4762
|
+
}, function (error) {
|
|
4763
|
+
reject(error);
|
|
4764
|
+
});
|
|
4765
|
+
});
|
|
4766
|
+
};
|
|
4767
|
+
|
|
4768
|
+
this.admin.company.links.update = function (id, data) {
|
|
4769
|
+
return new Promise(function (resolve, reject) {
|
|
4770
|
+
if (!id) {
|
|
4771
|
+
reject({ status: 400, message: 'No id has been given' });
|
|
4772
|
+
return;
|
|
4773
|
+
}
|
|
4774
|
+
|
|
4775
|
+
httpPatchRehive(adminCompanyLinksAPI + id + '/', data).then(function (response) {
|
|
4776
|
+
resolve(response);
|
|
4777
|
+
}, function (error) {
|
|
4778
|
+
reject(error);
|
|
4779
|
+
});
|
|
4780
|
+
});
|
|
4781
|
+
};
|
|
4782
|
+
|
|
4783
|
+
this.admin.company.links.delete = function (id) {
|
|
4784
|
+
return new Promise(function (resolve, reject) {
|
|
4785
|
+
if (!id) {
|
|
4786
|
+
reject({ status: 400, message: 'No id has been given' });
|
|
4787
|
+
return;
|
|
4788
|
+
}
|
|
4789
|
+
|
|
4790
|
+
httpDeleteRehive(adminCompanyLinksAPI + id + '/', {}).then(function (response) {
|
|
4791
|
+
resolve(response);
|
|
4792
|
+
}, function (error) {
|
|
4793
|
+
reject(error);
|
|
4794
|
+
});
|
|
4795
|
+
});
|
|
4796
|
+
};
|
|
4648
4797
|
//#endregion
|
|
4649
4798
|
|
|
4650
4799
|
//#region Admin Bankaccount methods
|