@haelp/teto
Version:
A typescript-based controllable TETR.IO client.
28 lines (27 loc) • 778 B
TypeScript
import { APIDefaults } from ".";
export type Res<T = any> = {
success: false;
error: {
msg: string;
[key: string]: any;
};
} | ({
success: true;
} & T);
export declare const basic: (defaults: APIDefaults) => {
get: <T = any>({ token, uri, headers, json }: {
token?: string | null;
uri: string;
headers?: Record<string, string>;
json?: boolean;
}) => Promise<Res<T>>;
post: <T = any>({ token, uri, body, headers, json }: {
token?: string;
uri: string;
body: Record<string, any>;
headers?: Record<string, string>;
json?: boolean;
}) => Promise<Res<T>>;
};
export type Get = ReturnType<typeof basic>["get"];
export type Post = ReturnType<typeof basic>["post"];