0.0.20241031 • Published 9 months ago

@maxim_mazurok/gapi.client.dataportability-v1beta v0.0.20241031

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

TypeScript typings for Data Portability API v1beta

The Data Portability API lets you build applications that request authorization from a user to move a copy of data from Google services into your application. This enables data portability and facilitates switching services. For detailed description please check documentation.

Installing

Install typings for Data Portability API:

npm install @types/gapi.client.dataportability-v1beta --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://dataportability.googleapis.com/$discovery/rest?version=v1beta',
  () => {
    // now we can use:
    // gapi.client.dataportability
  }
);
// 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('dataportability', 'v1beta', () => {
  // now we can use:
  // gapi.client.dataportability
});

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 = [
    // Move a copy of the Google Alerts subscriptions you created.
    'https://www.googleapis.com/auth/dataportability.alerts.subscriptions',

    // Move a copy of messages between you and the businesses you have conversations with across Google services.
    'https://www.googleapis.com/auth/dataportability.businessmessaging.conversations',

    // Move a copy of the information you entered into online forms in Chrome.
    'https://www.googleapis.com/auth/dataportability.chrome.autofill',

    // Move a copy of pages you bookmarked in Chrome.
    'https://www.googleapis.com/auth/dataportability.chrome.bookmarks',

    // Move a copy of words you added to Chrome's dictionary.
    'https://www.googleapis.com/auth/dataportability.chrome.dictionary',

    // Move a copy of extensions you installed from the Chrome Web Store.
    'https://www.googleapis.com/auth/dataportability.chrome.extensions',

    // Move a copy of sites you visited in Chrome.
    'https://www.googleapis.com/auth/dataportability.chrome.history',

    // Move a copy of pages you added to your reading list in Chrome.
    'https://www.googleapis.com/auth/dataportability.chrome.reading_list',

    // Move a copy of your settings in Chrome.
    'https://www.googleapis.com/auth/dataportability.chrome.settings',

    // Move a copy of searches and sites you follow, saved by Discover.
    'https://www.googleapis.com/auth/dataportability.discover.follows',

    // Move a copy of links to your liked documents, saved by Discover.
    'https://www.googleapis.com/auth/dataportability.discover.likes',

    // Move a copy of content you marked as not interested, saved by Discover.
    'https://www.googleapis.com/auth/dataportability.discover.not_interested',

    // Move a copy of the places you labeled on Maps.
    'https://www.googleapis.com/auth/dataportability.maps.aliased_places',

    // Move a copy of your pinned trips on Maps.
    'https://www.googleapis.com/auth/dataportability.maps.commute_routes',

    // Move a copy of your commute settings on Maps.
    'https://www.googleapis.com/auth/dataportability.maps.commute_settings',

    // Move a copy of your electric vehicle profile on Maps.
    'https://www.googleapis.com/auth/dataportability.maps.ev_profile',

    // Move a copy of the corrections you made to places or map information on Maps.
    'https://www.googleapis.com/auth/dataportability.maps.factual_contributions',

    // Move a copy of your updates to places on Maps.
    'https://www.googleapis.com/auth/dataportability.maps.offering_contributions',

    // Move a copy of the photos and videos you posted on Maps.
    'https://www.googleapis.com/auth/dataportability.maps.photos_videos',

    // Move a copy of the questions and answers you posted on Maps.
    'https://www.googleapis.com/auth/dataportability.maps.questions_answers',

    // Move a copy of your reviews and posts on Maps.
    'https://www.googleapis.com/auth/dataportability.maps.reviews',

    // Move a copy of your Starred places list on Maps.
    'https://www.googleapis.com/auth/dataportability.maps.starred_places',

    // Move a copy of your Maps activity.
    'https://www.googleapis.com/auth/dataportability.myactivity.maps',

    // Move a copy of your My Ad Center activity.
    'https://www.googleapis.com/auth/dataportability.myactivity.myadcenter',

    // Move a copy of your Google Play activity.
    'https://www.googleapis.com/auth/dataportability.myactivity.play',

    // Move a copy of your Google Search activity.
    'https://www.googleapis.com/auth/dataportability.myactivity.search',

    // Move a copy of your Shopping activity.
    'https://www.googleapis.com/auth/dataportability.myactivity.shopping',

    // Move a copy of your YouTube activity.
    'https://www.googleapis.com/auth/dataportability.myactivity.youtube',

    // Move a copy of the maps you created in My Maps.
    'https://www.googleapis.com/auth/dataportability.mymaps.maps',

    // Move a copy of your food purchase and reservation activity.
    'https://www.googleapis.com/auth/dataportability.order_reserve.purchases_reservations',

    // Move a copy of information about your devices with Google Play Store installed.
    'https://www.googleapis.com/auth/dataportability.play.devices',

    // Move a copy of your Google Play Store Grouping tags created by app developers.
    'https://www.googleapis.com/auth/dataportability.play.grouping',

    // Move a copy of your Google Play Store app installations.
    'https://www.googleapis.com/auth/dataportability.play.installs',

    // Move a copy of your Google Play Store downloads, including books, games, and apps.
    'https://www.googleapis.com/auth/dataportability.play.library',

    // Move a copy of information about your Google Play Store Points.
    'https://www.googleapis.com/auth/dataportability.play.playpoints',

    // Move a copy of information about your Google Play Store promotions.
    'https://www.googleapis.com/auth/dataportability.play.promotions',

    // Move a copy of your Google Play Store purchases.
    'https://www.googleapis.com/auth/dataportability.play.purchases',

    // Move a copy of your Google Play Store redemption activities.
    'https://www.googleapis.com/auth/dataportability.play.redemptions',

    // Move a copy of your Google Play Store subscriptions.
    'https://www.googleapis.com/auth/dataportability.play.subscriptions',

    // Move a copy of your Google Play Store user settings and preferences.
    'https://www.googleapis.com/auth/dataportability.play.usersettings',

    // Move a copy of your saved links, images, places, and collections from your use of Google services.
    'https://www.googleapis.com/auth/dataportability.saved.collections',

    // Move a copy of your media reviews on Google Search.
    'https://www.googleapis.com/auth/dataportability.search_ugc.media.reviews_and_stars',

    // Move a copy of your self-reported video streaming provider preferences from Google Search and Google TV.
    'https://www.googleapis.com/auth/dataportability.search_ugc.media.streaming_video_providers',

    // Move a copy of your indicated thumbs up and thumbs down on media in Google Search and Google TV.
    'https://www.googleapis.com/auth/dataportability.search_ugc.media.thumbs',

    // Move a copy of information about the movies and TV shows you marked as watched on Google Search and Google TV.
    'https://www.googleapis.com/auth/dataportability.search_ugc.media.watched',

    // Move a copy of your notification settings on the Google Search app.
    'https://www.googleapis.com/auth/dataportability.searchnotifications.settings',

    // Move a copy of your notification subscriptions on Google Search app.
    'https://www.googleapis.com/auth/dataportability.searchnotifications.subscriptions',

    // Move a copy of your shipping information on Shopping.
    'https://www.googleapis.com/auth/dataportability.shopping.addresses',

    // Move a copy of reviews you wrote about products or online stores on Google Search.
    'https://www.googleapis.com/auth/dataportability.shopping.reviews',

    // Move a copy of the images and videos you uploaded to Street View.
    'https://www.googleapis.com/auth/dataportability.streetview.imagery',

    // Move a copy of information about your YouTube channel.
    'https://www.googleapis.com/auth/dataportability.youtube.channel',

    // Move a copy of your YouTube clips metadata.
    'https://www.googleapis.com/auth/dataportability.youtube.clips',

    // Move a copy of your YouTube comments.
    'https://www.googleapis.com/auth/dataportability.youtube.comments',

    // Move a copy of your YouTube messages in live chat.
    'https://www.googleapis.com/auth/dataportability.youtube.live_chat',

    // Move a copy of your uploaded YouTube music tracks and your YouTube music library.
    'https://www.googleapis.com/auth/dataportability.youtube.music',

    // Move a copy of your YouTube playables saved game progress files.
    'https://www.googleapis.com/auth/dataportability.youtube.playable',

    // Move a copy of your YouTube posts.
    'https://www.googleapis.com/auth/dataportability.youtube.posts',

    // Move a copy of your YouTube private playlists.
    'https://www.googleapis.com/auth/dataportability.youtube.private_playlists',

    // Move a copy of your private YouTube videos and information about them.
    'https://www.googleapis.com/auth/dataportability.youtube.private_videos',

    // Move a copy of your public YouTube playlists.
    'https://www.googleapis.com/auth/dataportability.youtube.public_playlists',

    // Move a copy of your public YouTube videos and information about them.
    'https://www.googleapis.com/auth/dataportability.youtube.public_videos',

    // Move a copy of your YouTube shopping wishlists, and wishlist items.
    'https://www.googleapis.com/auth/dataportability.youtube.shopping',

    // Move a copy of your YouTube channel subscriptions, even if they're private.
    'https://www.googleapis.com/auth/dataportability.youtube.subscriptions',

    // Move a copy of your unlisted YouTube playlists.
    'https://www.googleapis.com/auth/dataportability.youtube.unlisted_playlists',

    // Move a copy of your unlisted YouTube videos and information about them.
    'https://www.googleapis.com/auth/dataportability.youtube.unlisted_videos',
  ],
  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 Data Portability API resources:

/*
Retrieves the state of an Archive job for the Portability API.
*/
await gapi.client.dataportability.archiveJobs.getPortabilityArchiveState({
  name: 'name',
});

/*
Retries a failed Portability Archive job.
*/
await gapi.client.dataportability.archiveJobs.retry({name: 'name'});

/*
Revokes OAuth tokens and resets exhausted scopes for a user/project pair. This method allows you to initiate a request after a new consent is granted. This method also indicates that previous archives can be garbage collected. You should call this method when all jobs are complete and all archives are downloaded. Do not call it only when you start a new job.
*/
await gapi.client.dataportability.authorization.reset({});

/*
Initiates a new Archive job for the Portability API.
*/
await gapi.client.dataportability.portabilityArchive.initiate({});
0.0.20241031

9 months ago

0.0.20241024

9 months ago

0.0.20241030

9 months ago

0.0.20241029

9 months ago

0.0.20241028

9 months ago

0.0.20241027

9 months ago

0.0.20241023

9 months ago

0.0.20241022

9 months ago

0.0.20241021

9 months ago

0.0.20241020

9 months ago

0.0.20241017

9 months ago

0.0.20241016

9 months ago

0.0.20241015

9 months ago

0.0.20241014

9 months ago

0.0.20240929

10 months ago

0.0.20240925

10 months ago

0.0.20240926

10 months ago

0.0.20240924

10 months ago

0.0.20241003

10 months ago

0.0.20241002

10 months ago

0.0.20241001

10 months ago

0.0.20241010

10 months ago

0.0.20241013

9 months ago

0.0.20241008

10 months ago

0.0.20241007

10 months ago

0.0.20241006

10 months ago

0.0.20241009

10 months ago

0.0.20240918

10 months ago

0.0.20240919

10 months ago

0.0.20240916

10 months ago

0.0.20240917

10 months ago

0.0.20240922

10 months ago

0.0.20240923

10 months ago

0.0.20240908

11 months ago

0.0.20240909

11 months ago

0.0.20240910

11 months ago

0.0.20240912

10 months ago

0.0.20240903

11 months ago

0.0.20240904

11 months ago

0.0.20240905

11 months ago

0.0.20240901

11 months ago

0.0.20240902

11 months ago

0.0.20240826

11 months ago

0.0.20240827

11 months ago

0.0.20240828

11 months ago

0.0.20240829

11 months ago

0.0.20240606

1 year ago

0.0.20240728

12 months ago

0.0.20240729

12 months ago

0.0.20240609

1 year ago

0.0.20240723

1 year ago

0.0.20240602

1 year ago

0.0.20240724

12 months ago

0.0.20240603

1 year ago

0.0.20240725

12 months ago

0.0.20240604

1 year ago

0.0.20240721

1 year ago

0.0.20240722

1 year ago

0.0.20240617

1 year ago

0.0.20240618

1 year ago

0.0.20240619

1 year ago

0.0.20240616

1 year ago

0.0.20240730

12 months ago

0.0.20240731

12 months ago

0.0.20240610

1 year ago

0.0.20240611

1 year ago

0.0.20240612

1 year ago

0.0.20240630

1 year ago

0.0.20240624

1 year ago

0.0.20240626

1 year ago

0.0.20240627

1 year ago

0.0.20240623

1 year ago

0.0.20240520

1 year ago

0.0.20240530

1 year ago

0.0.20240808

12 months ago

0.0.20240804

12 months ago

0.0.20240529

1 year ago

0.0.20240805

12 months ago

0.0.20240806

12 months ago

0.0.20240807

12 months ago

0.0.20240801

12 months ago

0.0.20240527

1 year ago

0.0.20240528

1 year ago

0.0.20240521

1 year ago

0.0.20240523

1 year ago

0.0.20240524

1 year ago

0.0.20240819

11 months ago

0.0.20240815

11 months ago

0.0.20240818

11 months ago

0.0.20240811

12 months ago

0.0.20240812

12 months ago

0.0.20240813

11 months ago

0.0.20240814

11 months ago

0.0.20240709

1 year ago

0.0.20240707

1 year ago

0.0.20240708

1 year ago

0.0.20240822

11 months ago

0.0.20240701

1 year ago

0.0.20240702

1 year ago

0.0.20240703

1 year ago

0.0.20240825

11 months ago

0.0.20240704

1 year ago

0.0.20240820

11 months ago

0.0.20240716

1 year ago

0.0.20240713

1 year ago

0.0.20240715

1 year ago

0.0.20240710

1 year ago

0.0.20240711

1 year ago

0.0.20240519

1 year ago

0.0.20240516

1 year ago

0.0.20240514

1 year ago

0.0.20240513

1 year ago

0.0.20240512

1 year ago

0.0.20240509

1 year ago

0.0.20240508

1 year ago

0.0.20240507

1 year ago

0.0.20240505

1 year ago

0.0.20240501

1 year ago

0.0.20240502

1 year ago

0.0.20240430

1 year ago

0.0.20240429

1 year ago

0.0.20240428

1 year ago

0.0.20240425

1 year ago

0.0.20240424

1 year ago

0.0.20240423

1 year ago

0.0.20240422

1 year ago

0.0.20240421

1 year ago

0.0.20240418

1 year ago

0.0.20240417

1 year ago

0.0.20240414

1 year ago

0.0.20240411

1 year ago

0.0.20240410

1 year ago

0.0.20240409

1 year ago

0.0.20240407

1 year ago

0.0.20240404

1 year ago

0.0.20240403

1 year ago

0.0.20240402

1 year ago

0.0.20240331

1 year ago

0.0.20240401

1 year ago

0.0.20240327

1 year ago

0.0.20240326

1 year ago

0.0.20240325

1 year ago

0.0.20240324

1 year ago

0.0.20240321

1 year ago

0.0.20240320

1 year ago

0.0.20240319

1 year ago

0.0.20240318

1 year ago

0.0.20240317

1 year ago

0.0.20240314

1 year ago

0.0.20240313

1 year ago

0.0.20240310

1 year ago

0.0.20240312

1 year ago

0.0.20240308

1 year ago

0.0.20240307

1 year ago

0.0.20240305

1 year ago

0.0.20240303

1 year ago

0.0.20240228

1 year ago

0.0.20240226

1 year ago

0.0.20240227

1 year ago

0.0.20240225

1 year ago

0.0.20240221

1 year ago

0.0.20240223

1 year ago

0.0.20240220

1 year ago

0.0.20240218

1 year ago

0.0.20240213

1 year ago

0.0.20240211

1 year ago

0.0.20240208

1 year ago

0.0.20240207

1 year ago

0.0.20240206

1 year ago

0.0.20240204

1 year ago

0.0.20240201

1 year ago

0.0.20240131

1 year ago

0.0.20240130

1 year ago