TypeScript typings for Merchant API accounts_v1beta
Programmatically manage your Merchant Center Accounts.
For detailed description please check documentation.
Installing
Install typings for Merchant API:
npm install @types/gapi.client.merchantapi-accounts_v1beta --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://merchantapi.googleapis.com/$discovery/rest?version=accounts_v1beta',
() => {
}
);
gapi.client.load('merchantapi', 'accounts_v1beta', () => {
});
Don't forget to authenticate your client before sending any request to resources:
var client_id = '',
scope = [
'https://www.googleapis.com/auth/content',
],
immediate = true;
gapi.auth.authorize(
{client_id: client_id, scope: scope, immediate: immediate},
authResult => {
if (authResult && !authResult.error) {
} else {
}
}
);
After that you can use Merchant API resources:
await gapi.client.merchantapi.accounts.createAndConfigure({});
await gapi.client.merchantapi.accounts.delete({name: 'name'});
await gapi.client.merchantapi.accounts.get({name: 'name'});
await gapi.client.merchantapi.accounts.getBusinessIdentity({name: 'name'});
await gapi.client.merchantapi.accounts.getBusinessInfo({name: 'name'});
await gapi.client.merchantapi.accounts.getHomepage({name: 'name'});
await gapi.client.merchantapi.accounts.getShippingSettings({name: 'name'});
await gapi.client.merchantapi.accounts.list({});
await gapi.client.merchantapi.accounts.listSubaccounts({provider: 'provider'});
await gapi.client.merchantapi.accounts.patch({name: 'name'});
await gapi.client.merchantapi.accounts.updateBusinessIdentity({name: 'name'});
await gapi.client.merchantapi.accounts.updateBusinessInfo({name: 'name'});
await gapi.client.merchantapi.accounts.updateHomepage({name: 'name'});
await gapi.client.merchantapi.termsOfService.accept({name: 'name'});
await gapi.client.merchantapi.termsOfService.get({name: 'name'});
await gapi.client.merchantapi.termsOfService.retrieveLatest({});