...

Source file src/google.golang.org/api/androidpublisher/v2/androidpublisher-gen.go

Documentation: google.golang.org/api/androidpublisher/v2

     1  // Copyright 2020 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 androidpublisher provides access to the Google Play Developer API.
     8  //
     9  // For product documentation, see: https://developers.google.com/android-publisher
    10  //
    11  // # Creating a client
    12  //
    13  // Usage example:
    14  //
    15  //	import "google.golang.org/api/androidpublisher/v2"
    16  //	...
    17  //	ctx := context.Background()
    18  //	androidpublisherService, err := androidpublisher.NewService(ctx)
    19  //
    20  // In this example, Google Application Default Credentials are used for authentication.
    21  //
    22  // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
    23  //
    24  // # Other authentication options
    25  //
    26  // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
    27  //
    28  //	androidpublisherService, err := androidpublisher.NewService(ctx, option.WithAPIKey("AIza..."))
    29  //
    30  // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
    31  //
    32  //	config := &oauth2.Config{...}
    33  //	// ...
    34  //	token, err := config.Exchange(ctx, ...)
    35  //	androidpublisherService, err := androidpublisher.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    36  //
    37  // See https://godoc.org/google.golang.org/api/option/ for details on options.
    38  package androidpublisher // import "google.golang.org/api/androidpublisher/v2"
    39  
    40  import (
    41  	"bytes"
    42  	"context"
    43  	"encoding/json"
    44  	"errors"
    45  	"fmt"
    46  	"io"
    47  	"net/http"
    48  	"net/url"
    49  	"strconv"
    50  	"strings"
    51  
    52  	googleapi "google.golang.org/api/googleapi"
    53  	gensupport "google.golang.org/api/internal/gensupport"
    54  	option "google.golang.org/api/option"
    55  	internaloption "google.golang.org/api/option/internaloption"
    56  	htransport "google.golang.org/api/transport/http"
    57  )
    58  
    59  // Always reference these packages, just in case the auto-generated code
    60  // below doesn't.
    61  var _ = bytes.NewBuffer
    62  var _ = strconv.Itoa
    63  var _ = fmt.Sprintf
    64  var _ = json.NewDecoder
    65  var _ = io.Copy
    66  var _ = url.Parse
    67  var _ = gensupport.MarshalJSON
    68  var _ = googleapi.Version
    69  var _ = errors.New
    70  var _ = strings.Replace
    71  var _ = context.Canceled
    72  var _ = internaloption.WithDefaultEndpoint
    73  
    74  const apiId = "androidpublisher:v2"
    75  const apiName = "androidpublisher"
    76  const apiVersion = "v2"
    77  const basePath = "https://www.googleapis.com/androidpublisher/v2/applications/"
    78  
    79  // OAuth2 scopes used by this API.
    80  const (
    81  	// View and manage your Google Play Developer account
    82  	AndroidpublisherScope = "https://www.googleapis.com/auth/androidpublisher"
    83  )
    84  
    85  // NewService creates a new Service.
    86  func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
    87  	scopesOption := option.WithScopes(
    88  		"https://www.googleapis.com/auth/androidpublisher",
    89  	)
    90  	// NOTE: prepend, so we don't override user-specified scopes.
    91  	opts = append([]option.ClientOption{scopesOption}, opts...)
    92  	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
    93  	client, endpoint, err := htransport.NewClient(ctx, opts...)
    94  	if err != nil {
    95  		return nil, err
    96  	}
    97  	s, err := New(client)
    98  	if err != nil {
    99  		return nil, err
   100  	}
   101  	if endpoint != "" {
   102  		s.BasePath = endpoint
   103  	}
   104  	return s, nil
   105  }
   106  
   107  // New creates a new Service. It uses the provided http.Client for requests.
   108  //
   109  // Deprecated: please use NewService instead.
   110  // To provide a custom HTTP client, use option.WithHTTPClient.
   111  // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
   112  func New(client *http.Client) (*Service, error) {
   113  	if client == nil {
   114  		return nil, errors.New("client is nil")
   115  	}
   116  	s := &Service{client: client, BasePath: basePath}
   117  	s.Purchases = NewPurchasesService(s)
   118  	return s, nil
   119  }
   120  
   121  type Service struct {
   122  	client    *http.Client
   123  	BasePath  string // API endpoint base URL
   124  	UserAgent string // optional additional User-Agent fragment
   125  
   126  	Purchases *PurchasesService
   127  }
   128  
   129  func (s *Service) userAgent() string {
   130  	if s.UserAgent == "" {
   131  		return googleapi.UserAgent
   132  	}
   133  	return googleapi.UserAgent + " " + s.UserAgent
   134  }
   135  
   136  func NewPurchasesService(s *Service) *PurchasesService {
   137  	rs := &PurchasesService{s: s}
   138  	rs.Products = NewPurchasesProductsService(s)
   139  	rs.Voidedpurchases = NewPurchasesVoidedpurchasesService(s)
   140  	return rs
   141  }
   142  
   143  type PurchasesService struct {
   144  	s *Service
   145  
   146  	Products *PurchasesProductsService
   147  
   148  	Voidedpurchases *PurchasesVoidedpurchasesService
   149  }
   150  
   151  func NewPurchasesProductsService(s *Service) *PurchasesProductsService {
   152  	rs := &PurchasesProductsService{s: s}
   153  	return rs
   154  }
   155  
   156  type PurchasesProductsService struct {
   157  	s *Service
   158  }
   159  
   160  func NewPurchasesVoidedpurchasesService(s *Service) *PurchasesVoidedpurchasesService {
   161  	rs := &PurchasesVoidedpurchasesService{s: s}
   162  	return rs
   163  }
   164  
   165  type PurchasesVoidedpurchasesService struct {
   166  	s *Service
   167  }
   168  
   169  type PageInfo struct {
   170  	ResultPerPage int64 `json:"resultPerPage,omitempty"`
   171  
   172  	StartIndex int64 `json:"startIndex,omitempty"`
   173  
   174  	TotalResults int64 `json:"totalResults,omitempty"`
   175  
   176  	// ForceSendFields is a list of field names (e.g. "ResultPerPage") to
   177  	// unconditionally include in API requests. By default, fields with
   178  	// empty values are omitted from API requests. However, any non-pointer,
   179  	// non-interface field appearing in ForceSendFields will be sent to the
   180  	// server regardless of whether the field is empty or not. This may be
   181  	// used to include empty fields in Patch requests.
   182  	ForceSendFields []string `json:"-"`
   183  
   184  	// NullFields is a list of field names (e.g. "ResultPerPage") to include
   185  	// in API requests with the JSON null value. By default, fields with
   186  	// empty values are omitted from API requests. However, any field with
   187  	// an empty value appearing in NullFields will be sent to the server as
   188  	// null. It is an error if a field in this list has a non-empty value.
   189  	// This may be used to include null fields in Patch requests.
   190  	NullFields []string `json:"-"`
   191  }
   192  
   193  func (s *PageInfo) MarshalJSON() ([]byte, error) {
   194  	type NoMethod PageInfo
   195  	raw := NoMethod(*s)
   196  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   197  }
   198  
   199  // ProductPurchase: A ProductPurchase resource indicates the status of a
   200  // user's inapp product purchase.
   201  type ProductPurchase struct {
   202  	// ConsumptionState: The consumption state of the inapp product.
   203  	// Possible values are:
   204  	// - Yet to be consumed
   205  	// - Consumed
   206  	ConsumptionState int64 `json:"consumptionState,omitempty"`
   207  
   208  	// DeveloperPayload: A developer-specified string that contains
   209  	// supplemental information about an order.
   210  	DeveloperPayload string `json:"developerPayload,omitempty"`
   211  
   212  	// Kind: This kind represents an inappPurchase object in the
   213  	// androidpublisher service.
   214  	Kind string `json:"kind,omitempty"`
   215  
   216  	// OrderId: The order id associated with the purchase of the inapp
   217  	// product.
   218  	OrderId string `json:"orderId,omitempty"`
   219  
   220  	// PurchaseState: The purchase state of the order. Possible values are:
   221  	//
   222  	// - Purchased
   223  	// - Canceled
   224  	// - Pending
   225  	PurchaseState int64 `json:"purchaseState,omitempty"`
   226  
   227  	// PurchaseTimeMillis: The time the product was purchased, in
   228  	// milliseconds since the epoch (Jan 1, 1970).
   229  	PurchaseTimeMillis int64 `json:"purchaseTimeMillis,omitempty,string"`
   230  
   231  	// PurchaseType: The type of purchase of the inapp product. This field
   232  	// is only set if this purchase was not made using the standard in-app
   233  	// billing flow. Possible values are:
   234  	// - Test (i.e. purchased from a license testing account)
   235  	// - Promo (i.e. purchased using a promo code)
   236  	// - Rewarded (i.e. from watching a video ad instead of paying)
   237  	PurchaseType *int64 `json:"purchaseType,omitempty"`
   238  
   239  	// ServerResponse contains the HTTP response code and headers from the
   240  	// server.
   241  	googleapi.ServerResponse `json:"-"`
   242  
   243  	// ForceSendFields is a list of field names (e.g. "ConsumptionState") to
   244  	// unconditionally include in API requests. By default, fields with
   245  	// empty values are omitted from API requests. However, any non-pointer,
   246  	// non-interface field appearing in ForceSendFields will be sent to the
   247  	// server regardless of whether the field is empty or not. This may be
   248  	// used to include empty fields in Patch requests.
   249  	ForceSendFields []string `json:"-"`
   250  
   251  	// NullFields is a list of field names (e.g. "ConsumptionState") to
   252  	// include in API requests with the JSON null value. By default, fields
   253  	// with empty values are omitted from API requests. However, any field
   254  	// with an empty value appearing in NullFields will be sent to the
   255  	// server as null. It is an error if a field in this list has a
   256  	// non-empty value. This may be used to include null fields in Patch
   257  	// requests.
   258  	NullFields []string `json:"-"`
   259  }
   260  
   261  func (s *ProductPurchase) MarshalJSON() ([]byte, error) {
   262  	type NoMethod ProductPurchase
   263  	raw := NoMethod(*s)
   264  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   265  }
   266  
   267  type TokenPagination struct {
   268  	NextPageToken string `json:"nextPageToken,omitempty"`
   269  
   270  	PreviousPageToken string `json:"previousPageToken,omitempty"`
   271  
   272  	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
   273  	// unconditionally include in API requests. By default, fields with
   274  	// empty values are omitted from API requests. However, any non-pointer,
   275  	// non-interface field appearing in ForceSendFields will be sent to the
   276  	// server regardless of whether the field is empty or not. This may be
   277  	// used to include empty fields in Patch requests.
   278  	ForceSendFields []string `json:"-"`
   279  
   280  	// NullFields is a list of field names (e.g. "NextPageToken") to include
   281  	// in API requests with the JSON null value. By default, fields with
   282  	// empty values are omitted from API requests. However, any field with
   283  	// an empty value appearing in NullFields will be sent to the server as
   284  	// null. It is an error if a field in this list has a non-empty value.
   285  	// This may be used to include null fields in Patch requests.
   286  	NullFields []string `json:"-"`
   287  }
   288  
   289  func (s *TokenPagination) MarshalJSON() ([]byte, error) {
   290  	type NoMethod TokenPagination
   291  	raw := NoMethod(*s)
   292  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   293  }
   294  
   295  // VoidedPurchase: A VoidedPurchase resource indicates a purchase that
   296  // was either canceled/refunded/charged-back.
   297  type VoidedPurchase struct {
   298  	// Kind: This kind represents a voided purchase object in the
   299  	// androidpublisher service.
   300  	Kind string `json:"kind,omitempty"`
   301  
   302  	// PurchaseTimeMillis: The time at which the purchase was made, in
   303  	// milliseconds since the epoch (Jan 1, 1970).
   304  	PurchaseTimeMillis int64 `json:"purchaseTimeMillis,omitempty,string"`
   305  
   306  	// PurchaseToken: The token which uniquely identifies a one-time
   307  	// purchase or subscription. To uniquely identify subscription renewals
   308  	// use order_id (available starting from version 3 of the API).
   309  	PurchaseToken string `json:"purchaseToken,omitempty"`
   310  
   311  	// VoidedTimeMillis: The time at which the purchase was
   312  	// canceled/refunded/charged-back, in milliseconds since the epoch (Jan
   313  	// 1, 1970).
   314  	VoidedTimeMillis int64 `json:"voidedTimeMillis,omitempty,string"`
   315  
   316  	// ForceSendFields is a list of field names (e.g. "Kind") to
   317  	// unconditionally include in API requests. By default, fields with
   318  	// empty values are omitted from API requests. However, any non-pointer,
   319  	// non-interface field appearing in ForceSendFields will be sent to the
   320  	// server regardless of whether the field is empty or not. This may be
   321  	// used to include empty fields in Patch requests.
   322  	ForceSendFields []string `json:"-"`
   323  
   324  	// NullFields is a list of field names (e.g. "Kind") to include in API
   325  	// requests with the JSON null value. By default, fields with empty
   326  	// values are omitted from API requests. However, any field with an
   327  	// empty value appearing in NullFields will be sent to the server as
   328  	// null. It is an error if a field in this list has a non-empty value.
   329  	// This may be used to include null fields in Patch requests.
   330  	NullFields []string `json:"-"`
   331  }
   332  
   333  func (s *VoidedPurchase) MarshalJSON() ([]byte, error) {
   334  	type NoMethod VoidedPurchase
   335  	raw := NoMethod(*s)
   336  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   337  }
   338  
   339  type VoidedPurchasesListResponse struct {
   340  	PageInfo *PageInfo `json:"pageInfo,omitempty"`
   341  
   342  	TokenPagination *TokenPagination `json:"tokenPagination,omitempty"`
   343  
   344  	VoidedPurchases []*VoidedPurchase `json:"voidedPurchases,omitempty"`
   345  
   346  	// ServerResponse contains the HTTP response code and headers from the
   347  	// server.
   348  	googleapi.ServerResponse `json:"-"`
   349  
   350  	// ForceSendFields is a list of field names (e.g. "PageInfo") to
   351  	// unconditionally include in API requests. By default, fields with
   352  	// empty values are omitted from API requests. However, any non-pointer,
   353  	// non-interface field appearing in ForceSendFields will be sent to the
   354  	// server regardless of whether the field is empty or not. This may be
   355  	// used to include empty fields in Patch requests.
   356  	ForceSendFields []string `json:"-"`
   357  
   358  	// NullFields is a list of field names (e.g. "PageInfo") to include in
   359  	// API requests with the JSON null value. By default, fields with empty
   360  	// values are omitted from API requests. However, any field with an
   361  	// empty value appearing in NullFields will be sent to the server as
   362  	// null. It is an error if a field in this list has a non-empty value.
   363  	// This may be used to include null fields in Patch requests.
   364  	NullFields []string `json:"-"`
   365  }
   366  
   367  func (s *VoidedPurchasesListResponse) MarshalJSON() ([]byte, error) {
   368  	type NoMethod VoidedPurchasesListResponse
   369  	raw := NoMethod(*s)
   370  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   371  }
   372  
   373  // method id "androidpublisher.purchases.products.get":
   374  
   375  type PurchasesProductsGetCall struct {
   376  	s            *Service
   377  	packageName  string
   378  	productId    string
   379  	token        string
   380  	urlParams_   gensupport.URLParams
   381  	ifNoneMatch_ string
   382  	ctx_         context.Context
   383  	header_      http.Header
   384  }
   385  
   386  // Get: Checks the purchase and consumption status of an inapp item.
   387  func (r *PurchasesProductsService) Get(packageName string, productId string, token string) *PurchasesProductsGetCall {
   388  	c := &PurchasesProductsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   389  	c.packageName = packageName
   390  	c.productId = productId
   391  	c.token = token
   392  	return c
   393  }
   394  
   395  // Fields allows partial responses to be retrieved. See
   396  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
   397  // for more information.
   398  func (c *PurchasesProductsGetCall) Fields(s ...googleapi.Field) *PurchasesProductsGetCall {
   399  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   400  	return c
   401  }
   402  
   403  // IfNoneMatch sets the optional parameter which makes the operation
   404  // fail if the object's ETag matches the given value. This is useful for
   405  // getting updates only after the object has changed since the last
   406  // request. Use googleapi.IsNotModified to check whether the response
   407  // error from Do is the result of In-None-Match.
   408  func (c *PurchasesProductsGetCall) IfNoneMatch(entityTag string) *PurchasesProductsGetCall {
   409  	c.ifNoneMatch_ = entityTag
   410  	return c
   411  }
   412  
   413  // Context sets the context to be used in this call's Do method. Any
   414  // pending HTTP request will be aborted if the provided context is
   415  // canceled.
   416  func (c *PurchasesProductsGetCall) Context(ctx context.Context) *PurchasesProductsGetCall {
   417  	c.ctx_ = ctx
   418  	return c
   419  }
   420  
   421  // Header returns an http.Header that can be modified by the caller to
   422  // add HTTP headers to the request.
   423  func (c *PurchasesProductsGetCall) Header() http.Header {
   424  	if c.header_ == nil {
   425  		c.header_ = make(http.Header)
   426  	}
   427  	return c.header_
   428  }
   429  
   430  func (c *PurchasesProductsGetCall) doRequest(alt string) (*http.Response, error) {
   431  	reqHeaders := make(http.Header)
   432  	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200627")
   433  	for k, v := range c.header_ {
   434  		reqHeaders[k] = v
   435  	}
   436  	reqHeaders.Set("User-Agent", c.s.userAgent())
   437  	if c.ifNoneMatch_ != "" {
   438  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   439  	}
   440  	var body io.Reader = nil
   441  	c.urlParams_.Set("alt", alt)
   442  	c.urlParams_.Set("prettyPrint", "false")
   443  	urls := googleapi.ResolveRelative(c.s.BasePath, "{packageName}/purchases/products/{productId}/tokens/{token}")
   444  	urls += "?" + c.urlParams_.Encode()
   445  	req, err := http.NewRequest("GET", urls, body)
   446  	if err != nil {
   447  		return nil, err
   448  	}
   449  	req.Header = reqHeaders
   450  	googleapi.Expand(req.URL, map[string]string{
   451  		"packageName": c.packageName,
   452  		"productId":   c.productId,
   453  		"token":       c.token,
   454  	})
   455  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   456  }
   457  
   458  // Do executes the "androidpublisher.purchases.products.get" call.
   459  // Exactly one of *ProductPurchase or error will be non-nil. Any non-2xx
   460  // status code is an error. Response headers are in either
   461  // *ProductPurchase.ServerResponse.Header or (if a response was returned
   462  // at all) in error.(*googleapi.Error).Header. Use
   463  // googleapi.IsNotModified to check whether the returned error was
   464  // because http.StatusNotModified was returned.
   465  func (c *PurchasesProductsGetCall) Do(opts ...googleapi.CallOption) (*ProductPurchase, error) {
   466  	gensupport.SetOptions(c.urlParams_, opts...)
   467  	res, err := c.doRequest("json")
   468  	if res != nil && res.StatusCode == http.StatusNotModified {
   469  		if res.Body != nil {
   470  			res.Body.Close()
   471  		}
   472  		return nil, &googleapi.Error{
   473  			Code:   res.StatusCode,
   474  			Header: res.Header,
   475  		}
   476  	}
   477  	if err != nil {
   478  		return nil, err
   479  	}
   480  	defer googleapi.CloseBody(res)
   481  	if err := googleapi.CheckResponse(res); err != nil {
   482  		return nil, err
   483  	}
   484  	ret := &ProductPurchase{
   485  		ServerResponse: googleapi.ServerResponse{
   486  			Header:         res.Header,
   487  			HTTPStatusCode: res.StatusCode,
   488  		},
   489  	}
   490  	target := &ret
   491  	if err := gensupport.DecodeResponse(target, res); err != nil {
   492  		return nil, err
   493  	}
   494  	return ret, nil
   495  	// {
   496  	//   "description": "Checks the purchase and consumption status of an inapp item.",
   497  	//   "httpMethod": "GET",
   498  	//   "id": "androidpublisher.purchases.products.get",
   499  	//   "parameterOrder": [
   500  	//     "packageName",
   501  	//     "productId",
   502  	//     "token"
   503  	//   ],
   504  	//   "parameters": {
   505  	//     "packageName": {
   506  	//       "description": "The package name of the application the inapp product was sold in (for example, 'com.some.thing').",
   507  	//       "location": "path",
   508  	//       "required": true,
   509  	//       "type": "string"
   510  	//     },
   511  	//     "productId": {
   512  	//       "description": "The inapp product SKU (for example, 'com.some.thing.inapp1').",
   513  	//       "location": "path",
   514  	//       "required": true,
   515  	//       "type": "string"
   516  	//     },
   517  	//     "token": {
   518  	//       "description": "The token provided to the user's device when the inapp product was purchased.",
   519  	//       "location": "path",
   520  	//       "required": true,
   521  	//       "type": "string"
   522  	//     }
   523  	//   },
   524  	//   "path": "{packageName}/purchases/products/{productId}/tokens/{token}",
   525  	//   "response": {
   526  	//     "$ref": "ProductPurchase"
   527  	//   },
   528  	//   "scopes": [
   529  	//     "https://www.googleapis.com/auth/androidpublisher"
   530  	//   ]
   531  	// }
   532  
   533  }
   534  
   535  // method id "androidpublisher.purchases.voidedpurchases.list":
   536  
   537  type PurchasesVoidedpurchasesListCall struct {
   538  	s            *Service
   539  	packageName  string
   540  	urlParams_   gensupport.URLParams
   541  	ifNoneMatch_ string
   542  	ctx_         context.Context
   543  	header_      http.Header
   544  }
   545  
   546  // List: Lists the purchases that were canceled, refunded or
   547  // charged-back.
   548  func (r *PurchasesVoidedpurchasesService) List(packageName string) *PurchasesVoidedpurchasesListCall {
   549  	c := &PurchasesVoidedpurchasesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   550  	c.packageName = packageName
   551  	return c
   552  }
   553  
   554  // EndTime sets the optional parameter "endTime": The time, in
   555  // milliseconds since the Epoch, of the newest voided purchase that you
   556  // want to see in the response. The value of this parameter cannot be
   557  // greater than the current time and is ignored if a pagination token is
   558  // set. Default value is current time. Note: This filter is applied on
   559  // the time at which the record is seen as voided by our systems and not
   560  // the actual voided time returned in the response.
   561  func (c *PurchasesVoidedpurchasesListCall) EndTime(endTime int64) *PurchasesVoidedpurchasesListCall {
   562  	c.urlParams_.Set("endTime", fmt.Sprint(endTime))
   563  	return c
   564  }
   565  
   566  // MaxResults sets the optional parameter "maxResults":
   567  func (c *PurchasesVoidedpurchasesListCall) MaxResults(maxResults int64) *PurchasesVoidedpurchasesListCall {
   568  	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
   569  	return c
   570  }
   571  
   572  // StartIndex sets the optional parameter "startIndex":
   573  func (c *PurchasesVoidedpurchasesListCall) StartIndex(startIndex int64) *PurchasesVoidedpurchasesListCall {
   574  	c.urlParams_.Set("startIndex", fmt.Sprint(startIndex))
   575  	return c
   576  }
   577  
   578  // StartTime sets the optional parameter "startTime": The time, in
   579  // milliseconds since the Epoch, of the oldest voided purchase that you
   580  // want to see in the response. The value of this parameter cannot be
   581  // older than 30 days and is ignored if a pagination token is set.
   582  // Default value is current time minus 30 days. Note: This filter is
   583  // applied on the time at which the record is seen as voided by our
   584  // systems and not the actual voided time returned in the response.
   585  func (c *PurchasesVoidedpurchasesListCall) StartTime(startTime int64) *PurchasesVoidedpurchasesListCall {
   586  	c.urlParams_.Set("startTime", fmt.Sprint(startTime))
   587  	return c
   588  }
   589  
   590  // Token sets the optional parameter "token":
   591  func (c *PurchasesVoidedpurchasesListCall) Token(token string) *PurchasesVoidedpurchasesListCall {
   592  	c.urlParams_.Set("token", token)
   593  	return c
   594  }
   595  
   596  // Fields allows partial responses to be retrieved. See
   597  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
   598  // for more information.
   599  func (c *PurchasesVoidedpurchasesListCall) Fields(s ...googleapi.Field) *PurchasesVoidedpurchasesListCall {
   600  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   601  	return c
   602  }
   603  
   604  // IfNoneMatch sets the optional parameter which makes the operation
   605  // fail if the object's ETag matches the given value. This is useful for
   606  // getting updates only after the object has changed since the last
   607  // request. Use googleapi.IsNotModified to check whether the response
   608  // error from Do is the result of In-None-Match.
   609  func (c *PurchasesVoidedpurchasesListCall) IfNoneMatch(entityTag string) *PurchasesVoidedpurchasesListCall {
   610  	c.ifNoneMatch_ = entityTag
   611  	return c
   612  }
   613  
   614  // Context sets the context to be used in this call's Do method. Any
   615  // pending HTTP request will be aborted if the provided context is
   616  // canceled.
   617  func (c *PurchasesVoidedpurchasesListCall) Context(ctx context.Context) *PurchasesVoidedpurchasesListCall {
   618  	c.ctx_ = ctx
   619  	return c
   620  }
   621  
   622  // Header returns an http.Header that can be modified by the caller to
   623  // add HTTP headers to the request.
   624  func (c *PurchasesVoidedpurchasesListCall) Header() http.Header {
   625  	if c.header_ == nil {
   626  		c.header_ = make(http.Header)
   627  	}
   628  	return c.header_
   629  }
   630  
   631  func (c *PurchasesVoidedpurchasesListCall) doRequest(alt string) (*http.Response, error) {
   632  	reqHeaders := make(http.Header)
   633  	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200627")
   634  	for k, v := range c.header_ {
   635  		reqHeaders[k] = v
   636  	}
   637  	reqHeaders.Set("User-Agent", c.s.userAgent())
   638  	if c.ifNoneMatch_ != "" {
   639  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   640  	}
   641  	var body io.Reader = nil
   642  	c.urlParams_.Set("alt", alt)
   643  	c.urlParams_.Set("prettyPrint", "false")
   644  	urls := googleapi.ResolveRelative(c.s.BasePath, "{packageName}/purchases/voidedpurchases")
   645  	urls += "?" + c.urlParams_.Encode()
   646  	req, err := http.NewRequest("GET", urls, body)
   647  	if err != nil {
   648  		return nil, err
   649  	}
   650  	req.Header = reqHeaders
   651  	googleapi.Expand(req.URL, map[string]string{
   652  		"packageName": c.packageName,
   653  	})
   654  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   655  }
   656  
   657  // Do executes the "androidpublisher.purchases.voidedpurchases.list" call.
   658  // Exactly one of *VoidedPurchasesListResponse or error will be non-nil.
   659  // Any non-2xx status code is an error. Response headers are in either
   660  // *VoidedPurchasesListResponse.ServerResponse.Header or (if a response
   661  // was returned at all) in error.(*googleapi.Error).Header. Use
   662  // googleapi.IsNotModified to check whether the returned error was
   663  // because http.StatusNotModified was returned.
   664  func (c *PurchasesVoidedpurchasesListCall) Do(opts ...googleapi.CallOption) (*VoidedPurchasesListResponse, error) {
   665  	gensupport.SetOptions(c.urlParams_, opts...)
   666  	res, err := c.doRequest("json")
   667  	if res != nil && res.StatusCode == http.StatusNotModified {
   668  		if res.Body != nil {
   669  			res.Body.Close()
   670  		}
   671  		return nil, &googleapi.Error{
   672  			Code:   res.StatusCode,
   673  			Header: res.Header,
   674  		}
   675  	}
   676  	if err != nil {
   677  		return nil, err
   678  	}
   679  	defer googleapi.CloseBody(res)
   680  	if err := googleapi.CheckResponse(res); err != nil {
   681  		return nil, err
   682  	}
   683  	ret := &VoidedPurchasesListResponse{
   684  		ServerResponse: googleapi.ServerResponse{
   685  			Header:         res.Header,
   686  			HTTPStatusCode: res.StatusCode,
   687  		},
   688  	}
   689  	target := &ret
   690  	if err := gensupport.DecodeResponse(target, res); err != nil {
   691  		return nil, err
   692  	}
   693  	return ret, nil
   694  	// {
   695  	//   "description": "Lists the purchases that were canceled, refunded or charged-back.",
   696  	//   "httpMethod": "GET",
   697  	//   "id": "androidpublisher.purchases.voidedpurchases.list",
   698  	//   "parameterOrder": [
   699  	//     "packageName"
   700  	//   ],
   701  	//   "parameters": {
   702  	//     "endTime": {
   703  	//       "description": "The time, in milliseconds since the Epoch, of the newest voided purchase that you want to see in the response. The value of this parameter cannot be greater than the current time and is ignored if a pagination token is set. Default value is current time. Note: This filter is applied on the time at which the record is seen as voided by our systems and not the actual voided time returned in the response.",
   704  	//       "format": "int64",
   705  	//       "location": "query",
   706  	//       "type": "string"
   707  	//     },
   708  	//     "maxResults": {
   709  	//       "format": "uint32",
   710  	//       "location": "query",
   711  	//       "type": "integer"
   712  	//     },
   713  	//     "packageName": {
   714  	//       "description": "The package name of the application for which voided purchases need to be returned (for example, 'com.some.thing').",
   715  	//       "location": "path",
   716  	//       "required": true,
   717  	//       "type": "string"
   718  	//     },
   719  	//     "startIndex": {
   720  	//       "format": "uint32",
   721  	//       "location": "query",
   722  	//       "type": "integer"
   723  	//     },
   724  	//     "startTime": {
   725  	//       "description": "The time, in milliseconds since the Epoch, of the oldest voided purchase that you want to see in the response. The value of this parameter cannot be older than 30 days and is ignored if a pagination token is set. Default value is current time minus 30 days. Note: This filter is applied on the time at which the record is seen as voided by our systems and not the actual voided time returned in the response.",
   726  	//       "format": "int64",
   727  	//       "location": "query",
   728  	//       "type": "string"
   729  	//     },
   730  	//     "token": {
   731  	//       "location": "query",
   732  	//       "type": "string"
   733  	//     }
   734  	//   },
   735  	//   "path": "{packageName}/purchases/voidedpurchases",
   736  	//   "response": {
   737  	//     "$ref": "VoidedPurchasesListResponse"
   738  	//   },
   739  	//   "scopes": [
   740  	//     "https://www.googleapis.com/auth/androidpublisher"
   741  	//   ]
   742  	// }
   743  
   744  }
   745  

View as plain text