@chez14/mal-api-lite
Version:
MyAnimeList API client, Lite Version
30 lines (28 loc) • 951 B
TypeScript
interface RequestParam {
[key: string]: any;
}
/**
* Pagination parameters. Set the limit, offset, and requested fields.
*/
interface PaginatableRequestParam extends RequestParam {
limit?: number;
offset?: number;
/**
* List of fields, comma separated. If this option filled with array, it will
* automatically converted to comma-separated string.
*/
fields?: string | string[];
}
interface BaseRequester {
get<T = any>(resource: string, param?: RequestParam | PaginatableRequestParam): Promise<T>;
post<T = any>(resource: string, param?: RequestParam): Promise<T>;
patch<T = any>(resource: string, param?: RequestParam): Promise<T>;
delete<T = any>(resource: string): Promise<T>;
}
interface TokenResponse {
access_token: string;
refresh_token: string;
token_type: string;
expires_in: number;
}
export type { BaseRequester, PaginatableRequestParam, RequestParam, TokenResponse };