UNPKG

@haelp/teto

Version:

A typescript-based controllable TETR.IO client.

41 lines (40 loc) 1.27 kB
// export * as API from "./wrapper.mjs"; import { CONSTANTS } from "../constants.mjs"; import { basic } from "./basic.mjs"; import { channel } from "./channel.mjs"; import { relationship } from "./relationship.mjs"; import { rooms } from "./rooms.mjs"; import { server } from "./server.mjs"; import { users } from "./users.mjs"; export class API { defaults = { token: "", userAgent: CONSTANTS.userAgent, turnstile: null }; get; post; rooms; server; users; social; channel; /** @hideconstructor */ constructor(options = {}){ this.update(options); } update(options = {}) { Object.keys(options).forEach((key)=>{ this.defaults[key] = options[key]; }); const b = basic(this.defaults); this.get = b.get; this.post = b.post; this.rooms = rooms(this.get, this.post, this.defaults); this.server = server(this.get, this.post, this.defaults); this.users = users(this.get, this.post, this.defaults); this.social = relationship(this.get, this.post, this.defaults); this.channel = channel(this.get, this.post, this.defaults); } } export * as APITypes from "./wrapper.mjs"; //# sourceMappingURL=index.js.map