🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

cloudnode-ts

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cloudnode-ts - npm Package Compare versions

Comparing version

to
3.0.2

2

browser/Cloudnode.js

@@ -38,3 +38,3 @@ /**

*/
#userAgent = `cloudnode/3.0.1`;
#userAgent = `cloudnode/3.0.2`;
/**

@@ -41,0 +41,0 @@ * Construct a new Cloudnode API client

@@ -1,1 +0,1 @@

class Cloudnode{#e;#t;static#r={baseUrl:"https://api.cloudnode.pro/v5/",autoRetry:!0,maxRetryDelay:5,maxRetries:3};#s="5.13.0";#o="cloudnode/3.0.1";constructor(e,t=Cloudnode.#r){const r=Cloudnode.#r;r.baseUrl=t.baseUrl??Cloudnode.#r.baseUrl,r.autoRetry=t.autoRetry??Cloudnode.#r.autoRetry,r.maxRetryDelay=t.maxRetryDelay??Cloudnode.#r.maxRetryDelay,r.maxRetries=t.maxRetries??Cloudnode.#r.maxRetries,this.#e=e,this.#t=r}async#a(e,t,r,s){const o=new URL(e.path.replace(/^\/+/,""),this.#t.baseUrl);for(const[e,r]of Object.entries(t))o.pathname=o.pathname.replaceAll(`/:${e}`,`/${r}`);for(const[e,t]of Object.entries(r))o.searchParams.append(e,t);const a={method:e.method,headers:{}};s&&!["GET","HEAD"].includes(e.method)&&("string"!=typeof s?(a.body=JSON.stringify(s),a.headers["Content-Type"]="application/json"):(a.body=s,a.headers["Content-Type"]="text/plain")),a.headers["User-Agent"]=this.#o,this.#e&&void 0!==e.token&&(a.headers.Authorization=`Bearer ${this.#e}`),void 0!==e.token&&(a.credentials="include");const n=await fetch(o.toString(),a);if(204===n.status)return;const i=await n.text();let p;p=n.headers.get("Content-Type")?.startsWith("application/json")?JSON.parse(i,((e,t)=>/^\d{4}-\d{2}-\d{2}T(?:\d{2}:){2}\d{2}(?:\.\d+)?(?:[a-zA-Z]+|\+\d{2}:\d{2})?$/.test(t)?new Date(t):t)):i;const d=Cloudnode.makeApiResponse(p,new Cloudnode.RawResponse(n,{operation:e,pathParams:t,queryParams:r,body:s}));if(n.ok)return d;throw d}#n(e,t,r,s,o){return new Promise((async(a,n)=>{const i=(p=0)=>{this.#a(e,t,r,s).then((e=>a(e))).catch((e=>{if(o??=this.#t,o.baseUrl??=this.#t.baseUrl,o.autoRetry??=this.#t.autoRetry,o.maxRetries??=this.#t.maxRetries,o.maxRetryDelay??=this.#t.maxRetryDelay,o.autoRetry&&p<o.maxRetries&&e instanceof Cloudnode.R.ApiResponse){const t=e,r=Number(429!==t._response.status?t._response.headers["x-retry-after"]??t._response.headers["retry-after"]:t._response.headers["x-ratelimit-reset"]??t._response.headers["x-rate-limit-reset"]??t._response.headers["ratelimit-reset"]??t._response.headers["rate-limit-reset"]??t._response.headers["retry-after"]??t._response.headers["x-retry-after"]);if(Number.isNaN(r)||r>o.maxRetryDelay)return n(e);setTimeout(i,1e3*Number(r),++p)}else n(e)}))};i(0)}))}#i(e,t){const r=e.split("."),s=t.split("."),o=[r[0]||"0",r[1]||"0"],a=[s[0]||"0",s[1]||"0"];return o[0]!==a[0]?"incompatible":o[1]!==a[1]?"outdated":"compatible"}async checkCompatibility(){const e=await(await fetch(new URL("../",this.#t.baseUrl).toString(),{method:"GET",headers:{"User-Agent":this.#o}})).json();return this.#i(e.version,this.#s)}async getPage(e,t){if(t*e.limit>e.total||t<1)return null;const r=Object.assign({},e._response.request.queryParams);return r.page=t.toString(),await this.#n(e._response.request.operation,e._response.request.pathParams,r,e._response.request.body)}async getNextPage(e){return await this.getPage(e,e.page+1)}async getPreviousPage(e){return await this.getPage(e,e.page-1)}async getAllPages(e){const t=new Array(Math.ceil(e.total/e.limit)).fill(null);t[e.page-1]=!0;const r=t.map(((t,r)=>null!==t||this.getPage(e,r+1))),s=await Promise.all(r.filter((e=>!0!==e)));s.splice(e.page-1,0,e);return{items:s.filter((e=>null!==e)).map((e=>e.items)).flat(),total:e.total,limit:e.limit,page:1}}newsletters={list:async(e=10,t=1)=>await this.#n({type:"operation",description:"List newsletters",method:"GET",path:"/newsletters",parameters:{query:{limit:{description:"The number of newsletters to return per page. No more than 50.",default:"10",type:"number",required:!1},page:{description:"The page number. No more than 2³² (4294967296).",default:"1",type:"number",required:!1}}},returns:[{status:200,type:"Newsletter[]"},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{limit:`${e}`,page:`${t}`},{}),get:async e=>await this.#n({type:"operation",description:"Get newsletter",method:"GET",path:"/newsletters/:id",parameters:{path:{id:{description:"A newsletter ID",type:"string",required:!0}}},returns:[{status:200,type:"Newsletter"},{status:404,type:'Error & {code: "RESOURCE_NOT_FOUND"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{id:`${e}`},{},{})};subscriptions={list:async(e=10,t=1)=>await this.#n({type:"operation",description:"List newsletter subscriptions",token:"newsletter.subscriptions.list.own",method:"GET",path:"/subscriptions",parameters:{query:{limit:{description:"The number of subscriptions to return per page. No more than 50.",default:"10",type:"number",required:!1},page:{description:"The page number. No more than 2³² (4294967296).",default:"1",type:"number",required:!1}}},returns:[{status:200,type:"DatedNewsletterSubscription[]"},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{limit:`${e}`,page:`${t}`},{}),get:async e=>await this.#n({type:"operation",description:"Get newsletter subscription",method:"GET",path:"/subscriptions/:id",parameters:{path:{id:{description:"The ID of the subscription to get",type:"string",required:!0}}},returns:[{status:200,type:"DatedNewsletterSubscription"},{status:404,type:'Error & {code: "RESOURCE_NOT_FOUND"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{id:`${e}`},{},{}),create:async(e,t,r)=>await this.#n({type:"operation",description:"Subscribe to newsletter",method:"POST",path:"/subscriptions",parameters:{body:{newsletter:{description:"The ID of the newsletter to subscribe to",type:"string",required:!0},email:{description:"Subscriber's email address",type:"string",required:!0},data:{description:"Additional data that this newsletter requires",type:"Record<string, string | number | boolean>",required:!1}}},returns:[{status:201,type:"NewsletterSubscription"},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:409,type:'Error & {code: "CONFLICT"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{},{newsletter:e,email:t,data:r}),delete:async e=>await this.#n({type:"operation",description:"Unsubscribe from newsletter",method:"DELETE",path:"/subscriptions/:id",parameters:{path:{id:{description:"The ID of the subscription to revoke",type:"string",required:!0}}},returns:[{status:204,type:"void"},{status:404,type:'Error & {code: "RESOURCE_NOT_FOUND"}'},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{id:`${e}`},{},{})};tokens={list:async(e=10,t=1,r)=>await this.#n({type:"operation",description:"List tokens of user",token:"tokens.list.own",method:"GET",path:"/tokens",parameters:{query:{limit:{description:"The number of tokens to return per page. No more than 50.",default:"10",type:"number",required:!1},page:{description:"The page number. No more than 2³² (4294967296).",default:"1",type:"number",required:!1},internal:{description:"Internal tokens are returned as well if this parameter is present.",type:"any",required:!1}}},returns:[{status:200,type:"PartialToken[]"},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{limit:`${e}`,page:`${t}`,internal:`${r}`},{}),create:async(e,t,r)=>await this.#n({type:"operation",description:"Create token",token:"tokens.create.own",method:"POST",path:"/tokens",parameters:{body:{permissions:{description:"List of permissions to grant to the token. You must already have each of these permissions with your current token.",type:"string[]",required:!0},lifetime:{description:"Lifetime of the token in seconds. If null, the token will never expire (not recommended). Max: 31560000 (1 year). Min: 60 (1 minute).",type:"number",required:!0},note:{description:"A user-specified note to label the token. Max length: 2⁸ (256) characters.",type:"string",required:!1}}},returns:[{status:201,type:"Token"},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{},{permissions:e,lifetime:t,note:r}),get:async e=>await this.#n({type:"operation",description:"Get token details",token:"tokens.get.own",method:"GET",path:"/tokens/:id",parameters:{path:{id:{description:"The ID of the token to get. Specify `current` to get information about the token that was used to authenticate the request.",type:'string | "current"',required:!0}}},returns:[{status:200,type:"Token"},{status:404,type:'Error & {code: "RESOURCE_NOT_FOUND"}'},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{id:`${e}`},{},{}),revoke:async e=>await this.#n({type:"operation",description:"Revoke token",token:"tokens.revoke.own",method:"DELETE",path:"/tokens/:id",parameters:{path:{id:{description:"The ID of the token to revoke. Specify `current` to revoke the token that was used to authenticate the request.",type:'string | "current"',required:!0}}},returns:[{status:204,type:"void"},{status:404,type:'Error & {code: "RESOURCE_NOT_FOUND"}'},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:423,type:'Error & {code: "MODIFICATION_NOT_ALLOWED"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{id:`${e}`},{},{}),listRequests:async(e,t=10,r=1)=>await this.#n({type:"operation",description:"Get list of recent requests made with the token",token:"tokens.get.own.requests",method:"GET",path:"/tokens/:id/requests",parameters:{path:{id:{description:"The ID of the token. Specify `current` to get information about the token that was used to authenticate the request.",type:'string | "current"',required:!0}},query:{limit:{description:"The number of requests to return per page. No more than 50.",default:"10",type:"number",required:!1},page:{description:"The page number. No more than 2³² (4294967296).",default:"1",type:"number",required:!1}}},returns:[{status:200,type:"ShortRequest[]"},{status:404,type:'Error & {code: "RESOURCE_NOT_FOUND"}'},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{id:`${e}`},{limit:`${t}`,page:`${r}`},{}),getRequest:async(e,t)=>await this.#n({type:"operation",description:"Get a recent request by ID",token:"tokens.get.own.requests",method:"GET",path:"/tokens/:id/requests/:request",parameters:{path:{id:{description:"The ID of the token. Specify `current` to get information about the token that was used to authenticate the request.",type:'string | "current"',required:!0},request:{description:"The ID of the request.",type:"string",required:!0}}},returns:[{status:200,type:"Request"},{status:404,type:'Error & {code: "RESOURCE_NOT_FOUND"}'},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:423,type:'Error & {code: "MODIFICATION_NOT_ALLOWED"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{id:`${e}`,request:`${t}`},{},{}),refresh:async e=>await this.#n({type:"operation",description:"Refresh current token. The token that was used to authenticate the request will be deleted. A new token with a new ID but the same permissions will be created and returned. The lifespan of the new token will be the same as the old one, starting from the time of the request. This operation effectively allows a token to be used indefinitely.",token:"token.refresh",method:"POST",path:"/tokens/:id",parameters:{path:{id:{description:"The ID of the token to refresh. Specify `current` to refresh the token that was used to authenticate the request.",type:'string | "current"',required:!0}}},returns:[{status:200,type:"Token"},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{id:`${e}`},{},{})};auth={register:async(e,t,r)=>await this.#n({type:"operation",description:"Create an account and session. After signing up, a welcome e-mail is sent to confirm your e-mail address.\n\n> **Note**: Registering an account can only be performed from residential IP. Proxying this endpoint will likely not work. Creating multiple/alternate accounts is not allowed as per the Terms of Service.",method:"POST",path:"/auth/register",token:null,parameters:{body:{username:{description:"The username to use for the account. Must be between 3 and 20 characters long. Cannot start with `user_`. May contain only letters, numbers, dashes and underscores. Must be unique.",type:"string",required:!0},email:{description:"The e-mail address to register. A valid unique non-disposable e-mail that can receive mail is required.",type:"string",required:!0},password:{description:"The password to use for the account. Must be at least 15 characters, or 8 characters if it contains a mix of letters, numbers and symbols.",type:"string",required:!0}}},returns:[{status:201,type:"{session: string}",description:"Session token. Also returned in `Set-Cookie` header."},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:403,type:'Error & {code: "IP_REJECTED"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{},{username:e,email:t,password:r}),login:async(e,t)=>await this.#n({type:"operation",description:"Create a session using user ID/username/e-mail and password.\n\n> **Note**: Logging in can only be performed from residential IP. Proxying this endpoint will likely not work. It is normally not recommended to use this endpoint to gain API access. Instead, create a token from your account to use with the API.",method:"POST",path:"/auth/login",token:null,parameters:{body:{user:{description:"User ID (starts with `user_`), username or e-mail address.",type:"string",required:!0},password:{description:"The password of the account.",type:"string",required:!0}}},returns:[{status:201,type:"{session: string}",description:"Session token. Also returned in `Set-Cookie` header."},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:403,type:'Error & {code: "IP_REJECTED"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{},{user:e,password:t})};account={get:async()=>await this.#n({type:"operation",description:"Get account details",token:"account.details",method:"GET",path:"/account",parameters:{},returns:[{status:200,type:"AccountDetails"},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{},{}),getIdentity:async()=>await this.#n({type:"operation",description:"Get account identity",token:"account.details.identity",method:"GET",path:"/account/identity",parameters:{},returns:[{status:200,type:"AccountIdentity"},{status:404,type:'Error & {code: "RESOURCE_NOT_FOUND"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{},{}),updateIdentity:async(e,t)=>await this.#n({type:"operation",description:"Update account identity",token:"account.details.identity.update",method:"PATCH",path:"/account/identity",parameters:{body:{username:{description:"Your unique username. Between 3 and 20 characters. Only letters, numbers, dashes and underscores. May not start with `user_`.",type:"string",required:!0},name:{description:"Your full name. Set to `null` to remove. Min 2 characters, max 32. Allowed characters (lowercase as well): A–Z `',-.,` and `ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞSŸ`",type:"string | null",required:!1}}},returns:[{status:200,type:"AccountIdentity"},{status:204,type:"void",description:"`void` if nothing was changed."},{status:404,type:'Error & {code: "RESOURCE_NOT_FOUND"}'},{status:409,type:'Error & {code: "CONFLICT"}'},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{},{username:e,name:t}),replaceIdentity:async(e,t)=>await this.#n({type:"operation",description:"Replace account identity",token:"account.details.identity.update",method:"PUT",path:"/account/identity",parameters:{body:{username:{description:"Your unique username. Between 3 and 20 characters. Only letters, numbers, dashes and underscores. May not start with `user_`.",type:"string",required:!0},name:{description:"Your full name. Set to `null` to remove. Min 2 characters, max 32. Allowed characters (lowercase as well): A–Z `',-.,` and `ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞSŸ`",type:"string | null",required:!0}}},returns:[{status:200,type:"AccountIdentity"},{status:404,type:'Error & {code: "RESOURCE_NOT_FOUND"}'},{status:409,type:'Error & {code: "CONFLICT"}'},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{},{username:e,name:t}),listEmails:async()=>await this.#n({type:"operation",description:"List account e-mail addresses",token:"account.details.email.list",method:"GET",path:"/account/email",parameters:{},returns:[{status:200,type:"AccountEmail[]"},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{},{}),getEmail:async()=>await this.#n({type:"operation",description:"Get your primary e-mail address",token:"account.details.email",method:"GET",path:"/account/email/primary",parameters:{},returns:[{status:200,type:"DatedPrimaryEmail"},{status:404,type:'Error & {code: "RESOURCE_NOT_FOUND"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{},{}),setEmail:async e=>await this.#n({type:"operation",description:"Set your primary e-mail address",token:"account.details.email.update",method:"PUT",path:"/account/email/primary",parameters:{body:{email:{description:"E-mail address to set as primary.",type:"string",required:!0}}},returns:[{status:204,type:"void"},{status:409,type:'Error & {code: "CONFLICT"}'},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{},{email:e}),changePassword:async(e,t)=>await this.#n({type:"operation",description:"Change account password",token:"account.details.password.update",method:"PUT",path:"/account/password",parameters:{body:{currentPassword:{description:"Your current password.",type:"string",required:!0},newPassword:{description:"The new password. Must be at least 15 characters, or 8 characters if it contains a mix of letters, numbers and symbols.",type:"string",required:!0}}},returns:[{status:204,type:"void"},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{},{currentPassword:e,newPassword:t}),listPermissions:async()=>await this.#n({type:"operation",description:"List account permissions with user-friendly descriptions. Some permissions (such as wildcard ones) may be excluded in this list if they don't have a description.",token:"account.details",method:"GET",path:"/account/permissions",parameters:{},returns:[{status:200,type:"Permission[]"},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{},{})};projects={list:async(e=20,t=1)=>await this.#n({type:"operation",description:"List projects",token:"projects.get.own",method:"GET",path:"/projects",parameters:{query:{limit:{description:"The number of projects to return per page. No more than 100.",default:"20",type:"number",required:!1},page:{description:"The page number. No more than 2³² (4294967296).",default:"1",type:"number",required:!1}}},returns:[{status:200,type:"Project[]"},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{limit:`${e}`,page:`${t}`},{}),create:async e=>await this.#n({type:"operation",description:"Create a project",token:"projects.create.own",method:"POST",path:"/projects",parameters:{body:{name:{description:"Project name. Max 255 characters.",type:"string",required:!0}}},returns:[{status:201,type:"Project"},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{},{name:e}),get:async e=>await this.#n({type:"operation",description:"Get a project",token:"projects.get.own",method:"GET",path:"/projects/:id",parameters:{path:{id:{description:"Project ID",type:"string",required:!0}}},returns:[{status:200,type:"Project"},{status:404,type:'Error & {code: "RESOURCE_NOT_FOUND"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{id:`${e}`},{},{}),update:async(e,t)=>await this.#n({type:"operation",description:"Update a project",token:"projects.update.own",method:"PATCH",path:"/projects/:id",parameters:{path:{id:{description:"Project ID",type:"string",required:!0}},body:{name:{description:"Project name. Max 255 characters.",type:"string",required:!0}}},returns:[{status:200,type:"Project"},{status:404,type:'Error & {code: "RESOURCE_NOT_FOUND"}'},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{id:`${e}`},{},{name:t}),delete:async e=>await this.#n({type:"operation",description:"Delete a project",token:"projects.delete.own",method:"DELETE",path:"/projects/:id",parameters:{path:{id:{description:"Project ID",type:"string",required:!0}}},returns:[{status:204,type:"void"},{status:404,type:'Error & {code: "RESOURCE_NOT_FOUND"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{id:`${e}`},{},{})}}!function(e){let t;e.RawResponse=class{headers;ok;redirected;status;statusText;url;request;constructor(e,t){this.headers=Object.fromEntries([...e.headers.entries()].map((([e,t])=>[e.toLowerCase(),t]))),this.ok=e.ok,this.redirected=e.redirected,this.status=e.status,this.statusText=e.statusText,this.url=new URL(e.url),this.request=t}},function(e){e.ApiResponse=class{#p;constructor(e){this.#p=e}get _response(){return this.#p}}}(t=e.R||(e.R={})),e.makeApiResponse=function(e,r){return Object.assign(new t.ApiResponse(r),e)}}(Cloudnode||(Cloudnode={}));
class Cloudnode{#e;#t;static#r={baseUrl:"https://api.cloudnode.pro/v5/",autoRetry:!0,maxRetryDelay:5,maxRetries:3};#s="5.13.0";#o="cloudnode/3.0.2";constructor(e,t=Cloudnode.#r){const r=Cloudnode.#r;r.baseUrl=t.baseUrl??Cloudnode.#r.baseUrl,r.autoRetry=t.autoRetry??Cloudnode.#r.autoRetry,r.maxRetryDelay=t.maxRetryDelay??Cloudnode.#r.maxRetryDelay,r.maxRetries=t.maxRetries??Cloudnode.#r.maxRetries,this.#e=e,this.#t=r}async#a(e,t,r,s){const o=new URL(e.path.replace(/^\/+/,""),this.#t.baseUrl);for(const[e,r]of Object.entries(t))o.pathname=o.pathname.replaceAll(`/:${e}`,`/${r}`);for(const[e,t]of Object.entries(r))o.searchParams.append(e,t);const a={method:e.method,headers:{}};s&&!["GET","HEAD"].includes(e.method)&&("string"!=typeof s?(a.body=JSON.stringify(s),a.headers["Content-Type"]="application/json"):(a.body=s,a.headers["Content-Type"]="text/plain")),a.headers["User-Agent"]=this.#o,this.#e&&void 0!==e.token&&(a.headers.Authorization=`Bearer ${this.#e}`),void 0!==e.token&&(a.credentials="include");const n=await fetch(o.toString(),a);if(204===n.status)return;const i=await n.text();let p;p=n.headers.get("Content-Type")?.startsWith("application/json")?JSON.parse(i,((e,t)=>/^\d{4}-\d{2}-\d{2}T(?:\d{2}:){2}\d{2}(?:\.\d+)?(?:[a-zA-Z]+|\+\d{2}:\d{2})?$/.test(t)?new Date(t):t)):i;const d=Cloudnode.makeApiResponse(p,new Cloudnode.RawResponse(n,{operation:e,pathParams:t,queryParams:r,body:s}));if(n.ok)return d;throw d}#n(e,t,r,s,o){return new Promise((async(a,n)=>{const i=(p=0)=>{this.#a(e,t,r,s).then((e=>a(e))).catch((e=>{if(o??=this.#t,o.baseUrl??=this.#t.baseUrl,o.autoRetry??=this.#t.autoRetry,o.maxRetries??=this.#t.maxRetries,o.maxRetryDelay??=this.#t.maxRetryDelay,o.autoRetry&&p<o.maxRetries&&e instanceof Cloudnode.R.ApiResponse){const t=e,r=Number(429!==t._response.status?t._response.headers["x-retry-after"]??t._response.headers["retry-after"]:t._response.headers["x-ratelimit-reset"]??t._response.headers["x-rate-limit-reset"]??t._response.headers["ratelimit-reset"]??t._response.headers["rate-limit-reset"]??t._response.headers["retry-after"]??t._response.headers["x-retry-after"]);if(Number.isNaN(r)||r>o.maxRetryDelay)return n(e);setTimeout(i,1e3*Number(r),++p)}else n(e)}))};i(0)}))}#i(e,t){const r=e.split("."),s=t.split("."),o=[r[0]||"0",r[1]||"0"],a=[s[0]||"0",s[1]||"0"];return o[0]!==a[0]?"incompatible":o[1]!==a[1]?"outdated":"compatible"}async checkCompatibility(){const e=await(await fetch(new URL("../",this.#t.baseUrl).toString(),{method:"GET",headers:{"User-Agent":this.#o}})).json();return this.#i(e.version,this.#s)}async getPage(e,t){if(t*e.limit>e.total||t<1)return null;const r=Object.assign({},e._response.request.queryParams);return r.page=t.toString(),await this.#n(e._response.request.operation,e._response.request.pathParams,r,e._response.request.body)}async getNextPage(e){return await this.getPage(e,e.page+1)}async getPreviousPage(e){return await this.getPage(e,e.page-1)}async getAllPages(e){const t=new Array(Math.ceil(e.total/e.limit)).fill(null);t[e.page-1]=!0;const r=t.map(((t,r)=>null!==t||this.getPage(e,r+1))),s=await Promise.all(r.filter((e=>!0!==e)));s.splice(e.page-1,0,e);return{items:s.filter((e=>null!==e)).map((e=>e.items)).flat(),total:e.total,limit:e.limit,page:1}}newsletters={list:async(e=10,t=1)=>await this.#n({type:"operation",description:"List newsletters",method:"GET",path:"/newsletters",parameters:{query:{limit:{description:"The number of newsletters to return per page. No more than 50.",default:"10",type:"number",required:!1},page:{description:"The page number. No more than 2³² (4294967296).",default:"1",type:"number",required:!1}}},returns:[{status:200,type:"Newsletter[]"},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{limit:`${e}`,page:`${t}`},{}),get:async e=>await this.#n({type:"operation",description:"Get newsletter",method:"GET",path:"/newsletters/:id",parameters:{path:{id:{description:"A newsletter ID",type:"string",required:!0}}},returns:[{status:200,type:"Newsletter"},{status:404,type:'Error & {code: "RESOURCE_NOT_FOUND"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{id:`${e}`},{},{})};subscriptions={list:async(e=10,t=1)=>await this.#n({type:"operation",description:"List newsletter subscriptions",token:"newsletter.subscriptions.list.own",method:"GET",path:"/subscriptions",parameters:{query:{limit:{description:"The number of subscriptions to return per page. No more than 50.",default:"10",type:"number",required:!1},page:{description:"The page number. No more than 2³² (4294967296).",default:"1",type:"number",required:!1}}},returns:[{status:200,type:"DatedNewsletterSubscription[]"},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{limit:`${e}`,page:`${t}`},{}),get:async e=>await this.#n({type:"operation",description:"Get newsletter subscription",method:"GET",path:"/subscriptions/:id",parameters:{path:{id:{description:"The ID of the subscription to get",type:"string",required:!0}}},returns:[{status:200,type:"DatedNewsletterSubscription"},{status:404,type:'Error & {code: "RESOURCE_NOT_FOUND"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{id:`${e}`},{},{}),create:async(e,t,r)=>await this.#n({type:"operation",description:"Subscribe to newsletter",method:"POST",path:"/subscriptions",parameters:{body:{newsletter:{description:"The ID of the newsletter to subscribe to",type:"string",required:!0},email:{description:"Subscriber's email address",type:"string",required:!0},data:{description:"Additional data that this newsletter requires",type:"Record<string, string | number | boolean>",required:!1}}},returns:[{status:201,type:"NewsletterSubscription"},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:409,type:'Error & {code: "CONFLICT"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{},{newsletter:e,email:t,data:r}),delete:async e=>await this.#n({type:"operation",description:"Unsubscribe from newsletter",method:"DELETE",path:"/subscriptions/:id",parameters:{path:{id:{description:"The ID of the subscription to revoke",type:"string",required:!0}}},returns:[{status:204,type:"void"},{status:404,type:'Error & {code: "RESOURCE_NOT_FOUND"}'},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{id:`${e}`},{},{})};tokens={list:async(e=10,t=1,r)=>await this.#n({type:"operation",description:"List tokens of user",token:"tokens.list.own",method:"GET",path:"/tokens",parameters:{query:{limit:{description:"The number of tokens to return per page. No more than 50.",default:"10",type:"number",required:!1},page:{description:"The page number. No more than 2³² (4294967296).",default:"1",type:"number",required:!1},internal:{description:"Internal tokens are returned as well if this parameter is present.",type:"any",required:!1}}},returns:[{status:200,type:"PartialToken[]"},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{limit:`${e}`,page:`${t}`,internal:`${r}`},{}),create:async(e,t,r)=>await this.#n({type:"operation",description:"Create token",token:"tokens.create.own",method:"POST",path:"/tokens",parameters:{body:{permissions:{description:"List of permissions to grant to the token. You must already have each of these permissions with your current token.",type:"string[]",required:!0},lifetime:{description:"Lifetime of the token in seconds. If null, the token will never expire (not recommended). Max: 31560000 (1 year). Min: 60 (1 minute).",type:"number",required:!0},note:{description:"A user-specified note to label the token. Max length: 2⁸ (256) characters.",type:"string",required:!1}}},returns:[{status:201,type:"Token"},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{},{permissions:e,lifetime:t,note:r}),get:async e=>await this.#n({type:"operation",description:"Get token details",token:"tokens.get.own",method:"GET",path:"/tokens/:id",parameters:{path:{id:{description:"The ID of the token to get. Specify `current` to get information about the token that was used to authenticate the request.",type:'string | "current"',required:!0}}},returns:[{status:200,type:"Token"},{status:404,type:'Error & {code: "RESOURCE_NOT_FOUND"}'},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{id:`${e}`},{},{}),revoke:async e=>await this.#n({type:"operation",description:"Revoke token",token:"tokens.revoke.own",method:"DELETE",path:"/tokens/:id",parameters:{path:{id:{description:"The ID of the token to revoke. Specify `current` to revoke the token that was used to authenticate the request.",type:'string | "current"',required:!0}}},returns:[{status:204,type:"void"},{status:404,type:'Error & {code: "RESOURCE_NOT_FOUND"}'},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:423,type:'Error & {code: "MODIFICATION_NOT_ALLOWED"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{id:`${e}`},{},{}),listRequests:async(e,t=10,r=1)=>await this.#n({type:"operation",description:"Get list of recent requests made with the token",token:"tokens.get.own.requests",method:"GET",path:"/tokens/:id/requests",parameters:{path:{id:{description:"The ID of the token. Specify `current` to get information about the token that was used to authenticate the request.",type:'string | "current"',required:!0}},query:{limit:{description:"The number of requests to return per page. No more than 50.",default:"10",type:"number",required:!1},page:{description:"The page number. No more than 2³² (4294967296).",default:"1",type:"number",required:!1}}},returns:[{status:200,type:"ShortRequest[]"},{status:404,type:'Error & {code: "RESOURCE_NOT_FOUND"}'},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{id:`${e}`},{limit:`${t}`,page:`${r}`},{}),getRequest:async(e,t)=>await this.#n({type:"operation",description:"Get a recent request by ID",token:"tokens.get.own.requests",method:"GET",path:"/tokens/:id/requests/:request",parameters:{path:{id:{description:"The ID of the token. Specify `current` to get information about the token that was used to authenticate the request.",type:'string | "current"',required:!0},request:{description:"The ID of the request.",type:"string",required:!0}}},returns:[{status:200,type:"Request"},{status:404,type:'Error & {code: "RESOURCE_NOT_FOUND"}'},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:423,type:'Error & {code: "MODIFICATION_NOT_ALLOWED"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{id:`${e}`,request:`${t}`},{},{}),refresh:async e=>await this.#n({type:"operation",description:"Refresh current token. The token that was used to authenticate the request will be deleted. A new token with a new ID but the same permissions will be created and returned. The lifespan of the new token will be the same as the old one, starting from the time of the request. This operation effectively allows a token to be used indefinitely.",token:"token.refresh",method:"POST",path:"/tokens/:id",parameters:{path:{id:{description:"The ID of the token to refresh. Specify `current` to refresh the token that was used to authenticate the request.",type:'string | "current"',required:!0}}},returns:[{status:200,type:"Token"},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{id:`${e}`},{},{})};auth={register:async(e,t,r)=>await this.#n({type:"operation",description:"Create an account and session. After signing up, a welcome e-mail is sent to confirm your e-mail address.\n\n> **Note**: Registering an account can only be performed from residential IP. Proxying this endpoint will likely not work. Creating multiple/alternate accounts is not allowed as per the Terms of Service.",method:"POST",path:"/auth/register",token:null,parameters:{body:{username:{description:"The username to use for the account. Must be between 3 and 20 characters long. Cannot start with `user_`. May contain only letters, numbers, dashes and underscores. Must be unique.",type:"string",required:!0},email:{description:"The e-mail address to register. A valid unique non-disposable e-mail that can receive mail is required.",type:"string",required:!0},password:{description:"The password to use for the account. Must be at least 15 characters, or 8 characters if it contains a mix of letters, numbers and symbols.",type:"string",required:!0}}},returns:[{status:201,type:"{session: string}",description:"Session token. Also returned in `Set-Cookie` header."},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:403,type:'Error & {code: "IP_REJECTED"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{},{username:e,email:t,password:r}),login:async(e,t)=>await this.#n({type:"operation",description:"Create a session using user ID/username/e-mail and password.\n\n> **Note**: Logging in can only be performed from residential IP. Proxying this endpoint will likely not work. It is normally not recommended to use this endpoint to gain API access. Instead, create a token from your account to use with the API.",method:"POST",path:"/auth/login",token:null,parameters:{body:{user:{description:"User ID (starts with `user_`), username or e-mail address.",type:"string",required:!0},password:{description:"The password of the account.",type:"string",required:!0}}},returns:[{status:201,type:"{session: string}",description:"Session token. Also returned in `Set-Cookie` header."},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:403,type:'Error & {code: "IP_REJECTED"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{},{user:e,password:t})};account={get:async()=>await this.#n({type:"operation",description:"Get account details",token:"account.details",method:"GET",path:"/account",parameters:{},returns:[{status:200,type:"AccountDetails"},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{},{}),getIdentity:async()=>await this.#n({type:"operation",description:"Get account identity",token:"account.details.identity",method:"GET",path:"/account/identity",parameters:{},returns:[{status:200,type:"AccountIdentity"},{status:404,type:'Error & {code: "RESOURCE_NOT_FOUND"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{},{}),updateIdentity:async(e,t)=>await this.#n({type:"operation",description:"Update account identity",token:"account.details.identity.update",method:"PATCH",path:"/account/identity",parameters:{body:{username:{description:"Your unique username. Between 3 and 20 characters. Only letters, numbers, dashes and underscores. May not start with `user_`.",type:"string",required:!0},name:{description:"Your full name. Set to `null` to remove. Min 2 characters, max 32. Allowed characters (lowercase as well): A–Z `',-.,` and `ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞSŸ`",type:"string | null",required:!1}}},returns:[{status:200,type:"AccountIdentity"},{status:204,type:"void",description:"`void` if nothing was changed."},{status:404,type:'Error & {code: "RESOURCE_NOT_FOUND"}'},{status:409,type:'Error & {code: "CONFLICT"}'},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{},{username:e,name:t}),replaceIdentity:async(e,t)=>await this.#n({type:"operation",description:"Replace account identity",token:"account.details.identity.update",method:"PUT",path:"/account/identity",parameters:{body:{username:{description:"Your unique username. Between 3 and 20 characters. Only letters, numbers, dashes and underscores. May not start with `user_`.",type:"string",required:!0},name:{description:"Your full name. Set to `null` to remove. Min 2 characters, max 32. Allowed characters (lowercase as well): A–Z `',-.,` and `ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞSŸ`",type:"string | null",required:!0}}},returns:[{status:200,type:"AccountIdentity"},{status:404,type:'Error & {code: "RESOURCE_NOT_FOUND"}'},{status:409,type:'Error & {code: "CONFLICT"}'},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{},{username:e,name:t}),listEmails:async()=>await this.#n({type:"operation",description:"List account e-mail addresses",token:"account.details.email.list",method:"GET",path:"/account/email",parameters:{},returns:[{status:200,type:"AccountEmail[]"},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{},{}),getEmail:async()=>await this.#n({type:"operation",description:"Get your primary e-mail address",token:"account.details.email",method:"GET",path:"/account/email/primary",parameters:{},returns:[{status:200,type:"DatedPrimaryEmail"},{status:404,type:'Error & {code: "RESOURCE_NOT_FOUND"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{},{}),setEmail:async e=>await this.#n({type:"operation",description:"Set your primary e-mail address",token:"account.details.email.update",method:"PUT",path:"/account/email/primary",parameters:{body:{email:{description:"E-mail address to set as primary.",type:"string",required:!0}}},returns:[{status:204,type:"void"},{status:409,type:'Error & {code: "CONFLICT"}'},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{},{email:e}),changePassword:async(e,t)=>await this.#n({type:"operation",description:"Change account password",token:"account.details.password.update",method:"PUT",path:"/account/password",parameters:{body:{currentPassword:{description:"Your current password.",type:"string",required:!0},newPassword:{description:"The new password. Must be at least 15 characters, or 8 characters if it contains a mix of letters, numbers and symbols.",type:"string",required:!0}}},returns:[{status:204,type:"void"},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{},{currentPassword:e,newPassword:t}),listPermissions:async()=>await this.#n({type:"operation",description:"List account permissions with user-friendly descriptions. Some permissions (such as wildcard ones) may be excluded in this list if they don't have a description.",token:"account.details",method:"GET",path:"/account/permissions",parameters:{},returns:[{status:200,type:"Permission[]"},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{},{})};projects={list:async(e=20,t=1)=>await this.#n({type:"operation",description:"List projects",token:"projects.get.own",method:"GET",path:"/projects",parameters:{query:{limit:{description:"The number of projects to return per page. No more than 100.",default:"20",type:"number",required:!1},page:{description:"The page number. No more than 2³² (4294967296).",default:"1",type:"number",required:!1}}},returns:[{status:200,type:"Project[]"},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{limit:`${e}`,page:`${t}`},{}),create:async e=>await this.#n({type:"operation",description:"Create a project",token:"projects.create.own",method:"POST",path:"/projects",parameters:{body:{name:{description:"Project name. Max 255 characters.",type:"string",required:!0}}},returns:[{status:201,type:"Project"},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{},{},{name:e}),get:async e=>await this.#n({type:"operation",description:"Get a project",token:"projects.get.own",method:"GET",path:"/projects/:id",parameters:{path:{id:{description:"Project ID",type:"string",required:!0}}},returns:[{status:200,type:"Project"},{status:404,type:'Error & {code: "RESOURCE_NOT_FOUND"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{id:`${e}`},{},{}),update:async(e,t)=>await this.#n({type:"operation",description:"Update a project",token:"projects.update.own",method:"PATCH",path:"/projects/:id",parameters:{path:{id:{description:"Project ID",type:"string",required:!0}},body:{name:{description:"Project name. Max 255 characters.",type:"string",required:!0}}},returns:[{status:200,type:"Project"},{status:404,type:'Error & {code: "RESOURCE_NOT_FOUND"}'},{status:422,type:'Error & {code: "INVALID_DATA"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{id:`${e}`},{},{name:t}),delete:async e=>await this.#n({type:"operation",description:"Delete a project",token:"projects.delete.own",method:"DELETE",path:"/projects/:id",parameters:{path:{id:{description:"Project ID",type:"string",required:!0}}},returns:[{status:204,type:"void"},{status:404,type:'Error & {code: "RESOURCE_NOT_FOUND"}'},{status:401,type:'Error & {code: "UNAUTHORIZED"}'},{status:403,type:'Error & {code: "NO_PERMISSION"}'},{status:429,type:'Error & {code: "RATE_LIMITED"}'},{status:500,type:'Error & {code: "INTERNAL_SERVER_ERROR"}'},{status:503,type:'Error & {code: "MAINTENANCE"}'}]},{id:`${e}`},{},{})}}!function(e){let t;e.RawResponse=class{headers;ok;redirected;status;statusText;url;request;constructor(e,t){this.headers=Object.fromEntries([...e.headers.entries()].map((([e,t])=>[e.toLowerCase(),t]))),this.ok=e.ok,this.redirected=e.redirected,this.status=e.status,this.statusText=e.statusText,this.url=new URL(e.url),this.request=t}},function(e){e.ApiResponse=class{#p;constructor(e){this.#p=e}get _response(){return this.#p}}}(t=e.R||(e.R={})),e.makeApiResponse=function(e,r){return Object.assign(new t.ApiResponse(r),e)}}(Cloudnode||(Cloudnode={}));
{
"name": "cloudnode-ts",
"version": "3.0.1",
"version": "3.0.2",
"description": "A client library for the Cloudnode API, written in TypeScript. [Documentation](https://github.com/cloudnode-pro/ts-client#documentation)",

@@ -5,0 +5,0 @@ "main": "src/Cloudnode.js",

@@ -38,3 +38,3 @@ /**

*/
#userAgent = `cloudnode/3.0.1`;
#userAgent = `cloudnode/3.0.2`;
/**

@@ -41,0 +41,0 @@ * Construct a new Cloudnode API client

Sorry, the diff of this file is too big to display