Files
Alexey Bolisov 4f8a3d571b Add Google APIs typings (#19083)
* Add Google APIs typings

* [gapi.cliebt.* ] Add version as part of typings name and fix gapi.client tslint errors

* versions should not get their own folders
fixing a few typos
using /** syntax so comments show up in editors
export only actual (last) version for now

* export only actual (last) version for now

* merge namespaces and remove unnecessary namespace qualifiers

* remove namespace qualifier for gapi.client.Request from nested namespaces and change Request base interface to Promise

* disable await-promise rule

* fix collision between gapi.client.Request and Request from nested namespace
disable no-irregular-whitespace rule

* sort properties and namespace resources

* remove empty comments
sort resources amd methods in tests and readme.md

* update 'this is autogenerated file' banner to remove this text from gapi.client namespace hint
use multiline comments when comment has several lines

* implement no-trailing-whitespace, no-padding, max-line-length, await-promise, no-irregular-whitespace rules

* add strictFunctionTypes to tsconfig

* fix "Whitespace within parentheses is not allowed" rule

* fix ts-lint rules

* fixes

* remove deprecated replicapool and replicapoolupdater api

* fix no-irregular-whitespace

* fix no-irregular-whitespace
2017-10-09 14:55:04 -07:00
..
…

TypeScript typings for Enterprise Apps Reseller API v1

Creates and manages your customers and their subscriptions. For detailed description please check documentation.

Installing

Install typings for Enterprise Apps Reseller API:

npm install @types/gapi.client.reseller@v1 --save-dev

Usage

You need to initialize Google API client in your code:

gapi.load("client", () => { 
    // now we can use gapi.client
    // ... 
});

Then load api client wrapper:

gapi.client.load('reseller', 'v1', () => {
    // now we can use gapi.client.reseller
    // ... 
});

Don't forget to authenticate your client before sending any request to resources:


// declare client_id registered in Google Developers Console
var client_id = '',
    scope = [     
        // Manage users on your domain
        'https://www.googleapis.com/auth/apps.order',
    
        // Manage users on your domain
        'https://www.googleapis.com/auth/apps.order.readonly',
    ],
    immediate = true;
// ...

gapi.auth.authorize({ client_id: client_id, scope: scope, immediate: immediate }, authResult => {
    if (authResult && !authResult.error) {
        /* handle succesfull authorization */
    } else {
        /* handle authorization error */
    }
});            

After that you can use Enterprise Apps Reseller API resources:

    
/* 
Get a customer account.  
*/
await gapi.client.customers.get({ customerId: "customerId",  }); 
    
/* 
Order a new customer's account.  
*/
await gapi.client.customers.insert({  }); 
    
/* 
Update a customer account's settings. This method supports patch semantics.  
*/
await gapi.client.customers.patch({ customerId: "customerId",  }); 
    
/* 
Update a customer account's settings.  
*/
await gapi.client.customers.update({ customerId: "customerId",  }); 
    
/* 
Returns all the details of the watch corresponding to the reseller.  
*/
await gapi.client.resellernotify.getwatchdetails({  }); 
    
/* 
Registers a Reseller for receiving notifications.  
*/
await gapi.client.resellernotify.register({  }); 
    
/* 
Unregisters a Reseller for receiving notifications.  
*/
await gapi.client.resellernotify.unregister({  }); 
    
/* 
Activates a subscription previously suspended by the reseller  
*/
await gapi.client.subscriptions.activate({ customerId: "customerId", subscriptionId: "subscriptionId",  }); 
    
/* 
Update a subscription plan. Use this method to update a plan for a 30-day trial or a flexible plan subscription to an annual commitment plan with monthly or yearly payments.  
*/
await gapi.client.subscriptions.changePlan({ customerId: "customerId", subscriptionId: "subscriptionId",  }); 
    
/* 
Update a user license's renewal settings. This is applicable for accounts with annual commitment plans only.  
*/
await gapi.client.subscriptions.changeRenewalSettings({ customerId: "customerId", subscriptionId: "subscriptionId",  }); 
    
/* 
Update a subscription's user license settings.  
*/
await gapi.client.subscriptions.changeSeats({ customerId: "customerId", subscriptionId: "subscriptionId",  }); 
    
/* 
Cancel, suspend or transfer a subscription to direct.  
*/
await gapi.client.subscriptions.delete({ customerId: "customerId", deletionType: "deletionType", subscriptionId: "subscriptionId",  }); 
    
/* 
Get a specific subscription.  
*/
await gapi.client.subscriptions.get({ customerId: "customerId", subscriptionId: "subscriptionId",  }); 
    
/* 
Create or transfer a subscription.  
*/
await gapi.client.subscriptions.insert({ customerId: "customerId",  }); 
    
/* 
List of subscriptions managed by the reseller. The list can be all subscriptions, all of a customer's subscriptions, or all of a customer's transferable subscriptions.  
*/
await gapi.client.subscriptions.list({  }); 
    
/* 
Immediately move a 30-day free trial subscription to a paid service subscription.  
*/
await gapi.client.subscriptions.startPaidService({ customerId: "customerId", subscriptionId: "subscriptionId",  }); 
    
/* 
Suspends an active subscription.  
*/
await gapi.client.subscriptions.suspend({ customerId: "customerId", subscriptionId: "subscriptionId",  });