DefinitelyTyped/types/gapi.client.books/gapi.client.books-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

194 lines
7.1 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('books', 'v1', () => {
/** now we can use gapi.client.books */
/** 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 = [
/** Manage your books */
'https://www.googleapis.com/auth/books',
];
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() {
/** Retrieves metadata for a specific bookshelf for the specified user. */
await gapi.client.bookshelves.get({
shelf: "shelf",
source: "source",
userId: "userId",
});
/** Retrieves a list of public bookshelves for the specified user. */
await gapi.client.bookshelves.list({
source: "source",
userId: "userId",
});
await gapi.client.cloudloading.addBook({
drive_document_id: "drive_document_id",
mime_type: "mime_type",
name: "name",
upload_client_token: "upload_client_token",
});
/** Remove the book and its contents */
await gapi.client.cloudloading.deleteBook({
volumeId: "volumeId",
});
await gapi.client.cloudloading.updateBook({
});
/** Returns a list of offline dictionary metadata available */
await gapi.client.dictionary.listOfflineMetadata({
cpksver: "cpksver",
});
/** Gets the layer summary for a volume. */
await gapi.client.layers.get({
contentVersion: "contentVersion",
source: "source",
summaryId: "summaryId",
volumeId: "volumeId",
});
/** List the layer summaries for a volume. */
await gapi.client.layers.list({
contentVersion: "contentVersion",
maxResults: 2,
pageToken: "pageToken",
source: "source",
volumeId: "volumeId",
});
/** Gets the current settings for the user. */
await gapi.client.myconfig.getUserSettings({
});
/** Release downloaded content access restriction. */
await gapi.client.myconfig.releaseDownloadAccess({
cpksver: "cpksver",
locale: "locale",
source: "source",
volumeIds: "volumeIds",
});
/** Request concurrent and download access restrictions. */
await gapi.client.myconfig.requestAccess({
cpksver: "cpksver",
licenseTypes: "licenseTypes",
locale: "locale",
nonce: "nonce",
source: "source",
volumeId: "volumeId",
});
/** Request downloaded content access for specified volumes on the My eBooks shelf. */
await gapi.client.myconfig.syncVolumeLicenses({
cpksver: "cpksver",
features: "features",
includeNonComicsSeries: true,
locale: "locale",
nonce: "nonce",
showPreorders: true,
source: "source",
volumeIds: "volumeIds",
});
/**
* Sets the settings for the user. If a sub-object is specified, it will overwrite the existing sub-object stored in the server. Unspecified sub-objects
* will retain the existing value.
*/
await gapi.client.myconfig.updateUserSettings({
});
/** Returns notification details for a given notification id. */
await gapi.client.notification.get({
locale: "locale",
notification_id: "notification_id",
source: "source",
});
/** List categories for onboarding experience. */
await gapi.client.onboarding.listCategories({
locale: "locale",
});
/** List available volumes under categories for onboarding experience. */
await gapi.client.onboarding.listCategoryVolumes({
categoryId: "categoryId",
locale: "locale",
maxAllowedMaturityRating: "maxAllowedMaturityRating",
pageSize: 4,
pageToken: "pageToken",
});
/** Returns a stream of personalized book clusters */
await gapi.client.personalizedstream.get({
locale: "locale",
maxAllowedMaturityRating: "maxAllowedMaturityRating",
source: "source",
});
await gapi.client.promooffer.accept({
androidId: "androidId",
device: "device",
manufacturer: "manufacturer",
model: "model",
offerId: "offerId",
product: "product",
serial: "serial",
volumeId: "volumeId",
});
await gapi.client.promooffer.dismiss({
androidId: "androidId",
device: "device",
manufacturer: "manufacturer",
model: "model",
offerId: "offerId",
product: "product",
serial: "serial",
});
/** Returns a list of promo offers available to the user */
await gapi.client.promooffer.get({
androidId: "androidId",
device: "device",
manufacturer: "manufacturer",
model: "model",
product: "product",
serial: "serial",
});
/** Returns Series metadata for the given series ids. */
await gapi.client.series.get({
series_id: "series_id",
});
/** Gets volume information for a single volume. */
await gapi.client.volumes.get({
country: "country",
includeNonComicsSeries: true,
partner: "partner",
projection: "projection",
source: "source",
user_library_consistent_read: true,
volumeId: "volumeId",
});
/** Performs a book search. */
await gapi.client.volumes.list({
download: "download",
filter: "filter",
langRestrict: "langRestrict",
libraryRestrict: "libraryRestrict",
maxAllowedMaturityRating: "maxAllowedMaturityRating",
maxResults: 6,
orderBy: "orderBy",
partner: "partner",
printType: "printType",
projection: "projection",
q: "q",
showPreorders: true,
source: "source",
startIndex: 14,
});
}
});