DefinitelyTyped/types/gapi.client.proximitybeacon/gapi.client.proximitybeacon-tests.ts
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

187 lines
9.0 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('proximitybeacon', 'v1beta1', () => {
/** now we can use gapi.client.proximitybeacon */
/** 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 modify your beacons */
'https://www.googleapis.com/auth/userlocation.beacon.registry',
];
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() {
/**
* Given one or more beacon observations, returns any beacon information
* and attachments accessible to your application. Authorize by using the
* [API key](https://developers.google.com/beacons/proximity/get-started#request_a_browser_api_key)
* for the application.
*/
await gapi.client.beaconinfo.getforobserved({
});
/**
* Activates a beacon. A beacon that is active will return information
* and attachment data when queried via `beaconinfo.getforobserved`.
* Calling this method on an already active beacon will do nothing (but
* will return a successful response code).
*
* Authenticate using an [OAuth access token](https://developers.google.com/identity/protocols/OAuth2)
* from a signed-in user with &#42;&#42;Is owner&#42;&#42; or &#42;&#42;Can edit&#42;&#42; permissions in the
* Google Developers Console project.
*/
await gapi.client.beacons.activate({
beaconName: "beaconName",
projectId: "projectId",
});
/**
* Deactivates a beacon. Once deactivated, the API will not return
* information nor attachment data for the beacon when queried via
* `beaconinfo.getforobserved`. Calling this method on an already inactive
* beacon will do nothing (but will return a successful response code).
*
* Authenticate using an [OAuth access token](https://developers.google.com/identity/protocols/OAuth2)
* from a signed-in user with &#42;&#42;Is owner&#42;&#42; or &#42;&#42;Can edit&#42;&#42; permissions in the
* Google Developers Console project.
*/
await gapi.client.beacons.deactivate({
beaconName: "beaconName",
projectId: "projectId",
});
/**
* Decommissions the specified beacon in the service. This beacon will no
* longer be returned from `beaconinfo.getforobserved`. This operation is
* permanent -- you will not be able to re-register a beacon with this ID
* again.
*
* Authenticate using an [OAuth access token](https://developers.google.com/identity/protocols/OAuth2)
* from a signed-in user with &#42;&#42;Is owner&#42;&#42; or &#42;&#42;Can edit&#42;&#42; permissions in the
* Google Developers Console project.
*/
await gapi.client.beacons.decommission({
beaconName: "beaconName",
projectId: "projectId",
});
/**
* Deletes the specified beacon including all diagnostics data for the beacon
* as well as any attachments on the beacon (including those belonging to
* other projects). This operation cannot be undone.
*
* Authenticate using an [OAuth access token](https://developers.google.com/identity/protocols/OAuth2)
* from a signed-in user with &#42;&#42;Is owner&#42;&#42; or &#42;&#42;Can edit&#42;&#42; permissions in the
* Google Developers Console project.
*/
await gapi.client.beacons.delete({
beaconName: "beaconName",
projectId: "projectId",
});
/**
* Returns detailed information about the specified beacon.
*
* Authenticate using an [OAuth access token](https://developers.google.com/identity/protocols/OAuth2)
* from a signed-in user with &#42;&#42;viewer&#42;&#42;, &#42;&#42;Is owner&#42;&#42; or &#42;&#42;Can edit&#42;&#42;
* permissions in the Google Developers Console project.
*
* Requests may supply an Eddystone-EID beacon name in the form:
* `beacons/4!beaconId` where the `beaconId` is the base16 ephemeral ID
* broadcast by the beacon. The returned `Beacon` object will contain the
* beacon's stable Eddystone-UID. Clients not authorized to resolve the
* beacon's ephemeral Eddystone-EID broadcast will receive an error.
*/
await gapi.client.beacons.get({
beaconName: "beaconName",
projectId: "projectId",
});
/**
* Searches the beacon registry for beacons that match the given search
* criteria. Only those beacons that the client has permission to list
* will be returned.
*
* Authenticate using an [OAuth access token](https://developers.google.com/identity/protocols/OAuth2)
* from a signed-in user with &#42;&#42;viewer&#42;&#42;, &#42;&#42;Is owner&#42;&#42; or &#42;&#42;Can edit&#42;&#42;
* permissions in the Google Developers Console project.
*/
await gapi.client.beacons.list({
pageSize: 1,
pageToken: "pageToken",
projectId: "projectId",
q: "q",
});
/**
* Registers a previously unregistered beacon given its `advertisedId`.
* These IDs are unique within the system. An ID can be registered only once.
*
* Authenticate using an [OAuth access token](https://developers.google.com/identity/protocols/OAuth2)
* from a signed-in user with &#42;&#42;Is owner&#42;&#42; or &#42;&#42;Can edit&#42;&#42; permissions in the
* Google Developers Console project.
*/
await gapi.client.beacons.register({
projectId: "projectId",
});
/**
* Updates the information about the specified beacon. &#42;&#42;Any field that you do
* not populate in the submitted beacon will be permanently erased&#42;&#42;, so you
* should follow the "read, modify, write" pattern to avoid inadvertently
* destroying data.
*
* Changes to the beacon status via this method will be silently ignored.
* To update beacon status, use the separate methods on this API for
* activation, deactivation, and decommissioning.
* Authenticate using an [OAuth access token](https://developers.google.com/identity/protocols/OAuth2)
* from a signed-in user with &#42;&#42;Is owner&#42;&#42; or &#42;&#42;Can edit&#42;&#42; permissions in the
* Google Developers Console project.
*/
await gapi.client.beacons.update({
beaconName: "beaconName",
projectId: "projectId",
});
/**
* Lists all attachment namespaces owned by your Google Developers Console
* project. Attachment data associated with a beacon must include a
* namespaced type, and the namespace must be owned by your project.
*
* Authenticate using an [OAuth access token](https://developers.google.com/identity/protocols/OAuth2)
* from a signed-in user with &#42;&#42;viewer&#42;&#42;, &#42;&#42;Is owner&#42;&#42; or &#42;&#42;Can edit&#42;&#42;
* permissions in the Google Developers Console project.
*/
await gapi.client.namespaces.list({
projectId: "projectId",
});
/**
* Updates the information about the specified namespace. Only the namespace
* visibility can be updated.
*/
await gapi.client.namespaces.update({
namespaceName: "namespaceName",
projectId: "projectId",
});
/**
* Gets the Proximity Beacon API's current public key and associated
* parameters used to initiate the Diffie-Hellman key exchange required to
* register a beacon that broadcasts the Eddystone-EID format. This key
* changes periodically; clients may cache it and re-use the same public key
* to provision and register multiple beacons. However, clients should be
* prepared to refresh this key when they encounter an error registering an
* Eddystone-EID beacon.
*/
await gapi.client.v1beta1.getEidparams({
});
}
});