-
Notifications
You must be signed in to change notification settings - Fork 68
/
index.d.ts
107 lines (92 loc) · 2.73 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
declare class Admin {
constructor(user: User);
createUser(email: string, password: string, attributes?: any): Promise<UserData>;
deleteUser(user: UserData): Promise<void>;
getUser(user: UserData): Promise<UserData>;
listUsers(aud: string): Promise<UserData[]>;
updateUser(user: UserData, attributes?: any): Promise<void>;
}
export interface GoTrueInit {
APIUrl?: string;
audience?: string;
setCookie?: boolean;
}
declare class GoTrue {
constructor(init?: GoTrueInit);
acceptInvite(token: string, password: string, remember?: boolean): Promise<User>;
acceptInviteExternalUrl(provider: string, token: string): string;
confirm(token: string, remember?: boolean): Promise<User>;
createUser(tokenResponse: any, remember?: boolean): Promise<User>;
currentUser(): User | null;
login(email: string, password: string, remember?: boolean): Promise<User>;
loginExternalUrl(provider: string): string;
recover(token: string, remember?: boolean): Promise<User>;
requestPasswordRecovery(email: string): Promise<void>;
settings(): Promise<Settings>;
signup(email: string, password: string, data?: any): Promise<User>;
verify(type: string, token: string, remember?: boolean): Promise<User>;
}
export interface Settings {
autoconfirm: boolean;
disable_signup: boolean;
external: {
bitbucket: boolean;
email: boolean;
facebook: boolean;
github: boolean;
gitlab: boolean;
google: boolean;
}
}
export interface Token {
access_token: string;
expires_at: number;
expires_in: number;
refresh_token: string;
token_type: 'bearer';
}
export declare class User implements UserData {
constructor(api: any, tokenResponse: any, audience: string);
static removeSavedSession(): void;
static recoverSession(api: any): User | null;
admin: Admin;
// Must be copied from UserData :(
app_metadata: any;
aud: string;
audience: string;
confirmed_at: string;
created_at: string;
email: string;
id: string;
role: string;
token: Token;
updated_at: string;
url: string;
user_metadata: any;
clearSession(): void;
getUserData(): Promise<UserData>;
jwt(forceRefresh?: boolean): Promise<string>;
logout(): Promise<void>;
tokenDetails(): Token;
update(attributes: any): Promise<User>;
}
export interface UserData {
app_metadata: any;
aud: string;
audience: string;
confirmed_at: string;
created_at: string;
email: string;
id: string;
role: string;
token: Token;
updated_at: string;
url: string;
user_metadata: any;
}
export default GoTrue;
declare global {
interface Window {
GoTrue: typeof GoTrue;
}
}