forked from react-native-google-signin/google-signin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
163 lines (137 loc) · 4.02 KB
/
index.d.ts
File metadata and controls
163 lines (137 loc) · 4.02 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
// Type definitions for react-native-google-signin 1.0
// Project: https://github.com/react-native-community/react-native-google-signin
// Definitions by: Jacob Froman <https://github.com/j-fro>
// Michele Bombardi <https://github.com/bm-software>
// Christian Chown <https://github.com/christianchown>
// Eric Chen <https://github.com/echentw>
import * as React from 'react';
import { StyleProp, ViewProps, ViewStyle } from 'react-native';
export interface GoogleSigninButtonProps extends ViewProps {
style?: StyleProp<ViewStyle>;
size?: GoogleSigninButton.Size;
color?: GoogleSigninButton.Color;
disabled?: boolean;
onPress?(): void;
}
export class GoogleSigninButton extends React.Component<GoogleSigninButtonProps> {
constructor(props: GoogleSigninButtonProps);
}
export namespace GoogleSigninButton {
enum Size {
Standard,
Wide,
Icon,
}
enum Color {
Light,
Dark,
}
}
export interface HasPlayServicesParams {
/**
* When showPlayServicesUpdateDialog is true, the user will be prompted to
* install Play Services if on Android and they are not installed.
* Default is true
*/
showPlayServicesUpdateDialog?: boolean;
}
export interface ConfigureParams {
/**
* The Google API scopes to request access to. Default is email and profile.
*/
scopes?: string[];
/**
* Web client ID from Developer Console. Required for offline access
*/
webClientId?: string;
/**
* If you want to specify the client ID of type iOS
*/
iosClientId?: string;
/**
* Must be true if you wish to access user APIs on behalf of the user from
* your own server
*/
offlineAccess?: boolean;
/**
* Specifies a hosted domain restriction
*/
hostedDomain?: string;
/**
* iOS ONLY.[iOS] The user's ID, or email address, to be prefilled in the authentication UI if possible.
* https://developers.google.com/identity/sign-in/ios/api/interface_g_i_d_sign_in.html#a0a68c7504c31ab0b728432565f6e33fd
*/
loginHint?: string;
/**
* ANDROID ONLY. Specifies if the consent prompt should be shown at each login.
*/
forceConsentPrompt?: boolean;
/**
* ANDROID ONLY. An account name that should be prioritized.
*/
accountName?: string;
}
export interface User {
user: {
id: string | null;
name: string | null;
email: string | null;
photo: string | null;
familyName: string | null;
givenName: string | null;
};
scopes?: string[];
idToken: string | null;
accessToken: string | null;
/**
* Deprecated
*/
accessTokenExpirationDate: number | null;
/**
* Not null only if a valid webClientId and offlineAccess: true was
* specified in configure().
*/
serverAuthCode: string | null;
}
export namespace GoogleSignin {
/**
* Check if the device has Google Play Services installed. Always resolves
* true on iOS
*/
function hasPlayServices(params?: HasPlayServicesParams): Promise<boolean>;
/**
* Configures the library for login. MUST be called before attempting login
*/
function configure(params?: ConfigureParams): void;
/**
* Returns a Promise that resolves with the current signed in user or rejects
* if not signed in.
*/
function signInSilently(): Promise<User>;
/**
* Prompts the user to sign in with their Google account. Resolves with the
* user if successful.
*/
function signIn(): Promise<User>;
/**
* Signs the user out.
*/
function signOut(): Promise<void>;
/**
* Removes your application from the user's authorized applications
*/
function revokeAccess(): Promise<void>;
/**
* Returns whether the user is currently signed in
*/
function isSignedIn(): Promise<boolean>;
function getCurrentUser(): Promise<User | null>;
function clearCachedToken(token: string): Promise<void>;
function getTokens(): Promise<{ idToken: string; accessToken: string }>;
}
export const statusCodes: {
SIGN_IN_CANCELLED: string;
IN_PROGRESS: string;
PLAY_SERVICES_NOT_AVAILABLE: string;
SIGN_IN_REQUIRED: string;
};