...

Source file src/google.golang.org/api/dataportability/v1beta/dataportability-gen.go

Documentation: google.golang.org/api/dataportability/v1beta

     1  // Copyright 2024 Google LLC.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Code generated file. DO NOT EDIT.
     6  
     7  // Package dataportability provides access to the Data Portability API.
     8  //
     9  // For product documentation, see: https://developers.google.com/data-portability
    10  //
    11  // # Library status
    12  //
    13  // These client libraries are officially supported by Google. However, this
    14  // library is considered complete and is in maintenance mode. This means
    15  // that we will address critical bugs and security issues but will not add
    16  // any new features.
    17  //
    18  // When possible, we recommend using our newer
    19  // [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go)
    20  // that are still actively being worked and iterated on.
    21  //
    22  // # Creating a client
    23  //
    24  // Usage example:
    25  //
    26  //	import "google.golang.org/api/dataportability/v1beta"
    27  //	...
    28  //	ctx := context.Background()
    29  //	dataportabilityService, err := dataportability.NewService(ctx)
    30  //
    31  // In this example, Google Application Default Credentials are used for
    32  // authentication. For information on how to create and obtain Application
    33  // Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
    34  //
    35  // # Other authentication options
    36  //
    37  // By default, all available scopes (see "Constants") are used to authenticate.
    38  // To restrict scopes, use [google.golang.org/api/option.WithScopes]:
    39  //
    40  //	dataportabilityService, err := dataportability.NewService(ctx, option.WithScopes(dataportability.DataportabilityYoutubeUnlistedVideosScope))
    41  //
    42  // To use an API key for authentication (note: some APIs do not support API
    43  // keys), use [google.golang.org/api/option.WithAPIKey]:
    44  //
    45  //	dataportabilityService, err := dataportability.NewService(ctx, option.WithAPIKey("AIza..."))
    46  //
    47  // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth
    48  // flow, use [google.golang.org/api/option.WithTokenSource]:
    49  //
    50  //	config := &oauth2.Config{...}
    51  //	// ...
    52  //	token, err := config.Exchange(ctx, ...)
    53  //	dataportabilityService, err := dataportability.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    54  //
    55  // See [google.golang.org/api/option.ClientOption] for details on options.
    56  package dataportability // import "google.golang.org/api/dataportability/v1beta"
    57  
    58  import (
    59  	"bytes"
    60  	"context"
    61  	"encoding/json"
    62  	"errors"
    63  	"fmt"
    64  	"io"
    65  	"net/http"
    66  	"net/url"
    67  	"strconv"
    68  	"strings"
    69  
    70  	googleapi "google.golang.org/api/googleapi"
    71  	internal "google.golang.org/api/internal"
    72  	gensupport "google.golang.org/api/internal/gensupport"
    73  	option "google.golang.org/api/option"
    74  	internaloption "google.golang.org/api/option/internaloption"
    75  	htransport "google.golang.org/api/transport/http"
    76  )
    77  
    78  // Always reference these packages, just in case the auto-generated code
    79  // below doesn't.
    80  var _ = bytes.NewBuffer
    81  var _ = strconv.Itoa
    82  var _ = fmt.Sprintf
    83  var _ = json.NewDecoder
    84  var _ = io.Copy
    85  var _ = url.Parse
    86  var _ = gensupport.MarshalJSON
    87  var _ = googleapi.Version
    88  var _ = errors.New
    89  var _ = strings.Replace
    90  var _ = context.Canceled
    91  var _ = internaloption.WithDefaultEndpoint
    92  var _ = internal.Version
    93  
    94  const apiId = "dataportability:v1beta"
    95  const apiName = "dataportability"
    96  const apiVersion = "v1beta"
    97  const basePath = "https://dataportability.googleapis.com/"
    98  const basePathTemplate = "https://dataportability.UNIVERSE_DOMAIN/"
    99  const mtlsBasePath = "https://dataportability.mtls.googleapis.com/"
   100  
   101  // OAuth2 scopes used by this API.
   102  const (
   103  	// Move a copy of messages between you and the businesses you have
   104  	// conversations with across Google services.
   105  	DataportabilityBusinessmessagingConversationsScope = "https://www.googleapis.com/auth/dataportability.businessmessaging.conversations"
   106  
   107  	// Move a copy of the information you entered into online forms in Chrome.
   108  	DataportabilityChromeAutofillScope = "https://www.googleapis.com/auth/dataportability.chrome.autofill"
   109  
   110  	// Move a copy of pages you bookmarked in Chrome.
   111  	DataportabilityChromeBookmarksScope = "https://www.googleapis.com/auth/dataportability.chrome.bookmarks"
   112  
   113  	// Move a copy of words you added to Chrome's dictionary.
   114  	DataportabilityChromeDictionaryScope = "https://www.googleapis.com/auth/dataportability.chrome.dictionary"
   115  
   116  	// Move a copy of extensions you installed from the Chrome Web Store.
   117  	DataportabilityChromeExtensionsScope = "https://www.googleapis.com/auth/dataportability.chrome.extensions"
   118  
   119  	// Move a copy of sites you visited in Chrome.
   120  	DataportabilityChromeHistoryScope = "https://www.googleapis.com/auth/dataportability.chrome.history"
   121  
   122  	// Move a copy of pages you added to your reading list in Chrome.
   123  	DataportabilityChromeReadingListScope = "https://www.googleapis.com/auth/dataportability.chrome.reading_list"
   124  
   125  	// Move a copy of your settings in Chrome.
   126  	DataportabilityChromeSettingsScope = "https://www.googleapis.com/auth/dataportability.chrome.settings"
   127  
   128  	// Move a copy of searches and sites you follow, saved by Discover.
   129  	DataportabilityDiscoverFollowsScope = "https://www.googleapis.com/auth/dataportability.discover.follows"
   130  
   131  	// Move a copy of links to your liked documents, saved by Discover.
   132  	DataportabilityDiscoverLikesScope = "https://www.googleapis.com/auth/dataportability.discover.likes"
   133  
   134  	// Move a copy of content you marked as not interested, saved by Discover.
   135  	DataportabilityDiscoverNotInterestedScope = "https://www.googleapis.com/auth/dataportability.discover.not_interested"
   136  
   137  	// Move a copy of the places you labeled on Maps.
   138  	DataportabilityMapsAliasedPlacesScope = "https://www.googleapis.com/auth/dataportability.maps.aliased_places"
   139  
   140  	// Move a copy of your pinned trips on Maps.
   141  	DataportabilityMapsCommuteRoutesScope = "https://www.googleapis.com/auth/dataportability.maps.commute_routes"
   142  
   143  	// Move a copy of your commute settings on Maps.
   144  	DataportabilityMapsCommuteSettingsScope = "https://www.googleapis.com/auth/dataportability.maps.commute_settings"
   145  
   146  	// Move a copy of your electric vehicle profile on Maps.
   147  	DataportabilityMapsEvProfileScope = "https://www.googleapis.com/auth/dataportability.maps.ev_profile"
   148  
   149  	// Move a copy of the corrections you made to places or map information on
   150  	// Maps.
   151  	DataportabilityMapsFactualContributionsScope = "https://www.googleapis.com/auth/dataportability.maps.factual_contributions"
   152  
   153  	// Move a copy of your updates to places on Maps.
   154  	DataportabilityMapsOfferingContributionsScope = "https://www.googleapis.com/auth/dataportability.maps.offering_contributions"
   155  
   156  	// Move a copy of the photos and videos you posted on Maps.
   157  	DataportabilityMapsPhotosVideosScope = "https://www.googleapis.com/auth/dataportability.maps.photos_videos"
   158  
   159  	// Move a copy of the questions and answers you posted on Maps.
   160  	DataportabilityMapsQuestionsAnswersScope = "https://www.googleapis.com/auth/dataportability.maps.questions_answers"
   161  
   162  	// Move a copy of your reviews and posts on Maps.
   163  	DataportabilityMapsReviewsScope = "https://www.googleapis.com/auth/dataportability.maps.reviews"
   164  
   165  	// Move a copy of your Starred places list on Maps.
   166  	DataportabilityMapsStarredPlacesScope = "https://www.googleapis.com/auth/dataportability.maps.starred_places"
   167  
   168  	// Move a copy of your Maps activity.
   169  	DataportabilityMyactivityMapsScope = "https://www.googleapis.com/auth/dataportability.myactivity.maps"
   170  
   171  	// Move a copy of your My Ad Center activity.
   172  	DataportabilityMyactivityMyadcenterScope = "https://www.googleapis.com/auth/dataportability.myactivity.myadcenter"
   173  
   174  	// Move a copy of your Google Play activity.
   175  	DataportabilityMyactivityPlayScope = "https://www.googleapis.com/auth/dataportability.myactivity.play"
   176  
   177  	// Move a copy of your Google Search activity.
   178  	DataportabilityMyactivitySearchScope = "https://www.googleapis.com/auth/dataportability.myactivity.search"
   179  
   180  	// Move a copy of your Shopping activity.
   181  	DataportabilityMyactivityShoppingScope = "https://www.googleapis.com/auth/dataportability.myactivity.shopping"
   182  
   183  	// Move a copy of your YouTube activity.
   184  	DataportabilityMyactivityYoutubeScope = "https://www.googleapis.com/auth/dataportability.myactivity.youtube"
   185  
   186  	// Move a copy of the maps you created in My Maps.
   187  	DataportabilityMymapsMapsScope = "https://www.googleapis.com/auth/dataportability.mymaps.maps"
   188  
   189  	// Move a copy of your food purchase and reservation activity.
   190  	DataportabilityOrderReservePurchasesReservationsScope = "https://www.googleapis.com/auth/dataportability.order_reserve.purchases_reservations"
   191  
   192  	// Move a copy of information about your devices with Google Play Store
   193  	// installed.
   194  	DataportabilityPlayDevicesScope = "https://www.googleapis.com/auth/dataportability.play.devices"
   195  
   196  	// Move a copy of your Google Play Store Grouping tags created by app
   197  	// developers.
   198  	DataportabilityPlayGroupingScope = "https://www.googleapis.com/auth/dataportability.play.grouping"
   199  
   200  	// Move a copy of your Google Play Store app installations.
   201  	DataportabilityPlayInstallsScope = "https://www.googleapis.com/auth/dataportability.play.installs"
   202  
   203  	// Move a copy of your Google Play Store downloads, including books, games, and
   204  	// apps.
   205  	DataportabilityPlayLibraryScope = "https://www.googleapis.com/auth/dataportability.play.library"
   206  
   207  	// Move a copy of information about your Google Play Store Points.
   208  	DataportabilityPlayPlaypointsScope = "https://www.googleapis.com/auth/dataportability.play.playpoints"
   209  
   210  	// Move a copy of information about your Google Play Store promotions.
   211  	DataportabilityPlayPromotionsScope = "https://www.googleapis.com/auth/dataportability.play.promotions"
   212  
   213  	// Move a copy of your Google Play Store purchases.
   214  	DataportabilityPlayPurchasesScope = "https://www.googleapis.com/auth/dataportability.play.purchases"
   215  
   216  	// Move a copy of your Google Play Store redemption activities.
   217  	DataportabilityPlayRedemptionsScope = "https://www.googleapis.com/auth/dataportability.play.redemptions"
   218  
   219  	// Move a copy of your Google Play Store subscriptions.
   220  	DataportabilityPlaySubscriptionsScope = "https://www.googleapis.com/auth/dataportability.play.subscriptions"
   221  
   222  	// Move a copy of your Google Play Store user settings and preferences.
   223  	DataportabilityPlayUsersettingsScope = "https://www.googleapis.com/auth/dataportability.play.usersettings"
   224  
   225  	// Move a copy of your saved links, images, places, and collections from your
   226  	// use of Google services.
   227  	DataportabilitySavedCollectionsScope = "https://www.googleapis.com/auth/dataportability.saved.collections"
   228  
   229  	// Move a copy of your media reviews on Google Search.
   230  	DataportabilitySearchUgcMediaReviewsAndStarsScope = "https://www.googleapis.com/auth/dataportability.search_ugc.media.reviews_and_stars"
   231  
   232  	// Move a copy of your self-reported video streaming provider preferences from
   233  	// Google Search and Google TV.
   234  	DataportabilitySearchUgcMediaStreamingVideoProvidersScope = "https://www.googleapis.com/auth/dataportability.search_ugc.media.streaming_video_providers"
   235  
   236  	// Move a copy of your indicated thumbs up and thumbs down on media in Google
   237  	// Search and Google TV.
   238  	DataportabilitySearchUgcMediaThumbsScope = "https://www.googleapis.com/auth/dataportability.search_ugc.media.thumbs"
   239  
   240  	// Move a copy of information about the movies and TV shows you marked as
   241  	// watched on Google Search and Google TV.
   242  	DataportabilitySearchUgcMediaWatchedScope = "https://www.googleapis.com/auth/dataportability.search_ugc.media.watched"
   243  
   244  	// Move a copy of your notification settings on the Google Search app.
   245  	DataportabilitySearchnotificationsSettingsScope = "https://www.googleapis.com/auth/dataportability.searchnotifications.settings"
   246  
   247  	// Move a copy of your notification subscriptions on Google Search app.
   248  	DataportabilitySearchnotificationsSubscriptionsScope = "https://www.googleapis.com/auth/dataportability.searchnotifications.subscriptions"
   249  
   250  	// Move a copy of your shipping information on Shopping.
   251  	DataportabilityShoppingAddressesScope = "https://www.googleapis.com/auth/dataportability.shopping.addresses"
   252  
   253  	// Move a copy of reviews you wrote about products or online stores on Google
   254  	// Search.
   255  	DataportabilityShoppingReviewsScope = "https://www.googleapis.com/auth/dataportability.shopping.reviews"
   256  
   257  	// Move a copy of the images and videos you uploaded to Street View.
   258  	DataportabilityStreetviewImageryScope = "https://www.googleapis.com/auth/dataportability.streetview.imagery"
   259  
   260  	// Move a copy of information about your YouTube channel.
   261  	DataportabilityYoutubeChannelScope = "https://www.googleapis.com/auth/dataportability.youtube.channel"
   262  
   263  	// Move a copy of your YouTube comments.
   264  	DataportabilityYoutubeCommentsScope = "https://www.googleapis.com/auth/dataportability.youtube.comments"
   265  
   266  	// Move a copy of your YouTube messages in live chat.
   267  	DataportabilityYoutubeLiveChatScope = "https://www.googleapis.com/auth/dataportability.youtube.live_chat"
   268  
   269  	// Move a copy of your uploaded YouTube music tracks and your YouTube music
   270  	// library.
   271  	DataportabilityYoutubeMusicScope = "https://www.googleapis.com/auth/dataportability.youtube.music"
   272  
   273  	// Move a copy of your YouTube playables saved game progress files.
   274  	DataportabilityYoutubePlayableScope = "https://www.googleapis.com/auth/dataportability.youtube.playable"
   275  
   276  	// Move a copy of your YouTube posts.
   277  	DataportabilityYoutubePostsScope = "https://www.googleapis.com/auth/dataportability.youtube.posts"
   278  
   279  	// Move a copy of your YouTube private playlists.
   280  	DataportabilityYoutubePrivatePlaylistsScope = "https://www.googleapis.com/auth/dataportability.youtube.private_playlists"
   281  
   282  	// Move a copy of your private YouTube videos and information about them.
   283  	DataportabilityYoutubePrivateVideosScope = "https://www.googleapis.com/auth/dataportability.youtube.private_videos"
   284  
   285  	// Move a copy of your public YouTube playlists.
   286  	DataportabilityYoutubePublicPlaylistsScope = "https://www.googleapis.com/auth/dataportability.youtube.public_playlists"
   287  
   288  	// Move a copy of your public YouTube videos and information about them.
   289  	DataportabilityYoutubePublicVideosScope = "https://www.googleapis.com/auth/dataportability.youtube.public_videos"
   290  
   291  	// Move a copy of your YouTube shopping wishlists, and wishlist items.
   292  	DataportabilityYoutubeShoppingScope = "https://www.googleapis.com/auth/dataportability.youtube.shopping"
   293  
   294  	// Move a copy of your YouTube channel subscriptions, even if they're private.
   295  	DataportabilityYoutubeSubscriptionsScope = "https://www.googleapis.com/auth/dataportability.youtube.subscriptions"
   296  
   297  	// Move a copy of your unlisted YouTube playlists.
   298  	DataportabilityYoutubeUnlistedPlaylistsScope = "https://www.googleapis.com/auth/dataportability.youtube.unlisted_playlists"
   299  
   300  	// Move a copy of your unlisted YouTube videos and information about them.
   301  	DataportabilityYoutubeUnlistedVideosScope = "https://www.googleapis.com/auth/dataportability.youtube.unlisted_videos"
   302  )
   303  
   304  // NewService creates a new Service.
   305  func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
   306  	scopesOption := internaloption.WithDefaultScopes(
   307  		"https://www.googleapis.com/auth/dataportability.businessmessaging.conversations",
   308  		"https://www.googleapis.com/auth/dataportability.chrome.autofill",
   309  		"https://www.googleapis.com/auth/dataportability.chrome.bookmarks",
   310  		"https://www.googleapis.com/auth/dataportability.chrome.dictionary",
   311  		"https://www.googleapis.com/auth/dataportability.chrome.extensions",
   312  		"https://www.googleapis.com/auth/dataportability.chrome.history",
   313  		"https://www.googleapis.com/auth/dataportability.chrome.reading_list",
   314  		"https://www.googleapis.com/auth/dataportability.chrome.settings",
   315  		"https://www.googleapis.com/auth/dataportability.discover.follows",
   316  		"https://www.googleapis.com/auth/dataportability.discover.likes",
   317  		"https://www.googleapis.com/auth/dataportability.discover.not_interested",
   318  		"https://www.googleapis.com/auth/dataportability.maps.aliased_places",
   319  		"https://www.googleapis.com/auth/dataportability.maps.commute_routes",
   320  		"https://www.googleapis.com/auth/dataportability.maps.commute_settings",
   321  		"https://www.googleapis.com/auth/dataportability.maps.ev_profile",
   322  		"https://www.googleapis.com/auth/dataportability.maps.factual_contributions",
   323  		"https://www.googleapis.com/auth/dataportability.maps.offering_contributions",
   324  		"https://www.googleapis.com/auth/dataportability.maps.photos_videos",
   325  		"https://www.googleapis.com/auth/dataportability.maps.questions_answers",
   326  		"https://www.googleapis.com/auth/dataportability.maps.reviews",
   327  		"https://www.googleapis.com/auth/dataportability.maps.starred_places",
   328  		"https://www.googleapis.com/auth/dataportability.myactivity.maps",
   329  		"https://www.googleapis.com/auth/dataportability.myactivity.myadcenter",
   330  		"https://www.googleapis.com/auth/dataportability.myactivity.play",
   331  		"https://www.googleapis.com/auth/dataportability.myactivity.search",
   332  		"https://www.googleapis.com/auth/dataportability.myactivity.shopping",
   333  		"https://www.googleapis.com/auth/dataportability.myactivity.youtube",
   334  		"https://www.googleapis.com/auth/dataportability.mymaps.maps",
   335  		"https://www.googleapis.com/auth/dataportability.order_reserve.purchases_reservations",
   336  		"https://www.googleapis.com/auth/dataportability.play.devices",
   337  		"https://www.googleapis.com/auth/dataportability.play.grouping",
   338  		"https://www.googleapis.com/auth/dataportability.play.installs",
   339  		"https://www.googleapis.com/auth/dataportability.play.library",
   340  		"https://www.googleapis.com/auth/dataportability.play.playpoints",
   341  		"https://www.googleapis.com/auth/dataportability.play.promotions",
   342  		"https://www.googleapis.com/auth/dataportability.play.purchases",
   343  		"https://www.googleapis.com/auth/dataportability.play.redemptions",
   344  		"https://www.googleapis.com/auth/dataportability.play.subscriptions",
   345  		"https://www.googleapis.com/auth/dataportability.play.usersettings",
   346  		"https://www.googleapis.com/auth/dataportability.saved.collections",
   347  		"https://www.googleapis.com/auth/dataportability.search_ugc.media.reviews_and_stars",
   348  		"https://www.googleapis.com/auth/dataportability.search_ugc.media.streaming_video_providers",
   349  		"https://www.googleapis.com/auth/dataportability.search_ugc.media.thumbs",
   350  		"https://www.googleapis.com/auth/dataportability.search_ugc.media.watched",
   351  		"https://www.googleapis.com/auth/dataportability.searchnotifications.settings",
   352  		"https://www.googleapis.com/auth/dataportability.searchnotifications.subscriptions",
   353  		"https://www.googleapis.com/auth/dataportability.shopping.addresses",
   354  		"https://www.googleapis.com/auth/dataportability.shopping.reviews",
   355  		"https://www.googleapis.com/auth/dataportability.streetview.imagery",
   356  		"https://www.googleapis.com/auth/dataportability.youtube.channel",
   357  		"https://www.googleapis.com/auth/dataportability.youtube.comments",
   358  		"https://www.googleapis.com/auth/dataportability.youtube.live_chat",
   359  		"https://www.googleapis.com/auth/dataportability.youtube.music",
   360  		"https://www.googleapis.com/auth/dataportability.youtube.playable",
   361  		"https://www.googleapis.com/auth/dataportability.youtube.posts",
   362  		"https://www.googleapis.com/auth/dataportability.youtube.private_playlists",
   363  		"https://www.googleapis.com/auth/dataportability.youtube.private_videos",
   364  		"https://www.googleapis.com/auth/dataportability.youtube.public_playlists",
   365  		"https://www.googleapis.com/auth/dataportability.youtube.public_videos",
   366  		"https://www.googleapis.com/auth/dataportability.youtube.shopping",
   367  		"https://www.googleapis.com/auth/dataportability.youtube.subscriptions",
   368  		"https://www.googleapis.com/auth/dataportability.youtube.unlisted_playlists",
   369  		"https://www.googleapis.com/auth/dataportability.youtube.unlisted_videos",
   370  	)
   371  	// NOTE: prepend, so we don't override user-specified scopes.
   372  	opts = append([]option.ClientOption{scopesOption}, opts...)
   373  	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
   374  	opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
   375  	opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
   376  	opts = append(opts, internaloption.EnableNewAuthLibrary())
   377  	client, endpoint, err := htransport.NewClient(ctx, opts...)
   378  	if err != nil {
   379  		return nil, err
   380  	}
   381  	s, err := New(client)
   382  	if err != nil {
   383  		return nil, err
   384  	}
   385  	if endpoint != "" {
   386  		s.BasePath = endpoint
   387  	}
   388  	return s, nil
   389  }
   390  
   391  // New creates a new Service. It uses the provided http.Client for requests.
   392  //
   393  // Deprecated: please use NewService instead.
   394  // To provide a custom HTTP client, use option.WithHTTPClient.
   395  // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
   396  func New(client *http.Client) (*Service, error) {
   397  	if client == nil {
   398  		return nil, errors.New("client is nil")
   399  	}
   400  	s := &Service{client: client, BasePath: basePath}
   401  	s.ArchiveJobs = NewArchiveJobsService(s)
   402  	s.Authorization = NewAuthorizationService(s)
   403  	s.PortabilityArchive = NewPortabilityArchiveService(s)
   404  	return s, nil
   405  }
   406  
   407  type Service struct {
   408  	client    *http.Client
   409  	BasePath  string // API endpoint base URL
   410  	UserAgent string // optional additional User-Agent fragment
   411  
   412  	ArchiveJobs *ArchiveJobsService
   413  
   414  	Authorization *AuthorizationService
   415  
   416  	PortabilityArchive *PortabilityArchiveService
   417  }
   418  
   419  func (s *Service) userAgent() string {
   420  	if s.UserAgent == "" {
   421  		return googleapi.UserAgent
   422  	}
   423  	return googleapi.UserAgent + " " + s.UserAgent
   424  }
   425  
   426  func NewArchiveJobsService(s *Service) *ArchiveJobsService {
   427  	rs := &ArchiveJobsService{s: s}
   428  	return rs
   429  }
   430  
   431  type ArchiveJobsService struct {
   432  	s *Service
   433  }
   434  
   435  func NewAuthorizationService(s *Service) *AuthorizationService {
   436  	rs := &AuthorizationService{s: s}
   437  	return rs
   438  }
   439  
   440  type AuthorizationService struct {
   441  	s *Service
   442  }
   443  
   444  func NewPortabilityArchiveService(s *Service) *PortabilityArchiveService {
   445  	rs := &PortabilityArchiveService{s: s}
   446  	return rs
   447  }
   448  
   449  type PortabilityArchiveService struct {
   450  	s *Service
   451  }
   452  
   453  // Empty: A generic empty message that you can re-use to avoid defining
   454  // duplicated empty messages in your APIs. A typical example is to use it as
   455  // the request or the response type of an API method. For instance: service Foo
   456  // { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
   457  type Empty struct {
   458  	// ServerResponse contains the HTTP response code and headers from the server.
   459  	googleapi.ServerResponse `json:"-"`
   460  }
   461  
   462  // InitiatePortabilityArchiveRequest: Request to kick off an Archive job.
   463  type InitiatePortabilityArchiveRequest struct {
   464  	// Resources: The resources from which you're exporting data. These values have
   465  	// a 1:1 correspondence with the OAuth scopes.
   466  	Resources []string `json:"resources,omitempty"`
   467  	// ForceSendFields is a list of field names (e.g. "Resources") to
   468  	// unconditionally include in API requests. By default, fields with empty or
   469  	// default values are omitted from API requests. See
   470  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   471  	// details.
   472  	ForceSendFields []string `json:"-"`
   473  	// NullFields is a list of field names (e.g. "Resources") to include in API
   474  	// requests with the JSON null value. By default, fields with empty values are
   475  	// omitted from API requests. See
   476  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   477  	NullFields []string `json:"-"`
   478  }
   479  
   480  func (s *InitiatePortabilityArchiveRequest) MarshalJSON() ([]byte, error) {
   481  	type NoMethod InitiatePortabilityArchiveRequest
   482  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   483  }
   484  
   485  // InitiatePortabilityArchiveResponse: Response from initiating an Archive job.
   486  type InitiatePortabilityArchiveResponse struct {
   487  	// ArchiveJobId: The archive job ID that is initiated in the API. This can be
   488  	// used to get the state of the job.
   489  	ArchiveJobId string `json:"archiveJobId,omitempty"`
   490  
   491  	// ServerResponse contains the HTTP response code and headers from the server.
   492  	googleapi.ServerResponse `json:"-"`
   493  	// ForceSendFields is a list of field names (e.g. "ArchiveJobId") to
   494  	// unconditionally include in API requests. By default, fields with empty or
   495  	// default values are omitted from API requests. See
   496  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   497  	// details.
   498  	ForceSendFields []string `json:"-"`
   499  	// NullFields is a list of field names (e.g. "ArchiveJobId") to include in API
   500  	// requests with the JSON null value. By default, fields with empty values are
   501  	// omitted from API requests. See
   502  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   503  	NullFields []string `json:"-"`
   504  }
   505  
   506  func (s *InitiatePortabilityArchiveResponse) MarshalJSON() ([]byte, error) {
   507  	type NoMethod InitiatePortabilityArchiveResponse
   508  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   509  }
   510  
   511  // PortabilityArchiveState: Resource that contains the state of an Archive job.
   512  type PortabilityArchiveState struct {
   513  	// Name: The resource name of ArchiveJob's PortabilityArchiveState singleton.
   514  	// The format is: archiveJobs/{archive_job}/portabilityArchiveState.
   515  	// archive_job is the job ID provided in the request.
   516  	Name string `json:"name,omitempty"`
   517  	// State: Resource that represents the state of the Archive job.
   518  	//
   519  	// Possible values:
   520  	//   "STATE_UNSPECIFIED" - Default value. This value is unused.
   521  	//   "IN_PROGRESS" - The job is in progress.
   522  	//   "COMPLETE" - The job is complete.
   523  	//   "FAILED" - The job failed.
   524  	//   "CANCELLED" - The job is cancelled.
   525  	State string `json:"state,omitempty"`
   526  	// Urls: If the state is complete, this method returns the signed URLs of the
   527  	// objects in the Cloud Storage bucket.
   528  	Urls []string `json:"urls,omitempty"`
   529  
   530  	// ServerResponse contains the HTTP response code and headers from the server.
   531  	googleapi.ServerResponse `json:"-"`
   532  	// ForceSendFields is a list of field names (e.g. "Name") to unconditionally
   533  	// include in API requests. By default, fields with empty or default values are
   534  	// omitted from API requests. See
   535  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   536  	// details.
   537  	ForceSendFields []string `json:"-"`
   538  	// NullFields is a list of field names (e.g. "Name") to include in API requests
   539  	// with the JSON null value. By default, fields with empty values are omitted
   540  	// from API requests. See
   541  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   542  	NullFields []string `json:"-"`
   543  }
   544  
   545  func (s *PortabilityArchiveState) MarshalJSON() ([]byte, error) {
   546  	type NoMethod PortabilityArchiveState
   547  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   548  }
   549  
   550  // ResetAuthorizationRequest: Request to reset exhausted OAuth scopes.
   551  type ResetAuthorizationRequest struct {
   552  }
   553  
   554  // RetryPortabilityArchiveRequest: Request to retry a failed Portability
   555  // Archive job.
   556  type RetryPortabilityArchiveRequest struct {
   557  }
   558  
   559  // RetryPortabilityArchiveResponse: Response from retrying a Portability
   560  // Archive.
   561  type RetryPortabilityArchiveResponse struct {
   562  	// ArchiveJobId: The archive job ID that is initiated by the retry endpoint.
   563  	// This can be used to get the state of the new job.
   564  	ArchiveJobId string `json:"archiveJobId,omitempty"`
   565  
   566  	// ServerResponse contains the HTTP response code and headers from the server.
   567  	googleapi.ServerResponse `json:"-"`
   568  	// ForceSendFields is a list of field names (e.g. "ArchiveJobId") to
   569  	// unconditionally include in API requests. By default, fields with empty or
   570  	// default values are omitted from API requests. See
   571  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   572  	// details.
   573  	ForceSendFields []string `json:"-"`
   574  	// NullFields is a list of field names (e.g. "ArchiveJobId") to include in API
   575  	// requests with the JSON null value. By default, fields with empty values are
   576  	// omitted from API requests. See
   577  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   578  	NullFields []string `json:"-"`
   579  }
   580  
   581  func (s *RetryPortabilityArchiveResponse) MarshalJSON() ([]byte, error) {
   582  	type NoMethod RetryPortabilityArchiveResponse
   583  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   584  }
   585  
   586  type ArchiveJobsGetPortabilityArchiveStateCall struct {
   587  	s            *Service
   588  	name         string
   589  	urlParams_   gensupport.URLParams
   590  	ifNoneMatch_ string
   591  	ctx_         context.Context
   592  	header_      http.Header
   593  }
   594  
   595  // GetPortabilityArchiveState: Retrieves the state of an Archive job for the
   596  // Portability API.
   597  //
   598  //   - name: The archive job ID that is returned when you request the state of
   599  //     the job. The format is: archiveJobs/{archive_job}/portabilityArchiveState.
   600  //     archive_job is the job ID returned by the
   601  //     InitiatePortabilityArchiveResponse.
   602  func (r *ArchiveJobsService) GetPortabilityArchiveState(name string) *ArchiveJobsGetPortabilityArchiveStateCall {
   603  	c := &ArchiveJobsGetPortabilityArchiveStateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   604  	c.name = name
   605  	return c
   606  }
   607  
   608  // Fields allows partial responses to be retrieved. See
   609  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   610  // details.
   611  func (c *ArchiveJobsGetPortabilityArchiveStateCall) Fields(s ...googleapi.Field) *ArchiveJobsGetPortabilityArchiveStateCall {
   612  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   613  	return c
   614  }
   615  
   616  // IfNoneMatch sets an optional parameter which makes the operation fail if the
   617  // object's ETag matches the given value. This is useful for getting updates
   618  // only after the object has changed since the last request.
   619  func (c *ArchiveJobsGetPortabilityArchiveStateCall) IfNoneMatch(entityTag string) *ArchiveJobsGetPortabilityArchiveStateCall {
   620  	c.ifNoneMatch_ = entityTag
   621  	return c
   622  }
   623  
   624  // Context sets the context to be used in this call's Do method.
   625  func (c *ArchiveJobsGetPortabilityArchiveStateCall) Context(ctx context.Context) *ArchiveJobsGetPortabilityArchiveStateCall {
   626  	c.ctx_ = ctx
   627  	return c
   628  }
   629  
   630  // Header returns a http.Header that can be modified by the caller to add
   631  // headers to the request.
   632  func (c *ArchiveJobsGetPortabilityArchiveStateCall) Header() http.Header {
   633  	if c.header_ == nil {
   634  		c.header_ = make(http.Header)
   635  	}
   636  	return c.header_
   637  }
   638  
   639  func (c *ArchiveJobsGetPortabilityArchiveStateCall) doRequest(alt string) (*http.Response, error) {
   640  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   641  	if c.ifNoneMatch_ != "" {
   642  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   643  	}
   644  	var body io.Reader = nil
   645  	c.urlParams_.Set("alt", alt)
   646  	c.urlParams_.Set("prettyPrint", "false")
   647  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}")
   648  	urls += "?" + c.urlParams_.Encode()
   649  	req, err := http.NewRequest("GET", urls, body)
   650  	if err != nil {
   651  		return nil, err
   652  	}
   653  	req.Header = reqHeaders
   654  	googleapi.Expand(req.URL, map[string]string{
   655  		"name": c.name,
   656  	})
   657  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   658  }
   659  
   660  // Do executes the "dataportability.archiveJobs.getPortabilityArchiveState" call.
   661  // Any non-2xx status code is an error. Response headers are in either
   662  // *PortabilityArchiveState.ServerResponse.Header or (if a response was
   663  // returned at all) in error.(*googleapi.Error).Header. Use
   664  // googleapi.IsNotModified to check whether the returned error was because
   665  // http.StatusNotModified was returned.
   666  func (c *ArchiveJobsGetPortabilityArchiveStateCall) Do(opts ...googleapi.CallOption) (*PortabilityArchiveState, error) {
   667  	gensupport.SetOptions(c.urlParams_, opts...)
   668  	res, err := c.doRequest("json")
   669  	if res != nil && res.StatusCode == http.StatusNotModified {
   670  		if res.Body != nil {
   671  			res.Body.Close()
   672  		}
   673  		return nil, gensupport.WrapError(&googleapi.Error{
   674  			Code:   res.StatusCode,
   675  			Header: res.Header,
   676  		})
   677  	}
   678  	if err != nil {
   679  		return nil, err
   680  	}
   681  	defer googleapi.CloseBody(res)
   682  	if err := googleapi.CheckResponse(res); err != nil {
   683  		return nil, gensupport.WrapError(err)
   684  	}
   685  	ret := &PortabilityArchiveState{
   686  		ServerResponse: googleapi.ServerResponse{
   687  			Header:         res.Header,
   688  			HTTPStatusCode: res.StatusCode,
   689  		},
   690  	}
   691  	target := &ret
   692  	if err := gensupport.DecodeResponse(target, res); err != nil {
   693  		return nil, err
   694  	}
   695  	return ret, nil
   696  }
   697  
   698  type ArchiveJobsRetryCall struct {
   699  	s                              *Service
   700  	name                           string
   701  	retryportabilityarchiverequest *RetryPortabilityArchiveRequest
   702  	urlParams_                     gensupport.URLParams
   703  	ctx_                           context.Context
   704  	header_                        http.Header
   705  }
   706  
   707  // Retry: Retries a failed Portability Archive job.
   708  //
   709  //   - name: The Archive job ID you're retrying. This is returned by the
   710  //     InitiatePortabilityArchiveResponse. Retrying is only executed if the
   711  //     initial job failed.
   712  func (r *ArchiveJobsService) Retry(name string, retryportabilityarchiverequest *RetryPortabilityArchiveRequest) *ArchiveJobsRetryCall {
   713  	c := &ArchiveJobsRetryCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   714  	c.name = name
   715  	c.retryportabilityarchiverequest = retryportabilityarchiverequest
   716  	return c
   717  }
   718  
   719  // Fields allows partial responses to be retrieved. See
   720  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   721  // details.
   722  func (c *ArchiveJobsRetryCall) Fields(s ...googleapi.Field) *ArchiveJobsRetryCall {
   723  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   724  	return c
   725  }
   726  
   727  // Context sets the context to be used in this call's Do method.
   728  func (c *ArchiveJobsRetryCall) Context(ctx context.Context) *ArchiveJobsRetryCall {
   729  	c.ctx_ = ctx
   730  	return c
   731  }
   732  
   733  // Header returns a http.Header that can be modified by the caller to add
   734  // headers to the request.
   735  func (c *ArchiveJobsRetryCall) Header() http.Header {
   736  	if c.header_ == nil {
   737  		c.header_ = make(http.Header)
   738  	}
   739  	return c.header_
   740  }
   741  
   742  func (c *ArchiveJobsRetryCall) doRequest(alt string) (*http.Response, error) {
   743  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
   744  	var body io.Reader = nil
   745  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.retryportabilityarchiverequest)
   746  	if err != nil {
   747  		return nil, err
   748  	}
   749  	c.urlParams_.Set("alt", alt)
   750  	c.urlParams_.Set("prettyPrint", "false")
   751  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}:retry")
   752  	urls += "?" + c.urlParams_.Encode()
   753  	req, err := http.NewRequest("POST", urls, body)
   754  	if err != nil {
   755  		return nil, err
   756  	}
   757  	req.Header = reqHeaders
   758  	googleapi.Expand(req.URL, map[string]string{
   759  		"name": c.name,
   760  	})
   761  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   762  }
   763  
   764  // Do executes the "dataportability.archiveJobs.retry" call.
   765  // Any non-2xx status code is an error. Response headers are in either
   766  // *RetryPortabilityArchiveResponse.ServerResponse.Header or (if a response was
   767  // returned at all) in error.(*googleapi.Error).Header. Use
   768  // googleapi.IsNotModified to check whether the returned error was because
   769  // http.StatusNotModified was returned.
   770  func (c *ArchiveJobsRetryCall) Do(opts ...googleapi.CallOption) (*RetryPortabilityArchiveResponse, error) {
   771  	gensupport.SetOptions(c.urlParams_, opts...)
   772  	res, err := c.doRequest("json")
   773  	if res != nil && res.StatusCode == http.StatusNotModified {
   774  		if res.Body != nil {
   775  			res.Body.Close()
   776  		}
   777  		return nil, gensupport.WrapError(&googleapi.Error{
   778  			Code:   res.StatusCode,
   779  			Header: res.Header,
   780  		})
   781  	}
   782  	if err != nil {
   783  		return nil, err
   784  	}
   785  	defer googleapi.CloseBody(res)
   786  	if err := googleapi.CheckResponse(res); err != nil {
   787  		return nil, gensupport.WrapError(err)
   788  	}
   789  	ret := &RetryPortabilityArchiveResponse{
   790  		ServerResponse: googleapi.ServerResponse{
   791  			Header:         res.Header,
   792  			HTTPStatusCode: res.StatusCode,
   793  		},
   794  	}
   795  	target := &ret
   796  	if err := gensupport.DecodeResponse(target, res); err != nil {
   797  		return nil, err
   798  	}
   799  	return ret, nil
   800  }
   801  
   802  type AuthorizationResetCall struct {
   803  	s                         *Service
   804  	resetauthorizationrequest *ResetAuthorizationRequest
   805  	urlParams_                gensupport.URLParams
   806  	ctx_                      context.Context
   807  	header_                   http.Header
   808  }
   809  
   810  // Reset: Revokes OAuth tokens and resets exhausted scopes for a user/project
   811  // pair. This method allows you to initiate a request after a new consent is
   812  // granted. This method also indicates that previous archives can be garbage
   813  // collected. You should call this method when all jobs are complete and all
   814  // archives are downloaded. Do not call it only when you start a new job.
   815  func (r *AuthorizationService) Reset(resetauthorizationrequest *ResetAuthorizationRequest) *AuthorizationResetCall {
   816  	c := &AuthorizationResetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   817  	c.resetauthorizationrequest = resetauthorizationrequest
   818  	return c
   819  }
   820  
   821  // Fields allows partial responses to be retrieved. See
   822  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   823  // details.
   824  func (c *AuthorizationResetCall) Fields(s ...googleapi.Field) *AuthorizationResetCall {
   825  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   826  	return c
   827  }
   828  
   829  // Context sets the context to be used in this call's Do method.
   830  func (c *AuthorizationResetCall) Context(ctx context.Context) *AuthorizationResetCall {
   831  	c.ctx_ = ctx
   832  	return c
   833  }
   834  
   835  // Header returns a http.Header that can be modified by the caller to add
   836  // headers to the request.
   837  func (c *AuthorizationResetCall) Header() http.Header {
   838  	if c.header_ == nil {
   839  		c.header_ = make(http.Header)
   840  	}
   841  	return c.header_
   842  }
   843  
   844  func (c *AuthorizationResetCall) doRequest(alt string) (*http.Response, error) {
   845  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
   846  	var body io.Reader = nil
   847  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.resetauthorizationrequest)
   848  	if err != nil {
   849  		return nil, err
   850  	}
   851  	c.urlParams_.Set("alt", alt)
   852  	c.urlParams_.Set("prettyPrint", "false")
   853  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/authorization:reset")
   854  	urls += "?" + c.urlParams_.Encode()
   855  	req, err := http.NewRequest("POST", urls, body)
   856  	if err != nil {
   857  		return nil, err
   858  	}
   859  	req.Header = reqHeaders
   860  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   861  }
   862  
   863  // Do executes the "dataportability.authorization.reset" call.
   864  // Any non-2xx status code is an error. Response headers are in either
   865  // *Empty.ServerResponse.Header or (if a response was returned at all) in
   866  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
   867  // whether the returned error was because http.StatusNotModified was returned.
   868  func (c *AuthorizationResetCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
   869  	gensupport.SetOptions(c.urlParams_, opts...)
   870  	res, err := c.doRequest("json")
   871  	if res != nil && res.StatusCode == http.StatusNotModified {
   872  		if res.Body != nil {
   873  			res.Body.Close()
   874  		}
   875  		return nil, gensupport.WrapError(&googleapi.Error{
   876  			Code:   res.StatusCode,
   877  			Header: res.Header,
   878  		})
   879  	}
   880  	if err != nil {
   881  		return nil, err
   882  	}
   883  	defer googleapi.CloseBody(res)
   884  	if err := googleapi.CheckResponse(res); err != nil {
   885  		return nil, gensupport.WrapError(err)
   886  	}
   887  	ret := &Empty{
   888  		ServerResponse: googleapi.ServerResponse{
   889  			Header:         res.Header,
   890  			HTTPStatusCode: res.StatusCode,
   891  		},
   892  	}
   893  	target := &ret
   894  	if err := gensupport.DecodeResponse(target, res); err != nil {
   895  		return nil, err
   896  	}
   897  	return ret, nil
   898  }
   899  
   900  type PortabilityArchiveInitiateCall struct {
   901  	s                                 *Service
   902  	initiateportabilityarchiverequest *InitiatePortabilityArchiveRequest
   903  	urlParams_                        gensupport.URLParams
   904  	ctx_                              context.Context
   905  	header_                           http.Header
   906  }
   907  
   908  // Initiate: Initiates a new Archive job for the Portability API.
   909  func (r *PortabilityArchiveService) Initiate(initiateportabilityarchiverequest *InitiatePortabilityArchiveRequest) *PortabilityArchiveInitiateCall {
   910  	c := &PortabilityArchiveInitiateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   911  	c.initiateportabilityarchiverequest = initiateportabilityarchiverequest
   912  	return c
   913  }
   914  
   915  // Fields allows partial responses to be retrieved. See
   916  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   917  // details.
   918  func (c *PortabilityArchiveInitiateCall) Fields(s ...googleapi.Field) *PortabilityArchiveInitiateCall {
   919  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   920  	return c
   921  }
   922  
   923  // Context sets the context to be used in this call's Do method.
   924  func (c *PortabilityArchiveInitiateCall) Context(ctx context.Context) *PortabilityArchiveInitiateCall {
   925  	c.ctx_ = ctx
   926  	return c
   927  }
   928  
   929  // Header returns a http.Header that can be modified by the caller to add
   930  // headers to the request.
   931  func (c *PortabilityArchiveInitiateCall) Header() http.Header {
   932  	if c.header_ == nil {
   933  		c.header_ = make(http.Header)
   934  	}
   935  	return c.header_
   936  }
   937  
   938  func (c *PortabilityArchiveInitiateCall) doRequest(alt string) (*http.Response, error) {
   939  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
   940  	var body io.Reader = nil
   941  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.initiateportabilityarchiverequest)
   942  	if err != nil {
   943  		return nil, err
   944  	}
   945  	c.urlParams_.Set("alt", alt)
   946  	c.urlParams_.Set("prettyPrint", "false")
   947  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/portabilityArchive:initiate")
   948  	urls += "?" + c.urlParams_.Encode()
   949  	req, err := http.NewRequest("POST", urls, body)
   950  	if err != nil {
   951  		return nil, err
   952  	}
   953  	req.Header = reqHeaders
   954  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   955  }
   956  
   957  // Do executes the "dataportability.portabilityArchive.initiate" call.
   958  // Any non-2xx status code is an error. Response headers are in either
   959  // *InitiatePortabilityArchiveResponse.ServerResponse.Header or (if a response
   960  // was returned at all) in error.(*googleapi.Error).Header. Use
   961  // googleapi.IsNotModified to check whether the returned error was because
   962  // http.StatusNotModified was returned.
   963  func (c *PortabilityArchiveInitiateCall) Do(opts ...googleapi.CallOption) (*InitiatePortabilityArchiveResponse, error) {
   964  	gensupport.SetOptions(c.urlParams_, opts...)
   965  	res, err := c.doRequest("json")
   966  	if res != nil && res.StatusCode == http.StatusNotModified {
   967  		if res.Body != nil {
   968  			res.Body.Close()
   969  		}
   970  		return nil, gensupport.WrapError(&googleapi.Error{
   971  			Code:   res.StatusCode,
   972  			Header: res.Header,
   973  		})
   974  	}
   975  	if err != nil {
   976  		return nil, err
   977  	}
   978  	defer googleapi.CloseBody(res)
   979  	if err := googleapi.CheckResponse(res); err != nil {
   980  		return nil, gensupport.WrapError(err)
   981  	}
   982  	ret := &InitiatePortabilityArchiveResponse{
   983  		ServerResponse: googleapi.ServerResponse{
   984  			Header:         res.Header,
   985  			HTTPStatusCode: res.StatusCode,
   986  		},
   987  	}
   988  	target := &ret
   989  	if err := gensupport.DecodeResponse(target, res); err != nil {
   990  		return nil, err
   991  	}
   992  	return ret, nil
   993  }
   994  

View as plain text