@ffflorian/xkcdjs
Version:
An xkcd API client with a CLI.
36 lines (35 loc) • 1.2 kB
TypeScript
import type { APIClient } from '@ffflorian/api-client';
import type { ClientOptions, RequestOptions, XKCDResultWithData } from './Interfaces';
export declare class XKCDAPI {
protected readonly apiClient: APIClient;
protected readonly options: ClientOptions;
private readonly JSON_INFO_FILE;
private readonly lowestIndex;
constructor(apiClient: APIClient, options: ClientOptions);
/**
* Get a comic by index.
* @param index Index number
* @param options Request options
*/
getByIndex(index: number, options: {
withData: true;
}): Promise<XKCDResultWithData>;
getByIndex(index: number, options?: RequestOptions): Promise<XKCDResultWithData>;
/**
* Get the latest comic.
* @param options Request options
*/
getLatest(options: {
withData: true;
}): Promise<XKCDResultWithData>;
getLatest(options?: RequestOptions): Promise<XKCDResultWithData>;
/**
* Get a random comic.
* @param options Request options
*/
getRandom(options: {
withData: true;
}): Promise<XKCDResultWithData>;
getRandom(options?: RequestOptions): Promise<XKCDResultWithData>;
private getImage;
}