Skip to content

Cumulonimbus

Warning

This page is for v4 of the library. If you're using v3, it will no longer be maintained. Please refer to type definitions for v3.

Interfaces, Types, and Subclasses

Note

Some of these interfaces, types, and subclasses are not documented here. This is to reduce repetition since they're already documented in the Reference page.

Omitted Fields
  • BASE_URL
  • BASE_THUMBNAIL_URL
  • APICallRequestInit (This is just RequestInit with ClientOptions added)
  • Data and its children (These are documented in the Data Structures page)
  • ErrorCode (This is documented in the Error Codes page)
  • SuccessCode (This is documented in the Success Codes page)

RatelimitData ^4.0.0

ts
interface RatelimitData {
  limit: number;
  remaining: number;
  reset: number;
}

ClientOptions ^4.0.0

ts
interface ClientOptions {
  baseURL?: string;
  baseThumbnailURL?: string;
}

APIResponse ^4.0.0

Note

The generic type T will contain one of the Data Structures page.

ts
interface APIResponse<T> {
  result: T;
  ratelimit: RatelimitData;
}

ResponseError ^4.0.0

ts
class ResponseError extends Error implements Data.Error {
  code: keyof ErrorCode;
  message: ErrorCode[keyof ErrorCode];
  ratelimit: RatelimitData | null;
  fields?: string[];
  constructor(response: Data.Error, ratelimit: RatelimitData | null = null);
}

ThumbnailError ^4.0.0

ts
class ThumbnailError extends Error {
  code: number;
  message: string;
  constructor(response: Response);
}

KillSwitches ^4.0.4

An enum containing the kill switches.

ts
enum KillSwitches {
  // Account related killSwitches
  ACCOUNT_CREATE,
  ACCOUNT_MODIFY,
  ACCOUNT_DELETE,
  ACCOUNT_EMAIL_VERIFY,
  ACCOUNT_LOGIN,
  // File related killSwitches
  FILE_CREATE,
  FILE_MODIFY,
  FILE_DELETE,
  // The Global KillSwitch
  GLOBAL,
}

Static Methods

login ^4.0.0

This method is used to login to Cumulonimbus using the /api/login endpoint, and will return a promise with an instance of the Cumulonimbus class upon succeeding.

ts
static login(
  options: {
    username: string;
    password: string;
    rememberMe?: boolean;
    tokenName?: string;
  },
  clientOptions?: Cumulonimbus.ClientOptions
): Promise<Cumulonimbus>;

register ^4.0.0

This method is used to register a new account on Cumulonimbus using the /api/register endpoint, and will return a promise with an instance of the Cumulonimbus class upon succeeding.

ts
static register(
  options: {
    username: string;
    email: string;
    password: string;
    repeatPassword: string;
    rememberMe?: boolean;
  },
  clientOptions?: Cumulonimbus.ClientOptions
): Promise<Cumulonimbus>;

getAPIStatus ^4.0.0

This method fetches the example endpoint / and returns a promise with the response.

ts
static getAPIStatus(options?: Cumulonimbus.ClientOptions): Promise<Response>;

getThumbnailAPIStatus ^4.0.0

Similar to getAPIStatus, this method fetches the thumbnail server's example endpoint.

ts
static getThumbnailAPIStatus(
  options?: Cumulonimbus.ClientOptions
): Promise<Response>;

Constructor

The constructor is used to create an instance of the Cumulonimbus class.

ts
constructor(
  token: string,
  clientOptions?: Cumulonimbus.ClientOptions
);

Instance Methods

The following methods are on the Cumulonimbus class and are used to make requests to the Cumulonimbus API. Not all of these methods are public on the class and are only used internally. They have been omitted for brevity.

getAPIStatus (Instance) ^4.0.0

Functionally the same as the static method getAPIStatus, but uses the instance's options.

ts
getAPIStatus();

getThumbnailAPIStatus (Instance) ^4.0.0

Functionally the same as the static method getThumbnailAPIStatus, but uses the instance's options.

ts
getThumbnailAPIStatus();

getThumbnail ^4.0.0

Fetches a thumbnail from the thumbnail server. This method uses the configured baseThumbnailURL to fetch the thumbnail.

ts
getThumbnail(
  id: string | Cumulonimbus.Data.File
);

getSession ^4.0.0

Fetches the current session or the specified session of yourself or another user. If no session ID is specified, the current session will be fetched.

See the underlying endpoint for more information.

ts
getSession(
  options?:
  | string
  | {
    session?: string; // Session is optional when user is not specified
    user?: undefined;
  }
  | {
    session: string; // Session is required when user is specified
    user: string;
  }
);

getSessions ^4.0.0

Fetches a list of sessions for yourself or another user. If no user ID is specified, the sessions for the current user will be fetched.

See the underlying endpoint for more information.

ts
getSessions(
  options?:
  | string
  | {
    user?: string;
    limit?: number;
    offset?: number;
  }
);

deleteSession ^4.0.0

Deletes the specified session of yourself or another user. If no user ID is specified, it will assume the current user.

See the underlying endpoint for more information.

ts
deleteSession(
  options?:
  | string
  | {
    session?: string; // Session is optional when user is not specified
    user?: undefined;
  }
  | {
    session: string; // Session is required when user is specified
    user: string;
  }
);

deleteSessions ^4.0.0

Deletes the specified sessions of yourself or another user. If no user ID is specified, it will assume the current user.

See the underlying endpoint for more information.

ts
deleteSessions(
  sessionIDs: string[],
  user?: string
);

deleteAllSessions ^4.0.0

Deletes all sessions of yourself or another user. If no user ID is specified, it will assume the current user.

If provided a string, it will assume the user ID. If provided a boolean, it will assume the user ID is the current user and use it as a flag to include the current session or not.

See the underlying endpoint for more information.

ts
deleteAllSessions(
  userOrIncludeSelf?: string | boolean
);

getUsers ^4.0.0

Fetches a list of users.

See the underlying endpoint for more information.

ts
getUsers(
  options?: {
    limit?: number;
    offset?: number;
  }
);

getUser ^4.0.0

Fetches a user. If no user ID is specified, it will fetch the current user.

See the underlying endpoint for more information.

ts
getUser(
  user?: string
);

editUsername ^4.0.0

Edits the username of yourself or another user.

See the underlying endpoint for more information.

ts
editUsername(
  options:
  | {
    username: string;
    password: string;
    user?: undefined; // Cannot specify user when editing current user (it's implied when password is provided)
  }
  | {
    username: string;
    password?: undefined; // Cannot specify password when editing another user (it's implied when user is provided)
    user: string;
  }
);

editEmail ^4.0.0

Edits the email of yourself or another user. This will also unverify the email and automatically send a verification email.

See the underlying endpoint for more information.

ts
editEmail(
  options:
  | {
    email: string;
    password: string;
    user?: undefined; // Cannot specify user when editing current user (it's implied when password is provided)
  }
  | {
    email: string;
    password?: undefined; // Cannot specify password when editing another user (it's implied when user is provided)
    user: string;
  }
);

verifyEmail ^4.0.0

Verifies the email of yourself or another user.

See the underlying endpoint for more information.

ts
verifyEmail(
  options:
  | {
    token: string;
    user?: undefined; // Cannot specify user when verifying current user (it's implied when token is provided)
  }
  | {
    token?: undefined; // Cannot specify token when verifying another user (it's implied when user is provided)
    user: string;
  }
);

resendVerificationEmail ^4.0.0

Resend the verification email of yourself or another user. If no user ID is specified, it will assume the current user.

See the underlying endpoint for more information.

ts
resendVerificationEmail(
  user?: string
);

unverifyEmail ^4.0.0

Unverify the email of another user.

See the underlying endpoint for more information.

ts
unverifyEmail(
  user: string
);

editPassword ^4.0.0

Edits the password of yourself or another user. If no user ID is specified, it will assume the current user. If you're editing the current user's password, you must provide the current password.

See the underlying endpoint for more information.

ts
editPassword(
  options:
  | {
    newPassword: string;
    confirmNewPassword: string;
    password: string;
    user?: undefined; // Cannot specify user when editing current user (it's implied when password is provided)
  }
  | {
    newPassword: string;
    confirmNewPassword: string;
    password?: undefined; // Cannot specify password when editing another user (it's implied when user is provided)
    user: string;
  }
);

grantStaff ^4.0.0

Grants staff to the specified user.

See the underlying endpoint for more information.

ts
grantStaff(
  user: string
);

revokeStaff ^4.0.0

Revokes staff from the specified user.

See the underlying endpoint for more information.

ts
revokeStaff(
  user: string
);

banUser ^4.0.0

Bans the specified user. This will automatically send an email to the user notifying them of the ban with the provided reason.

See the underlying endpoint for more information.

ts
banUser(
  user: string,
  reason: string
);

unbanUser ^4.0.0

Unbans the specified user.

See the underlying endpoint for more information.

ts
unbanUser(
  user: string
);

editDomainSelection ^4.0.0

Edits the domain selection of yourself or another user. If no user ID is specified, it will assume the current user.

See the underlying endpoint for more information.

ts
editDomainSelection(
  options: {
    domain: string;
    subdomain?: string;
  },
  user?: string
);

deleteUser ^4.0.0

Deletes the current user or the specified user.

See the underlying endpoint for more information.

ts
deleteUser(
  options:
  | {
    username: string;
    password: string;
    user?: undefined; // Cannot specify user when deleting current user (it's implied when username and password are provided)
  }
  | {
    username?: undefined; // Cannot specify username when deleting another user (it's implied when user is provided)
    password?: undefined; // Cannot specify password when deleting another user (it's implied when user is provided)
    user: string;
  }
);

deleteUsers ^4.0.0

Deletes the specified users.

See the underlying endpoint for more information.

ts
deleteUsers(
  userIDs: string[]
);

getDomains ^4.0.0

Fetches a list of domains.

See the underlying endpoint for more information.

ts
getDomains(
  limit?: 'all' | number,
  offset?: number
);

getDomain ^4.0.0

Fetches the specified domain.

See the underlying endpoint for more information.

ts
getDomain(
  id: string
);

createDomain ^4.0.0

Creates a domain.

See the underlying endpoint for more information.

ts
createDomain(
  id: string,
  subdomains?: boolean
);

allowSubdomains ^4.0.0

Allows subdomains for the specified domain.

See the underlying endpoint for more information.

ts
allowSubdomains(
  id: string
);

disallowSubdomains ^4.0.0

Disallows subdomains for the specified domain.

See the underlying endpoint for more information.

ts
disallowSubdomains(
  id: string
);

deleteDomain ^4.0.0

Deletes the specified domain.

See the underlying endpoint for more information.

ts
deleteDomain(
  id: string
);

deleteDomains ^4.0.0

Deletes the specified domains.

See the underlying endpoint for more information.

ts
deleteDomains(
  ids: string[]
);

getFiles ^4.0.0

Fetches a list of files. If no user ID is specified, it will fetch all files from all users.

See the underlying endpoint for more information.

ts
getFiles(
  options?: {
    user?: string;
    limit?: number;
    offset?: number;
  }
);

getFile ^4.0.0

Fetches the specified file.

See the underlying endpoint for more information.

ts
getFile(
  id: string
);

editFilename ^4.0.0

Edits the display name of the specified file.

See the underlying endpoint for more information.

ts
editFilename(
  id: string,
  name: string
);

deleteFilename ^4.0.0

Deletes the display name of the specified file.

See the underlying endpoint for more information.

ts
deleteFilename(
  id: string
);

editFileExtension ^4.0.0

Edits the extension of the specified file.

See the underlying endpoint for more information.

ts
editFileExtension(
  id: string,
  extension: string
);

deleteFile ^4.0.0

Deletes the specified file.

See the underlying endpoint for more information.

ts
deleteFile(
  id: string
);

deleteFiles ^4.0.0

Deletes the specified files.

See the underlying endpoint for more information.

ts
deleteFiles(
  ids: string[]
);

deleteAllFiles ^4.0.0

Deletes all files from the specified user. If no user ID is specified, it will assume the current user. If you're deleting the files of the current user, you must provide the current password to confirm the deletion.

See the underlying endpoint for more information.

ts
deleteAllFiles(
  options:
  | {
    password: string;
    user?: undefined; // Cannot specify user when deleting current user (it's implied when password is provided)
  }
  | {
    password?: undefined; // Cannot specify password when deleting another user (it's implied when user is provided)
    user: string;
  }
);

getInstructions ^4.0.0

Fetches a list of instructions.

See the underlying endpoint for more information.

ts
getInstructions(
  limit?: number,
  offset?: number
);

getInstruction ^4.0.0

Fetches the specified instruction.

See the underlying endpoint for more information.

ts
getInstruction(
  id: string
);

createInstruction ^4.0.0

Creates an instruction.

See the underlying endpoint for more information.

ts
createInstruction(
  options: {
    id: string;
    name: string;
    description: string;
    steps: string[];
    content: string;
    filename?: string;
  }
);

editInstructionName ^4.0.0

Edits the name of the specified instruction.

See the underlying endpoint for more information.

ts
editInstructionName(
  id: string,
  name: string
);

editInstructionDescription ^4.0.0

Edits the description of the specified instruction.

See the underlying endpoint for more information.

ts
editInstructionDescription(
  id: string,
  description: string
);

editInstructionFile ^4.0.0

Edits the file of the specified instruction.

See the underlying endpoint for more information.

ts
editInstructionFile(
  id: string,
  content: string,
  filename?: string
);

editInstructionSteps ^4.0.0

Edits the steps of the specified instruction.

See the underlying endpoint for more information.

ts
editInstructionSteps(
  id: string,
  steps: string[]
);

deleteInstruction ^4.0.0

Deletes the specified instruction.

See the underlying endpoint for more information.

ts
deleteInstruction(
  id: string
);

deleteInstructions ^4.0.0

Deletes the specified instructions.

See the underlying endpoint for more information.

ts
deleteInstructions(
  ids: string[]
);

getKillSwitches ^4.0.4

Fetches a list of kill switches.

See the underlying endpoint for more information.

ts
getKillSwitches();

enableKillSwitch ^4.0.4

Enables the specified kill switch.

See the underlying endpoint for more information.

ts
enableKillSwitch(
  id: KillSwitches
);

disableKillSwitch ^4.0.4

Disables the specified kill switch.

See the underlying endpoint for more information.

ts
disableKillSwitch(
  id: KillSwitches
);

disableAllKillSwitches ^4.0.4

Disables all kill switches.

See the underlying endpoint for more information.

ts
disableAllKillSwitches();

upload ^4.0.0

Uploads the provided data to Cumulonimbus.

ts
upload(
  data: string | Buffer | File | Blob | ArrayBuffer,
  type?: string,
);

Made with ❤️ by Alek Evans (AlekEagle)