@assetsfirst/pasarguard-sdk 1.0.0 → 1.1.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/README.md +13 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +46 -112
- package/dist/index.d.ts +46 -112
- package/dist/index.js +1 -1
- package/package.json +28 -3
package/README.md
CHANGED
|
@@ -1 +1,13 @@
|
|
|
1
|
-
# pasarguard-sdk
|
|
1
|
+
# pasarguard-sdk
|
|
2
|
+
|
|
3
|
+
pasarguard-sdk is a fully typed TypeScript client for interacting with the [Pasarguard](https://github.com/PasarGuard/panel) API.
|
|
4
|
+
It provides a clean, consistent, and developer-friendly interface — with built-in authentication, retries, and WebSocket support.
|
|
5
|
+
Based on [Marzban SDK](https://github.com/Ilmar7786/marzban-sdk).
|
|
6
|
+
|
|
7
|
+
## 📦 Installation
|
|
8
|
+
|
|
9
|
+
Install pasarguard-sdk via npm:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm i @assetsfirst/pasarguard-sdk
|
|
13
|
+
```
|
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var w=require('axios'),fe=require('axios-retry');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var w__default=/*#__PURE__*/_interopDefault(w);var fe__default=/*#__PURE__*/_interopDefault(fe);var c="http://localhost".replace(/\/+$/,"");var U=class{constructor(s,t=c,e=w__default.default){this.basePath=t;this.axios=e;s&&(this.configuration=s,this.basePath=s.basePath??t);}},j=class extends Error{constructor(t,e){super(e);this.field=t;this.name="RequiredError";}},d={};var g="https://example.com",f=function(n,s,t){if(t==null)throw new j(s,`Required parameter ${s} was null or undefined when calling ${n}.`)};var y=async function(n,s,t,e){if(e&&e.accessToken){let o=typeof e.accessToken=="function"?await e.accessToken(s,t):await e.accessToken;n.Authorization="Bearer "+o;}};function Z(n,s,t=""){s!=null&&(typeof s=="object"?Array.isArray(s)?s.forEach(e=>Z(n,e,t)):Object.keys(s).forEach(e=>Z(n,s[e],`${t}${t!==""?".":""}${e}`)):n.has(t)?n.append(t,s):n.set(t,s));}var h=function(n,...s){let t=new URLSearchParams(n.search);Z(t,s),n.search=t.toString();},O=function(n,s,t){let e=typeof n!="string";return (e&&t&&t.isJsonMime?t.isJsonMime(s.headers["Content-Type"]):e)?JSON.stringify(n!==void 0?n:{}):n||""},x=function(n){return n.pathname+n.search+n.hash},A=function(n,s,t,e){return (o=s,r=t)=>{let a={...n.options,url:(o.defaults.baseURL?"":e?.basePath??r)+n.url};return o.request(a)}};var ue=function(n){return {activateAllDisabledUsers:async(s,t={})=>{f("activateAllDisabledUsers","username",s);let e="/api/admin/{username}/users/activate".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},adminMiniAppToken:async(s,t={})=>{f("adminMiniAppToken","xTelegramAuthorization",s);let e="/api/admin/miniapp/token",o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};s!=null&&(i["x-telegram-authorization"]=String(s)),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},adminToken:async(s,t,e,o,r,a,i={})=>{f("adminToken","username",s),f("adminToken","password",t);let l="/api/admin/token",u=new URL(l,g),m;n&&(m=n.baseOptions);let b={method:"POST",...m,...i},R={},P={},S=new URLSearchParams;e!==void 0&&S.set("grant_type",e),s!==void 0&&S.set("username",s),t!==void 0&&S.set("password",t),o!==void 0&&S.set("scope",o),r!==void 0&&S.set("client_id",r),a!==void 0&&S.set("client_secret",a),R["Content-Type"]="application/x-www-form-urlencoded",h(u,P);let v=m&&m.headers?m.headers:{};return b.headers={...R,...v,...i.headers},b.data=S.toString(),{url:x(u),options:b}},createAdmin:async(s,t={})=>{f("createAdmin","adminCreate",s);let e="/api/admin",o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=O(s,a,n),{url:x(o),options:a}},disableAllActiveUsers:async(s,t={})=>{f("disableAllActiveUsers","username",s);let e="/api/admin/{username}/users/disable".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},getAdmins:async(s,t,e,o,r={})=>{let a="/api/admins",i=new URL(a,g),l;n&&(l=n.baseOptions);let u={method:"GET",...l,...r},m={},b={};await y(m,"OAuth2PasswordBearer",[],n),s!==void 0&&(b.username=s),t!==void 0&&(b.offset=t),e!==void 0&&(b.limit=e),o!==void 0&&(b.sort=o),h(i,b);let R=l&&l.headers?l.headers:{};return u.headers={...m,...R,...r.headers},{url:x(i),options:u}},getCurrentAdmin:async(s={})=>{let t="/api/admin",e=new URL(t,g),o;n&&(o=n.baseOptions);let r={method:"GET",...o,...s},a={},i={};await y(a,"OAuth2PasswordBearer",[],n),h(e,i);let l=o&&o.headers?o.headers:{};return r.headers={...a,...l,...s.headers},{url:x(e),options:r}},modifyAdmin:async(s,t,e={})=>{f("modifyAdmin","username",s),f("modifyAdmin","adminModify",t);let o="/api/admin/{username}".replace("{username}",encodeURIComponent(String(s))),r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"PUT",...a,...e},l={},u={};await y(l,"OAuth2PasswordBearer",[],n),l["Content-Type"]="application/json",h(r,u);let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},i.data=O(t,i,n),{url:x(r),options:i}},removeAdmin:async(s,t={})=>{f("removeAdmin","username",s);let e="/api/admin/{username}".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"DELETE",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},removeAllUsers:async(s,t={})=>{f("removeAllUsers","username",s);let e="/api/admin/{username}/users".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"DELETE",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},resetAdminUsage:async(s,t={})=>{f("resetAdminUsage","username",s);let e="/api/admin/{username}/reset".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}}}},I=function(n){let s=ue(n);return {async activateAllDisabledUsers(t,e){let o=await s.activateAllDisabledUsers(t,e),r=n?.serverIndex??0,a=d["AdminApi.activateAllDisabledUsers"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async adminMiniAppToken(t,e){let o=await s.adminMiniAppToken(t,e),r=n?.serverIndex??0,a=d["AdminApi.adminMiniAppToken"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async adminToken(t,e,o,r,a,i,l){let u=await s.adminToken(t,e,o,r,a,i,l),m=n?.serverIndex??0,b=d["AdminApi.adminToken"]?.[m]?.url;return (R,P)=>A(u,w__default.default,c,n)(R,b||P)},async createAdmin(t,e){let o=await s.createAdmin(t,e),r=n?.serverIndex??0,a=d["AdminApi.createAdmin"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async disableAllActiveUsers(t,e){let o=await s.disableAllActiveUsers(t,e),r=n?.serverIndex??0,a=d["AdminApi.disableAllActiveUsers"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async getAdmins(t,e,o,r,a){let i=await s.getAdmins(t,e,o,r,a),l=n?.serverIndex??0,u=d["AdminApi.getAdmins"]?.[l]?.url;return (m,b)=>A(i,w__default.default,c,n)(m,u||b)},async getCurrentAdmin(t){let e=await s.getCurrentAdmin(t),o=n?.serverIndex??0,r=d["AdminApi.getCurrentAdmin"]?.[o]?.url;return (a,i)=>A(e,w__default.default,c,n)(a,r||i)},async modifyAdmin(t,e,o){let r=await s.modifyAdmin(t,e,o),a=n?.serverIndex??0,i=d["AdminApi.modifyAdmin"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)},async removeAdmin(t,e){let o=await s.removeAdmin(t,e),r=n?.serverIndex??0,a=d["AdminApi.removeAdmin"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async removeAllUsers(t,e){let o=await s.removeAllUsers(t,e),r=n?.serverIndex??0,a=d["AdminApi.removeAllUsers"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async resetAdminUsage(t,e){let o=await s.resetAdminUsage(t,e),r=n?.serverIndex??0,a=d["AdminApi.resetAdminUsage"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)}}};var B=class extends U{activateAllDisabledUsers(s,t){return I(this.configuration).activateAllDisabledUsers(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}adminMiniAppToken(s,t){return I(this.configuration).adminMiniAppToken(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}adminToken(s,t,e,o,r,a,i){return I(this.configuration).adminToken(s,t,e,o,r,a,i).then(l=>l(this.axios,this.basePath)).then(({data:l})=>l)}createAdmin(s,t){return I(this.configuration).createAdmin(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}disableAllActiveUsers(s,t){return I(this.configuration).disableAllActiveUsers(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}getAdmins(s,t,e,o,r){return I(this.configuration).getAdmins(s,t,e,o,r).then(a=>a(this.axios,this.basePath)).then(({data:a})=>a)}getCurrentAdmin(s){return I(this.configuration).getCurrentAdmin(s).then(t=>t(this.axios,this.basePath)).then(({data:t})=>t)}modifyAdmin(s,t,e){return I(this.configuration).modifyAdmin(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}removeAdmin(s,t){return I(this.configuration).removeAdmin(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}removeAllUsers(s,t){return I(this.configuration).removeAllUsers(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}resetAdminUsage(s,t){return I(this.configuration).resetAdminUsage(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}};var pe=function(n){return {createCoreConfig:async(s,t={})=>{f("createCoreConfig","coreCreate",s);let e="/api/core",o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=O(s,a,n),{url:x(o),options:a}},deleteCoreConfig:async(s,t,e={})=>{f("deleteCoreConfig","coreId",s);let o="/api/core/{core_id}".replace("{core_id}",encodeURIComponent(String(s))),r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"DELETE",...a,...e},l={},u={};await y(l,"OAuth2PasswordBearer",[],n),t!==void 0&&(u.restart_nodes=t),h(r,u);let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},{url:x(r),options:i}},getAllCores:async(s,t,e={})=>{let o="/api/cores",r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"GET",...a,...e},l={},u={};await y(l,"OAuth2PasswordBearer",[],n),s!==void 0&&(u.offset=s),t!==void 0&&(u.limit=t),h(r,u);let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},{url:x(r),options:i}},getCoreConfig:async(s,t={})=>{f("getCoreConfig","coreId",s);let e="/api/core/{core_id}".replace("{core_id}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},modifyCoreConfig:async(s,t,e,o={})=>{f("modifyCoreConfig","coreId",s),f("modifyCoreConfig","restartNodes",t),f("modifyCoreConfig","coreCreate",e);let r="/api/core/{core_id}".replace("{core_id}",encodeURIComponent(String(s))),a=new URL(r,g),i;n&&(i=n.baseOptions);let l={method:"PUT",...i,...o},u={},m={};await y(u,"OAuth2PasswordBearer",[],n),t!==void 0&&(m.restart_nodes=t),u["Content-Type"]="application/json",h(a,m);let b=i&&i.headers?i.headers:{};return l.headers={...u,...b,...o.headers},l.data=O(e,l,n),{url:x(a),options:l}},restartCore:async(s,t={})=>{f("restartCore","coreId",s);let e="/api/core/{core_id}/restart".replace("{core_id}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}}}},k=function(n){let s=pe(n);return {async createCoreConfig(t,e){let o=await s.createCoreConfig(t,e),r=n?.serverIndex??0,a=d["CoreApi.createCoreConfig"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async deleteCoreConfig(t,e,o){let r=await s.deleteCoreConfig(t,e,o),a=n?.serverIndex??0,i=d["CoreApi.deleteCoreConfig"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)},async getAllCores(t,e,o){let r=await s.getAllCores(t,e,o),a=n?.serverIndex??0,i=d["CoreApi.getAllCores"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)},async getCoreConfig(t,e){let o=await s.getCoreConfig(t,e),r=n?.serverIndex??0,a=d["CoreApi.getCoreConfig"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async modifyCoreConfig(t,e,o,r){let a=await s.modifyCoreConfig(t,e,o,r),i=n?.serverIndex??0,l=d["CoreApi.modifyCoreConfig"]?.[i]?.url;return (u,m)=>A(a,w__default.default,c,n)(u,l||m)},async restartCore(t,e){let o=await s.restartCore(t,e),r=n?.serverIndex??0,a=d["CoreApi.restartCore"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)}}};var G=class extends U{createCoreConfig(s,t){return k(this.configuration).createCoreConfig(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}deleteCoreConfig(s,t,e){return k(this.configuration).deleteCoreConfig(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}getAllCores(s,t,e){return k(this.configuration).getAllCores(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}getCoreConfig(s,t){return k(this.configuration).getCoreConfig(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}modifyCoreConfig(s,t,e,o){return k(this.configuration).modifyCoreConfig(s,t,e,o).then(r=>r(this.axios,this.basePath)).then(({data:r})=>r)}restartCore(s,t){return k(this.configuration).restartCore(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}};var me=function(n){return {base:async(s={})=>{let e=new URL("/",g),o;n&&(o=n.baseOptions);let r={method:"GET",...o,...s},a={};h(e,{});let l=o&&o.headers?o.headers:{};return r.headers={...a,...l,...s.headers},{url:x(e),options:r}},getManifest:async(s,t={})=>{let e="/manifest.json",o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};s!==void 0&&(l.start_url=s),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}}}},te=function(n){let s=me(n);return {async base(t){let e=await s.base(t),o=n?.serverIndex??0,r=d["DefaultApi.base"]?.[o]?.url;return (a,i)=>A(e,w__default.default,c,n)(a,r||i)},async getManifest(t,e){let o=await s.getManifest(t,e),r=n?.serverIndex??0,a=d["DefaultApi.getManifest"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)}}};var D=class extends U{base(s){return te(this.configuration).base(s).then(t=>t(this.axios,this.basePath)).then(({data:t})=>t)}getManifest(s,t){return te(this.configuration).getManifest(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}};var ce=function(n){return {clearUsageData:async(s,t,e,o={})=>{f("clearUsageData","table",s);let r="/api/nodes/clear_usage_data/{table}".replace("{table}",encodeURIComponent(String(s))),a=new URL(r,g),i;n&&(i=n.baseOptions);let l={method:"DELETE",...i,...o},u={},m={};await y(u,"OAuth2PasswordBearer",[],n),t!==void 0&&(m.start=t instanceof Date?t.toISOString():t),e!==void 0&&(m.end=e instanceof Date?e.toISOString():e),h(a,m);let b=i&&i.headers?i.headers:{};return l.headers={...u,...b,...o.headers},{url:x(a),options:l}},createNode:async(s,t={})=>{f("createNode","nodeCreate",s);let e="/api/node",o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=O(s,a,n),{url:x(o),options:a}},getNode:async(s,t={})=>{f("getNode","nodeId",s);let e="/api/node/{node_id}".replace("{node_id}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},getNodeSettings:async(s={})=>{let t="/api/node/settings",e=new URL(t,g),o;n&&(o=n.baseOptions);let r={method:"GET",...o,...s},a={},i={};await y(a,"OAuth2PasswordBearer",[],n),h(e,i);let l=o&&o.headers?o.headers:{};return r.headers={...a,...l,...s.headers},{url:x(e),options:r}},getNodeStatsPeriodic:async(s,t,e,o,r={})=>{f("getNodeStatsPeriodic","nodeId",s);let a="/api/node/{node_id}/stats".replace("{node_id}",encodeURIComponent(String(s))),i=new URL(a,g),l;n&&(l=n.baseOptions);let u={method:"GET",...l,...r},m={},b={};await y(m,"OAuth2PasswordBearer",[],n),t!==void 0&&(b.start=t instanceof Date?t.toISOString():t),e!==void 0&&(b.end=e instanceof Date?e.toISOString():e),o!==void 0&&(b.period=o),h(i,b);let R=l&&l.headers?l.headers:{};return u.headers={...m,...R,...r.headers},{url:x(i),options:u}},getNodes:async(s,t,e,o,r,a,i,l={})=>{let u="/api/nodes",m=new URL(u,g),b;n&&(b=n.baseOptions);let R={method:"GET",...b,...l},P={},S={};await y(P,"OAuth2PasswordBearer",[],n),s!==void 0&&(S.core_id=s),t!==void 0&&(S.offset=t),e!==void 0&&(S.limit=e),o&&(S.status=o),r!==void 0&&(S.enabled=r),a&&(S.ids=a),i!==void 0&&(S.search=i),h(m,S);let v=b&&b.headers?b.headers:{};return R.headers={...P,...v,...l.headers},{url:x(m),options:R}},getUsage:async(s,t,e,o,r,a={})=>{let i="/api/node/usage",l=new URL(i,g),u;n&&(u=n.baseOptions);let m={method:"GET",...u,...a},b={},R={};await y(b,"OAuth2PasswordBearer",[],n),s!==void 0&&(R.start=s instanceof Date?s.toISOString():s),t!==void 0&&(R.end=t instanceof Date?t.toISOString():t),e!==void 0&&(R.period=e),o!==void 0&&(R.node_id=o),r!==void 0&&(R.group_by_node=r),h(l,R);let P=u&&u.headers?u.headers:{};return m.headers={...b,...P,...a.headers},{url:x(l),options:m}},modifyNode:async(s,t,e={})=>{f("modifyNode","nodeId",s),f("modifyNode","nodeModify",t);let o="/api/node/{node_id}".replace("{node_id}",encodeURIComponent(String(s))),r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"PUT",...a,...e},l={},u={};await y(l,"OAuth2PasswordBearer",[],n),l["Content-Type"]="application/json",h(r,u);let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},i.data=O(t,i,n),{url:x(r),options:i}},nodeLogs:async(s,t={})=>{f("nodeLogs","nodeId",s);let e="/api/node/{node_id}/logs".replace("{node_id}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},realtimeNodeStats:async(s,t={})=>{f("realtimeNodeStats","nodeId",s);let e="/api/node/{node_id}/realtime_stats".replace("{node_id}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},realtimeNodesStats:async(s={})=>{let t="/api/nodes/realtime_stats",e=new URL(t,g),o;n&&(o=n.baseOptions);let r={method:"GET",...o,...s},a={},i={};await y(a,"OAuth2PasswordBearer",[],n),h(e,i);let l=o&&o.headers?o.headers:{};return r.headers={...a,...l,...s.headers},{url:x(e),options:r}},reconnectAllNode:async(s,t={})=>{let e="/api/nodes/reconnect",o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),s!==void 0&&(l.core_id=s),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},reconnectNode:async(s,t={})=>{f("reconnectNode","nodeId",s);let e="/api/node/{node_id}/reconnect".replace("{node_id}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},removeNode:async(s,t={})=>{f("removeNode","nodeId",s);let e="/api/node/{node_id}".replace("{node_id}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"DELETE",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},resetNodeUsage:async(s,t={})=>{f("resetNodeUsage","nodeId",s);let e="/api/node/{node_id}/reset".replace("{node_id}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},syncNode:async(s,t,e={})=>{f("syncNode","nodeId",s);let o="/api/node/{node_id}/sync".replace("{node_id}",encodeURIComponent(String(s))),r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"PUT",...a,...e},l={},u={};await y(l,"OAuth2PasswordBearer",[],n),t!==void 0&&(u.flush_users=t),h(r,u);let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},{url:x(r),options:i}},userOnlineIpList:async(s,t,e={})=>{f("userOnlineIpList","nodeId",s),f("userOnlineIpList","username",t);let o="/api/node/{node_id}/online_stats/{username}/ip".replace("{node_id}",encodeURIComponent(String(s))).replace("{username}",encodeURIComponent(String(t))),r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"GET",...a,...e},l={},u={};await y(l,"OAuth2PasswordBearer",[],n),h(r,u);let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},{url:x(r),options:i}},userOnlineIpListAllNodes:async(s,t={})=>{f("userOnlineIpListAllNodes","username",s);let e="/api/node/online_stats/{username}/ip".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},userOnlineStats:async(s,t,e={})=>{f("userOnlineStats","nodeId",s),f("userOnlineStats","username",t);let o="/api/node/{node_id}/online_stats/{username}".replace("{node_id}",encodeURIComponent(String(s))).replace("{username}",encodeURIComponent(String(t))),r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"GET",...a,...e},l={},u={};await y(l,"OAuth2PasswordBearer",[],n),h(r,u);let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},{url:x(r),options:i}}}},_=function(n){let s=ce(n);return {async clearUsageData(t,e,o,r){let a=await s.clearUsageData(t,e,o,r),i=n?.serverIndex??0,l=d["NodeApi.clearUsageData"]?.[i]?.url;return (u,m)=>A(a,w__default.default,c,n)(u,l||m)},async createNode(t,e){let o=await s.createNode(t,e),r=n?.serverIndex??0,a=d["NodeApi.createNode"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async getNode(t,e){let o=await s.getNode(t,e),r=n?.serverIndex??0,a=d["NodeApi.getNode"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async getNodeSettings(t){let e=await s.getNodeSettings(t),o=n?.serverIndex??0,r=d["NodeApi.getNodeSettings"]?.[o]?.url;return (a,i)=>A(e,w__default.default,c,n)(a,r||i)},async getNodeStatsPeriodic(t,e,o,r,a){let i=await s.getNodeStatsPeriodic(t,e,o,r,a),l=n?.serverIndex??0,u=d["NodeApi.getNodeStatsPeriodic"]?.[l]?.url;return (m,b)=>A(i,w__default.default,c,n)(m,u||b)},async getNodes(t,e,o,r,a,i,l,u){let m=await s.getNodes(t,e,o,r,a,i,l,u),b=n?.serverIndex??0,R=d["NodeApi.getNodes"]?.[b]?.url;return (P,S)=>A(m,w__default.default,c,n)(P,R||S)},async getUsage(t,e,o,r,a,i){let l=await s.getUsage(t,e,o,r,a,i),u=n?.serverIndex??0,m=d["NodeApi.getUsage"]?.[u]?.url;return (b,R)=>A(l,w__default.default,c,n)(b,m||R)},async modifyNode(t,e,o){let r=await s.modifyNode(t,e,o),a=n?.serverIndex??0,i=d["NodeApi.modifyNode"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)},async nodeLogs(t,e){let o=await s.nodeLogs(t,e),r=n?.serverIndex??0,a=d["NodeApi.nodeLogs"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async realtimeNodeStats(t,e){let o=await s.realtimeNodeStats(t,e),r=n?.serverIndex??0,a=d["NodeApi.realtimeNodeStats"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async realtimeNodesStats(t){let e=await s.realtimeNodesStats(t),o=n?.serverIndex??0,r=d["NodeApi.realtimeNodesStats"]?.[o]?.url;return (a,i)=>A(e,w__default.default,c,n)(a,r||i)},async reconnectAllNode(t,e){let o=await s.reconnectAllNode(t,e),r=n?.serverIndex??0,a=d["NodeApi.reconnectAllNode"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async reconnectNode(t,e){let o=await s.reconnectNode(t,e),r=n?.serverIndex??0,a=d["NodeApi.reconnectNode"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async removeNode(t,e){let o=await s.removeNode(t,e),r=n?.serverIndex??0,a=d["NodeApi.removeNode"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async resetNodeUsage(t,e){let o=await s.resetNodeUsage(t,e),r=n?.serverIndex??0,a=d["NodeApi.resetNodeUsage"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async syncNode(t,e,o){let r=await s.syncNode(t,e,o),a=n?.serverIndex??0,i=d["NodeApi.syncNode"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)},async userOnlineIpList(t,e,o){let r=await s.userOnlineIpList(t,e,o),a=n?.serverIndex??0,i=d["NodeApi.userOnlineIpList"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)},async userOnlineIpListAllNodes(t,e){let o=await s.userOnlineIpListAllNodes(t,e),r=n?.serverIndex??0,a=d["NodeApi.userOnlineIpListAllNodes"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async userOnlineStats(t,e,o){let r=await s.userOnlineStats(t,e,o),a=n?.serverIndex??0,i=d["NodeApi.userOnlineStats"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)}}};var Q=class extends U{clearUsageData(s,t,e,o){return _(this.configuration).clearUsageData(s,t,e,o).then(r=>r(this.axios,this.basePath)).then(({data:r})=>r)}createNode(s,t){return _(this.configuration).createNode(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}getNode(s,t){return _(this.configuration).getNode(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}getNodeSettings(s){return _(this.configuration).getNodeSettings(s).then(t=>t(this.axios,this.basePath)).then(({data:t})=>t)}getNodeStatsPeriodic(s,t,e,o,r){return _(this.configuration).getNodeStatsPeriodic(s,t,e,o,r).then(a=>a(this.axios,this.basePath)).then(({data:a})=>a)}getNodes(s,t,e,o,r,a,i,l){return _(this.configuration).getNodes(s,t,e,o,r,a,i,l).then(u=>u(this.axios,this.basePath)).then(({data:u})=>u)}getUsage(s,t,e,o,r,a){return _(this.configuration).getUsage(s,t,e,o,r,a).then(i=>i(this.axios,this.basePath)).then(({data:i})=>i)}modifyNode(s,t,e){return _(this.configuration).modifyNode(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}nodeLogs(s,t){return _(this.configuration).nodeLogs(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}realtimeNodeStats(s,t){return _(this.configuration).realtimeNodeStats(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}realtimeNodesStats(s){return _(this.configuration).realtimeNodesStats(s).then(t=>t(this.axios,this.basePath)).then(({data:t})=>t)}reconnectAllNode(s,t){return _(this.configuration).reconnectAllNode(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}reconnectNode(s,t){return _(this.configuration).reconnectNode(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}removeNode(s,t){return _(this.configuration).removeNode(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}resetNodeUsage(s,t){return _(this.configuration).resetNodeUsage(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}syncNode(s,t,e){return _(this.configuration).syncNode(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}userOnlineIpList(s,t,e){return _(this.configuration).userOnlineIpList(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}userOnlineIpListAllNodes(s,t){return _(this.configuration).userOnlineIpListAllNodes(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}userOnlineStats(s,t,e){return _(this.configuration).userOnlineStats(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}};var de=function(n){return {getSubUserUsage:async(s,t,e,o,r={})=>{f("getSubUserUsage","token",s);let a="/sub/{token}/usage".replace("{token}",encodeURIComponent(String(s))),i=new URL(a,g),l;n&&(l=n.baseOptions);let u={method:"GET",...l,...r},m={},b={};t!==void 0&&(b.start=t instanceof Date?t.toISOString():t),e!==void 0&&(b.end=e instanceof Date?e.toISOString():e),o!==void 0&&(b.period=o),h(i,b);let R=l&&l.headers?l.headers:{};return u.headers={...m,...R,...r.headers},{url:x(i),options:u}},userSubscription:async(s,t,e={})=>{f("userSubscription","token",s);let o="/sub/{token}/".replace("{token}",encodeURIComponent(String(s))),r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"GET",...a,...e},l={},u={};t!=null&&(l["user-agent"]=String(t)),h(r,u);let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},{url:x(r),options:i}},userSubscriptionApps:async(s,t={})=>{f("userSubscriptionApps","token",s);let e="/sub/{token}/apps".replace("{token}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={};h(o,{});let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},userSubscriptionInfo:async(s,t={})=>{f("userSubscriptionInfo","token",s);let e="/sub/{token}/info".replace("{token}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={};h(o,{});let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},userSubscriptionWithClientType:async(s,t,e={})=>{f("userSubscriptionWithClientType","token",s),f("userSubscriptionWithClientType","clientType",t);let o="/sub/{token}/{client_type}".replace("{token}",encodeURIComponent(String(s))).replace("{client_type}",encodeURIComponent(String(t))),r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"GET",...a,...e},l={};h(r,{});let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},{url:x(r),options:i}}}},H=function(n){let s=de(n);return {async getSubUserUsage(t,e,o,r,a){let i=await s.getSubUserUsage(t,e,o,r,a),l=n?.serverIndex??0,u=d["SubscriptionApi.getSubUserUsage"]?.[l]?.url;return (m,b)=>A(i,w__default.default,c,n)(m,u||b)},async userSubscription(t,e,o){let r=await s.userSubscription(t,e,o),a=n?.serverIndex??0,i=d["SubscriptionApi.userSubscription"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)},async userSubscriptionApps(t,e){let o=await s.userSubscriptionApps(t,e),r=n?.serverIndex??0,a=d["SubscriptionApi.userSubscriptionApps"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async userSubscriptionInfo(t,e){let o=await s.userSubscriptionInfo(t,e),r=n?.serverIndex??0,a=d["SubscriptionApi.userSubscriptionInfo"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async userSubscriptionWithClientType(t,e,o){let r=await s.userSubscriptionWithClientType(t,e,o),a=n?.serverIndex??0,i=d["SubscriptionApi.userSubscriptionWithClientType"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)}}};var $=class extends U{getSubUserUsage(s,t,e,o,r){return H(this.configuration).getSubUserUsage(s,t,e,o,r).then(a=>a(this.axios,this.basePath)).then(({data:a})=>a)}userSubscription(s,t,e){return H(this.configuration).userSubscription(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}userSubscriptionApps(s,t){return H(this.configuration).userSubscriptionApps(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}userSubscriptionInfo(s,t){return H(this.configuration).userSubscriptionInfo(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}userSubscriptionWithClientType(s,t,e){return H(this.configuration).userSubscriptionWithClientType(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}};var ge=function(n){return {getInbounds:async(s={})=>{let t="/api/inbounds",e=new URL(t,g),o;n&&(o=n.baseOptions);let r={method:"GET",...o,...s},a={},i={};await y(a,"OAuth2PasswordBearer",[],n),h(e,i);let l=o&&o.headers?o.headers:{};return r.headers={...a,...l,...s.headers},{url:x(e),options:r}},getSystemStats:async(s,t={})=>{let e="/api/system",o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),s!==void 0&&(l.admin_username=s),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}}}},re=function(n){let s=ge(n);return {async getInbounds(t){let e=await s.getInbounds(t),o=n?.serverIndex??0,r=d["SystemApi.getInbounds"]?.[o]?.url;return (a,i)=>A(e,w__default.default,c,n)(a,r||i)},async getSystemStats(t,e){let o=await s.getSystemStats(t,e),r=n?.serverIndex??0,a=d["SystemApi.getSystemStats"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)}}};var X=class extends U{getInbounds(s){return re(this.configuration).getInbounds(s).then(t=>t(this.axios,this.basePath)).then(({data:t})=>t)}getSystemStats(s,t){return re(this.configuration).getSystemStats(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}};var he=function(n){return {activeNextPlan:async(s,t={})=>{f("activeNextPlan","username",s);let e="/api/user/{username}/active_next".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},bulkModifyUsersDatalimit:async(s,t={})=>{f("bulkModifyUsersDatalimit","bulkUser",s);let e="/api/users/bulk/data_limit",o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=O(s,a,n),{url:x(o),options:a}},bulkModifyUsersExpire:async(s,t={})=>{f("bulkModifyUsersExpire","bulkUser",s);let e="/api/users/bulk/expire",o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=O(s,a,n),{url:x(o),options:a}},bulkModifyUsersProxySettings:async(s,t={})=>{f("bulkModifyUsersProxySettings","bulkUsersProxy",s);let e="/api/users/bulk/proxy_settings",o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=O(s,a,n),{url:x(o),options:a}},createUser:async(s,t={})=>{f("createUser","userCreate",s);let e="/api/user",o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=O(s,a,n),{url:x(o),options:a}},createUserFromTemplate:async(s,t={})=>{f("createUserFromTemplate","createUserFromTemplate",s);let e="/api/user/from_template",o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=O(s,a,n),{url:x(o),options:a}},deleteExpiredUsers:async(s,t,e,o={})=>{let r="/api/users/expired",a=new URL(r,g),i;n&&(i=n.baseOptions);let l={method:"DELETE",...i,...o},u={},m={};await y(u,"OAuth2PasswordBearer",[],n),s!==void 0&&(m.admin_username=s),t!==void 0&&(m.expired_after=t instanceof Date?t.toISOString():t),e!==void 0&&(m.expired_before=e instanceof Date?e.toISOString():e),h(a,m);let b=i&&i.headers?i.headers:{};return l.headers={...u,...b,...o.headers},{url:x(a),options:l}},getExpiredUsers:async(s,t,e,o={})=>{let r="/api/users/expired",a=new URL(r,g),i;n&&(i=n.baseOptions);let l={method:"GET",...i,...o},u={},m={};await y(u,"OAuth2PasswordBearer",[],n),s!==void 0&&(m.admin_username=s),t!==void 0&&(m.expired_after=t instanceof Date?t.toISOString():t),e!==void 0&&(m.expired_before=e instanceof Date?e.toISOString():e),h(a,m);let b=i&&i.headers?i.headers:{};return l.headers={...u,...b,...o.headers},{url:x(a),options:l}},getUser:async(s,t={})=>{f("getUser","username",s);let e="/api/user/{username}".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},getUserSubUpdateList:async(s,t,e,o={})=>{f("getUserSubUpdateList","username",s);let r="/api/user/{username}/sub_update".replace("{username}",encodeURIComponent(String(s))),a=new URL(r,g),i;n&&(i=n.baseOptions);let l={method:"GET",...i,...o},u={},m={};await y(u,"OAuth2PasswordBearer",[],n),t!==void 0&&(m.offset=t),e!==void 0&&(m.limit=e),h(a,m);let b=i&&i.headers?i.headers:{};return l.headers={...u,...b,...o.headers},{url:x(a),options:l}},getUserUsage:async(s,t,e,o,r,a,i={})=>{f("getUserUsage","username",s),f("getUserUsage","period",t);let l="/api/user/{username}/usage".replace("{username}",encodeURIComponent(String(s))),u=new URL(l,g),m;n&&(m=n.baseOptions);let b={method:"GET",...m,...i},R={},P={};await y(R,"OAuth2PasswordBearer",[],n),t!==void 0&&(P.period=t),e!==void 0&&(P.node_id=e),o!==void 0&&(P.group_by_node=o),r!==void 0&&(P.start=r instanceof Date?r.toISOString():r),a!==void 0&&(P.end=a instanceof Date?a.toISOString():a),h(u,P);let S=m&&m.headers?m.headers:{};return b.headers={...R,...S,...i.headers},{url:x(u),options:b}},getUsers:async(s,t,e,o,r,a,i,l,u,m,b={})=>{let R="/api/users",P=new URL(R,g),S;n&&(S=n.baseOptions);let v={method:"GET",...S,...b},F={},q={};await y(F,"OAuth2PasswordBearer",[],n),s!==void 0&&(q.offset=s),t!==void 0&&(q.limit=t),e&&(q.username=e),o&&(q.admin=o),r&&(q.group=r),a!==void 0&&(q.search=a),i!==void 0&&(q.status=i),l!==void 0&&(q.sort=l),u!==void 0&&(q.proxy_id=u),m!==void 0&&(q.load_sub=m),h(P,q);let ie=S&&S.headers?S.headers:{};return v.headers={...F,...ie,...b.headers},{url:x(P),options:v}},getUsersSubUpdateChart:async(s,t,e={})=>{let o="/api/users/sub_update/chart",r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"GET",...a,...e},l={},u={};await y(l,"OAuth2PasswordBearer",[],n),s!==void 0&&(u.username=s),t!==void 0&&(u.admin_id=t),h(r,u);let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},{url:x(r),options:i}},getUsersUsage:async(s,t,e,o,r,a,i={})=>{f("getUsersUsage","period",s);let l="/api/users/usage",u=new URL(l,g),m;n&&(m=n.baseOptions);let b={method:"GET",...m,...i},R={},P={};await y(R,"OAuth2PasswordBearer",[],n),s!==void 0&&(P.period=s),t!==void 0&&(P.node_id=t),e!==void 0&&(P.group_by_node=e),o!==void 0&&(P.start=o instanceof Date?o.toISOString():o),r!==void 0&&(P.end=r instanceof Date?r.toISOString():r),a&&(P.admin=a),h(u,P);let S=m&&m.headers?m.headers:{};return b.headers={...R,...S,...i.headers},{url:x(u),options:b}},modifyUser:async(s,t,e={})=>{f("modifyUser","username",s),f("modifyUser","userModify",t);let o="/api/user/{username}".replace("{username}",encodeURIComponent(String(s))),r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"PUT",...a,...e},l={},u={};await y(l,"OAuth2PasswordBearer",[],n),l["Content-Type"]="application/json",h(r,u);let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},i.data=O(t,i,n),{url:x(r),options:i}},modifyUserWithTemplate:async(s,t,e={})=>{f("modifyUserWithTemplate","username",s),f("modifyUserWithTemplate","modifyUserByTemplate",t);let o="/api/user/from_template/{username}".replace("{username}",encodeURIComponent(String(s))),r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"PUT",...a,...e},l={},u={};await y(l,"OAuth2PasswordBearer",[],n),l["Content-Type"]="application/json",h(r,u);let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},i.data=O(t,i,n),{url:x(r),options:i}},removeUser:async(s,t={})=>{f("removeUser","username",s);let e="/api/user/{username}".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"DELETE",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},resetUserDataUsage:async(s,t={})=>{f("resetUserDataUsage","username",s);let e="/api/user/{username}/reset".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},resetUsersDataUsage:async(s={})=>{let t="/api/users/reset",e=new URL(t,g),o;n&&(o=n.baseOptions);let r={method:"POST",...o,...s},a={},i={};await y(a,"OAuth2PasswordBearer",[],n),h(e,i);let l=o&&o.headers?o.headers:{};return r.headers={...a,...l,...s.headers},{url:x(e),options:r}},revokeUserSubscription:async(s,t={})=>{f("revokeUserSubscription","username",s);let e="/api/user/{username}/revoke_sub".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},setOwner:async(s,t,e={})=>{f("setOwner","username",s),f("setOwner","adminUsername",t);let o="/api/user/{username}/set_owner".replace("{username}",encodeURIComponent(String(s))),r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"PUT",...a,...e},l={},u={};await y(l,"OAuth2PasswordBearer",[],n),t!==void 0&&(u.admin_username=t),h(r,u);let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},{url:x(r),options:i}}}},C=function(n){let s=he(n);return {async activeNextPlan(t,e){let o=await s.activeNextPlan(t,e),r=n?.serverIndex??0,a=d["UserApi.activeNextPlan"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async bulkModifyUsersDatalimit(t,e){let o=await s.bulkModifyUsersDatalimit(t,e),r=n?.serverIndex??0,a=d["UserApi.bulkModifyUsersDatalimit"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async bulkModifyUsersExpire(t,e){let o=await s.bulkModifyUsersExpire(t,e),r=n?.serverIndex??0,a=d["UserApi.bulkModifyUsersExpire"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async bulkModifyUsersProxySettings(t,e){let o=await s.bulkModifyUsersProxySettings(t,e),r=n?.serverIndex??0,a=d["UserApi.bulkModifyUsersProxySettings"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async createUser(t,e){let o=await s.createUser(t,e),r=n?.serverIndex??0,a=d["UserApi.createUser"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async createUserFromTemplate(t,e){let o=await s.createUserFromTemplate(t,e),r=n?.serverIndex??0,a=d["UserApi.createUserFromTemplate"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async deleteExpiredUsers(t,e,o,r){let a=await s.deleteExpiredUsers(t,e,o,r),i=n?.serverIndex??0,l=d["UserApi.deleteExpiredUsers"]?.[i]?.url;return (u,m)=>A(a,w__default.default,c,n)(u,l||m)},async getExpiredUsers(t,e,o,r){let a=await s.getExpiredUsers(t,e,o,r),i=n?.serverIndex??0,l=d["UserApi.getExpiredUsers"]?.[i]?.url;return (u,m)=>A(a,w__default.default,c,n)(u,l||m)},async getUser(t,e){let o=await s.getUser(t,e),r=n?.serverIndex??0,a=d["UserApi.getUser"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async getUserSubUpdateList(t,e,o,r){let a=await s.getUserSubUpdateList(t,e,o,r),i=n?.serverIndex??0,l=d["UserApi.getUserSubUpdateList"]?.[i]?.url;return (u,m)=>A(a,w__default.default,c,n)(u,l||m)},async getUserUsage(t,e,o,r,a,i,l){let u=await s.getUserUsage(t,e,o,r,a,i,l),m=n?.serverIndex??0,b=d["UserApi.getUserUsage"]?.[m]?.url;return (R,P)=>A(u,w__default.default,c,n)(R,b||P)},async getUsers(t,e,o,r,a,i,l,u,m,b,R){let P=await s.getUsers(t,e,o,r,a,i,l,u,m,b,R),S=n?.serverIndex??0,v=d["UserApi.getUsers"]?.[S]?.url;return (F,q)=>A(P,w__default.default,c,n)(F,v||q)},async getUsersSubUpdateChart(t,e,o){let r=await s.getUsersSubUpdateChart(t,e,o),a=n?.serverIndex??0,i=d["UserApi.getUsersSubUpdateChart"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)},async getUsersUsage(t,e,o,r,a,i,l){let u=await s.getUsersUsage(t,e,o,r,a,i,l),m=n?.serverIndex??0,b=d["UserApi.getUsersUsage"]?.[m]?.url;return (R,P)=>A(u,w__default.default,c,n)(R,b||P)},async modifyUser(t,e,o){let r=await s.modifyUser(t,e,o),a=n?.serverIndex??0,i=d["UserApi.modifyUser"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)},async modifyUserWithTemplate(t,e,o){let r=await s.modifyUserWithTemplate(t,e,o),a=n?.serverIndex??0,i=d["UserApi.modifyUserWithTemplate"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)},async removeUser(t,e){let o=await s.removeUser(t,e),r=n?.serverIndex??0,a=d["UserApi.removeUser"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async resetUserDataUsage(t,e){let o=await s.resetUserDataUsage(t,e),r=n?.serverIndex??0,a=d["UserApi.resetUserDataUsage"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async resetUsersDataUsage(t){let e=await s.resetUsersDataUsage(t),o=n?.serverIndex??0,r=d["UserApi.resetUsersDataUsage"]?.[o]?.url;return (a,i)=>A(e,w__default.default,c,n)(a,r||i)},async revokeUserSubscription(t,e){let o=await s.revokeUserSubscription(t,e),r=n?.serverIndex??0,a=d["UserApi.revokeUserSubscription"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async setOwner(t,e,o){let r=await s.setOwner(t,e,o),a=n?.serverIndex??0,i=d["UserApi.setOwner"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)}}};var z=class extends U{activeNextPlan(s,t){return C(this.configuration).activeNextPlan(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}bulkModifyUsersDatalimit(s,t){return C(this.configuration).bulkModifyUsersDatalimit(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}bulkModifyUsersExpire(s,t){return C(this.configuration).bulkModifyUsersExpire(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}bulkModifyUsersProxySettings(s,t){return C(this.configuration).bulkModifyUsersProxySettings(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}createUser(s,t){return C(this.configuration).createUser(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}createUserFromTemplate(s,t){return C(this.configuration).createUserFromTemplate(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}deleteExpiredUsers(s,t,e,o){return C(this.configuration).deleteExpiredUsers(s,t,e,o).then(r=>r(this.axios,this.basePath)).then(({data:r})=>r)}getExpiredUsers(s,t,e,o){return C(this.configuration).getExpiredUsers(s,t,e,o).then(r=>r(this.axios,this.basePath)).then(({data:r})=>r)}getUser(s,t){return C(this.configuration).getUser(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}getUserSubUpdateList(s,t,e,o){return C(this.configuration).getUserSubUpdateList(s,t,e,o).then(r=>r(this.axios,this.basePath)).then(({data:r})=>r)}getUserUsage(s,t,e,o,r,a,i){return C(this.configuration).getUserUsage(s,t,e,o,r,a,i).then(l=>l(this.axios,this.basePath)).then(({data:l})=>l)}getUsers(s,t,e,o,r,a,i,l,u,m,b){return C(this.configuration).getUsers(s,t,e,o,r,a,i,l,u,m,b).then(R=>R(this.axios,this.basePath)).then(({data:R})=>R)}getUsersSubUpdateChart(s,t,e){return C(this.configuration).getUsersSubUpdateChart(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}getUsersUsage(s,t,e,o,r,a,i){return C(this.configuration).getUsersUsage(s,t,e,o,r,a,i).then(l=>l(this.axios,this.basePath)).then(({data:l})=>l)}modifyUser(s,t,e){return C(this.configuration).modifyUser(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}modifyUserWithTemplate(s,t,e){return C(this.configuration).modifyUserWithTemplate(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}removeUser(s,t){return C(this.configuration).removeUser(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}resetUserDataUsage(s,t){return C(this.configuration).resetUserDataUsage(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}resetUsersDataUsage(s){return C(this.configuration).resetUsersDataUsage(s).then(t=>t(this.axios,this.basePath)).then(({data:t})=>t)}revokeUserSubscription(s,t){return C(this.configuration).revokeUserSubscription(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}setOwner(s,t,e){return C(this.configuration).setOwner(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}};var xe=function(n){return {createUserTemplate:async(s,t={})=>{f("createUserTemplate","userTemplateCreate",s);let e="/api/user_template",o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=O(s,a,n),{url:x(o),options:a}},getUserTemplate:async(s,t={})=>{f("getUserTemplate","templateId",s);let e="/api/user_template/{template_id}".replace("{template_id}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},getUserTemplates:async(s,t,e={})=>{let o="/api/user_templates",r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"GET",...a,...e},l={},u={};await y(l,"OAuth2PasswordBearer",[],n),s!==void 0&&(u.offset=s),t!==void 0&&(u.limit=t),h(r,u);let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},{url:x(r),options:i}},modifyUserTemplate:async(s,t,e={})=>{f("modifyUserTemplate","templateId",s),f("modifyUserTemplate","userTemplateModify",t);let o="/api/user_template/{template_id}".replace("{template_id}",encodeURIComponent(String(s))),r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"PUT",...a,...e},l={},u={};await y(l,"OAuth2PasswordBearer",[],n),l["Content-Type"]="application/json",h(r,u);let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},i.data=O(t,i,n),{url:x(r),options:i}},removeUserTemplate:async(s,t={})=>{f("removeUserTemplate","templateId",s);let e="/api/user_template/{template_id}".replace("{template_id}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"DELETE",...r,...t},i={},l={};await y(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}}}},E=function(n){let s=xe(n);return {async createUserTemplate(t,e){let o=await s.createUserTemplate(t,e),r=n?.serverIndex??0,a=d["UserTemplateApi.createUserTemplate"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async getUserTemplate(t,e){let o=await s.getUserTemplate(t,e),r=n?.serverIndex??0,a=d["UserTemplateApi.getUserTemplate"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async getUserTemplates(t,e,o){let r=await s.getUserTemplates(t,e,o),a=n?.serverIndex??0,i=d["UserTemplateApi.getUserTemplates"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)},async modifyUserTemplate(t,e,o){let r=await s.modifyUserTemplate(t,e,o),a=n?.serverIndex??0,i=d["UserTemplateApi.modifyUserTemplate"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)},async removeUserTemplate(t,e){let o=await s.removeUserTemplate(t,e),r=n?.serverIndex??0,a=d["UserTemplateApi.removeUserTemplate"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)}}};var W=class extends U{createUserTemplate(s,t){return E(this.configuration).createUserTemplate(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}getUserTemplate(s,t){return E(this.configuration).getUserTemplate(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}getUserTemplates(s,t,e){return E(this.configuration).getUserTemplates(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}modifyUserTemplate(s,t,e){return E(this.configuration).modifyUserTemplate(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}removeUserTemplate(s,t){return E(this.configuration).removeUserTemplate(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}};var K=class{constructor(s={}){this.apiKey=s.apiKey,this.username=s.username,this.password=s.password,this.accessToken=s.accessToken,this.basePath=s.basePath,this.serverIndex=s.serverIndex,this.baseOptions={...s.baseOptions,headers:{...s.baseOptions?.headers}},this.formDataCtor=s.formDataCtor;}isJsonMime(s){let t=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return s!==null&&(t.test(s)||s.toLowerCase()==="application/json-patch+json")}};var oe=(n,s)=>{let t=w__default.default.create({baseURL:n});return fe__default.default(t,{retries:s?.retries??3,retryDelay:e=>e*1e3}),t};var Y=class extends Error{constructor(s){super(s),this.name="AuthenticationError";}},J=class{constructor(s){this.authPromise=null;this.isAuthenticating=false;this.configuration=s;}async authenticate(s,t){return this.authPromise?this.authPromise:(this.isAuthenticating=true,this.authPromise=new Promise((e,o)=>{(async()=>{try{let i=await new B(this.configuration).adminToken(s,t);i?.access_token?(this.configuration.accessToken=i.access_token,e()):(this.configuration.accessToken=void 0,o(new Y("Failed to retrieve access token")));}catch(a){console.error("Authentication failed",a),this.configuration.accessToken=void 0,o(new Y("Authentication failed"));}finally{this.authPromise=null,this.isAuthenticating=false;}})();}),this.authPromise)}async waitForAuth(){await this.authPromise;}retryAuth(){return this.authenticate(this.configuration.username,this.configuration.password)}get accessToken(){return this.configuration.accessToken?.toString()||""}set accessToken(s){this.configuration.accessToken=s;}};var ae=(n,s,t)=>{n.interceptors.request.use(async e=>{await s.waitForAuth();let o=s.accessToken;return e.headers.authorization=o?`Bearer ${o}`:void 0,e},e=>Promise.reject(e)),n.interceptors.response.use(e=>e,async e=>{let o=e?.config;if(e?.response?.status===401&&!o?.sent){o.sent=true;try{await s.authenticate(t.username,t.password);let r=s.accessToken;if(r)return o.headers.authorization=`Bearer ${r}`,n(o)}catch(r){return Promise.reject(r)}}return Promise.reject(e)});};var ne=class{constructor(s){if(!s.username||!s.password)throw new Error("No credentials provided for authentication");this.configuration=new K({basePath:s.baseUrl,username:s.username,password:s.password,accessToken:s.token}),this.client=oe(s.baseUrl,{retries:s.retries}),this.authService=new J(this.configuration),this.admin=new B(this.configuration,s.baseUrl,this.client),this.core=new G(this.configuration,s.baseUrl,this.client),this.node=new Q(this.configuration,s.baseUrl,this.client),this.user=new z(this.configuration,s.baseUrl,this.client),this.system=new X(this.configuration,s.baseUrl,this.client),this.default=new D(this.configuration,s.baseUrl,this.client),this.subscription=new $(this.configuration,s.baseUrl,this.client),this.userTemplate=new W(this.configuration,s.baseUrl,this.client),ae(this.client,this.authService,s),!s.token&&s.authenticateOnInit!==false&&this.authService.authenticate(s.username,s.password);}async getAuthToken(){return await this.authService.waitForAuth(),this.authService.accessToken}authorize(s=false){return this.authService.isAuthenticating&&!s?this.authService.authPromise:this.authService.authenticate(this.configuration.username,this.configuration.password)}};
|
|
1
|
+
'use strict';var w=require('axios'),ye=require('axios-retry');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var w__default=/*#__PURE__*/_interopDefault(w);var ye__default=/*#__PURE__*/_interopDefault(ye);var c="http://localhost".replace(/\/+$/,"");var U=class{constructor(s,t=c,e=w__default.default){this.basePath=t;this.axios=e;s&&(this.configuration=s,this.basePath=s.basePath??t);}},j=class extends Error{constructor(t,e){super(e);this.field=t;this.name="RequiredError";}},d={};var g="https://example.com",y=function(n,s,t){if(t==null)throw new j(s,`Required parameter ${s} was null or undefined when calling ${n}.`)};var f=async function(n,s,t,e){if(e&&e.accessToken){let o=typeof e.accessToken=="function"?await e.accessToken(s,t):await e.accessToken;n.Authorization="Bearer "+o;}};function Z(n,s,t=""){s!=null&&(typeof s=="object"?Array.isArray(s)?s.forEach(e=>Z(n,e,t)):Object.keys(s).forEach(e=>Z(n,s[e],`${t}${t!==""?".":""}${e}`)):n.has(t)?n.append(t,s):n.set(t,s));}var h=function(n,...s){let t=new URLSearchParams(n.search);Z(t,s),n.search=t.toString();},O=function(n,s,t){let e=typeof n!="string";return (e&&t&&t.isJsonMime?t.isJsonMime(s.headers["Content-Type"]):e)?JSON.stringify(n!==void 0?n:{}):n||""},x=function(n){return n.pathname+n.search+n.hash},A=function(n,s,t,e){return (o=s,r=t)=>{let a={...n.options,url:(o.defaults.baseURL?"":e?.basePath??r)+n.url};return o.request(a)}};var ue=function(n){return {activateAllDisabledUsers:async(s,t={})=>{y("activateAllDisabledUsers","username",s);let e="/api/admin/{username}/users/activate".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},adminMiniAppToken:async(s,t={})=>{y("adminMiniAppToken","xTelegramAuthorization",s);let e="/api/admin/miniapp/token",o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};s!=null&&(i["x-telegram-authorization"]=String(s)),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},adminToken:async(s,t,e,o,r,a,i={})=>{y("adminToken","username",s),y("adminToken","password",t);let l="/api/admin/token",u=new URL(l,g),m;n&&(m=n.baseOptions);let b={method:"POST",...m,...i},R={},P={},S=new URLSearchParams;e!==void 0&&S.set("grant_type",e),s!==void 0&&S.set("username",s),t!==void 0&&S.set("password",t),o!==void 0&&S.set("scope",o),r!==void 0&&S.set("client_id",r),a!==void 0&&S.set("client_secret",a),R["Content-Type"]="application/x-www-form-urlencoded",h(u,P);let v=m&&m.headers?m.headers:{};return b.headers={...R,...v,...i.headers},b.data=S.toString(),{url:x(u),options:b}},createAdmin:async(s,t={})=>{y("createAdmin","adminCreate",s);let e="/api/admin",o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=O(s,a,n),{url:x(o),options:a}},disableAllActiveUsers:async(s,t={})=>{y("disableAllActiveUsers","username",s);let e="/api/admin/{username}/users/disable".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},getAdmins:async(s,t,e,o,r={})=>{let a="/api/admins",i=new URL(a,g),l;n&&(l=n.baseOptions);let u={method:"GET",...l,...r},m={},b={};await f(m,"OAuth2PasswordBearer",[],n),s!==void 0&&(b.username=s),t!==void 0&&(b.offset=t),e!==void 0&&(b.limit=e),o!==void 0&&(b.sort=o),h(i,b);let R=l&&l.headers?l.headers:{};return u.headers={...m,...R,...r.headers},{url:x(i),options:u}},getCurrentAdmin:async(s={})=>{let t="/api/admin",e=new URL(t,g),o;n&&(o=n.baseOptions);let r={method:"GET",...o,...s},a={},i={};await f(a,"OAuth2PasswordBearer",[],n),h(e,i);let l=o&&o.headers?o.headers:{};return r.headers={...a,...l,...s.headers},{url:x(e),options:r}},modifyAdmin:async(s,t,e={})=>{y("modifyAdmin","username",s),y("modifyAdmin","adminModify",t);let o="/api/admin/{username}".replace("{username}",encodeURIComponent(String(s))),r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"PUT",...a,...e},l={},u={};await f(l,"OAuth2PasswordBearer",[],n),l["Content-Type"]="application/json",h(r,u);let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},i.data=O(t,i,n),{url:x(r),options:i}},removeAdmin:async(s,t={})=>{y("removeAdmin","username",s);let e="/api/admin/{username}".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"DELETE",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},removeAllUsers:async(s,t={})=>{y("removeAllUsers","username",s);let e="/api/admin/{username}/users".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"DELETE",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},resetAdminUsage:async(s,t={})=>{y("resetAdminUsage","username",s);let e="/api/admin/{username}/reset".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}}}},I=function(n){let s=ue(n);return {async activateAllDisabledUsers(t,e){let o=await s.activateAllDisabledUsers(t,e),r=n?.serverIndex??0,a=d["AdminApi.activateAllDisabledUsers"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async adminMiniAppToken(t,e){let o=await s.adminMiniAppToken(t,e),r=n?.serverIndex??0,a=d["AdminApi.adminMiniAppToken"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async adminToken(t,e,o,r,a,i,l){let u=await s.adminToken(t,e,o,r,a,i,l),m=n?.serverIndex??0,b=d["AdminApi.adminToken"]?.[m]?.url;return (R,P)=>A(u,w__default.default,c,n)(R,b||P)},async createAdmin(t,e){let o=await s.createAdmin(t,e),r=n?.serverIndex??0,a=d["AdminApi.createAdmin"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async disableAllActiveUsers(t,e){let o=await s.disableAllActiveUsers(t,e),r=n?.serverIndex??0,a=d["AdminApi.disableAllActiveUsers"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async getAdmins(t,e,o,r,a){let i=await s.getAdmins(t,e,o,r,a),l=n?.serverIndex??0,u=d["AdminApi.getAdmins"]?.[l]?.url;return (m,b)=>A(i,w__default.default,c,n)(m,u||b)},async getCurrentAdmin(t){let e=await s.getCurrentAdmin(t),o=n?.serverIndex??0,r=d["AdminApi.getCurrentAdmin"]?.[o]?.url;return (a,i)=>A(e,w__default.default,c,n)(a,r||i)},async modifyAdmin(t,e,o){let r=await s.modifyAdmin(t,e,o),a=n?.serverIndex??0,i=d["AdminApi.modifyAdmin"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)},async removeAdmin(t,e){let o=await s.removeAdmin(t,e),r=n?.serverIndex??0,a=d["AdminApi.removeAdmin"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async removeAllUsers(t,e){let o=await s.removeAllUsers(t,e),r=n?.serverIndex??0,a=d["AdminApi.removeAllUsers"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async resetAdminUsage(t,e){let o=await s.resetAdminUsage(t,e),r=n?.serverIndex??0,a=d["AdminApi.resetAdminUsage"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)}}};var B=class extends U{activateAllDisabledUsers(s,t){return I(this.configuration).activateAllDisabledUsers(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}adminMiniAppToken(s,t){return I(this.configuration).adminMiniAppToken(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}adminToken(s,t,e,o,r,a,i){return I(this.configuration).adminToken(s,t,e,o,r,a,i).then(l=>l(this.axios,this.basePath)).then(({data:l})=>l)}createAdmin(s,t){return I(this.configuration).createAdmin(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}disableAllActiveUsers(s,t){return I(this.configuration).disableAllActiveUsers(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}getAdmins(s,t,e,o,r){return I(this.configuration).getAdmins(s,t,e,o,r).then(a=>a(this.axios,this.basePath)).then(({data:a})=>a)}getCurrentAdmin(s){return I(this.configuration).getCurrentAdmin(s).then(t=>t(this.axios,this.basePath)).then(({data:t})=>t)}modifyAdmin(s,t,e){return I(this.configuration).modifyAdmin(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}removeAdmin(s,t){return I(this.configuration).removeAdmin(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}removeAllUsers(s,t){return I(this.configuration).removeAllUsers(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}resetAdminUsage(s,t){return I(this.configuration).resetAdminUsage(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}};var pe=function(n){return {createCoreConfig:async(s,t={})=>{y("createCoreConfig","coreCreate",s);let e="/api/core",o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=O(s,a,n),{url:x(o),options:a}},deleteCoreConfig:async(s,t,e={})=>{y("deleteCoreConfig","coreId",s);let o="/api/core/{core_id}".replace("{core_id}",encodeURIComponent(String(s))),r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"DELETE",...a,...e},l={},u={};await f(l,"OAuth2PasswordBearer",[],n),t!==void 0&&(u.restart_nodes=t),h(r,u);let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},{url:x(r),options:i}},getAllCores:async(s,t,e={})=>{let o="/api/cores",r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"GET",...a,...e},l={},u={};await f(l,"OAuth2PasswordBearer",[],n),s!==void 0&&(u.offset=s),t!==void 0&&(u.limit=t),h(r,u);let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},{url:x(r),options:i}},getCoreConfig:async(s,t={})=>{y("getCoreConfig","coreId",s);let e="/api/core/{core_id}".replace("{core_id}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},modifyCoreConfig:async(s,t,e,o={})=>{y("modifyCoreConfig","coreId",s),y("modifyCoreConfig","restartNodes",t),y("modifyCoreConfig","coreCreate",e);let r="/api/core/{core_id}".replace("{core_id}",encodeURIComponent(String(s))),a=new URL(r,g),i;n&&(i=n.baseOptions);let l={method:"PUT",...i,...o},u={},m={};await f(u,"OAuth2PasswordBearer",[],n),t!==void 0&&(m.restart_nodes=t),u["Content-Type"]="application/json",h(a,m);let b=i&&i.headers?i.headers:{};return l.headers={...u,...b,...o.headers},l.data=O(e,l,n),{url:x(a),options:l}},restartCore:async(s,t={})=>{y("restartCore","coreId",s);let e="/api/core/{core_id}/restart".replace("{core_id}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}}}},k=function(n){let s=pe(n);return {async createCoreConfig(t,e){let o=await s.createCoreConfig(t,e),r=n?.serverIndex??0,a=d["CoreApi.createCoreConfig"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async deleteCoreConfig(t,e,o){let r=await s.deleteCoreConfig(t,e,o),a=n?.serverIndex??0,i=d["CoreApi.deleteCoreConfig"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)},async getAllCores(t,e,o){let r=await s.getAllCores(t,e,o),a=n?.serverIndex??0,i=d["CoreApi.getAllCores"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)},async getCoreConfig(t,e){let o=await s.getCoreConfig(t,e),r=n?.serverIndex??0,a=d["CoreApi.getCoreConfig"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async modifyCoreConfig(t,e,o,r){let a=await s.modifyCoreConfig(t,e,o,r),i=n?.serverIndex??0,l=d["CoreApi.modifyCoreConfig"]?.[i]?.url;return (u,m)=>A(a,w__default.default,c,n)(u,l||m)},async restartCore(t,e){let o=await s.restartCore(t,e),r=n?.serverIndex??0,a=d["CoreApi.restartCore"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)}}};var G=class extends U{createCoreConfig(s,t){return k(this.configuration).createCoreConfig(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}deleteCoreConfig(s,t,e){return k(this.configuration).deleteCoreConfig(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}getAllCores(s,t,e){return k(this.configuration).getAllCores(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}getCoreConfig(s,t){return k(this.configuration).getCoreConfig(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}modifyCoreConfig(s,t,e,o){return k(this.configuration).modifyCoreConfig(s,t,e,o).then(r=>r(this.axios,this.basePath)).then(({data:r})=>r)}restartCore(s,t){return k(this.configuration).restartCore(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}};var me=function(n){return {base:async(s={})=>{let e=new URL("/",g),o;n&&(o=n.baseOptions);let r={method:"GET",...o,...s},a={};h(e,{});let l=o&&o.headers?o.headers:{};return r.headers={...a,...l,...s.headers},{url:x(e),options:r}},getManifest:async(s,t={})=>{let e="/manifest.json",o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};s!==void 0&&(l.start_url=s),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}}}},te=function(n){let s=me(n);return {async base(t){let e=await s.base(t),o=n?.serverIndex??0,r=d["DefaultApi.base"]?.[o]?.url;return (a,i)=>A(e,w__default.default,c,n)(a,r||i)},async getManifest(t,e){let o=await s.getManifest(t,e),r=n?.serverIndex??0,a=d["DefaultApi.getManifest"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)}}};var D=class extends U{base(s){return te(this.configuration).base(s).then(t=>t(this.axios,this.basePath)).then(({data:t})=>t)}getManifest(s,t){return te(this.configuration).getManifest(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}};var ce=function(n){return {clearUsageData:async(s,t,e,o={})=>{y("clearUsageData","table",s);let r="/api/nodes/clear_usage_data/{table}".replace("{table}",encodeURIComponent(String(s))),a=new URL(r,g),i;n&&(i=n.baseOptions);let l={method:"DELETE",...i,...o},u={},m={};await f(u,"OAuth2PasswordBearer",[],n),t!==void 0&&(m.start=t instanceof Date?t.toISOString():t),e!==void 0&&(m.end=e instanceof Date?e.toISOString():e),h(a,m);let b=i&&i.headers?i.headers:{};return l.headers={...u,...b,...o.headers},{url:x(a),options:l}},createNode:async(s,t={})=>{y("createNode","nodeCreate",s);let e="/api/node",o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=O(s,a,n),{url:x(o),options:a}},getNode:async(s,t={})=>{y("getNode","nodeId",s);let e="/api/node/{node_id}".replace("{node_id}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},getNodeSettings:async(s={})=>{let t="/api/node/settings",e=new URL(t,g),o;n&&(o=n.baseOptions);let r={method:"GET",...o,...s},a={},i={};await f(a,"OAuth2PasswordBearer",[],n),h(e,i);let l=o&&o.headers?o.headers:{};return r.headers={...a,...l,...s.headers},{url:x(e),options:r}},getNodeStatsPeriodic:async(s,t,e,o,r={})=>{y("getNodeStatsPeriodic","nodeId",s);let a="/api/node/{node_id}/stats".replace("{node_id}",encodeURIComponent(String(s))),i=new URL(a,g),l;n&&(l=n.baseOptions);let u={method:"GET",...l,...r},m={},b={};await f(m,"OAuth2PasswordBearer",[],n),t!==void 0&&(b.start=t instanceof Date?t.toISOString():t),e!==void 0&&(b.end=e instanceof Date?e.toISOString():e),o!==void 0&&(b.period=o),h(i,b);let R=l&&l.headers?l.headers:{};return u.headers={...m,...R,...r.headers},{url:x(i),options:u}},getNodes:async(s,t,e,o,r,a,i,l={})=>{let u="/api/nodes",m=new URL(u,g),b;n&&(b=n.baseOptions);let R={method:"GET",...b,...l},P={},S={};await f(P,"OAuth2PasswordBearer",[],n),s!==void 0&&(S.core_id=s),t!==void 0&&(S.offset=t),e!==void 0&&(S.limit=e),o&&(S.status=o),r!==void 0&&(S.enabled=r),a&&(S.ids=a),i!==void 0&&(S.search=i),h(m,S);let v=b&&b.headers?b.headers:{};return R.headers={...P,...v,...l.headers},{url:x(m),options:R}},getUsage:async(s,t,e,o,r,a={})=>{let i="/api/node/usage",l=new URL(i,g),u;n&&(u=n.baseOptions);let m={method:"GET",...u,...a},b={},R={};await f(b,"OAuth2PasswordBearer",[],n),s!==void 0&&(R.start=s instanceof Date?s.toISOString():s),t!==void 0&&(R.end=t instanceof Date?t.toISOString():t),e!==void 0&&(R.period=e),o!==void 0&&(R.node_id=o),r!==void 0&&(R.group_by_node=r),h(l,R);let P=u&&u.headers?u.headers:{};return m.headers={...b,...P,...a.headers},{url:x(l),options:m}},modifyNode:async(s,t,e={})=>{y("modifyNode","nodeId",s),y("modifyNode","nodeModify",t);let o="/api/node/{node_id}".replace("{node_id}",encodeURIComponent(String(s))),r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"PUT",...a,...e},l={},u={};await f(l,"OAuth2PasswordBearer",[],n),l["Content-Type"]="application/json",h(r,u);let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},i.data=O(t,i,n),{url:x(r),options:i}},nodeLogs:async(s,t={})=>{y("nodeLogs","nodeId",s);let e="/api/node/{node_id}/logs".replace("{node_id}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},realtimeNodeStats:async(s,t={})=>{y("realtimeNodeStats","nodeId",s);let e="/api/node/{node_id}/realtime_stats".replace("{node_id}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},realtimeNodesStats:async(s={})=>{let t="/api/nodes/realtime_stats",e=new URL(t,g),o;n&&(o=n.baseOptions);let r={method:"GET",...o,...s},a={},i={};await f(a,"OAuth2PasswordBearer",[],n),h(e,i);let l=o&&o.headers?o.headers:{};return r.headers={...a,...l,...s.headers},{url:x(e),options:r}},reconnectAllNode:async(s,t={})=>{let e="/api/nodes/reconnect",o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),s!==void 0&&(l.core_id=s),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},reconnectNode:async(s,t={})=>{y("reconnectNode","nodeId",s);let e="/api/node/{node_id}/reconnect".replace("{node_id}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},removeNode:async(s,t={})=>{y("removeNode","nodeId",s);let e="/api/node/{node_id}".replace("{node_id}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"DELETE",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},resetNodeUsage:async(s,t={})=>{y("resetNodeUsage","nodeId",s);let e="/api/node/{node_id}/reset".replace("{node_id}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},syncNode:async(s,t,e={})=>{y("syncNode","nodeId",s);let o="/api/node/{node_id}/sync".replace("{node_id}",encodeURIComponent(String(s))),r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"PUT",...a,...e},l={},u={};await f(l,"OAuth2PasswordBearer",[],n),t!==void 0&&(u.flush_users=t),h(r,u);let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},{url:x(r),options:i}},userOnlineIpList:async(s,t,e={})=>{y("userOnlineIpList","nodeId",s),y("userOnlineIpList","username",t);let o="/api/node/{node_id}/online_stats/{username}/ip".replace("{node_id}",encodeURIComponent(String(s))).replace("{username}",encodeURIComponent(String(t))),r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"GET",...a,...e},l={},u={};await f(l,"OAuth2PasswordBearer",[],n),h(r,u);let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},{url:x(r),options:i}},userOnlineIpListAllNodes:async(s,t={})=>{y("userOnlineIpListAllNodes","username",s);let e="/api/node/online_stats/{username}/ip".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},userOnlineStats:async(s,t,e={})=>{y("userOnlineStats","nodeId",s),y("userOnlineStats","username",t);let o="/api/node/{node_id}/online_stats/{username}".replace("{node_id}",encodeURIComponent(String(s))).replace("{username}",encodeURIComponent(String(t))),r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"GET",...a,...e},l={},u={};await f(l,"OAuth2PasswordBearer",[],n),h(r,u);let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},{url:x(r),options:i}}}},_=function(n){let s=ce(n);return {async clearUsageData(t,e,o,r){let a=await s.clearUsageData(t,e,o,r),i=n?.serverIndex??0,l=d["NodeApi.clearUsageData"]?.[i]?.url;return (u,m)=>A(a,w__default.default,c,n)(u,l||m)},async createNode(t,e){let o=await s.createNode(t,e),r=n?.serverIndex??0,a=d["NodeApi.createNode"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async getNode(t,e){let o=await s.getNode(t,e),r=n?.serverIndex??0,a=d["NodeApi.getNode"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async getNodeSettings(t){let e=await s.getNodeSettings(t),o=n?.serverIndex??0,r=d["NodeApi.getNodeSettings"]?.[o]?.url;return (a,i)=>A(e,w__default.default,c,n)(a,r||i)},async getNodeStatsPeriodic(t,e,o,r,a){let i=await s.getNodeStatsPeriodic(t,e,o,r,a),l=n?.serverIndex??0,u=d["NodeApi.getNodeStatsPeriodic"]?.[l]?.url;return (m,b)=>A(i,w__default.default,c,n)(m,u||b)},async getNodes(t,e,o,r,a,i,l,u){let m=await s.getNodes(t,e,o,r,a,i,l,u),b=n?.serverIndex??0,R=d["NodeApi.getNodes"]?.[b]?.url;return (P,S)=>A(m,w__default.default,c,n)(P,R||S)},async getUsage(t,e,o,r,a,i){let l=await s.getUsage(t,e,o,r,a,i),u=n?.serverIndex??0,m=d["NodeApi.getUsage"]?.[u]?.url;return (b,R)=>A(l,w__default.default,c,n)(b,m||R)},async modifyNode(t,e,o){let r=await s.modifyNode(t,e,o),a=n?.serverIndex??0,i=d["NodeApi.modifyNode"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)},async nodeLogs(t,e){let o=await s.nodeLogs(t,e),r=n?.serverIndex??0,a=d["NodeApi.nodeLogs"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async realtimeNodeStats(t,e){let o=await s.realtimeNodeStats(t,e),r=n?.serverIndex??0,a=d["NodeApi.realtimeNodeStats"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async realtimeNodesStats(t){let e=await s.realtimeNodesStats(t),o=n?.serverIndex??0,r=d["NodeApi.realtimeNodesStats"]?.[o]?.url;return (a,i)=>A(e,w__default.default,c,n)(a,r||i)},async reconnectAllNode(t,e){let o=await s.reconnectAllNode(t,e),r=n?.serverIndex??0,a=d["NodeApi.reconnectAllNode"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async reconnectNode(t,e){let o=await s.reconnectNode(t,e),r=n?.serverIndex??0,a=d["NodeApi.reconnectNode"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async removeNode(t,e){let o=await s.removeNode(t,e),r=n?.serverIndex??0,a=d["NodeApi.removeNode"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async resetNodeUsage(t,e){let o=await s.resetNodeUsage(t,e),r=n?.serverIndex??0,a=d["NodeApi.resetNodeUsage"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async syncNode(t,e,o){let r=await s.syncNode(t,e,o),a=n?.serverIndex??0,i=d["NodeApi.syncNode"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)},async userOnlineIpList(t,e,o){let r=await s.userOnlineIpList(t,e,o),a=n?.serverIndex??0,i=d["NodeApi.userOnlineIpList"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)},async userOnlineIpListAllNodes(t,e){let o=await s.userOnlineIpListAllNodes(t,e),r=n?.serverIndex??0,a=d["NodeApi.userOnlineIpListAllNodes"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async userOnlineStats(t,e,o){let r=await s.userOnlineStats(t,e,o),a=n?.serverIndex??0,i=d["NodeApi.userOnlineStats"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)}}};var Q=class extends U{clearUsageData(s,t,e,o){return _(this.configuration).clearUsageData(s,t,e,o).then(r=>r(this.axios,this.basePath)).then(({data:r})=>r)}createNode(s,t){return _(this.configuration).createNode(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}getNode(s,t){return _(this.configuration).getNode(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}getNodeSettings(s){return _(this.configuration).getNodeSettings(s).then(t=>t(this.axios,this.basePath)).then(({data:t})=>t)}getNodeStatsPeriodic(s,t,e,o,r){return _(this.configuration).getNodeStatsPeriodic(s,t,e,o,r).then(a=>a(this.axios,this.basePath)).then(({data:a})=>a)}getNodes(s,t,e,o,r,a,i,l){return _(this.configuration).getNodes(s,t,e,o,r,a,i,l).then(u=>u(this.axios,this.basePath)).then(({data:u})=>u)}getUsage(s,t,e,o,r,a){return _(this.configuration).getUsage(s,t,e,o,r,a).then(i=>i(this.axios,this.basePath)).then(({data:i})=>i)}modifyNode(s,t,e){return _(this.configuration).modifyNode(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}nodeLogs(s,t){return _(this.configuration).nodeLogs(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}realtimeNodeStats(s,t){return _(this.configuration).realtimeNodeStats(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}realtimeNodesStats(s){return _(this.configuration).realtimeNodesStats(s).then(t=>t(this.axios,this.basePath)).then(({data:t})=>t)}reconnectAllNode(s,t){return _(this.configuration).reconnectAllNode(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}reconnectNode(s,t){return _(this.configuration).reconnectNode(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}removeNode(s,t){return _(this.configuration).removeNode(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}resetNodeUsage(s,t){return _(this.configuration).resetNodeUsage(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}syncNode(s,t,e){return _(this.configuration).syncNode(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}userOnlineIpList(s,t,e){return _(this.configuration).userOnlineIpList(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}userOnlineIpListAllNodes(s,t){return _(this.configuration).userOnlineIpListAllNodes(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}userOnlineStats(s,t,e){return _(this.configuration).userOnlineStats(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}};var de=function(n){return {getSubUserUsage:async(s,t,e,o,r={})=>{y("getSubUserUsage","token",s);let a="/sub/{token}/usage".replace("{token}",encodeURIComponent(String(s))),i=new URL(a,g),l;n&&(l=n.baseOptions);let u={method:"GET",...l,...r},m={},b={};t!==void 0&&(b.start=t instanceof Date?t.toISOString():t),e!==void 0&&(b.end=e instanceof Date?e.toISOString():e),o!==void 0&&(b.period=o),h(i,b);let R=l&&l.headers?l.headers:{};return u.headers={...m,...R,...r.headers},{url:x(i),options:u}},userSubscription:async(s,t,e={})=>{y("userSubscription","token",s);let o="/sub/{token}/".replace("{token}",encodeURIComponent(String(s))),r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"GET",...a,...e},l={},u={};t!=null&&(l["user-agent"]=String(t)),h(r,u);let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},{url:x(r),options:i}},userSubscriptionApps:async(s,t={})=>{y("userSubscriptionApps","token",s);let e="/sub/{token}/apps".replace("{token}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={};h(o,{});let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},userSubscriptionInfo:async(s,t={})=>{y("userSubscriptionInfo","token",s);let e="/sub/{token}/info".replace("{token}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={};h(o,{});let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},userSubscriptionWithClientType:async(s,t,e={})=>{y("userSubscriptionWithClientType","token",s),y("userSubscriptionWithClientType","clientType",t);let o="/sub/{token}/{client_type}".replace("{token}",encodeURIComponent(String(s))).replace("{client_type}",encodeURIComponent(String(t))),r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"GET",...a,...e},l={};h(r,{});let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},{url:x(r),options:i}}}},H=function(n){let s=de(n);return {async getSubUserUsage(t,e,o,r,a){let i=await s.getSubUserUsage(t,e,o,r,a),l=n?.serverIndex??0,u=d["SubscriptionApi.getSubUserUsage"]?.[l]?.url;return (m,b)=>A(i,w__default.default,c,n)(m,u||b)},async userSubscription(t,e,o){let r=await s.userSubscription(t,e,o),a=n?.serverIndex??0,i=d["SubscriptionApi.userSubscription"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)},async userSubscriptionApps(t,e){let o=await s.userSubscriptionApps(t,e),r=n?.serverIndex??0,a=d["SubscriptionApi.userSubscriptionApps"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async userSubscriptionInfo(t,e){let o=await s.userSubscriptionInfo(t,e),r=n?.serverIndex??0,a=d["SubscriptionApi.userSubscriptionInfo"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async userSubscriptionWithClientType(t,e,o){let r=await s.userSubscriptionWithClientType(t,e,o),a=n?.serverIndex??0,i=d["SubscriptionApi.userSubscriptionWithClientType"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)}}};var $=class extends U{getSubUserUsage(s,t,e,o,r){return H(this.configuration).getSubUserUsage(s,t,e,o,r).then(a=>a(this.axios,this.basePath)).then(({data:a})=>a)}userSubscription(s,t,e){return H(this.configuration).userSubscription(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}userSubscriptionApps(s,t){return H(this.configuration).userSubscriptionApps(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}userSubscriptionInfo(s,t){return H(this.configuration).userSubscriptionInfo(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}userSubscriptionWithClientType(s,t,e){return H(this.configuration).userSubscriptionWithClientType(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}};var ge=function(n){return {getInbounds:async(s={})=>{let t="/api/inbounds",e=new URL(t,g),o;n&&(o=n.baseOptions);let r={method:"GET",...o,...s},a={},i={};await f(a,"OAuth2PasswordBearer",[],n),h(e,i);let l=o&&o.headers?o.headers:{};return r.headers={...a,...l,...s.headers},{url:x(e),options:r}},getSystemStats:async(s,t={})=>{let e="/api/system",o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),s!==void 0&&(l.admin_username=s),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}}}},re=function(n){let s=ge(n);return {async getInbounds(t){let e=await s.getInbounds(t),o=n?.serverIndex??0,r=d["SystemApi.getInbounds"]?.[o]?.url;return (a,i)=>A(e,w__default.default,c,n)(a,r||i)},async getSystemStats(t,e){let o=await s.getSystemStats(t,e),r=n?.serverIndex??0,a=d["SystemApi.getSystemStats"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)}}};var X=class extends U{getInbounds(s){return re(this.configuration).getInbounds(s).then(t=>t(this.axios,this.basePath)).then(({data:t})=>t)}getSystemStats(s,t){return re(this.configuration).getSystemStats(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}};var he=function(n){return {activeNextPlan:async(s,t={})=>{y("activeNextPlan","username",s);let e="/api/user/{username}/active_next".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},bulkModifyUsersDatalimit:async(s,t={})=>{y("bulkModifyUsersDatalimit","bulkUser",s);let e="/api/users/bulk/data_limit",o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=O(s,a,n),{url:x(o),options:a}},bulkModifyUsersExpire:async(s,t={})=>{y("bulkModifyUsersExpire","bulkUser",s);let e="/api/users/bulk/expire",o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=O(s,a,n),{url:x(o),options:a}},bulkModifyUsersProxySettings:async(s,t={})=>{y("bulkModifyUsersProxySettings","bulkUsersProxy",s);let e="/api/users/bulk/proxy_settings",o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=O(s,a,n),{url:x(o),options:a}},createUser:async(s,t={})=>{y("createUser","userCreate",s);let e="/api/user",o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=O(s,a,n),{url:x(o),options:a}},createUserFromTemplate:async(s,t={})=>{y("createUserFromTemplate","createUserFromTemplate",s);let e="/api/user/from_template",o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=O(s,a,n),{url:x(o),options:a}},deleteExpiredUsers:async(s,t,e,o={})=>{let r="/api/users/expired",a=new URL(r,g),i;n&&(i=n.baseOptions);let l={method:"DELETE",...i,...o},u={},m={};await f(u,"OAuth2PasswordBearer",[],n),s!==void 0&&(m.admin_username=s),t!==void 0&&(m.expired_after=t instanceof Date?t.toISOString():t),e!==void 0&&(m.expired_before=e instanceof Date?e.toISOString():e),h(a,m);let b=i&&i.headers?i.headers:{};return l.headers={...u,...b,...o.headers},{url:x(a),options:l}},getExpiredUsers:async(s,t,e,o={})=>{let r="/api/users/expired",a=new URL(r,g),i;n&&(i=n.baseOptions);let l={method:"GET",...i,...o},u={},m={};await f(u,"OAuth2PasswordBearer",[],n),s!==void 0&&(m.admin_username=s),t!==void 0&&(m.expired_after=t instanceof Date?t.toISOString():t),e!==void 0&&(m.expired_before=e instanceof Date?e.toISOString():e),h(a,m);let b=i&&i.headers?i.headers:{};return l.headers={...u,...b,...o.headers},{url:x(a),options:l}},getUser:async(s,t={})=>{y("getUser","username",s);let e="/api/user/{username}".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},getUserSubUpdateList:async(s,t,e,o={})=>{y("getUserSubUpdateList","username",s);let r="/api/user/{username}/sub_update".replace("{username}",encodeURIComponent(String(s))),a=new URL(r,g),i;n&&(i=n.baseOptions);let l={method:"GET",...i,...o},u={},m={};await f(u,"OAuth2PasswordBearer",[],n),t!==void 0&&(m.offset=t),e!==void 0&&(m.limit=e),h(a,m);let b=i&&i.headers?i.headers:{};return l.headers={...u,...b,...o.headers},{url:x(a),options:l}},getUserUsage:async(s,t,e,o,r,a,i={})=>{y("getUserUsage","username",s),y("getUserUsage","period",t);let l="/api/user/{username}/usage".replace("{username}",encodeURIComponent(String(s))),u=new URL(l,g),m;n&&(m=n.baseOptions);let b={method:"GET",...m,...i},R={},P={};await f(R,"OAuth2PasswordBearer",[],n),t!==void 0&&(P.period=t),e!==void 0&&(P.node_id=e),o!==void 0&&(P.group_by_node=o),r!==void 0&&(P.start=r instanceof Date?r.toISOString():r),a!==void 0&&(P.end=a instanceof Date?a.toISOString():a),h(u,P);let S=m&&m.headers?m.headers:{};return b.headers={...R,...S,...i.headers},{url:x(u),options:b}},getUsers:async(s,t,e,o,r,a,i,l,u,m,b={})=>{let R="/api/users",P=new URL(R,g),S;n&&(S=n.baseOptions);let v={method:"GET",...S,...b},F={},q={};await f(F,"OAuth2PasswordBearer",[],n),s!==void 0&&(q.offset=s),t!==void 0&&(q.limit=t),e&&(q.username=e),o&&(q.admin=o),r&&(q.group=r),a!==void 0&&(q.search=a),i!==void 0&&(q.status=i),l!==void 0&&(q.sort=l),u!==void 0&&(q.proxy_id=u),m!==void 0&&(q.load_sub=m),h(P,q);let ie=S&&S.headers?S.headers:{};return v.headers={...F,...ie,...b.headers},{url:x(P),options:v}},getUsersSubUpdateChart:async(s,t,e={})=>{let o="/api/users/sub_update/chart",r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"GET",...a,...e},l={},u={};await f(l,"OAuth2PasswordBearer",[],n),s!==void 0&&(u.username=s),t!==void 0&&(u.admin_id=t),h(r,u);let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},{url:x(r),options:i}},getUsersUsage:async(s,t,e,o,r,a,i={})=>{y("getUsersUsage","period",s);let l="/api/users/usage",u=new URL(l,g),m;n&&(m=n.baseOptions);let b={method:"GET",...m,...i},R={},P={};await f(R,"OAuth2PasswordBearer",[],n),s!==void 0&&(P.period=s),t!==void 0&&(P.node_id=t),e!==void 0&&(P.group_by_node=e),o!==void 0&&(P.start=o instanceof Date?o.toISOString():o),r!==void 0&&(P.end=r instanceof Date?r.toISOString():r),a&&(P.admin=a),h(u,P);let S=m&&m.headers?m.headers:{};return b.headers={...R,...S,...i.headers},{url:x(u),options:b}},modifyUser:async(s,t,e={})=>{y("modifyUser","username",s),y("modifyUser","userModify",t);let o="/api/user/{username}".replace("{username}",encodeURIComponent(String(s))),r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"PUT",...a,...e},l={},u={};await f(l,"OAuth2PasswordBearer",[],n),l["Content-Type"]="application/json",h(r,u);let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},i.data=O(t,i,n),{url:x(r),options:i}},modifyUserWithTemplate:async(s,t,e={})=>{y("modifyUserWithTemplate","username",s),y("modifyUserWithTemplate","modifyUserByTemplate",t);let o="/api/user/from_template/{username}".replace("{username}",encodeURIComponent(String(s))),r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"PUT",...a,...e},l={},u={};await f(l,"OAuth2PasswordBearer",[],n),l["Content-Type"]="application/json",h(r,u);let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},i.data=O(t,i,n),{url:x(r),options:i}},removeUser:async(s,t={})=>{y("removeUser","username",s);let e="/api/user/{username}".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"DELETE",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},resetUserDataUsage:async(s,t={})=>{y("resetUserDataUsage","username",s);let e="/api/user/{username}/reset".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},resetUsersDataUsage:async(s={})=>{let t="/api/users/reset",e=new URL(t,g),o;n&&(o=n.baseOptions);let r={method:"POST",...o,...s},a={},i={};await f(a,"OAuth2PasswordBearer",[],n),h(e,i);let l=o&&o.headers?o.headers:{};return r.headers={...a,...l,...s.headers},{url:x(e),options:r}},revokeUserSubscription:async(s,t={})=>{y("revokeUserSubscription","username",s);let e="/api/user/{username}/revoke_sub".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},setOwner:async(s,t,e={})=>{y("setOwner","username",s),y("setOwner","adminUsername",t);let o="/api/user/{username}/set_owner".replace("{username}",encodeURIComponent(String(s))),r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"PUT",...a,...e},l={},u={};await f(l,"OAuth2PasswordBearer",[],n),t!==void 0&&(u.admin_username=t),h(r,u);let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},{url:x(r),options:i}}}},C=function(n){let s=he(n);return {async activeNextPlan(t,e){let o=await s.activeNextPlan(t,e),r=n?.serverIndex??0,a=d["UserApi.activeNextPlan"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async bulkModifyUsersDatalimit(t,e){let o=await s.bulkModifyUsersDatalimit(t,e),r=n?.serverIndex??0,a=d["UserApi.bulkModifyUsersDatalimit"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async bulkModifyUsersExpire(t,e){let o=await s.bulkModifyUsersExpire(t,e),r=n?.serverIndex??0,a=d["UserApi.bulkModifyUsersExpire"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async bulkModifyUsersProxySettings(t,e){let o=await s.bulkModifyUsersProxySettings(t,e),r=n?.serverIndex??0,a=d["UserApi.bulkModifyUsersProxySettings"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async createUser(t,e){let o=await s.createUser(t,e),r=n?.serverIndex??0,a=d["UserApi.createUser"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async createUserFromTemplate(t,e){let o=await s.createUserFromTemplate(t,e),r=n?.serverIndex??0,a=d["UserApi.createUserFromTemplate"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async deleteExpiredUsers(t,e,o,r){let a=await s.deleteExpiredUsers(t,e,o,r),i=n?.serverIndex??0,l=d["UserApi.deleteExpiredUsers"]?.[i]?.url;return (u,m)=>A(a,w__default.default,c,n)(u,l||m)},async getExpiredUsers(t,e,o,r){let a=await s.getExpiredUsers(t,e,o,r),i=n?.serverIndex??0,l=d["UserApi.getExpiredUsers"]?.[i]?.url;return (u,m)=>A(a,w__default.default,c,n)(u,l||m)},async getUser(t,e){let o=await s.getUser(t,e),r=n?.serverIndex??0,a=d["UserApi.getUser"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async getUserSubUpdateList(t,e,o,r){let a=await s.getUserSubUpdateList(t,e,o,r),i=n?.serverIndex??0,l=d["UserApi.getUserSubUpdateList"]?.[i]?.url;return (u,m)=>A(a,w__default.default,c,n)(u,l||m)},async getUserUsage(t,e,o,r,a,i,l){let u=await s.getUserUsage(t,e,o,r,a,i,l),m=n?.serverIndex??0,b=d["UserApi.getUserUsage"]?.[m]?.url;return (R,P)=>A(u,w__default.default,c,n)(R,b||P)},async getUsers(t,e,o,r,a,i,l,u,m,b,R){let P=await s.getUsers(t,e,o,r,a,i,l,u,m,b,R),S=n?.serverIndex??0,v=d["UserApi.getUsers"]?.[S]?.url;return (F,q)=>A(P,w__default.default,c,n)(F,v||q)},async getUsersSubUpdateChart(t,e,o){let r=await s.getUsersSubUpdateChart(t,e,o),a=n?.serverIndex??0,i=d["UserApi.getUsersSubUpdateChart"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)},async getUsersUsage(t,e,o,r,a,i,l){let u=await s.getUsersUsage(t,e,o,r,a,i,l),m=n?.serverIndex??0,b=d["UserApi.getUsersUsage"]?.[m]?.url;return (R,P)=>A(u,w__default.default,c,n)(R,b||P)},async modifyUser(t,e,o){let r=await s.modifyUser(t,e,o),a=n?.serverIndex??0,i=d["UserApi.modifyUser"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)},async modifyUserWithTemplate(t,e,o){let r=await s.modifyUserWithTemplate(t,e,o),a=n?.serverIndex??0,i=d["UserApi.modifyUserWithTemplate"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)},async removeUser(t,e){let o=await s.removeUser(t,e),r=n?.serverIndex??0,a=d["UserApi.removeUser"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async resetUserDataUsage(t,e){let o=await s.resetUserDataUsage(t,e),r=n?.serverIndex??0,a=d["UserApi.resetUserDataUsage"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async resetUsersDataUsage(t){let e=await s.resetUsersDataUsage(t),o=n?.serverIndex??0,r=d["UserApi.resetUsersDataUsage"]?.[o]?.url;return (a,i)=>A(e,w__default.default,c,n)(a,r||i)},async revokeUserSubscription(t,e){let o=await s.revokeUserSubscription(t,e),r=n?.serverIndex??0,a=d["UserApi.revokeUserSubscription"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async setOwner(t,e,o){let r=await s.setOwner(t,e,o),a=n?.serverIndex??0,i=d["UserApi.setOwner"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)}}};var z=class extends U{activeNextPlan(s,t){return C(this.configuration).activeNextPlan(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}bulkModifyUsersDatalimit(s,t){return C(this.configuration).bulkModifyUsersDatalimit(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}bulkModifyUsersExpire(s,t){return C(this.configuration).bulkModifyUsersExpire(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}bulkModifyUsersProxySettings(s,t){return C(this.configuration).bulkModifyUsersProxySettings(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}createUser(s,t){return C(this.configuration).createUser(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}createUserFromTemplate(s,t){return C(this.configuration).createUserFromTemplate(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}deleteExpiredUsers(s,t,e,o){return C(this.configuration).deleteExpiredUsers(s,t,e,o).then(r=>r(this.axios,this.basePath)).then(({data:r})=>r)}getExpiredUsers(s,t,e,o){return C(this.configuration).getExpiredUsers(s,t,e,o).then(r=>r(this.axios,this.basePath)).then(({data:r})=>r)}getUser(s,t){return C(this.configuration).getUser(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}getUserSubUpdateList(s,t,e,o){return C(this.configuration).getUserSubUpdateList(s,t,e,o).then(r=>r(this.axios,this.basePath)).then(({data:r})=>r)}getUserUsage(s,t,e,o,r,a,i){return C(this.configuration).getUserUsage(s,t,e,o,r,a,i).then(l=>l(this.axios,this.basePath)).then(({data:l})=>l)}getUsers(s,t,e,o,r,a,i,l,u,m,b){return C(this.configuration).getUsers(s,t,e,o,r,a,i,l,u,m,b).then(R=>R(this.axios,this.basePath)).then(({data:R})=>R)}getUsersSubUpdateChart(s,t,e){return C(this.configuration).getUsersSubUpdateChart(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}getUsersUsage(s,t,e,o,r,a,i){return C(this.configuration).getUsersUsage(s,t,e,o,r,a,i).then(l=>l(this.axios,this.basePath)).then(({data:l})=>l)}modifyUser(s,t,e){return C(this.configuration).modifyUser(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}modifyUserWithTemplate(s,t,e){return C(this.configuration).modifyUserWithTemplate(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}removeUser(s,t){return C(this.configuration).removeUser(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}resetUserDataUsage(s,t){return C(this.configuration).resetUserDataUsage(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}resetUsersDataUsage(s){return C(this.configuration).resetUsersDataUsage(s).then(t=>t(this.axios,this.basePath)).then(({data:t})=>t)}revokeUserSubscription(s,t){return C(this.configuration).revokeUserSubscription(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}setOwner(s,t,e){return C(this.configuration).setOwner(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}};var xe=function(n){return {createUserTemplate:async(s,t={})=>{y("createUserTemplate","userTemplateCreate",s);let e="/api/user_template",o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=O(s,a,n),{url:x(o),options:a}},getUserTemplate:async(s,t={})=>{y("getUserTemplate","templateId",s);let e="/api/user_template/{template_id}".replace("{template_id}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}},getUserTemplates:async(s,t,e={})=>{let o="/api/user_templates",r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"GET",...a,...e},l={},u={};await f(l,"OAuth2PasswordBearer",[],n),s!==void 0&&(u.offset=s),t!==void 0&&(u.limit=t),h(r,u);let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},{url:x(r),options:i}},modifyUserTemplate:async(s,t,e={})=>{y("modifyUserTemplate","templateId",s),y("modifyUserTemplate","userTemplateModify",t);let o="/api/user_template/{template_id}".replace("{template_id}",encodeURIComponent(String(s))),r=new URL(o,g),a;n&&(a=n.baseOptions);let i={method:"PUT",...a,...e},l={},u={};await f(l,"OAuth2PasswordBearer",[],n),l["Content-Type"]="application/json",h(r,u);let m=a&&a.headers?a.headers:{};return i.headers={...l,...m,...e.headers},i.data=O(t,i,n),{url:x(r),options:i}},removeUserTemplate:async(s,t={})=>{y("removeUserTemplate","templateId",s);let e="/api/user_template/{template_id}".replace("{template_id}",encodeURIComponent(String(s))),o=new URL(e,g),r;n&&(r=n.baseOptions);let a={method:"DELETE",...r,...t},i={},l={};await f(i,"OAuth2PasswordBearer",[],n),h(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:x(o),options:a}}}},E=function(n){let s=xe(n);return {async createUserTemplate(t,e){let o=await s.createUserTemplate(t,e),r=n?.serverIndex??0,a=d["UserTemplateApi.createUserTemplate"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async getUserTemplate(t,e){let o=await s.getUserTemplate(t,e),r=n?.serverIndex??0,a=d["UserTemplateApi.getUserTemplate"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)},async getUserTemplates(t,e,o){let r=await s.getUserTemplates(t,e,o),a=n?.serverIndex??0,i=d["UserTemplateApi.getUserTemplates"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)},async modifyUserTemplate(t,e,o){let r=await s.modifyUserTemplate(t,e,o),a=n?.serverIndex??0,i=d["UserTemplateApi.modifyUserTemplate"]?.[a]?.url;return (l,u)=>A(r,w__default.default,c,n)(l,i||u)},async removeUserTemplate(t,e){let o=await s.removeUserTemplate(t,e),r=n?.serverIndex??0,a=d["UserTemplateApi.removeUserTemplate"]?.[r]?.url;return (i,l)=>A(o,w__default.default,c,n)(i,a||l)}}};var W=class extends U{createUserTemplate(s,t){return E(this.configuration).createUserTemplate(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}getUserTemplate(s,t){return E(this.configuration).getUserTemplate(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}getUserTemplates(s,t,e){return E(this.configuration).getUserTemplates(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}modifyUserTemplate(s,t,e){return E(this.configuration).modifyUserTemplate(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}removeUserTemplate(s,t){return E(this.configuration).removeUserTemplate(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}};var K=class{constructor(s={}){this.apiKey=s.apiKey,this.username=s.username,this.password=s.password,this.accessToken=s.accessToken,this.basePath=s.basePath,this.serverIndex=s.serverIndex,this.baseOptions={...s.baseOptions,headers:{...s.baseOptions?.headers}},this.formDataCtor=s.formDataCtor;}isJsonMime(s){let t=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return s!==null&&(t.test(s)||s.toLowerCase()==="application/json-patch+json")}};var oe=(n,s)=>{let t=w__default.default.create({baseURL:n});return ye__default.default(t,{retries:s?.retries??3,retryDelay:e=>e*1e3}),t};var Y=class extends Error{constructor(s){super(s),this.name="AuthenticationError";}},J=class{constructor(s){this.authPromise=null;this.isAuthenticating=false;this.configuration=s;}async authenticate(s,t){return this.authPromise?this.authPromise:(this.isAuthenticating=true,this.authPromise=new Promise((e,o)=>{(async()=>{try{let i=await new B(this.configuration).adminToken(s,t);i?.access_token?(this.configuration.accessToken=i.access_token,e()):(this.configuration.accessToken=void 0,o(new Y("Failed to retrieve access token")));}catch(a){console.error("Authentication failed",a),this.configuration.accessToken=void 0,o(new Y("Authentication failed"));}finally{this.authPromise=null,this.isAuthenticating=false;}})();}),this.authPromise)}async waitForAuth(){await this.authPromise;}retryAuth(){return this.authenticate(this.configuration.username,this.configuration.password)}get accessToken(){return this.configuration.accessToken?.toString()||""}set accessToken(s){this.configuration.accessToken=s;}};var ae=(n,s,t)=>{n.interceptors.request.use(async e=>{await s.waitForAuth();let o=s.accessToken;return e.headers.authorization=o?`Bearer ${o}`:void 0,e},e=>Promise.reject(e)),n.interceptors.response.use(e=>e,async e=>{let o=e?.config;if(e?.response?.status===401&&!o?.sent){o.sent=true;try{await s.authenticate(t.username,t.password);let r=s.accessToken;if(r)return o.headers.authorization=`Bearer ${r}`,n(o)}catch(r){return Promise.reject(r)}}return Promise.reject(e)});};var ne=class{constructor(s){if(!s.username||!s.password)throw new Error("No credentials provided for authentication");this.configuration=new K({basePath:s.baseUrl,username:s.username,password:s.password,accessToken:s.token}),this.client=oe(s.baseUrl,{retries:s.retries}),this.authService=new J(this.configuration),this.admin=new B(this.configuration,s.baseUrl,this.client),this.core=new G(this.configuration,s.baseUrl,this.client),this.node=new Q(this.configuration,s.baseUrl,this.client),this.user=new z(this.configuration,s.baseUrl,this.client),this.system=new X(this.configuration,s.baseUrl,this.client),this.default=new D(this.configuration,s.baseUrl,this.client),this.subscription=new $(this.configuration,s.baseUrl,this.client),this.userTemplate=new W(this.configuration,s.baseUrl,this.client),ae(this.client,this.authService,s),!s.token&&s.authenticateOnInit!==false&&this.authService.authenticate(s.username,s.password);}async getAuthToken(){return await this.authService.waitForAuth(),this.authService.accessToken}authorize(s=false){return this.authService.isAuthenticating&&!s?this.authService.authPromise:this.authService.authenticate(this.configuration.username,this.configuration.password)}};
|
|
2
2
|
exports.PasarguardSDK=ne;//# sourceMappingURL=index.cjs.map
|
|
3
3
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.cts
CHANGED
|
@@ -2241,12 +2241,10 @@ interface BulkUsersProxy {
|
|
|
2241
2241
|
* Do not edit the class manually.
|
|
2242
2242
|
*/
|
|
2243
2243
|
/**
|
|
2244
|
-
*
|
|
2244
|
+
* @type CMaxReuseTimes
|
|
2245
2245
|
* @export
|
|
2246
|
-
* @interface CMaxReuseTimes
|
|
2247
2246
|
*/
|
|
2248
|
-
|
|
2249
|
-
}
|
|
2247
|
+
type CMaxReuseTimes = number | string;
|
|
2250
2248
|
|
|
2251
2249
|
/**
|
|
2252
2250
|
* PasarGuardAPI
|
|
@@ -2504,12 +2502,10 @@ interface MuxSettingsInput {
|
|
|
2504
2502
|
* Do not edit the class manually.
|
|
2505
2503
|
*/
|
|
2506
2504
|
/**
|
|
2507
|
-
*
|
|
2505
|
+
* @type ScMaxEachPostBytes
|
|
2508
2506
|
* @export
|
|
2509
|
-
* @interface ScMaxEachPostBytes
|
|
2510
2507
|
*/
|
|
2511
|
-
|
|
2512
|
-
}
|
|
2508
|
+
type ScMaxEachPostBytes = number | string;
|
|
2513
2509
|
|
|
2514
2510
|
/**
|
|
2515
2511
|
* PasarGuardAPI
|
|
@@ -2523,12 +2519,10 @@ interface ScMaxEachPostBytes {
|
|
|
2523
2519
|
* Do not edit the class manually.
|
|
2524
2520
|
*/
|
|
2525
2521
|
/**
|
|
2526
|
-
*
|
|
2522
|
+
* @type ScMinPostsIntervalMs
|
|
2527
2523
|
* @export
|
|
2528
|
-
* @interface ScMinPostsIntervalMs
|
|
2529
2524
|
*/
|
|
2530
|
-
|
|
2531
|
-
}
|
|
2525
|
+
type ScMinPostsIntervalMs = number | string;
|
|
2532
2526
|
|
|
2533
2527
|
/**
|
|
2534
2528
|
* PasarGuardAPI
|
|
@@ -2542,12 +2536,10 @@ interface ScMinPostsIntervalMs {
|
|
|
2542
2536
|
* Do not edit the class manually.
|
|
2543
2537
|
*/
|
|
2544
2538
|
/**
|
|
2545
|
-
*
|
|
2539
|
+
* @type HMaxRequestTimes
|
|
2546
2540
|
* @export
|
|
2547
|
-
* @interface HMaxRequestTimes
|
|
2548
2541
|
*/
|
|
2549
|
-
|
|
2550
|
-
}
|
|
2542
|
+
type HMaxRequestTimes = number | string;
|
|
2551
2543
|
|
|
2552
2544
|
/**
|
|
2553
2545
|
* PasarGuardAPI
|
|
@@ -2561,12 +2553,10 @@ interface HMaxRequestTimes {
|
|
|
2561
2553
|
* Do not edit the class manually.
|
|
2562
2554
|
*/
|
|
2563
2555
|
/**
|
|
2564
|
-
*
|
|
2556
|
+
* @type HMaxReusableSecs
|
|
2565
2557
|
* @export
|
|
2566
|
-
* @interface HMaxReusableSecs
|
|
2567
2558
|
*/
|
|
2568
|
-
|
|
2569
|
-
}
|
|
2559
|
+
type HMaxReusableSecs = number | string;
|
|
2570
2560
|
|
|
2571
2561
|
/**
|
|
2572
2562
|
* PasarGuardAPI
|
|
@@ -2580,12 +2570,10 @@ interface HMaxReusableSecs {
|
|
|
2580
2570
|
* Do not edit the class manually.
|
|
2581
2571
|
*/
|
|
2582
2572
|
/**
|
|
2583
|
-
*
|
|
2573
|
+
* @type MaxConcurrency
|
|
2584
2574
|
* @export
|
|
2585
|
-
* @interface MaxConcurrency
|
|
2586
2575
|
*/
|
|
2587
|
-
|
|
2588
|
-
}
|
|
2576
|
+
type MaxConcurrency = number | string;
|
|
2589
2577
|
|
|
2590
2578
|
/**
|
|
2591
2579
|
* PasarGuardAPI
|
|
@@ -2599,12 +2587,10 @@ interface MaxConcurrency {
|
|
|
2599
2587
|
* Do not edit the class manually.
|
|
2600
2588
|
*/
|
|
2601
2589
|
/**
|
|
2602
|
-
*
|
|
2590
|
+
* @type MaxConnections
|
|
2603
2591
|
* @export
|
|
2604
|
-
* @interface MaxConnections
|
|
2605
2592
|
*/
|
|
2606
|
-
|
|
2607
|
-
}
|
|
2593
|
+
type MaxConnections = number | string;
|
|
2608
2594
|
|
|
2609
2595
|
/**
|
|
2610
2596
|
* PasarGuardAPI
|
|
@@ -2674,12 +2660,10 @@ interface XMuxSettingsInput {
|
|
|
2674
2660
|
* Do not edit the class manually.
|
|
2675
2661
|
*/
|
|
2676
2662
|
/**
|
|
2677
|
-
*
|
|
2663
|
+
* @type XPaddingBytes
|
|
2678
2664
|
* @export
|
|
2679
|
-
* @interface XPaddingBytes
|
|
2680
2665
|
*/
|
|
2681
|
-
|
|
2682
|
-
}
|
|
2666
|
+
type XPaddingBytes = number | string;
|
|
2683
2667
|
|
|
2684
2668
|
/**
|
|
2685
2669
|
* PasarGuardAPI
|
|
@@ -3064,12 +3048,10 @@ interface Discord {
|
|
|
3064
3048
|
* Do not edit the class manually.
|
|
3065
3049
|
*/
|
|
3066
3050
|
/**
|
|
3067
|
-
*
|
|
3051
|
+
* @type Expire
|
|
3068
3052
|
* @export
|
|
3069
|
-
* @interface Expire
|
|
3070
3053
|
*/
|
|
3071
|
-
|
|
3072
|
-
}
|
|
3054
|
+
type Expire = number | string;
|
|
3073
3055
|
|
|
3074
3056
|
/**
|
|
3075
3057
|
* PasarGuardAPI
|
|
@@ -4211,21 +4193,39 @@ interface NodesResponse {
|
|
|
4211
4193
|
* Do not edit the class manually.
|
|
4212
4194
|
*/
|
|
4213
4195
|
/**
|
|
4214
|
-
*
|
|
4196
|
+
* User IP list - mapping of IP addresses to connection counts
|
|
4215
4197
|
* @export
|
|
4216
|
-
* @interface
|
|
4198
|
+
* @interface UserIPList
|
|
4217
4199
|
*/
|
|
4218
|
-
interface
|
|
4200
|
+
interface UserIPList {
|
|
4219
4201
|
/**
|
|
4220
4202
|
*
|
|
4221
4203
|
* @type {{ [key: string]: number; }}
|
|
4222
|
-
* @memberof
|
|
4204
|
+
* @memberof UserIPList
|
|
4223
4205
|
*/
|
|
4224
4206
|
'ips': {
|
|
4225
4207
|
[key: string]: number;
|
|
4226
4208
|
};
|
|
4227
4209
|
}
|
|
4228
4210
|
|
|
4211
|
+
/**
|
|
4212
|
+
* PasarGuardAPI
|
|
4213
|
+
* Unified GUI Censorship Resistant Solution
|
|
4214
|
+
*
|
|
4215
|
+
* The version of the OpenAPI document: 1.8.2
|
|
4216
|
+
*
|
|
4217
|
+
*
|
|
4218
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
4219
|
+
* https://openapi-generator.tech
|
|
4220
|
+
* Do not edit the class manually.
|
|
4221
|
+
*/
|
|
4222
|
+
|
|
4223
|
+
/**
|
|
4224
|
+
* @type NodesValue
|
|
4225
|
+
* @export
|
|
4226
|
+
*/
|
|
4227
|
+
type NodesValue = UserIPList;
|
|
4228
|
+
|
|
4229
4229
|
/**
|
|
4230
4230
|
* PasarGuardAPI
|
|
4231
4231
|
* Unified GUI Censorship Resistant Solution
|
|
@@ -4559,12 +4559,10 @@ interface NotificationSettingsOutput {
|
|
|
4559
4559
|
* Do not edit the class manually.
|
|
4560
4560
|
*/
|
|
4561
4561
|
/**
|
|
4562
|
-
*
|
|
4562
|
+
* @type OnHoldTimeout
|
|
4563
4563
|
* @export
|
|
4564
|
-
* @interface OnHoldTimeout
|
|
4565
4564
|
*/
|
|
4566
|
-
|
|
4567
|
-
}
|
|
4565
|
+
type OnHoldTimeout = number | string;
|
|
4568
4566
|
|
|
4569
4567
|
/**
|
|
4570
4568
|
* PasarGuardAPI
|
|
@@ -4810,49 +4808,12 @@ interface RemoveUsersResponse {
|
|
|
4810
4808
|
* https://openapi-generator.tech
|
|
4811
4809
|
* Do not edit the class manually.
|
|
4812
4810
|
*/
|
|
4811
|
+
|
|
4813
4812
|
/**
|
|
4814
|
-
*
|
|
4813
|
+
* @type ResponseRealtimeNodesStatsApiNodesRealtimeStatsGetValue
|
|
4815
4814
|
* @export
|
|
4816
|
-
* @interface ResponseRealtimeNodesStatsApiNodesRealtimeStatsGetValue
|
|
4817
4815
|
*/
|
|
4818
|
-
|
|
4819
|
-
/**
|
|
4820
|
-
*
|
|
4821
|
-
* @type {number}
|
|
4822
|
-
* @memberof ResponseRealtimeNodesStatsApiNodesRealtimeStatsGetValue
|
|
4823
|
-
*/
|
|
4824
|
-
'mem_total': number;
|
|
4825
|
-
/**
|
|
4826
|
-
*
|
|
4827
|
-
* @type {number}
|
|
4828
|
-
* @memberof ResponseRealtimeNodesStatsApiNodesRealtimeStatsGetValue
|
|
4829
|
-
*/
|
|
4830
|
-
'mem_used': number;
|
|
4831
|
-
/**
|
|
4832
|
-
*
|
|
4833
|
-
* @type {number}
|
|
4834
|
-
* @memberof ResponseRealtimeNodesStatsApiNodesRealtimeStatsGetValue
|
|
4835
|
-
*/
|
|
4836
|
-
'cpu_cores': number;
|
|
4837
|
-
/**
|
|
4838
|
-
*
|
|
4839
|
-
* @type {number}
|
|
4840
|
-
* @memberof ResponseRealtimeNodesStatsApiNodesRealtimeStatsGetValue
|
|
4841
|
-
*/
|
|
4842
|
-
'cpu_usage': number;
|
|
4843
|
-
/**
|
|
4844
|
-
*
|
|
4845
|
-
* @type {number}
|
|
4846
|
-
* @memberof ResponseRealtimeNodesStatsApiNodesRealtimeStatsGetValue
|
|
4847
|
-
*/
|
|
4848
|
-
'incoming_bandwidth_speed': number;
|
|
4849
|
-
/**
|
|
4850
|
-
*
|
|
4851
|
-
* @type {number}
|
|
4852
|
-
* @memberof ResponseRealtimeNodesStatsApiNodesRealtimeStatsGetValue
|
|
4853
|
-
*/
|
|
4854
|
-
'outgoing_bandwidth_speed': number;
|
|
4855
|
-
}
|
|
4816
|
+
type ResponseRealtimeNodesStatsApiNodesRealtimeStatsGetValue = NodeRealtimeStats;
|
|
4856
4817
|
|
|
4857
4818
|
/**
|
|
4858
4819
|
* PasarGuardAPI
|
|
@@ -5794,33 +5755,6 @@ interface UserCreate {
|
|
|
5794
5755
|
'status'?: UserStatusCreate | null;
|
|
5795
5756
|
}
|
|
5796
5757
|
|
|
5797
|
-
/**
|
|
5798
|
-
* PasarGuardAPI
|
|
5799
|
-
* Unified GUI Censorship Resistant Solution
|
|
5800
|
-
*
|
|
5801
|
-
* The version of the OpenAPI document: 1.8.2
|
|
5802
|
-
*
|
|
5803
|
-
*
|
|
5804
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
5805
|
-
* https://openapi-generator.tech
|
|
5806
|
-
* Do not edit the class manually.
|
|
5807
|
-
*/
|
|
5808
|
-
/**
|
|
5809
|
-
* User IP list - mapping of IP addresses to connection counts
|
|
5810
|
-
* @export
|
|
5811
|
-
* @interface UserIPList
|
|
5812
|
-
*/
|
|
5813
|
-
interface UserIPList {
|
|
5814
|
-
/**
|
|
5815
|
-
*
|
|
5816
|
-
* @type {{ [key: string]: number; }}
|
|
5817
|
-
* @memberof UserIPList
|
|
5818
|
-
*/
|
|
5819
|
-
'ips': {
|
|
5820
|
-
[key: string]: number;
|
|
5821
|
-
};
|
|
5822
|
-
}
|
|
5823
|
-
|
|
5824
5758
|
/**
|
|
5825
5759
|
* PasarGuardAPI
|
|
5826
5760
|
* Unified GUI Censorship Resistant Solution
|
|
@@ -8597,7 +8531,7 @@ declare class NodeApi extends BaseAPI {
|
|
|
8597
8531
|
* @memberof NodeApi
|
|
8598
8532
|
*/
|
|
8599
8533
|
realtimeNodesStats(options?: RawAxiosRequestConfig): Promise<{
|
|
8600
|
-
[key: string]:
|
|
8534
|
+
[key: string]: NodeRealtimeStats;
|
|
8601
8535
|
}>;
|
|
8602
8536
|
/**
|
|
8603
8537
|
* Trigger reconnection for all nodes or a specific core.
|
package/dist/index.d.ts
CHANGED
|
@@ -2241,12 +2241,10 @@ interface BulkUsersProxy {
|
|
|
2241
2241
|
* Do not edit the class manually.
|
|
2242
2242
|
*/
|
|
2243
2243
|
/**
|
|
2244
|
-
*
|
|
2244
|
+
* @type CMaxReuseTimes
|
|
2245
2245
|
* @export
|
|
2246
|
-
* @interface CMaxReuseTimes
|
|
2247
2246
|
*/
|
|
2248
|
-
|
|
2249
|
-
}
|
|
2247
|
+
type CMaxReuseTimes = number | string;
|
|
2250
2248
|
|
|
2251
2249
|
/**
|
|
2252
2250
|
* PasarGuardAPI
|
|
@@ -2504,12 +2502,10 @@ interface MuxSettingsInput {
|
|
|
2504
2502
|
* Do not edit the class manually.
|
|
2505
2503
|
*/
|
|
2506
2504
|
/**
|
|
2507
|
-
*
|
|
2505
|
+
* @type ScMaxEachPostBytes
|
|
2508
2506
|
* @export
|
|
2509
|
-
* @interface ScMaxEachPostBytes
|
|
2510
2507
|
*/
|
|
2511
|
-
|
|
2512
|
-
}
|
|
2508
|
+
type ScMaxEachPostBytes = number | string;
|
|
2513
2509
|
|
|
2514
2510
|
/**
|
|
2515
2511
|
* PasarGuardAPI
|
|
@@ -2523,12 +2519,10 @@ interface ScMaxEachPostBytes {
|
|
|
2523
2519
|
* Do not edit the class manually.
|
|
2524
2520
|
*/
|
|
2525
2521
|
/**
|
|
2526
|
-
*
|
|
2522
|
+
* @type ScMinPostsIntervalMs
|
|
2527
2523
|
* @export
|
|
2528
|
-
* @interface ScMinPostsIntervalMs
|
|
2529
2524
|
*/
|
|
2530
|
-
|
|
2531
|
-
}
|
|
2525
|
+
type ScMinPostsIntervalMs = number | string;
|
|
2532
2526
|
|
|
2533
2527
|
/**
|
|
2534
2528
|
* PasarGuardAPI
|
|
@@ -2542,12 +2536,10 @@ interface ScMinPostsIntervalMs {
|
|
|
2542
2536
|
* Do not edit the class manually.
|
|
2543
2537
|
*/
|
|
2544
2538
|
/**
|
|
2545
|
-
*
|
|
2539
|
+
* @type HMaxRequestTimes
|
|
2546
2540
|
* @export
|
|
2547
|
-
* @interface HMaxRequestTimes
|
|
2548
2541
|
*/
|
|
2549
|
-
|
|
2550
|
-
}
|
|
2542
|
+
type HMaxRequestTimes = number | string;
|
|
2551
2543
|
|
|
2552
2544
|
/**
|
|
2553
2545
|
* PasarGuardAPI
|
|
@@ -2561,12 +2553,10 @@ interface HMaxRequestTimes {
|
|
|
2561
2553
|
* Do not edit the class manually.
|
|
2562
2554
|
*/
|
|
2563
2555
|
/**
|
|
2564
|
-
*
|
|
2556
|
+
* @type HMaxReusableSecs
|
|
2565
2557
|
* @export
|
|
2566
|
-
* @interface HMaxReusableSecs
|
|
2567
2558
|
*/
|
|
2568
|
-
|
|
2569
|
-
}
|
|
2559
|
+
type HMaxReusableSecs = number | string;
|
|
2570
2560
|
|
|
2571
2561
|
/**
|
|
2572
2562
|
* PasarGuardAPI
|
|
@@ -2580,12 +2570,10 @@ interface HMaxReusableSecs {
|
|
|
2580
2570
|
* Do not edit the class manually.
|
|
2581
2571
|
*/
|
|
2582
2572
|
/**
|
|
2583
|
-
*
|
|
2573
|
+
* @type MaxConcurrency
|
|
2584
2574
|
* @export
|
|
2585
|
-
* @interface MaxConcurrency
|
|
2586
2575
|
*/
|
|
2587
|
-
|
|
2588
|
-
}
|
|
2576
|
+
type MaxConcurrency = number | string;
|
|
2589
2577
|
|
|
2590
2578
|
/**
|
|
2591
2579
|
* PasarGuardAPI
|
|
@@ -2599,12 +2587,10 @@ interface MaxConcurrency {
|
|
|
2599
2587
|
* Do not edit the class manually.
|
|
2600
2588
|
*/
|
|
2601
2589
|
/**
|
|
2602
|
-
*
|
|
2590
|
+
* @type MaxConnections
|
|
2603
2591
|
* @export
|
|
2604
|
-
* @interface MaxConnections
|
|
2605
2592
|
*/
|
|
2606
|
-
|
|
2607
|
-
}
|
|
2593
|
+
type MaxConnections = number | string;
|
|
2608
2594
|
|
|
2609
2595
|
/**
|
|
2610
2596
|
* PasarGuardAPI
|
|
@@ -2674,12 +2660,10 @@ interface XMuxSettingsInput {
|
|
|
2674
2660
|
* Do not edit the class manually.
|
|
2675
2661
|
*/
|
|
2676
2662
|
/**
|
|
2677
|
-
*
|
|
2663
|
+
* @type XPaddingBytes
|
|
2678
2664
|
* @export
|
|
2679
|
-
* @interface XPaddingBytes
|
|
2680
2665
|
*/
|
|
2681
|
-
|
|
2682
|
-
}
|
|
2666
|
+
type XPaddingBytes = number | string;
|
|
2683
2667
|
|
|
2684
2668
|
/**
|
|
2685
2669
|
* PasarGuardAPI
|
|
@@ -3064,12 +3048,10 @@ interface Discord {
|
|
|
3064
3048
|
* Do not edit the class manually.
|
|
3065
3049
|
*/
|
|
3066
3050
|
/**
|
|
3067
|
-
*
|
|
3051
|
+
* @type Expire
|
|
3068
3052
|
* @export
|
|
3069
|
-
* @interface Expire
|
|
3070
3053
|
*/
|
|
3071
|
-
|
|
3072
|
-
}
|
|
3054
|
+
type Expire = number | string;
|
|
3073
3055
|
|
|
3074
3056
|
/**
|
|
3075
3057
|
* PasarGuardAPI
|
|
@@ -4211,21 +4193,39 @@ interface NodesResponse {
|
|
|
4211
4193
|
* Do not edit the class manually.
|
|
4212
4194
|
*/
|
|
4213
4195
|
/**
|
|
4214
|
-
*
|
|
4196
|
+
* User IP list - mapping of IP addresses to connection counts
|
|
4215
4197
|
* @export
|
|
4216
|
-
* @interface
|
|
4198
|
+
* @interface UserIPList
|
|
4217
4199
|
*/
|
|
4218
|
-
interface
|
|
4200
|
+
interface UserIPList {
|
|
4219
4201
|
/**
|
|
4220
4202
|
*
|
|
4221
4203
|
* @type {{ [key: string]: number; }}
|
|
4222
|
-
* @memberof
|
|
4204
|
+
* @memberof UserIPList
|
|
4223
4205
|
*/
|
|
4224
4206
|
'ips': {
|
|
4225
4207
|
[key: string]: number;
|
|
4226
4208
|
};
|
|
4227
4209
|
}
|
|
4228
4210
|
|
|
4211
|
+
/**
|
|
4212
|
+
* PasarGuardAPI
|
|
4213
|
+
* Unified GUI Censorship Resistant Solution
|
|
4214
|
+
*
|
|
4215
|
+
* The version of the OpenAPI document: 1.8.2
|
|
4216
|
+
*
|
|
4217
|
+
*
|
|
4218
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
4219
|
+
* https://openapi-generator.tech
|
|
4220
|
+
* Do not edit the class manually.
|
|
4221
|
+
*/
|
|
4222
|
+
|
|
4223
|
+
/**
|
|
4224
|
+
* @type NodesValue
|
|
4225
|
+
* @export
|
|
4226
|
+
*/
|
|
4227
|
+
type NodesValue = UserIPList;
|
|
4228
|
+
|
|
4229
4229
|
/**
|
|
4230
4230
|
* PasarGuardAPI
|
|
4231
4231
|
* Unified GUI Censorship Resistant Solution
|
|
@@ -4559,12 +4559,10 @@ interface NotificationSettingsOutput {
|
|
|
4559
4559
|
* Do not edit the class manually.
|
|
4560
4560
|
*/
|
|
4561
4561
|
/**
|
|
4562
|
-
*
|
|
4562
|
+
* @type OnHoldTimeout
|
|
4563
4563
|
* @export
|
|
4564
|
-
* @interface OnHoldTimeout
|
|
4565
4564
|
*/
|
|
4566
|
-
|
|
4567
|
-
}
|
|
4565
|
+
type OnHoldTimeout = number | string;
|
|
4568
4566
|
|
|
4569
4567
|
/**
|
|
4570
4568
|
* PasarGuardAPI
|
|
@@ -4810,49 +4808,12 @@ interface RemoveUsersResponse {
|
|
|
4810
4808
|
* https://openapi-generator.tech
|
|
4811
4809
|
* Do not edit the class manually.
|
|
4812
4810
|
*/
|
|
4811
|
+
|
|
4813
4812
|
/**
|
|
4814
|
-
*
|
|
4813
|
+
* @type ResponseRealtimeNodesStatsApiNodesRealtimeStatsGetValue
|
|
4815
4814
|
* @export
|
|
4816
|
-
* @interface ResponseRealtimeNodesStatsApiNodesRealtimeStatsGetValue
|
|
4817
4815
|
*/
|
|
4818
|
-
|
|
4819
|
-
/**
|
|
4820
|
-
*
|
|
4821
|
-
* @type {number}
|
|
4822
|
-
* @memberof ResponseRealtimeNodesStatsApiNodesRealtimeStatsGetValue
|
|
4823
|
-
*/
|
|
4824
|
-
'mem_total': number;
|
|
4825
|
-
/**
|
|
4826
|
-
*
|
|
4827
|
-
* @type {number}
|
|
4828
|
-
* @memberof ResponseRealtimeNodesStatsApiNodesRealtimeStatsGetValue
|
|
4829
|
-
*/
|
|
4830
|
-
'mem_used': number;
|
|
4831
|
-
/**
|
|
4832
|
-
*
|
|
4833
|
-
* @type {number}
|
|
4834
|
-
* @memberof ResponseRealtimeNodesStatsApiNodesRealtimeStatsGetValue
|
|
4835
|
-
*/
|
|
4836
|
-
'cpu_cores': number;
|
|
4837
|
-
/**
|
|
4838
|
-
*
|
|
4839
|
-
* @type {number}
|
|
4840
|
-
* @memberof ResponseRealtimeNodesStatsApiNodesRealtimeStatsGetValue
|
|
4841
|
-
*/
|
|
4842
|
-
'cpu_usage': number;
|
|
4843
|
-
/**
|
|
4844
|
-
*
|
|
4845
|
-
* @type {number}
|
|
4846
|
-
* @memberof ResponseRealtimeNodesStatsApiNodesRealtimeStatsGetValue
|
|
4847
|
-
*/
|
|
4848
|
-
'incoming_bandwidth_speed': number;
|
|
4849
|
-
/**
|
|
4850
|
-
*
|
|
4851
|
-
* @type {number}
|
|
4852
|
-
* @memberof ResponseRealtimeNodesStatsApiNodesRealtimeStatsGetValue
|
|
4853
|
-
*/
|
|
4854
|
-
'outgoing_bandwidth_speed': number;
|
|
4855
|
-
}
|
|
4816
|
+
type ResponseRealtimeNodesStatsApiNodesRealtimeStatsGetValue = NodeRealtimeStats;
|
|
4856
4817
|
|
|
4857
4818
|
/**
|
|
4858
4819
|
* PasarGuardAPI
|
|
@@ -5794,33 +5755,6 @@ interface UserCreate {
|
|
|
5794
5755
|
'status'?: UserStatusCreate | null;
|
|
5795
5756
|
}
|
|
5796
5757
|
|
|
5797
|
-
/**
|
|
5798
|
-
* PasarGuardAPI
|
|
5799
|
-
* Unified GUI Censorship Resistant Solution
|
|
5800
|
-
*
|
|
5801
|
-
* The version of the OpenAPI document: 1.8.2
|
|
5802
|
-
*
|
|
5803
|
-
*
|
|
5804
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
5805
|
-
* https://openapi-generator.tech
|
|
5806
|
-
* Do not edit the class manually.
|
|
5807
|
-
*/
|
|
5808
|
-
/**
|
|
5809
|
-
* User IP list - mapping of IP addresses to connection counts
|
|
5810
|
-
* @export
|
|
5811
|
-
* @interface UserIPList
|
|
5812
|
-
*/
|
|
5813
|
-
interface UserIPList {
|
|
5814
|
-
/**
|
|
5815
|
-
*
|
|
5816
|
-
* @type {{ [key: string]: number; }}
|
|
5817
|
-
* @memberof UserIPList
|
|
5818
|
-
*/
|
|
5819
|
-
'ips': {
|
|
5820
|
-
[key: string]: number;
|
|
5821
|
-
};
|
|
5822
|
-
}
|
|
5823
|
-
|
|
5824
5758
|
/**
|
|
5825
5759
|
* PasarGuardAPI
|
|
5826
5760
|
* Unified GUI Censorship Resistant Solution
|
|
@@ -8597,7 +8531,7 @@ declare class NodeApi extends BaseAPI {
|
|
|
8597
8531
|
* @memberof NodeApi
|
|
8598
8532
|
*/
|
|
8599
8533
|
realtimeNodesStats(options?: RawAxiosRequestConfig): Promise<{
|
|
8600
|
-
[key: string]:
|
|
8534
|
+
[key: string]: NodeRealtimeStats;
|
|
8601
8535
|
}>;
|
|
8602
8536
|
/**
|
|
8603
8537
|
* Trigger reconnection for all nodes or a specific core.
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import C from'axios';import ye from'axios-retry';var d="http://localhost".replace(/\/+$/,"");var w=class{constructor(s,t=d,e=C){this.basePath=t;this.axios=e;s&&(this.configuration=s,this.basePath=s.basePath??t);}},G=class extends Error{constructor(t,e){super(e);this.field=t;this.name="RequiredError";}},g={};var h="https://example.com",y=function(n,s,t){if(t==null)throw new G(s,`Required parameter ${s} was null or undefined when calling ${n}.`)};var b=async function(n,s,t,e){if(e&&e.accessToken){let o=typeof e.accessToken=="function"?await e.accessToken(s,t):await e.accessToken;n.Authorization="Bearer "+o;}};function ee(n,s,t=""){s!=null&&(typeof s=="object"?Array.isArray(s)?s.forEach(e=>ee(n,e,t)):Object.keys(s).forEach(e=>ee(n,s[e],`${t}${t!==""?".":""}${e}`)):n.has(t)?n.append(t,s):n.set(t,s));}var x=function(n,...s){let t=new URLSearchParams(n.search);ee(t,s),n.search=t.toString();},U=function(n,s,t){let e=typeof n!="string";return (e&&t&&t.isJsonMime?t.isJsonMime(s.headers["Content-Type"]):e)?JSON.stringify(n!==void 0?n:{}):n||""},A=function(n){return n.pathname+n.search+n.hash},f=function(n,s,t,e){return (o=s,r=t)=>{let a={...n.options,url:(o.defaults.baseURL?"":e?.basePath??r)+n.url};return o.request(a)}};var pe=function(n){return {activateAllDisabledUsers:async(s,t={})=>{y("activateAllDisabledUsers","username",s);let e="/api/admin/{username}/users/activate".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},adminMiniAppToken:async(s,t={})=>{y("adminMiniAppToken","xTelegramAuthorization",s);let e="/api/admin/miniapp/token",o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};s!=null&&(i["x-telegram-authorization"]=String(s)),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},adminToken:async(s,t,e,o,r,a,i={})=>{y("adminToken","username",s),y("adminToken","password",t);let l="/api/admin/token",u=new URL(l,h),c;n&&(c=n.baseOptions);let R={method:"POST",...c,...i},P={},S={},O=new URLSearchParams;e!==void 0&&O.set("grant_type",e),s!==void 0&&O.set("username",s),t!==void 0&&O.set("password",t),o!==void 0&&O.set("scope",o),r!==void 0&&O.set("client_id",r),a!==void 0&&O.set("client_secret",a),P["Content-Type"]="application/x-www-form-urlencoded",x(u,S);let B=c&&c.headers?c.headers:{};return R.headers={...P,...B,...i.headers},R.data=O.toString(),{url:A(u),options:R}},createAdmin:async(s,t={})=>{y("createAdmin","adminCreate",s);let e="/api/admin",o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=U(s,a,n),{url:A(o),options:a}},disableAllActiveUsers:async(s,t={})=>{y("disableAllActiveUsers","username",s);let e="/api/admin/{username}/users/disable".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},getAdmins:async(s,t,e,o,r={})=>{let a="/api/admins",i=new URL(a,h),l;n&&(l=n.baseOptions);let u={method:"GET",...l,...r},c={},R={};await b(c,"OAuth2PasswordBearer",[],n),s!==void 0&&(R.username=s),t!==void 0&&(R.offset=t),e!==void 0&&(R.limit=e),o!==void 0&&(R.sort=o),x(i,R);let P=l&&l.headers?l.headers:{};return u.headers={...c,...P,...r.headers},{url:A(i),options:u}},getCurrentAdmin:async(s={})=>{let t="/api/admin",e=new URL(t,h),o;n&&(o=n.baseOptions);let r={method:"GET",...o,...s},a={},i={};await b(a,"OAuth2PasswordBearer",[],n),x(e,i);let l=o&&o.headers?o.headers:{};return r.headers={...a,...l,...s.headers},{url:A(e),options:r}},modifyAdmin:async(s,t,e={})=>{y("modifyAdmin","username",s),y("modifyAdmin","adminModify",t);let o="/api/admin/{username}".replace("{username}",encodeURIComponent(String(s))),r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"PUT",...a,...e},l={},u={};await b(l,"OAuth2PasswordBearer",[],n),l["Content-Type"]="application/json",x(r,u);let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},i.data=U(t,i,n),{url:A(r),options:i}},removeAdmin:async(s,t={})=>{y("removeAdmin","username",s);let e="/api/admin/{username}".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"DELETE",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},removeAllUsers:async(s,t={})=>{y("removeAllUsers","username",s);let e="/api/admin/{username}/users".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"DELETE",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},resetAdminUsage:async(s,t={})=>{y("resetAdminUsage","username",s);let e="/api/admin/{username}/reset".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}}}},v=function(n){let s=pe(n);return {async activateAllDisabledUsers(t,e){let o=await s.activateAllDisabledUsers(t,e),r=n?.serverIndex??0,a=g["AdminApi.activateAllDisabledUsers"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async adminMiniAppToken(t,e){let o=await s.adminMiniAppToken(t,e),r=n?.serverIndex??0,a=g["AdminApi.adminMiniAppToken"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async adminToken(t,e,o,r,a,i,l){let u=await s.adminToken(t,e,o,r,a,i,l),c=n?.serverIndex??0,R=g["AdminApi.adminToken"]?.[c]?.url;return (P,S)=>f(u,C,d,n)(P,R||S)},async createAdmin(t,e){let o=await s.createAdmin(t,e),r=n?.serverIndex??0,a=g["AdminApi.createAdmin"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async disableAllActiveUsers(t,e){let o=await s.disableAllActiveUsers(t,e),r=n?.serverIndex??0,a=g["AdminApi.disableAllActiveUsers"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async getAdmins(t,e,o,r,a){let i=await s.getAdmins(t,e,o,r,a),l=n?.serverIndex??0,u=g["AdminApi.getAdmins"]?.[l]?.url;return (c,R)=>f(i,C,d,n)(c,u||R)},async getCurrentAdmin(t){let e=await s.getCurrentAdmin(t),o=n?.serverIndex??0,r=g["AdminApi.getCurrentAdmin"]?.[o]?.url;return (a,i)=>f(e,C,d,n)(a,r||i)},async modifyAdmin(t,e,o){let r=await s.modifyAdmin(t,e,o),a=n?.serverIndex??0,i=g["AdminApi.modifyAdmin"]?.[a]?.url;return (l,u)=>f(r,C,d,n)(l,i||u)},async removeAdmin(t,e){let o=await s.removeAdmin(t,e),r=n?.serverIndex??0,a=g["AdminApi.removeAdmin"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async removeAllUsers(t,e){let o=await s.removeAllUsers(t,e),r=n?.serverIndex??0,a=g["AdminApi.removeAllUsers"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async resetAdminUsage(t,e){let o=await s.resetAdminUsage(t,e),r=n?.serverIndex??0,a=g["AdminApi.resetAdminUsage"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)}}};var N=class extends w{activateAllDisabledUsers(s,t){return v(this.configuration).activateAllDisabledUsers(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}adminMiniAppToken(s,t){return v(this.configuration).adminMiniAppToken(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}adminToken(s,t,e,o,r,a,i){return v(this.configuration).adminToken(s,t,e,o,r,a,i).then(l=>l(this.axios,this.basePath)).then(({data:l})=>l)}createAdmin(s,t){return v(this.configuration).createAdmin(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}disableAllActiveUsers(s,t){return v(this.configuration).disableAllActiveUsers(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}getAdmins(s,t,e,o,r){return v(this.configuration).getAdmins(s,t,e,o,r).then(a=>a(this.axios,this.basePath)).then(({data:a})=>a)}getCurrentAdmin(s){return v(this.configuration).getCurrentAdmin(s).then(t=>t(this.axios,this.basePath)).then(({data:t})=>t)}modifyAdmin(s,t,e){return v(this.configuration).modifyAdmin(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}removeAdmin(s,t){return v(this.configuration).removeAdmin(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}removeAllUsers(s,t){return v(this.configuration).removeAllUsers(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}resetAdminUsage(s,t){return v(this.configuration).resetAdminUsage(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}};var me=function(n){return {createCoreConfig:async(s,t={})=>{y("createCoreConfig","coreCreate",s);let e="/api/core",o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=U(s,a,n),{url:A(o),options:a}},deleteCoreConfig:async(s,t,e={})=>{y("deleteCoreConfig","coreId",s);let o="/api/core/{core_id}".replace("{core_id}",encodeURIComponent(String(s))),r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"DELETE",...a,...e},l={},u={};await b(l,"OAuth2PasswordBearer",[],n),t!==void 0&&(u.restart_nodes=t),x(r,u);let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},{url:A(r),options:i}},getAllCores:async(s,t,e={})=>{let o="/api/cores",r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"GET",...a,...e},l={},u={};await b(l,"OAuth2PasswordBearer",[],n),s!==void 0&&(u.offset=s),t!==void 0&&(u.limit=t),x(r,u);let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},{url:A(r),options:i}},getCoreConfig:async(s,t={})=>{y("getCoreConfig","coreId",s);let e="/api/core/{core_id}".replace("{core_id}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},modifyCoreConfig:async(s,t,e,o={})=>{y("modifyCoreConfig","coreId",s),y("modifyCoreConfig","restartNodes",t),y("modifyCoreConfig","coreCreate",e);let r="/api/core/{core_id}".replace("{core_id}",encodeURIComponent(String(s))),a=new URL(r,h),i;n&&(i=n.baseOptions);let l={method:"PUT",...i,...o},u={},c={};await b(u,"OAuth2PasswordBearer",[],n),t!==void 0&&(c.restart_nodes=t),u["Content-Type"]="application/json",x(a,c);let R=i&&i.headers?i.headers:{};return l.headers={...u,...R,...o.headers},l.data=U(e,l,n),{url:A(a),options:l}},restartCore:async(s,t={})=>{y("restartCore","coreId",s);let e="/api/core/{core_id}/restart".replace("{core_id}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}}}},L=function(n){let s=me(n);return {async createCoreConfig(t,e){let o=await s.createCoreConfig(t,e),r=n?.serverIndex??0,a=g["CoreApi.createCoreConfig"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async deleteCoreConfig(t,e,o){let r=await s.deleteCoreConfig(t,e,o),a=n?.serverIndex??0,i=g["CoreApi.deleteCoreConfig"]?.[a]?.url;return (l,u)=>f(r,C,d,n)(l,i||u)},async getAllCores(t,e,o){let r=await s.getAllCores(t,e,o),a=n?.serverIndex??0,i=g["CoreApi.getAllCores"]?.[a]?.url;return (l,u)=>f(r,C,d,n)(l,i||u)},async getCoreConfig(t,e){let o=await s.getCoreConfig(t,e),r=n?.serverIndex??0,a=g["CoreApi.getCoreConfig"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async modifyCoreConfig(t,e,o,r){let a=await s.modifyCoreConfig(t,e,o,r),i=n?.serverIndex??0,l=g["CoreApi.modifyCoreConfig"]?.[i]?.url;return (u,c)=>f(a,C,d,n)(u,l||c)},async restartCore(t,e){let o=await s.restartCore(t,e),r=n?.serverIndex??0,a=g["CoreApi.restartCore"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)}}};var D=class extends w{createCoreConfig(s,t){return L(this.configuration).createCoreConfig(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}deleteCoreConfig(s,t,e){return L(this.configuration).deleteCoreConfig(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}getAllCores(s,t,e){return L(this.configuration).getAllCores(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}getCoreConfig(s,t){return L(this.configuration).getCoreConfig(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}modifyCoreConfig(s,t,e,o){return L(this.configuration).modifyCoreConfig(s,t,e,o).then(r=>r(this.axios,this.basePath)).then(({data:r})=>r)}restartCore(s,t){return L(this.configuration).restartCore(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}};var ce=function(n){return {base:async(s={})=>{let e=new URL("/",h),o;n&&(o=n.baseOptions);let r={method:"GET",...o,...s},a={};x(e,{});let l=o&&o.headers?o.headers:{};return r.headers={...a,...l,...s.headers},{url:A(e),options:r}},getManifest:async(s,t={})=>{let e="/manifest.json",o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};s!==void 0&&(l.start_url=s),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}}}},se=function(n){let s=ce(n);return {async base(t){let e=await s.base(t),o=n?.serverIndex??0,r=g["DefaultApi.base"]?.[o]?.url;return (a,i)=>f(e,C,d,n)(a,r||i)},async getManifest(t,e){let o=await s.getManifest(t,e),r=n?.serverIndex??0,a=g["DefaultApi.getManifest"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)}}};var Q=class extends w{base(s){return se(this.configuration).base(s).then(t=>t(this.axios,this.basePath)).then(({data:t})=>t)}getManifest(s,t){return se(this.configuration).getManifest(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}};var de=function(n){return {clearUsageData:async(s,t,e,o={})=>{y("clearUsageData","table",s);let r="/api/nodes/clear_usage_data/{table}".replace("{table}",encodeURIComponent(String(s))),a=new URL(r,h),i;n&&(i=n.baseOptions);let l={method:"DELETE",...i,...o},u={},c={};await b(u,"OAuth2PasswordBearer",[],n),t!==void 0&&(c.start=t instanceof Date?t.toISOString():t),e!==void 0&&(c.end=e instanceof Date?e.toISOString():e),x(a,c);let R=i&&i.headers?i.headers:{};return l.headers={...u,...R,...o.headers},{url:A(a),options:l}},createNode:async(s,t={})=>{y("createNode","nodeCreate",s);let e="/api/node",o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=U(s,a,n),{url:A(o),options:a}},getNode:async(s,t={})=>{y("getNode","nodeId",s);let e="/api/node/{node_id}".replace("{node_id}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},getNodeSettings:async(s={})=>{let t="/api/node/settings",e=new URL(t,h),o;n&&(o=n.baseOptions);let r={method:"GET",...o,...s},a={},i={};await b(a,"OAuth2PasswordBearer",[],n),x(e,i);let l=o&&o.headers?o.headers:{};return r.headers={...a,...l,...s.headers},{url:A(e),options:r}},getNodeStatsPeriodic:async(s,t,e,o,r={})=>{y("getNodeStatsPeriodic","nodeId",s);let a="/api/node/{node_id}/stats".replace("{node_id}",encodeURIComponent(String(s))),i=new URL(a,h),l;n&&(l=n.baseOptions);let u={method:"GET",...l,...r},c={},R={};await b(c,"OAuth2PasswordBearer",[],n),t!==void 0&&(R.start=t instanceof Date?t.toISOString():t),e!==void 0&&(R.end=e instanceof Date?e.toISOString():e),o!==void 0&&(R.period=o),x(i,R);let P=l&&l.headers?l.headers:{};return u.headers={...c,...P,...r.headers},{url:A(i),options:u}},getNodes:async(s,t,e,o,r,a,i,l={})=>{let u="/api/nodes",c=new URL(u,h),R;n&&(R=n.baseOptions);let P={method:"GET",...R,...l},S={},O={};await b(S,"OAuth2PasswordBearer",[],n),s!==void 0&&(O.core_id=s),t!==void 0&&(O.offset=t),e!==void 0&&(O.limit=e),o&&(O.status=o),r!==void 0&&(O.enabled=r),a&&(O.ids=a),i!==void 0&&(O.search=i),x(c,O);let B=R&&R.headers?R.headers:{};return P.headers={...S,...B,...l.headers},{url:A(c),options:P}},getUsage:async(s,t,e,o,r,a={})=>{let i="/api/node/usage",l=new URL(i,h),u;n&&(u=n.baseOptions);let c={method:"GET",...u,...a},R={},P={};await b(R,"OAuth2PasswordBearer",[],n),s!==void 0&&(P.start=s instanceof Date?s.toISOString():s),t!==void 0&&(P.end=t instanceof Date?t.toISOString():t),e!==void 0&&(P.period=e),o!==void 0&&(P.node_id=o),r!==void 0&&(P.group_by_node=r),x(l,P);let S=u&&u.headers?u.headers:{};return c.headers={...R,...S,...a.headers},{url:A(l),options:c}},modifyNode:async(s,t,e={})=>{y("modifyNode","nodeId",s),y("modifyNode","nodeModify",t);let o="/api/node/{node_id}".replace("{node_id}",encodeURIComponent(String(s))),r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"PUT",...a,...e},l={},u={};await b(l,"OAuth2PasswordBearer",[],n),l["Content-Type"]="application/json",x(r,u);let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},i.data=U(t,i,n),{url:A(r),options:i}},nodeLogs:async(s,t={})=>{y("nodeLogs","nodeId",s);let e="/api/node/{node_id}/logs".replace("{node_id}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},realtimeNodeStats:async(s,t={})=>{y("realtimeNodeStats","nodeId",s);let e="/api/node/{node_id}/realtime_stats".replace("{node_id}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},realtimeNodesStats:async(s={})=>{let t="/api/nodes/realtime_stats",e=new URL(t,h),o;n&&(o=n.baseOptions);let r={method:"GET",...o,...s},a={},i={};await b(a,"OAuth2PasswordBearer",[],n),x(e,i);let l=o&&o.headers?o.headers:{};return r.headers={...a,...l,...s.headers},{url:A(e),options:r}},reconnectAllNode:async(s,t={})=>{let e="/api/nodes/reconnect",o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),s!==void 0&&(l.core_id=s),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},reconnectNode:async(s,t={})=>{y("reconnectNode","nodeId",s);let e="/api/node/{node_id}/reconnect".replace("{node_id}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},removeNode:async(s,t={})=>{y("removeNode","nodeId",s);let e="/api/node/{node_id}".replace("{node_id}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"DELETE",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},resetNodeUsage:async(s,t={})=>{y("resetNodeUsage","nodeId",s);let e="/api/node/{node_id}/reset".replace("{node_id}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},syncNode:async(s,t,e={})=>{y("syncNode","nodeId",s);let o="/api/node/{node_id}/sync".replace("{node_id}",encodeURIComponent(String(s))),r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"PUT",...a,...e},l={},u={};await b(l,"OAuth2PasswordBearer",[],n),t!==void 0&&(u.flush_users=t),x(r,u);let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},{url:A(r),options:i}},userOnlineIpList:async(s,t,e={})=>{y("userOnlineIpList","nodeId",s),y("userOnlineIpList","username",t);let o="/api/node/{node_id}/online_stats/{username}/ip".replace("{node_id}",encodeURIComponent(String(s))).replace("{username}",encodeURIComponent(String(t))),r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"GET",...a,...e},l={},u={};await b(l,"OAuth2PasswordBearer",[],n),x(r,u);let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},{url:A(r),options:i}},userOnlineIpListAllNodes:async(s,t={})=>{y("userOnlineIpListAllNodes","username",s);let e="/api/node/online_stats/{username}/ip".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},userOnlineStats:async(s,t,e={})=>{y("userOnlineStats","nodeId",s),y("userOnlineStats","username",t);let o="/api/node/{node_id}/online_stats/{username}".replace("{node_id}",encodeURIComponent(String(s))).replace("{username}",encodeURIComponent(String(t))),r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"GET",...a,...e},l={},u={};await b(l,"OAuth2PasswordBearer",[],n),x(r,u);let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},{url:A(r),options:i}}}},q=function(n){let s=de(n);return {async clearUsageData(t,e,o,r){let a=await s.clearUsageData(t,e,o,r),i=n?.serverIndex??0,l=g["NodeApi.clearUsageData"]?.[i]?.url;return (u,c)=>f(a,C,d,n)(u,l||c)},async createNode(t,e){let o=await s.createNode(t,e),r=n?.serverIndex??0,a=g["NodeApi.createNode"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async getNode(t,e){let o=await s.getNode(t,e),r=n?.serverIndex??0,a=g["NodeApi.getNode"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async getNodeSettings(t){let e=await s.getNodeSettings(t),o=n?.serverIndex??0,r=g["NodeApi.getNodeSettings"]?.[o]?.url;return (a,i)=>f(e,C,d,n)(a,r||i)},async getNodeStatsPeriodic(t,e,o,r,a){let i=await s.getNodeStatsPeriodic(t,e,o,r,a),l=n?.serverIndex??0,u=g["NodeApi.getNodeStatsPeriodic"]?.[l]?.url;return (c,R)=>f(i,C,d,n)(c,u||R)},async getNodes(t,e,o,r,a,i,l,u){let c=await s.getNodes(t,e,o,r,a,i,l,u),R=n?.serverIndex??0,P=g["NodeApi.getNodes"]?.[R]?.url;return (S,O)=>f(c,C,d,n)(S,P||O)},async getUsage(t,e,o,r,a,i){let l=await s.getUsage(t,e,o,r,a,i),u=n?.serverIndex??0,c=g["NodeApi.getUsage"]?.[u]?.url;return (R,P)=>f(l,C,d,n)(R,c||P)},async modifyNode(t,e,o){let r=await s.modifyNode(t,e,o),a=n?.serverIndex??0,i=g["NodeApi.modifyNode"]?.[a]?.url;return (l,u)=>f(r,C,d,n)(l,i||u)},async nodeLogs(t,e){let o=await s.nodeLogs(t,e),r=n?.serverIndex??0,a=g["NodeApi.nodeLogs"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async realtimeNodeStats(t,e){let o=await s.realtimeNodeStats(t,e),r=n?.serverIndex??0,a=g["NodeApi.realtimeNodeStats"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async realtimeNodesStats(t){let e=await s.realtimeNodesStats(t),o=n?.serverIndex??0,r=g["NodeApi.realtimeNodesStats"]?.[o]?.url;return (a,i)=>f(e,C,d,n)(a,r||i)},async reconnectAllNode(t,e){let o=await s.reconnectAllNode(t,e),r=n?.serverIndex??0,a=g["NodeApi.reconnectAllNode"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async reconnectNode(t,e){let o=await s.reconnectNode(t,e),r=n?.serverIndex??0,a=g["NodeApi.reconnectNode"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async removeNode(t,e){let o=await s.removeNode(t,e),r=n?.serverIndex??0,a=g["NodeApi.removeNode"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async resetNodeUsage(t,e){let o=await s.resetNodeUsage(t,e),r=n?.serverIndex??0,a=g["NodeApi.resetNodeUsage"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async syncNode(t,e,o){let r=await s.syncNode(t,e,o),a=n?.serverIndex??0,i=g["NodeApi.syncNode"]?.[a]?.url;return (l,u)=>f(r,C,d,n)(l,i||u)},async userOnlineIpList(t,e,o){let r=await s.userOnlineIpList(t,e,o),a=n?.serverIndex??0,i=g["NodeApi.userOnlineIpList"]?.[a]?.url;return (l,u)=>f(r,C,d,n)(l,i||u)},async userOnlineIpListAllNodes(t,e){let o=await s.userOnlineIpListAllNodes(t,e),r=n?.serverIndex??0,a=g["NodeApi.userOnlineIpListAllNodes"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async userOnlineStats(t,e,o){let r=await s.userOnlineStats(t,e,o),a=n?.serverIndex??0,i=g["NodeApi.userOnlineStats"]?.[a]?.url;return (l,u)=>f(r,C,d,n)(l,i||u)}}};var $=class extends w{clearUsageData(s,t,e,o){return q(this.configuration).clearUsageData(s,t,e,o).then(r=>r(this.axios,this.basePath)).then(({data:r})=>r)}createNode(s,t){return q(this.configuration).createNode(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}getNode(s,t){return q(this.configuration).getNode(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}getNodeSettings(s){return q(this.configuration).getNodeSettings(s).then(t=>t(this.axios,this.basePath)).then(({data:t})=>t)}getNodeStatsPeriodic(s,t,e,o,r){return q(this.configuration).getNodeStatsPeriodic(s,t,e,o,r).then(a=>a(this.axios,this.basePath)).then(({data:a})=>a)}getNodes(s,t,e,o,r,a,i,l){return q(this.configuration).getNodes(s,t,e,o,r,a,i,l).then(u=>u(this.axios,this.basePath)).then(({data:u})=>u)}getUsage(s,t,e,o,r,a){return q(this.configuration).getUsage(s,t,e,o,r,a).then(i=>i(this.axios,this.basePath)).then(({data:i})=>i)}modifyNode(s,t,e){return q(this.configuration).modifyNode(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}nodeLogs(s,t){return q(this.configuration).nodeLogs(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}realtimeNodeStats(s,t){return q(this.configuration).realtimeNodeStats(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}realtimeNodesStats(s){return q(this.configuration).realtimeNodesStats(s).then(t=>t(this.axios,this.basePath)).then(({data:t})=>t)}reconnectAllNode(s,t){return q(this.configuration).reconnectAllNode(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}reconnectNode(s,t){return q(this.configuration).reconnectNode(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}removeNode(s,t){return q(this.configuration).removeNode(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}resetNodeUsage(s,t){return q(this.configuration).resetNodeUsage(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}syncNode(s,t,e){return q(this.configuration).syncNode(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}userOnlineIpList(s,t,e){return q(this.configuration).userOnlineIpList(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}userOnlineIpListAllNodes(s,t){return q(this.configuration).userOnlineIpListAllNodes(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}userOnlineStats(s,t,e){return q(this.configuration).userOnlineStats(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}};var ge=function(n){return {getSubUserUsage:async(s,t,e,o,r={})=>{y("getSubUserUsage","token",s);let a="/sub/{token}/usage".replace("{token}",encodeURIComponent(String(s))),i=new URL(a,h),l;n&&(l=n.baseOptions);let u={method:"GET",...l,...r},c={},R={};t!==void 0&&(R.start=t instanceof Date?t.toISOString():t),e!==void 0&&(R.end=e instanceof Date?e.toISOString():e),o!==void 0&&(R.period=o),x(i,R);let P=l&&l.headers?l.headers:{};return u.headers={...c,...P,...r.headers},{url:A(i),options:u}},userSubscription:async(s,t,e={})=>{y("userSubscription","token",s);let o="/sub/{token}/".replace("{token}",encodeURIComponent(String(s))),r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"GET",...a,...e},l={},u={};t!=null&&(l["user-agent"]=String(t)),x(r,u);let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},{url:A(r),options:i}},userSubscriptionApps:async(s,t={})=>{y("userSubscriptionApps","token",s);let e="/sub/{token}/apps".replace("{token}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={};x(o,{});let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},userSubscriptionInfo:async(s,t={})=>{y("userSubscriptionInfo","token",s);let e="/sub/{token}/info".replace("{token}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={};x(o,{});let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},userSubscriptionWithClientType:async(s,t,e={})=>{y("userSubscriptionWithClientType","token",s),y("userSubscriptionWithClientType","clientType",t);let o="/sub/{token}/{client_type}".replace("{token}",encodeURIComponent(String(s))).replace("{client_type}",encodeURIComponent(String(t))),r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"GET",...a,...e},l={};x(r,{});let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},{url:A(r),options:i}}}},M=function(n){let s=ge(n);return {async getSubUserUsage(t,e,o,r,a){let i=await s.getSubUserUsage(t,e,o,r,a),l=n?.serverIndex??0,u=g["SubscriptionApi.getSubUserUsage"]?.[l]?.url;return (c,R)=>f(i,C,d,n)(c,u||R)},async userSubscription(t,e,o){let r=await s.userSubscription(t,e,o),a=n?.serverIndex??0,i=g["SubscriptionApi.userSubscription"]?.[a]?.url;return (l,u)=>f(r,C,d,n)(l,i||u)},async userSubscriptionApps(t,e){let o=await s.userSubscriptionApps(t,e),r=n?.serverIndex??0,a=g["SubscriptionApi.userSubscriptionApps"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async userSubscriptionInfo(t,e){let o=await s.userSubscriptionInfo(t,e),r=n?.serverIndex??0,a=g["SubscriptionApi.userSubscriptionInfo"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async userSubscriptionWithClientType(t,e,o){let r=await s.userSubscriptionWithClientType(t,e,o),a=n?.serverIndex??0,i=g["SubscriptionApi.userSubscriptionWithClientType"]?.[a]?.url;return (l,u)=>f(r,C,d,n)(l,i||u)}}};var X=class extends w{getSubUserUsage(s,t,e,o,r){return M(this.configuration).getSubUserUsage(s,t,e,o,r).then(a=>a(this.axios,this.basePath)).then(({data:a})=>a)}userSubscription(s,t,e){return M(this.configuration).userSubscription(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}userSubscriptionApps(s,t){return M(this.configuration).userSubscriptionApps(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}userSubscriptionInfo(s,t){return M(this.configuration).userSubscriptionInfo(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}userSubscriptionWithClientType(s,t,e){return M(this.configuration).userSubscriptionWithClientType(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}};var he=function(n){return {getInbounds:async(s={})=>{let t="/api/inbounds",e=new URL(t,h),o;n&&(o=n.baseOptions);let r={method:"GET",...o,...s},a={},i={};await b(a,"OAuth2PasswordBearer",[],n),x(e,i);let l=o&&o.headers?o.headers:{};return r.headers={...a,...l,...s.headers},{url:A(e),options:r}},getSystemStats:async(s,t={})=>{let e="/api/system",o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),s!==void 0&&(l.admin_username=s),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}}}},oe=function(n){let s=he(n);return {async getInbounds(t){let e=await s.getInbounds(t),o=n?.serverIndex??0,r=g["SystemApi.getInbounds"]?.[o]?.url;return (a,i)=>f(e,C,d,n)(a,r||i)},async getSystemStats(t,e){let o=await s.getSystemStats(t,e),r=n?.serverIndex??0,a=g["SystemApi.getSystemStats"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)}}};var z=class extends w{getInbounds(s){return oe(this.configuration).getInbounds(s).then(t=>t(this.axios,this.basePath)).then(({data:t})=>t)}getSystemStats(s,t){return oe(this.configuration).getSystemStats(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}};var xe=function(n){return {activeNextPlan:async(s,t={})=>{y("activeNextPlan","username",s);let e="/api/user/{username}/active_next".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},bulkModifyUsersDatalimit:async(s,t={})=>{y("bulkModifyUsersDatalimit","bulkUser",s);let e="/api/users/bulk/data_limit",o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=U(s,a,n),{url:A(o),options:a}},bulkModifyUsersExpire:async(s,t={})=>{y("bulkModifyUsersExpire","bulkUser",s);let e="/api/users/bulk/expire",o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=U(s,a,n),{url:A(o),options:a}},bulkModifyUsersProxySettings:async(s,t={})=>{y("bulkModifyUsersProxySettings","bulkUsersProxy",s);let e="/api/users/bulk/proxy_settings",o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=U(s,a,n),{url:A(o),options:a}},createUser:async(s,t={})=>{y("createUser","userCreate",s);let e="/api/user",o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=U(s,a,n),{url:A(o),options:a}},createUserFromTemplate:async(s,t={})=>{y("createUserFromTemplate","createUserFromTemplate",s);let e="/api/user/from_template",o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=U(s,a,n),{url:A(o),options:a}},deleteExpiredUsers:async(s,t,e,o={})=>{let r="/api/users/expired",a=new URL(r,h),i;n&&(i=n.baseOptions);let l={method:"DELETE",...i,...o},u={},c={};await b(u,"OAuth2PasswordBearer",[],n),s!==void 0&&(c.admin_username=s),t!==void 0&&(c.expired_after=t instanceof Date?t.toISOString():t),e!==void 0&&(c.expired_before=e instanceof Date?e.toISOString():e),x(a,c);let R=i&&i.headers?i.headers:{};return l.headers={...u,...R,...o.headers},{url:A(a),options:l}},getExpiredUsers:async(s,t,e,o={})=>{let r="/api/users/expired",a=new URL(r,h),i;n&&(i=n.baseOptions);let l={method:"GET",...i,...o},u={},c={};await b(u,"OAuth2PasswordBearer",[],n),s!==void 0&&(c.admin_username=s),t!==void 0&&(c.expired_after=t instanceof Date?t.toISOString():t),e!==void 0&&(c.expired_before=e instanceof Date?e.toISOString():e),x(a,c);let R=i&&i.headers?i.headers:{};return l.headers={...u,...R,...o.headers},{url:A(a),options:l}},getUser:async(s,t={})=>{y("getUser","username",s);let e="/api/user/{username}".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},getUserSubUpdateList:async(s,t,e,o={})=>{y("getUserSubUpdateList","username",s);let r="/api/user/{username}/sub_update".replace("{username}",encodeURIComponent(String(s))),a=new URL(r,h),i;n&&(i=n.baseOptions);let l={method:"GET",...i,...o},u={},c={};await b(u,"OAuth2PasswordBearer",[],n),t!==void 0&&(c.offset=t),e!==void 0&&(c.limit=e),x(a,c);let R=i&&i.headers?i.headers:{};return l.headers={...u,...R,...o.headers},{url:A(a),options:l}},getUserUsage:async(s,t,e,o,r,a,i={})=>{y("getUserUsage","username",s),y("getUserUsage","period",t);let l="/api/user/{username}/usage".replace("{username}",encodeURIComponent(String(s))),u=new URL(l,h),c;n&&(c=n.baseOptions);let R={method:"GET",...c,...i},P={},S={};await b(P,"OAuth2PasswordBearer",[],n),t!==void 0&&(S.period=t),e!==void 0&&(S.node_id=e),o!==void 0&&(S.group_by_node=o),r!==void 0&&(S.start=r instanceof Date?r.toISOString():r),a!==void 0&&(S.end=a instanceof Date?a.toISOString():a),x(u,S);let O=c&&c.headers?c.headers:{};return R.headers={...P,...O,...i.headers},{url:A(u),options:R}},getUsers:async(s,t,e,o,r,a,i,l,u,c,R={})=>{let P="/api/users",S=new URL(P,h),O;n&&(O=n.baseOptions);let B={method:"GET",...O,...R},j={},T={};await b(j,"OAuth2PasswordBearer",[],n),s!==void 0&&(T.offset=s),t!==void 0&&(T.limit=t),e&&(T.username=e),o&&(T.admin=o),r&&(T.group=r),a!==void 0&&(T.search=a),i!==void 0&&(T.status=i),l!==void 0&&(T.sort=l),u!==void 0&&(T.proxy_id=u),c!==void 0&&(T.load_sub=c),x(S,T);let le=O&&O.headers?O.headers:{};return B.headers={...j,...le,...R.headers},{url:A(S),options:B}},getUsersSubUpdateChart:async(s,t,e={})=>{let o="/api/users/sub_update/chart",r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"GET",...a,...e},l={},u={};await b(l,"OAuth2PasswordBearer",[],n),s!==void 0&&(u.username=s),t!==void 0&&(u.admin_id=t),x(r,u);let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},{url:A(r),options:i}},getUsersUsage:async(s,t,e,o,r,a,i={})=>{y("getUsersUsage","period",s);let l="/api/users/usage",u=new URL(l,h),c;n&&(c=n.baseOptions);let R={method:"GET",...c,...i},P={},S={};await b(P,"OAuth2PasswordBearer",[],n),s!==void 0&&(S.period=s),t!==void 0&&(S.node_id=t),e!==void 0&&(S.group_by_node=e),o!==void 0&&(S.start=o instanceof Date?o.toISOString():o),r!==void 0&&(S.end=r instanceof Date?r.toISOString():r),a&&(S.admin=a),x(u,S);let O=c&&c.headers?c.headers:{};return R.headers={...P,...O,...i.headers},{url:A(u),options:R}},modifyUser:async(s,t,e={})=>{y("modifyUser","username",s),y("modifyUser","userModify",t);let o="/api/user/{username}".replace("{username}",encodeURIComponent(String(s))),r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"PUT",...a,...e},l={},u={};await b(l,"OAuth2PasswordBearer",[],n),l["Content-Type"]="application/json",x(r,u);let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},i.data=U(t,i,n),{url:A(r),options:i}},modifyUserWithTemplate:async(s,t,e={})=>{y("modifyUserWithTemplate","username",s),y("modifyUserWithTemplate","modifyUserByTemplate",t);let o="/api/user/from_template/{username}".replace("{username}",encodeURIComponent(String(s))),r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"PUT",...a,...e},l={},u={};await b(l,"OAuth2PasswordBearer",[],n),l["Content-Type"]="application/json",x(r,u);let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},i.data=U(t,i,n),{url:A(r),options:i}},removeUser:async(s,t={})=>{y("removeUser","username",s);let e="/api/user/{username}".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"DELETE",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},resetUserDataUsage:async(s,t={})=>{y("resetUserDataUsage","username",s);let e="/api/user/{username}/reset".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},resetUsersDataUsage:async(s={})=>{let t="/api/users/reset",e=new URL(t,h),o;n&&(o=n.baseOptions);let r={method:"POST",...o,...s},a={},i={};await b(a,"OAuth2PasswordBearer",[],n),x(e,i);let l=o&&o.headers?o.headers:{};return r.headers={...a,...l,...s.headers},{url:A(e),options:r}},revokeUserSubscription:async(s,t={})=>{y("revokeUserSubscription","username",s);let e="/api/user/{username}/revoke_sub".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},setOwner:async(s,t,e={})=>{y("setOwner","username",s),y("setOwner","adminUsername",t);let o="/api/user/{username}/set_owner".replace("{username}",encodeURIComponent(String(s))),r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"PUT",...a,...e},l={},u={};await b(l,"OAuth2PasswordBearer",[],n),t!==void 0&&(u.admin_username=t),x(r,u);let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},{url:A(r),options:i}}}},V=function(n){let s=xe(n);return {async activeNextPlan(t,e){let o=await s.activeNextPlan(t,e),r=n?.serverIndex??0,a=g["UserApi.activeNextPlan"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async bulkModifyUsersDatalimit(t,e){let o=await s.bulkModifyUsersDatalimit(t,e),r=n?.serverIndex??0,a=g["UserApi.bulkModifyUsersDatalimit"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async bulkModifyUsersExpire(t,e){let o=await s.bulkModifyUsersExpire(t,e),r=n?.serverIndex??0,a=g["UserApi.bulkModifyUsersExpire"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async bulkModifyUsersProxySettings(t,e){let o=await s.bulkModifyUsersProxySettings(t,e),r=n?.serverIndex??0,a=g["UserApi.bulkModifyUsersProxySettings"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async createUser(t,e){let o=await s.createUser(t,e),r=n?.serverIndex??0,a=g["UserApi.createUser"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async createUserFromTemplate(t,e){let o=await s.createUserFromTemplate(t,e),r=n?.serverIndex??0,a=g["UserApi.createUserFromTemplate"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async deleteExpiredUsers(t,e,o,r){let a=await s.deleteExpiredUsers(t,e,o,r),i=n?.serverIndex??0,l=g["UserApi.deleteExpiredUsers"]?.[i]?.url;return (u,c)=>f(a,C,d,n)(u,l||c)},async getExpiredUsers(t,e,o,r){let a=await s.getExpiredUsers(t,e,o,r),i=n?.serverIndex??0,l=g["UserApi.getExpiredUsers"]?.[i]?.url;return (u,c)=>f(a,C,d,n)(u,l||c)},async getUser(t,e){let o=await s.getUser(t,e),r=n?.serverIndex??0,a=g["UserApi.getUser"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async getUserSubUpdateList(t,e,o,r){let a=await s.getUserSubUpdateList(t,e,o,r),i=n?.serverIndex??0,l=g["UserApi.getUserSubUpdateList"]?.[i]?.url;return (u,c)=>f(a,C,d,n)(u,l||c)},async getUserUsage(t,e,o,r,a,i,l){let u=await s.getUserUsage(t,e,o,r,a,i,l),c=n?.serverIndex??0,R=g["UserApi.getUserUsage"]?.[c]?.url;return (P,S)=>f(u,C,d,n)(P,R||S)},async getUsers(t,e,o,r,a,i,l,u,c,R,P){let S=await s.getUsers(t,e,o,r,a,i,l,u,c,R,P),O=n?.serverIndex??0,B=g["UserApi.getUsers"]?.[O]?.url;return (j,T)=>f(S,C,d,n)(j,B||T)},async getUsersSubUpdateChart(t,e,o){let r=await s.getUsersSubUpdateChart(t,e,o),a=n?.serverIndex??0,i=g["UserApi.getUsersSubUpdateChart"]?.[a]?.url;return (l,u)=>f(r,C,d,n)(l,i||u)},async getUsersUsage(t,e,o,r,a,i,l){let u=await s.getUsersUsage(t,e,o,r,a,i,l),c=n?.serverIndex??0,R=g["UserApi.getUsersUsage"]?.[c]?.url;return (P,S)=>f(u,C,d,n)(P,R||S)},async modifyUser(t,e,o){let r=await s.modifyUser(t,e,o),a=n?.serverIndex??0,i=g["UserApi.modifyUser"]?.[a]?.url;return (l,u)=>f(r,C,d,n)(l,i||u)},async modifyUserWithTemplate(t,e,o){let r=await s.modifyUserWithTemplate(t,e,o),a=n?.serverIndex??0,i=g["UserApi.modifyUserWithTemplate"]?.[a]?.url;return (l,u)=>f(r,C,d,n)(l,i||u)},async removeUser(t,e){let o=await s.removeUser(t,e),r=n?.serverIndex??0,a=g["UserApi.removeUser"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async resetUserDataUsage(t,e){let o=await s.resetUserDataUsage(t,e),r=n?.serverIndex??0,a=g["UserApi.resetUserDataUsage"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async resetUsersDataUsage(t){let e=await s.resetUsersDataUsage(t),o=n?.serverIndex??0,r=g["UserApi.resetUsersDataUsage"]?.[o]?.url;return (a,i)=>f(e,C,d,n)(a,r||i)},async revokeUserSubscription(t,e){let o=await s.revokeUserSubscription(t,e),r=n?.serverIndex??0,a=g["UserApi.revokeUserSubscription"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async setOwner(t,e,o){let r=await s.setOwner(t,e,o),a=n?.serverIndex??0,i=g["UserApi.setOwner"]?.[a]?.url;return (l,u)=>f(r,C,d,n)(l,i||u)}}};var W=class extends w{activeNextPlan(s,t){return V(this.configuration).activeNextPlan(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}bulkModifyUsersDatalimit(s,t){return V(this.configuration).bulkModifyUsersDatalimit(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}bulkModifyUsersExpire(s,t){return V(this.configuration).bulkModifyUsersExpire(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}bulkModifyUsersProxySettings(s,t){return V(this.configuration).bulkModifyUsersProxySettings(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}createUser(s,t){return V(this.configuration).createUser(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}createUserFromTemplate(s,t){return V(this.configuration).createUserFromTemplate(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}deleteExpiredUsers(s,t,e,o){return V(this.configuration).deleteExpiredUsers(s,t,e,o).then(r=>r(this.axios,this.basePath)).then(({data:r})=>r)}getExpiredUsers(s,t,e,o){return V(this.configuration).getExpiredUsers(s,t,e,o).then(r=>r(this.axios,this.basePath)).then(({data:r})=>r)}getUser(s,t){return V(this.configuration).getUser(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}getUserSubUpdateList(s,t,e,o){return V(this.configuration).getUserSubUpdateList(s,t,e,o).then(r=>r(this.axios,this.basePath)).then(({data:r})=>r)}getUserUsage(s,t,e,o,r,a,i){return V(this.configuration).getUserUsage(s,t,e,o,r,a,i).then(l=>l(this.axios,this.basePath)).then(({data:l})=>l)}getUsers(s,t,e,o,r,a,i,l,u,c,R){return V(this.configuration).getUsers(s,t,e,o,r,a,i,l,u,c,R).then(P=>P(this.axios,this.basePath)).then(({data:P})=>P)}getUsersSubUpdateChart(s,t,e){return V(this.configuration).getUsersSubUpdateChart(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}getUsersUsage(s,t,e,o,r,a,i){return V(this.configuration).getUsersUsage(s,t,e,o,r,a,i).then(l=>l(this.axios,this.basePath)).then(({data:l})=>l)}modifyUser(s,t,e){return V(this.configuration).modifyUser(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}modifyUserWithTemplate(s,t,e){return V(this.configuration).modifyUserWithTemplate(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}removeUser(s,t){return V(this.configuration).removeUser(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}resetUserDataUsage(s,t){return V(this.configuration).resetUserDataUsage(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}resetUsersDataUsage(s){return V(this.configuration).resetUsersDataUsage(s).then(t=>t(this.axios,this.basePath)).then(({data:t})=>t)}revokeUserSubscription(s,t){return V(this.configuration).revokeUserSubscription(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}setOwner(s,t,e){return V(this.configuration).setOwner(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}};var Ae=function(n){return {createUserTemplate:async(s,t={})=>{y("createUserTemplate","userTemplateCreate",s);let e="/api/user_template",o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=U(s,a,n),{url:A(o),options:a}},getUserTemplate:async(s,t={})=>{y("getUserTemplate","templateId",s);let e="/api/user_template/{template_id}".replace("{template_id}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},getUserTemplates:async(s,t,e={})=>{let o="/api/user_templates",r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"GET",...a,...e},l={},u={};await b(l,"OAuth2PasswordBearer",[],n),s!==void 0&&(u.offset=s),t!==void 0&&(u.limit=t),x(r,u);let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},{url:A(r),options:i}},modifyUserTemplate:async(s,t,e={})=>{y("modifyUserTemplate","templateId",s),y("modifyUserTemplate","userTemplateModify",t);let o="/api/user_template/{template_id}".replace("{template_id}",encodeURIComponent(String(s))),r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"PUT",...a,...e},l={},u={};await b(l,"OAuth2PasswordBearer",[],n),l["Content-Type"]="application/json",x(r,u);let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},i.data=U(t,i,n),{url:A(r),options:i}},removeUserTemplate:async(s,t={})=>{y("removeUserTemplate","templateId",s);let e="/api/user_template/{template_id}".replace("{template_id}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"DELETE",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}}}},F=function(n){let s=Ae(n);return {async createUserTemplate(t,e){let o=await s.createUserTemplate(t,e),r=n?.serverIndex??0,a=g["UserTemplateApi.createUserTemplate"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async getUserTemplate(t,e){let o=await s.getUserTemplate(t,e),r=n?.serverIndex??0,a=g["UserTemplateApi.getUserTemplate"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)},async getUserTemplates(t,e,o){let r=await s.getUserTemplates(t,e,o),a=n?.serverIndex??0,i=g["UserTemplateApi.getUserTemplates"]?.[a]?.url;return (l,u)=>f(r,C,d,n)(l,i||u)},async modifyUserTemplate(t,e,o){let r=await s.modifyUserTemplate(t,e,o),a=n?.serverIndex??0,i=g["UserTemplateApi.modifyUserTemplate"]?.[a]?.url;return (l,u)=>f(r,C,d,n)(l,i||u)},async removeUserTemplate(t,e){let o=await s.removeUserTemplate(t,e),r=n?.serverIndex??0,a=g["UserTemplateApi.removeUserTemplate"]?.[r]?.url;return (i,l)=>f(o,C,d,n)(i,a||l)}}};var K=class extends w{createUserTemplate(s,t){return F(this.configuration).createUserTemplate(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}getUserTemplate(s,t){return F(this.configuration).getUserTemplate(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}getUserTemplates(s,t,e){return F(this.configuration).getUserTemplates(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}modifyUserTemplate(s,t,e){return F(this.configuration).modifyUserTemplate(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}removeUserTemplate(s,t){return F(this.configuration).removeUserTemplate(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}};var Y=class{constructor(s={}){this.apiKey=s.apiKey,this.username=s.username,this.password=s.password,this.accessToken=s.accessToken,this.basePath=s.basePath,this.serverIndex=s.serverIndex,this.baseOptions={...s.baseOptions,headers:{...s.baseOptions?.headers}},this.formDataCtor=s.formDataCtor;}isJsonMime(s){let t=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return s!==null&&(t.test(s)||s.toLowerCase()==="application/json-patch+json")}};var ae=(n,s)=>{let t=C.create({baseURL:n});return ye(t,{retries:s?.retries??3,retryDelay:e=>e*1e3}),t};var J=class extends Error{constructor(s){super(s),this.name="AuthenticationError";}},Z=class{constructor(s){this.authPromise=null;this.isAuthenticating=false;this.configuration=s;}async authenticate(s,t){return this.authPromise?this.authPromise:(this.isAuthenticating=true,this.authPromise=new Promise((e,o)=>{(async()=>{try{let i=await new N(this.configuration).adminToken(s,t);i?.access_token?(this.configuration.accessToken=i.access_token,e()):(this.configuration.accessToken=void 0,o(new J("Failed to retrieve access token")));}catch(a){console.error("Authentication failed",a),this.configuration.accessToken=void 0,o(new J("Authentication failed"));}finally{this.authPromise=null,this.isAuthenticating=false;}})();}),this.authPromise)}async waitForAuth(){await this.authPromise;}retryAuth(){return this.authenticate(this.configuration.username,this.configuration.password)}get accessToken(){return this.configuration.accessToken?.toString()||""}set accessToken(s){this.configuration.accessToken=s;}};var ne=(n,s,t)=>{n.interceptors.request.use(async e=>{await s.waitForAuth();let o=s.accessToken;return e.headers.authorization=o?`Bearer ${o}`:void 0,e},e=>Promise.reject(e)),n.interceptors.response.use(e=>e,async e=>{let o=e?.config;if(e?.response?.status===401&&!o?.sent){o.sent=true;try{await s.authenticate(t.username,t.password);let r=s.accessToken;if(r)return o.headers.authorization=`Bearer ${r}`,n(o)}catch(r){return Promise.reject(r)}}return Promise.reject(e)});};var ie=class{constructor(s){if(!s.username||!s.password)throw new Error("No credentials provided for authentication");this.configuration=new Y({basePath:s.baseUrl,username:s.username,password:s.password,accessToken:s.token}),this.client=ae(s.baseUrl,{retries:s.retries}),this.authService=new Z(this.configuration),this.admin=new N(this.configuration,s.baseUrl,this.client),this.core=new D(this.configuration,s.baseUrl,this.client),this.node=new $(this.configuration,s.baseUrl,this.client),this.user=new W(this.configuration,s.baseUrl,this.client),this.system=new z(this.configuration,s.baseUrl,this.client),this.default=new Q(this.configuration,s.baseUrl,this.client),this.subscription=new X(this.configuration,s.baseUrl,this.client),this.userTemplate=new K(this.configuration,s.baseUrl,this.client),ne(this.client,this.authService,s),!s.token&&s.authenticateOnInit!==false&&this.authService.authenticate(s.username,s.password);}async getAuthToken(){return await this.authService.waitForAuth(),this.authService.accessToken}authorize(s=false){return this.authService.isAuthenticating&&!s?this.authService.authPromise:this.authService.authenticate(this.configuration.username,this.configuration.password)}};
|
|
1
|
+
import C from'axios';import fe from'axios-retry';var d="http://localhost".replace(/\/+$/,"");var w=class{constructor(s,t=d,e=C){this.basePath=t;this.axios=e;s&&(this.configuration=s,this.basePath=s.basePath??t);}},G=class extends Error{constructor(t,e){super(e);this.field=t;this.name="RequiredError";}},g={};var h="https://example.com",f=function(n,s,t){if(t==null)throw new G(s,`Required parameter ${s} was null or undefined when calling ${n}.`)};var b=async function(n,s,t,e){if(e&&e.accessToken){let o=typeof e.accessToken=="function"?await e.accessToken(s,t):await e.accessToken;n.Authorization="Bearer "+o;}};function ee(n,s,t=""){s!=null&&(typeof s=="object"?Array.isArray(s)?s.forEach(e=>ee(n,e,t)):Object.keys(s).forEach(e=>ee(n,s[e],`${t}${t!==""?".":""}${e}`)):n.has(t)?n.append(t,s):n.set(t,s));}var x=function(n,...s){let t=new URLSearchParams(n.search);ee(t,s),n.search=t.toString();},U=function(n,s,t){let e=typeof n!="string";return (e&&t&&t.isJsonMime?t.isJsonMime(s.headers["Content-Type"]):e)?JSON.stringify(n!==void 0?n:{}):n||""},A=function(n){return n.pathname+n.search+n.hash},y=function(n,s,t,e){return (o=s,r=t)=>{let a={...n.options,url:(o.defaults.baseURL?"":e?.basePath??r)+n.url};return o.request(a)}};var pe=function(n){return {activateAllDisabledUsers:async(s,t={})=>{f("activateAllDisabledUsers","username",s);let e="/api/admin/{username}/users/activate".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},adminMiniAppToken:async(s,t={})=>{f("adminMiniAppToken","xTelegramAuthorization",s);let e="/api/admin/miniapp/token",o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};s!=null&&(i["x-telegram-authorization"]=String(s)),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},adminToken:async(s,t,e,o,r,a,i={})=>{f("adminToken","username",s),f("adminToken","password",t);let l="/api/admin/token",u=new URL(l,h),c;n&&(c=n.baseOptions);let R={method:"POST",...c,...i},P={},S={},O=new URLSearchParams;e!==void 0&&O.set("grant_type",e),s!==void 0&&O.set("username",s),t!==void 0&&O.set("password",t),o!==void 0&&O.set("scope",o),r!==void 0&&O.set("client_id",r),a!==void 0&&O.set("client_secret",a),P["Content-Type"]="application/x-www-form-urlencoded",x(u,S);let B=c&&c.headers?c.headers:{};return R.headers={...P,...B,...i.headers},R.data=O.toString(),{url:A(u),options:R}},createAdmin:async(s,t={})=>{f("createAdmin","adminCreate",s);let e="/api/admin",o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=U(s,a,n),{url:A(o),options:a}},disableAllActiveUsers:async(s,t={})=>{f("disableAllActiveUsers","username",s);let e="/api/admin/{username}/users/disable".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},getAdmins:async(s,t,e,o,r={})=>{let a="/api/admins",i=new URL(a,h),l;n&&(l=n.baseOptions);let u={method:"GET",...l,...r},c={},R={};await b(c,"OAuth2PasswordBearer",[],n),s!==void 0&&(R.username=s),t!==void 0&&(R.offset=t),e!==void 0&&(R.limit=e),o!==void 0&&(R.sort=o),x(i,R);let P=l&&l.headers?l.headers:{};return u.headers={...c,...P,...r.headers},{url:A(i),options:u}},getCurrentAdmin:async(s={})=>{let t="/api/admin",e=new URL(t,h),o;n&&(o=n.baseOptions);let r={method:"GET",...o,...s},a={},i={};await b(a,"OAuth2PasswordBearer",[],n),x(e,i);let l=o&&o.headers?o.headers:{};return r.headers={...a,...l,...s.headers},{url:A(e),options:r}},modifyAdmin:async(s,t,e={})=>{f("modifyAdmin","username",s),f("modifyAdmin","adminModify",t);let o="/api/admin/{username}".replace("{username}",encodeURIComponent(String(s))),r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"PUT",...a,...e},l={},u={};await b(l,"OAuth2PasswordBearer",[],n),l["Content-Type"]="application/json",x(r,u);let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},i.data=U(t,i,n),{url:A(r),options:i}},removeAdmin:async(s,t={})=>{f("removeAdmin","username",s);let e="/api/admin/{username}".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"DELETE",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},removeAllUsers:async(s,t={})=>{f("removeAllUsers","username",s);let e="/api/admin/{username}/users".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"DELETE",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},resetAdminUsage:async(s,t={})=>{f("resetAdminUsage","username",s);let e="/api/admin/{username}/reset".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}}}},v=function(n){let s=pe(n);return {async activateAllDisabledUsers(t,e){let o=await s.activateAllDisabledUsers(t,e),r=n?.serverIndex??0,a=g["AdminApi.activateAllDisabledUsers"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async adminMiniAppToken(t,e){let o=await s.adminMiniAppToken(t,e),r=n?.serverIndex??0,a=g["AdminApi.adminMiniAppToken"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async adminToken(t,e,o,r,a,i,l){let u=await s.adminToken(t,e,o,r,a,i,l),c=n?.serverIndex??0,R=g["AdminApi.adminToken"]?.[c]?.url;return (P,S)=>y(u,C,d,n)(P,R||S)},async createAdmin(t,e){let o=await s.createAdmin(t,e),r=n?.serverIndex??0,a=g["AdminApi.createAdmin"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async disableAllActiveUsers(t,e){let o=await s.disableAllActiveUsers(t,e),r=n?.serverIndex??0,a=g["AdminApi.disableAllActiveUsers"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async getAdmins(t,e,o,r,a){let i=await s.getAdmins(t,e,o,r,a),l=n?.serverIndex??0,u=g["AdminApi.getAdmins"]?.[l]?.url;return (c,R)=>y(i,C,d,n)(c,u||R)},async getCurrentAdmin(t){let e=await s.getCurrentAdmin(t),o=n?.serverIndex??0,r=g["AdminApi.getCurrentAdmin"]?.[o]?.url;return (a,i)=>y(e,C,d,n)(a,r||i)},async modifyAdmin(t,e,o){let r=await s.modifyAdmin(t,e,o),a=n?.serverIndex??0,i=g["AdminApi.modifyAdmin"]?.[a]?.url;return (l,u)=>y(r,C,d,n)(l,i||u)},async removeAdmin(t,e){let o=await s.removeAdmin(t,e),r=n?.serverIndex??0,a=g["AdminApi.removeAdmin"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async removeAllUsers(t,e){let o=await s.removeAllUsers(t,e),r=n?.serverIndex??0,a=g["AdminApi.removeAllUsers"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async resetAdminUsage(t,e){let o=await s.resetAdminUsage(t,e),r=n?.serverIndex??0,a=g["AdminApi.resetAdminUsage"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)}}};var N=class extends w{activateAllDisabledUsers(s,t){return v(this.configuration).activateAllDisabledUsers(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}adminMiniAppToken(s,t){return v(this.configuration).adminMiniAppToken(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}adminToken(s,t,e,o,r,a,i){return v(this.configuration).adminToken(s,t,e,o,r,a,i).then(l=>l(this.axios,this.basePath)).then(({data:l})=>l)}createAdmin(s,t){return v(this.configuration).createAdmin(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}disableAllActiveUsers(s,t){return v(this.configuration).disableAllActiveUsers(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}getAdmins(s,t,e,o,r){return v(this.configuration).getAdmins(s,t,e,o,r).then(a=>a(this.axios,this.basePath)).then(({data:a})=>a)}getCurrentAdmin(s){return v(this.configuration).getCurrentAdmin(s).then(t=>t(this.axios,this.basePath)).then(({data:t})=>t)}modifyAdmin(s,t,e){return v(this.configuration).modifyAdmin(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}removeAdmin(s,t){return v(this.configuration).removeAdmin(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}removeAllUsers(s,t){return v(this.configuration).removeAllUsers(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}resetAdminUsage(s,t){return v(this.configuration).resetAdminUsage(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}};var me=function(n){return {createCoreConfig:async(s,t={})=>{f("createCoreConfig","coreCreate",s);let e="/api/core",o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=U(s,a,n),{url:A(o),options:a}},deleteCoreConfig:async(s,t,e={})=>{f("deleteCoreConfig","coreId",s);let o="/api/core/{core_id}".replace("{core_id}",encodeURIComponent(String(s))),r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"DELETE",...a,...e},l={},u={};await b(l,"OAuth2PasswordBearer",[],n),t!==void 0&&(u.restart_nodes=t),x(r,u);let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},{url:A(r),options:i}},getAllCores:async(s,t,e={})=>{let o="/api/cores",r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"GET",...a,...e},l={},u={};await b(l,"OAuth2PasswordBearer",[],n),s!==void 0&&(u.offset=s),t!==void 0&&(u.limit=t),x(r,u);let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},{url:A(r),options:i}},getCoreConfig:async(s,t={})=>{f("getCoreConfig","coreId",s);let e="/api/core/{core_id}".replace("{core_id}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},modifyCoreConfig:async(s,t,e,o={})=>{f("modifyCoreConfig","coreId",s),f("modifyCoreConfig","restartNodes",t),f("modifyCoreConfig","coreCreate",e);let r="/api/core/{core_id}".replace("{core_id}",encodeURIComponent(String(s))),a=new URL(r,h),i;n&&(i=n.baseOptions);let l={method:"PUT",...i,...o},u={},c={};await b(u,"OAuth2PasswordBearer",[],n),t!==void 0&&(c.restart_nodes=t),u["Content-Type"]="application/json",x(a,c);let R=i&&i.headers?i.headers:{};return l.headers={...u,...R,...o.headers},l.data=U(e,l,n),{url:A(a),options:l}},restartCore:async(s,t={})=>{f("restartCore","coreId",s);let e="/api/core/{core_id}/restart".replace("{core_id}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}}}},L=function(n){let s=me(n);return {async createCoreConfig(t,e){let o=await s.createCoreConfig(t,e),r=n?.serverIndex??0,a=g["CoreApi.createCoreConfig"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async deleteCoreConfig(t,e,o){let r=await s.deleteCoreConfig(t,e,o),a=n?.serverIndex??0,i=g["CoreApi.deleteCoreConfig"]?.[a]?.url;return (l,u)=>y(r,C,d,n)(l,i||u)},async getAllCores(t,e,o){let r=await s.getAllCores(t,e,o),a=n?.serverIndex??0,i=g["CoreApi.getAllCores"]?.[a]?.url;return (l,u)=>y(r,C,d,n)(l,i||u)},async getCoreConfig(t,e){let o=await s.getCoreConfig(t,e),r=n?.serverIndex??0,a=g["CoreApi.getCoreConfig"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async modifyCoreConfig(t,e,o,r){let a=await s.modifyCoreConfig(t,e,o,r),i=n?.serverIndex??0,l=g["CoreApi.modifyCoreConfig"]?.[i]?.url;return (u,c)=>y(a,C,d,n)(u,l||c)},async restartCore(t,e){let o=await s.restartCore(t,e),r=n?.serverIndex??0,a=g["CoreApi.restartCore"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)}}};var D=class extends w{createCoreConfig(s,t){return L(this.configuration).createCoreConfig(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}deleteCoreConfig(s,t,e){return L(this.configuration).deleteCoreConfig(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}getAllCores(s,t,e){return L(this.configuration).getAllCores(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}getCoreConfig(s,t){return L(this.configuration).getCoreConfig(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}modifyCoreConfig(s,t,e,o){return L(this.configuration).modifyCoreConfig(s,t,e,o).then(r=>r(this.axios,this.basePath)).then(({data:r})=>r)}restartCore(s,t){return L(this.configuration).restartCore(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}};var ce=function(n){return {base:async(s={})=>{let e=new URL("/",h),o;n&&(o=n.baseOptions);let r={method:"GET",...o,...s},a={};x(e,{});let l=o&&o.headers?o.headers:{};return r.headers={...a,...l,...s.headers},{url:A(e),options:r}},getManifest:async(s,t={})=>{let e="/manifest.json",o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};s!==void 0&&(l.start_url=s),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}}}},se=function(n){let s=ce(n);return {async base(t){let e=await s.base(t),o=n?.serverIndex??0,r=g["DefaultApi.base"]?.[o]?.url;return (a,i)=>y(e,C,d,n)(a,r||i)},async getManifest(t,e){let o=await s.getManifest(t,e),r=n?.serverIndex??0,a=g["DefaultApi.getManifest"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)}}};var Q=class extends w{base(s){return se(this.configuration).base(s).then(t=>t(this.axios,this.basePath)).then(({data:t})=>t)}getManifest(s,t){return se(this.configuration).getManifest(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}};var de=function(n){return {clearUsageData:async(s,t,e,o={})=>{f("clearUsageData","table",s);let r="/api/nodes/clear_usage_data/{table}".replace("{table}",encodeURIComponent(String(s))),a=new URL(r,h),i;n&&(i=n.baseOptions);let l={method:"DELETE",...i,...o},u={},c={};await b(u,"OAuth2PasswordBearer",[],n),t!==void 0&&(c.start=t instanceof Date?t.toISOString():t),e!==void 0&&(c.end=e instanceof Date?e.toISOString():e),x(a,c);let R=i&&i.headers?i.headers:{};return l.headers={...u,...R,...o.headers},{url:A(a),options:l}},createNode:async(s,t={})=>{f("createNode","nodeCreate",s);let e="/api/node",o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=U(s,a,n),{url:A(o),options:a}},getNode:async(s,t={})=>{f("getNode","nodeId",s);let e="/api/node/{node_id}".replace("{node_id}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},getNodeSettings:async(s={})=>{let t="/api/node/settings",e=new URL(t,h),o;n&&(o=n.baseOptions);let r={method:"GET",...o,...s},a={},i={};await b(a,"OAuth2PasswordBearer",[],n),x(e,i);let l=o&&o.headers?o.headers:{};return r.headers={...a,...l,...s.headers},{url:A(e),options:r}},getNodeStatsPeriodic:async(s,t,e,o,r={})=>{f("getNodeStatsPeriodic","nodeId",s);let a="/api/node/{node_id}/stats".replace("{node_id}",encodeURIComponent(String(s))),i=new URL(a,h),l;n&&(l=n.baseOptions);let u={method:"GET",...l,...r},c={},R={};await b(c,"OAuth2PasswordBearer",[],n),t!==void 0&&(R.start=t instanceof Date?t.toISOString():t),e!==void 0&&(R.end=e instanceof Date?e.toISOString():e),o!==void 0&&(R.period=o),x(i,R);let P=l&&l.headers?l.headers:{};return u.headers={...c,...P,...r.headers},{url:A(i),options:u}},getNodes:async(s,t,e,o,r,a,i,l={})=>{let u="/api/nodes",c=new URL(u,h),R;n&&(R=n.baseOptions);let P={method:"GET",...R,...l},S={},O={};await b(S,"OAuth2PasswordBearer",[],n),s!==void 0&&(O.core_id=s),t!==void 0&&(O.offset=t),e!==void 0&&(O.limit=e),o&&(O.status=o),r!==void 0&&(O.enabled=r),a&&(O.ids=a),i!==void 0&&(O.search=i),x(c,O);let B=R&&R.headers?R.headers:{};return P.headers={...S,...B,...l.headers},{url:A(c),options:P}},getUsage:async(s,t,e,o,r,a={})=>{let i="/api/node/usage",l=new URL(i,h),u;n&&(u=n.baseOptions);let c={method:"GET",...u,...a},R={},P={};await b(R,"OAuth2PasswordBearer",[],n),s!==void 0&&(P.start=s instanceof Date?s.toISOString():s),t!==void 0&&(P.end=t instanceof Date?t.toISOString():t),e!==void 0&&(P.period=e),o!==void 0&&(P.node_id=o),r!==void 0&&(P.group_by_node=r),x(l,P);let S=u&&u.headers?u.headers:{};return c.headers={...R,...S,...a.headers},{url:A(l),options:c}},modifyNode:async(s,t,e={})=>{f("modifyNode","nodeId",s),f("modifyNode","nodeModify",t);let o="/api/node/{node_id}".replace("{node_id}",encodeURIComponent(String(s))),r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"PUT",...a,...e},l={},u={};await b(l,"OAuth2PasswordBearer",[],n),l["Content-Type"]="application/json",x(r,u);let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},i.data=U(t,i,n),{url:A(r),options:i}},nodeLogs:async(s,t={})=>{f("nodeLogs","nodeId",s);let e="/api/node/{node_id}/logs".replace("{node_id}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},realtimeNodeStats:async(s,t={})=>{f("realtimeNodeStats","nodeId",s);let e="/api/node/{node_id}/realtime_stats".replace("{node_id}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},realtimeNodesStats:async(s={})=>{let t="/api/nodes/realtime_stats",e=new URL(t,h),o;n&&(o=n.baseOptions);let r={method:"GET",...o,...s},a={},i={};await b(a,"OAuth2PasswordBearer",[],n),x(e,i);let l=o&&o.headers?o.headers:{};return r.headers={...a,...l,...s.headers},{url:A(e),options:r}},reconnectAllNode:async(s,t={})=>{let e="/api/nodes/reconnect",o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),s!==void 0&&(l.core_id=s),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},reconnectNode:async(s,t={})=>{f("reconnectNode","nodeId",s);let e="/api/node/{node_id}/reconnect".replace("{node_id}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},removeNode:async(s,t={})=>{f("removeNode","nodeId",s);let e="/api/node/{node_id}".replace("{node_id}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"DELETE",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},resetNodeUsage:async(s,t={})=>{f("resetNodeUsage","nodeId",s);let e="/api/node/{node_id}/reset".replace("{node_id}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},syncNode:async(s,t,e={})=>{f("syncNode","nodeId",s);let o="/api/node/{node_id}/sync".replace("{node_id}",encodeURIComponent(String(s))),r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"PUT",...a,...e},l={},u={};await b(l,"OAuth2PasswordBearer",[],n),t!==void 0&&(u.flush_users=t),x(r,u);let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},{url:A(r),options:i}},userOnlineIpList:async(s,t,e={})=>{f("userOnlineIpList","nodeId",s),f("userOnlineIpList","username",t);let o="/api/node/{node_id}/online_stats/{username}/ip".replace("{node_id}",encodeURIComponent(String(s))).replace("{username}",encodeURIComponent(String(t))),r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"GET",...a,...e},l={},u={};await b(l,"OAuth2PasswordBearer",[],n),x(r,u);let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},{url:A(r),options:i}},userOnlineIpListAllNodes:async(s,t={})=>{f("userOnlineIpListAllNodes","username",s);let e="/api/node/online_stats/{username}/ip".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},userOnlineStats:async(s,t,e={})=>{f("userOnlineStats","nodeId",s),f("userOnlineStats","username",t);let o="/api/node/{node_id}/online_stats/{username}".replace("{node_id}",encodeURIComponent(String(s))).replace("{username}",encodeURIComponent(String(t))),r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"GET",...a,...e},l={},u={};await b(l,"OAuth2PasswordBearer",[],n),x(r,u);let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},{url:A(r),options:i}}}},q=function(n){let s=de(n);return {async clearUsageData(t,e,o,r){let a=await s.clearUsageData(t,e,o,r),i=n?.serverIndex??0,l=g["NodeApi.clearUsageData"]?.[i]?.url;return (u,c)=>y(a,C,d,n)(u,l||c)},async createNode(t,e){let o=await s.createNode(t,e),r=n?.serverIndex??0,a=g["NodeApi.createNode"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async getNode(t,e){let o=await s.getNode(t,e),r=n?.serverIndex??0,a=g["NodeApi.getNode"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async getNodeSettings(t){let e=await s.getNodeSettings(t),o=n?.serverIndex??0,r=g["NodeApi.getNodeSettings"]?.[o]?.url;return (a,i)=>y(e,C,d,n)(a,r||i)},async getNodeStatsPeriodic(t,e,o,r,a){let i=await s.getNodeStatsPeriodic(t,e,o,r,a),l=n?.serverIndex??0,u=g["NodeApi.getNodeStatsPeriodic"]?.[l]?.url;return (c,R)=>y(i,C,d,n)(c,u||R)},async getNodes(t,e,o,r,a,i,l,u){let c=await s.getNodes(t,e,o,r,a,i,l,u),R=n?.serverIndex??0,P=g["NodeApi.getNodes"]?.[R]?.url;return (S,O)=>y(c,C,d,n)(S,P||O)},async getUsage(t,e,o,r,a,i){let l=await s.getUsage(t,e,o,r,a,i),u=n?.serverIndex??0,c=g["NodeApi.getUsage"]?.[u]?.url;return (R,P)=>y(l,C,d,n)(R,c||P)},async modifyNode(t,e,o){let r=await s.modifyNode(t,e,o),a=n?.serverIndex??0,i=g["NodeApi.modifyNode"]?.[a]?.url;return (l,u)=>y(r,C,d,n)(l,i||u)},async nodeLogs(t,e){let o=await s.nodeLogs(t,e),r=n?.serverIndex??0,a=g["NodeApi.nodeLogs"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async realtimeNodeStats(t,e){let o=await s.realtimeNodeStats(t,e),r=n?.serverIndex??0,a=g["NodeApi.realtimeNodeStats"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async realtimeNodesStats(t){let e=await s.realtimeNodesStats(t),o=n?.serverIndex??0,r=g["NodeApi.realtimeNodesStats"]?.[o]?.url;return (a,i)=>y(e,C,d,n)(a,r||i)},async reconnectAllNode(t,e){let o=await s.reconnectAllNode(t,e),r=n?.serverIndex??0,a=g["NodeApi.reconnectAllNode"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async reconnectNode(t,e){let o=await s.reconnectNode(t,e),r=n?.serverIndex??0,a=g["NodeApi.reconnectNode"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async removeNode(t,e){let o=await s.removeNode(t,e),r=n?.serverIndex??0,a=g["NodeApi.removeNode"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async resetNodeUsage(t,e){let o=await s.resetNodeUsage(t,e),r=n?.serverIndex??0,a=g["NodeApi.resetNodeUsage"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async syncNode(t,e,o){let r=await s.syncNode(t,e,o),a=n?.serverIndex??0,i=g["NodeApi.syncNode"]?.[a]?.url;return (l,u)=>y(r,C,d,n)(l,i||u)},async userOnlineIpList(t,e,o){let r=await s.userOnlineIpList(t,e,o),a=n?.serverIndex??0,i=g["NodeApi.userOnlineIpList"]?.[a]?.url;return (l,u)=>y(r,C,d,n)(l,i||u)},async userOnlineIpListAllNodes(t,e){let o=await s.userOnlineIpListAllNodes(t,e),r=n?.serverIndex??0,a=g["NodeApi.userOnlineIpListAllNodes"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async userOnlineStats(t,e,o){let r=await s.userOnlineStats(t,e,o),a=n?.serverIndex??0,i=g["NodeApi.userOnlineStats"]?.[a]?.url;return (l,u)=>y(r,C,d,n)(l,i||u)}}};var $=class extends w{clearUsageData(s,t,e,o){return q(this.configuration).clearUsageData(s,t,e,o).then(r=>r(this.axios,this.basePath)).then(({data:r})=>r)}createNode(s,t){return q(this.configuration).createNode(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}getNode(s,t){return q(this.configuration).getNode(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}getNodeSettings(s){return q(this.configuration).getNodeSettings(s).then(t=>t(this.axios,this.basePath)).then(({data:t})=>t)}getNodeStatsPeriodic(s,t,e,o,r){return q(this.configuration).getNodeStatsPeriodic(s,t,e,o,r).then(a=>a(this.axios,this.basePath)).then(({data:a})=>a)}getNodes(s,t,e,o,r,a,i,l){return q(this.configuration).getNodes(s,t,e,o,r,a,i,l).then(u=>u(this.axios,this.basePath)).then(({data:u})=>u)}getUsage(s,t,e,o,r,a){return q(this.configuration).getUsage(s,t,e,o,r,a).then(i=>i(this.axios,this.basePath)).then(({data:i})=>i)}modifyNode(s,t,e){return q(this.configuration).modifyNode(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}nodeLogs(s,t){return q(this.configuration).nodeLogs(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}realtimeNodeStats(s,t){return q(this.configuration).realtimeNodeStats(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}realtimeNodesStats(s){return q(this.configuration).realtimeNodesStats(s).then(t=>t(this.axios,this.basePath)).then(({data:t})=>t)}reconnectAllNode(s,t){return q(this.configuration).reconnectAllNode(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}reconnectNode(s,t){return q(this.configuration).reconnectNode(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}removeNode(s,t){return q(this.configuration).removeNode(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}resetNodeUsage(s,t){return q(this.configuration).resetNodeUsage(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}syncNode(s,t,e){return q(this.configuration).syncNode(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}userOnlineIpList(s,t,e){return q(this.configuration).userOnlineIpList(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}userOnlineIpListAllNodes(s,t){return q(this.configuration).userOnlineIpListAllNodes(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}userOnlineStats(s,t,e){return q(this.configuration).userOnlineStats(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}};var ge=function(n){return {getSubUserUsage:async(s,t,e,o,r={})=>{f("getSubUserUsage","token",s);let a="/sub/{token}/usage".replace("{token}",encodeURIComponent(String(s))),i=new URL(a,h),l;n&&(l=n.baseOptions);let u={method:"GET",...l,...r},c={},R={};t!==void 0&&(R.start=t instanceof Date?t.toISOString():t),e!==void 0&&(R.end=e instanceof Date?e.toISOString():e),o!==void 0&&(R.period=o),x(i,R);let P=l&&l.headers?l.headers:{};return u.headers={...c,...P,...r.headers},{url:A(i),options:u}},userSubscription:async(s,t,e={})=>{f("userSubscription","token",s);let o="/sub/{token}/".replace("{token}",encodeURIComponent(String(s))),r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"GET",...a,...e},l={},u={};t!=null&&(l["user-agent"]=String(t)),x(r,u);let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},{url:A(r),options:i}},userSubscriptionApps:async(s,t={})=>{f("userSubscriptionApps","token",s);let e="/sub/{token}/apps".replace("{token}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={};x(o,{});let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},userSubscriptionInfo:async(s,t={})=>{f("userSubscriptionInfo","token",s);let e="/sub/{token}/info".replace("{token}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={};x(o,{});let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},userSubscriptionWithClientType:async(s,t,e={})=>{f("userSubscriptionWithClientType","token",s),f("userSubscriptionWithClientType","clientType",t);let o="/sub/{token}/{client_type}".replace("{token}",encodeURIComponent(String(s))).replace("{client_type}",encodeURIComponent(String(t))),r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"GET",...a,...e},l={};x(r,{});let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},{url:A(r),options:i}}}},M=function(n){let s=ge(n);return {async getSubUserUsage(t,e,o,r,a){let i=await s.getSubUserUsage(t,e,o,r,a),l=n?.serverIndex??0,u=g["SubscriptionApi.getSubUserUsage"]?.[l]?.url;return (c,R)=>y(i,C,d,n)(c,u||R)},async userSubscription(t,e,o){let r=await s.userSubscription(t,e,o),a=n?.serverIndex??0,i=g["SubscriptionApi.userSubscription"]?.[a]?.url;return (l,u)=>y(r,C,d,n)(l,i||u)},async userSubscriptionApps(t,e){let o=await s.userSubscriptionApps(t,e),r=n?.serverIndex??0,a=g["SubscriptionApi.userSubscriptionApps"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async userSubscriptionInfo(t,e){let o=await s.userSubscriptionInfo(t,e),r=n?.serverIndex??0,a=g["SubscriptionApi.userSubscriptionInfo"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async userSubscriptionWithClientType(t,e,o){let r=await s.userSubscriptionWithClientType(t,e,o),a=n?.serverIndex??0,i=g["SubscriptionApi.userSubscriptionWithClientType"]?.[a]?.url;return (l,u)=>y(r,C,d,n)(l,i||u)}}};var X=class extends w{getSubUserUsage(s,t,e,o,r){return M(this.configuration).getSubUserUsage(s,t,e,o,r).then(a=>a(this.axios,this.basePath)).then(({data:a})=>a)}userSubscription(s,t,e){return M(this.configuration).userSubscription(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}userSubscriptionApps(s,t){return M(this.configuration).userSubscriptionApps(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}userSubscriptionInfo(s,t){return M(this.configuration).userSubscriptionInfo(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}userSubscriptionWithClientType(s,t,e){return M(this.configuration).userSubscriptionWithClientType(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}};var he=function(n){return {getInbounds:async(s={})=>{let t="/api/inbounds",e=new URL(t,h),o;n&&(o=n.baseOptions);let r={method:"GET",...o,...s},a={},i={};await b(a,"OAuth2PasswordBearer",[],n),x(e,i);let l=o&&o.headers?o.headers:{};return r.headers={...a,...l,...s.headers},{url:A(e),options:r}},getSystemStats:async(s,t={})=>{let e="/api/system",o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),s!==void 0&&(l.admin_username=s),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}}}},oe=function(n){let s=he(n);return {async getInbounds(t){let e=await s.getInbounds(t),o=n?.serverIndex??0,r=g["SystemApi.getInbounds"]?.[o]?.url;return (a,i)=>y(e,C,d,n)(a,r||i)},async getSystemStats(t,e){let o=await s.getSystemStats(t,e),r=n?.serverIndex??0,a=g["SystemApi.getSystemStats"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)}}};var z=class extends w{getInbounds(s){return oe(this.configuration).getInbounds(s).then(t=>t(this.axios,this.basePath)).then(({data:t})=>t)}getSystemStats(s,t){return oe(this.configuration).getSystemStats(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}};var xe=function(n){return {activeNextPlan:async(s,t={})=>{f("activeNextPlan","username",s);let e="/api/user/{username}/active_next".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},bulkModifyUsersDatalimit:async(s,t={})=>{f("bulkModifyUsersDatalimit","bulkUser",s);let e="/api/users/bulk/data_limit",o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=U(s,a,n),{url:A(o),options:a}},bulkModifyUsersExpire:async(s,t={})=>{f("bulkModifyUsersExpire","bulkUser",s);let e="/api/users/bulk/expire",o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=U(s,a,n),{url:A(o),options:a}},bulkModifyUsersProxySettings:async(s,t={})=>{f("bulkModifyUsersProxySettings","bulkUsersProxy",s);let e="/api/users/bulk/proxy_settings",o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=U(s,a,n),{url:A(o),options:a}},createUser:async(s,t={})=>{f("createUser","userCreate",s);let e="/api/user",o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=U(s,a,n),{url:A(o),options:a}},createUserFromTemplate:async(s,t={})=>{f("createUserFromTemplate","createUserFromTemplate",s);let e="/api/user/from_template",o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=U(s,a,n),{url:A(o),options:a}},deleteExpiredUsers:async(s,t,e,o={})=>{let r="/api/users/expired",a=new URL(r,h),i;n&&(i=n.baseOptions);let l={method:"DELETE",...i,...o},u={},c={};await b(u,"OAuth2PasswordBearer",[],n),s!==void 0&&(c.admin_username=s),t!==void 0&&(c.expired_after=t instanceof Date?t.toISOString():t),e!==void 0&&(c.expired_before=e instanceof Date?e.toISOString():e),x(a,c);let R=i&&i.headers?i.headers:{};return l.headers={...u,...R,...o.headers},{url:A(a),options:l}},getExpiredUsers:async(s,t,e,o={})=>{let r="/api/users/expired",a=new URL(r,h),i;n&&(i=n.baseOptions);let l={method:"GET",...i,...o},u={},c={};await b(u,"OAuth2PasswordBearer",[],n),s!==void 0&&(c.admin_username=s),t!==void 0&&(c.expired_after=t instanceof Date?t.toISOString():t),e!==void 0&&(c.expired_before=e instanceof Date?e.toISOString():e),x(a,c);let R=i&&i.headers?i.headers:{};return l.headers={...u,...R,...o.headers},{url:A(a),options:l}},getUser:async(s,t={})=>{f("getUser","username",s);let e="/api/user/{username}".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},getUserSubUpdateList:async(s,t,e,o={})=>{f("getUserSubUpdateList","username",s);let r="/api/user/{username}/sub_update".replace("{username}",encodeURIComponent(String(s))),a=new URL(r,h),i;n&&(i=n.baseOptions);let l={method:"GET",...i,...o},u={},c={};await b(u,"OAuth2PasswordBearer",[],n),t!==void 0&&(c.offset=t),e!==void 0&&(c.limit=e),x(a,c);let R=i&&i.headers?i.headers:{};return l.headers={...u,...R,...o.headers},{url:A(a),options:l}},getUserUsage:async(s,t,e,o,r,a,i={})=>{f("getUserUsage","username",s),f("getUserUsage","period",t);let l="/api/user/{username}/usage".replace("{username}",encodeURIComponent(String(s))),u=new URL(l,h),c;n&&(c=n.baseOptions);let R={method:"GET",...c,...i},P={},S={};await b(P,"OAuth2PasswordBearer",[],n),t!==void 0&&(S.period=t),e!==void 0&&(S.node_id=e),o!==void 0&&(S.group_by_node=o),r!==void 0&&(S.start=r instanceof Date?r.toISOString():r),a!==void 0&&(S.end=a instanceof Date?a.toISOString():a),x(u,S);let O=c&&c.headers?c.headers:{};return R.headers={...P,...O,...i.headers},{url:A(u),options:R}},getUsers:async(s,t,e,o,r,a,i,l,u,c,R={})=>{let P="/api/users",S=new URL(P,h),O;n&&(O=n.baseOptions);let B={method:"GET",...O,...R},j={},T={};await b(j,"OAuth2PasswordBearer",[],n),s!==void 0&&(T.offset=s),t!==void 0&&(T.limit=t),e&&(T.username=e),o&&(T.admin=o),r&&(T.group=r),a!==void 0&&(T.search=a),i!==void 0&&(T.status=i),l!==void 0&&(T.sort=l),u!==void 0&&(T.proxy_id=u),c!==void 0&&(T.load_sub=c),x(S,T);let le=O&&O.headers?O.headers:{};return B.headers={...j,...le,...R.headers},{url:A(S),options:B}},getUsersSubUpdateChart:async(s,t,e={})=>{let o="/api/users/sub_update/chart",r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"GET",...a,...e},l={},u={};await b(l,"OAuth2PasswordBearer",[],n),s!==void 0&&(u.username=s),t!==void 0&&(u.admin_id=t),x(r,u);let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},{url:A(r),options:i}},getUsersUsage:async(s,t,e,o,r,a,i={})=>{f("getUsersUsage","period",s);let l="/api/users/usage",u=new URL(l,h),c;n&&(c=n.baseOptions);let R={method:"GET",...c,...i},P={},S={};await b(P,"OAuth2PasswordBearer",[],n),s!==void 0&&(S.period=s),t!==void 0&&(S.node_id=t),e!==void 0&&(S.group_by_node=e),o!==void 0&&(S.start=o instanceof Date?o.toISOString():o),r!==void 0&&(S.end=r instanceof Date?r.toISOString():r),a&&(S.admin=a),x(u,S);let O=c&&c.headers?c.headers:{};return R.headers={...P,...O,...i.headers},{url:A(u),options:R}},modifyUser:async(s,t,e={})=>{f("modifyUser","username",s),f("modifyUser","userModify",t);let o="/api/user/{username}".replace("{username}",encodeURIComponent(String(s))),r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"PUT",...a,...e},l={},u={};await b(l,"OAuth2PasswordBearer",[],n),l["Content-Type"]="application/json",x(r,u);let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},i.data=U(t,i,n),{url:A(r),options:i}},modifyUserWithTemplate:async(s,t,e={})=>{f("modifyUserWithTemplate","username",s),f("modifyUserWithTemplate","modifyUserByTemplate",t);let o="/api/user/from_template/{username}".replace("{username}",encodeURIComponent(String(s))),r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"PUT",...a,...e},l={},u={};await b(l,"OAuth2PasswordBearer",[],n),l["Content-Type"]="application/json",x(r,u);let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},i.data=U(t,i,n),{url:A(r),options:i}},removeUser:async(s,t={})=>{f("removeUser","username",s);let e="/api/user/{username}".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"DELETE",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},resetUserDataUsage:async(s,t={})=>{f("resetUserDataUsage","username",s);let e="/api/user/{username}/reset".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},resetUsersDataUsage:async(s={})=>{let t="/api/users/reset",e=new URL(t,h),o;n&&(o=n.baseOptions);let r={method:"POST",...o,...s},a={},i={};await b(a,"OAuth2PasswordBearer",[],n),x(e,i);let l=o&&o.headers?o.headers:{};return r.headers={...a,...l,...s.headers},{url:A(e),options:r}},revokeUserSubscription:async(s,t={})=>{f("revokeUserSubscription","username",s);let e="/api/user/{username}/revoke_sub".replace("{username}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},setOwner:async(s,t,e={})=>{f("setOwner","username",s),f("setOwner","adminUsername",t);let o="/api/user/{username}/set_owner".replace("{username}",encodeURIComponent(String(s))),r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"PUT",...a,...e},l={},u={};await b(l,"OAuth2PasswordBearer",[],n),t!==void 0&&(u.admin_username=t),x(r,u);let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},{url:A(r),options:i}}}},V=function(n){let s=xe(n);return {async activeNextPlan(t,e){let o=await s.activeNextPlan(t,e),r=n?.serverIndex??0,a=g["UserApi.activeNextPlan"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async bulkModifyUsersDatalimit(t,e){let o=await s.bulkModifyUsersDatalimit(t,e),r=n?.serverIndex??0,a=g["UserApi.bulkModifyUsersDatalimit"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async bulkModifyUsersExpire(t,e){let o=await s.bulkModifyUsersExpire(t,e),r=n?.serverIndex??0,a=g["UserApi.bulkModifyUsersExpire"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async bulkModifyUsersProxySettings(t,e){let o=await s.bulkModifyUsersProxySettings(t,e),r=n?.serverIndex??0,a=g["UserApi.bulkModifyUsersProxySettings"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async createUser(t,e){let o=await s.createUser(t,e),r=n?.serverIndex??0,a=g["UserApi.createUser"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async createUserFromTemplate(t,e){let o=await s.createUserFromTemplate(t,e),r=n?.serverIndex??0,a=g["UserApi.createUserFromTemplate"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async deleteExpiredUsers(t,e,o,r){let a=await s.deleteExpiredUsers(t,e,o,r),i=n?.serverIndex??0,l=g["UserApi.deleteExpiredUsers"]?.[i]?.url;return (u,c)=>y(a,C,d,n)(u,l||c)},async getExpiredUsers(t,e,o,r){let a=await s.getExpiredUsers(t,e,o,r),i=n?.serverIndex??0,l=g["UserApi.getExpiredUsers"]?.[i]?.url;return (u,c)=>y(a,C,d,n)(u,l||c)},async getUser(t,e){let o=await s.getUser(t,e),r=n?.serverIndex??0,a=g["UserApi.getUser"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async getUserSubUpdateList(t,e,o,r){let a=await s.getUserSubUpdateList(t,e,o,r),i=n?.serverIndex??0,l=g["UserApi.getUserSubUpdateList"]?.[i]?.url;return (u,c)=>y(a,C,d,n)(u,l||c)},async getUserUsage(t,e,o,r,a,i,l){let u=await s.getUserUsage(t,e,o,r,a,i,l),c=n?.serverIndex??0,R=g["UserApi.getUserUsage"]?.[c]?.url;return (P,S)=>y(u,C,d,n)(P,R||S)},async getUsers(t,e,o,r,a,i,l,u,c,R,P){let S=await s.getUsers(t,e,o,r,a,i,l,u,c,R,P),O=n?.serverIndex??0,B=g["UserApi.getUsers"]?.[O]?.url;return (j,T)=>y(S,C,d,n)(j,B||T)},async getUsersSubUpdateChart(t,e,o){let r=await s.getUsersSubUpdateChart(t,e,o),a=n?.serverIndex??0,i=g["UserApi.getUsersSubUpdateChart"]?.[a]?.url;return (l,u)=>y(r,C,d,n)(l,i||u)},async getUsersUsage(t,e,o,r,a,i,l){let u=await s.getUsersUsage(t,e,o,r,a,i,l),c=n?.serverIndex??0,R=g["UserApi.getUsersUsage"]?.[c]?.url;return (P,S)=>y(u,C,d,n)(P,R||S)},async modifyUser(t,e,o){let r=await s.modifyUser(t,e,o),a=n?.serverIndex??0,i=g["UserApi.modifyUser"]?.[a]?.url;return (l,u)=>y(r,C,d,n)(l,i||u)},async modifyUserWithTemplate(t,e,o){let r=await s.modifyUserWithTemplate(t,e,o),a=n?.serverIndex??0,i=g["UserApi.modifyUserWithTemplate"]?.[a]?.url;return (l,u)=>y(r,C,d,n)(l,i||u)},async removeUser(t,e){let o=await s.removeUser(t,e),r=n?.serverIndex??0,a=g["UserApi.removeUser"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async resetUserDataUsage(t,e){let o=await s.resetUserDataUsage(t,e),r=n?.serverIndex??0,a=g["UserApi.resetUserDataUsage"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async resetUsersDataUsage(t){let e=await s.resetUsersDataUsage(t),o=n?.serverIndex??0,r=g["UserApi.resetUsersDataUsage"]?.[o]?.url;return (a,i)=>y(e,C,d,n)(a,r||i)},async revokeUserSubscription(t,e){let o=await s.revokeUserSubscription(t,e),r=n?.serverIndex??0,a=g["UserApi.revokeUserSubscription"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async setOwner(t,e,o){let r=await s.setOwner(t,e,o),a=n?.serverIndex??0,i=g["UserApi.setOwner"]?.[a]?.url;return (l,u)=>y(r,C,d,n)(l,i||u)}}};var W=class extends w{activeNextPlan(s,t){return V(this.configuration).activeNextPlan(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}bulkModifyUsersDatalimit(s,t){return V(this.configuration).bulkModifyUsersDatalimit(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}bulkModifyUsersExpire(s,t){return V(this.configuration).bulkModifyUsersExpire(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}bulkModifyUsersProxySettings(s,t){return V(this.configuration).bulkModifyUsersProxySettings(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}createUser(s,t){return V(this.configuration).createUser(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}createUserFromTemplate(s,t){return V(this.configuration).createUserFromTemplate(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}deleteExpiredUsers(s,t,e,o){return V(this.configuration).deleteExpiredUsers(s,t,e,o).then(r=>r(this.axios,this.basePath)).then(({data:r})=>r)}getExpiredUsers(s,t,e,o){return V(this.configuration).getExpiredUsers(s,t,e,o).then(r=>r(this.axios,this.basePath)).then(({data:r})=>r)}getUser(s,t){return V(this.configuration).getUser(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}getUserSubUpdateList(s,t,e,o){return V(this.configuration).getUserSubUpdateList(s,t,e,o).then(r=>r(this.axios,this.basePath)).then(({data:r})=>r)}getUserUsage(s,t,e,o,r,a,i){return V(this.configuration).getUserUsage(s,t,e,o,r,a,i).then(l=>l(this.axios,this.basePath)).then(({data:l})=>l)}getUsers(s,t,e,o,r,a,i,l,u,c,R){return V(this.configuration).getUsers(s,t,e,o,r,a,i,l,u,c,R).then(P=>P(this.axios,this.basePath)).then(({data:P})=>P)}getUsersSubUpdateChart(s,t,e){return V(this.configuration).getUsersSubUpdateChart(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}getUsersUsage(s,t,e,o,r,a,i){return V(this.configuration).getUsersUsage(s,t,e,o,r,a,i).then(l=>l(this.axios,this.basePath)).then(({data:l})=>l)}modifyUser(s,t,e){return V(this.configuration).modifyUser(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}modifyUserWithTemplate(s,t,e){return V(this.configuration).modifyUserWithTemplate(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}removeUser(s,t){return V(this.configuration).removeUser(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}resetUserDataUsage(s,t){return V(this.configuration).resetUserDataUsage(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}resetUsersDataUsage(s){return V(this.configuration).resetUsersDataUsage(s).then(t=>t(this.axios,this.basePath)).then(({data:t})=>t)}revokeUserSubscription(s,t){return V(this.configuration).revokeUserSubscription(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}setOwner(s,t,e){return V(this.configuration).setOwner(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}};var Ae=function(n){return {createUserTemplate:async(s,t={})=>{f("createUserTemplate","userTemplateCreate",s);let e="/api/user_template",o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"POST",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),i["Content-Type"]="application/json",x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},a.data=U(s,a,n),{url:A(o),options:a}},getUserTemplate:async(s,t={})=>{f("getUserTemplate","templateId",s);let e="/api/user_template/{template_id}".replace("{template_id}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"GET",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}},getUserTemplates:async(s,t,e={})=>{let o="/api/user_templates",r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"GET",...a,...e},l={},u={};await b(l,"OAuth2PasswordBearer",[],n),s!==void 0&&(u.offset=s),t!==void 0&&(u.limit=t),x(r,u);let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},{url:A(r),options:i}},modifyUserTemplate:async(s,t,e={})=>{f("modifyUserTemplate","templateId",s),f("modifyUserTemplate","userTemplateModify",t);let o="/api/user_template/{template_id}".replace("{template_id}",encodeURIComponent(String(s))),r=new URL(o,h),a;n&&(a=n.baseOptions);let i={method:"PUT",...a,...e},l={},u={};await b(l,"OAuth2PasswordBearer",[],n),l["Content-Type"]="application/json",x(r,u);let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...e.headers},i.data=U(t,i,n),{url:A(r),options:i}},removeUserTemplate:async(s,t={})=>{f("removeUserTemplate","templateId",s);let e="/api/user_template/{template_id}".replace("{template_id}",encodeURIComponent(String(s))),o=new URL(e,h),r;n&&(r=n.baseOptions);let a={method:"DELETE",...r,...t},i={},l={};await b(i,"OAuth2PasswordBearer",[],n),x(o,l);let u=r&&r.headers?r.headers:{};return a.headers={...i,...u,...t.headers},{url:A(o),options:a}}}},F=function(n){let s=Ae(n);return {async createUserTemplate(t,e){let o=await s.createUserTemplate(t,e),r=n?.serverIndex??0,a=g["UserTemplateApi.createUserTemplate"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async getUserTemplate(t,e){let o=await s.getUserTemplate(t,e),r=n?.serverIndex??0,a=g["UserTemplateApi.getUserTemplate"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)},async getUserTemplates(t,e,o){let r=await s.getUserTemplates(t,e,o),a=n?.serverIndex??0,i=g["UserTemplateApi.getUserTemplates"]?.[a]?.url;return (l,u)=>y(r,C,d,n)(l,i||u)},async modifyUserTemplate(t,e,o){let r=await s.modifyUserTemplate(t,e,o),a=n?.serverIndex??0,i=g["UserTemplateApi.modifyUserTemplate"]?.[a]?.url;return (l,u)=>y(r,C,d,n)(l,i||u)},async removeUserTemplate(t,e){let o=await s.removeUserTemplate(t,e),r=n?.serverIndex??0,a=g["UserTemplateApi.removeUserTemplate"]?.[r]?.url;return (i,l)=>y(o,C,d,n)(i,a||l)}}};var K=class extends w{createUserTemplate(s,t){return F(this.configuration).createUserTemplate(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}getUserTemplate(s,t){return F(this.configuration).getUserTemplate(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}getUserTemplates(s,t,e){return F(this.configuration).getUserTemplates(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}modifyUserTemplate(s,t,e){return F(this.configuration).modifyUserTemplate(s,t,e).then(o=>o(this.axios,this.basePath)).then(({data:o})=>o)}removeUserTemplate(s,t){return F(this.configuration).removeUserTemplate(s,t).then(e=>e(this.axios,this.basePath)).then(({data:e})=>e)}};var Y=class{constructor(s={}){this.apiKey=s.apiKey,this.username=s.username,this.password=s.password,this.accessToken=s.accessToken,this.basePath=s.basePath,this.serverIndex=s.serverIndex,this.baseOptions={...s.baseOptions,headers:{...s.baseOptions?.headers}},this.formDataCtor=s.formDataCtor;}isJsonMime(s){let t=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return s!==null&&(t.test(s)||s.toLowerCase()==="application/json-patch+json")}};var ae=(n,s)=>{let t=C.create({baseURL:n});return fe(t,{retries:s?.retries??3,retryDelay:e=>e*1e3}),t};var J=class extends Error{constructor(s){super(s),this.name="AuthenticationError";}},Z=class{constructor(s){this.authPromise=null;this.isAuthenticating=false;this.configuration=s;}async authenticate(s,t){return this.authPromise?this.authPromise:(this.isAuthenticating=true,this.authPromise=new Promise((e,o)=>{(async()=>{try{let i=await new N(this.configuration).adminToken(s,t);i?.access_token?(this.configuration.accessToken=i.access_token,e()):(this.configuration.accessToken=void 0,o(new J("Failed to retrieve access token")));}catch(a){console.error("Authentication failed",a),this.configuration.accessToken=void 0,o(new J("Authentication failed"));}finally{this.authPromise=null,this.isAuthenticating=false;}})();}),this.authPromise)}async waitForAuth(){await this.authPromise;}retryAuth(){return this.authenticate(this.configuration.username,this.configuration.password)}get accessToken(){return this.configuration.accessToken?.toString()||""}set accessToken(s){this.configuration.accessToken=s;}};var ne=(n,s,t)=>{n.interceptors.request.use(async e=>{await s.waitForAuth();let o=s.accessToken;return e.headers.authorization=o?`Bearer ${o}`:void 0,e},e=>Promise.reject(e)),n.interceptors.response.use(e=>e,async e=>{let o=e?.config;if(e?.response?.status===401&&!o?.sent){o.sent=true;try{await s.authenticate(t.username,t.password);let r=s.accessToken;if(r)return o.headers.authorization=`Bearer ${r}`,n(o)}catch(r){return Promise.reject(r)}}return Promise.reject(e)});};var ie=class{constructor(s){if(!s.username||!s.password)throw new Error("No credentials provided for authentication");this.configuration=new Y({basePath:s.baseUrl,username:s.username,password:s.password,accessToken:s.token}),this.client=ae(s.baseUrl,{retries:s.retries}),this.authService=new Z(this.configuration),this.admin=new N(this.configuration,s.baseUrl,this.client),this.core=new D(this.configuration,s.baseUrl,this.client),this.node=new $(this.configuration,s.baseUrl,this.client),this.user=new W(this.configuration,s.baseUrl,this.client),this.system=new z(this.configuration,s.baseUrl,this.client),this.default=new Q(this.configuration,s.baseUrl,this.client),this.subscription=new X(this.configuration,s.baseUrl,this.client),this.userTemplate=new K(this.configuration,s.baseUrl,this.client),ne(this.client,this.authService,s),!s.token&&s.authenticateOnInit!==false&&this.authService.authenticate(s.username,s.password);}async getAuthToken(){return await this.authService.waitForAuth(),this.authService.accessToken}authorize(s=false){return this.authService.isAuthenticating&&!s?this.authService.authPromise:this.authService.authenticate(this.configuration.username,this.configuration.password)}};
|
|
2
2
|
export{ie as PasarguardSDK};//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@assetsfirst/pasarguard-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Fully typed client SDK for the Pasarguard API, supporting both browser and Node.js environments.",
|
|
5
5
|
"author": "pods611",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
"rimraf": "rimraf",
|
|
24
24
|
"clean": "rimraf dist",
|
|
25
25
|
"dev": "tsup --watch",
|
|
26
|
-
"codegen": "openapi-generator-cli generate --generator-key v1",
|
|
26
|
+
"codegen": "openapi-generator-cli generate --generator-key v1 --type-mappings=anyOf=object",
|
|
27
|
+
"test": "openapi-generator-cli author template -g typescript-axios -o ./templates/typescript-axios",
|
|
27
28
|
"openapi-generator-cli": "openapi-generator-cli",
|
|
28
29
|
"format": "prettier --write .",
|
|
29
30
|
"lint": "eslint --fix ."
|
|
30
31
|
},
|
|
31
|
-
"keywords": [],
|
|
32
32
|
"private": false,
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"axios": "^1.12.2",
|
|
@@ -53,5 +53,30 @@
|
|
|
53
53
|
},
|
|
54
54
|
"files": [
|
|
55
55
|
"dist"
|
|
56
|
+
],
|
|
57
|
+
"keywords": [
|
|
58
|
+
"pasarguard-sdk",
|
|
59
|
+
"pasarguard",
|
|
60
|
+
"pasarguard api",
|
|
61
|
+
"pasarguard api client",
|
|
62
|
+
"pasarguard vpn",
|
|
63
|
+
"pasarguard vpn api",
|
|
64
|
+
"pasarguard vpn api client",
|
|
65
|
+
"vpn",
|
|
66
|
+
"http-client",
|
|
67
|
+
"api-client",
|
|
68
|
+
"proxy",
|
|
69
|
+
"shadowsocks",
|
|
70
|
+
"v2ray",
|
|
71
|
+
"xray",
|
|
72
|
+
"trojan",
|
|
73
|
+
"wireguard",
|
|
74
|
+
"vmess",
|
|
75
|
+
"vless",
|
|
76
|
+
"hysteria",
|
|
77
|
+
"tuic",
|
|
78
|
+
"rest-api",
|
|
79
|
+
"http",
|
|
80
|
+
"networking"
|
|
56
81
|
]
|
|
57
82
|
}
|