TypeScript typings for Retail API v2alpha
Cloud Retail service enables customers to build end-to-end personalized recommendation systems without requiring a high level of expertise in machine learning, recommendation system, or Google Cloud.
For detailed description please check documentation.
Installing
Install typings for Retail API:
npm install @types/gapi.client.retail-v2alpha --save-dev
Usage
You need to initialize Google API client in your code:
gapi.load('client', () => {
});
Then load api client wrapper:
gapi.client.load('https://retail.googleapis.com/$discovery/rest?version=v2alpha', () => {
});
gapi.client.load('retail', 'v2alpha', () => {
});
Don't forget to authenticate your client before sending any request to resources:
var client_id = '',
scope = [
'https://www.googleapis.com/auth/cloud-platform',
],
immediate = true;
gapi.auth.authorize(
{ client_id: client_id, scope: scope, immediate: immediate },
authResult => {
if (authResult && !authResult.error) {
} else {
}
});
After that you can use Retail API resources: