noticebord-client
Version:
The official Typescript client library for the Noticebord API.
49 lines (48 loc) • 1.55 kB
TypeScript
import { AuthenticateRequest } from "./requests";
import { NoticeService, TeamNoticeService, TeamService, TopicService, UserService } from "./services";
export declare class NoticebordClient {
readonly token: string;
readonly baseUrl: string;
static readonly defaultBaseUrl = "https://noticebord.space/api";
/**
* @constructor
* @param {string} token Bearer token
* @param {string} baseUrl Base URL of the API
*
* @example
* const client = new NoticebordClient("token", "https://noticebord.space/api");
* client.fetchNotice(1).then(notice => {
* console.log(notice);
* });
*
* client.fetchNotices().then(notices => {
* console.table(notices);
* });
*/
constructor(token?: string, baseUrl?: string);
/**
* Gets a bearer token from the API.
*
* @param {AuthenticateRequest} request The request to authenticate with.
* @param {string} baseUrl Base URL of the API
*
* @example
* const token = await NoticebordClient.getToken({
* email: "",
* password: "",
* deviceName: ""
* });
*
* const client = new NoticebordClient(token);
*
* client.users.fetchCurrentUser().then(user => {
* console.log(user);
* });
*/
static getToken(request: AuthenticateRequest, baseUrl?: string): Promise<string>;
get notices(): NoticeService;
get teams(): TeamService;
get teamNotices(): TeamNoticeService;
get topics(): TopicService;
get users(): UserService;
}