UNPKG

@altostra/core

Version:

Core library for shared types and logic

1 lines 2.27 kB
"use strict";var _AccountsManager_integrationService,__awaiter=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,i){function o(e){try{c(a.next(e))}catch(e){i(e)}}function s(e){try{c(a.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}c((a=a.apply(e,t||[])).next())}))},__classPrivateFieldSet=this&&this.__classPrivateFieldSet||function(e,t,r,a,n){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?n.call(e,r):n?n.value=r:t.set(e,r),r},__classPrivateFieldGet=this&&this.__classPrivateFieldGet||function(e,t,r,a){if("a"===r&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?a:"a"===r?a.call(e):a?a.value:t.get(e)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.AccountsManager=void 0;const IntegrationAccounts_1=require("../../../common/Models/IntegrationAccounts"),type_validations_1=require("@altostra/type-validations"),ServiceClientBase_1=require("../ServiceClientBase");class AccountsManager extends ServiceClientBase_1.ServiceClientBase{constructor({axios:e,integrationService:t,getToken:r,errorMapping:a={}}){super({getToken:r,axios:e,errorMapping:a}),_AccountsManager_integrationService.set(this,void 0),__classPrivateFieldSet(this,_AccountsManager_integrationService,t,"f")}list(){return this._request({request:e=>__awaiter(this,void 0,void 0,(function*(){return yield e.get(accountsUrl(__classPrivateFieldGet(this,_AccountsManager_integrationService,"f")),{headers:yield this._getHeaders()})})),dataValidation:(0,type_validations_1.arrayOf)(IntegrationAccounts_1.isCrossAccountInfo),errorWrapping:{message:"Unable to list cloud accounts.\nPlease try again or contact support."}})}}function accountsUrl(e){return e+"/accounts"}exports.AccountsManager=AccountsManager,_AccountsManager_integrationService=new WeakMap;