UNPKG

node-groupme

Version:

The only GroupMe API library that isn't a million years old.

79 lines 2.84 kB
import type { Client } from '..'; import { BaseManager, Collection, FormerGroupManager, Group } from '..'; declare type GroupCreateOptions = { name: string; type?: 'private' | 'closed'; description?: string; image_url?: string; share?: boolean; join_question?: string; requires_approval?: boolean; office_mode?: boolean; }; declare type FetchParams = { page?: number; per_page?: number; /** Whether to omit membership data from the response. * Recommended if dealing with very large groups. Defaults to false. */ omit_members?: boolean; }; interface GroupManagerInterface { client: Client; cache: Collection<string, Group>; former: FormerGroupManager; create(options: GroupCreateOptions): Promise<Group>; join(inviteLink: string): Promise<Group>; join(groupID: string, shareToken: string): Promise<Group>; fetch(): Promise<Collection<string, Group>>; fetch(id: string): Promise<Group>; fetch(ids: string[]): Promise<Collection<string, Group | null>>; fetch(options: FetchParams): Promise<Collection<string, Group | null>>; } export default class GroupManager extends BaseManager<Group, typeof Group> implements GroupManagerInterface { former: FormerGroupManager; constructor(client: Client); /** * Creates a group. * * @param options Options for creating a group. * @returns The created group. */ create(options: GroupCreateOptions): Promise<Group>; /** * Joins a group. * * @param inviteLink The group invite link. * @returns The joined group. */ join(inviteLink: string): Promise<Group>; /** * Joins a group. * * @param groupID The group ID. * @param shareToken The group's share token. * @returns The joined group. */ join(groupID: string, shareToken: string): Promise<Group>; private joinWithToken; /** * Fetches groups from the API. * * By default, this method fetches all groups that the client is in. * * Use `options.page` and `options.per_page` to specify a paginated section of groups to fetch. * Pass in one or an array of string IDs to specify specific group IDs to fetch. * * @param options Options for fetching groups. All groups are fetched if `page` and `per_page` are omitted. * @returns A Collection of groups that were fetched, or `client.groups.cache` if all groups were fetched. */ fetch(): Promise<Collection<string, Group>>; fetch(id: string): Promise<Group>; fetch(ids: string[]): Promise<Collection<string, Group | null>>; fetch(options: FetchParams): Promise<Collection<string, Group | null>>; private fetchId; private fetchIds; private fetchIndex; private fetchAll; } export {}; //# sourceMappingURL=GroupManager.d.ts.map