...

Source file src/google.golang.org/api/reseller/v1/reseller-gen.go

Documentation: google.golang.org/api/reseller/v1

     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 reseller provides access to the Google Workspace Reseller API.
     8  //
     9  // For product documentation, see: https://developers.google.com/google-apps/reseller/
    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/reseller/v1"
    27  //	...
    28  //	ctx := context.Background()
    29  //	resellerService, err := reseller.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  //	resellerService, err := reseller.NewService(ctx, option.WithScopes(reseller.AppsOrderReadonlyScope))
    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  //	resellerService, err := reseller.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  //	resellerService, err := reseller.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    54  //
    55  // See [google.golang.org/api/option.ClientOption] for details on options.
    56  package reseller // import "google.golang.org/api/reseller/v1"
    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 = "reseller:v1"
    95  const apiName = "reseller"
    96  const apiVersion = "v1"
    97  const basePath = "https://reseller.googleapis.com/"
    98  const basePathTemplate = "https://reseller.UNIVERSE_DOMAIN/"
    99  const mtlsBasePath = "https://reseller.mtls.googleapis.com/"
   100  
   101  // OAuth2 scopes used by this API.
   102  const (
   103  	// Manage users on your domain
   104  	AppsOrderScope = "https://www.googleapis.com/auth/apps.order"
   105  
   106  	// Manage users on your domain
   107  	AppsOrderReadonlyScope = "https://www.googleapis.com/auth/apps.order.readonly"
   108  )
   109  
   110  // NewService creates a new Service.
   111  func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
   112  	scopesOption := internaloption.WithDefaultScopes(
   113  		"https://www.googleapis.com/auth/apps.order",
   114  		"https://www.googleapis.com/auth/apps.order.readonly",
   115  	)
   116  	// NOTE: prepend, so we don't override user-specified scopes.
   117  	opts = append([]option.ClientOption{scopesOption}, opts...)
   118  	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
   119  	opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
   120  	opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
   121  	opts = append(opts, internaloption.EnableNewAuthLibrary())
   122  	client, endpoint, err := htransport.NewClient(ctx, opts...)
   123  	if err != nil {
   124  		return nil, err
   125  	}
   126  	s, err := New(client)
   127  	if err != nil {
   128  		return nil, err
   129  	}
   130  	if endpoint != "" {
   131  		s.BasePath = endpoint
   132  	}
   133  	return s, nil
   134  }
   135  
   136  // New creates a new Service. It uses the provided http.Client for requests.
   137  //
   138  // Deprecated: please use NewService instead.
   139  // To provide a custom HTTP client, use option.WithHTTPClient.
   140  // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
   141  func New(client *http.Client) (*Service, error) {
   142  	if client == nil {
   143  		return nil, errors.New("client is nil")
   144  	}
   145  	s := &Service{client: client, BasePath: basePath}
   146  	s.Customers = NewCustomersService(s)
   147  	s.Resellernotify = NewResellernotifyService(s)
   148  	s.Subscriptions = NewSubscriptionsService(s)
   149  	return s, nil
   150  }
   151  
   152  type Service struct {
   153  	client    *http.Client
   154  	BasePath  string // API endpoint base URL
   155  	UserAgent string // optional additional User-Agent fragment
   156  
   157  	Customers *CustomersService
   158  
   159  	Resellernotify *ResellernotifyService
   160  
   161  	Subscriptions *SubscriptionsService
   162  }
   163  
   164  func (s *Service) userAgent() string {
   165  	if s.UserAgent == "" {
   166  		return googleapi.UserAgent
   167  	}
   168  	return googleapi.UserAgent + " " + s.UserAgent
   169  }
   170  
   171  func NewCustomersService(s *Service) *CustomersService {
   172  	rs := &CustomersService{s: s}
   173  	return rs
   174  }
   175  
   176  type CustomersService struct {
   177  	s *Service
   178  }
   179  
   180  func NewResellernotifyService(s *Service) *ResellernotifyService {
   181  	rs := &ResellernotifyService{s: s}
   182  	return rs
   183  }
   184  
   185  type ResellernotifyService struct {
   186  	s *Service
   187  }
   188  
   189  func NewSubscriptionsService(s *Service) *SubscriptionsService {
   190  	rs := &SubscriptionsService{s: s}
   191  	return rs
   192  }
   193  
   194  type SubscriptionsService struct {
   195  	s *Service
   196  }
   197  
   198  // Address: JSON template for address of a customer.
   199  type Address struct {
   200  	// AddressLine1: A customer's physical address. An address can be composed of
   201  	// one to three lines. The `addressline2` and `addressLine3` are optional.
   202  	AddressLine1 string `json:"addressLine1,omitempty"`
   203  	// AddressLine2: Line 2 of the address.
   204  	AddressLine2 string `json:"addressLine2,omitempty"`
   205  	// AddressLine3: Line 3 of the address.
   206  	AddressLine3 string `json:"addressLine3,omitempty"`
   207  	// ContactName: The customer contact's name. This is required.
   208  	ContactName string `json:"contactName,omitempty"`
   209  	// CountryCode: For `countryCode` information, see the ISO 3166 country code
   210  	// elements. Verify that country is approved for resale of Google products.
   211  	// This property is required when creating a new customer.
   212  	CountryCode string `json:"countryCode,omitempty"`
   213  	// Kind: Identifies the resource as a customer address. Value:
   214  	// `customers#address`
   215  	Kind string `json:"kind,omitempty"`
   216  	// Locality: An example of a `locality` value is the city of `San Francisco`.
   217  	Locality string `json:"locality,omitempty"`
   218  	// OrganizationName: The company or company division name. This is required.
   219  	OrganizationName string `json:"organizationName,omitempty"`
   220  	// PostalCode: A `postalCode` example is a postal zip code such as `94043`.
   221  	// This property is required when creating a new customer.
   222  	PostalCode string `json:"postalCode,omitempty"`
   223  	// Region: An example of a `region` value is `CA` for the state of California.
   224  	Region string `json:"region,omitempty"`
   225  	// ForceSendFields is a list of field names (e.g. "AddressLine1") to
   226  	// unconditionally include in API requests. By default, fields with empty or
   227  	// default values are omitted from API requests. See
   228  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   229  	// details.
   230  	ForceSendFields []string `json:"-"`
   231  	// NullFields is a list of field names (e.g. "AddressLine1") to include in API
   232  	// requests with the JSON null value. By default, fields with empty values are
   233  	// omitted from API requests. See
   234  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   235  	NullFields []string `json:"-"`
   236  }
   237  
   238  func (s *Address) MarshalJSON() ([]byte, error) {
   239  	type NoMethod Address
   240  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   241  }
   242  
   243  // ChangePlanRequest: JSON template for the ChangePlan rpc request.
   244  type ChangePlanRequest struct {
   245  	// DealCode: Google-issued code (100 char max) for discounted pricing on
   246  	// subscription plans. Deal code must be included in `changePlan` request in
   247  	// order to receive discounted rate. This property is optional. If a deal code
   248  	// has already been added to a subscription, this property may be left empty
   249  	// and the existing discounted rate will still apply (if not empty, only
   250  	// provide the deal code that is already present on the subscription). If a
   251  	// deal code has never been added to a subscription and this property is left
   252  	// blank, regular pricing will apply.
   253  	DealCode string `json:"dealCode,omitempty"`
   254  	// Kind: Identifies the resource as a subscription change plan request. Value:
   255  	// `subscriptions#changePlanRequest`
   256  	Kind string `json:"kind,omitempty"`
   257  	// PlanName: The `planName` property is required. This is the name of the
   258  	// subscription's payment plan. For more information about the Google payment
   259  	// plans, see API concepts. Possible values are: - `ANNUAL_MONTHLY_PAY` - The
   260  	// annual commitment plan with monthly payments *Caution: *`ANNUAL_MONTHLY_PAY`
   261  	// is returned as `ANNUAL` in all API responses. - `ANNUAL_YEARLY_PAY` - The
   262  	// annual commitment plan with yearly payments - `FLEXIBLE` - The flexible plan
   263  	// - `TRIAL` - The 30-day free trial plan
   264  	PlanName string `json:"planName,omitempty"`
   265  	// PurchaseOrderId: This is an optional property. This purchase order (PO)
   266  	// information is for resellers to use for their company tracking usage. If a
   267  	// `purchaseOrderId` value is given it appears in the API responses and shows
   268  	// up in the invoice. The property accepts up to 80 plain text characters.
   269  	PurchaseOrderId string `json:"purchaseOrderId,omitempty"`
   270  	// Seats: This is a required property. The seats property is the number of user
   271  	// seat licenses.
   272  	Seats *Seats `json:"seats,omitempty"`
   273  	// ForceSendFields is a list of field names (e.g. "DealCode") to
   274  	// unconditionally include in API requests. By default, fields with empty or
   275  	// default values are omitted from API requests. See
   276  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   277  	// details.
   278  	ForceSendFields []string `json:"-"`
   279  	// NullFields is a list of field names (e.g. "DealCode") to include in API
   280  	// requests with the JSON null value. By default, fields with empty values are
   281  	// omitted from API requests. See
   282  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   283  	NullFields []string `json:"-"`
   284  }
   285  
   286  func (s *ChangePlanRequest) MarshalJSON() ([]byte, error) {
   287  	type NoMethod ChangePlanRequest
   288  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   289  }
   290  
   291  // Customer: When a Google customer's account is registered with a reseller,
   292  // the customer's subscriptions for Google services are managed by this
   293  // reseller. A customer is described by a primary domain name and a physical
   294  // address.
   295  type Customer struct {
   296  	// AlternateEmail: Like the "Customer email" in the reseller tools, this email
   297  	// is the secondary contact used if something happens to the customer's service
   298  	// such as service outage or a security issue. This property is required when
   299  	// creating a new "domain" customer and should not use the same domain as
   300  	// `customerDomain`. The `alternateEmail` field is not necessary to create a
   301  	// "team" customer.
   302  	AlternateEmail string `json:"alternateEmail,omitempty"`
   303  	// CustomerDomain: The customer's primary domain name string. `customerDomain`
   304  	// is required when creating a new customer. Do not include the `www` prefix in
   305  	// the domain when adding a customer.
   306  	CustomerDomain string `json:"customerDomain,omitempty"`
   307  	// CustomerDomainVerified: Whether the customer's primary domain has been
   308  	// verified.
   309  	CustomerDomainVerified bool `json:"customerDomainVerified,omitempty"`
   310  	// CustomerId: This property will always be returned in a response as the
   311  	// unique identifier generated by Google. In a request, this property can be
   312  	// either the primary domain or the unique identifier generated by Google.
   313  	CustomerId string `json:"customerId,omitempty"`
   314  	// CustomerType: Identifies the type of the customer. Acceptable values
   315  	// include: * `domain`: Implies a domain-verified customer (default). * `team`:
   316  	// Implies an email-verified customer. For more information, see managed teams
   317  	// (https://support.google.com/a/users/answer/9939479).
   318  	//
   319  	// Possible values:
   320  	//   "customerTypeUnspecified" - Customer type not known
   321  	//   "domain" - Domained or domain-owning customers
   322  	//   "team" - Domainless or email-verified customers
   323  	CustomerType string `json:"customerType,omitempty"`
   324  	// Kind: Identifies the resource as a customer. Value: `reseller#customer`
   325  	Kind string `json:"kind,omitempty"`
   326  	// PhoneNumber: Customer contact phone number. Must start with "+" followed by
   327  	// the country code. The rest of the number can be contiguous numbers or
   328  	// respect the phone local format conventions, but it must be a real phone
   329  	// number and not, for example, "123". This field is silently ignored if
   330  	// invalid.
   331  	PhoneNumber string `json:"phoneNumber,omitempty"`
   332  	// PostalAddress: A customer's address information. Each field has a limit of
   333  	// 255 charcters.
   334  	PostalAddress *Address `json:"postalAddress,omitempty"`
   335  	// PrimaryAdmin: The first admin details of the customer, present in case of
   336  	// TEAM customer.
   337  	PrimaryAdmin *PrimaryAdmin `json:"primaryAdmin,omitempty"`
   338  	// ResourceUiUrl: URL to customer's Admin console dashboard. The read-only URL
   339  	// is generated by the API service. This is used if your client application
   340  	// requires the customer to complete a task in the Admin console.
   341  	ResourceUiUrl string `json:"resourceUiUrl,omitempty"`
   342  
   343  	// ServerResponse contains the HTTP response code and headers from the server.
   344  	googleapi.ServerResponse `json:"-"`
   345  	// ForceSendFields is a list of field names (e.g. "AlternateEmail") to
   346  	// unconditionally include in API requests. By default, fields with empty or
   347  	// default values are omitted from API requests. See
   348  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   349  	// details.
   350  	ForceSendFields []string `json:"-"`
   351  	// NullFields is a list of field names (e.g. "AlternateEmail") to include in
   352  	// API requests with the JSON null value. By default, fields with empty values
   353  	// are omitted from API requests. See
   354  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   355  	NullFields []string `json:"-"`
   356  }
   357  
   358  func (s *Customer) MarshalJSON() ([]byte, error) {
   359  	type NoMethod Customer
   360  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   361  }
   362  
   363  // PrimaryAdmin: JSON template for primary admin in case of TEAM customers
   364  type PrimaryAdmin struct {
   365  	// PrimaryEmail: The business email of the primary administrator of the
   366  	// customer. The email verification link is sent to this email address at the
   367  	// time of customer creation. Primary administrators have access to the
   368  	// customer's Admin Console, including the ability to invite and evict users
   369  	// and manage the administrative needs of the customer.
   370  	PrimaryEmail string `json:"primaryEmail,omitempty"`
   371  	// ForceSendFields is a list of field names (e.g. "PrimaryEmail") to
   372  	// unconditionally include in API requests. By default, fields with empty or
   373  	// default values are omitted from API requests. See
   374  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   375  	// details.
   376  	ForceSendFields []string `json:"-"`
   377  	// NullFields is a list of field names (e.g. "PrimaryEmail") to include in API
   378  	// requests with the JSON null value. By default, fields with empty values are
   379  	// omitted from API requests. See
   380  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   381  	NullFields []string `json:"-"`
   382  }
   383  
   384  func (s *PrimaryAdmin) MarshalJSON() ([]byte, error) {
   385  	type NoMethod PrimaryAdmin
   386  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   387  }
   388  
   389  // RenewalSettings: JSON template for a subscription renewal settings.
   390  type RenewalSettings struct {
   391  	// Kind: Identifies the resource as a subscription renewal setting. Value:
   392  	// `subscriptions#renewalSettings`
   393  	Kind string `json:"kind,omitempty"`
   394  	// RenewalType: Renewal settings for the annual commitment plan. For more
   395  	// detailed information, see renewal options in the administrator help center.
   396  	// When renewing a subscription, the `renewalType` is a required property.
   397  	RenewalType string `json:"renewalType,omitempty"`
   398  	// ForceSendFields is a list of field names (e.g. "Kind") to unconditionally
   399  	// include in API requests. By default, fields with empty or default values are
   400  	// omitted from API requests. See
   401  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   402  	// details.
   403  	ForceSendFields []string `json:"-"`
   404  	// NullFields is a list of field names (e.g. "Kind") to include in API requests
   405  	// with the JSON null value. By default, fields with empty values are omitted
   406  	// from API requests. See
   407  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   408  	NullFields []string `json:"-"`
   409  }
   410  
   411  func (s *RenewalSettings) MarshalJSON() ([]byte, error) {
   412  	type NoMethod RenewalSettings
   413  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   414  }
   415  
   416  // ResellernotifyGetwatchdetailsResponse: JSON template for resellernotify
   417  // getwatchdetails response.
   418  type ResellernotifyGetwatchdetailsResponse struct {
   419  	// ServiceAccountEmailAddresses: List of registered service accounts.
   420  	ServiceAccountEmailAddresses []string `json:"serviceAccountEmailAddresses,omitempty"`
   421  	// TopicName: Topic name of the PubSub
   422  	TopicName string `json:"topicName,omitempty"`
   423  
   424  	// ServerResponse contains the HTTP response code and headers from the server.
   425  	googleapi.ServerResponse `json:"-"`
   426  	// ForceSendFields is a list of field names (e.g.
   427  	// "ServiceAccountEmailAddresses") to unconditionally include in API requests.
   428  	// By default, fields with empty or default values are omitted from API
   429  	// requests. See https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields
   430  	// for more details.
   431  	ForceSendFields []string `json:"-"`
   432  	// NullFields is a list of field names (e.g. "ServiceAccountEmailAddresses") to
   433  	// include in API requests with the JSON null value. By default, fields with
   434  	// empty values are omitted from API requests. See
   435  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   436  	NullFields []string `json:"-"`
   437  }
   438  
   439  func (s *ResellernotifyGetwatchdetailsResponse) MarshalJSON() ([]byte, error) {
   440  	type NoMethod ResellernotifyGetwatchdetailsResponse
   441  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   442  }
   443  
   444  // ResellernotifyResource: JSON template for resellernotify response.
   445  type ResellernotifyResource struct {
   446  	// TopicName: Topic name of the PubSub
   447  	TopicName string `json:"topicName,omitempty"`
   448  
   449  	// ServerResponse contains the HTTP response code and headers from the server.
   450  	googleapi.ServerResponse `json:"-"`
   451  	// ForceSendFields is a list of field names (e.g. "TopicName") to
   452  	// unconditionally include in API requests. By default, fields with empty or
   453  	// default values are omitted from API requests. See
   454  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   455  	// details.
   456  	ForceSendFields []string `json:"-"`
   457  	// NullFields is a list of field names (e.g. "TopicName") to include in API
   458  	// requests with the JSON null value. By default, fields with empty values are
   459  	// omitted from API requests. See
   460  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   461  	NullFields []string `json:"-"`
   462  }
   463  
   464  func (s *ResellernotifyResource) MarshalJSON() ([]byte, error) {
   465  	type NoMethod ResellernotifyResource
   466  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   467  }
   468  
   469  // Seats: JSON template for subscription seats.
   470  type Seats struct {
   471  	// Kind: Identifies the resource as a subscription seat setting. Value:
   472  	// `subscriptions#seats`
   473  	Kind string `json:"kind,omitempty"`
   474  	// LicensedNumberOfSeats: Read-only field containing the current number of
   475  	// users that are assigned a license for the product defined in `skuId`. This
   476  	// field's value is equivalent to the numerical count of users returned by the
   477  	// Enterprise License Manager API method: `listForProductAndSku`
   478  	// (/admin-sdk/licensing/v1/reference/licenseAssignments/listForProductAndSku).
   479  	LicensedNumberOfSeats int64 `json:"licensedNumberOfSeats,omitempty"`
   480  	// MaximumNumberOfSeats: This is a required property and is exclusive to
   481  	// subscriptions with `FLEXIBLE` or `TRIAL` plans. This property sets the
   482  	// maximum number of licensed users allowed on a subscription. This quantity
   483  	// can be increased up to the maximum limit defined in the reseller's contract.
   484  	// The minimum quantity is the current number of users in the customer account.
   485  	// *Note: *G Suite subscriptions automatically assign a license to every user.
   486  	MaximumNumberOfSeats int64 `json:"maximumNumberOfSeats,omitempty"`
   487  	// NumberOfSeats: This is a required property and is exclusive to subscriptions
   488  	// with `ANNUAL_MONTHLY_PAY` and `ANNUAL_YEARLY_PAY` plans. This property sets
   489  	// the maximum number of licenses assignable to users on a subscription. The
   490  	// reseller can add more licenses, but once set, the `numberOfSeats` cannot be
   491  	// reduced until renewal. The reseller is invoiced based on the `numberOfSeats`
   492  	// value regardless of how many of these user licenses are assigned. *Note:
   493  	// *Google Workspace subscriptions automatically assign a license to every
   494  	// user.
   495  	NumberOfSeats int64 `json:"numberOfSeats,omitempty"`
   496  	// ForceSendFields is a list of field names (e.g. "Kind") to unconditionally
   497  	// include in API requests. By default, fields with empty or default values are
   498  	// omitted from API requests. See
   499  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   500  	// details.
   501  	ForceSendFields []string `json:"-"`
   502  	// NullFields is a list of field names (e.g. "Kind") to include in API requests
   503  	// with the JSON null value. By default, fields with empty values are omitted
   504  	// from API requests. See
   505  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   506  	NullFields []string `json:"-"`
   507  }
   508  
   509  func (s *Seats) MarshalJSON() ([]byte, error) {
   510  	type NoMethod Seats
   511  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   512  }
   513  
   514  // Subscription: JSON template for a subscription.
   515  type Subscription struct {
   516  	// BillingMethod: Read-only field that returns the current billing method for a
   517  	// subscription.
   518  	BillingMethod string `json:"billingMethod,omitempty"`
   519  	// CreationTime: The `creationTime` property is the date when subscription was
   520  	// created. It is in milliseconds using the Epoch format. See an example Epoch
   521  	// converter.
   522  	CreationTime int64 `json:"creationTime,omitempty,string"`
   523  	// CustomerDomain: Primary domain name of the customer
   524  	CustomerDomain string `json:"customerDomain,omitempty"`
   525  	// CustomerId: This property will always be returned in a response as the
   526  	// unique identifier generated by Google. In a request, this property can be
   527  	// either the primary domain or the unique identifier generated by Google.
   528  	CustomerId string `json:"customerId,omitempty"`
   529  	// DealCode: Google-issued code (100 char max) for discounted pricing on
   530  	// subscription plans. Deal code must be included in `insert` requests in order
   531  	// to receive discounted rate. This property is optional, regular pricing
   532  	// applies if left empty.
   533  	DealCode string `json:"dealCode,omitempty"`
   534  	// Kind: Identifies the resource as a Subscription. Value:
   535  	// `reseller#subscription`
   536  	Kind string `json:"kind,omitempty"`
   537  	// Plan: The `plan` property is required. In this version of the API, the G
   538  	// Suite plans are the flexible plan, annual commitment plan, and the 30-day
   539  	// free trial plan. For more information about the API"s payment plans, see the
   540  	// API concepts.
   541  	Plan *SubscriptionPlan `json:"plan,omitempty"`
   542  	// PurchaseOrderId: This is an optional property. This purchase order (PO)
   543  	// information is for resellers to use for their company tracking usage. If a
   544  	// `purchaseOrderId` value is given it appears in the API responses and shows
   545  	// up in the invoice. The property accepts up to 80 plain text characters.
   546  	PurchaseOrderId string `json:"purchaseOrderId,omitempty"`
   547  	// RenewalSettings: Renewal settings for the annual commitment plan. For more
   548  	// detailed information, see renewal options in the administrator help center.
   549  	RenewalSettings *RenewalSettings `json:"renewalSettings,omitempty"`
   550  	// ResourceUiUrl: URL to customer's Subscriptions page in the Admin console.
   551  	// The read-only URL is generated by the API service. This is used if your
   552  	// client application requires the customer to complete a task using the
   553  	// Subscriptions page in the Admin console.
   554  	ResourceUiUrl string `json:"resourceUiUrl,omitempty"`
   555  	// Seats: This is a required property. The number and limit of user seat
   556  	// licenses in the plan.
   557  	Seats *Seats `json:"seats,omitempty"`
   558  	// SkuId: A required property. The `skuId` is a unique system identifier for a
   559  	// product's SKU assigned to a customer in the subscription. For products and
   560  	// SKUs available in this version of the API, see Product and SKU IDs.
   561  	SkuId string `json:"skuId,omitempty"`
   562  	// SkuName: Read-only external display name for a product's SKU assigned to a
   563  	// customer in the subscription. SKU names are subject to change at Google's
   564  	// discretion. For products and SKUs available in this version of the API, see
   565  	// Product and SKU IDs.
   566  	SkuName string `json:"skuName,omitempty"`
   567  	// Status: This is an optional property.
   568  	Status string `json:"status,omitempty"`
   569  	// SubscriptionId: The `subscriptionId` is the subscription identifier and is
   570  	// unique for each customer. This is a required property. Since a
   571  	// `subscriptionId` changes when a subscription is updated, we recommend not
   572  	// using this ID as a key for persistent data. Use the `subscriptionId` as
   573  	// described in retrieve all reseller subscriptions.
   574  	SubscriptionId string `json:"subscriptionId,omitempty"`
   575  	// SuspensionReasons: Read-only field containing an enumerable of all the
   576  	// current suspension reasons for a subscription. It is possible for a
   577  	// subscription to have many concurrent, overlapping suspension reasons. A
   578  	// subscription's `STATUS` is `SUSPENDED` until all pending suspensions are
   579  	// removed. Possible options include: - `PENDING_TOS_ACCEPTANCE` - The customer
   580  	// has not logged in and accepted the G Suite Resold Terms of Services. -
   581  	// `RENEWAL_WITH_TYPE_CANCEL` - The customer's commitment ended and their
   582  	// service was cancelled at the end of their term. - `RESELLER_INITIATED` - A
   583  	// manual suspension invoked by a Reseller. - `TRIAL_ENDED` - The customer's
   584  	// trial expired without a plan selected. - `OTHER` - The customer is suspended
   585  	// for an internal Google reason (e.g. abuse or otherwise).
   586  	SuspensionReasons []string `json:"suspensionReasons,omitempty"`
   587  	// TransferInfo: Read-only transfer related information for the subscription.
   588  	// For more information, see retrieve transferable subscriptions for a
   589  	// customer.
   590  	TransferInfo *SubscriptionTransferInfo `json:"transferInfo,omitempty"`
   591  	// TrialSettings: The G Suite annual commitment and flexible payment plans can
   592  	// be in a 30-day free trial. For more information, see the API concepts.
   593  	TrialSettings *SubscriptionTrialSettings `json:"trialSettings,omitempty"`
   594  
   595  	// ServerResponse contains the HTTP response code and headers from the server.
   596  	googleapi.ServerResponse `json:"-"`
   597  	// ForceSendFields is a list of field names (e.g. "BillingMethod") to
   598  	// unconditionally include in API requests. By default, fields with empty or
   599  	// default values are omitted from API requests. See
   600  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   601  	// details.
   602  	ForceSendFields []string `json:"-"`
   603  	// NullFields is a list of field names (e.g. "BillingMethod") to include in API
   604  	// requests with the JSON null value. By default, fields with empty values are
   605  	// omitted from API requests. See
   606  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   607  	NullFields []string `json:"-"`
   608  }
   609  
   610  func (s *Subscription) MarshalJSON() ([]byte, error) {
   611  	type NoMethod Subscription
   612  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   613  }
   614  
   615  // SubscriptionPlan: The `plan` property is required. In this version of the
   616  // API, the G Suite plans are the flexible plan, annual commitment plan, and
   617  // the 30-day free trial plan. For more information about the API"s payment
   618  // plans, see the API concepts.
   619  type SubscriptionPlan struct {
   620  	// CommitmentInterval: In this version of the API, annual commitment plan's
   621  	// interval is one year. *Note: *When `billingMethod` value is `OFFLINE`, the
   622  	// subscription property object `plan.commitmentInterval` is omitted in all API
   623  	// responses.
   624  	CommitmentInterval *SubscriptionPlanCommitmentInterval `json:"commitmentInterval,omitempty"`
   625  	// IsCommitmentPlan: The `isCommitmentPlan` property's boolean value identifies
   626  	// the plan as an annual commitment plan: - `true` — The subscription's plan
   627  	// is an annual commitment plan. - `false` — The plan is not an annual
   628  	// commitment plan.
   629  	IsCommitmentPlan bool `json:"isCommitmentPlan,omitempty"`
   630  	// PlanName: The `planName` property is required. This is the name of the
   631  	// subscription's plan. For more information about the Google payment plans,
   632  	// see the API concepts. Possible values are: - `ANNUAL_MONTHLY_PAY` — The
   633  	// annual commitment plan with monthly payments. *Caution:
   634  	// *`ANNUAL_MONTHLY_PAY` is returned as `ANNUAL` in all API responses. -
   635  	// `ANNUAL_YEARLY_PAY` — The annual commitment plan with yearly payments -
   636  	// `FLEXIBLE` — The flexible plan - `TRIAL` — The 30-day free trial plan. A
   637  	// subscription in trial will be suspended after the 30th free day if no
   638  	// payment plan is assigned. Calling `changePlan` will assign a payment plan to
   639  	// a trial but will not activate the plan. A trial will automatically begin its
   640  	// assigned payment plan after its 30th free day or immediately after calling
   641  	// `startPaidService`. - `FREE` — The free plan is exclusive to the Cloud
   642  	// Identity SKU and does not incur any billing.
   643  	PlanName string `json:"planName,omitempty"`
   644  	// ForceSendFields is a list of field names (e.g. "CommitmentInterval") to
   645  	// unconditionally include in API requests. By default, fields with empty or
   646  	// default values are omitted from API requests. See
   647  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   648  	// details.
   649  	ForceSendFields []string `json:"-"`
   650  	// NullFields is a list of field names (e.g. "CommitmentInterval") to include
   651  	// in API requests with the JSON null value. By default, fields with empty
   652  	// values are omitted from API requests. See
   653  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   654  	NullFields []string `json:"-"`
   655  }
   656  
   657  func (s *SubscriptionPlan) MarshalJSON() ([]byte, error) {
   658  	type NoMethod SubscriptionPlan
   659  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   660  }
   661  
   662  // SubscriptionPlanCommitmentInterval: In this version of the API, annual
   663  // commitment plan's interval is one year. *Note: *When `billingMethod` value
   664  // is `OFFLINE`, the subscription property object `plan.commitmentInterval` is
   665  // omitted in all API responses.
   666  type SubscriptionPlanCommitmentInterval struct {
   667  	// EndTime: An annual commitment plan's interval's `endTime` in milliseconds
   668  	// using the UNIX Epoch format. See an example Epoch converter.
   669  	EndTime int64 `json:"endTime,omitempty,string"`
   670  	// StartTime: An annual commitment plan's interval's `startTime` in
   671  	// milliseconds using UNIX Epoch format. See an example Epoch converter.
   672  	StartTime int64 `json:"startTime,omitempty,string"`
   673  	// ForceSendFields is a list of field names (e.g. "EndTime") to unconditionally
   674  	// include in API requests. By default, fields with empty or default values are
   675  	// omitted from API requests. See
   676  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   677  	// details.
   678  	ForceSendFields []string `json:"-"`
   679  	// NullFields is a list of field names (e.g. "EndTime") to include in API
   680  	// requests with the JSON null value. By default, fields with empty values are
   681  	// omitted from API requests. See
   682  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   683  	NullFields []string `json:"-"`
   684  }
   685  
   686  func (s *SubscriptionPlanCommitmentInterval) MarshalJSON() ([]byte, error) {
   687  	type NoMethod SubscriptionPlanCommitmentInterval
   688  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   689  }
   690  
   691  // SubscriptionTransferInfo: Read-only transfer related information for the
   692  // subscription. For more information, see retrieve transferable subscriptions
   693  // for a customer.
   694  type SubscriptionTransferInfo struct {
   695  	// CurrentLegacySkuId: The `skuId` of the current resold subscription. This is
   696  	// populated only when the customer has a subscription with a legacy SKU and
   697  	// the subscription resource is populated with the `skuId` of the SKU
   698  	// recommended for the transfer.
   699  	CurrentLegacySkuId string `json:"currentLegacySkuId,omitempty"`
   700  	// MinimumTransferableSeats: When inserting a subscription, this is the minimum
   701  	// number of seats listed in the transfer order for this product. For example,
   702  	// if the customer has 20 users, the reseller cannot place a transfer order of
   703  	// 15 seats. The minimum is 20 seats.
   704  	MinimumTransferableSeats int64 `json:"minimumTransferableSeats,omitempty"`
   705  	// TransferabilityExpirationTime: The time when transfer token or intent to
   706  	// transfer will expire. The time is in milliseconds using UNIX Epoch format.
   707  	TransferabilityExpirationTime int64 `json:"transferabilityExpirationTime,omitempty,string"`
   708  	// ForceSendFields is a list of field names (e.g. "CurrentLegacySkuId") to
   709  	// unconditionally include in API requests. By default, fields with empty or
   710  	// default values are omitted from API requests. See
   711  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   712  	// details.
   713  	ForceSendFields []string `json:"-"`
   714  	// NullFields is a list of field names (e.g. "CurrentLegacySkuId") to include
   715  	// in API requests with the JSON null value. By default, fields with empty
   716  	// values are omitted from API requests. See
   717  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   718  	NullFields []string `json:"-"`
   719  }
   720  
   721  func (s *SubscriptionTransferInfo) MarshalJSON() ([]byte, error) {
   722  	type NoMethod SubscriptionTransferInfo
   723  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   724  }
   725  
   726  // SubscriptionTrialSettings: The G Suite annual commitment and flexible
   727  // payment plans can be in a 30-day free trial. For more information, see the
   728  // API concepts.
   729  type SubscriptionTrialSettings struct {
   730  	// IsInTrial: Determines if a subscription's plan is in a 30-day free trial or
   731  	// not: - `true` — The plan is in trial. - `false` — The plan is not in
   732  	// trial.
   733  	IsInTrial bool `json:"isInTrial,omitempty"`
   734  	// TrialEndTime: Date when the trial ends. The value is in milliseconds using
   735  	// the UNIX Epoch format. See an example Epoch converter.
   736  	TrialEndTime int64 `json:"trialEndTime,omitempty,string"`
   737  	// ForceSendFields is a list of field names (e.g. "IsInTrial") to
   738  	// unconditionally include in API requests. By default, fields with empty or
   739  	// default values are omitted from API requests. See
   740  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   741  	// details.
   742  	ForceSendFields []string `json:"-"`
   743  	// NullFields is a list of field names (e.g. "IsInTrial") to include in API
   744  	// requests with the JSON null value. By default, fields with empty values are
   745  	// omitted from API requests. See
   746  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   747  	NullFields []string `json:"-"`
   748  }
   749  
   750  func (s *SubscriptionTrialSettings) MarshalJSON() ([]byte, error) {
   751  	type NoMethod SubscriptionTrialSettings
   752  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   753  }
   754  
   755  // Subscriptions: A subscription manages the relationship of a Google
   756  // customer's payment plan with a product's SKU, user licenses, 30-day free
   757  // trial status, and renewal options. A primary role of a reseller is to manage
   758  // the Google customer's subscriptions.
   759  type Subscriptions struct {
   760  	// Kind: Identifies the resource as a collection of subscriptions. Value:
   761  	// reseller#subscriptions
   762  	Kind string `json:"kind,omitempty"`
   763  	// NextPageToken: The continuation token, used to page through large result
   764  	// sets. Provide this value in a subsequent request to return the next page of
   765  	// results.
   766  	NextPageToken string `json:"nextPageToken,omitempty"`
   767  	// Subscriptions: The subscriptions in this page of results.
   768  	Subscriptions []*Subscription `json:"subscriptions,omitempty"`
   769  
   770  	// ServerResponse contains the HTTP response code and headers from the server.
   771  	googleapi.ServerResponse `json:"-"`
   772  	// ForceSendFields is a list of field names (e.g. "Kind") to unconditionally
   773  	// include in API requests. By default, fields with empty or default values are
   774  	// omitted from API requests. See
   775  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   776  	// details.
   777  	ForceSendFields []string `json:"-"`
   778  	// NullFields is a list of field names (e.g. "Kind") to include in API requests
   779  	// with the JSON null value. By default, fields with empty values are omitted
   780  	// from API requests. See
   781  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   782  	NullFields []string `json:"-"`
   783  }
   784  
   785  func (s *Subscriptions) MarshalJSON() ([]byte, error) {
   786  	type NoMethod Subscriptions
   787  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   788  }
   789  
   790  type CustomersGetCall struct {
   791  	s            *Service
   792  	customerId   string
   793  	urlParams_   gensupport.URLParams
   794  	ifNoneMatch_ string
   795  	ctx_         context.Context
   796  	header_      http.Header
   797  }
   798  
   799  // Get: Gets a customer account. Use this operation to see a customer account
   800  // already in your reseller management, or to see the minimal account
   801  // information for an existing customer that you do not manage. For more
   802  // information about the API response for existing customers, see retrieving a
   803  // customer account
   804  // (/admin-sdk/reseller/v1/how-tos/manage_customers#get_customer).
   805  //
   806  //   - customerId: This can be either the customer's primary domain name or the
   807  //     customer's unique identifier. If the domain name for a customer changes,
   808  //     the old domain name cannot be used to access the customer, but the
   809  //     customer's unique identifier (as returned by the API) can always be used.
   810  //     We recommend storing the unique identifier in your systems where
   811  //     applicable.
   812  func (r *CustomersService) Get(customerId string) *CustomersGetCall {
   813  	c := &CustomersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   814  	c.customerId = customerId
   815  	return c
   816  }
   817  
   818  // Fields allows partial responses to be retrieved. See
   819  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   820  // details.
   821  func (c *CustomersGetCall) Fields(s ...googleapi.Field) *CustomersGetCall {
   822  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   823  	return c
   824  }
   825  
   826  // IfNoneMatch sets an optional parameter which makes the operation fail if the
   827  // object's ETag matches the given value. This is useful for getting updates
   828  // only after the object has changed since the last request.
   829  func (c *CustomersGetCall) IfNoneMatch(entityTag string) *CustomersGetCall {
   830  	c.ifNoneMatch_ = entityTag
   831  	return c
   832  }
   833  
   834  // Context sets the context to be used in this call's Do method.
   835  func (c *CustomersGetCall) Context(ctx context.Context) *CustomersGetCall {
   836  	c.ctx_ = ctx
   837  	return c
   838  }
   839  
   840  // Header returns a http.Header that can be modified by the caller to add
   841  // headers to the request.
   842  func (c *CustomersGetCall) Header() http.Header {
   843  	if c.header_ == nil {
   844  		c.header_ = make(http.Header)
   845  	}
   846  	return c.header_
   847  }
   848  
   849  func (c *CustomersGetCall) doRequest(alt string) (*http.Response, error) {
   850  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   851  	if c.ifNoneMatch_ != "" {
   852  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   853  	}
   854  	var body io.Reader = nil
   855  	c.urlParams_.Set("alt", alt)
   856  	c.urlParams_.Set("prettyPrint", "false")
   857  	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}")
   858  	urls += "?" + c.urlParams_.Encode()
   859  	req, err := http.NewRequest("GET", urls, body)
   860  	if err != nil {
   861  		return nil, err
   862  	}
   863  	req.Header = reqHeaders
   864  	googleapi.Expand(req.URL, map[string]string{
   865  		"customerId": c.customerId,
   866  	})
   867  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   868  }
   869  
   870  // Do executes the "reseller.customers.get" call.
   871  // Any non-2xx status code is an error. Response headers are in either
   872  // *Customer.ServerResponse.Header or (if a response was returned at all) in
   873  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
   874  // whether the returned error was because http.StatusNotModified was returned.
   875  func (c *CustomersGetCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
   876  	gensupport.SetOptions(c.urlParams_, opts...)
   877  	res, err := c.doRequest("json")
   878  	if res != nil && res.StatusCode == http.StatusNotModified {
   879  		if res.Body != nil {
   880  			res.Body.Close()
   881  		}
   882  		return nil, gensupport.WrapError(&googleapi.Error{
   883  			Code:   res.StatusCode,
   884  			Header: res.Header,
   885  		})
   886  	}
   887  	if err != nil {
   888  		return nil, err
   889  	}
   890  	defer googleapi.CloseBody(res)
   891  	if err := googleapi.CheckResponse(res); err != nil {
   892  		return nil, gensupport.WrapError(err)
   893  	}
   894  	ret := &Customer{
   895  		ServerResponse: googleapi.ServerResponse{
   896  			Header:         res.Header,
   897  			HTTPStatusCode: res.StatusCode,
   898  		},
   899  	}
   900  	target := &ret
   901  	if err := gensupport.DecodeResponse(target, res); err != nil {
   902  		return nil, err
   903  	}
   904  	return ret, nil
   905  }
   906  
   907  type CustomersInsertCall struct {
   908  	s          *Service
   909  	customer   *Customer
   910  	urlParams_ gensupport.URLParams
   911  	ctx_       context.Context
   912  	header_    http.Header
   913  }
   914  
   915  // Insert: Orders a new customer's account. Before ordering a new customer
   916  // account, establish whether the customer account already exists using the
   917  // `customers.get` (/admin-sdk/reseller/v1/reference/customers/get) If the
   918  // customer account exists as a direct Google account or as a resold customer
   919  // account from another reseller, use the `customerAuthToken\` as described in
   920  // order a resold account for an existing customer
   921  // (/admin-sdk/reseller/v1/how-tos/manage_customers#create_existing_customer).
   922  // For more information about ordering a new customer account, see order a new
   923  // customer account
   924  // (/admin-sdk/reseller/v1/how-tos/manage_customers#create_customer). After
   925  // creating a new customer account, you must provision a user as an
   926  // administrator. The customer's administrator is required to sign in to the
   927  // Admin console and sign the G Suite via Reseller agreement to activate the
   928  // account. Resellers are prohibited from signing the G Suite via Reseller
   929  // agreement on the customer's behalf. For more information, see order a new
   930  // customer account (/admin-sdk/reseller/v1/how-tos/manage_customers#tos).
   931  func (r *CustomersService) Insert(customer *Customer) *CustomersInsertCall {
   932  	c := &CustomersInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   933  	c.customer = customer
   934  	return c
   935  }
   936  
   937  // CustomerAuthToken sets the optional parameter "customerAuthToken": The
   938  // `customerAuthToken` query string is required when creating a resold account
   939  // that transfers a direct customer's subscription or transfers another
   940  // reseller customer's subscription to your reseller management. This is a
   941  // hexadecimal authentication token needed to complete the subscription
   942  // transfer. For more information, see the administrator help center.
   943  func (c *CustomersInsertCall) CustomerAuthToken(customerAuthToken string) *CustomersInsertCall {
   944  	c.urlParams_.Set("customerAuthToken", customerAuthToken)
   945  	return c
   946  }
   947  
   948  // Fields allows partial responses to be retrieved. See
   949  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   950  // details.
   951  func (c *CustomersInsertCall) Fields(s ...googleapi.Field) *CustomersInsertCall {
   952  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   953  	return c
   954  }
   955  
   956  // Context sets the context to be used in this call's Do method.
   957  func (c *CustomersInsertCall) Context(ctx context.Context) *CustomersInsertCall {
   958  	c.ctx_ = ctx
   959  	return c
   960  }
   961  
   962  // Header returns a http.Header that can be modified by the caller to add
   963  // headers to the request.
   964  func (c *CustomersInsertCall) Header() http.Header {
   965  	if c.header_ == nil {
   966  		c.header_ = make(http.Header)
   967  	}
   968  	return c.header_
   969  }
   970  
   971  func (c *CustomersInsertCall) doRequest(alt string) (*http.Response, error) {
   972  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
   973  	var body io.Reader = nil
   974  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.customer)
   975  	if err != nil {
   976  		return nil, err
   977  	}
   978  	c.urlParams_.Set("alt", alt)
   979  	c.urlParams_.Set("prettyPrint", "false")
   980  	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers")
   981  	urls += "?" + c.urlParams_.Encode()
   982  	req, err := http.NewRequest("POST", urls, body)
   983  	if err != nil {
   984  		return nil, err
   985  	}
   986  	req.Header = reqHeaders
   987  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   988  }
   989  
   990  // Do executes the "reseller.customers.insert" call.
   991  // Any non-2xx status code is an error. Response headers are in either
   992  // *Customer.ServerResponse.Header or (if a response was returned at all) in
   993  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
   994  // whether the returned error was because http.StatusNotModified was returned.
   995  func (c *CustomersInsertCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
   996  	gensupport.SetOptions(c.urlParams_, opts...)
   997  	res, err := c.doRequest("json")
   998  	if res != nil && res.StatusCode == http.StatusNotModified {
   999  		if res.Body != nil {
  1000  			res.Body.Close()
  1001  		}
  1002  		return nil, gensupport.WrapError(&googleapi.Error{
  1003  			Code:   res.StatusCode,
  1004  			Header: res.Header,
  1005  		})
  1006  	}
  1007  	if err != nil {
  1008  		return nil, err
  1009  	}
  1010  	defer googleapi.CloseBody(res)
  1011  	if err := googleapi.CheckResponse(res); err != nil {
  1012  		return nil, gensupport.WrapError(err)
  1013  	}
  1014  	ret := &Customer{
  1015  		ServerResponse: googleapi.ServerResponse{
  1016  			Header:         res.Header,
  1017  			HTTPStatusCode: res.StatusCode,
  1018  		},
  1019  	}
  1020  	target := &ret
  1021  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1022  		return nil, err
  1023  	}
  1024  	return ret, nil
  1025  }
  1026  
  1027  type CustomersPatchCall struct {
  1028  	s          *Service
  1029  	customerId string
  1030  	customer   *Customer
  1031  	urlParams_ gensupport.URLParams
  1032  	ctx_       context.Context
  1033  	header_    http.Header
  1034  }
  1035  
  1036  // Patch: Updates a customer account's settings. This method supports patch
  1037  // semantics. You cannot update `customerType` via the Reseller API, but a
  1038  // "team" customer can verify their domain and become `customerType =
  1039  // "domain". For more information, see Verify your domain to unlock Essentials
  1040  // features (https://support.google.com/a/answer/9122284).
  1041  //
  1042  //   - customerId: This can be either the customer's primary domain name or the
  1043  //     customer's unique identifier. If the domain name for a customer changes,
  1044  //     the old domain name cannot be used to access the customer, but the
  1045  //     customer's unique identifier (as returned by the API) can always be used.
  1046  //     We recommend storing the unique identifier in your systems where
  1047  //     applicable.
  1048  func (r *CustomersService) Patch(customerId string, customer *Customer) *CustomersPatchCall {
  1049  	c := &CustomersPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1050  	c.customerId = customerId
  1051  	c.customer = customer
  1052  	return c
  1053  }
  1054  
  1055  // Fields allows partial responses to be retrieved. See
  1056  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1057  // details.
  1058  func (c *CustomersPatchCall) Fields(s ...googleapi.Field) *CustomersPatchCall {
  1059  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1060  	return c
  1061  }
  1062  
  1063  // Context sets the context to be used in this call's Do method.
  1064  func (c *CustomersPatchCall) Context(ctx context.Context) *CustomersPatchCall {
  1065  	c.ctx_ = ctx
  1066  	return c
  1067  }
  1068  
  1069  // Header returns a http.Header that can be modified by the caller to add
  1070  // headers to the request.
  1071  func (c *CustomersPatchCall) Header() http.Header {
  1072  	if c.header_ == nil {
  1073  		c.header_ = make(http.Header)
  1074  	}
  1075  	return c.header_
  1076  }
  1077  
  1078  func (c *CustomersPatchCall) doRequest(alt string) (*http.Response, error) {
  1079  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1080  	var body io.Reader = nil
  1081  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.customer)
  1082  	if err != nil {
  1083  		return nil, err
  1084  	}
  1085  	c.urlParams_.Set("alt", alt)
  1086  	c.urlParams_.Set("prettyPrint", "false")
  1087  	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}")
  1088  	urls += "?" + c.urlParams_.Encode()
  1089  	req, err := http.NewRequest("PATCH", urls, body)
  1090  	if err != nil {
  1091  		return nil, err
  1092  	}
  1093  	req.Header = reqHeaders
  1094  	googleapi.Expand(req.URL, map[string]string{
  1095  		"customerId": c.customerId,
  1096  	})
  1097  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1098  }
  1099  
  1100  // Do executes the "reseller.customers.patch" call.
  1101  // Any non-2xx status code is an error. Response headers are in either
  1102  // *Customer.ServerResponse.Header or (if a response was returned at all) in
  1103  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1104  // whether the returned error was because http.StatusNotModified was returned.
  1105  func (c *CustomersPatchCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
  1106  	gensupport.SetOptions(c.urlParams_, opts...)
  1107  	res, err := c.doRequest("json")
  1108  	if res != nil && res.StatusCode == http.StatusNotModified {
  1109  		if res.Body != nil {
  1110  			res.Body.Close()
  1111  		}
  1112  		return nil, gensupport.WrapError(&googleapi.Error{
  1113  			Code:   res.StatusCode,
  1114  			Header: res.Header,
  1115  		})
  1116  	}
  1117  	if err != nil {
  1118  		return nil, err
  1119  	}
  1120  	defer googleapi.CloseBody(res)
  1121  	if err := googleapi.CheckResponse(res); err != nil {
  1122  		return nil, gensupport.WrapError(err)
  1123  	}
  1124  	ret := &Customer{
  1125  		ServerResponse: googleapi.ServerResponse{
  1126  			Header:         res.Header,
  1127  			HTTPStatusCode: res.StatusCode,
  1128  		},
  1129  	}
  1130  	target := &ret
  1131  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1132  		return nil, err
  1133  	}
  1134  	return ret, nil
  1135  }
  1136  
  1137  type CustomersUpdateCall struct {
  1138  	s          *Service
  1139  	customerId string
  1140  	customer   *Customer
  1141  	urlParams_ gensupport.URLParams
  1142  	ctx_       context.Context
  1143  	header_    http.Header
  1144  }
  1145  
  1146  // Update: Updates a customer account's settings. You cannot update
  1147  // `customerType` via the Reseller API, but a "team" customer can verify
  1148  // their domain and become `customerType = "domain". For more information, see
  1149  // update a customer's settings
  1150  // (/admin-sdk/reseller/v1/how-tos/manage_customers#update_customer).
  1151  //
  1152  //   - customerId: This can be either the customer's primary domain name or the
  1153  //     customer's unique identifier. If the domain name for a customer changes,
  1154  //     the old domain name cannot be used to access the customer, but the
  1155  //     customer's unique identifier (as returned by the API) can always be used.
  1156  //     We recommend storing the unique identifier in your systems where
  1157  //     applicable.
  1158  func (r *CustomersService) Update(customerId string, customer *Customer) *CustomersUpdateCall {
  1159  	c := &CustomersUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1160  	c.customerId = customerId
  1161  	c.customer = customer
  1162  	return c
  1163  }
  1164  
  1165  // Fields allows partial responses to be retrieved. See
  1166  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1167  // details.
  1168  func (c *CustomersUpdateCall) Fields(s ...googleapi.Field) *CustomersUpdateCall {
  1169  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1170  	return c
  1171  }
  1172  
  1173  // Context sets the context to be used in this call's Do method.
  1174  func (c *CustomersUpdateCall) Context(ctx context.Context) *CustomersUpdateCall {
  1175  	c.ctx_ = ctx
  1176  	return c
  1177  }
  1178  
  1179  // Header returns a http.Header that can be modified by the caller to add
  1180  // headers to the request.
  1181  func (c *CustomersUpdateCall) Header() http.Header {
  1182  	if c.header_ == nil {
  1183  		c.header_ = make(http.Header)
  1184  	}
  1185  	return c.header_
  1186  }
  1187  
  1188  func (c *CustomersUpdateCall) doRequest(alt string) (*http.Response, error) {
  1189  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1190  	var body io.Reader = nil
  1191  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.customer)
  1192  	if err != nil {
  1193  		return nil, err
  1194  	}
  1195  	c.urlParams_.Set("alt", alt)
  1196  	c.urlParams_.Set("prettyPrint", "false")
  1197  	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}")
  1198  	urls += "?" + c.urlParams_.Encode()
  1199  	req, err := http.NewRequest("PUT", urls, body)
  1200  	if err != nil {
  1201  		return nil, err
  1202  	}
  1203  	req.Header = reqHeaders
  1204  	googleapi.Expand(req.URL, map[string]string{
  1205  		"customerId": c.customerId,
  1206  	})
  1207  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1208  }
  1209  
  1210  // Do executes the "reseller.customers.update" call.
  1211  // Any non-2xx status code is an error. Response headers are in either
  1212  // *Customer.ServerResponse.Header or (if a response was returned at all) in
  1213  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1214  // whether the returned error was because http.StatusNotModified was returned.
  1215  func (c *CustomersUpdateCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
  1216  	gensupport.SetOptions(c.urlParams_, opts...)
  1217  	res, err := c.doRequest("json")
  1218  	if res != nil && res.StatusCode == http.StatusNotModified {
  1219  		if res.Body != nil {
  1220  			res.Body.Close()
  1221  		}
  1222  		return nil, gensupport.WrapError(&googleapi.Error{
  1223  			Code:   res.StatusCode,
  1224  			Header: res.Header,
  1225  		})
  1226  	}
  1227  	if err != nil {
  1228  		return nil, err
  1229  	}
  1230  	defer googleapi.CloseBody(res)
  1231  	if err := googleapi.CheckResponse(res); err != nil {
  1232  		return nil, gensupport.WrapError(err)
  1233  	}
  1234  	ret := &Customer{
  1235  		ServerResponse: googleapi.ServerResponse{
  1236  			Header:         res.Header,
  1237  			HTTPStatusCode: res.StatusCode,
  1238  		},
  1239  	}
  1240  	target := &ret
  1241  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1242  		return nil, err
  1243  	}
  1244  	return ret, nil
  1245  }
  1246  
  1247  type ResellernotifyGetwatchdetailsCall struct {
  1248  	s            *Service
  1249  	urlParams_   gensupport.URLParams
  1250  	ifNoneMatch_ string
  1251  	ctx_         context.Context
  1252  	header_      http.Header
  1253  }
  1254  
  1255  // Getwatchdetails: Returns all the details of the watch corresponding to the
  1256  // reseller.
  1257  func (r *ResellernotifyService) Getwatchdetails() *ResellernotifyGetwatchdetailsCall {
  1258  	c := &ResellernotifyGetwatchdetailsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1259  	return c
  1260  }
  1261  
  1262  // Fields allows partial responses to be retrieved. See
  1263  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1264  // details.
  1265  func (c *ResellernotifyGetwatchdetailsCall) Fields(s ...googleapi.Field) *ResellernotifyGetwatchdetailsCall {
  1266  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1267  	return c
  1268  }
  1269  
  1270  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1271  // object's ETag matches the given value. This is useful for getting updates
  1272  // only after the object has changed since the last request.
  1273  func (c *ResellernotifyGetwatchdetailsCall) IfNoneMatch(entityTag string) *ResellernotifyGetwatchdetailsCall {
  1274  	c.ifNoneMatch_ = entityTag
  1275  	return c
  1276  }
  1277  
  1278  // Context sets the context to be used in this call's Do method.
  1279  func (c *ResellernotifyGetwatchdetailsCall) Context(ctx context.Context) *ResellernotifyGetwatchdetailsCall {
  1280  	c.ctx_ = ctx
  1281  	return c
  1282  }
  1283  
  1284  // Header returns a http.Header that can be modified by the caller to add
  1285  // headers to the request.
  1286  func (c *ResellernotifyGetwatchdetailsCall) Header() http.Header {
  1287  	if c.header_ == nil {
  1288  		c.header_ = make(http.Header)
  1289  	}
  1290  	return c.header_
  1291  }
  1292  
  1293  func (c *ResellernotifyGetwatchdetailsCall) doRequest(alt string) (*http.Response, error) {
  1294  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1295  	if c.ifNoneMatch_ != "" {
  1296  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1297  	}
  1298  	var body io.Reader = nil
  1299  	c.urlParams_.Set("alt", alt)
  1300  	c.urlParams_.Set("prettyPrint", "false")
  1301  	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/resellernotify/getwatchdetails")
  1302  	urls += "?" + c.urlParams_.Encode()
  1303  	req, err := http.NewRequest("GET", urls, body)
  1304  	if err != nil {
  1305  		return nil, err
  1306  	}
  1307  	req.Header = reqHeaders
  1308  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1309  }
  1310  
  1311  // Do executes the "reseller.resellernotify.getwatchdetails" call.
  1312  // Any non-2xx status code is an error. Response headers are in either
  1313  // *ResellernotifyGetwatchdetailsResponse.ServerResponse.Header or (if a
  1314  // response was returned at all) in error.(*googleapi.Error).Header. Use
  1315  // googleapi.IsNotModified to check whether the returned error was because
  1316  // http.StatusNotModified was returned.
  1317  func (c *ResellernotifyGetwatchdetailsCall) Do(opts ...googleapi.CallOption) (*ResellernotifyGetwatchdetailsResponse, error) {
  1318  	gensupport.SetOptions(c.urlParams_, opts...)
  1319  	res, err := c.doRequest("json")
  1320  	if res != nil && res.StatusCode == http.StatusNotModified {
  1321  		if res.Body != nil {
  1322  			res.Body.Close()
  1323  		}
  1324  		return nil, gensupport.WrapError(&googleapi.Error{
  1325  			Code:   res.StatusCode,
  1326  			Header: res.Header,
  1327  		})
  1328  	}
  1329  	if err != nil {
  1330  		return nil, err
  1331  	}
  1332  	defer googleapi.CloseBody(res)
  1333  	if err := googleapi.CheckResponse(res); err != nil {
  1334  		return nil, gensupport.WrapError(err)
  1335  	}
  1336  	ret := &ResellernotifyGetwatchdetailsResponse{
  1337  		ServerResponse: googleapi.ServerResponse{
  1338  			Header:         res.Header,
  1339  			HTTPStatusCode: res.StatusCode,
  1340  		},
  1341  	}
  1342  	target := &ret
  1343  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1344  		return nil, err
  1345  	}
  1346  	return ret, nil
  1347  }
  1348  
  1349  type ResellernotifyRegisterCall struct {
  1350  	s          *Service
  1351  	urlParams_ gensupport.URLParams
  1352  	ctx_       context.Context
  1353  	header_    http.Header
  1354  }
  1355  
  1356  // Register: Registers a Reseller for receiving notifications.
  1357  func (r *ResellernotifyService) Register() *ResellernotifyRegisterCall {
  1358  	c := &ResellernotifyRegisterCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1359  	return c
  1360  }
  1361  
  1362  // ServiceAccountEmailAddress sets the optional parameter
  1363  // "serviceAccountEmailAddress": The service account which will own the created
  1364  // Cloud-PubSub topic.
  1365  func (c *ResellernotifyRegisterCall) ServiceAccountEmailAddress(serviceAccountEmailAddress string) *ResellernotifyRegisterCall {
  1366  	c.urlParams_.Set("serviceAccountEmailAddress", serviceAccountEmailAddress)
  1367  	return c
  1368  }
  1369  
  1370  // Fields allows partial responses to be retrieved. See
  1371  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1372  // details.
  1373  func (c *ResellernotifyRegisterCall) Fields(s ...googleapi.Field) *ResellernotifyRegisterCall {
  1374  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1375  	return c
  1376  }
  1377  
  1378  // Context sets the context to be used in this call's Do method.
  1379  func (c *ResellernotifyRegisterCall) Context(ctx context.Context) *ResellernotifyRegisterCall {
  1380  	c.ctx_ = ctx
  1381  	return c
  1382  }
  1383  
  1384  // Header returns a http.Header that can be modified by the caller to add
  1385  // headers to the request.
  1386  func (c *ResellernotifyRegisterCall) Header() http.Header {
  1387  	if c.header_ == nil {
  1388  		c.header_ = make(http.Header)
  1389  	}
  1390  	return c.header_
  1391  }
  1392  
  1393  func (c *ResellernotifyRegisterCall) doRequest(alt string) (*http.Response, error) {
  1394  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1395  	var body io.Reader = nil
  1396  	c.urlParams_.Set("alt", alt)
  1397  	c.urlParams_.Set("prettyPrint", "false")
  1398  	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/resellernotify/register")
  1399  	urls += "?" + c.urlParams_.Encode()
  1400  	req, err := http.NewRequest("POST", urls, body)
  1401  	if err != nil {
  1402  		return nil, err
  1403  	}
  1404  	req.Header = reqHeaders
  1405  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1406  }
  1407  
  1408  // Do executes the "reseller.resellernotify.register" call.
  1409  // Any non-2xx status code is an error. Response headers are in either
  1410  // *ResellernotifyResource.ServerResponse.Header or (if a response was returned
  1411  // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1412  // check whether the returned error was because http.StatusNotModified was
  1413  // returned.
  1414  func (c *ResellernotifyRegisterCall) Do(opts ...googleapi.CallOption) (*ResellernotifyResource, error) {
  1415  	gensupport.SetOptions(c.urlParams_, opts...)
  1416  	res, err := c.doRequest("json")
  1417  	if res != nil && res.StatusCode == http.StatusNotModified {
  1418  		if res.Body != nil {
  1419  			res.Body.Close()
  1420  		}
  1421  		return nil, gensupport.WrapError(&googleapi.Error{
  1422  			Code:   res.StatusCode,
  1423  			Header: res.Header,
  1424  		})
  1425  	}
  1426  	if err != nil {
  1427  		return nil, err
  1428  	}
  1429  	defer googleapi.CloseBody(res)
  1430  	if err := googleapi.CheckResponse(res); err != nil {
  1431  		return nil, gensupport.WrapError(err)
  1432  	}
  1433  	ret := &ResellernotifyResource{
  1434  		ServerResponse: googleapi.ServerResponse{
  1435  			Header:         res.Header,
  1436  			HTTPStatusCode: res.StatusCode,
  1437  		},
  1438  	}
  1439  	target := &ret
  1440  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1441  		return nil, err
  1442  	}
  1443  	return ret, nil
  1444  }
  1445  
  1446  type ResellernotifyUnregisterCall struct {
  1447  	s          *Service
  1448  	urlParams_ gensupport.URLParams
  1449  	ctx_       context.Context
  1450  	header_    http.Header
  1451  }
  1452  
  1453  // Unregister: Unregisters a Reseller for receiving notifications.
  1454  func (r *ResellernotifyService) Unregister() *ResellernotifyUnregisterCall {
  1455  	c := &ResellernotifyUnregisterCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1456  	return c
  1457  }
  1458  
  1459  // ServiceAccountEmailAddress sets the optional parameter
  1460  // "serviceAccountEmailAddress": The service account which owns the
  1461  // Cloud-PubSub topic.
  1462  func (c *ResellernotifyUnregisterCall) ServiceAccountEmailAddress(serviceAccountEmailAddress string) *ResellernotifyUnregisterCall {
  1463  	c.urlParams_.Set("serviceAccountEmailAddress", serviceAccountEmailAddress)
  1464  	return c
  1465  }
  1466  
  1467  // Fields allows partial responses to be retrieved. See
  1468  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1469  // details.
  1470  func (c *ResellernotifyUnregisterCall) Fields(s ...googleapi.Field) *ResellernotifyUnregisterCall {
  1471  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1472  	return c
  1473  }
  1474  
  1475  // Context sets the context to be used in this call's Do method.
  1476  func (c *ResellernotifyUnregisterCall) Context(ctx context.Context) *ResellernotifyUnregisterCall {
  1477  	c.ctx_ = ctx
  1478  	return c
  1479  }
  1480  
  1481  // Header returns a http.Header that can be modified by the caller to add
  1482  // headers to the request.
  1483  func (c *ResellernotifyUnregisterCall) Header() http.Header {
  1484  	if c.header_ == nil {
  1485  		c.header_ = make(http.Header)
  1486  	}
  1487  	return c.header_
  1488  }
  1489  
  1490  func (c *ResellernotifyUnregisterCall) doRequest(alt string) (*http.Response, error) {
  1491  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1492  	var body io.Reader = nil
  1493  	c.urlParams_.Set("alt", alt)
  1494  	c.urlParams_.Set("prettyPrint", "false")
  1495  	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/resellernotify/unregister")
  1496  	urls += "?" + c.urlParams_.Encode()
  1497  	req, err := http.NewRequest("POST", urls, body)
  1498  	if err != nil {
  1499  		return nil, err
  1500  	}
  1501  	req.Header = reqHeaders
  1502  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1503  }
  1504  
  1505  // Do executes the "reseller.resellernotify.unregister" call.
  1506  // Any non-2xx status code is an error. Response headers are in either
  1507  // *ResellernotifyResource.ServerResponse.Header or (if a response was returned
  1508  // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1509  // check whether the returned error was because http.StatusNotModified was
  1510  // returned.
  1511  func (c *ResellernotifyUnregisterCall) Do(opts ...googleapi.CallOption) (*ResellernotifyResource, error) {
  1512  	gensupport.SetOptions(c.urlParams_, opts...)
  1513  	res, err := c.doRequest("json")
  1514  	if res != nil && res.StatusCode == http.StatusNotModified {
  1515  		if res.Body != nil {
  1516  			res.Body.Close()
  1517  		}
  1518  		return nil, gensupport.WrapError(&googleapi.Error{
  1519  			Code:   res.StatusCode,
  1520  			Header: res.Header,
  1521  		})
  1522  	}
  1523  	if err != nil {
  1524  		return nil, err
  1525  	}
  1526  	defer googleapi.CloseBody(res)
  1527  	if err := googleapi.CheckResponse(res); err != nil {
  1528  		return nil, gensupport.WrapError(err)
  1529  	}
  1530  	ret := &ResellernotifyResource{
  1531  		ServerResponse: googleapi.ServerResponse{
  1532  			Header:         res.Header,
  1533  			HTTPStatusCode: res.StatusCode,
  1534  		},
  1535  	}
  1536  	target := &ret
  1537  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1538  		return nil, err
  1539  	}
  1540  	return ret, nil
  1541  }
  1542  
  1543  type SubscriptionsActivateCall struct {
  1544  	s              *Service
  1545  	customerId     string
  1546  	subscriptionId string
  1547  	urlParams_     gensupport.URLParams
  1548  	ctx_           context.Context
  1549  	header_        http.Header
  1550  }
  1551  
  1552  // Activate: Activates a subscription previously suspended by the reseller. If
  1553  // you did not suspend the customer subscription and it is suspended for any
  1554  // other reason, such as for abuse or a pending ToS acceptance, this call will
  1555  // not reactivate the customer subscription.
  1556  //
  1557  //   - customerId: This can be either the customer's primary domain name or the
  1558  //     customer's unique identifier. If the domain name for a customer changes,
  1559  //     the old domain name cannot be used to access the customer, but the
  1560  //     customer's unique identifier (as returned by the API) can always be used.
  1561  //     We recommend storing the unique identifier in your systems where
  1562  //     applicable.
  1563  //   - subscriptionId: This is a required property. The `subscriptionId` is the
  1564  //     subscription identifier and is unique for each customer. Since a
  1565  //     `subscriptionId` changes when a subscription is updated, we recommend to
  1566  //     not use this ID as a key for persistent data. And the `subscriptionId` can
  1567  //     be found using the retrieve all reseller subscriptions method.
  1568  func (r *SubscriptionsService) Activate(customerId string, subscriptionId string) *SubscriptionsActivateCall {
  1569  	c := &SubscriptionsActivateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1570  	c.customerId = customerId
  1571  	c.subscriptionId = subscriptionId
  1572  	return c
  1573  }
  1574  
  1575  // Fields allows partial responses to be retrieved. See
  1576  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1577  // details.
  1578  func (c *SubscriptionsActivateCall) Fields(s ...googleapi.Field) *SubscriptionsActivateCall {
  1579  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1580  	return c
  1581  }
  1582  
  1583  // Context sets the context to be used in this call's Do method.
  1584  func (c *SubscriptionsActivateCall) Context(ctx context.Context) *SubscriptionsActivateCall {
  1585  	c.ctx_ = ctx
  1586  	return c
  1587  }
  1588  
  1589  // Header returns a http.Header that can be modified by the caller to add
  1590  // headers to the request.
  1591  func (c *SubscriptionsActivateCall) Header() http.Header {
  1592  	if c.header_ == nil {
  1593  		c.header_ = make(http.Header)
  1594  	}
  1595  	return c.header_
  1596  }
  1597  
  1598  func (c *SubscriptionsActivateCall) doRequest(alt string) (*http.Response, error) {
  1599  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1600  	var body io.Reader = nil
  1601  	c.urlParams_.Set("alt", alt)
  1602  	c.urlParams_.Set("prettyPrint", "false")
  1603  	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/activate")
  1604  	urls += "?" + c.urlParams_.Encode()
  1605  	req, err := http.NewRequest("POST", urls, body)
  1606  	if err != nil {
  1607  		return nil, err
  1608  	}
  1609  	req.Header = reqHeaders
  1610  	googleapi.Expand(req.URL, map[string]string{
  1611  		"customerId":     c.customerId,
  1612  		"subscriptionId": c.subscriptionId,
  1613  	})
  1614  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1615  }
  1616  
  1617  // Do executes the "reseller.subscriptions.activate" call.
  1618  // Any non-2xx status code is an error. Response headers are in either
  1619  // *Subscription.ServerResponse.Header or (if a response was returned at all)
  1620  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1621  // whether the returned error was because http.StatusNotModified was returned.
  1622  func (c *SubscriptionsActivateCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
  1623  	gensupport.SetOptions(c.urlParams_, opts...)
  1624  	res, err := c.doRequest("json")
  1625  	if res != nil && res.StatusCode == http.StatusNotModified {
  1626  		if res.Body != nil {
  1627  			res.Body.Close()
  1628  		}
  1629  		return nil, gensupport.WrapError(&googleapi.Error{
  1630  			Code:   res.StatusCode,
  1631  			Header: res.Header,
  1632  		})
  1633  	}
  1634  	if err != nil {
  1635  		return nil, err
  1636  	}
  1637  	defer googleapi.CloseBody(res)
  1638  	if err := googleapi.CheckResponse(res); err != nil {
  1639  		return nil, gensupport.WrapError(err)
  1640  	}
  1641  	ret := &Subscription{
  1642  		ServerResponse: googleapi.ServerResponse{
  1643  			Header:         res.Header,
  1644  			HTTPStatusCode: res.StatusCode,
  1645  		},
  1646  	}
  1647  	target := &ret
  1648  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1649  		return nil, err
  1650  	}
  1651  	return ret, nil
  1652  }
  1653  
  1654  type SubscriptionsChangePlanCall struct {
  1655  	s                 *Service
  1656  	customerId        string
  1657  	subscriptionId    string
  1658  	changeplanrequest *ChangePlanRequest
  1659  	urlParams_        gensupport.URLParams
  1660  	ctx_              context.Context
  1661  	header_           http.Header
  1662  }
  1663  
  1664  // ChangePlan: Updates a subscription plan. Use this method to update a plan
  1665  // for a 30-day trial or a flexible plan subscription to an annual commitment
  1666  // plan with monthly or yearly payments. How a plan is updated differs
  1667  // depending on the plan and the products. For more information, see the
  1668  // description in manage subscriptions
  1669  // (/admin-sdk/reseller/v1/how-tos/manage_subscriptions#update_subscription_plan
  1670  // ).
  1671  //
  1672  //   - customerId: This can be either the customer's primary domain name or the
  1673  //     customer's unique identifier. If the domain name for a customer changes,
  1674  //     the old domain name cannot be used to access the customer, but the
  1675  //     customer's unique identifier (as returned by the API) can always be used.
  1676  //     We recommend storing the unique identifier in your systems where
  1677  //     applicable.
  1678  //   - subscriptionId: This is a required property. The `subscriptionId` is the
  1679  //     subscription identifier and is unique for each customer. Since a
  1680  //     `subscriptionId` changes when a subscription is updated, we recommend to
  1681  //     not use this ID as a key for persistent data. And the `subscriptionId` can
  1682  //     be found using the retrieve all reseller subscriptions method.
  1683  func (r *SubscriptionsService) ChangePlan(customerId string, subscriptionId string, changeplanrequest *ChangePlanRequest) *SubscriptionsChangePlanCall {
  1684  	c := &SubscriptionsChangePlanCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1685  	c.customerId = customerId
  1686  	c.subscriptionId = subscriptionId
  1687  	c.changeplanrequest = changeplanrequest
  1688  	return c
  1689  }
  1690  
  1691  // Fields allows partial responses to be retrieved. See
  1692  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1693  // details.
  1694  func (c *SubscriptionsChangePlanCall) Fields(s ...googleapi.Field) *SubscriptionsChangePlanCall {
  1695  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1696  	return c
  1697  }
  1698  
  1699  // Context sets the context to be used in this call's Do method.
  1700  func (c *SubscriptionsChangePlanCall) Context(ctx context.Context) *SubscriptionsChangePlanCall {
  1701  	c.ctx_ = ctx
  1702  	return c
  1703  }
  1704  
  1705  // Header returns a http.Header that can be modified by the caller to add
  1706  // headers to the request.
  1707  func (c *SubscriptionsChangePlanCall) Header() http.Header {
  1708  	if c.header_ == nil {
  1709  		c.header_ = make(http.Header)
  1710  	}
  1711  	return c.header_
  1712  }
  1713  
  1714  func (c *SubscriptionsChangePlanCall) doRequest(alt string) (*http.Response, error) {
  1715  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1716  	var body io.Reader = nil
  1717  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.changeplanrequest)
  1718  	if err != nil {
  1719  		return nil, err
  1720  	}
  1721  	c.urlParams_.Set("alt", alt)
  1722  	c.urlParams_.Set("prettyPrint", "false")
  1723  	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/changePlan")
  1724  	urls += "?" + c.urlParams_.Encode()
  1725  	req, err := http.NewRequest("POST", urls, body)
  1726  	if err != nil {
  1727  		return nil, err
  1728  	}
  1729  	req.Header = reqHeaders
  1730  	googleapi.Expand(req.URL, map[string]string{
  1731  		"customerId":     c.customerId,
  1732  		"subscriptionId": c.subscriptionId,
  1733  	})
  1734  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1735  }
  1736  
  1737  // Do executes the "reseller.subscriptions.changePlan" call.
  1738  // Any non-2xx status code is an error. Response headers are in either
  1739  // *Subscription.ServerResponse.Header or (if a response was returned at all)
  1740  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1741  // whether the returned error was because http.StatusNotModified was returned.
  1742  func (c *SubscriptionsChangePlanCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
  1743  	gensupport.SetOptions(c.urlParams_, opts...)
  1744  	res, err := c.doRequest("json")
  1745  	if res != nil && res.StatusCode == http.StatusNotModified {
  1746  		if res.Body != nil {
  1747  			res.Body.Close()
  1748  		}
  1749  		return nil, gensupport.WrapError(&googleapi.Error{
  1750  			Code:   res.StatusCode,
  1751  			Header: res.Header,
  1752  		})
  1753  	}
  1754  	if err != nil {
  1755  		return nil, err
  1756  	}
  1757  	defer googleapi.CloseBody(res)
  1758  	if err := googleapi.CheckResponse(res); err != nil {
  1759  		return nil, gensupport.WrapError(err)
  1760  	}
  1761  	ret := &Subscription{
  1762  		ServerResponse: googleapi.ServerResponse{
  1763  			Header:         res.Header,
  1764  			HTTPStatusCode: res.StatusCode,
  1765  		},
  1766  	}
  1767  	target := &ret
  1768  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1769  		return nil, err
  1770  	}
  1771  	return ret, nil
  1772  }
  1773  
  1774  type SubscriptionsChangeRenewalSettingsCall struct {
  1775  	s               *Service
  1776  	customerId      string
  1777  	subscriptionId  string
  1778  	renewalsettings *RenewalSettings
  1779  	urlParams_      gensupport.URLParams
  1780  	ctx_            context.Context
  1781  	header_         http.Header
  1782  }
  1783  
  1784  // ChangeRenewalSettings: Updates a user license's renewal settings. This is
  1785  // applicable for accounts with annual commitment plans only. For more
  1786  // information, see the description in manage subscriptions
  1787  // (/admin-sdk/reseller/v1/how-tos/manage_subscriptions#update_renewal).
  1788  //
  1789  //   - customerId: This can be either the customer's primary domain name or the
  1790  //     customer's unique identifier. If the domain name for a customer changes,
  1791  //     the old domain name cannot be used to access the customer, but the
  1792  //     customer's unique identifier (as returned by the API) can always be used.
  1793  //     We recommend storing the unique identifier in your systems where
  1794  //     applicable.
  1795  //   - subscriptionId: This is a required property. The `subscriptionId` is the
  1796  //     subscription identifier and is unique for each customer. Since a
  1797  //     `subscriptionId` changes when a subscription is updated, we recommend to
  1798  //     not use this ID as a key for persistent data. And the `subscriptionId` can
  1799  //     be found using the retrieve all reseller subscriptions method.
  1800  func (r *SubscriptionsService) ChangeRenewalSettings(customerId string, subscriptionId string, renewalsettings *RenewalSettings) *SubscriptionsChangeRenewalSettingsCall {
  1801  	c := &SubscriptionsChangeRenewalSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1802  	c.customerId = customerId
  1803  	c.subscriptionId = subscriptionId
  1804  	c.renewalsettings = renewalsettings
  1805  	return c
  1806  }
  1807  
  1808  // Fields allows partial responses to be retrieved. See
  1809  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1810  // details.
  1811  func (c *SubscriptionsChangeRenewalSettingsCall) Fields(s ...googleapi.Field) *SubscriptionsChangeRenewalSettingsCall {
  1812  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1813  	return c
  1814  }
  1815  
  1816  // Context sets the context to be used in this call's Do method.
  1817  func (c *SubscriptionsChangeRenewalSettingsCall) Context(ctx context.Context) *SubscriptionsChangeRenewalSettingsCall {
  1818  	c.ctx_ = ctx
  1819  	return c
  1820  }
  1821  
  1822  // Header returns a http.Header that can be modified by the caller to add
  1823  // headers to the request.
  1824  func (c *SubscriptionsChangeRenewalSettingsCall) Header() http.Header {
  1825  	if c.header_ == nil {
  1826  		c.header_ = make(http.Header)
  1827  	}
  1828  	return c.header_
  1829  }
  1830  
  1831  func (c *SubscriptionsChangeRenewalSettingsCall) doRequest(alt string) (*http.Response, error) {
  1832  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1833  	var body io.Reader = nil
  1834  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.renewalsettings)
  1835  	if err != nil {
  1836  		return nil, err
  1837  	}
  1838  	c.urlParams_.Set("alt", alt)
  1839  	c.urlParams_.Set("prettyPrint", "false")
  1840  	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/changeRenewalSettings")
  1841  	urls += "?" + c.urlParams_.Encode()
  1842  	req, err := http.NewRequest("POST", urls, body)
  1843  	if err != nil {
  1844  		return nil, err
  1845  	}
  1846  	req.Header = reqHeaders
  1847  	googleapi.Expand(req.URL, map[string]string{
  1848  		"customerId":     c.customerId,
  1849  		"subscriptionId": c.subscriptionId,
  1850  	})
  1851  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1852  }
  1853  
  1854  // Do executes the "reseller.subscriptions.changeRenewalSettings" call.
  1855  // Any non-2xx status code is an error. Response headers are in either
  1856  // *Subscription.ServerResponse.Header or (if a response was returned at all)
  1857  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1858  // whether the returned error was because http.StatusNotModified was returned.
  1859  func (c *SubscriptionsChangeRenewalSettingsCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
  1860  	gensupport.SetOptions(c.urlParams_, opts...)
  1861  	res, err := c.doRequest("json")
  1862  	if res != nil && res.StatusCode == http.StatusNotModified {
  1863  		if res.Body != nil {
  1864  			res.Body.Close()
  1865  		}
  1866  		return nil, gensupport.WrapError(&googleapi.Error{
  1867  			Code:   res.StatusCode,
  1868  			Header: res.Header,
  1869  		})
  1870  	}
  1871  	if err != nil {
  1872  		return nil, err
  1873  	}
  1874  	defer googleapi.CloseBody(res)
  1875  	if err := googleapi.CheckResponse(res); err != nil {
  1876  		return nil, gensupport.WrapError(err)
  1877  	}
  1878  	ret := &Subscription{
  1879  		ServerResponse: googleapi.ServerResponse{
  1880  			Header:         res.Header,
  1881  			HTTPStatusCode: res.StatusCode,
  1882  		},
  1883  	}
  1884  	target := &ret
  1885  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1886  		return nil, err
  1887  	}
  1888  	return ret, nil
  1889  }
  1890  
  1891  type SubscriptionsChangeSeatsCall struct {
  1892  	s              *Service
  1893  	customerId     string
  1894  	subscriptionId string
  1895  	seats          *Seats
  1896  	urlParams_     gensupport.URLParams
  1897  	ctx_           context.Context
  1898  	header_        http.Header
  1899  }
  1900  
  1901  // ChangeSeats: Updates a subscription's user license settings. For more
  1902  // information about updating an annual commitment plan or a flexible plan
  1903  // subscription’s licenses, see Manage Subscriptions
  1904  // (/admin-sdk/reseller/v1/how-tos/manage_subscriptions#update_subscription_seat
  1905  // ).
  1906  //
  1907  //   - customerId: This can be either the customer's primary domain name or the
  1908  //     customer's unique identifier. If the domain name for a customer changes,
  1909  //     the old domain name cannot be used to access the customer, but the
  1910  //     customer's unique identifier (as returned by the API) can always be used.
  1911  //     We recommend storing the unique identifier in your systems where
  1912  //     applicable.
  1913  //   - subscriptionId: This is a required property. The `subscriptionId` is the
  1914  //     subscription identifier and is unique for each customer. Since a
  1915  //     `subscriptionId` changes when a subscription is updated, we recommend to
  1916  //     not use this ID as a key for persistent data. And the `subscriptionId` can
  1917  //     be found using the retrieve all reseller subscriptions method.
  1918  func (r *SubscriptionsService) ChangeSeats(customerId string, subscriptionId string, seats *Seats) *SubscriptionsChangeSeatsCall {
  1919  	c := &SubscriptionsChangeSeatsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1920  	c.customerId = customerId
  1921  	c.subscriptionId = subscriptionId
  1922  	c.seats = seats
  1923  	return c
  1924  }
  1925  
  1926  // Fields allows partial responses to be retrieved. See
  1927  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1928  // details.
  1929  func (c *SubscriptionsChangeSeatsCall) Fields(s ...googleapi.Field) *SubscriptionsChangeSeatsCall {
  1930  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1931  	return c
  1932  }
  1933  
  1934  // Context sets the context to be used in this call's Do method.
  1935  func (c *SubscriptionsChangeSeatsCall) Context(ctx context.Context) *SubscriptionsChangeSeatsCall {
  1936  	c.ctx_ = ctx
  1937  	return c
  1938  }
  1939  
  1940  // Header returns a http.Header that can be modified by the caller to add
  1941  // headers to the request.
  1942  func (c *SubscriptionsChangeSeatsCall) Header() http.Header {
  1943  	if c.header_ == nil {
  1944  		c.header_ = make(http.Header)
  1945  	}
  1946  	return c.header_
  1947  }
  1948  
  1949  func (c *SubscriptionsChangeSeatsCall) doRequest(alt string) (*http.Response, error) {
  1950  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1951  	var body io.Reader = nil
  1952  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.seats)
  1953  	if err != nil {
  1954  		return nil, err
  1955  	}
  1956  	c.urlParams_.Set("alt", alt)
  1957  	c.urlParams_.Set("prettyPrint", "false")
  1958  	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/changeSeats")
  1959  	urls += "?" + c.urlParams_.Encode()
  1960  	req, err := http.NewRequest("POST", urls, body)
  1961  	if err != nil {
  1962  		return nil, err
  1963  	}
  1964  	req.Header = reqHeaders
  1965  	googleapi.Expand(req.URL, map[string]string{
  1966  		"customerId":     c.customerId,
  1967  		"subscriptionId": c.subscriptionId,
  1968  	})
  1969  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1970  }
  1971  
  1972  // Do executes the "reseller.subscriptions.changeSeats" call.
  1973  // Any non-2xx status code is an error. Response headers are in either
  1974  // *Subscription.ServerResponse.Header or (if a response was returned at all)
  1975  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1976  // whether the returned error was because http.StatusNotModified was returned.
  1977  func (c *SubscriptionsChangeSeatsCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
  1978  	gensupport.SetOptions(c.urlParams_, opts...)
  1979  	res, err := c.doRequest("json")
  1980  	if res != nil && res.StatusCode == http.StatusNotModified {
  1981  		if res.Body != nil {
  1982  			res.Body.Close()
  1983  		}
  1984  		return nil, gensupport.WrapError(&googleapi.Error{
  1985  			Code:   res.StatusCode,
  1986  			Header: res.Header,
  1987  		})
  1988  	}
  1989  	if err != nil {
  1990  		return nil, err
  1991  	}
  1992  	defer googleapi.CloseBody(res)
  1993  	if err := googleapi.CheckResponse(res); err != nil {
  1994  		return nil, gensupport.WrapError(err)
  1995  	}
  1996  	ret := &Subscription{
  1997  		ServerResponse: googleapi.ServerResponse{
  1998  			Header:         res.Header,
  1999  			HTTPStatusCode: res.StatusCode,
  2000  		},
  2001  	}
  2002  	target := &ret
  2003  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2004  		return nil, err
  2005  	}
  2006  	return ret, nil
  2007  }
  2008  
  2009  type SubscriptionsDeleteCall struct {
  2010  	s              *Service
  2011  	customerId     string
  2012  	subscriptionId string
  2013  	urlParams_     gensupport.URLParams
  2014  	ctx_           context.Context
  2015  	header_        http.Header
  2016  }
  2017  
  2018  // Delete: Cancels, suspends, or transfers a subscription to direct.
  2019  //
  2020  //   - customerId: This can be either the customer's primary domain name or the
  2021  //     customer's unique identifier. If the domain name for a customer changes,
  2022  //     the old domain name cannot be used to access the customer, but the
  2023  //     customer's unique identifier (as returned by the API) can always be used.
  2024  //     We recommend storing the unique identifier in your systems where
  2025  //     applicable.
  2026  //   - deletionType: The `deletionType` query string enables the cancellation,
  2027  //     downgrade, or suspension of a subscription.
  2028  //   - subscriptionId: This is a required property. The `subscriptionId` is the
  2029  //     subscription identifier and is unique for each customer. Since a
  2030  //     `subscriptionId` changes when a subscription is updated, we recommend to
  2031  //     not use this ID as a key for persistent data. And the `subscriptionId` can
  2032  //     be found using the retrieve all reseller subscriptions method.
  2033  func (r *SubscriptionsService) Delete(customerId string, subscriptionId string, deletionType string) *SubscriptionsDeleteCall {
  2034  	c := &SubscriptionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2035  	c.customerId = customerId
  2036  	c.subscriptionId = subscriptionId
  2037  	c.urlParams_.Set("deletionType", deletionType)
  2038  	return c
  2039  }
  2040  
  2041  // Fields allows partial responses to be retrieved. See
  2042  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2043  // details.
  2044  func (c *SubscriptionsDeleteCall) Fields(s ...googleapi.Field) *SubscriptionsDeleteCall {
  2045  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2046  	return c
  2047  }
  2048  
  2049  // Context sets the context to be used in this call's Do method.
  2050  func (c *SubscriptionsDeleteCall) Context(ctx context.Context) *SubscriptionsDeleteCall {
  2051  	c.ctx_ = ctx
  2052  	return c
  2053  }
  2054  
  2055  // Header returns a http.Header that can be modified by the caller to add
  2056  // headers to the request.
  2057  func (c *SubscriptionsDeleteCall) Header() http.Header {
  2058  	if c.header_ == nil {
  2059  		c.header_ = make(http.Header)
  2060  	}
  2061  	return c.header_
  2062  }
  2063  
  2064  func (c *SubscriptionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2065  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2066  	var body io.Reader = nil
  2067  	c.urlParams_.Set("alt", alt)
  2068  	c.urlParams_.Set("prettyPrint", "false")
  2069  	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}")
  2070  	urls += "?" + c.urlParams_.Encode()
  2071  	req, err := http.NewRequest("DELETE", urls, body)
  2072  	if err != nil {
  2073  		return nil, err
  2074  	}
  2075  	req.Header = reqHeaders
  2076  	googleapi.Expand(req.URL, map[string]string{
  2077  		"customerId":     c.customerId,
  2078  		"subscriptionId": c.subscriptionId,
  2079  	})
  2080  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2081  }
  2082  
  2083  // Do executes the "reseller.subscriptions.delete" call.
  2084  func (c *SubscriptionsDeleteCall) Do(opts ...googleapi.CallOption) error {
  2085  	gensupport.SetOptions(c.urlParams_, opts...)
  2086  	res, err := c.doRequest("json")
  2087  	if err != nil {
  2088  		return err
  2089  	}
  2090  	defer googleapi.CloseBody(res)
  2091  	if err := googleapi.CheckResponse(res); err != nil {
  2092  		return gensupport.WrapError(err)
  2093  	}
  2094  	return nil
  2095  }
  2096  
  2097  type SubscriptionsGetCall struct {
  2098  	s              *Service
  2099  	customerId     string
  2100  	subscriptionId string
  2101  	urlParams_     gensupport.URLParams
  2102  	ifNoneMatch_   string
  2103  	ctx_           context.Context
  2104  	header_        http.Header
  2105  }
  2106  
  2107  // Get: Gets a specific subscription. The `subscriptionId` can be found using
  2108  // the Retrieve all reseller subscriptions
  2109  // (/admin-sdk/reseller/v1/how-tos/manage_subscriptions#get_all_subscriptions)
  2110  // method. For more information about retrieving a specific subscription, see
  2111  // the information descrived in manage subscriptions
  2112  // (/admin-sdk/reseller/v1/how-tos/manage_subscriptions#get_subscription).
  2113  //
  2114  //   - customerId: This can be either the customer's primary domain name or the
  2115  //     customer's unique identifier. If the domain name for a customer changes,
  2116  //     the old domain name cannot be used to access the customer, but the
  2117  //     customer's unique identifier (as returned by the API) can always be used.
  2118  //     We recommend storing the unique identifier in your systems where
  2119  //     applicable.
  2120  //   - subscriptionId: This is a required property. The `subscriptionId` is the
  2121  //     subscription identifier and is unique for each customer. Since a
  2122  //     `subscriptionId` changes when a subscription is updated, we recommend to
  2123  //     not use this ID as a key for persistent data. And the `subscriptionId` can
  2124  //     be found using the retrieve all reseller subscriptions method.
  2125  func (r *SubscriptionsService) Get(customerId string, subscriptionId string) *SubscriptionsGetCall {
  2126  	c := &SubscriptionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2127  	c.customerId = customerId
  2128  	c.subscriptionId = subscriptionId
  2129  	return c
  2130  }
  2131  
  2132  // Fields allows partial responses to be retrieved. See
  2133  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2134  // details.
  2135  func (c *SubscriptionsGetCall) Fields(s ...googleapi.Field) *SubscriptionsGetCall {
  2136  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2137  	return c
  2138  }
  2139  
  2140  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  2141  // object's ETag matches the given value. This is useful for getting updates
  2142  // only after the object has changed since the last request.
  2143  func (c *SubscriptionsGetCall) IfNoneMatch(entityTag string) *SubscriptionsGetCall {
  2144  	c.ifNoneMatch_ = entityTag
  2145  	return c
  2146  }
  2147  
  2148  // Context sets the context to be used in this call's Do method.
  2149  func (c *SubscriptionsGetCall) Context(ctx context.Context) *SubscriptionsGetCall {
  2150  	c.ctx_ = ctx
  2151  	return c
  2152  }
  2153  
  2154  // Header returns a http.Header that can be modified by the caller to add
  2155  // headers to the request.
  2156  func (c *SubscriptionsGetCall) Header() http.Header {
  2157  	if c.header_ == nil {
  2158  		c.header_ = make(http.Header)
  2159  	}
  2160  	return c.header_
  2161  }
  2162  
  2163  func (c *SubscriptionsGetCall) doRequest(alt string) (*http.Response, error) {
  2164  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2165  	if c.ifNoneMatch_ != "" {
  2166  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2167  	}
  2168  	var body io.Reader = nil
  2169  	c.urlParams_.Set("alt", alt)
  2170  	c.urlParams_.Set("prettyPrint", "false")
  2171  	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}")
  2172  	urls += "?" + c.urlParams_.Encode()
  2173  	req, err := http.NewRequest("GET", urls, body)
  2174  	if err != nil {
  2175  		return nil, err
  2176  	}
  2177  	req.Header = reqHeaders
  2178  	googleapi.Expand(req.URL, map[string]string{
  2179  		"customerId":     c.customerId,
  2180  		"subscriptionId": c.subscriptionId,
  2181  	})
  2182  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2183  }
  2184  
  2185  // Do executes the "reseller.subscriptions.get" call.
  2186  // Any non-2xx status code is an error. Response headers are in either
  2187  // *Subscription.ServerResponse.Header or (if a response was returned at all)
  2188  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2189  // whether the returned error was because http.StatusNotModified was returned.
  2190  func (c *SubscriptionsGetCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
  2191  	gensupport.SetOptions(c.urlParams_, opts...)
  2192  	res, err := c.doRequest("json")
  2193  	if res != nil && res.StatusCode == http.StatusNotModified {
  2194  		if res.Body != nil {
  2195  			res.Body.Close()
  2196  		}
  2197  		return nil, gensupport.WrapError(&googleapi.Error{
  2198  			Code:   res.StatusCode,
  2199  			Header: res.Header,
  2200  		})
  2201  	}
  2202  	if err != nil {
  2203  		return nil, err
  2204  	}
  2205  	defer googleapi.CloseBody(res)
  2206  	if err := googleapi.CheckResponse(res); err != nil {
  2207  		return nil, gensupport.WrapError(err)
  2208  	}
  2209  	ret := &Subscription{
  2210  		ServerResponse: googleapi.ServerResponse{
  2211  			Header:         res.Header,
  2212  			HTTPStatusCode: res.StatusCode,
  2213  		},
  2214  	}
  2215  	target := &ret
  2216  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2217  		return nil, err
  2218  	}
  2219  	return ret, nil
  2220  }
  2221  
  2222  type SubscriptionsInsertCall struct {
  2223  	s            *Service
  2224  	customerId   string
  2225  	subscription *Subscription
  2226  	urlParams_   gensupport.URLParams
  2227  	ctx_         context.Context
  2228  	header_      http.Header
  2229  }
  2230  
  2231  // Insert: Creates or transfer a subscription. Create a subscription for a
  2232  // customer's account that you ordered using the Order a new customer account
  2233  // (/admin-sdk/reseller/v1/reference/customers/insert.html) method. For more
  2234  // information about creating a subscription for different payment plans, see
  2235  // manage subscriptions
  2236  // (/admin-sdk/reseller/v1/how-tos/manage_subscriptions#create_subscription).\
  2237  // If you did not order the customer's account using the customer insert
  2238  // method, use the customer's `customerAuthToken` when creating a subscription
  2239  // for that customer. If transferring a G Suite subscription with an associated
  2240  // Google Drive or Google Vault subscription, use the batch operation
  2241  // (/admin-sdk/reseller/v1/how-tos/batch.html) to transfer all of these
  2242  // subscriptions. For more information, see how to transfer subscriptions
  2243  // (/admin-sdk/reseller/v1/how-tos/manage_subscriptions#transfer_a_subscription)
  2244  // .
  2245  //
  2246  //   - customerId: This can be either the customer's primary domain name or the
  2247  //     customer's unique identifier. If the domain name for a customer changes,
  2248  //     the old domain name cannot be used to access the customer, but the
  2249  //     customer's unique identifier (as returned by the API) can always be used.
  2250  //     We recommend storing the unique identifier in your systems where
  2251  //     applicable.
  2252  func (r *SubscriptionsService) Insert(customerId string, subscription *Subscription) *SubscriptionsInsertCall {
  2253  	c := &SubscriptionsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2254  	c.customerId = customerId
  2255  	c.subscription = subscription
  2256  	return c
  2257  }
  2258  
  2259  // Action sets the optional parameter "action": The intented insert action. The
  2260  // usage of this field is governed by certain policies which are being
  2261  // developed & tested currently. Hence, these might not work as intended. Once
  2262  // this is fully tested & available to consume, we will share more information
  2263  // about its usage, limitations and policy documentation.
  2264  //
  2265  // Possible values:
  2266  //
  2267  //	"actionUnspecified" - Auto determines whether to create new subscription,
  2268  //
  2269  // upgrade or downagrade existing subscription or transfer the existing
  2270  // subscription
  2271  //
  2272  //	"buy" - Create new subscription
  2273  //	"switch" - Switch existing subscription to another sku (upgrade/downgrade)
  2274  func (c *SubscriptionsInsertCall) Action(action string) *SubscriptionsInsertCall {
  2275  	c.urlParams_.Set("action", action)
  2276  	return c
  2277  }
  2278  
  2279  // CustomerAuthToken sets the optional parameter "customerAuthToken": The
  2280  // `customerAuthToken` query string is required when creating a resold account
  2281  // that transfers a direct customer's subscription or transfers another
  2282  // reseller customer's subscription to your reseller management. This is a
  2283  // hexadecimal authentication token needed to complete the subscription
  2284  // transfer. For more information, see the administrator help center.
  2285  func (c *SubscriptionsInsertCall) CustomerAuthToken(customerAuthToken string) *SubscriptionsInsertCall {
  2286  	c.urlParams_.Set("customerAuthToken", customerAuthToken)
  2287  	return c
  2288  }
  2289  
  2290  // SourceSkuId sets the optional parameter "sourceSkuId": The sku_id of the
  2291  // existing subscription to be upgraded or downgraded. This is required when
  2292  // action is SWITCH. The usage of this field is governed by certain policies
  2293  // which are being developed & tested currently. Hence, these might not work as
  2294  // intended. Once this is fully tested & available to consume, we will share
  2295  // more information about its usage, limitations and policy documentation.
  2296  func (c *SubscriptionsInsertCall) SourceSkuId(sourceSkuId string) *SubscriptionsInsertCall {
  2297  	c.urlParams_.Set("sourceSkuId", sourceSkuId)
  2298  	return c
  2299  }
  2300  
  2301  // Fields allows partial responses to be retrieved. See
  2302  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2303  // details.
  2304  func (c *SubscriptionsInsertCall) Fields(s ...googleapi.Field) *SubscriptionsInsertCall {
  2305  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2306  	return c
  2307  }
  2308  
  2309  // Context sets the context to be used in this call's Do method.
  2310  func (c *SubscriptionsInsertCall) Context(ctx context.Context) *SubscriptionsInsertCall {
  2311  	c.ctx_ = ctx
  2312  	return c
  2313  }
  2314  
  2315  // Header returns a http.Header that can be modified by the caller to add
  2316  // headers to the request.
  2317  func (c *SubscriptionsInsertCall) Header() http.Header {
  2318  	if c.header_ == nil {
  2319  		c.header_ = make(http.Header)
  2320  	}
  2321  	return c.header_
  2322  }
  2323  
  2324  func (c *SubscriptionsInsertCall) doRequest(alt string) (*http.Response, error) {
  2325  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  2326  	var body io.Reader = nil
  2327  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.subscription)
  2328  	if err != nil {
  2329  		return nil, err
  2330  	}
  2331  	c.urlParams_.Set("alt", alt)
  2332  	c.urlParams_.Set("prettyPrint", "false")
  2333  	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}/subscriptions")
  2334  	urls += "?" + c.urlParams_.Encode()
  2335  	req, err := http.NewRequest("POST", urls, body)
  2336  	if err != nil {
  2337  		return nil, err
  2338  	}
  2339  	req.Header = reqHeaders
  2340  	googleapi.Expand(req.URL, map[string]string{
  2341  		"customerId": c.customerId,
  2342  	})
  2343  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2344  }
  2345  
  2346  // Do executes the "reseller.subscriptions.insert" call.
  2347  // Any non-2xx status code is an error. Response headers are in either
  2348  // *Subscription.ServerResponse.Header or (if a response was returned at all)
  2349  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2350  // whether the returned error was because http.StatusNotModified was returned.
  2351  func (c *SubscriptionsInsertCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
  2352  	gensupport.SetOptions(c.urlParams_, opts...)
  2353  	res, err := c.doRequest("json")
  2354  	if res != nil && res.StatusCode == http.StatusNotModified {
  2355  		if res.Body != nil {
  2356  			res.Body.Close()
  2357  		}
  2358  		return nil, gensupport.WrapError(&googleapi.Error{
  2359  			Code:   res.StatusCode,
  2360  			Header: res.Header,
  2361  		})
  2362  	}
  2363  	if err != nil {
  2364  		return nil, err
  2365  	}
  2366  	defer googleapi.CloseBody(res)
  2367  	if err := googleapi.CheckResponse(res); err != nil {
  2368  		return nil, gensupport.WrapError(err)
  2369  	}
  2370  	ret := &Subscription{
  2371  		ServerResponse: googleapi.ServerResponse{
  2372  			Header:         res.Header,
  2373  			HTTPStatusCode: res.StatusCode,
  2374  		},
  2375  	}
  2376  	target := &ret
  2377  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2378  		return nil, err
  2379  	}
  2380  	return ret, nil
  2381  }
  2382  
  2383  type SubscriptionsListCall struct {
  2384  	s            *Service
  2385  	urlParams_   gensupport.URLParams
  2386  	ifNoneMatch_ string
  2387  	ctx_         context.Context
  2388  	header_      http.Header
  2389  }
  2390  
  2391  // List: Lists of subscriptions managed by the reseller. The list can be all
  2392  // subscriptions, all of a customer's subscriptions, or all of a customer's
  2393  // transferable subscriptions. Optionally, this method can filter the response
  2394  // by a `customerNamePrefix`. For more information, see manage subscriptions
  2395  // (/admin-sdk/reseller/v1/how-tos/manage_subscriptions).
  2396  func (r *SubscriptionsService) List() *SubscriptionsListCall {
  2397  	c := &SubscriptionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2398  	return c
  2399  }
  2400  
  2401  // CustomerAuthToken sets the optional parameter "customerAuthToken": The
  2402  // `customerAuthToken` query string is required when creating a resold account
  2403  // that transfers a direct customer's subscription or transfers another
  2404  // reseller customer's subscription to your reseller management. This is a
  2405  // hexadecimal authentication token needed to complete the subscription
  2406  // transfer. For more information, see the administrator help center.
  2407  func (c *SubscriptionsListCall) CustomerAuthToken(customerAuthToken string) *SubscriptionsListCall {
  2408  	c.urlParams_.Set("customerAuthToken", customerAuthToken)
  2409  	return c
  2410  }
  2411  
  2412  // CustomerId sets the optional parameter "customerId": This can be either the
  2413  // customer's primary domain name or the customer's unique identifier. If the
  2414  // domain name for a customer changes, the old domain name cannot be used to
  2415  // access the customer, but the customer's unique identifier (as returned by
  2416  // the API) can always be used. We recommend storing the unique identifier in
  2417  // your systems where applicable.
  2418  func (c *SubscriptionsListCall) CustomerId(customerId string) *SubscriptionsListCall {
  2419  	c.urlParams_.Set("customerId", customerId)
  2420  	return c
  2421  }
  2422  
  2423  // CustomerNamePrefix sets the optional parameter "customerNamePrefix": When
  2424  // retrieving all of your subscriptions and filtering for specific customers,
  2425  // you can enter a prefix for a customer name. Using an example customer group
  2426  // that includes `exam.com`, `example20.com` and `example.com`: - `exa` --
  2427  // Returns all customer names that start with 'exa' which could include
  2428  // `exam.com`, `example20.com`, and `example.com`. A name prefix is similar to
  2429  // using a regular expression's asterisk, exa*. - `example` -- Returns
  2430  // `example20.com` and `example.com`.
  2431  func (c *SubscriptionsListCall) CustomerNamePrefix(customerNamePrefix string) *SubscriptionsListCall {
  2432  	c.urlParams_.Set("customerNamePrefix", customerNamePrefix)
  2433  	return c
  2434  }
  2435  
  2436  // MaxResults sets the optional parameter "maxResults": When retrieving a large
  2437  // list, the `maxResults` is the maximum number of results per page. The
  2438  // `nextPageToken` value takes you to the next page. The default is 20.
  2439  func (c *SubscriptionsListCall) MaxResults(maxResults int64) *SubscriptionsListCall {
  2440  	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2441  	return c
  2442  }
  2443  
  2444  // PageToken sets the optional parameter "pageToken": Token to specify next
  2445  // page in the list
  2446  func (c *SubscriptionsListCall) PageToken(pageToken string) *SubscriptionsListCall {
  2447  	c.urlParams_.Set("pageToken", pageToken)
  2448  	return c
  2449  }
  2450  
  2451  // Fields allows partial responses to be retrieved. See
  2452  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2453  // details.
  2454  func (c *SubscriptionsListCall) Fields(s ...googleapi.Field) *SubscriptionsListCall {
  2455  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2456  	return c
  2457  }
  2458  
  2459  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  2460  // object's ETag matches the given value. This is useful for getting updates
  2461  // only after the object has changed since the last request.
  2462  func (c *SubscriptionsListCall) IfNoneMatch(entityTag string) *SubscriptionsListCall {
  2463  	c.ifNoneMatch_ = entityTag
  2464  	return c
  2465  }
  2466  
  2467  // Context sets the context to be used in this call's Do method.
  2468  func (c *SubscriptionsListCall) Context(ctx context.Context) *SubscriptionsListCall {
  2469  	c.ctx_ = ctx
  2470  	return c
  2471  }
  2472  
  2473  // Header returns a http.Header that can be modified by the caller to add
  2474  // headers to the request.
  2475  func (c *SubscriptionsListCall) Header() http.Header {
  2476  	if c.header_ == nil {
  2477  		c.header_ = make(http.Header)
  2478  	}
  2479  	return c.header_
  2480  }
  2481  
  2482  func (c *SubscriptionsListCall) doRequest(alt string) (*http.Response, error) {
  2483  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2484  	if c.ifNoneMatch_ != "" {
  2485  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2486  	}
  2487  	var body io.Reader = nil
  2488  	c.urlParams_.Set("alt", alt)
  2489  	c.urlParams_.Set("prettyPrint", "false")
  2490  	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/subscriptions")
  2491  	urls += "?" + c.urlParams_.Encode()
  2492  	req, err := http.NewRequest("GET", urls, body)
  2493  	if err != nil {
  2494  		return nil, err
  2495  	}
  2496  	req.Header = reqHeaders
  2497  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2498  }
  2499  
  2500  // Do executes the "reseller.subscriptions.list" call.
  2501  // Any non-2xx status code is an error. Response headers are in either
  2502  // *Subscriptions.ServerResponse.Header or (if a response was returned at all)
  2503  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2504  // whether the returned error was because http.StatusNotModified was returned.
  2505  func (c *SubscriptionsListCall) Do(opts ...googleapi.CallOption) (*Subscriptions, error) {
  2506  	gensupport.SetOptions(c.urlParams_, opts...)
  2507  	res, err := c.doRequest("json")
  2508  	if res != nil && res.StatusCode == http.StatusNotModified {
  2509  		if res.Body != nil {
  2510  			res.Body.Close()
  2511  		}
  2512  		return nil, gensupport.WrapError(&googleapi.Error{
  2513  			Code:   res.StatusCode,
  2514  			Header: res.Header,
  2515  		})
  2516  	}
  2517  	if err != nil {
  2518  		return nil, err
  2519  	}
  2520  	defer googleapi.CloseBody(res)
  2521  	if err := googleapi.CheckResponse(res); err != nil {
  2522  		return nil, gensupport.WrapError(err)
  2523  	}
  2524  	ret := &Subscriptions{
  2525  		ServerResponse: googleapi.ServerResponse{
  2526  			Header:         res.Header,
  2527  			HTTPStatusCode: res.StatusCode,
  2528  		},
  2529  	}
  2530  	target := &ret
  2531  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2532  		return nil, err
  2533  	}
  2534  	return ret, nil
  2535  }
  2536  
  2537  // Pages invokes f for each page of results.
  2538  // A non-nil error returned from f will halt the iteration.
  2539  // The provided context supersedes any context provided to the Context method.
  2540  func (c *SubscriptionsListCall) Pages(ctx context.Context, f func(*Subscriptions) error) error {
  2541  	c.ctx_ = ctx
  2542  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  2543  	for {
  2544  		x, err := c.Do()
  2545  		if err != nil {
  2546  			return err
  2547  		}
  2548  		if err := f(x); err != nil {
  2549  			return err
  2550  		}
  2551  		if x.NextPageToken == "" {
  2552  			return nil
  2553  		}
  2554  		c.PageToken(x.NextPageToken)
  2555  	}
  2556  }
  2557  
  2558  type SubscriptionsStartPaidServiceCall struct {
  2559  	s              *Service
  2560  	customerId     string
  2561  	subscriptionId string
  2562  	urlParams_     gensupport.URLParams
  2563  	ctx_           context.Context
  2564  	header_        http.Header
  2565  }
  2566  
  2567  // StartPaidService: Immediately move a 30-day free trial subscription to a
  2568  // paid service subscription. This method is only applicable if a payment plan
  2569  // has already been set up for the 30-day trial subscription. For more
  2570  // information, see manage subscriptions
  2571  // (/admin-sdk/reseller/v1/how-tos/manage_subscriptions#paid_service).
  2572  //
  2573  //   - customerId: This can be either the customer's primary domain name or the
  2574  //     customer's unique identifier. If the domain name for a customer changes,
  2575  //     the old domain name cannot be used to access the customer, but the
  2576  //     customer's unique identifier (as returned by the API) can always be used.
  2577  //     We recommend storing the unique identifier in your systems where
  2578  //     applicable.
  2579  //   - subscriptionId: This is a required property. The `subscriptionId` is the
  2580  //     subscription identifier and is unique for each customer. Since a
  2581  //     `subscriptionId` changes when a subscription is updated, we recommend to
  2582  //     not use this ID as a key for persistent data. And the `subscriptionId` can
  2583  //     be found using the retrieve all reseller subscriptions method.
  2584  func (r *SubscriptionsService) StartPaidService(customerId string, subscriptionId string) *SubscriptionsStartPaidServiceCall {
  2585  	c := &SubscriptionsStartPaidServiceCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2586  	c.customerId = customerId
  2587  	c.subscriptionId = subscriptionId
  2588  	return c
  2589  }
  2590  
  2591  // Fields allows partial responses to be retrieved. See
  2592  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2593  // details.
  2594  func (c *SubscriptionsStartPaidServiceCall) Fields(s ...googleapi.Field) *SubscriptionsStartPaidServiceCall {
  2595  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2596  	return c
  2597  }
  2598  
  2599  // Context sets the context to be used in this call's Do method.
  2600  func (c *SubscriptionsStartPaidServiceCall) Context(ctx context.Context) *SubscriptionsStartPaidServiceCall {
  2601  	c.ctx_ = ctx
  2602  	return c
  2603  }
  2604  
  2605  // Header returns a http.Header that can be modified by the caller to add
  2606  // headers to the request.
  2607  func (c *SubscriptionsStartPaidServiceCall) Header() http.Header {
  2608  	if c.header_ == nil {
  2609  		c.header_ = make(http.Header)
  2610  	}
  2611  	return c.header_
  2612  }
  2613  
  2614  func (c *SubscriptionsStartPaidServiceCall) doRequest(alt string) (*http.Response, error) {
  2615  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2616  	var body io.Reader = nil
  2617  	c.urlParams_.Set("alt", alt)
  2618  	c.urlParams_.Set("prettyPrint", "false")
  2619  	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/startPaidService")
  2620  	urls += "?" + c.urlParams_.Encode()
  2621  	req, err := http.NewRequest("POST", urls, body)
  2622  	if err != nil {
  2623  		return nil, err
  2624  	}
  2625  	req.Header = reqHeaders
  2626  	googleapi.Expand(req.URL, map[string]string{
  2627  		"customerId":     c.customerId,
  2628  		"subscriptionId": c.subscriptionId,
  2629  	})
  2630  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2631  }
  2632  
  2633  // Do executes the "reseller.subscriptions.startPaidService" call.
  2634  // Any non-2xx status code is an error. Response headers are in either
  2635  // *Subscription.ServerResponse.Header or (if a response was returned at all)
  2636  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2637  // whether the returned error was because http.StatusNotModified was returned.
  2638  func (c *SubscriptionsStartPaidServiceCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
  2639  	gensupport.SetOptions(c.urlParams_, opts...)
  2640  	res, err := c.doRequest("json")
  2641  	if res != nil && res.StatusCode == http.StatusNotModified {
  2642  		if res.Body != nil {
  2643  			res.Body.Close()
  2644  		}
  2645  		return nil, gensupport.WrapError(&googleapi.Error{
  2646  			Code:   res.StatusCode,
  2647  			Header: res.Header,
  2648  		})
  2649  	}
  2650  	if err != nil {
  2651  		return nil, err
  2652  	}
  2653  	defer googleapi.CloseBody(res)
  2654  	if err := googleapi.CheckResponse(res); err != nil {
  2655  		return nil, gensupport.WrapError(err)
  2656  	}
  2657  	ret := &Subscription{
  2658  		ServerResponse: googleapi.ServerResponse{
  2659  			Header:         res.Header,
  2660  			HTTPStatusCode: res.StatusCode,
  2661  		},
  2662  	}
  2663  	target := &ret
  2664  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2665  		return nil, err
  2666  	}
  2667  	return ret, nil
  2668  }
  2669  
  2670  type SubscriptionsSuspendCall struct {
  2671  	s              *Service
  2672  	customerId     string
  2673  	subscriptionId string
  2674  	urlParams_     gensupport.URLParams
  2675  	ctx_           context.Context
  2676  	header_        http.Header
  2677  }
  2678  
  2679  // Suspend: Suspends an active subscription. You can use this method to suspend
  2680  // a paid subscription that is currently in the `ACTIVE` state. * For
  2681  // `FLEXIBLE` subscriptions, billing is paused. * For `ANNUAL_MONTHLY_PAY` or
  2682  // `ANNUAL_YEARLY_PAY` subscriptions: * Suspending the subscription does not
  2683  // change the renewal date that was originally committed to. * A suspended
  2684  // subscription does not renew. If you activate the subscription after the
  2685  // original renewal date, a new annual subscription will be created, starting
  2686  // on the day of activation. We strongly encourage you to suspend subscriptions
  2687  // only for short periods of time as suspensions over 60 days may result in the
  2688  // subscription being cancelled.
  2689  //
  2690  //   - customerId: This can be either the customer's primary domain name or the
  2691  //     customer's unique identifier. If the domain name for a customer changes,
  2692  //     the old domain name cannot be used to access the customer, but the
  2693  //     customer's unique identifier (as returned by the API) can always be used.
  2694  //     We recommend storing the unique identifier in your systems where
  2695  //     applicable.
  2696  //   - subscriptionId: This is a required property. The `subscriptionId` is the
  2697  //     subscription identifier and is unique for each customer. Since a
  2698  //     `subscriptionId` changes when a subscription is updated, we recommend to
  2699  //     not use this ID as a key for persistent data. And the `subscriptionId` can
  2700  //     be found using the retrieve all reseller subscriptions method.
  2701  func (r *SubscriptionsService) Suspend(customerId string, subscriptionId string) *SubscriptionsSuspendCall {
  2702  	c := &SubscriptionsSuspendCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2703  	c.customerId = customerId
  2704  	c.subscriptionId = subscriptionId
  2705  	return c
  2706  }
  2707  
  2708  // Fields allows partial responses to be retrieved. See
  2709  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2710  // details.
  2711  func (c *SubscriptionsSuspendCall) Fields(s ...googleapi.Field) *SubscriptionsSuspendCall {
  2712  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2713  	return c
  2714  }
  2715  
  2716  // Context sets the context to be used in this call's Do method.
  2717  func (c *SubscriptionsSuspendCall) Context(ctx context.Context) *SubscriptionsSuspendCall {
  2718  	c.ctx_ = ctx
  2719  	return c
  2720  }
  2721  
  2722  // Header returns a http.Header that can be modified by the caller to add
  2723  // headers to the request.
  2724  func (c *SubscriptionsSuspendCall) Header() http.Header {
  2725  	if c.header_ == nil {
  2726  		c.header_ = make(http.Header)
  2727  	}
  2728  	return c.header_
  2729  }
  2730  
  2731  func (c *SubscriptionsSuspendCall) doRequest(alt string) (*http.Response, error) {
  2732  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2733  	var body io.Reader = nil
  2734  	c.urlParams_.Set("alt", alt)
  2735  	c.urlParams_.Set("prettyPrint", "false")
  2736  	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/suspend")
  2737  	urls += "?" + c.urlParams_.Encode()
  2738  	req, err := http.NewRequest("POST", urls, body)
  2739  	if err != nil {
  2740  		return nil, err
  2741  	}
  2742  	req.Header = reqHeaders
  2743  	googleapi.Expand(req.URL, map[string]string{
  2744  		"customerId":     c.customerId,
  2745  		"subscriptionId": c.subscriptionId,
  2746  	})
  2747  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2748  }
  2749  
  2750  // Do executes the "reseller.subscriptions.suspend" call.
  2751  // Any non-2xx status code is an error. Response headers are in either
  2752  // *Subscription.ServerResponse.Header or (if a response was returned at all)
  2753  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2754  // whether the returned error was because http.StatusNotModified was returned.
  2755  func (c *SubscriptionsSuspendCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
  2756  	gensupport.SetOptions(c.urlParams_, opts...)
  2757  	res, err := c.doRequest("json")
  2758  	if res != nil && res.StatusCode == http.StatusNotModified {
  2759  		if res.Body != nil {
  2760  			res.Body.Close()
  2761  		}
  2762  		return nil, gensupport.WrapError(&googleapi.Error{
  2763  			Code:   res.StatusCode,
  2764  			Header: res.Header,
  2765  		})
  2766  	}
  2767  	if err != nil {
  2768  		return nil, err
  2769  	}
  2770  	defer googleapi.CloseBody(res)
  2771  	if err := googleapi.CheckResponse(res); err != nil {
  2772  		return nil, gensupport.WrapError(err)
  2773  	}
  2774  	ret := &Subscription{
  2775  		ServerResponse: googleapi.ServerResponse{
  2776  			Header:         res.Header,
  2777  			HTTPStatusCode: res.StatusCode,
  2778  		},
  2779  	}
  2780  	target := &ret
  2781  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2782  		return nil, err
  2783  	}
  2784  	return ret, nil
  2785  }
  2786  

View as plain text