From 4121cae121f325b53e1b02934ccf6ba761997ef5 Mon Sep 17 00:00:00 2001 From: Derek Lawless Date: Mon, 4 Jan 2016 23:20:44 -0600 Subject: [PATCH] Initial creation of new gapi.auth2 types --- gapi.auth2/gapi.auth2.d.ts | 75 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 gapi.auth2/gapi.auth2.d.ts diff --git a/gapi.auth2/gapi.auth2.d.ts b/gapi.auth2/gapi.auth2.d.ts new file mode 100644 index 000000000..7da32c9a1 --- /dev/null +++ b/gapi.auth2/gapi.auth2.d.ts @@ -0,0 +1,75 @@ +// Type definitions for Google Sign-In API +// Project: https://developers.google.com/identity/sign-in/web/ +// Definitions by: Derek Lawless +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module gapi.auth2 { + + // TODO + export class GoogleAuth { + + } + + // TODO + export class GoogleUser { + + } + + export function init(params: { + /** + * The app's client ID, found and created in the Google Developers Console. + */ + client_id?: string; + + /** + * The domains for which to create sign-in cookies. Either a URI, single_host_origin, or none. + * Defaults to single_host_origin if unspecified. + */ + cookie_policy?: string; + + /** + * The scopes to request, as a space-delimited string. Optional if fetch_basic_profile is not set to false. + */ + scope?: string; + + /** + * Fetch users' basic profile information when they sign in. Adds 'profile' and 'email' to the requested scopes. True if unspecified. + */ + fetch_basic_profile?: boolean; + + /** + * The Google Apps domain to which users must belong to sign in. This is susceptible to modification by clients, + * so be sure to verify the hosted domain property of the returned user. Use GoogleUser.getHostedDomain() on the client, + * and the hd claim in the ID Token on the server to verify the domain is what you expected. + */ + hosted_domain?: string; + + /** + * Used only for OpenID 2.0 client migration. Set to the value of the realm that you are currently using for OpenID 2.0, + * as described in OpenID 2.0 (Migration) https://developers.google.com/accounts/docs/OpenID#openid-connect. + */ + openid_realm?: string; + }): GoogleAuth; + + // TODO + export function getAuthInstance(); +} + +declare module gapi.signin { + // TODO + export function render(id: any, options: { + /** + * The auth scope or scopes to authorize. Auth scopes for individual APIs can be found in their documentation. + */ + scope?: string; + width?: number; + height?: number; + longtitle?: boolean; + theme?: string; + onsuccess?: any; + onfailure?: any; + app_package_name?: string; + }); +}