UNPKG

ordercloud-javascript-sdk

Version:

The offical Javascript SDK for the Ordercloud ecommerce API

15 lines (13 loc) 292 kB
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("axios")):"function"==typeof define&&define.amd?define(["exports","axios"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).OrderCloud={},t.axios)}(this,(function(t,n){"use strict";function i(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var e=i(n),s=function(t,n){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},s(t,n)}; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */var r=function(){return r=Object.assign||function(t){for(var n,i=1,e=arguments.length;i<e;i++)for(var s in n=arguments[i])Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s]);return t},r.apply(this,arguments)};function o(t,n,i,e){return new(i||(i=Promise))((function(s,r){function o(t){try{a(e.next(t))}catch(t){r(t)}}function c(t){try{a(e.throw(t))}catch(t){r(t)}}function a(t){t.done?s(t.value):new i((function(n){n(t.value)})).then(o,c)}a((e=e.apply(t,n||[])).next())}))}function c(t,n){var i,e,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function c(r){return function(c){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,e&&(s=2&r[0]?e.return:r[0]?e.throw||((s=e.return)&&s.call(e),0):e.next)&&!(s=s.call(e,r[1])).done)return s;switch(e=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,e=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]<s[3])){o.label=r[1];break}if(6===r[0]&&o.label<s[1]){o.label=s[1],s=r;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(r);break}s[2]&&o.ops.pop(),o.trys.pop();continue}r=n.call(t,o)}catch(t){r=[6,t],e=0}finally{i=s=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,c])}}}var a=new(function(){function t(){var t;this.defaultConfig={baseApiUrl:"https://api.ordercloud.io",apiVersion:"v1",timeoutInMilliseconds:6e4,clientID:null,cookieOptions:{samesite:"lax",secure:!1,domain:null,prefix:"ordercloud",path:"/"}},this.config=(t=this.defaultConfig,JSON.parse(JSON.stringify(t))),this.Set=this.Set.bind(this),this.Get=this.Get.bind(this)}return t.prototype.Set=function(t){this.config=r(r(r({},this.defaultConfig),this.config),t||{}),this.config.cookieOptions=r(r(r({},this.defaultConfig.cookieOptions),this.config.cookieOptions),(null==t?void 0:t.cookieOptions)||{})},t.prototype.Get=function(){return this.config},t}()),h=function(t){function n(n){var i=this,e=function(t){var n;try{var i=null===(n=null==t?void 0:t.response)||void 0===n?void 0:n.data;return i?"object"==typeof i?i.Errors:"string"==typeof i?(i&&65279===i.charCodeAt(0)&&(i=i.substring(1)),JSON.parse(i).Errors):i:[]}catch(t){return[]}}(n),s=null==e?void 0:e[0];return i=t.call(this,function(t,n){if(!n)return t.response.statusText;if("NotFound"===n.ErrorCode)return"".concat(n.Data.ObjectType," ").concat(n.Data.ObjectID," not found");return n.Message}(n,s))||this,i.isOrderCloudError=!0,i.errors=e,i.name="OrderCloudError",i.errorCode=function(t){if(!t)return"OrderCloudError";return t.ErrorCode}(s),i.status=n.response.status,i.statusText=n.response.statusText,i.response=n.response,i.request=n.request,i}return function(t,n){function i(){this.constructor=t}s(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}(n,t),n}(Error);var u=function(){function t(){}return t.prototype.write=function(t,n,i){void 0===n&&(n=void 0),document.cookie=this.buildCookieString(t,n,i)},t.prototype.read=function(t){for(var n=0,i=document.cookie.split(";");n<i.length;n++){var e=i[n].split("="),s=e[0],r=e[1];if(decodeURIComponent(s.trim().toLowerCase())===t.toLowerCase())return decodeURIComponent(r)}return""},t.prototype.buildCookieString=function(t,n,i){var e;void 0===n&&(n=void 0),n?(e=new Date).setFullYear(e.getFullYear()+1):(e=new Date("Thu, 01 Jan 1970 00:00:00 GMT"),n="");var s=encodeURIComponent(t)+"="+encodeURIComponent(n);s+=i.domain?";domain="+i.domain:"",s+=e?";expires="+e.toUTCString():"",s+=i.secure?";secure":"",s+=i.samesite?";samesite="+i.samesite:"";var r=(s+=i.path?";path="+i.path:"").length+1;return r>4096&&console.warn("Cookie ".concat(t," possibly not set or overflowed because it was too large! (").concat(r," > 4096 bytes)")),s},t}(),p=new u,d=new(function(){function t(){this.get=this.get.bind(this),this.set=this.set.bind(this),this.remove=this.remove.bind(this)}return t.prototype.get=function(t){var n=a.Get().cookieOptions.prefix+t;return p.read(n)},t.prototype.set=function(t,n){var i=a.Get(),e=i.cookieOptions.prefix+t;p.write(e,n,i.cookieOptions)},t.prototype.remove=function(t){var n=a.Get(),i=n.cookieOptions.prefix+t;p.write(i,void 0,n.cookieOptions)},t}());function f(t){try{var n=t.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),i=decodeURIComponent((e=n,"undefined"!=typeof atob?atob(e):Buffer.from(e,"base64").toString("binary")).split("").map((function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)})).join(""));return JSON.parse(i)}catch(t){throw new Error("Invalid token")}var e}var v={serialize:function(t){var n=JSON.parse(JSON.stringify(t)),i=[];if(n.filters){var e=function(t){var n={};for(var i in t)m(t[i],i,n);return n}(n.filters),s=function(t){var n=e[t];Array.isArray(n)?n.forEach((function(n){return i.push("".concat(t,"=").concat(encodeURIComponent(n)))})):("boolean"==typeof n||0===n||n)&&i.push("".concat(t,"=").concat(encodeURIComponent(n)))};for(var r in e)s(r);delete n.filters}for(var r in n){var o=n[r];o&&i.push("".concat(r,"=").concat(encodeURIComponent(o)))}return i.length?"".concat(i.join("&")):""}};function m(t,n,i){if("[object Object]"===Object.prototype.toString.call(t))for(var e in t)m(t[e],"".concat(n,".").concat(e),i);else{if(null===t)throw new Error('Null is not a valid filter prop. Use negative filter "!" combined with wildcard filter "*" to define a filter for the absence of a value. \nex: an order list call with { xp: { hasPaid: \'!*\' } } would return a list of orders where xp.hasPaid is null or undefined\nhttps://ordercloud.io/features/advanced-querying#filtering');i[n]=t}}var g,l,w=function(){function t(){if(void 0===e.default)throw new Error("Ordercloud is missing required peer dependency axios. This must be installed and loaded before the OrderCloud SDK");this.Anonymous=this.Anonymous.bind(this),this.ClientCredentials=this.ClientCredentials.bind(this),this.ElevatedLogin=this.ElevatedLogin.bind(this),this.Login=this.Login.bind(this),this.RefreshToken=this.RefreshToken.bind(this)}return t.prototype.Login=function(t,n,i,s,u,p){return void 0===p&&(p={}),o(this,void 0,void 0,(function(){var o,d,f;return c(this,(function(c){switch(c.label){case 0:if(s&&!Array.isArray(s))throw new Error("scope must be a string array");if(null!=u&&!Array.isArray(u))throw new Error("custom roles must be defined as a string array");return(null==s?void 0:s.length)&&!(null==u?void 0:u.length)?o=s.join(" "):!(null==s?void 0:s.length)&&(null==u?void 0:u.length)?o+=" ".concat(u.join(" ")):(null==s?void 0:s.length)&&(null==u?void 0:u.length)&&(o="".concat(s.join(" ")," ").concat(u.join(" "))),d={grant_type:"password",username:t,password:n,client_id:i,scope:o},f=a.Get(),[4,e.default.post("".concat(f.baseApiUrl,"/oauth/token"),v.serialize(d),r({headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},adapter:f.axiosAdapter},p)).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,c.sent().data]}}))}))},t.prototype.ElevatedLogin=function(t,n,i,s,u,p,d){return void 0===d&&(d={}),o(this,void 0,void 0,(function(){var o,f,m;return c(this,(function(c){switch(c.label){case 0:if(u&&!Array.isArray(u))throw new Error("scope must be a string array");if(null!=p&&!Array.isArray(p))throw new Error("custom roles must be defined as a string array");return(null==u?void 0:u.length)&&!(null==p?void 0:p.length)?o=u.join(" "):!(null==u?void 0:u.length)&&(null==p?void 0:p.length)?o+=" ".concat(p.join(" ")):(null==u?void 0:u.length)&&(null==p?void 0:p.length)&&(o="".concat(u.join(" ")," ").concat(p.join(" "))),f={grant_type:"password",scope:o,client_id:s,username:n,password:i,client_secret:t},m=a.Get(),[4,e.default.post("".concat(m.baseApiUrl,"/oauth/token"),v.serialize(f),r({headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},adapter:m.axiosAdapter},d)).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,c.sent().data]}}))}))},t.prototype.ClientCredentials=function(t,n,i,s,u){return void 0===u&&(u={}),o(this,void 0,void 0,(function(){var o,p,d;return c(this,(function(c){switch(c.label){case 0:if(i&&!Array.isArray(i))throw new Error("scope must be a string array");if(null!=s&&!Array.isArray(s))throw new Error("custom roles must be defined as a string array");return(null==i?void 0:i.length)&&!(null==s?void 0:s.length)?o=i.join(" "):!(null==i?void 0:i.length)&&(null==s?void 0:s.length)?o+=" ".concat(s.join(" ")):(null==i?void 0:i.length)&&(null==s?void 0:s.length)&&(o="".concat(i.join(" ")," ").concat(s.join(" "))),p={grant_type:"client_credentials",scope:o,client_id:n,client_secret:t},d=a.Get(),[4,e.default.post("".concat(d.baseApiUrl,"/oauth/token"),v.serialize(p),r({headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},adapter:d.axiosAdapter},u)).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,c.sent().data]}}))}))},t.prototype.RefreshToken=function(t,n,i){return void 0===i&&(i={}),o(this,void 0,void 0,(function(){var s,o;return c(this,(function(c){switch(c.label){case 0:return s={grant_type:"refresh_token",client_id:n,refresh_token:t},o=a.Get(),[4,e.default.post("".concat(o.baseApiUrl,"/oauth/token"),v.serialize(s),r({headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},adapter:o.axiosAdapter},i)).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,c.sent().data]}}))}))},t.prototype.Anonymous=function(t,n,i,s){return void 0===s&&(s={}),o(this,void 0,void 0,(function(){var o,u,p;return c(this,(function(c){switch(c.label){case 0:if(n&&!Array.isArray(n))throw new Error("scope must be a string array");if(null!=i&&!Array.isArray(i))throw new Error("custom roles must be defined as a string array");return(null==n?void 0:n.length)&&!(null==i?void 0:i.length)?o=n.join(" "):!(null==n?void 0:n.length)&&(null==i?void 0:i.length)?o+=" ".concat(i.join(" ")):(null==n?void 0:n.length)&&(null==i?void 0:i.length)&&(o="".concat(n.join(" ")," ").concat(i.join(" "))),u={grant_type:"client_credentials",client_id:t,scope:o},s.anonuserid&&(u.anonuserid=s.anonuserid,delete s.anonuserid),p=a.Get(),[4,e.default.post("".concat(p.baseApiUrl,"/oauth/token"),v.serialize(u),r({headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},adapter:p.axiosAdapter},s)).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,c.sent().data]}}))}))},t}(),b=new w,y="undefined"!=typeof process&&Boolean(null===(g=null===process||void 0===process?void 0:process.versions)||void 0===g?void 0:g.node),S="undefined"!=typeof process&&(null===(l=null===process||void 0===process?void 0:process.env)||void 0===l?void 0:l.NEXT_RUNTIME)&&"edge"!==process.env.NEXT_RUNTIME,A=y||S,C=function(){function t(){this.accessTokenCookieName=".access-token",this.impersonationTokenCookieName=".impersonation-token",this.refreshTokenCookieName=".refresh-token",this.identityTokenCookieName=".identity-token",this.identityProviderAccessTokenCookieName=".idp-access-token",this.accessToken=null,this.impersonationToken=null,this.refreshToken=null,this.identityToken=null,this.identityProviderAccessToken=null,this.GetAccessToken=this.GetAccessToken.bind(this),this.GetImpersonationToken=this.GetImpersonationToken.bind(this),this.GetRefreshToken=this.GetRefreshToken.bind(this),this.RemoveAccessToken=this.RemoveAccessToken.bind(this),this.RemoveImpersonationToken=this.RemoveImpersonationToken.bind(this),this.SetAccessToken=this.SetAccessToken.bind(this),this.RemoveRefreshToken=this.RemoveRefreshToken.bind(this),this.SetImpersonationToken=this.SetImpersonationToken.bind(this),this.SetRefreshToken=this.SetRefreshToken.bind(this),this.RemoveIdentityToken=this.RemoveIdentityToken.bind(this),this.GetIdentityToken=this.GetIdentityToken.bind(this),this.SetIdentityToken=this.SetIdentityToken.bind(this),this._isTokenExpired=this._isTokenExpired.bind(this),this._tryRefreshToken=this._tryRefreshToken.bind(this)}return t.prototype.GetAccessToken=function(){return A?this.accessToken:d.get(this.accessTokenCookieName)},t.prototype.SetAccessToken=function(t){f(t),A?this.accessToken=t:d.set(this.accessTokenCookieName,t)},t.prototype.RemoveAccessToken=function(){A?this.accessToken="":d.remove(this.accessTokenCookieName)},t.prototype.GetImpersonationToken=function(){return A?this.impersonationToken:d.get(this.impersonationTokenCookieName)},t.prototype.SetImpersonationToken=function(t){f(t),A?this.impersonationToken=t:d.set(this.impersonationTokenCookieName,t)},t.prototype.RemoveImpersonationToken=function(){A?this.impersonationToken=null:d.remove(this.impersonationTokenCookieName)},t.prototype.GetRefreshToken=function(){return A?this.refreshToken:d.get(this.refreshTokenCookieName)},t.prototype.SetRefreshToken=function(t){A?this.refreshToken=t:d.set(this.refreshTokenCookieName,t)},t.prototype.RemoveRefreshToken=function(){A?this.refreshToken=null:d.remove(this.refreshTokenCookieName)},t.prototype.GetIdentityToken=function(){return A?this.identityToken:d.get(this.identityTokenCookieName)},t.prototype.SetIdentityToken=function(t){A?this.identityToken=t:d.set(this.identityTokenCookieName,t)},t.prototype.RemoveIdentityToken=function(){A?this.identityToken=null:d.remove(this.identityTokenCookieName)},t.prototype.GetIdpAccessToken=function(){return A?this.identityProviderAccessToken:d.get(this.identityProviderAccessTokenCookieName)},t.prototype.SetIdpAccessToken=function(t){A?this.identityProviderAccessToken=t:d.set(this.identityProviderAccessTokenCookieName,t)},t.prototype.RemoveIdpAccessToken=function(){A?this.identityProviderAccessToken=null:d.remove(this.identityProviderAccessTokenCookieName)},t.prototype.GetValidToken=function(t){return o(this,void 0,void 0,(function(){var n;return c(this,(function(i){switch(i.label){case 0:return n=t||this.GetAccessToken(),this._isTokenExpired(n)?[4,this._tryRefreshToken(n)]:[3,2];case 1:n=i.sent(),i.label=2;case 2:return[2,Promise.resolve(n||"")]}}))}))},t.prototype._isTokenExpired=function(t){if(!t)return!0;var n=f(t),i=Date.now()/1e3-10;return n.exp<i},t.prototype._tryRefreshToken=function(t){return o(this,void 0,void 0,(function(){var n,i,e,s,r,o;return c(this,(function(c){switch(c.label){case 0:if(!(n=this.GetRefreshToken()))return[2,t||""];if(i=a.Get(),!t&&!i.clientID)return[2,t||""];if(t&&(s=f(t),e=s.cid),i.clientID&&(e=i.clientID),!e)return[2,""];if(!e)return[3,4];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,b.RefreshToken(n,e)];case 2:return r=c.sent(),o=r.access_token,this.SetAccessToken(o),[2,o];case 3:return c.sent(),[2,""];case 4:return[2]}}))}))},t}(),P=new C,L=function(){function t(){var t=this;if(this.get=function(n,i){return o(t,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return[4,this.makeApiCall("get",n,i)];case 1:return[2,t.sent()]}}))}))},this.post=function(n,i){return o(t,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return[4,this.makeApiCall("post",n,i)];case 1:return[2,t.sent()]}}))}))},this.put=function(n,i){return o(t,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return[4,this.makeApiCall("put",n,i)];case 1:return[2,t.sent()]}}))}))},this.patch=function(n,i){return o(t,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return[4,this.makeApiCall("patch",n,i)];case 1:return[2,t.sent()]}}))}))},this.delete=function(n,i){return o(t,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return[4,this.makeApiCall("delete",n,i)];case 1:return[2,t.sent()]}}))}))},void 0===e.default)throw new Error("Missing required peer dependency axios. This must be installed and loaded before the OrderCloud SDK");this.get=this.get.bind(this),this.put=this.put.bind(this),this.post=this.post.bind(this),this.patch=this.patch.bind(this),this.delete=this.delete.bind(this),this._resolveToken=this._resolveToken.bind(this),this._buildRequestConfig=this._buildRequestConfig.bind(this),this._addTokenToConfig=this._addTokenToConfig.bind(this)}return t.prototype.makeApiCall=function(t,n,i){return o(this,void 0,void 0,(function(){var s,r,o;return c(this,(function(c){switch(c.label){case 0:return[4,this._buildRequestConfig(i)];case 1:return s=c.sent(),r=n.includes("oauth/")?"".concat(a.Get().baseApiUrl,"/").concat(n):"".concat(a.Get().baseApiUrl,"/").concat(a.Get().apiVersion).concat(n),"put"!==t&&"post"!==t&&"patch"!==t?[3,3]:(o=s.data,delete s.data,[4,e.default[t](r,o,s)]);case 2:case 4:return[2,c.sent().data];case 3:return[4,e.default[t](r,s)]}}))}))},t.prototype._addTokenToConfig=function(t){return o(this,void 0,void 0,(function(){var n,i;return c(this,(function(e){switch(e.label){case 0:return n=this._resolveToken(t),[4,P.GetValidToken(n)];case 1:return i=e.sent(),t.headers||(t.headers={}),t.headers.Authorization="Bearer ".concat(i),[2,t]}}))}))},t.prototype._resolveToken=function(t){var n;return n=t.accessToken?t.accessToken:t.impersonating?P.GetImpersonationToken():P.GetAccessToken(),delete t.accessToken,delete t.impersonating,n},t.prototype._buildRequestConfig=function(t){var n=a.Get(),i=r(r({},t),{paramsSerializer:v,adapter:n.axiosAdapter,timeout:n.timeoutInMilliseconds,headers:{"Content-Type":"application/json"}});return this._addTokenToConfig(i)},t}(),D=new L,G=function(){function t(){this.impersonating=!1,this.List=this.List.bind(this),this.Create=this.Create.bind(this),this.Get=this.Get.bind(this),this.Save=this.Save.bind(this),this.Delete=this.Delete.bind(this),this.Patch=this.Patch.bind(this),this.ListSecrets=this.ListSecrets.bind(this),this.CreateSecret=this.CreateSecret.bind(this),this.GetSecret=this.GetSecret.bind(this),this.DeleteSecret=this.DeleteSecret.bind(this),this.PatchSecret=this.PatchSecret.bind(this),this.ListAssignments=this.ListAssignments.bind(this),this.SaveAssignment=this.SaveAssignment.bind(this),this.DeleteBuyerAssignment=this.DeleteBuyerAssignment.bind(this),this.DeleteSupplierAssignment=this.DeleteSupplierAssignment.bind(this)}return t.prototype.List=function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.get("/apiclients",r(r({},n),{impersonating:i,params:t})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Create=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.post("/apiclients",r(r({},n),{data:t,impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Get=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.get("/apiclients/".concat(t),r(r({},n),{impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Save=function(t,n,i){return void 0===i&&(i={}),o(this,void 0,void 0,(function(){var e;return c(this,(function(s){switch(s.label){case 0:return e=this.impersonating,this.impersonating=!1,[4,D.put("/apiclients/".concat(t),r(r({},i),{data:n,impersonating:e})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,s.sent()]}}))}))},t.prototype.Delete=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.delete("/apiclients/".concat(t),r(r({},n),{impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Patch=function(t,n,i){return void 0===i&&(i={}),o(this,void 0,void 0,(function(){var e;return c(this,(function(s){switch(s.label){case 0:return e=this.impersonating,this.impersonating=!1,[4,D.patch("/apiclients/".concat(t),r(r({},i),{data:n,impersonating:e})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,s.sent()]}}))}))},t.prototype.ListSecrets=function(t,n,i){return void 0===n&&(n={}),void 0===i&&(i={}),o(this,void 0,void 0,(function(){var e;return c(this,(function(s){switch(s.label){case 0:return e=this.impersonating,this.impersonating=!1,[4,D.get("/apiclients/".concat(t,"/secrets"),r(r({},i),{impersonating:e,params:n})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,s.sent()]}}))}))},t.prototype.CreateSecret=function(t,n,i){return void 0===i&&(i={}),o(this,void 0,void 0,(function(){var e;return c(this,(function(s){switch(s.label){case 0:return e=this.impersonating,this.impersonating=!1,[4,D.post("/apiclients/".concat(t,"/secrets"),r(r({},i),{data:n,impersonating:e})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,s.sent()]}}))}))},t.prototype.GetSecret=function(t,n,i){return void 0===i&&(i={}),o(this,void 0,void 0,(function(){var e;return c(this,(function(s){switch(s.label){case 0:return e=this.impersonating,this.impersonating=!1,[4,D.get("/apiclients/".concat(t,"/secrets/").concat(n),r(r({},i),{impersonating:e})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,s.sent()]}}))}))},t.prototype.DeleteSecret=function(t,n,i){return void 0===i&&(i={}),o(this,void 0,void 0,(function(){var e;return c(this,(function(s){switch(s.label){case 0:return e=this.impersonating,this.impersonating=!1,[4,D.delete("/apiclients/".concat(t,"/secrets/").concat(n),r(r({},i),{impersonating:e})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,s.sent()]}}))}))},t.prototype.PatchSecret=function(t,n,i,e){return void 0===e&&(e={}),o(this,void 0,void 0,(function(){var s;return c(this,(function(o){switch(o.label){case 0:return s=this.impersonating,this.impersonating=!1,[4,D.patch("/apiclients/".concat(t,"/secrets/").concat(n),r(r({},e),{data:i,impersonating:s})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,o.sent()]}}))}))},t.prototype.ListAssignments=function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.get("/apiclients/assignments",r(r({},n),{impersonating:i,params:t})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.SaveAssignment=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.post("/apiclients/assignments",r(r({},n),{data:t,impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.DeleteBuyerAssignment=function(t,n,i){return void 0===i&&(i={}),o(this,void 0,void 0,(function(){var e;return c(this,(function(s){switch(s.label){case 0:return e=this.impersonating,this.impersonating=!1,[4,D.delete("/buyers/".concat(n,"/ApiClients/Assignments/").concat(t),r(r({},i),{impersonating:e})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,s.sent()]}}))}))},t.prototype.DeleteSupplierAssignment=function(t,n,i){return void 0===i&&(i={}),o(this,void 0,void 0,(function(){var e;return c(this,(function(s){switch(s.label){case 0:return e=this.impersonating,this.impersonating=!1,[4,D.delete("/suppliers/".concat(n,"/ApiClients/Assignments/").concat(t),r(r({},i),{impersonating:e})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,s.sent()]}}))}))},t.prototype.As=function(){return this.impersonating=!0,this},t}(),k=new G,T=function(){function t(){this.impersonating=!1,this.List=this.List.bind(this),this.Create=this.Create.bind(this),this.Get=this.Get.bind(this),this.Save=this.Save.bind(this),this.Delete=this.Delete.bind(this),this.Patch=this.Patch.bind(this),this.DeleteAssignment=this.DeleteAssignment.bind(this),this.ListAssignments=this.ListAssignments.bind(this),this.SaveAssignment=this.SaveAssignment.bind(this)}return t.prototype.List=function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.get("/securityprofiles",r(r({},n),{impersonating:i,params:t})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Create=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.post("/securityprofiles",r(r({},n),{data:t,impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Get=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.get("/securityprofiles/".concat(t),r(r({},n),{impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Save=function(t,n,i){return void 0===i&&(i={}),o(this,void 0,void 0,(function(){var e;return c(this,(function(s){switch(s.label){case 0:return e=this.impersonating,this.impersonating=!1,[4,D.put("/securityprofiles/".concat(t),r(r({},i),{data:n,impersonating:e})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,s.sent()]}}))}))},t.prototype.Delete=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.delete("/securityprofiles/".concat(t),r(r({},n),{impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Patch=function(t,n,i){return void 0===i&&(i={}),o(this,void 0,void 0,(function(){var e;return c(this,(function(s){switch(s.label){case 0:return e=this.impersonating,this.impersonating=!1,[4,D.patch("/securityprofiles/".concat(t),r(r({},i),{data:n,impersonating:e})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,s.sent()]}}))}))},t.prototype.DeleteAssignment=function(t,n,i){return void 0===n&&(n={}),void 0===i&&(i={}),o(this,void 0,void 0,(function(){var e;return c(this,(function(s){switch(s.label){case 0:return e=this.impersonating,this.impersonating=!1,[4,D.delete("/securityprofiles/".concat(t,"/assignments"),r(r({},i),{impersonating:e,params:n})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,s.sent()]}}))}))},t.prototype.ListAssignments=function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.get("/securityprofiles/assignments",r(r({},n),{impersonating:i,params:t})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.SaveAssignment=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.post("/securityprofiles/assignments",r(r({},n),{data:t,impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.As=function(){return this.impersonating=!0,this},t}(),I=new T,U=function(){function t(){this.impersonating=!1,this.SendOneTimePassword=this.SendOneTimePassword.bind(this),this.SendVerificationCode=this.SendVerificationCode.bind(this),this.ResetPasswordByVerificationCode=this.ResetPasswordByVerificationCode.bind(this),this.RetrieveUsername=this.RetrieveUsername.bind(this)}return t.prototype.SendOneTimePassword=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.post("/password/onetimepassword",r(r({},n),{data:t,impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.SendVerificationCode=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.post("/password/reset",r(r({},n),{data:t,impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.ResetPasswordByVerificationCode=function(t,n,i){return void 0===i&&(i={}),o(this,void 0,void 0,(function(){var e;return c(this,(function(s){switch(s.label){case 0:return e=this.impersonating,this.impersonating=!1,[4,D.put("/password/reset/".concat(t),r(r({},i),{data:n,impersonating:e})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,s.sent()]}}))}))},t.prototype.RetrieveUsername=function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.post("/username/retrieve",r(r({},n),{impersonating:i,params:t})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.As=function(){return this.impersonating=!0,this},t}(),B=new U,R=function(){function t(){this.impersonating=!1,this.List=this.List.bind(this),this.Create=this.Create.bind(this),this.Get=this.Get.bind(this),this.Save=this.Save.bind(this),this.Delete=this.Delete.bind(this),this.Patch=this.Patch.bind(this)}return t.prototype.List=function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.get("/impersonationconfig",r(r({},n),{impersonating:i,params:t})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Create=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.post("/impersonationconfig",r(r({},n),{data:t,impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Get=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.get("/impersonationconfig/".concat(t),r(r({},n),{impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Save=function(t,n,i){return void 0===i&&(i={}),o(this,void 0,void 0,(function(){var e;return c(this,(function(s){switch(s.label){case 0:return e=this.impersonating,this.impersonating=!1,[4,D.put("/impersonationconfig/".concat(t),r(r({},i),{data:n,impersonating:e})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,s.sent()]}}))}))},t.prototype.Delete=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.delete("/impersonationconfig/".concat(t),r(r({},n),{impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Patch=function(t,n,i){return void 0===i&&(i={}),o(this,void 0,void 0,(function(){var e;return c(this,(function(s){switch(s.label){case 0:return e=this.impersonating,this.impersonating=!1,[4,D.patch("/impersonationconfig/".concat(t),r(r({},i),{data:n,impersonating:e})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,s.sent()]}}))}))},t.prototype.As=function(){return this.impersonating=!0,this},t}(),O=new R,E=function(){function t(){this.impersonating=!1,this.List=this.List.bind(this),this.Create=this.Create.bind(this),this.Get=this.Get.bind(this),this.Save=this.Save.bind(this),this.Delete=this.Delete.bind(this),this.Patch=this.Patch.bind(this)}return t.prototype.List=function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.get("/openidconnects",r(r({},n),{impersonating:i,params:t})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Create=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.post("/openidconnects",r(r({},n),{data:t,impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Get=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.get("/openidconnects/".concat(t),r(r({},n),{impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Save=function(t,n,i){return void 0===i&&(i={}),o(this,void 0,void 0,(function(){var e;return c(this,(function(s){switch(s.label){case 0:return e=this.impersonating,this.impersonating=!1,[4,D.put("/openidconnects/".concat(t),r(r({},i),{data:n,impersonating:e})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,s.sent()]}}))}))},t.prototype.Delete=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.delete("/openidconnects/".concat(t),r(r({},n),{impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Patch=function(t,n,i){return void 0===i&&(i={}),o(this,void 0,void 0,(function(){var e;return c(this,(function(s){switch(s.label){case 0:return e=this.impersonating,this.impersonating=!1,[4,D.patch("/openidconnects/".concat(t),r(r({},i),{data:n,impersonating:e})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,s.sent()]}}))}))},t.prototype.As=function(){return this.impersonating=!0,this},t}(),V=new E,_=function(){function t(){this.impersonating=!1,this.List=this.List.bind(this),this.Create=this.Create.bind(this),this.Get=this.Get.bind(this),this.Save=this.Save.bind(this),this.Delete=this.Delete.bind(this),this.Patch=this.Patch.bind(this),this.RevokeUserTokens=this.RevokeUserTokens.bind(this),this.UnlockUserAccount=this.UnlockUserAccount.bind(this)}return t.prototype.List=function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.get("/adminusers",r(r({},n),{impersonating:i,params:t})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Create=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.post("/adminusers",r(r({},n),{data:t,impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Get=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.get("/adminusers/".concat(t),r(r({},n),{impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Save=function(t,n,i){return void 0===i&&(i={}),o(this,void 0,void 0,(function(){var e;return c(this,(function(s){switch(s.label){case 0:return e=this.impersonating,this.impersonating=!1,[4,D.put("/adminusers/".concat(t),r(r({},i),{data:n,impersonating:e})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,s.sent()]}}))}))},t.prototype.Delete=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.delete("/adminusers/".concat(t),r(r({},n),{impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Patch=function(t,n,i){return void 0===i&&(i={}),o(this,void 0,void 0,(function(){var e;return c(this,(function(s){switch(s.label){case 0:return e=this.impersonating,this.impersonating=!1,[4,D.patch("/adminusers/".concat(t),r(r({},i),{data:n,impersonating:e})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,s.sent()]}}))}))},t.prototype.RevokeUserTokens=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.delete("/adminusers/".concat(t,"/tokens"),r(r({},n),{impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.UnlockUserAccount=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.post("/adminusers/".concat(t,"/unlock"),r(r({},n),{impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.As=function(){return this.impersonating=!0,this},t}(),x=new _,j=function(){function t(){this.impersonating=!1,this.List=this.List.bind(this),this.Create=this.Create.bind(this),this.Get=this.Get.bind(this),this.Save=this.Save.bind(this),this.Delete=this.Delete.bind(this),this.Patch=this.Patch.bind(this),this.DeleteUserAssignment=this.DeleteUserAssignment.bind(this),this.ListUserAssignments=this.ListUserAssignments.bind(this),this.SaveUserAssignment=this.SaveUserAssignment.bind(this)}return t.prototype.List=function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.get("/usergroups",r(r({},n),{impersonating:i,params:t})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Create=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.post("/usergroups",r(r({},n),{data:t,impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Get=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.get("/usergroups/".concat(t),r(r({},n),{impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Save=function(t,n,i){return void 0===i&&(i={}),o(this,void 0,void 0,(function(){var e;return c(this,(function(s){switch(s.label){case 0:return e=this.impersonating,this.impersonating=!1,[4,D.put("/usergroups/".concat(t),r(r({},i),{data:n,impersonating:e})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,s.sent()]}}))}))},t.prototype.Delete=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.delete("/usergroups/".concat(t),r(r({},n),{impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Patch=function(t,n,i){return void 0===i&&(i={}),o(this,void 0,void 0,(function(){var e;return c(this,(function(s){switch(s.label){case 0:return e=this.impersonating,this.impersonating=!1,[4,D.patch("/usergroups/".concat(t),r(r({},i),{data:n,impersonating:e})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,s.sent()]}}))}))},t.prototype.DeleteUserAssignment=function(t,n,i){return void 0===i&&(i={}),o(this,void 0,void 0,(function(){var e;return c(this,(function(s){switch(s.label){case 0:return e=this.impersonating,this.impersonating=!1,[4,D.delete("/usergroups/".concat(t,"/assignments/").concat(n),r(r({},i),{impersonating:e})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,s.sent()]}}))}))},t.prototype.ListUserAssignments=function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.get("/usergroups/assignments",r(r({},n),{impersonating:i,params:t})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.SaveUserAssignment=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.post("/usergroups/assignments",r(r({},n),{data:t,impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.As=function(){return this.impersonating=!0,this},t}(),N=new j,F=function(){function t(){this.impersonating=!1,this.List=this.List.bind(this),this.Create=this.Create.bind(this),this.Get=this.Get.bind(this),this.Save=this.Save.bind(this),this.Delete=this.Delete.bind(this),this.Patch=this.Patch.bind(this)}return t.prototype.List=function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.get("/addresses",r(r({},n),{impersonating:i,params:t})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Create=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.post("/addresses",r(r({},n),{data:t,impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Get=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.get("/addresses/".concat(t),r(r({},n),{impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Save=function(t,n,i){return void 0===i&&(i={}),o(this,void 0,void 0,(function(){var e;return c(this,(function(s){switch(s.label){case 0:return e=this.impersonating,this.impersonating=!1,[4,D.put("/addresses/".concat(t),r(r({},i),{data:n,impersonating:e})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,s.sent()]}}))}))},t.prototype.Delete=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.delete("/addresses/".concat(t),r(r({},n),{impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Patch=function(t,n,i){return void 0===i&&(i={}),o(this,void 0,void 0,(function(){var e;return c(this,(function(s){switch(s.label){case 0:return e=this.impersonating,this.impersonating=!1,[4,D.patch("/addresses/".concat(t),r(r({},i),{data:n,impersonating:e})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,s.sent()]}}))}))},t.prototype.As=function(){return this.impersonating=!0,this},t}(),M=new F,z=function(){function t(){this.impersonating=!1,this.List=this.List.bind(this),this.Create=this.Create.bind(this),this.Get=this.Get.bind(this),this.Save=this.Save.bind(this),this.Delete=this.Delete.bind(this),this.Patch=this.Patch.bind(this)}return t.prototype.List=function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.get("/incrementors",r(r({},n),{impersonating:i,params:t})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Create=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.post("/incrementors",r(r({},n),{data:t,impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Get=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.get("/incrementors/".concat(t),r(r({},n),{impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Save=function(t,n,i){return void 0===i&&(i={}),o(this,void 0,void 0,(function(){var e;return c(this,(function(s){switch(s.label){case 0:return e=this.impersonating,this.impersonating=!1,[4,D.put("/incrementors/".concat(t),r(r({},i),{data:n,impersonating:e})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,s.sent()]}}))}))},t.prototype.Delete=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.delete("/incrementors/".concat(t),r(r({},n),{impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Patch=function(t,n,i){return void 0===i&&(i={}),o(this,void 0,void 0,(function(){var e;return c(this,(function(s){switch(s.label){case 0:return e=this.impersonating,this.impersonating=!1,[4,D.patch("/incrementors/".concat(t),r(r({},i),{data:n,impersonating:e})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,s.sent()]}}))}))},t.prototype.As=function(){return this.impersonating=!0,this},t}(),q=new z,J=function(){function t(){this.impersonating=!1,this.List=this.List.bind(this),this.Create=this.Create.bind(this),this.Get=this.Get.bind(this),this.Save=this.Save.bind(this),this.Delete=this.Delete.bind(this),this.Patch=this.Patch.bind(this),this.DeleteAssignment=this.DeleteAssignment.bind(this),this.ListAssignments=this.ListAssignments.bind(this),this.SaveAssignment=this.SaveAssignment.bind(this)}return t.prototype.List=function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.get("/locales",r(r({},n),{impersonating:i,params:t})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Create=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.post("/locales",r(r({},n),{data:t,impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Get=function(t,n){return void 0===n&&(n={}),o(this,void 0,void 0,(function(){var i;return c(this,(function(e){switch(e.label){case 0:return i=this.impersonating,this.impersonating=!1,[4,D.get("/locales/".concat(t),r(r({},n),{impersonating:i})).catch((function(t){if(t.response)throw new h(t);throw t}))];case 1:return[2,e.sent()]}}))}))},t.prototype.Save=function(t,n,i){return void 0===i