-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.d.ts
84 lines (74 loc) · 2.45 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
// Type definitions for react-google-contacts v0.0.1
// Project: https://github.com/kwent/react-google-contacts
// Definitions by: Ruslan Ibragimov <https://github.com/IRus>
import {Component, ReactNode, CSSProperties} from 'react';
export as namespace ReactGoogleContacts;
interface AuthResponse {
readonly access_token: string;
readonly id_token: string;
readonly login_hint: string;
readonly expires_in: number;
readonly first_issued_at: number;
readonly expires_at: number;
}
interface BasicProfile {
getId(): string;
getEmail(): string;
getName(): string;
getGivenName(): string;
getFamilyName(): string;
getImageUrl(): string;
}
// Based on https://developers.google.com/identity/sign-in/web/reference
export interface GoogleContactsResponse {
getBasicProfile(): BasicProfile;
getAuthResponse(): AuthResponse;
getGrantedScopes(): string;
getHostedDomain(): string;
getId(): string;
hasGrantedScopes(scopes: string): boolean;
disconnect(): void;
grantOfflineAccess(options: GrantOfflineAccessOptions): Promise<GoogleContactsResponseOffline>;
signIn(options: SignInOptions): Promise<any>;
grant(options: SignInOptions): Promise<any>;
}
interface GrantOfflineAccessOptions {
readonly redirect_uri?: string;
}
interface SignInOptions {
readonly app_package_name?: string;
readonly fetch_basic_profile?: boolean;
readonly prompt?: string;
}
export interface GoogleContactsResponseOffline {
readonly code: string;
}
export interface GoogleContactsProps {
readonly onSuccess: (response: GoogleContactsResponse | GoogleContactsResponseOffline) => void,
readonly onFailure: (error: any) => void,
readonly clientId: string,
readonly jsSrc?: string,
readonly onRequest?: () => void,
readonly buttonText?: string,
readonly className?: string,
readonly redirectUri?: string,
readonly cookiePolicy?: string,
readonly loginHint?: string,
readonly hostedDomain?: string,
readonly prompt?: string,
readonly responseType?: string,
readonly children?: ReactNode,
readonly style?: CSSProperties,
readonly tag?: string,
readonly disabled?: boolean;
readonly uxMode?: string;
readonly disabledStyle?: CSSProperties;
readonly type?: string;
readonly accessType?: string;
readonly maxResults?: number;
readonly render?: (props?: { onClick: () => void }) => JSX.Element;
}
export class GoogleContacts extends Component<GoogleContactsProps, {}> {
public signIn(e?: Event): void;
}
export default GoogleContacts;