clik
Version:
20 lines (15 loc) • 679 B
TypeScript
export namespace ClikIO {
export type TokenType = 'Bearer' | 'ApiKey';
export type Client<T> = (method: string, pathname: string, body?: any) => Promise<T>;
export interface Link {
uid: string;
href: string;
created_at: number;
updated_at: number | null;
}
}
export function setup(token: string, type?: TokenType): ClikIO.Client;
export function list(client: ClikIO.Client): Promise<Link[]>;
export function exists(client: ClikIO.Client, uid: string): Promise<boolean>;
export function update(client: ClikIO.Client, uid: string, href: string): Promise<ClikIO.Link>;
export function create(client: ClikIO.Client, href: string, uid?: string): Promise<ClikIO.Link>;