0.0.20240514 • Published 5 days ago

@maxim_mazurok/gapi.client.books-v1 v0.0.20240514

Weekly downloads
-
License
MIT
Repository
github
Last release
5 days ago

TypeScript typings for Books API v1

The Google Books API allows clients to access the Google Books repository. For detailed description please check documentation.

Installing

Install typings for Books API:

npm install @types/gapi.client.books-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(
  'https://books.googleapis.com/$discovery/rest?version=v1',
  () => {
    // now we can use:
    // gapi.client.books
  }
);
// Deprecated, use discovery document URL, see https://github.com/google/google-api-javascript-client/blob/master/docs/reference.md#----gapiclientloadname----version----callback--
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
var client_id = '',
  scope = [
    // Manage your books
    'https://www.googleapis.com/auth/books',
  ],
  immediate = true;
// ...

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

After that you can use Books API resources:

/*
Retrieves metadata for a specific bookshelf for the specified user.
*/
await gapi.client.books.bookshelves.get({shelf: 'shelf', userId: 'userId'});

/*
Retrieves a list of public bookshelves for the specified user.
*/
await gapi.client.books.bookshelves.list({userId: 'userId'});

/*
Add a user-upload volume and triggers processing.
*/
await gapi.client.books.cloudloading.addBook({});

/*
Remove the book and its contents
*/
await gapi.client.books.cloudloading.deleteBook({volumeId: 'volumeId'});

/*
Updates a user-upload volume.
*/
await gapi.client.books.cloudloading.updateBook({});

/*
Returns a list of offline dictionary metadata available
*/
await gapi.client.books.dictionary.listOfflineMetadata({cpksver: 'cpksver'});

/*
Gets information regarding the family that the user is part of.
*/
await gapi.client.books.familysharing.getFamilyInfo({});

/*
Initiates sharing of the content with the user's family. Empty response indicates success.
*/
await gapi.client.books.familysharing.share({});

/*
Initiates revoking content that has already been shared with the user's family. Empty response indicates success.
*/
await gapi.client.books.familysharing.unshare({});

/*
Gets the layer summary for a volume.
*/
await gapi.client.books.layers.get({
  summaryId: 'summaryId',
  volumeId: 'volumeId',
});

/*
List the layer summaries for a volume.
*/
await gapi.client.books.layers.list({volumeId: 'volumeId'});

/*
Gets the current settings for the user.
*/
await gapi.client.books.myconfig.getUserSettings({});

/*
Release downloaded content access restriction.
*/
await gapi.client.books.myconfig.releaseDownloadAccess({
  cpksver: 'cpksver',
  volumeIds: 'volumeIds',
});

/*
Request concurrent and download access restrictions.
*/
await gapi.client.books.myconfig.requestAccess({
  cpksver: 'cpksver',
  nonce: 'nonce',
  source: 'source',
  volumeId: 'volumeId',
});

/*
Request downloaded content access for specified volumes on the My eBooks shelf.
*/
await gapi.client.books.myconfig.syncVolumeLicenses({
  cpksver: 'cpksver',
  nonce: 'nonce',
  source: 'source',
});

/*
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.books.myconfig.updateUserSettings({});

/*
Returns notification details for a given notification id.
*/
await gapi.client.books.notification.get({notification_id: 'notification_id'});

/*
List categories for onboarding experience.
*/
await gapi.client.books.onboarding.listCategories({});

/*
List available volumes under categories for onboarding experience.
*/
await gapi.client.books.onboarding.listCategoryVolumes({});

/*
Returns a stream of personalized book clusters
*/
await gapi.client.books.personalizedstream.get({});

/*
Accepts the promo offer.
*/
await gapi.client.books.promooffer.accept({});

/*
Marks the promo offer as dismissed.
*/
await gapi.client.books.promooffer.dismiss({});

/*
Returns a list of promo offers available to the user
*/
await gapi.client.books.promooffer.get({});

/*
Returns Series metadata for the given series ids.
*/
await gapi.client.books.series.get({series_id: 'series_id'});

/*
Gets volume information for a single volume.
*/
await gapi.client.books.volumes.get({volumeId: 'volumeId'});

/*
Performs a book search.
*/
await gapi.client.books.volumes.list({q: 'q'});
0.0.20240514

5 days ago

0.0.20240509

8 days ago

0.0.20240507

12 days ago

0.0.20240502

15 days ago

0.0.20240425

22 days ago

0.0.20240423

26 days ago

0.0.20240418

27 days ago

0.0.20240416

1 month ago

0.0.20240411

1 month ago

0.0.20240409

1 month ago

0.0.20240404

1 month ago

0.0.20240402

1 month ago

0.0.20240326

2 months ago

0.0.20240321

2 months ago

0.0.20240319

2 months ago

0.0.20240314

2 months ago

0.0.20240305

2 months ago

0.0.20240312

2 months ago

0.0.20240304

3 months ago

0.0.20240222

3 months ago

0.0.20240220

3 months ago

0.0.20240214

3 months ago

0.0.20240208

3 months ago

0.0.20240213

3 months ago

0.0.20240202

4 months ago

0.0.20240131

4 months ago

0.0.20240129

4 months ago

0.0.20240124

4 months ago

0.0.20240109

4 months ago

0.0.20231212

5 months ago

0.0.20231207

5 months ago

0.0.20231130

6 months ago

0.0.20230817

9 months ago

0.0.20230810

9 months ago

0.0.20231107

6 months ago

0.0.20230928

8 months ago

0.0.20230808

10 months ago

0.0.20230926

8 months ago

0.0.20231017

7 months ago

0.0.20230720

10 months ago

0.0.20231019

7 months ago

0.0.20230803

10 months ago

0.0.20230727

10 months ago

0.0.20230725

10 months ago

0.0.20231102

7 months ago

0.0.20231024

7 months ago

0.0.20231026

7 months ago

0.0.20230718

10 months ago

0.0.20230711

10 months ago

0.0.20230912

8 months ago

0.0.20231011

7 months ago

0.0.20230829

9 months ago

0.0.20230907

8 months ago

0.0.20230629

11 months ago

0.0.20230905

9 months ago

0.0.20230823

9 months ago

0.0.20230824

9 months ago

0.0.20231004

8 months ago

0.0.20230622

11 months ago

0.0.20230613

11 months ago

0.0.20230620

11 months ago

0.0.20230608

11 months ago

0.0.20230525

12 months ago

0.0.20230530

12 months ago

0.0.20230511

1 year ago

0.0.20230518

12 months ago

0.0.20230502

1 year ago

0.0.20230504

1 year ago

0.0.20230316

1 year ago

0.0.20230418

1 year ago

0.0.20230322

1 year ago

0.0.20230223

1 year ago

0.0.20230323

1 year ago

0.0.20230425

1 year ago

0.0.20230404

1 year ago

0.0.20230309

1 year ago

0.0.20230328

1 year ago

0.0.20230406

1 year ago

0.0.20230307

1 year ago

0.0.20230330

1 year ago

0.0.20230201

1 year ago

0.0.20230202

1 year ago

0.0.20230221

1 year ago

0.0.20230203

1 year ago

0.0.20230207

1 year ago

0.0.20230131

1 year ago

0.0.20230117

1 year ago

0.0.20221116

2 years ago

0.0.20221111

2 years ago

0.0.20230120

1 year ago

0.0.20230103

1 year ago

0.0.20221207

1 year ago

0.0.20221108

2 years ago

0.0.20221104

2 years ago

0.0.20230110

1 year ago

0.0.20221216

1 year ago

0.0.20221006

2 years ago

0.0.20221027

2 years ago

0.0.20221025

2 years ago

0.0.20221101

2 years ago

0.0.20220927

2 years ago

0.0.20221019

2 years ago

0.0.20221007

2 years ago

0.0.20220923

2 years ago

0.0.20220916

2 years ago

0.0.20220907

2 years ago

0.0.20220920

2 years ago

0.0.20220824

2 years ago

0.0.20220825

2 years ago

0.0.20220914

2 years ago

0.0.20220816

2 years ago

0.0.20220812

2 years ago

0.0.20220810

2 years ago