universal-github-client
Version:
A Github API Client for the browser and Node
29 lines (28 loc) • 999 B
TypeScript
export interface IndexedList<T> {
[x: string]: T;
}
export interface IGithubClient {
readonly base: string;
readonly token: string;
readonly fetch: (url: string, options?: IndexedList<any>) => Promise<any>;
}
export interface IGithubClientOptions {
readonly path: string;
readonly method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
readonly data: any;
}
export declare class GitHubClient {
token: string;
fetch: any;
private base;
private credentials;
private headers;
constructor({ base, token, fetch }: IGithubClient);
get({ path }: Pick<IGithubClientOptions, 'path'>): Promise<any>;
delete({ path }: Pick<IGithubClientOptions, 'path'>): Promise<any>;
post({ path, data }: Omit<IGithubClientOptions, 'method'>): Promise<any>;
put({ path, data }: Omit<IGithubClientOptions, 'method'>): Promise<any>;
patch({ path, data }: Omit<IGithubClientOptions, 'method'>): Promise<any>;
private call;
}
export default GitHubClient;