UNPKG

1.55 kBTypeScriptView Raw
1import { AuthenticateRequest } from "./requests";
2import { NoticeService, TeamNoticeService, TeamService, TopicService, UserService } from "./services";
3export declare class NoticebordClient {
4 readonly token: string;
5 readonly baseUrl: string;
6 static readonly defaultBaseUrl = "https://noticebord.space/api";
7 /**
8 * @constructor
9 * @param {string} token Bearer token
10 * @param {string} baseUrl Base URL of the API
11 *
12 * @example
13 * const client = new NoticebordClient("token", "https://noticebord.space/api");
14 * client.fetchNotice(1).then(notice => {
15 * console.log(notice);
16 * });
17 *
18 * client.fetchNotices().then(notices => {
19 * console.table(notices);
20 * });
21 */
22 constructor(token?: string, baseUrl?: string);
23 /**
24 * Gets a bearer token from the API.
25 *
26 * @param {AuthenticateRequest} request The request to authenticate with.
27 * @param {string} baseUrl Base URL of the API
28 *
29 * @example
30 * const token = await NoticebordClient.getToken({
31 * email: "",
32 * password: "",
33 * deviceName: ""
34 * });
35 *
36 * const client = new NoticebordClient(token);
37 *
38 * client.users.fetchCurrentUser().then(user => {
39 * console.log(user);
40 * });
41 */
42 static getToken(request: AuthenticateRequest, baseUrl?: string): Promise<string>;
43 get notices(): NoticeService;
44 get teams(): TeamService;
45 get teamNotices(): TeamNoticeService;
46 get topics(): TopicService;
47 get users(): UserService;
48}