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 justRequestInit
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
interface RatelimitData {
limit: number;
remaining: number;
reset: number;
}
ClientOptions ^4.0.0
interface ClientOptions {
baseURL?: string;
baseThumbnailURL?: string;
}
APIResponse ^4.0.0
Note
The generic type T
will contain one of the Data Structures page.
interface APIResponse<T> {
result: T;
ratelimit: RatelimitData;
}
ResponseError ^4.0.0
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
class ThumbnailError extends Error {
code: number;
message: string;
constructor(response: Response);
}
KillSwitches ^4.0.4
An enum containing the kill switches.
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.
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.
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.
static getAPIStatus(options?: Cumulonimbus.ClientOptions): Promise<Response>;
getThumbnailAPIStatus ^4.0.0
Similar to getAPIStatus, this method fetches the thumbnail server's example endpoint.
static getThumbnailAPIStatus(
options?: Cumulonimbus.ClientOptions
): Promise<Response>;
Constructor
The constructor is used to create an instance of the Cumulonimbus class.
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.
getAPIStatus();
getThumbnailAPIStatus (Instance) ^4.0.0
Functionally the same as the static method getThumbnailAPIStatus, but uses the instance's options.
getThumbnailAPIStatus();
getThumbnail ^4.0.0
Fetches a thumbnail from the thumbnail server. This method uses the configured baseThumbnailURL
to fetch the thumbnail.
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.
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.
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.
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.
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.
deleteAllSessions(
userOrIncludeSelf?: string | boolean
);
getUsers ^4.0.0
Fetches a list of users.
See the underlying endpoint for more information.
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.
getUser(
user?: string
);
editUsername ^4.0.0
Edits the username of yourself or another user.
See the underlying endpoint for more information.
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.
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.
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.
resendVerificationEmail(
user?: string
);
unverifyEmail ^4.0.0
Unverify the email of another user.
See the underlying endpoint for more information.
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.
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.
grantStaff(
user: string
);
revokeStaff ^4.0.0
Revokes staff from the specified user.
See the underlying endpoint for more information.
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.
banUser(
user: string,
reason: string
);
unbanUser ^4.0.0
Unbans the specified user.
See the underlying endpoint for more information.
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.
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.
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.
deleteUsers(
userIDs: string[]
);
getDomains ^4.0.0
Fetches a list of domains.
See the underlying endpoint for more information.
getDomains(
limit?: 'all' | number,
offset?: number
);
getDomain ^4.0.0
Fetches the specified domain.
See the underlying endpoint for more information.
getDomain(
id: string
);
createDomain ^4.0.0
Creates a domain.
See the underlying endpoint for more information.
createDomain(
id: string,
subdomains?: boolean
);
allowSubdomains ^4.0.0
Allows subdomains for the specified domain.
See the underlying endpoint for more information.
allowSubdomains(
id: string
);
disallowSubdomains ^4.0.0
Disallows subdomains for the specified domain.
See the underlying endpoint for more information.
disallowSubdomains(
id: string
);
deleteDomain ^4.0.0
Deletes the specified domain.
See the underlying endpoint for more information.
deleteDomain(
id: string
);
deleteDomains ^4.0.0
Deletes the specified domains.
See the underlying endpoint for more information.
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.
getFiles(
options?: {
user?: string;
limit?: number;
offset?: number;
}
);
getFile ^4.0.0
Fetches the specified file.
See the underlying endpoint for more information.
getFile(
id: string
);
editFilename ^4.0.0
Edits the display name of the specified file.
See the underlying endpoint for more information.
editFilename(
id: string,
name: string
);
deleteFilename ^4.0.0
Deletes the display name of the specified file.
See the underlying endpoint for more information.
deleteFilename(
id: string
);
editFileExtension ^4.0.0
Edits the extension of the specified file.
See the underlying endpoint for more information.
editFileExtension(
id: string,
extension: string
);
deleteFile ^4.0.0
Deletes the specified file.
See the underlying endpoint for more information.
deleteFile(
id: string
);
deleteFiles ^4.0.0
Deletes the specified files.
See the underlying endpoint for more information.
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.
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.
getInstructions(
limit?: number,
offset?: number
);
getInstruction ^4.0.0
Fetches the specified instruction.
See the underlying endpoint for more information.
getInstruction(
id: string
);
createInstruction ^4.0.0
Creates an instruction.
See the underlying endpoint for more information.
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.
editInstructionName(
id: string,
name: string
);
editInstructionDescription ^4.0.0
Edits the description of the specified instruction.
See the underlying endpoint for more information.
editInstructionDescription(
id: string,
description: string
);
editInstructionFile ^4.0.0
Edits the file of the specified instruction.
See the underlying endpoint for more information.
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.
editInstructionSteps(
id: string,
steps: string[]
);
deleteInstruction ^4.0.0
Deletes the specified instruction.
See the underlying endpoint for more information.
deleteInstruction(
id: string
);
deleteInstructions ^4.0.0
Deletes the specified instructions.
See the underlying endpoint for more information.
deleteInstructions(
ids: string[]
);
getKillSwitches ^4.0.4
Fetches a list of kill switches.
See the underlying endpoint for more information.
getKillSwitches();
enableKillSwitch ^4.0.4
Enables the specified kill switch.
See the underlying endpoint for more information.
enableKillSwitch(
id: KillSwitches
);
disableKillSwitch ^4.0.4
Disables the specified kill switch.
See the underlying endpoint for more information.
disableKillSwitch(
id: KillSwitches
);
disableAllKillSwitches ^4.0.4
Disables all kill switches.
See the underlying endpoint for more information.
disableAllKillSwitches();
upload ^4.0.0
Uploads the provided data to Cumulonimbus.
upload(
data: string | Buffer | File | Blob | ArrayBuffer,
type?: string,
);