Triangle.js Docs
    Preparing search index...

    Class API

    Index

    Properties

    channel: { replay: (id: string) => Promise<any> }
    defaults: APIDefaults = ...
    get: <T = any>(
        __namedParameters: {
            headers?: Record<string, string>;
            json?: boolean;
            token?: string | null;
            uri: string;
        },
    ) => Promise<Res<T>>

    post

    post: <T = any>(
        __namedParameters: {
            body: Record<string, any>;
            headers?: Record<string, string>;
            json?: boolean;
            token?: string | null;
            uri: string;
        },
    ) => Promise<Res<T>>
    rooms: {
        list: () => Promise<Utils.APITypes.Rooms.Room[]>;
        menu: () => Promise<Utils.APITypes.Rooms.Room[]>;
    }
    server: {
        environment: () => Promise<Environment>;
        spool: (
            useSpools: boolean,
        ) => Promise<{ endpoint: string; host: string; token: string }>;
    }
    social: {
        block: (id: string) => Promise<true>;
        dms: (id: string) => Promise<DM[]>;
        friend: (id: string) => Promise<true>;
        unblock: (id: string) => Promise<boolean>;
        unfriend: (id: string) => Promise<boolean>;
    }

    Type Declaration

    • block: (id: string) => Promise<true>

      Block a user

    • dms: (id: string) => Promise<DM[]>
    • friend: (id: string) => Promise<true>

      Friend a user

    • unblock: (id: string) => Promise<boolean>

      Unblock a user. Note: unblocking a user will unfriend them if they are friended.

    • unfriend: (id: string) => Promise<boolean>

      Unfriend a user. Note: unfriending a user will unblock them if they are blocked.

    users: {
        authenticate: (
            username: string,
            password: string,
        ) => Promise<{ id: string; token: string }>;
        exists: (username: string) => Promise<boolean>;
        get: (
            options: { username: string } | { id: string },
        ) => Promise<Utils.APITypes.Users.User>;
        me: () => Promise<Me>;
        resolve: (username: string) => Promise<string>;
    }

    Type Declaration

    • authenticate: (username: string, password: string) => Promise<{ id: string; token: string }>
    • exists: (username: string) => Promise<boolean>

      Checks whether a user exists

    • get: (
          options: { username: string } | { id: string },
      ) => Promise<Utils.APITypes.Users.User>

      Get a user's profile

    • me: () => Promise<Me>
    • resolve: (username: string) => Promise<string>

      Resolves a username to a user ID

    Methods

    • Parameters

      Returns void