mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
38 lines
1.5 KiB
TypeScript
38 lines
1.5 KiB
TypeScript
|
|
/* This is stub file for gapi.client.{{=it.name}} definition tests */
|
||
|
|
/* IMPORTANT.
|
||
|
|
* This file was automatically generated by https://github.com/Bolisov/google-api-typings-generator. Please do not edit it manually.
|
||
|
|
* In case of any problems please post issue to https://github.com/Bolisov/google-api-typings-generator
|
||
|
|
**/
|
||
|
|
gapi.load('client', () => {
|
||
|
|
/** now we can use gapi.client */
|
||
|
|
gapi.client.load('vision', 'v1', () => {
|
||
|
|
/** now we can use gapi.client.vision */
|
||
|
|
|
||
|
|
/** don't forget to authenticate your client before sending any request to resources: */
|
||
|
|
/** declare client_id registered in Google Developers Console */
|
||
|
|
const client_id = '<<PUT YOUR CLIENT ID HERE>>';
|
||
|
|
const scope = [
|
||
|
|
/** View and manage your data across Google Cloud Platform services */
|
||
|
|
'https://www.googleapis.com/auth/cloud-platform',
|
||
|
|
/** Apply machine learning models to understand and label images */
|
||
|
|
'https://www.googleapis.com/auth/cloud-vision',
|
||
|
|
];
|
||
|
|
const immediate = true;
|
||
|
|
gapi.auth.authorize({ client_id, scope, immediate }, authResult => {
|
||
|
|
if (authResult && !authResult.error) {
|
||
|
|
/** handle succesfull authorization */
|
||
|
|
run();
|
||
|
|
} else {
|
||
|
|
/** handle authorization error */
|
||
|
|
}
|
||
|
|
});
|
||
|
|
run();
|
||
|
|
});
|
||
|
|
|
||
|
|
async function run() {
|
||
|
|
/** Run image detection and annotation for a batch of images. */
|
||
|
|
await gapi.client.images.annotate({
|
||
|
|
});
|
||
|
|
}
|
||
|
|
});
|