@types/gapi.client
- Version 1.0.8
- Published
- 10.8 kB
- No dependencies
- MIT license
Install
npm i @types/gapi.client
yarn add @types/gapi.client
pnpm add @types/gapi.client
Overview
TypeScript definitions for gapi.client
Index
Namespaces
namespace gapi
namespace gapi {}
function load
load: (api: string, callback: () => void) => void;
Pragmatically initialize gapi class member.
namespace gapi.auth
namespace gapi.auth {}
function authorize
authorize: ( params: { client_id?: string | undefined; immediate?: boolean | undefined; response_type?: string | undefined; scope?: string | string[] | undefined; }, callback: (authResult: GoogleApiOAuth2TokenObject) => void) => void;
Initiates the OAuth 2.0 authorization process. The browser displays a popup window prompting the user authenticate and authorize. After the user authorizes, the popup closes and the callback function fires.
Parameter params
A key/value map of parameters for the request. If the key is not one of the expected OAuth 2.0 parameters, it is added to the URI as a query parameter.
Parameter callback
The function to call once the login process is complete. The function takes an OAuth 2.0 token object as its only parameter.
function getToken
getToken: () => GoogleApiOAuth2TokenObject;
Retrieves the OAuth 2.0 token for the application. The OAuth 2.0 token.
function init
init: (callback: () => any) => void;
Initializes the authorization feature. Call this when the client loads to prevent popup blockers from blocking the auth window on gapi.auth.authorize calls.
Parameter callback
A callback to execute when the auth feature is ready to make authorization calls.
function setToken
setToken: (token: GoogleApiOAuth2TokenObject) => void;
Sets the OAuth 2.0 token for the application.
Parameter token
The token to set.
interface GoogleApiOAuth2TokenObject
interface GoogleApiOAuth2TokenObject {}
The OAuth 2.0 token object represents the OAuth 2.0 token and any associated data.
property access_token
access_token: string;
The OAuth 2.0 token. Only present in successful responses
property error
error: string;
Details about the error. Only present in error responses
property expires_in
expires_in: string;
The duration, in seconds, the token is valid for. Only present in successful responses
property state
state: string;
The Google API scopes related to this token
namespace gapi.client
namespace gapi.client {}
function load
load: { (name: string, version: string, callback: () => any): void; (name: string, version: string): Promise<void>;};
Loads the client library interface to a particular API. The new API interface will be in the form gapi.client.api.collection.method.
Parameter name
The name of the API to load.
Parameter version
The version of the API to load
Parameter callback
the function that is called once the API interface is loaded
function newBatch
newBatch: () => Batch<any>;
Creates a batch object for batching individual requests.
function request
request: (args: { path: string; method?: string | undefined; params?: any; headers?: any; body?: any;}) => Request<any>;
Creates a HTTP request for making RESTful requests. An object encapsulating the various arguments for this method.
function setApiKey
setApiKey: (apiKey: string) => void;
Sets the API key for the application.
Parameter apiKey
The API key to set
interface Batch
interface Batch<T> extends Promise<Response<ResponseMap<T>>> {}
Represents an HTTP Batch operation. Individual HTTP requests are added with the add method and the batch is executed using execute.
method add
add: <T>( request: Request<T>, opt_params?: { id: string; callback(individualResponse: Response<T>, rawBatchResponse: string): any; }) => void;
Adds a gapi.client.Request to the batch.
Parameter request
The HTTP request to add to this batch.
Parameter opt_params
extra parameters for this batch entry.
method execute
execute: ( callback: (responseMap: ResponseMap<T>, rawBatchResponse: string) => any) => void;
Executes all requests in the batch. The supplied callback is executed on success or failure.
Parameter callback
The callback to execute when the batch returns.
interface Request
interface Request<T> extends Promise<Response<T>> {}
An object encapsulating an HTTP request. This object is not instantiated directly, rather it is returned by gapi.client.request.
method execute
execute: (callback: (response: Response<T>) => any) => void;
Executes the request and runs the supplied callback on response.
Parameter callback
The callback function which executes when the request succeeds or fails.
interface Response
interface Response<T> {}
An object containing information about the HTTP response
property body
body: string;
property headers
headers?: { [headerName: string]: string } | undefined;
property result
result: T;
property status
status?: number | undefined;
property statusText
statusText?: string | undefined;
interface ResponseMap
interface ResponseMap<T> {}
index signature
[id: string]: Response<T>;
Package Files (1)
Dependencies (0)
No dependencies.
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/gapi.client
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/gapi.client)
- HTML<a href="https://www.jsdocs.io/package/@types/gapi.client"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 4046 ms. - Missing or incorrect documentation? Open an issue for this package.