4chan-ts
Version:
A typescript client wrapper for 4chan api
69 lines (68 loc) • 1.91 kB
TypeScript
import type { BoardList, Catalog, ThreadIndex } from './types';
export declare class FourChanClient {
private baseUrl;
private imageBaseUrl;
private thumbnailBaseUrl;
private $fetch;
/**
* Get a list of all boards
*/
getBoards(): Promise<{
data: BoardList;
error: null;
} | {
data: null;
error: {
message?: string | undefined;
status: number;
statusText: string;
};
}>;
/**
* Get a list of all threads+attributes on a board. Every thread is grouped by page
* @param board Board name (e.g., 'g', 'v', 'a', etc.)
*/
getCatalog(board: string): Promise<{
data: null;
error: {
message?: string | undefined;
status: number;
statusText: string;
};
} | {
data: Catalog;
error: null;
}>;
/**
* Get a representation of a single index page, which includes each thread on that specific page and the preview replies.
* @param board Board name (e.g., 'g', 'v', 'a', etc.)
* @param page Page number (e.g., 1, 2, 3, etc.)
**/
getIndexes(board: string, page: number): Promise<{
data: null;
error: {
message?: string | undefined;
status: number;
statusText: string;
};
} | {
data: ThreadIndex;
error: null;
}>;
/**
* Get a representation of a single OP and all the replies, which form a thread.
* @param board Board name (e.g., 'g', 'v', 'a', etc.)
* @param id Thread ID (e.g., 123456)
*/
getThread(board: string, id: number): Promise<{
data: null;
error: {
message?: string | undefined;
status: number;
statusText: string;
};
} | {
data: ThreadIndex;
error: null;
}>;
}