TypeScript typings for Vertex AI Search for Retail API v2alpha
Vertex AI Search for Retail API is made up of Retail Search, Browse and Recommendations. These discovery AI solutions help you implement personalized search, browse and recommendations, based on machine learning models, across your websites and mobile applications.
For detailed description please check documentation.
Installing
Install typings for Vertex AI Search 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 Vertex AI Search for Retail API resources:
await gapi.client.retail.projects.enrollSolution({project: 'project'});
await gapi.client.retail.projects.getAlertConfig({name: 'name'});
await gapi.client.retail.projects.getLoggingConfig({name: 'name'});
await gapi.client.retail.projects.getRetailProject({name: 'name'});
await gapi.client.retail.projects.listEnrolledSolutions({parent: 'parent'});
await gapi.client.retail.projects.updateAlertConfig({name: 'name'});
await gapi.client.retail.projects.updateLoggingConfig({name: 'name'});