OLD | NEW |
1 // DO NOT EDIT: auto-generated with `pub run custom_element_apigen:update` | 1 // DO NOT EDIT: auto-generated with `pub run custom_element_apigen:update` |
2 | 2 |
3 /// Dart API for the polymer element `google_signin_aware`. | 3 /// Dart API for the polymer element `google_signin_aware`. |
4 @HtmlImport('google_signin_aware_nodart.html') | 4 @HtmlImport('google_signin_aware_nodart.html') |
5 library polymer_elements.lib.src.google_signin.google_signin_aware; | 5 library polymer_elements.lib.src.google_signin.google_signin_aware; |
6 | 6 |
7 import 'dart:html'; | 7 import 'dart:html'; |
8 import 'dart:js' show JsArray, JsObject; | 8 import 'dart:js' show JsArray, JsObject; |
9 import 'package:web_components/web_components.dart'; | 9 import 'package:web_components/web_components.dart'; |
10 import 'package:polymer_interop/polymer_interop.dart'; | 10 import 'package:polymer_interop/polymer_interop.dart'; |
11 import 'google_js_api.dart'; | 11 import 'google_js_api.dart'; |
12 | 12 |
13 /// `google-signin-aware` is used to enable authentication in custom elements by | 13 /// `google-signin-aware` is used to enable authentication in custom elements by |
14 /// interacting with a google-signin element that needs to be present somewhere | 14 /// interacting with a google-signin element that needs to be present somewhere |
15 /// on the page. | 15 /// on the page. |
16 /// | 16 /// |
17 /// The `scopes` attribute allows you to specify which scope permissions are req
uired | 17 /// The `scopes` attribute allows you to specify which scope permissions are req
uired |
18 /// (e.g do you want to allow interaction with the Google Drive API). | 18 /// (e.g do you want to allow interaction with the Google Drive API). |
19 /// | 19 /// |
20 /// The `google-signin-aware-success` event is triggered when a user successfull
y | 20 /// The `google-signin-aware-success` event is triggered when a user successfull
y |
21 /// authenticates. The `google-signin-aware-signed-out` event is triggered | 21 /// authenticates. If either `offline` or `offlineAlwaysPrompt` is set to true,
successful |
22 /// when a user explicitely signs out via the google-signin element. | 22 /// authentication will also trigger the `google-signin-offline-success`event. |
| 23 /// The `google-signin-aware-signed-out` event is triggered when a user explicit
ly |
| 24 /// signs out via the google-signin element. |
23 /// | 25 /// |
24 /// You can bind to `isAuthorized` property to monitor authorization state. | 26 /// You can bind to `isAuthorized` property to monitor authorization state. |
25 /// ##### Example | 27 /// ##### Example |
26 /// | 28 /// |
27 /// <google-signin-aware scopes="https://www.googleapis.com/auth/drive"></go
ogle-signin-aware> | 29 /// <google-signin-aware scopes="https://www.googleapis.com/auth/drive"></go
ogle-signin-aware> |
| 30 /// |
| 31 /// |
| 32 /// ##### Example with offline |
| 33 /// <template id="awareness" is="dom-bind"> |
| 34 /// <google-signin-aware |
| 35 /// scopes="https://www.googleapis.com/auth/drive" |
| 36 /// offline |
| 37 /// on-google-signin-aware-success="handleSignin" |
| 38 /// on-google-signin-offline-success="handleOffline"></google-signin-a
ware> |
| 39 /// <\/template> |
| 40 /// <script> |
| 41 /// var aware = document.querySelector('#awareness'); |
| 42 /// aware.handleSignin = function(response) { |
| 43 /// var user = gapi.auth2.getAuthInstance().currentUser.get(); |
| 44 /// console.log('User name: ' + user.getBasicProfile().getName()); |
| 45 /// }; |
| 46 /// aware.handleOffline = function(response) { |
| 47 /// console.log('Offline code received: ' + response.detail.code); |
| 48 /// // Here you would POST response.detail.code to your webserver, which
can |
| 49 /// // exchange the authorization code for an access token. More info at
: |
| 50 /// // https://developers.google.com/identity/protocols/OAuth2WebServer |
| 51 /// }; |
| 52 /// <\/script> |
28 @CustomElementProxy('google-signin-aware') | 53 @CustomElementProxy('google-signin-aware') |
29 class GoogleSigninAware extends HtmlElement with CustomElementProxyMixin, Polyme
rBase { | 54 class GoogleSigninAware extends HtmlElement with CustomElementProxyMixin, Polyme
rBase { |
30 GoogleSigninAware.created() : super.created(); | 55 GoogleSigninAware.created() : super.created(); |
31 factory GoogleSigninAware() => new Element.tag('google-signin-aware'); | 56 factory GoogleSigninAware() => new Element.tag('google-signin-aware'); |
32 | 57 |
33 /// App package name for android over-the-air installs. | 58 /// App package name for android over-the-air installs. |
34 /// See the relevant [docs](https://developers.google.com/+/web/signin/android
-app-installs) | 59 /// See the relevant [docs](https://developers.google.com/+/web/signin/android
-app-installs) |
35 String get appPackageName => jsElement[r'appPackageName']; | 60 String get appPackageName => jsElement[r'appPackageName']; |
36 set appPackageName(String value) { jsElement[r'appPackageName'] = value; } | 61 set appPackageName(String value) { jsElement[r'appPackageName'] = value; } |
37 | 62 |
38 /// a Google Developers clientId reference | 63 /// a Google Developers clientId reference |
39 String get clientId => jsElement[r'clientId']; | 64 String get clientId => jsElement[r'clientId']; |
40 set clientId(String value) { jsElement[r'clientId'] = value; } | 65 set clientId(String value) { jsElement[r'clientId'] = value; } |
41 | 66 |
42 /// The cookie policy defines what URIs have access to the session cookie | 67 /// The cookie policy defines what URIs have access to the session cookie |
43 /// remembering the user's sign-in state. | 68 /// remembering the user's sign-in state. |
44 /// See the relevant [docs](https://developers.google.com/+/web/signin/referen
ce#determining_a_value_for_cookie_policy) for more information. | 69 /// See the relevant [docs](https://developers.google.com/+/web/signin/referen
ce#determining_a_value_for_cookie_policy) for more information. |
45 String get cookiePolicy => jsElement[r'cookiePolicy']; | 70 String get cookiePolicy => jsElement[r'cookiePolicy']; |
46 set cookiePolicy(String value) { jsElement[r'cookiePolicy'] = value; } | 71 set cookiePolicy(String value) { jsElement[r'cookiePolicy'] = value; } |
47 | 72 |
48 /// True if *any* element has google+ scopes | 73 /// True if *any* element has google+ scopes |
49 bool get hasPlusScopes => jsElement[r'hasPlusScopes']; | 74 bool get hasPlusScopes => jsElement[r'hasPlusScopes']; |
50 set hasPlusScopes(bool value) { jsElement[r'hasPlusScopes'] = value; } | 75 set hasPlusScopes(bool value) { jsElement[r'hasPlusScopes'] = value; } |
51 | 76 |
| 77 /// The Google Apps domain to which users must belong to sign in. |
| 78 /// See the relevant [docs](https://developers.google.com/identity/sign-in/web
/reference) for more information. |
| 79 String get hostedDomain => jsElement[r'hostedDomain']; |
| 80 set hostedDomain(String value) { jsElement[r'hostedDomain'] = value; } |
| 81 |
52 /// True if authorizations for *this* element have been granted | 82 /// True if authorizations for *this* element have been granted |
53 bool get isAuthorized => jsElement[r'isAuthorized']; | 83 bool get isAuthorized => jsElement[r'isAuthorized']; |
54 set isAuthorized(bool value) { jsElement[r'isAuthorized'] = value; } | 84 set isAuthorized(bool value) { jsElement[r'isAuthorized'] = value; } |
55 | 85 |
56 /// True if additional authorizations for *any* element are required | 86 /// True if additional authorizations for *any* element are required |
57 bool get needAdditionalAuth => jsElement[r'needAdditionalAuth']; | 87 bool get needAdditionalAuth => jsElement[r'needAdditionalAuth']; |
58 set needAdditionalAuth(bool value) { jsElement[r'needAdditionalAuth'] = value;
} | 88 set needAdditionalAuth(bool value) { jsElement[r'needAdditionalAuth'] = value;
} |
59 | 89 |
| 90 /// Allows for offline `access_token` retrieval during the signin process. |
| 91 /// See also `offlineAlwaysPrompt`. You only need to set one of the two; if bo
th |
| 92 /// are set, the behavior of `offlineAlwaysPrompt` will override `offline`. |
| 93 bool get offline => jsElement[r'offline']; |
| 94 set offline(bool value) { jsElement[r'offline'] = value; } |
| 95 |
| 96 /// Works the same as `offline` with the addition that it will always |
| 97 /// force a re-prompt to the user, guaranteeing that you will get a |
| 98 /// refresh_token even if the user has already granted offline access to |
| 99 /// this application. You only need to set one of `offline` or |
| 100 /// `offlineAlwaysPrompt`, not both. |
| 101 bool get offlineAlwaysPrompt => jsElement[r'offlineAlwaysPrompt']; |
| 102 set offlineAlwaysPrompt(bool value) { jsElement[r'offlineAlwaysPrompt'] = valu
e; } |
| 103 |
60 /// The app activity types you want to write on behalf of the user | 104 /// The app activity types you want to write on behalf of the user |
61 /// (e.g http://schemas.google.com/AddActivity) | 105 /// (e.g http://schemas.google.com/AddActivity) |
62 String get requestVisibleActions => jsElement[r'requestVisibleActions']; | 106 String get requestVisibleActions => jsElement[r'requestVisibleActions']; |
63 set requestVisibleActions(String value) { jsElement[r'requestVisibleActions']
= value; } | 107 set requestVisibleActions(String value) { jsElement[r'requestVisibleActions']
= value; } |
64 | 108 |
65 /// The scopes to provide access to (e.g https://www.googleapis.com/auth/drive
) | 109 /// The scopes to provide access to (e.g https://www.googleapis.com/auth/drive
) |
66 /// and should be space-delimited. | 110 /// and should be space-delimited. |
67 String get scopes => jsElement[r'scopes']; | 111 String get scopes => jsElement[r'scopes']; |
68 set scopes(String value) { jsElement[r'scopes'] = value; } | 112 set scopes(String value) { jsElement[r'scopes'] = value; } |
69 | 113 |
70 /// True if user is signed in | 114 /// True if user is signed in |
71 bool get signedIn => jsElement[r'signedIn']; | 115 bool get signedIn => jsElement[r'signedIn']; |
72 set signedIn(bool value) { jsElement[r'signedIn'] = value; } | 116 set signedIn(bool value) { jsElement[r'signedIn'] = value; } |
73 | 117 |
74 /// pops up the authorization dialog | 118 /// pops up the authorization dialog |
75 signIn() => | 119 signIn() => |
76 jsElement.callMethod('signIn', []); | 120 jsElement.callMethod('signIn', []); |
77 | 121 |
78 /// signs user out | 122 /// signs user out |
79 signOut() => | 123 signOut() => |
80 jsElement.callMethod('signOut', []); | 124 jsElement.callMethod('signOut', []); |
81 } | 125 } |
OLD | NEW |