Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
export default class Hubkit {
export default class Hubkit<TParams extends Parameters = {}> {
static defaults: Options & {stats: Stats};
static Stats: StatsClass;
static readonly RETRY: unique symbol;
static readonly DONT_RETRY: unique symbol;

constructor(options?: Options);
defaultOptions: Options;
request(path: string, options?: Options): Promise<any>;
constructor(options?: Options & TParams);
defaultOptions: Options & TParams;
request(path: string, options?: Options & Parameters): Promise<any>;
graph(query: string, options?: Options & {variables?: Record<string, any>}): Promise<any>;
interpolate(string: string, options?: Record<string, any>);
scope(options: Options);
interpolate(string: string, options?: Parameters);
scope<Tsource extends Parameters>(options: Options & Tsource): Hubkit<TParams & Tsource>;
}

interface Options {
Expand Down Expand Up @@ -42,8 +42,6 @@ interface Options {
clientId?: string;
clientSecret?: string;

[key: string]: any;

onSend?(cause: 'initial' | 'retry' | 'page'): number; // returns timeout
onError?(error: Error & {
status?: number,
Expand All @@ -60,6 +58,10 @@ interface Options {
undefined | typeof Hubkit.RETRY | typeof Hubkit.DONT_RETRY | any;
}

interface Parameters {
[key: string]: any;
}

interface StatsClass {
new(): Stats;
}
Expand Down