DefinitelyTyped/types/solid-auth-client/index.d.ts
James Durand acc0673552 Added arguments to solid-auth-client methods (#37603)
There are a few optional arguments that can be passed to
the client methods that aren't present in the types currently.
I've added them as they are in the 2.3.0 version of the client
the existing types say they target.
2019-08-14 11:33:25 -07:00

36 lines
1.2 KiB
TypeScript

// Type definitions for solid-auth-client 2.3
// Project: https://github.com/solid/solid-auth-client#readme
// Definitions by: Vincent <https://github.com/Vinnl>
// James <https://github.com/durandj>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import { EventEmitter } from 'events';
export interface Session {
webId: string;
}
export interface AsyncStorage {
getItem(key: string): Promise<undefined | string>;
setItem(key: string, value: string): Promise<void>;
removeItem(key: string): Promise<void>;
}
interface LoginOptions {
callbackUri?: string;
popupUri?: string;
storage?: Storage | AsyncStorage;
}
export interface SolidAuthClient extends EventEmitter {
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
currentSession(storage?: AsyncStorage): Promise<Session | undefined>;
trackSession(callback: (session?: Session) => void): void;
login(identityProvider: string, options?: LoginOptions): Promise<void>;
logout(storage?: AsyncStorage): Promise<void>;
popupLogin(params?: LoginOptions): Promise<Session>;
}
declare const instantiated: SolidAuthClient;
export default instantiated;