1// Copyright 2021 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// Creating a client
12//
13// Usage example:
14//
15//   import "google.golang.org/api/reseller/v1"
16//   ...
17//   ctx := context.Background()
18//   resellerService, err := reseller.NewService(ctx)
19//
20// In this example, Google Application Default Credentials are used for authentication.
21//
22// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
23//
24// Other authentication options
25//
26// By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
27//
28//   resellerService, err := reseller.NewService(ctx, option.WithScopes(reseller.AppsOrderReadonlyScope))
29//
30// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
31//
32//   resellerService, err := reseller.NewService(ctx, option.WithAPIKey("AIza..."))
33//
34// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
35//
36//   config := &oauth2.Config{...}
37//   // ...
38//   token, err := config.Exchange(ctx, ...)
39//   resellerService, err := reseller.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
40//
41// See https://godoc.org/google.golang.org/api/option/ for details on options.
42package reseller // import "google.golang.org/api/reseller/v1"
43
44import (
45	"bytes"
46	"context"
47	"encoding/json"
48	"errors"
49	"fmt"
50	"io"
51	"net/http"
52	"net/url"
53	"strconv"
54	"strings"
55
56	googleapi "google.golang.org/api/googleapi"
57	gensupport "google.golang.org/api/internal/gensupport"
58	option "google.golang.org/api/option"
59	internaloption "google.golang.org/api/option/internaloption"
60	htransport "google.golang.org/api/transport/http"
61)
62
63// Always reference these packages, just in case the auto-generated code
64// below doesn't.
65var _ = bytes.NewBuffer
66var _ = strconv.Itoa
67var _ = fmt.Sprintf
68var _ = json.NewDecoder
69var _ = io.Copy
70var _ = url.Parse
71var _ = gensupport.MarshalJSON
72var _ = googleapi.Version
73var _ = errors.New
74var _ = strings.Replace
75var _ = context.Canceled
76var _ = internaloption.WithDefaultEndpoint
77
78const apiId = "reseller:v1"
79const apiName = "reseller"
80const apiVersion = "v1"
81const basePath = "https://reseller.googleapis.com/"
82const mtlsBasePath = "https://reseller.mtls.googleapis.com/"
83
84// OAuth2 scopes used by this API.
85const (
86	// Manage users on your domain
87	AppsOrderScope = "https://www.googleapis.com/auth/apps.order"
88
89	// Manage users on your domain
90	AppsOrderReadonlyScope = "https://www.googleapis.com/auth/apps.order.readonly"
91)
92
93// NewService creates a new Service.
94func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
95	scopesOption := option.WithScopes(
96		"https://www.googleapis.com/auth/apps.order",
97		"https://www.googleapis.com/auth/apps.order.readonly",
98	)
99	// NOTE: prepend, so we don't override user-specified scopes.
100	opts = append([]option.ClientOption{scopesOption}, opts...)
101	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
102	opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
103	client, endpoint, err := htransport.NewClient(ctx, opts...)
104	if err != nil {
105		return nil, err
106	}
107	s, err := New(client)
108	if err != nil {
109		return nil, err
110	}
111	if endpoint != "" {
112		s.BasePath = endpoint
113	}
114	return s, nil
115}
116
117// New creates a new Service. It uses the provided http.Client for requests.
118//
119// Deprecated: please use NewService instead.
120// To provide a custom HTTP client, use option.WithHTTPClient.
121// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
122func New(client *http.Client) (*Service, error) {
123	if client == nil {
124		return nil, errors.New("client is nil")
125	}
126	s := &Service{client: client, BasePath: basePath}
127	s.Customers = NewCustomersService(s)
128	s.Resellernotify = NewResellernotifyService(s)
129	s.Subscriptions = NewSubscriptionsService(s)
130	return s, nil
131}
132
133type Service struct {
134	client    *http.Client
135	BasePath  string // API endpoint base URL
136	UserAgent string // optional additional User-Agent fragment
137
138	Customers *CustomersService
139
140	Resellernotify *ResellernotifyService
141
142	Subscriptions *SubscriptionsService
143}
144
145func (s *Service) userAgent() string {
146	if s.UserAgent == "" {
147		return googleapi.UserAgent
148	}
149	return googleapi.UserAgent + " " + s.UserAgent
150}
151
152func NewCustomersService(s *Service) *CustomersService {
153	rs := &CustomersService{s: s}
154	return rs
155}
156
157type CustomersService struct {
158	s *Service
159}
160
161func NewResellernotifyService(s *Service) *ResellernotifyService {
162	rs := &ResellernotifyService{s: s}
163	return rs
164}
165
166type ResellernotifyService struct {
167	s *Service
168}
169
170func NewSubscriptionsService(s *Service) *SubscriptionsService {
171	rs := &SubscriptionsService{s: s}
172	return rs
173}
174
175type SubscriptionsService struct {
176	s *Service
177}
178
179// Address: JSON template for address of a customer.
180type Address struct {
181	// AddressLine1: A customer's physical address. An address can be
182	// composed of one to three lines. The `addressline2` and `addressLine3`
183	// are optional.
184	AddressLine1 string `json:"addressLine1,omitempty"`
185
186	// AddressLine2: Line 2 of the address.
187	AddressLine2 string `json:"addressLine2,omitempty"`
188
189	// AddressLine3: Line 3 of the address.
190	AddressLine3 string `json:"addressLine3,omitempty"`
191
192	// ContactName: The customer contact's name. This is required.
193	ContactName string `json:"contactName,omitempty"`
194
195	// CountryCode: For `countryCode` information, see the ISO 3166 country
196	// code elements. Verify that country is approved for resale of Google
197	// products. This property is required when creating a new customer.
198	CountryCode string `json:"countryCode,omitempty"`
199
200	// Kind: Identifies the resource as a customer address. Value:
201	// `customers#address`
202	Kind string `json:"kind,omitempty"`
203
204	// Locality: An example of a `locality` value is the city of `San
205	// Francisco`.
206	Locality string `json:"locality,omitempty"`
207
208	// OrganizationName: The company or company division name. This is
209	// required.
210	OrganizationName string `json:"organizationName,omitempty"`
211
212	// PostalCode: A `postalCode` example is a postal zip code such as
213	// `94043`. This property is required when creating a new customer.
214	PostalCode string `json:"postalCode,omitempty"`
215
216	// Region: An example of a `region` value is `CA` for the state of
217	// California.
218	Region string `json:"region,omitempty"`
219
220	// ForceSendFields is a list of field names (e.g. "AddressLine1") to
221	// unconditionally include in API requests. By default, fields with
222	// empty or default values are omitted from API requests. However, any
223	// non-pointer, non-interface field appearing in ForceSendFields will be
224	// sent to the server regardless of whether the field is empty or not.
225	// This may be used to include empty fields in Patch requests.
226	ForceSendFields []string `json:"-"`
227
228	// NullFields is a list of field names (e.g. "AddressLine1") to include
229	// in API requests with the JSON null value. By default, fields with
230	// empty values are omitted from API requests. However, any field with
231	// an empty value appearing in NullFields will be sent to the server as
232	// null. It is an error if a field in this list has a non-empty value.
233	// This may be used to include null fields in Patch requests.
234	NullFields []string `json:"-"`
235}
236
237func (s *Address) MarshalJSON() ([]byte, error) {
238	type NoMethod Address
239	raw := NoMethod(*s)
240	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
241}
242
243// ChangePlanRequest: JSON template for the ChangePlan rpc request.
244type ChangePlanRequest struct {
245	// DealCode: Google-issued code (100 char max) for discounted pricing on
246	// subscription plans. Deal code must be included in `changePlan`
247	// request in order to receive discounted rate. This property is
248	// optional. If a deal code has already been added to a subscription,
249	// this property may be left empty and the existing discounted rate will
250	// still apply (if not empty, only provide the deal code that is already
251	// present on the subscription). If a deal code has never been added to
252	// a subscription and this property is left blank, regular pricing will
253	// apply.
254	DealCode string `json:"dealCode,omitempty"`
255
256	// Kind: Identifies the resource as a subscription change plan request.
257	// Value: `subscriptions#changePlanRequest`
258	Kind string `json:"kind,omitempty"`
259
260	// PlanName: The `planName` property is required. This is the name of
261	// the subscription's payment plan. For more information about the
262	// Google payment plans, see API concepts. Possible values are: -
263	// `ANNUAL_MONTHLY_PAY` - The annual commitment plan with monthly
264	// payments *Caution: *`ANNUAL_MONTHLY_PAY` is returned as `ANNUAL` in
265	// all API responses. - `ANNUAL_YEARLY_PAY` - The annual commitment plan
266	// with yearly payments - `FLEXIBLE` - The flexible plan - `TRIAL` - The
267	// 30-day free trial plan
268	PlanName string `json:"planName,omitempty"`
269
270	// PurchaseOrderId: This is an optional property. This purchase order
271	// (PO) information is for resellers to use for their company tracking
272	// usage. If a `purchaseOrderId` value is given it appears in the API
273	// responses and shows up in the invoice. The property accepts up to 80
274	// plain text characters.
275	PurchaseOrderId string `json:"purchaseOrderId,omitempty"`
276
277	// Seats: This is a required property. The seats property is the number
278	// of user seat licenses.
279	Seats *Seats `json:"seats,omitempty"`
280
281	// ForceSendFields is a list of field names (e.g. "DealCode") to
282	// unconditionally include in API requests. By default, fields with
283	// empty or default values are omitted from API requests. However, any
284	// non-pointer, non-interface field appearing in ForceSendFields will be
285	// sent to the server regardless of whether the field is empty or not.
286	// This may be used to include empty fields in Patch requests.
287	ForceSendFields []string `json:"-"`
288
289	// NullFields is a list of field names (e.g. "DealCode") to include in
290	// API requests with the JSON null value. By default, fields with empty
291	// values are omitted from API requests. However, any field with an
292	// empty value appearing in NullFields will be sent to the server as
293	// null. It is an error if a field in this list has a non-empty value.
294	// This may be used to include null fields in Patch requests.
295	NullFields []string `json:"-"`
296}
297
298func (s *ChangePlanRequest) MarshalJSON() ([]byte, error) {
299	type NoMethod ChangePlanRequest
300	raw := NoMethod(*s)
301	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
302}
303
304// Customer: When a Google customer's account is registered with a
305// reseller, the customer's subscriptions for Google services are
306// managed by this reseller. A customer is described by a primary domain
307// name and a physical address.
308type Customer struct {
309	// AlternateEmail: Like the "Customer email" in the reseller tools, this
310	// email is the secondary contact used if something happens to the
311	// customer's service such as service outage or a security issue. This
312	// property is required when creating a new "domain" customer and should
313	// not use the same domain as `customerDomain`. The `alternateEmail`
314	// field is not necessary to create a "team" customer.
315	AlternateEmail string `json:"alternateEmail,omitempty"`
316
317	// CustomerDomain: The customer's primary domain name string.
318	// `customerDomain` is required when creating a new customer. Do not
319	// include the `www` prefix in the domain when adding a customer.
320	CustomerDomain string `json:"customerDomain,omitempty"`
321
322	// CustomerDomainVerified: Whether the customer's primary domain has
323	// been verified.
324	CustomerDomainVerified bool `json:"customerDomainVerified,omitempty"`
325
326	// CustomerId: This property will always be returned in a response as
327	// the unique identifier generated by Google. In a request, this
328	// property can be either the primary domain or the unique identifier
329	// generated by Google.
330	CustomerId string `json:"customerId,omitempty"`
331
332	// CustomerType: Identifies the type of the customer. Acceptable values
333	// include: * `domain`: Implies a domain-verified customer (default). *
334	// `team`: Implies an email-verified customer. For more information, see
335	// managed teams (https://support.google.com/a/users/answer/9939479).
336	//
337	// Possible values:
338	//   "CUSTOMER_TYPE_UNSPECIFIED" - Customer type not known
339	//   "DOMAIN" - Domained or domain-owning customers
340	//   "TEAM" - Domainless or email-verified customers
341	CustomerType string `json:"customerType,omitempty"`
342
343	// Kind: Identifies the resource as a customer. Value:
344	// `reseller#customer`
345	Kind string `json:"kind,omitempty"`
346
347	// PhoneNumber: Customer contact phone number. Must start with "+"
348	// followed by the country code. The rest of the number can be
349	// contiguous numbers or respect the phone local format conventions, but
350	// it must be a real phone number and not, for example, "123". This
351	// field is silently ignored if invalid.
352	PhoneNumber string `json:"phoneNumber,omitempty"`
353
354	// PostalAddress: A customer's address information. Each field has a
355	// limit of 255 charcters.
356	PostalAddress *Address `json:"postalAddress,omitempty"`
357
358	// PrimaryAdmin: The first admin details of the customer, present in
359	// case of TEAM customer.
360	PrimaryAdmin *PrimaryAdmin `json:"primaryAdmin,omitempty"`
361
362	// ResourceUiUrl: URL to customer's Admin console dashboard. The
363	// read-only URL is generated by the API service. This is used if your
364	// client application requires the customer to complete a task in the
365	// Admin console.
366	ResourceUiUrl string `json:"resourceUiUrl,omitempty"`
367
368	// ServerResponse contains the HTTP response code and headers from the
369	// server.
370	googleapi.ServerResponse `json:"-"`
371
372	// ForceSendFields is a list of field names (e.g. "AlternateEmail") to
373	// unconditionally include in API requests. By default, fields with
374	// empty or default values are omitted from API requests. However, any
375	// non-pointer, non-interface field appearing in ForceSendFields will be
376	// sent to the server regardless of whether the field is empty or not.
377	// This may be used to include empty fields in Patch requests.
378	ForceSendFields []string `json:"-"`
379
380	// NullFields is a list of field names (e.g. "AlternateEmail") to
381	// include in API requests with the JSON null value. By default, fields
382	// with empty values are omitted from API requests. However, any field
383	// with an empty value appearing in NullFields will be sent to the
384	// server as null. It is an error if a field in this list has a
385	// non-empty value. This may be used to include null fields in Patch
386	// requests.
387	NullFields []string `json:"-"`
388}
389
390func (s *Customer) MarshalJSON() ([]byte, error) {
391	type NoMethod Customer
392	raw := NoMethod(*s)
393	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
394}
395
396// PrimaryAdmin: JSON template for primary admin in case of TEAM
397// customers
398type PrimaryAdmin struct {
399	// PrimaryEmail: The business email of the primary administrator of the
400	// customer. The email verification link is sent to this email address
401	// at the time of customer creation. Primary administrators have access
402	// to the customer's Admin Console, including the ability to invite and
403	// evict users and manage the administrative needs of the customer.
404	PrimaryEmail string `json:"primaryEmail,omitempty"`
405
406	// ForceSendFields is a list of field names (e.g. "PrimaryEmail") to
407	// unconditionally include in API requests. By default, fields with
408	// empty or default values are omitted from API requests. However, any
409	// non-pointer, non-interface field appearing in ForceSendFields will be
410	// sent to the server regardless of whether the field is empty or not.
411	// This may be used to include empty fields in Patch requests.
412	ForceSendFields []string `json:"-"`
413
414	// NullFields is a list of field names (e.g. "PrimaryEmail") to include
415	// in API requests with the JSON null value. By default, fields with
416	// empty values are omitted from API requests. However, any field with
417	// an empty value appearing in NullFields will be sent to the server as
418	// null. It is an error if a field in this list has a non-empty value.
419	// This may be used to include null fields in Patch requests.
420	NullFields []string `json:"-"`
421}
422
423func (s *PrimaryAdmin) MarshalJSON() ([]byte, error) {
424	type NoMethod PrimaryAdmin
425	raw := NoMethod(*s)
426	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
427}
428
429// RenewalSettings: JSON template for a subscription renewal settings.
430type RenewalSettings struct {
431	// Kind: Identifies the resource as a subscription renewal setting.
432	// Value: `subscriptions#renewalSettings`
433	Kind string `json:"kind,omitempty"`
434
435	// RenewalType: Renewal settings for the annual commitment plan. For
436	// more detailed information, see renewal options in the administrator
437	// help center. When renewing a subscription, the `renewalType` is a
438	// required property.
439	RenewalType string `json:"renewalType,omitempty"`
440
441	// ForceSendFields is a list of field names (e.g. "Kind") to
442	// unconditionally include in API requests. By default, fields with
443	// empty or default values are omitted from API requests. However, any
444	// non-pointer, non-interface field appearing in ForceSendFields will be
445	// sent to the server regardless of whether the field is empty or not.
446	// This may be used to include empty fields in Patch requests.
447	ForceSendFields []string `json:"-"`
448
449	// NullFields is a list of field names (e.g. "Kind") to include in API
450	// requests with the JSON null value. By default, fields with empty
451	// values are omitted from API requests. However, any field with an
452	// empty value appearing in NullFields will be sent to the server as
453	// null. It is an error if a field in this list has a non-empty value.
454	// This may be used to include null fields in Patch requests.
455	NullFields []string `json:"-"`
456}
457
458func (s *RenewalSettings) MarshalJSON() ([]byte, error) {
459	type NoMethod RenewalSettings
460	raw := NoMethod(*s)
461	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
462}
463
464// ResellernotifyGetwatchdetailsResponse: JSON template for
465// resellernotify getwatchdetails response.
466type ResellernotifyGetwatchdetailsResponse struct {
467	// ServiceAccountEmailAddresses: List of registered service accounts.
468	ServiceAccountEmailAddresses []string `json:"serviceAccountEmailAddresses,omitempty"`
469
470	// TopicName: Topic name of the PubSub
471	TopicName string `json:"topicName,omitempty"`
472
473	// ServerResponse contains the HTTP response code and headers from the
474	// server.
475	googleapi.ServerResponse `json:"-"`
476
477	// ForceSendFields is a list of field names (e.g.
478	// "ServiceAccountEmailAddresses") to unconditionally include in API
479	// requests. By default, fields with empty or default values are omitted
480	// from API requests. However, any non-pointer, non-interface field
481	// appearing in ForceSendFields will be sent to the server regardless of
482	// whether the field is empty or not. This may be used to include empty
483	// fields in Patch requests.
484	ForceSendFields []string `json:"-"`
485
486	// NullFields is a list of field names (e.g.
487	// "ServiceAccountEmailAddresses") to include in API requests with the
488	// JSON null value. By default, fields with empty values are omitted
489	// from API requests. However, any field with an empty value appearing
490	// in NullFields will be sent to the server as null. It is an error if a
491	// field in this list has a non-empty value. This may be used to include
492	// null fields in Patch requests.
493	NullFields []string `json:"-"`
494}
495
496func (s *ResellernotifyGetwatchdetailsResponse) MarshalJSON() ([]byte, error) {
497	type NoMethod ResellernotifyGetwatchdetailsResponse
498	raw := NoMethod(*s)
499	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
500}
501
502// ResellernotifyResource: JSON template for resellernotify response.
503type ResellernotifyResource struct {
504	// TopicName: Topic name of the PubSub
505	TopicName string `json:"topicName,omitempty"`
506
507	// ServerResponse contains the HTTP response code and headers from the
508	// server.
509	googleapi.ServerResponse `json:"-"`
510
511	// ForceSendFields is a list of field names (e.g. "TopicName") to
512	// unconditionally include in API requests. By default, fields with
513	// empty or default values are omitted from API requests. However, any
514	// non-pointer, non-interface field appearing in ForceSendFields will be
515	// sent to the server regardless of whether the field is empty or not.
516	// This may be used to include empty fields in Patch requests.
517	ForceSendFields []string `json:"-"`
518
519	// NullFields is a list of field names (e.g. "TopicName") to include in
520	// API requests with the JSON null value. By default, fields with empty
521	// values are omitted from API requests. However, any field with an
522	// empty value appearing in NullFields will be sent to the server as
523	// null. It is an error if a field in this list has a non-empty value.
524	// This may be used to include null fields in Patch requests.
525	NullFields []string `json:"-"`
526}
527
528func (s *ResellernotifyResource) MarshalJSON() ([]byte, error) {
529	type NoMethod ResellernotifyResource
530	raw := NoMethod(*s)
531	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
532}
533
534// Seats: JSON template for subscription seats.
535type Seats struct {
536	// Kind: Identifies the resource as a subscription seat setting. Value:
537	// `subscriptions#seats`
538	Kind string `json:"kind,omitempty"`
539
540	// LicensedNumberOfSeats: Read-only field containing the current number
541	// of users that are assigned a license for the product defined in
542	// `skuId`. This field's value is equivalent to the numerical count of
543	// users returned by the Enterprise License Manager API method:
544	// `listForProductAndSku`
545	// (/admin-sdk/licensing/v1/reference/licenseAssignments/listForProductAn
546	// dSku).
547	LicensedNumberOfSeats int64 `json:"licensedNumberOfSeats,omitempty"`
548
549	// MaximumNumberOfSeats: This is a required property and is exclusive to
550	// subscriptions with `FLEXIBLE` or `TRIAL` plans. This property sets
551	// the maximum number of licensed users allowed on a subscription. This
552	// quantity can be increased up to the maximum limit defined in the
553	// reseller's contract. The minimum quantity is the current number of
554	// users in the customer account. *Note: *G Suite subscriptions
555	// automatically assign a license to every user.
556	MaximumNumberOfSeats int64 `json:"maximumNumberOfSeats,omitempty"`
557
558	// NumberOfSeats: This is a required property and is exclusive to
559	// subscriptions with `ANNUAL_MONTHLY_PAY` and `ANNUAL_YEARLY_PAY`
560	// plans. This property sets the maximum number of licenses assignable
561	// to users on a subscription. The reseller can add more licenses, but
562	// once set, the `numberOfSeats` cannot be reduced until renewal. The
563	// reseller is invoiced based on the `numberOfSeats` value regardless of
564	// how many of these user licenses are assigned. *Note: *Google
565	// Workspace subscriptions automatically assign a license to every user.
566	NumberOfSeats int64 `json:"numberOfSeats,omitempty"`
567
568	// ForceSendFields is a list of field names (e.g. "Kind") to
569	// unconditionally include in API requests. By default, fields with
570	// empty or default values are omitted from API requests. However, any
571	// non-pointer, non-interface field appearing in ForceSendFields will be
572	// sent to the server regardless of whether the field is empty or not.
573	// This may be used to include empty fields in Patch requests.
574	ForceSendFields []string `json:"-"`
575
576	// NullFields is a list of field names (e.g. "Kind") to include in API
577	// requests with the JSON null value. By default, fields with empty
578	// values are omitted from API requests. However, any field with an
579	// empty value appearing in NullFields will be sent to the server as
580	// null. It is an error if a field in this list has a non-empty value.
581	// This may be used to include null fields in Patch requests.
582	NullFields []string `json:"-"`
583}
584
585func (s *Seats) MarshalJSON() ([]byte, error) {
586	type NoMethod Seats
587	raw := NoMethod(*s)
588	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
589}
590
591// Subscription: JSON template for a subscription.
592type Subscription struct {
593	// BillingMethod: Read-only field that returns the current billing
594	// method for a subscription.
595	BillingMethod string `json:"billingMethod,omitempty"`
596
597	// CreationTime: The `creationTime` property is the date when
598	// subscription was created. It is in milliseconds using the Epoch
599	// format. See an example Epoch converter.
600	CreationTime int64 `json:"creationTime,omitempty,string"`
601
602	// CustomerDomain: Primary domain name of the customer
603	CustomerDomain string `json:"customerDomain,omitempty"`
604
605	// CustomerId: This property will always be returned in a response as
606	// the unique identifier generated by Google. In a request, this
607	// property can be either the primary domain or the unique identifier
608	// generated by Google.
609	CustomerId string `json:"customerId,omitempty"`
610
611	// DealCode: Google-issued code (100 char max) for discounted pricing on
612	// subscription plans. Deal code must be included in `insert` requests
613	// in order to receive discounted rate. This property is optional,
614	// regular pricing applies if left empty.
615	DealCode string `json:"dealCode,omitempty"`
616
617	// Kind: Identifies the resource as a Subscription. Value:
618	// `reseller#subscription`
619	Kind string `json:"kind,omitempty"`
620
621	// Plan: The `plan` property is required. In this version of the API,
622	// the G Suite plans are the flexible plan, annual commitment plan, and
623	// the 30-day free trial plan. For more information about the API"s
624	// payment plans, see the API concepts.
625	Plan *SubscriptionPlan `json:"plan,omitempty"`
626
627	// PurchaseOrderId: This is an optional property. This purchase order
628	// (PO) information is for resellers to use for their company tracking
629	// usage. If a `purchaseOrderId` value is given it appears in the API
630	// responses and shows up in the invoice. The property accepts up to 80
631	// plain text characters.
632	PurchaseOrderId string `json:"purchaseOrderId,omitempty"`
633
634	// RenewalSettings: Renewal settings for the annual commitment plan. For
635	// more detailed information, see renewal options in the administrator
636	// help center.
637	RenewalSettings *RenewalSettings `json:"renewalSettings,omitempty"`
638
639	// ResourceUiUrl: URL to customer's Subscriptions page in the Admin
640	// console. The read-only URL is generated by the API service. This is
641	// used if your client application requires the customer to complete a
642	// task using the Subscriptions page in the Admin console.
643	ResourceUiUrl string `json:"resourceUiUrl,omitempty"`
644
645	// Seats: This is a required property. The number and limit of user seat
646	// licenses in the plan.
647	Seats *Seats `json:"seats,omitempty"`
648
649	// SkuId: A required property. The `skuId` is a unique system identifier
650	// for a product's SKU assigned to a customer in the subscription. For
651	// products and SKUs available in this version of the API, see Product
652	// and SKU IDs.
653	SkuId string `json:"skuId,omitempty"`
654
655	// SkuName: Read-only external display name for a product's SKU assigned
656	// to a customer in the subscription. SKU names are subject to change at
657	// Google's discretion. For products and SKUs available in this version
658	// of the API, see Product and SKU IDs.
659	SkuName string `json:"skuName,omitempty"`
660
661	// Status: This is an optional property.
662	Status string `json:"status,omitempty"`
663
664	// SubscriptionId: The `subscriptionId` is the subscription identifier
665	// and is unique for each customer. This is a required property. Since a
666	// `subscriptionId` changes when a subscription is updated, we recommend
667	// not using this ID as a key for persistent data. Use the
668	// `subscriptionId` as described in retrieve all reseller subscriptions.
669	SubscriptionId string `json:"subscriptionId,omitempty"`
670
671	// SuspensionReasons: Read-only field containing an enumerable of all
672	// the current suspension reasons for a subscription. It is possible for
673	// a subscription to have many concurrent, overlapping suspension
674	// reasons. A subscription's `STATUS` is `SUSPENDED` until all pending
675	// suspensions are removed. Possible options include: -
676	// `PENDING_TOS_ACCEPTANCE` - The customer has not logged in and
677	// accepted the G Suite Resold Terms of Services. -
678	// `RENEWAL_WITH_TYPE_CANCEL` - The customer's commitment ended and
679	// their service was cancelled at the end of their term. -
680	// `RESELLER_INITIATED` - A manual suspension invoked by a Reseller. -
681	// `TRIAL_ENDED` - The customer's trial expired without a plan selected.
682	// - `OTHER` - The customer is suspended for an internal Google reason
683	// (e.g. abuse or otherwise).
684	SuspensionReasons []string `json:"suspensionReasons,omitempty"`
685
686	// TransferInfo: Read-only transfer related information for the
687	// subscription. For more information, see retrieve transferable
688	// subscriptions for a customer.
689	TransferInfo *SubscriptionTransferInfo `json:"transferInfo,omitempty"`
690
691	// TrialSettings: The G Suite annual commitment and flexible payment
692	// plans can be in a 30-day free trial. For more information, see the
693	// API concepts.
694	TrialSettings *SubscriptionTrialSettings `json:"trialSettings,omitempty"`
695
696	// ServerResponse contains the HTTP response code and headers from the
697	// server.
698	googleapi.ServerResponse `json:"-"`
699
700	// ForceSendFields is a list of field names (e.g. "BillingMethod") to
701	// unconditionally include in API requests. By default, fields with
702	// empty or default values are omitted from API requests. However, any
703	// non-pointer, non-interface field appearing in ForceSendFields will be
704	// sent to the server regardless of whether the field is empty or not.
705	// This may be used to include empty fields in Patch requests.
706	ForceSendFields []string `json:"-"`
707
708	// NullFields is a list of field names (e.g. "BillingMethod") to include
709	// in API requests with the JSON null value. By default, fields with
710	// empty values are omitted from API requests. However, any field with
711	// an empty value appearing in NullFields will be sent to the server as
712	// null. It is an error if a field in this list has a non-empty value.
713	// This may be used to include null fields in Patch requests.
714	NullFields []string `json:"-"`
715}
716
717func (s *Subscription) MarshalJSON() ([]byte, error) {
718	type NoMethod Subscription
719	raw := NoMethod(*s)
720	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
721}
722
723// SubscriptionPlan: The `plan` property is required. In this version of
724// the API, the G Suite plans are the flexible plan, annual commitment
725// plan, and the 30-day free trial plan. For more information about the
726// API"s payment plans, see the API concepts.
727type SubscriptionPlan struct {
728	// CommitmentInterval: In this version of the API, annual commitment
729	// plan's interval is one year. *Note: *When `billingMethod` value is
730	// `OFFLINE`, the subscription property object `plan.commitmentInterval`
731	// is omitted in all API responses.
732	CommitmentInterval *SubscriptionPlanCommitmentInterval `json:"commitmentInterval,omitempty"`
733
734	// IsCommitmentPlan: The `isCommitmentPlan` property's boolean value
735	// identifies the plan as an annual commitment plan: - `true` — The
736	// subscription's plan is an annual commitment plan. - `false` — The
737	// plan is not an annual commitment plan.
738	IsCommitmentPlan bool `json:"isCommitmentPlan,omitempty"`
739
740	// PlanName: The `planName` property is required. This is the name of
741	// the subscription's plan. For more information about the Google
742	// payment plans, see the API concepts. Possible values are: -
743	// `ANNUAL_MONTHLY_PAY` — The annual commitment plan with monthly
744	// payments. *Caution: *`ANNUAL_MONTHLY_PAY` is returned as `ANNUAL` in
745	// all API responses. - `ANNUAL_YEARLY_PAY` — The annual commitment
746	// plan with yearly payments - `FLEXIBLE` — The flexible plan -
747	// `TRIAL` — The 30-day free trial plan. A subscription in trial will
748	// be suspended after the 30th free day if no payment plan is assigned.
749	// Calling `changePlan` will assign a payment plan to a trial but will
750	// not activate the plan. A trial will automatically begin its assigned
751	// payment plan after its 30th free day or immediately after calling
752	// `startPaidService`. - `FREE` — The free plan is exclusive to the
753	// Cloud Identity SKU and does not incur any billing.
754	PlanName string `json:"planName,omitempty"`
755
756	// ForceSendFields is a list of field names (e.g. "CommitmentInterval")
757	// to unconditionally include in API requests. By default, fields with
758	// empty or default values are omitted from API requests. However, any
759	// non-pointer, non-interface field appearing in ForceSendFields will be
760	// sent to the server regardless of whether the field is empty or not.
761	// This may be used to include empty fields in Patch requests.
762	ForceSendFields []string `json:"-"`
763
764	// NullFields is a list of field names (e.g. "CommitmentInterval") to
765	// include in API requests with the JSON null value. By default, fields
766	// with empty values are omitted from API requests. However, any field
767	// with an empty value appearing in NullFields will be sent to the
768	// server as null. It is an error if a field in this list has a
769	// non-empty value. This may be used to include null fields in Patch
770	// requests.
771	NullFields []string `json:"-"`
772}
773
774func (s *SubscriptionPlan) MarshalJSON() ([]byte, error) {
775	type NoMethod SubscriptionPlan
776	raw := NoMethod(*s)
777	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
778}
779
780// SubscriptionPlanCommitmentInterval: In this version of the API,
781// annual commitment plan's interval is one year. *Note: *When
782// `billingMethod` value is `OFFLINE`, the subscription property object
783// `plan.commitmentInterval` is omitted in all API responses.
784type SubscriptionPlanCommitmentInterval struct {
785	// EndTime: An annual commitment plan's interval's `endTime` in
786	// milliseconds using the UNIX Epoch format. See an example Epoch
787	// converter.
788	EndTime int64 `json:"endTime,omitempty,string"`
789
790	// StartTime: An annual commitment plan's interval's `startTime` in
791	// milliseconds using UNIX Epoch format. See an example Epoch converter.
792	StartTime int64 `json:"startTime,omitempty,string"`
793
794	// ForceSendFields is a list of field names (e.g. "EndTime") to
795	// unconditionally include in API requests. By default, fields with
796	// empty or default values are omitted from API requests. However, any
797	// non-pointer, non-interface field appearing in ForceSendFields will be
798	// sent to the server regardless of whether the field is empty or not.
799	// This may be used to include empty fields in Patch requests.
800	ForceSendFields []string `json:"-"`
801
802	// NullFields is a list of field names (e.g. "EndTime") to include in
803	// API requests with the JSON null value. By default, fields with empty
804	// values are omitted from API requests. However, any field with an
805	// empty value appearing in NullFields will be sent to the server as
806	// null. It is an error if a field in this list has a non-empty value.
807	// This may be used to include null fields in Patch requests.
808	NullFields []string `json:"-"`
809}
810
811func (s *SubscriptionPlanCommitmentInterval) MarshalJSON() ([]byte, error) {
812	type NoMethod SubscriptionPlanCommitmentInterval
813	raw := NoMethod(*s)
814	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
815}
816
817// SubscriptionTransferInfo: Read-only transfer related information for
818// the subscription. For more information, see retrieve transferable
819// subscriptions for a customer.
820type SubscriptionTransferInfo struct {
821	// CurrentLegacySkuId: The `skuId` of the current resold subscription.
822	// This is populated only when the customer has a subscription with a
823	// legacy SKU and the subscription resource is populated with the
824	// `skuId` of the SKU recommended for the transfer.
825	CurrentLegacySkuId string `json:"currentLegacySkuId,omitempty"`
826
827	// MinimumTransferableSeats: When inserting a subscription, this is the
828	// minimum number of seats listed in the transfer order for this
829	// product. For example, if the customer has 20 users, the reseller
830	// cannot place a transfer order of 15 seats. The minimum is 20 seats.
831	MinimumTransferableSeats int64 `json:"minimumTransferableSeats,omitempty"`
832
833	// TransferabilityExpirationTime: The time when transfer token or intent
834	// to transfer will expire. The time is in milliseconds using UNIX Epoch
835	// format.
836	TransferabilityExpirationTime int64 `json:"transferabilityExpirationTime,omitempty,string"`
837
838	// ForceSendFields is a list of field names (e.g. "CurrentLegacySkuId")
839	// to unconditionally include in API requests. By default, fields with
840	// empty or default values are omitted from API requests. However, any
841	// non-pointer, non-interface field appearing in ForceSendFields will be
842	// sent to the server regardless of whether the field is empty or not.
843	// This may be used to include empty fields in Patch requests.
844	ForceSendFields []string `json:"-"`
845
846	// NullFields is a list of field names (e.g. "CurrentLegacySkuId") to
847	// include in API requests with the JSON null value. By default, fields
848	// with empty values are omitted from API requests. However, any field
849	// with an empty value appearing in NullFields will be sent to the
850	// server as null. It is an error if a field in this list has a
851	// non-empty value. This may be used to include null fields in Patch
852	// requests.
853	NullFields []string `json:"-"`
854}
855
856func (s *SubscriptionTransferInfo) MarshalJSON() ([]byte, error) {
857	type NoMethod SubscriptionTransferInfo
858	raw := NoMethod(*s)
859	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
860}
861
862// SubscriptionTrialSettings: The G Suite annual commitment and flexible
863// payment plans can be in a 30-day free trial. For more information,
864// see the API concepts.
865type SubscriptionTrialSettings struct {
866	// IsInTrial: Determines if a subscription's plan is in a 30-day free
867	// trial or not: - `true` — The plan is in trial. - `false` — The
868	// plan is not in trial.
869	IsInTrial bool `json:"isInTrial,omitempty"`
870
871	// TrialEndTime: Date when the trial ends. The value is in milliseconds
872	// using the UNIX Epoch format. See an example Epoch converter.
873	TrialEndTime int64 `json:"trialEndTime,omitempty,string"`
874
875	// ForceSendFields is a list of field names (e.g. "IsInTrial") to
876	// unconditionally include in API requests. By default, fields with
877	// empty or default values are omitted from API requests. However, any
878	// non-pointer, non-interface field appearing in ForceSendFields will be
879	// sent to the server regardless of whether the field is empty or not.
880	// This may be used to include empty fields in Patch requests.
881	ForceSendFields []string `json:"-"`
882
883	// NullFields is a list of field names (e.g. "IsInTrial") to include in
884	// API requests with the JSON null value. By default, fields with empty
885	// values are omitted from API requests. However, any field with an
886	// empty value appearing in NullFields will be sent to the server as
887	// null. It is an error if a field in this list has a non-empty value.
888	// This may be used to include null fields in Patch requests.
889	NullFields []string `json:"-"`
890}
891
892func (s *SubscriptionTrialSettings) MarshalJSON() ([]byte, error) {
893	type NoMethod SubscriptionTrialSettings
894	raw := NoMethod(*s)
895	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
896}
897
898// Subscriptions: A subscription manages the relationship of a Google
899// customer's payment plan with a product's SKU, user licenses, 30-day
900// free trial status, and renewal options. A primary role of a reseller
901// is to manage the Google customer's subscriptions.
902type Subscriptions struct {
903	// Kind: Identifies the resource as a collection of subscriptions.
904	// Value: reseller#subscriptions
905	Kind string `json:"kind,omitempty"`
906
907	// NextPageToken: The continuation token, used to page through large
908	// result sets. Provide this value in a subsequent request to return the
909	// next page of results.
910	NextPageToken string `json:"nextPageToken,omitempty"`
911
912	// Subscriptions: The subscriptions in this page of results.
913	Subscriptions []*Subscription `json:"subscriptions,omitempty"`
914
915	// ServerResponse contains the HTTP response code and headers from the
916	// server.
917	googleapi.ServerResponse `json:"-"`
918
919	// ForceSendFields is a list of field names (e.g. "Kind") to
920	// unconditionally include in API requests. By default, fields with
921	// empty or default values are omitted from API requests. However, any
922	// non-pointer, non-interface field appearing in ForceSendFields will be
923	// sent to the server regardless of whether the field is empty or not.
924	// This may be used to include empty fields in Patch requests.
925	ForceSendFields []string `json:"-"`
926
927	// NullFields is a list of field names (e.g. "Kind") to include in API
928	// requests with the JSON null value. By default, fields with empty
929	// values are omitted from API requests. However, any field with an
930	// empty value appearing in NullFields will be sent to the server as
931	// null. It is an error if a field in this list has a non-empty value.
932	// This may be used to include null fields in Patch requests.
933	NullFields []string `json:"-"`
934}
935
936func (s *Subscriptions) MarshalJSON() ([]byte, error) {
937	type NoMethod Subscriptions
938	raw := NoMethod(*s)
939	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
940}
941
942// method id "reseller.customers.get":
943
944type CustomersGetCall struct {
945	s            *Service
946	customerId   string
947	urlParams_   gensupport.URLParams
948	ifNoneMatch_ string
949	ctx_         context.Context
950	header_      http.Header
951}
952
953// Get: Gets a customer account. Use this operation to see a customer
954// account already in your reseller management, or to see the minimal
955// account information for an existing customer that you do not manage.
956// For more information about the API response for existing customers,
957// see retrieving a customer account
958// (/admin-sdk/reseller/v1/how-tos/manage_customers#get_customer).
959//
960// - customerId: Either the customer's primary domain name or the
961//   customer's unique identifier. If using the domain name, we do not
962//   recommend using a `customerId` as a key for persistent data. If the
963//   domain name for a `customerId` is changed, the Google system
964//   automatically updates.
965func (r *CustomersService) Get(customerId string) *CustomersGetCall {
966	c := &CustomersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
967	c.customerId = customerId
968	return c
969}
970
971// Fields allows partial responses to be retrieved. See
972// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
973// for more information.
974func (c *CustomersGetCall) Fields(s ...googleapi.Field) *CustomersGetCall {
975	c.urlParams_.Set("fields", googleapi.CombineFields(s))
976	return c
977}
978
979// IfNoneMatch sets the optional parameter which makes the operation
980// fail if the object's ETag matches the given value. This is useful for
981// getting updates only after the object has changed since the last
982// request. Use googleapi.IsNotModified to check whether the response
983// error from Do is the result of In-None-Match.
984func (c *CustomersGetCall) IfNoneMatch(entityTag string) *CustomersGetCall {
985	c.ifNoneMatch_ = entityTag
986	return c
987}
988
989// Context sets the context to be used in this call's Do method. Any
990// pending HTTP request will be aborted if the provided context is
991// canceled.
992func (c *CustomersGetCall) Context(ctx context.Context) *CustomersGetCall {
993	c.ctx_ = ctx
994	return c
995}
996
997// Header returns an http.Header that can be modified by the caller to
998// add HTTP headers to the request.
999func (c *CustomersGetCall) Header() http.Header {
1000	if c.header_ == nil {
1001		c.header_ = make(http.Header)
1002	}
1003	return c.header_
1004}
1005
1006func (c *CustomersGetCall) doRequest(alt string) (*http.Response, error) {
1007	reqHeaders := make(http.Header)
1008	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915")
1009	for k, v := range c.header_ {
1010		reqHeaders[k] = v
1011	}
1012	reqHeaders.Set("User-Agent", c.s.userAgent())
1013	if c.ifNoneMatch_ != "" {
1014		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1015	}
1016	var body io.Reader = nil
1017	c.urlParams_.Set("alt", alt)
1018	c.urlParams_.Set("prettyPrint", "false")
1019	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}")
1020	urls += "?" + c.urlParams_.Encode()
1021	req, err := http.NewRequest("GET", urls, body)
1022	if err != nil {
1023		return nil, err
1024	}
1025	req.Header = reqHeaders
1026	googleapi.Expand(req.URL, map[string]string{
1027		"customerId": c.customerId,
1028	})
1029	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1030}
1031
1032// Do executes the "reseller.customers.get" call.
1033// Exactly one of *Customer or error will be non-nil. Any non-2xx status
1034// code is an error. Response headers are in either
1035// *Customer.ServerResponse.Header or (if a response was returned at
1036// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
1037// to check whether the returned error was because
1038// http.StatusNotModified was returned.
1039func (c *CustomersGetCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
1040	gensupport.SetOptions(c.urlParams_, opts...)
1041	res, err := c.doRequest("json")
1042	if res != nil && res.StatusCode == http.StatusNotModified {
1043		if res.Body != nil {
1044			res.Body.Close()
1045		}
1046		return nil, &googleapi.Error{
1047			Code:   res.StatusCode,
1048			Header: res.Header,
1049		}
1050	}
1051	if err != nil {
1052		return nil, err
1053	}
1054	defer googleapi.CloseBody(res)
1055	if err := googleapi.CheckResponse(res); err != nil {
1056		return nil, err
1057	}
1058	ret := &Customer{
1059		ServerResponse: googleapi.ServerResponse{
1060			Header:         res.Header,
1061			HTTPStatusCode: res.StatusCode,
1062		},
1063	}
1064	target := &ret
1065	if err := gensupport.DecodeResponse(target, res); err != nil {
1066		return nil, err
1067	}
1068	return ret, nil
1069	// {
1070	//   "description": "Gets a customer account. Use this operation to see a customer account already in your reseller management, or to see the minimal account information for an existing customer that you do not manage. For more information about the API response for existing customers, see [retrieving a customer account](/admin-sdk/reseller/v1/how-tos/manage_customers#get_customer).",
1071	//   "flatPath": "apps/reseller/v1/customers/{customerId}",
1072	//   "httpMethod": "GET",
1073	//   "id": "reseller.customers.get",
1074	//   "parameterOrder": [
1075	//     "customerId"
1076	//   ],
1077	//   "parameters": {
1078	//     "customerId": {
1079	//       "description": "Either the customer's primary domain name or the customer's unique identifier. If using the domain name, we do not recommend using a `customerId` as a key for persistent data. If the domain name for a `customerId` is changed, the Google system automatically updates.",
1080	//       "location": "path",
1081	//       "required": true,
1082	//       "type": "string"
1083	//     }
1084	//   },
1085	//   "path": "apps/reseller/v1/customers/{customerId}",
1086	//   "response": {
1087	//     "$ref": "Customer"
1088	//   },
1089	//   "scopes": [
1090	//     "https://www.googleapis.com/auth/apps.order",
1091	//     "https://www.googleapis.com/auth/apps.order.readonly"
1092	//   ]
1093	// }
1094
1095}
1096
1097// method id "reseller.customers.insert":
1098
1099type CustomersInsertCall struct {
1100	s          *Service
1101	customer   *Customer
1102	urlParams_ gensupport.URLParams
1103	ctx_       context.Context
1104	header_    http.Header
1105}
1106
1107// Insert: Orders a new customer's account. Before ordering a new
1108// customer account, establish whether the customer account already
1109// exists using the `customers.get`
1110// (/admin-sdk/reseller/v1/reference/customers/get) If the customer
1111// account exists as a direct Google account or as a resold customer
1112// account from another reseller, use the `customerAuthToken\` as
1113// described in order a resold account for an existing customer
1114// (/admin-sdk/reseller/v1/how-tos/manage_customers#create_existing_custo
1115// mer). For more information about ordering a new customer account, see
1116// order a new customer account
1117// (/admin-sdk/reseller/v1/how-tos/manage_customers#create_customer).
1118// After creating a new customer account, you must provision a user as
1119// an administrator. The customer's administrator is required to sign in
1120// to the Admin console and sign the G Suite via Reseller agreement to
1121// activate the account. Resellers are prohibited from signing the G
1122// Suite via Reseller agreement on the customer's behalf. For more
1123// information, see order a new customer account
1124// (/admin-sdk/reseller/v1/how-tos/manage_customers#tos).
1125func (r *CustomersService) Insert(customer *Customer) *CustomersInsertCall {
1126	c := &CustomersInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1127	c.customer = customer
1128	return c
1129}
1130
1131// CustomerAuthToken sets the optional parameter "customerAuthToken":
1132// The `customerAuthToken` query string is required when creating a
1133// resold account that transfers a direct customer's subscription or
1134// transfers another reseller customer's subscription to your reseller
1135// management. This is a hexadecimal authentication token needed to
1136// complete the subscription transfer. For more information, see the
1137// administrator help center.
1138func (c *CustomersInsertCall) CustomerAuthToken(customerAuthToken string) *CustomersInsertCall {
1139	c.urlParams_.Set("customerAuthToken", customerAuthToken)
1140	return c
1141}
1142
1143// Fields allows partial responses to be retrieved. See
1144// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1145// for more information.
1146func (c *CustomersInsertCall) Fields(s ...googleapi.Field) *CustomersInsertCall {
1147	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1148	return c
1149}
1150
1151// Context sets the context to be used in this call's Do method. Any
1152// pending HTTP request will be aborted if the provided context is
1153// canceled.
1154func (c *CustomersInsertCall) Context(ctx context.Context) *CustomersInsertCall {
1155	c.ctx_ = ctx
1156	return c
1157}
1158
1159// Header returns an http.Header that can be modified by the caller to
1160// add HTTP headers to the request.
1161func (c *CustomersInsertCall) Header() http.Header {
1162	if c.header_ == nil {
1163		c.header_ = make(http.Header)
1164	}
1165	return c.header_
1166}
1167
1168func (c *CustomersInsertCall) doRequest(alt string) (*http.Response, error) {
1169	reqHeaders := make(http.Header)
1170	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915")
1171	for k, v := range c.header_ {
1172		reqHeaders[k] = v
1173	}
1174	reqHeaders.Set("User-Agent", c.s.userAgent())
1175	var body io.Reader = nil
1176	body, err := googleapi.WithoutDataWrapper.JSONReader(c.customer)
1177	if err != nil {
1178		return nil, err
1179	}
1180	reqHeaders.Set("Content-Type", "application/json")
1181	c.urlParams_.Set("alt", alt)
1182	c.urlParams_.Set("prettyPrint", "false")
1183	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers")
1184	urls += "?" + c.urlParams_.Encode()
1185	req, err := http.NewRequest("POST", urls, body)
1186	if err != nil {
1187		return nil, err
1188	}
1189	req.Header = reqHeaders
1190	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1191}
1192
1193// Do executes the "reseller.customers.insert" call.
1194// Exactly one of *Customer or error will be non-nil. Any non-2xx status
1195// code is an error. Response headers are in either
1196// *Customer.ServerResponse.Header or (if a response was returned at
1197// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
1198// to check whether the returned error was because
1199// http.StatusNotModified was returned.
1200func (c *CustomersInsertCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
1201	gensupport.SetOptions(c.urlParams_, opts...)
1202	res, err := c.doRequest("json")
1203	if res != nil && res.StatusCode == http.StatusNotModified {
1204		if res.Body != nil {
1205			res.Body.Close()
1206		}
1207		return nil, &googleapi.Error{
1208			Code:   res.StatusCode,
1209			Header: res.Header,
1210		}
1211	}
1212	if err != nil {
1213		return nil, err
1214	}
1215	defer googleapi.CloseBody(res)
1216	if err := googleapi.CheckResponse(res); err != nil {
1217		return nil, err
1218	}
1219	ret := &Customer{
1220		ServerResponse: googleapi.ServerResponse{
1221			Header:         res.Header,
1222			HTTPStatusCode: res.StatusCode,
1223		},
1224	}
1225	target := &ret
1226	if err := gensupport.DecodeResponse(target, res); err != nil {
1227		return nil, err
1228	}
1229	return ret, nil
1230	// {
1231	//   "description": "Orders a new customer's account. Before ordering a new customer account, establish whether the customer account already exists using the [`customers.get`](/admin-sdk/reseller/v1/reference/customers/get) If the customer account exists as a direct Google account or as a resold customer account from another reseller, use the `customerAuthToken\\` as described in [order a resold account for an existing customer](/admin-sdk/reseller/v1/how-tos/manage_customers#create_existing_customer). For more information about ordering a new customer account, see [order a new customer account](/admin-sdk/reseller/v1/how-tos/manage_customers#create_customer). After creating a new customer account, you must provision a user as an administrator. The customer's administrator is required to sign in to the Admin console and sign the G Suite via Reseller agreement to activate the account. Resellers are prohibited from signing the G Suite via Reseller agreement on the customer's behalf. For more information, see [order a new customer account](/admin-sdk/reseller/v1/how-tos/manage_customers#tos).",
1232	//   "flatPath": "apps/reseller/v1/customers",
1233	//   "httpMethod": "POST",
1234	//   "id": "reseller.customers.insert",
1235	//   "parameterOrder": [],
1236	//   "parameters": {
1237	//     "customerAuthToken": {
1238	//       "description": "The `customerAuthToken` query string is required when creating a resold account that transfers a direct customer's subscription or transfers another reseller customer's subscription to your reseller management. This is a hexadecimal authentication token needed to complete the subscription transfer. For more information, see the administrator help center.",
1239	//       "location": "query",
1240	//       "type": "string"
1241	//     }
1242	//   },
1243	//   "path": "apps/reseller/v1/customers",
1244	//   "request": {
1245	//     "$ref": "Customer"
1246	//   },
1247	//   "response": {
1248	//     "$ref": "Customer"
1249	//   },
1250	//   "scopes": [
1251	//     "https://www.googleapis.com/auth/apps.order"
1252	//   ]
1253	// }
1254
1255}
1256
1257// method id "reseller.customers.patch":
1258
1259type CustomersPatchCall struct {
1260	s          *Service
1261	customerId string
1262	customer   *Customer
1263	urlParams_ gensupport.URLParams
1264	ctx_       context.Context
1265	header_    http.Header
1266}
1267
1268// Patch: Updates a customer account's settings. This method supports
1269// patch semantics. You cannot update `customerType` via the Reseller
1270// API, but a "team" customer can verify their domain and become
1271// `customerType = "domain". For more information, see Verify your
1272// domain to unlock Essentials features
1273// (https://support.google.com/a/answer/9122284).
1274//
1275// - customerId: Either the customer's primary domain name or the
1276//   customer's unique identifier. If using the domain name, we do not
1277//   recommend using a `customerId` as a key for persistent data. If the
1278//   domain name for a `customerId` is changed, the Google system
1279//   automatically updates.
1280func (r *CustomersService) Patch(customerId string, customer *Customer) *CustomersPatchCall {
1281	c := &CustomersPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1282	c.customerId = customerId
1283	c.customer = customer
1284	return c
1285}
1286
1287// Fields allows partial responses to be retrieved. See
1288// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1289// for more information.
1290func (c *CustomersPatchCall) Fields(s ...googleapi.Field) *CustomersPatchCall {
1291	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1292	return c
1293}
1294
1295// Context sets the context to be used in this call's Do method. Any
1296// pending HTTP request will be aborted if the provided context is
1297// canceled.
1298func (c *CustomersPatchCall) Context(ctx context.Context) *CustomersPatchCall {
1299	c.ctx_ = ctx
1300	return c
1301}
1302
1303// Header returns an http.Header that can be modified by the caller to
1304// add HTTP headers to the request.
1305func (c *CustomersPatchCall) Header() http.Header {
1306	if c.header_ == nil {
1307		c.header_ = make(http.Header)
1308	}
1309	return c.header_
1310}
1311
1312func (c *CustomersPatchCall) doRequest(alt string) (*http.Response, error) {
1313	reqHeaders := make(http.Header)
1314	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915")
1315	for k, v := range c.header_ {
1316		reqHeaders[k] = v
1317	}
1318	reqHeaders.Set("User-Agent", c.s.userAgent())
1319	var body io.Reader = nil
1320	body, err := googleapi.WithoutDataWrapper.JSONReader(c.customer)
1321	if err != nil {
1322		return nil, err
1323	}
1324	reqHeaders.Set("Content-Type", "application/json")
1325	c.urlParams_.Set("alt", alt)
1326	c.urlParams_.Set("prettyPrint", "false")
1327	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}")
1328	urls += "?" + c.urlParams_.Encode()
1329	req, err := http.NewRequest("PATCH", urls, body)
1330	if err != nil {
1331		return nil, err
1332	}
1333	req.Header = reqHeaders
1334	googleapi.Expand(req.URL, map[string]string{
1335		"customerId": c.customerId,
1336	})
1337	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1338}
1339
1340// Do executes the "reseller.customers.patch" call.
1341// Exactly one of *Customer or error will be non-nil. Any non-2xx status
1342// code is an error. Response headers are in either
1343// *Customer.ServerResponse.Header or (if a response was returned at
1344// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
1345// to check whether the returned error was because
1346// http.StatusNotModified was returned.
1347func (c *CustomersPatchCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
1348	gensupport.SetOptions(c.urlParams_, opts...)
1349	res, err := c.doRequest("json")
1350	if res != nil && res.StatusCode == http.StatusNotModified {
1351		if res.Body != nil {
1352			res.Body.Close()
1353		}
1354		return nil, &googleapi.Error{
1355			Code:   res.StatusCode,
1356			Header: res.Header,
1357		}
1358	}
1359	if err != nil {
1360		return nil, err
1361	}
1362	defer googleapi.CloseBody(res)
1363	if err := googleapi.CheckResponse(res); err != nil {
1364		return nil, err
1365	}
1366	ret := &Customer{
1367		ServerResponse: googleapi.ServerResponse{
1368			Header:         res.Header,
1369			HTTPStatusCode: res.StatusCode,
1370		},
1371	}
1372	target := &ret
1373	if err := gensupport.DecodeResponse(target, res); err != nil {
1374		return nil, err
1375	}
1376	return ret, nil
1377	// {
1378	//   "description": "Updates a customer account's settings. This method supports patch semantics. You cannot update `customerType` via the Reseller API, but a `\"team\"` customer can verify their domain and become `customerType = \"domain\"`. For more information, see [Verify your domain to unlock Essentials features](https://support.google.com/a/answer/9122284).",
1379	//   "flatPath": "apps/reseller/v1/customers/{customerId}",
1380	//   "httpMethod": "PATCH",
1381	//   "id": "reseller.customers.patch",
1382	//   "parameterOrder": [
1383	//     "customerId"
1384	//   ],
1385	//   "parameters": {
1386	//     "customerId": {
1387	//       "description": "Either the customer's primary domain name or the customer's unique identifier. If using the domain name, we do not recommend using a `customerId` as a key for persistent data. If the domain name for a `customerId` is changed, the Google system automatically updates.",
1388	//       "location": "path",
1389	//       "required": true,
1390	//       "type": "string"
1391	//     }
1392	//   },
1393	//   "path": "apps/reseller/v1/customers/{customerId}",
1394	//   "request": {
1395	//     "$ref": "Customer"
1396	//   },
1397	//   "response": {
1398	//     "$ref": "Customer"
1399	//   },
1400	//   "scopes": [
1401	//     "https://www.googleapis.com/auth/apps.order"
1402	//   ]
1403	// }
1404
1405}
1406
1407// method id "reseller.customers.update":
1408
1409type CustomersUpdateCall struct {
1410	s          *Service
1411	customerId string
1412	customer   *Customer
1413	urlParams_ gensupport.URLParams
1414	ctx_       context.Context
1415	header_    http.Header
1416}
1417
1418// Update: Updates a customer account's settings. You cannot update
1419// `customerType` via the Reseller API, but a "team" customer can
1420// verify their domain and become `customerType = "domain". For more
1421// information, see update a customer's settings
1422// (/admin-sdk/reseller/v1/how-tos/manage_customers#update_customer).
1423//
1424// - customerId: Either the customer's primary domain name or the
1425//   customer's unique identifier. If using the domain name, we do not
1426//   recommend using a `customerId` as a key for persistent data. If the
1427//   domain name for a `customerId` is changed, the Google system
1428//   automatically updates.
1429func (r *CustomersService) Update(customerId string, customer *Customer) *CustomersUpdateCall {
1430	c := &CustomersUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1431	c.customerId = customerId
1432	c.customer = customer
1433	return c
1434}
1435
1436// Fields allows partial responses to be retrieved. See
1437// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1438// for more information.
1439func (c *CustomersUpdateCall) Fields(s ...googleapi.Field) *CustomersUpdateCall {
1440	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1441	return c
1442}
1443
1444// Context sets the context to be used in this call's Do method. Any
1445// pending HTTP request will be aborted if the provided context is
1446// canceled.
1447func (c *CustomersUpdateCall) Context(ctx context.Context) *CustomersUpdateCall {
1448	c.ctx_ = ctx
1449	return c
1450}
1451
1452// Header returns an http.Header that can be modified by the caller to
1453// add HTTP headers to the request.
1454func (c *CustomersUpdateCall) Header() http.Header {
1455	if c.header_ == nil {
1456		c.header_ = make(http.Header)
1457	}
1458	return c.header_
1459}
1460
1461func (c *CustomersUpdateCall) doRequest(alt string) (*http.Response, error) {
1462	reqHeaders := make(http.Header)
1463	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915")
1464	for k, v := range c.header_ {
1465		reqHeaders[k] = v
1466	}
1467	reqHeaders.Set("User-Agent", c.s.userAgent())
1468	var body io.Reader = nil
1469	body, err := googleapi.WithoutDataWrapper.JSONReader(c.customer)
1470	if err != nil {
1471		return nil, err
1472	}
1473	reqHeaders.Set("Content-Type", "application/json")
1474	c.urlParams_.Set("alt", alt)
1475	c.urlParams_.Set("prettyPrint", "false")
1476	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}")
1477	urls += "?" + c.urlParams_.Encode()
1478	req, err := http.NewRequest("PUT", urls, body)
1479	if err != nil {
1480		return nil, err
1481	}
1482	req.Header = reqHeaders
1483	googleapi.Expand(req.URL, map[string]string{
1484		"customerId": c.customerId,
1485	})
1486	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1487}
1488
1489// Do executes the "reseller.customers.update" call.
1490// Exactly one of *Customer or error will be non-nil. Any non-2xx status
1491// code is an error. Response headers are in either
1492// *Customer.ServerResponse.Header or (if a response was returned at
1493// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
1494// to check whether the returned error was because
1495// http.StatusNotModified was returned.
1496func (c *CustomersUpdateCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
1497	gensupport.SetOptions(c.urlParams_, opts...)
1498	res, err := c.doRequest("json")
1499	if res != nil && res.StatusCode == http.StatusNotModified {
1500		if res.Body != nil {
1501			res.Body.Close()
1502		}
1503		return nil, &googleapi.Error{
1504			Code:   res.StatusCode,
1505			Header: res.Header,
1506		}
1507	}
1508	if err != nil {
1509		return nil, err
1510	}
1511	defer googleapi.CloseBody(res)
1512	if err := googleapi.CheckResponse(res); err != nil {
1513		return nil, err
1514	}
1515	ret := &Customer{
1516		ServerResponse: googleapi.ServerResponse{
1517			Header:         res.Header,
1518			HTTPStatusCode: res.StatusCode,
1519		},
1520	}
1521	target := &ret
1522	if err := gensupport.DecodeResponse(target, res); err != nil {
1523		return nil, err
1524	}
1525	return ret, nil
1526	// {
1527	//   "description": "Updates a customer account's settings. You cannot update `customerType` via the Reseller API, but a `\"team\"` customer can verify their domain and become `customerType = \"domain\"`. For more information, see [update a customer's settings](/admin-sdk/reseller/v1/how-tos/manage_customers#update_customer).",
1528	//   "flatPath": "apps/reseller/v1/customers/{customerId}",
1529	//   "httpMethod": "PUT",
1530	//   "id": "reseller.customers.update",
1531	//   "parameterOrder": [
1532	//     "customerId"
1533	//   ],
1534	//   "parameters": {
1535	//     "customerId": {
1536	//       "description": "Either the customer's primary domain name or the customer's unique identifier. If using the domain name, we do not recommend using a `customerId` as a key for persistent data. If the domain name for a `customerId` is changed, the Google system automatically updates.",
1537	//       "location": "path",
1538	//       "required": true,
1539	//       "type": "string"
1540	//     }
1541	//   },
1542	//   "path": "apps/reseller/v1/customers/{customerId}",
1543	//   "request": {
1544	//     "$ref": "Customer"
1545	//   },
1546	//   "response": {
1547	//     "$ref": "Customer"
1548	//   },
1549	//   "scopes": [
1550	//     "https://www.googleapis.com/auth/apps.order"
1551	//   ]
1552	// }
1553
1554}
1555
1556// method id "reseller.resellernotify.getwatchdetails":
1557
1558type ResellernotifyGetwatchdetailsCall struct {
1559	s            *Service
1560	urlParams_   gensupport.URLParams
1561	ifNoneMatch_ string
1562	ctx_         context.Context
1563	header_      http.Header
1564}
1565
1566// Getwatchdetails: Returns all the details of the watch corresponding
1567// to the reseller.
1568func (r *ResellernotifyService) Getwatchdetails() *ResellernotifyGetwatchdetailsCall {
1569	c := &ResellernotifyGetwatchdetailsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1570	return c
1571}
1572
1573// Fields allows partial responses to be retrieved. See
1574// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1575// for more information.
1576func (c *ResellernotifyGetwatchdetailsCall) Fields(s ...googleapi.Field) *ResellernotifyGetwatchdetailsCall {
1577	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1578	return c
1579}
1580
1581// IfNoneMatch sets the optional parameter which makes the operation
1582// fail if the object's ETag matches the given value. This is useful for
1583// getting updates only after the object has changed since the last
1584// request. Use googleapi.IsNotModified to check whether the response
1585// error from Do is the result of In-None-Match.
1586func (c *ResellernotifyGetwatchdetailsCall) IfNoneMatch(entityTag string) *ResellernotifyGetwatchdetailsCall {
1587	c.ifNoneMatch_ = entityTag
1588	return c
1589}
1590
1591// Context sets the context to be used in this call's Do method. Any
1592// pending HTTP request will be aborted if the provided context is
1593// canceled.
1594func (c *ResellernotifyGetwatchdetailsCall) Context(ctx context.Context) *ResellernotifyGetwatchdetailsCall {
1595	c.ctx_ = ctx
1596	return c
1597}
1598
1599// Header returns an http.Header that can be modified by the caller to
1600// add HTTP headers to the request.
1601func (c *ResellernotifyGetwatchdetailsCall) Header() http.Header {
1602	if c.header_ == nil {
1603		c.header_ = make(http.Header)
1604	}
1605	return c.header_
1606}
1607
1608func (c *ResellernotifyGetwatchdetailsCall) doRequest(alt string) (*http.Response, error) {
1609	reqHeaders := make(http.Header)
1610	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915")
1611	for k, v := range c.header_ {
1612		reqHeaders[k] = v
1613	}
1614	reqHeaders.Set("User-Agent", c.s.userAgent())
1615	if c.ifNoneMatch_ != "" {
1616		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1617	}
1618	var body io.Reader = nil
1619	c.urlParams_.Set("alt", alt)
1620	c.urlParams_.Set("prettyPrint", "false")
1621	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/resellernotify/getwatchdetails")
1622	urls += "?" + c.urlParams_.Encode()
1623	req, err := http.NewRequest("GET", urls, body)
1624	if err != nil {
1625		return nil, err
1626	}
1627	req.Header = reqHeaders
1628	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1629}
1630
1631// Do executes the "reseller.resellernotify.getwatchdetails" call.
1632// Exactly one of *ResellernotifyGetwatchdetailsResponse or error will
1633// be non-nil. Any non-2xx status code is an error. Response headers are
1634// in either
1635// *ResellernotifyGetwatchdetailsResponse.ServerResponse.Header or (if a
1636// response was returned at all) in error.(*googleapi.Error).Header. Use
1637// googleapi.IsNotModified to check whether the returned error was
1638// because http.StatusNotModified was returned.
1639func (c *ResellernotifyGetwatchdetailsCall) Do(opts ...googleapi.CallOption) (*ResellernotifyGetwatchdetailsResponse, error) {
1640	gensupport.SetOptions(c.urlParams_, opts...)
1641	res, err := c.doRequest("json")
1642	if res != nil && res.StatusCode == http.StatusNotModified {
1643		if res.Body != nil {
1644			res.Body.Close()
1645		}
1646		return nil, &googleapi.Error{
1647			Code:   res.StatusCode,
1648			Header: res.Header,
1649		}
1650	}
1651	if err != nil {
1652		return nil, err
1653	}
1654	defer googleapi.CloseBody(res)
1655	if err := googleapi.CheckResponse(res); err != nil {
1656		return nil, err
1657	}
1658	ret := &ResellernotifyGetwatchdetailsResponse{
1659		ServerResponse: googleapi.ServerResponse{
1660			Header:         res.Header,
1661			HTTPStatusCode: res.StatusCode,
1662		},
1663	}
1664	target := &ret
1665	if err := gensupport.DecodeResponse(target, res); err != nil {
1666		return nil, err
1667	}
1668	return ret, nil
1669	// {
1670	//   "description": "Returns all the details of the watch corresponding to the reseller.",
1671	//   "flatPath": "apps/reseller/v1/resellernotify/getwatchdetails",
1672	//   "httpMethod": "GET",
1673	//   "id": "reseller.resellernotify.getwatchdetails",
1674	//   "parameterOrder": [],
1675	//   "parameters": {},
1676	//   "path": "apps/reseller/v1/resellernotify/getwatchdetails",
1677	//   "response": {
1678	//     "$ref": "ResellernotifyGetwatchdetailsResponse"
1679	//   },
1680	//   "scopes": [
1681	//     "https://www.googleapis.com/auth/apps.order",
1682	//     "https://www.googleapis.com/auth/apps.order.readonly"
1683	//   ]
1684	// }
1685
1686}
1687
1688// method id "reseller.resellernotify.register":
1689
1690type ResellernotifyRegisterCall struct {
1691	s          *Service
1692	urlParams_ gensupport.URLParams
1693	ctx_       context.Context
1694	header_    http.Header
1695}
1696
1697// Register: Registers a Reseller for receiving notifications.
1698func (r *ResellernotifyService) Register() *ResellernotifyRegisterCall {
1699	c := &ResellernotifyRegisterCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1700	return c
1701}
1702
1703// ServiceAccountEmailAddress sets the optional parameter
1704// "serviceAccountEmailAddress": The service account which will own the
1705// created Cloud-PubSub topic.
1706func (c *ResellernotifyRegisterCall) ServiceAccountEmailAddress(serviceAccountEmailAddress string) *ResellernotifyRegisterCall {
1707	c.urlParams_.Set("serviceAccountEmailAddress", serviceAccountEmailAddress)
1708	return c
1709}
1710
1711// Fields allows partial responses to be retrieved. See
1712// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1713// for more information.
1714func (c *ResellernotifyRegisterCall) Fields(s ...googleapi.Field) *ResellernotifyRegisterCall {
1715	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1716	return c
1717}
1718
1719// Context sets the context to be used in this call's Do method. Any
1720// pending HTTP request will be aborted if the provided context is
1721// canceled.
1722func (c *ResellernotifyRegisterCall) Context(ctx context.Context) *ResellernotifyRegisterCall {
1723	c.ctx_ = ctx
1724	return c
1725}
1726
1727// Header returns an http.Header that can be modified by the caller to
1728// add HTTP headers to the request.
1729func (c *ResellernotifyRegisterCall) Header() http.Header {
1730	if c.header_ == nil {
1731		c.header_ = make(http.Header)
1732	}
1733	return c.header_
1734}
1735
1736func (c *ResellernotifyRegisterCall) doRequest(alt string) (*http.Response, error) {
1737	reqHeaders := make(http.Header)
1738	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915")
1739	for k, v := range c.header_ {
1740		reqHeaders[k] = v
1741	}
1742	reqHeaders.Set("User-Agent", c.s.userAgent())
1743	var body io.Reader = nil
1744	c.urlParams_.Set("alt", alt)
1745	c.urlParams_.Set("prettyPrint", "false")
1746	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/resellernotify/register")
1747	urls += "?" + c.urlParams_.Encode()
1748	req, err := http.NewRequest("POST", urls, body)
1749	if err != nil {
1750		return nil, err
1751	}
1752	req.Header = reqHeaders
1753	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1754}
1755
1756// Do executes the "reseller.resellernotify.register" call.
1757// Exactly one of *ResellernotifyResource or error will be non-nil. Any
1758// non-2xx status code is an error. Response headers are in either
1759// *ResellernotifyResource.ServerResponse.Header or (if a response was
1760// returned at all) in error.(*googleapi.Error).Header. Use
1761// googleapi.IsNotModified to check whether the returned error was
1762// because http.StatusNotModified was returned.
1763func (c *ResellernotifyRegisterCall) Do(opts ...googleapi.CallOption) (*ResellernotifyResource, error) {
1764	gensupport.SetOptions(c.urlParams_, opts...)
1765	res, err := c.doRequest("json")
1766	if res != nil && res.StatusCode == http.StatusNotModified {
1767		if res.Body != nil {
1768			res.Body.Close()
1769		}
1770		return nil, &googleapi.Error{
1771			Code:   res.StatusCode,
1772			Header: res.Header,
1773		}
1774	}
1775	if err != nil {
1776		return nil, err
1777	}
1778	defer googleapi.CloseBody(res)
1779	if err := googleapi.CheckResponse(res); err != nil {
1780		return nil, err
1781	}
1782	ret := &ResellernotifyResource{
1783		ServerResponse: googleapi.ServerResponse{
1784			Header:         res.Header,
1785			HTTPStatusCode: res.StatusCode,
1786		},
1787	}
1788	target := &ret
1789	if err := gensupport.DecodeResponse(target, res); err != nil {
1790		return nil, err
1791	}
1792	return ret, nil
1793	// {
1794	//   "description": "Registers a Reseller for receiving notifications.",
1795	//   "flatPath": "apps/reseller/v1/resellernotify/register",
1796	//   "httpMethod": "POST",
1797	//   "id": "reseller.resellernotify.register",
1798	//   "parameterOrder": [],
1799	//   "parameters": {
1800	//     "serviceAccountEmailAddress": {
1801	//       "description": "The service account which will own the created Cloud-PubSub topic.",
1802	//       "location": "query",
1803	//       "type": "string"
1804	//     }
1805	//   },
1806	//   "path": "apps/reseller/v1/resellernotify/register",
1807	//   "response": {
1808	//     "$ref": "ResellernotifyResource"
1809	//   },
1810	//   "scopes": [
1811	//     "https://www.googleapis.com/auth/apps.order"
1812	//   ]
1813	// }
1814
1815}
1816
1817// method id "reseller.resellernotify.unregister":
1818
1819type ResellernotifyUnregisterCall struct {
1820	s          *Service
1821	urlParams_ gensupport.URLParams
1822	ctx_       context.Context
1823	header_    http.Header
1824}
1825
1826// Unregister: Unregisters a Reseller for receiving notifications.
1827func (r *ResellernotifyService) Unregister() *ResellernotifyUnregisterCall {
1828	c := &ResellernotifyUnregisterCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1829	return c
1830}
1831
1832// ServiceAccountEmailAddress sets the optional parameter
1833// "serviceAccountEmailAddress": The service account which owns the
1834// Cloud-PubSub topic.
1835func (c *ResellernotifyUnregisterCall) ServiceAccountEmailAddress(serviceAccountEmailAddress string) *ResellernotifyUnregisterCall {
1836	c.urlParams_.Set("serviceAccountEmailAddress", serviceAccountEmailAddress)
1837	return c
1838}
1839
1840// Fields allows partial responses to be retrieved. See
1841// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1842// for more information.
1843func (c *ResellernotifyUnregisterCall) Fields(s ...googleapi.Field) *ResellernotifyUnregisterCall {
1844	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1845	return c
1846}
1847
1848// Context sets the context to be used in this call's Do method. Any
1849// pending HTTP request will be aborted if the provided context is
1850// canceled.
1851func (c *ResellernotifyUnregisterCall) Context(ctx context.Context) *ResellernotifyUnregisterCall {
1852	c.ctx_ = ctx
1853	return c
1854}
1855
1856// Header returns an http.Header that can be modified by the caller to
1857// add HTTP headers to the request.
1858func (c *ResellernotifyUnregisterCall) Header() http.Header {
1859	if c.header_ == nil {
1860		c.header_ = make(http.Header)
1861	}
1862	return c.header_
1863}
1864
1865func (c *ResellernotifyUnregisterCall) doRequest(alt string) (*http.Response, error) {
1866	reqHeaders := make(http.Header)
1867	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915")
1868	for k, v := range c.header_ {
1869		reqHeaders[k] = v
1870	}
1871	reqHeaders.Set("User-Agent", c.s.userAgent())
1872	var body io.Reader = nil
1873	c.urlParams_.Set("alt", alt)
1874	c.urlParams_.Set("prettyPrint", "false")
1875	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/resellernotify/unregister")
1876	urls += "?" + c.urlParams_.Encode()
1877	req, err := http.NewRequest("POST", urls, body)
1878	if err != nil {
1879		return nil, err
1880	}
1881	req.Header = reqHeaders
1882	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1883}
1884
1885// Do executes the "reseller.resellernotify.unregister" call.
1886// Exactly one of *ResellernotifyResource or error will be non-nil. Any
1887// non-2xx status code is an error. Response headers are in either
1888// *ResellernotifyResource.ServerResponse.Header or (if a response was
1889// returned at all) in error.(*googleapi.Error).Header. Use
1890// googleapi.IsNotModified to check whether the returned error was
1891// because http.StatusNotModified was returned.
1892func (c *ResellernotifyUnregisterCall) Do(opts ...googleapi.CallOption) (*ResellernotifyResource, error) {
1893	gensupport.SetOptions(c.urlParams_, opts...)
1894	res, err := c.doRequest("json")
1895	if res != nil && res.StatusCode == http.StatusNotModified {
1896		if res.Body != nil {
1897			res.Body.Close()
1898		}
1899		return nil, &googleapi.Error{
1900			Code:   res.StatusCode,
1901			Header: res.Header,
1902		}
1903	}
1904	if err != nil {
1905		return nil, err
1906	}
1907	defer googleapi.CloseBody(res)
1908	if err := googleapi.CheckResponse(res); err != nil {
1909		return nil, err
1910	}
1911	ret := &ResellernotifyResource{
1912		ServerResponse: googleapi.ServerResponse{
1913			Header:         res.Header,
1914			HTTPStatusCode: res.StatusCode,
1915		},
1916	}
1917	target := &ret
1918	if err := gensupport.DecodeResponse(target, res); err != nil {
1919		return nil, err
1920	}
1921	return ret, nil
1922	// {
1923	//   "description": "Unregisters a Reseller for receiving notifications.",
1924	//   "flatPath": "apps/reseller/v1/resellernotify/unregister",
1925	//   "httpMethod": "POST",
1926	//   "id": "reseller.resellernotify.unregister",
1927	//   "parameterOrder": [],
1928	//   "parameters": {
1929	//     "serviceAccountEmailAddress": {
1930	//       "description": "The service account which owns the Cloud-PubSub topic.",
1931	//       "location": "query",
1932	//       "type": "string"
1933	//     }
1934	//   },
1935	//   "path": "apps/reseller/v1/resellernotify/unregister",
1936	//   "response": {
1937	//     "$ref": "ResellernotifyResource"
1938	//   },
1939	//   "scopes": [
1940	//     "https://www.googleapis.com/auth/apps.order"
1941	//   ]
1942	// }
1943
1944}
1945
1946// method id "reseller.subscriptions.activate":
1947
1948type SubscriptionsActivateCall struct {
1949	s              *Service
1950	customerId     string
1951	subscriptionId string
1952	urlParams_     gensupport.URLParams
1953	ctx_           context.Context
1954	header_        http.Header
1955}
1956
1957// Activate: Activates a subscription previously suspended by the
1958// reseller. If you did not suspend the customer subscription and it is
1959// suspended for any other reason, such as for abuse or a pending ToS
1960// acceptance, this call will not reactivate the customer subscription.
1961//
1962// - customerId: Either the customer's primary domain name or the
1963//   customer's unique identifier. If using the domain name, we do not
1964//   recommend using a `customerId` as a key for persistent data. If the
1965//   domain name for a `customerId` is changed, the Google system
1966//   automatically updates.
1967// - subscriptionId: This is a required property. The `subscriptionId`
1968//   is the subscription identifier and is unique for each customer.
1969//   Since a `subscriptionId` changes when a subscription is updated, we
1970//   recommend to not use this ID as a key for persistent data. And the
1971//   `subscriptionId` can be found using the retrieve all reseller
1972//   subscriptions method.
1973func (r *SubscriptionsService) Activate(customerId string, subscriptionId string) *SubscriptionsActivateCall {
1974	c := &SubscriptionsActivateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1975	c.customerId = customerId
1976	c.subscriptionId = subscriptionId
1977	return c
1978}
1979
1980// Fields allows partial responses to be retrieved. See
1981// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1982// for more information.
1983func (c *SubscriptionsActivateCall) Fields(s ...googleapi.Field) *SubscriptionsActivateCall {
1984	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1985	return c
1986}
1987
1988// Context sets the context to be used in this call's Do method. Any
1989// pending HTTP request will be aborted if the provided context is
1990// canceled.
1991func (c *SubscriptionsActivateCall) Context(ctx context.Context) *SubscriptionsActivateCall {
1992	c.ctx_ = ctx
1993	return c
1994}
1995
1996// Header returns an http.Header that can be modified by the caller to
1997// add HTTP headers to the request.
1998func (c *SubscriptionsActivateCall) Header() http.Header {
1999	if c.header_ == nil {
2000		c.header_ = make(http.Header)
2001	}
2002	return c.header_
2003}
2004
2005func (c *SubscriptionsActivateCall) doRequest(alt string) (*http.Response, error) {
2006	reqHeaders := make(http.Header)
2007	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915")
2008	for k, v := range c.header_ {
2009		reqHeaders[k] = v
2010	}
2011	reqHeaders.Set("User-Agent", c.s.userAgent())
2012	var body io.Reader = nil
2013	c.urlParams_.Set("alt", alt)
2014	c.urlParams_.Set("prettyPrint", "false")
2015	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/activate")
2016	urls += "?" + c.urlParams_.Encode()
2017	req, err := http.NewRequest("POST", urls, body)
2018	if err != nil {
2019		return nil, err
2020	}
2021	req.Header = reqHeaders
2022	googleapi.Expand(req.URL, map[string]string{
2023		"customerId":     c.customerId,
2024		"subscriptionId": c.subscriptionId,
2025	})
2026	return gensupport.SendRequest(c.ctx_, c.s.client, req)
2027}
2028
2029// Do executes the "reseller.subscriptions.activate" call.
2030// Exactly one of *Subscription or error will be non-nil. Any non-2xx
2031// status code is an error. Response headers are in either
2032// *Subscription.ServerResponse.Header or (if a response was returned at
2033// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
2034// to check whether the returned error was because
2035// http.StatusNotModified was returned.
2036func (c *SubscriptionsActivateCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
2037	gensupport.SetOptions(c.urlParams_, opts...)
2038	res, err := c.doRequest("json")
2039	if res != nil && res.StatusCode == http.StatusNotModified {
2040		if res.Body != nil {
2041			res.Body.Close()
2042		}
2043		return nil, &googleapi.Error{
2044			Code:   res.StatusCode,
2045			Header: res.Header,
2046		}
2047	}
2048	if err != nil {
2049		return nil, err
2050	}
2051	defer googleapi.CloseBody(res)
2052	if err := googleapi.CheckResponse(res); err != nil {
2053		return nil, err
2054	}
2055	ret := &Subscription{
2056		ServerResponse: googleapi.ServerResponse{
2057			Header:         res.Header,
2058			HTTPStatusCode: res.StatusCode,
2059		},
2060	}
2061	target := &ret
2062	if err := gensupport.DecodeResponse(target, res); err != nil {
2063		return nil, err
2064	}
2065	return ret, nil
2066	// {
2067	//   "description": "Activates a subscription previously suspended by the reseller. If you did not suspend the customer subscription and it is suspended for any other reason, such as for abuse or a pending ToS acceptance, this call will not reactivate the customer subscription.",
2068	//   "flatPath": "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/activate",
2069	//   "httpMethod": "POST",
2070	//   "id": "reseller.subscriptions.activate",
2071	//   "parameterOrder": [
2072	//     "customerId",
2073	//     "subscriptionId"
2074	//   ],
2075	//   "parameters": {
2076	//     "customerId": {
2077	//       "description": "Either the customer's primary domain name or the customer's unique identifier. If using the domain name, we do not recommend using a `customerId` as a key for persistent data. If the domain name for a `customerId` is changed, the Google system automatically updates.",
2078	//       "location": "path",
2079	//       "required": true,
2080	//       "type": "string"
2081	//     },
2082	//     "subscriptionId": {
2083	//       "description": "This is a required property. The `subscriptionId` is the subscription identifier and is unique for each customer. Since a `subscriptionId` changes when a subscription is updated, we recommend to not use this ID as a key for persistent data. And the `subscriptionId` can be found using the retrieve all reseller subscriptions method.",
2084	//       "location": "path",
2085	//       "required": true,
2086	//       "type": "string"
2087	//     }
2088	//   },
2089	//   "path": "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/activate",
2090	//   "response": {
2091	//     "$ref": "Subscription"
2092	//   },
2093	//   "scopes": [
2094	//     "https://www.googleapis.com/auth/apps.order"
2095	//   ]
2096	// }
2097
2098}
2099
2100// method id "reseller.subscriptions.changePlan":
2101
2102type SubscriptionsChangePlanCall struct {
2103	s                 *Service
2104	customerId        string
2105	subscriptionId    string
2106	changeplanrequest *ChangePlanRequest
2107	urlParams_        gensupport.URLParams
2108	ctx_              context.Context
2109	header_           http.Header
2110}
2111
2112// ChangePlan: Updates a subscription plan. Use this method to update a
2113// plan for a 30-day trial or a flexible plan subscription to an annual
2114// commitment plan with monthly or yearly payments. How a plan is
2115// updated differs depending on the plan and the products. For more
2116// information, see the description in manage subscriptions
2117// (/admin-sdk/reseller/v1/how-tos/manage_subscriptions#update_subscripti
2118// on_plan).
2119//
2120// - customerId: Either the customer's primary domain name or the
2121//   customer's unique identifier. If using the domain name, we do not
2122//   recommend using a `customerId` as a key for persistent data. If the
2123//   domain name for a `customerId` is changed, the Google system
2124//   automatically updates.
2125// - subscriptionId: This is a required property. The `subscriptionId`
2126//   is the subscription identifier and is unique for each customer.
2127//   Since a `subscriptionId` changes when a subscription is updated, we
2128//   recommend to not use this ID as a key for persistent data. And the
2129//   `subscriptionId` can be found using the retrieve all reseller
2130//   subscriptions method.
2131func (r *SubscriptionsService) ChangePlan(customerId string, subscriptionId string, changeplanrequest *ChangePlanRequest) *SubscriptionsChangePlanCall {
2132	c := &SubscriptionsChangePlanCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2133	c.customerId = customerId
2134	c.subscriptionId = subscriptionId
2135	c.changeplanrequest = changeplanrequest
2136	return c
2137}
2138
2139// Fields allows partial responses to be retrieved. See
2140// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2141// for more information.
2142func (c *SubscriptionsChangePlanCall) Fields(s ...googleapi.Field) *SubscriptionsChangePlanCall {
2143	c.urlParams_.Set("fields", googleapi.CombineFields(s))
2144	return c
2145}
2146
2147// Context sets the context to be used in this call's Do method. Any
2148// pending HTTP request will be aborted if the provided context is
2149// canceled.
2150func (c *SubscriptionsChangePlanCall) Context(ctx context.Context) *SubscriptionsChangePlanCall {
2151	c.ctx_ = ctx
2152	return c
2153}
2154
2155// Header returns an http.Header that can be modified by the caller to
2156// add HTTP headers to the request.
2157func (c *SubscriptionsChangePlanCall) Header() http.Header {
2158	if c.header_ == nil {
2159		c.header_ = make(http.Header)
2160	}
2161	return c.header_
2162}
2163
2164func (c *SubscriptionsChangePlanCall) doRequest(alt string) (*http.Response, error) {
2165	reqHeaders := make(http.Header)
2166	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915")
2167	for k, v := range c.header_ {
2168		reqHeaders[k] = v
2169	}
2170	reqHeaders.Set("User-Agent", c.s.userAgent())
2171	var body io.Reader = nil
2172	body, err := googleapi.WithoutDataWrapper.JSONReader(c.changeplanrequest)
2173	if err != nil {
2174		return nil, err
2175	}
2176	reqHeaders.Set("Content-Type", "application/json")
2177	c.urlParams_.Set("alt", alt)
2178	c.urlParams_.Set("prettyPrint", "false")
2179	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/changePlan")
2180	urls += "?" + c.urlParams_.Encode()
2181	req, err := http.NewRequest("POST", urls, body)
2182	if err != nil {
2183		return nil, err
2184	}
2185	req.Header = reqHeaders
2186	googleapi.Expand(req.URL, map[string]string{
2187		"customerId":     c.customerId,
2188		"subscriptionId": c.subscriptionId,
2189	})
2190	return gensupport.SendRequest(c.ctx_, c.s.client, req)
2191}
2192
2193// Do executes the "reseller.subscriptions.changePlan" call.
2194// Exactly one of *Subscription or error will be non-nil. Any non-2xx
2195// status code is an error. Response headers are in either
2196// *Subscription.ServerResponse.Header or (if a response was returned at
2197// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
2198// to check whether the returned error was because
2199// http.StatusNotModified was returned.
2200func (c *SubscriptionsChangePlanCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
2201	gensupport.SetOptions(c.urlParams_, opts...)
2202	res, err := c.doRequest("json")
2203	if res != nil && res.StatusCode == http.StatusNotModified {
2204		if res.Body != nil {
2205			res.Body.Close()
2206		}
2207		return nil, &googleapi.Error{
2208			Code:   res.StatusCode,
2209			Header: res.Header,
2210		}
2211	}
2212	if err != nil {
2213		return nil, err
2214	}
2215	defer googleapi.CloseBody(res)
2216	if err := googleapi.CheckResponse(res); err != nil {
2217		return nil, err
2218	}
2219	ret := &Subscription{
2220		ServerResponse: googleapi.ServerResponse{
2221			Header:         res.Header,
2222			HTTPStatusCode: res.StatusCode,
2223		},
2224	}
2225	target := &ret
2226	if err := gensupport.DecodeResponse(target, res); err != nil {
2227		return nil, err
2228	}
2229	return ret, nil
2230	// {
2231	//   "description": "Updates a subscription plan. Use this method to update a plan for a 30-day trial or a flexible plan subscription to an annual commitment plan with monthly or yearly payments. How a plan is updated differs depending on the plan and the products. For more information, see the description in [manage subscriptions](/admin-sdk/reseller/v1/how-tos/manage_subscriptions#update_subscription_plan).",
2232	//   "flatPath": "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/changePlan",
2233	//   "httpMethod": "POST",
2234	//   "id": "reseller.subscriptions.changePlan",
2235	//   "parameterOrder": [
2236	//     "customerId",
2237	//     "subscriptionId"
2238	//   ],
2239	//   "parameters": {
2240	//     "customerId": {
2241	//       "description": "Either the customer's primary domain name or the customer's unique identifier. If using the domain name, we do not recommend using a `customerId` as a key for persistent data. If the domain name for a `customerId` is changed, the Google system automatically updates.",
2242	//       "location": "path",
2243	//       "required": true,
2244	//       "type": "string"
2245	//     },
2246	//     "subscriptionId": {
2247	//       "description": "This is a required property. The `subscriptionId` is the subscription identifier and is unique for each customer. Since a `subscriptionId` changes when a subscription is updated, we recommend to not use this ID as a key for persistent data. And the `subscriptionId` can be found using the retrieve all reseller subscriptions method.",
2248	//       "location": "path",
2249	//       "required": true,
2250	//       "type": "string"
2251	//     }
2252	//   },
2253	//   "path": "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/changePlan",
2254	//   "request": {
2255	//     "$ref": "ChangePlanRequest"
2256	//   },
2257	//   "response": {
2258	//     "$ref": "Subscription"
2259	//   },
2260	//   "scopes": [
2261	//     "https://www.googleapis.com/auth/apps.order"
2262	//   ]
2263	// }
2264
2265}
2266
2267// method id "reseller.subscriptions.changeRenewalSettings":
2268
2269type SubscriptionsChangeRenewalSettingsCall struct {
2270	s               *Service
2271	customerId      string
2272	subscriptionId  string
2273	renewalsettings *RenewalSettings
2274	urlParams_      gensupport.URLParams
2275	ctx_            context.Context
2276	header_         http.Header
2277}
2278
2279// ChangeRenewalSettings: Updates a user license's renewal settings.
2280// This is applicable for accounts with annual commitment plans only.
2281// For more information, see the description in manage subscriptions
2282// (/admin-sdk/reseller/v1/how-tos/manage_subscriptions#update_renewal).
2283//
2284// - customerId: Either the customer's primary domain name or the
2285//   customer's unique identifier. If using the domain name, we do not
2286//   recommend using a `customerId` as a key for persistent data. If the
2287//   domain name for a `customerId` is changed, the Google system
2288//   automatically updates.
2289// - subscriptionId: This is a required property. The `subscriptionId`
2290//   is the subscription identifier and is unique for each customer.
2291//   Since a `subscriptionId` changes when a subscription is updated, we
2292//   recommend to not use this ID as a key for persistent data. And the
2293//   `subscriptionId` can be found using the retrieve all reseller
2294//   subscriptions method.
2295func (r *SubscriptionsService) ChangeRenewalSettings(customerId string, subscriptionId string, renewalsettings *RenewalSettings) *SubscriptionsChangeRenewalSettingsCall {
2296	c := &SubscriptionsChangeRenewalSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2297	c.customerId = customerId
2298	c.subscriptionId = subscriptionId
2299	c.renewalsettings = renewalsettings
2300	return c
2301}
2302
2303// Fields allows partial responses to be retrieved. See
2304// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2305// for more information.
2306func (c *SubscriptionsChangeRenewalSettingsCall) Fields(s ...googleapi.Field) *SubscriptionsChangeRenewalSettingsCall {
2307	c.urlParams_.Set("fields", googleapi.CombineFields(s))
2308	return c
2309}
2310
2311// Context sets the context to be used in this call's Do method. Any
2312// pending HTTP request will be aborted if the provided context is
2313// canceled.
2314func (c *SubscriptionsChangeRenewalSettingsCall) Context(ctx context.Context) *SubscriptionsChangeRenewalSettingsCall {
2315	c.ctx_ = ctx
2316	return c
2317}
2318
2319// Header returns an http.Header that can be modified by the caller to
2320// add HTTP headers to the request.
2321func (c *SubscriptionsChangeRenewalSettingsCall) Header() http.Header {
2322	if c.header_ == nil {
2323		c.header_ = make(http.Header)
2324	}
2325	return c.header_
2326}
2327
2328func (c *SubscriptionsChangeRenewalSettingsCall) doRequest(alt string) (*http.Response, error) {
2329	reqHeaders := make(http.Header)
2330	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915")
2331	for k, v := range c.header_ {
2332		reqHeaders[k] = v
2333	}
2334	reqHeaders.Set("User-Agent", c.s.userAgent())
2335	var body io.Reader = nil
2336	body, err := googleapi.WithoutDataWrapper.JSONReader(c.renewalsettings)
2337	if err != nil {
2338		return nil, err
2339	}
2340	reqHeaders.Set("Content-Type", "application/json")
2341	c.urlParams_.Set("alt", alt)
2342	c.urlParams_.Set("prettyPrint", "false")
2343	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/changeRenewalSettings")
2344	urls += "?" + c.urlParams_.Encode()
2345	req, err := http.NewRequest("POST", urls, body)
2346	if err != nil {
2347		return nil, err
2348	}
2349	req.Header = reqHeaders
2350	googleapi.Expand(req.URL, map[string]string{
2351		"customerId":     c.customerId,
2352		"subscriptionId": c.subscriptionId,
2353	})
2354	return gensupport.SendRequest(c.ctx_, c.s.client, req)
2355}
2356
2357// Do executes the "reseller.subscriptions.changeRenewalSettings" call.
2358// Exactly one of *Subscription or error will be non-nil. Any non-2xx
2359// status code is an error. Response headers are in either
2360// *Subscription.ServerResponse.Header or (if a response was returned at
2361// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
2362// to check whether the returned error was because
2363// http.StatusNotModified was returned.
2364func (c *SubscriptionsChangeRenewalSettingsCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
2365	gensupport.SetOptions(c.urlParams_, opts...)
2366	res, err := c.doRequest("json")
2367	if res != nil && res.StatusCode == http.StatusNotModified {
2368		if res.Body != nil {
2369			res.Body.Close()
2370		}
2371		return nil, &googleapi.Error{
2372			Code:   res.StatusCode,
2373			Header: res.Header,
2374		}
2375	}
2376	if err != nil {
2377		return nil, err
2378	}
2379	defer googleapi.CloseBody(res)
2380	if err := googleapi.CheckResponse(res); err != nil {
2381		return nil, err
2382	}
2383	ret := &Subscription{
2384		ServerResponse: googleapi.ServerResponse{
2385			Header:         res.Header,
2386			HTTPStatusCode: res.StatusCode,
2387		},
2388	}
2389	target := &ret
2390	if err := gensupport.DecodeResponse(target, res); err != nil {
2391		return nil, err
2392	}
2393	return ret, nil
2394	// {
2395	//   "description": "Updates a user license's renewal settings. This is applicable for accounts with annual commitment plans only. For more information, see the description in [manage subscriptions](/admin-sdk/reseller/v1/how-tos/manage_subscriptions#update_renewal).",
2396	//   "flatPath": "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/changeRenewalSettings",
2397	//   "httpMethod": "POST",
2398	//   "id": "reseller.subscriptions.changeRenewalSettings",
2399	//   "parameterOrder": [
2400	//     "customerId",
2401	//     "subscriptionId"
2402	//   ],
2403	//   "parameters": {
2404	//     "customerId": {
2405	//       "description": "Either the customer's primary domain name or the customer's unique identifier. If using the domain name, we do not recommend using a `customerId` as a key for persistent data. If the domain name for a `customerId` is changed, the Google system automatically updates.",
2406	//       "location": "path",
2407	//       "required": true,
2408	//       "type": "string"
2409	//     },
2410	//     "subscriptionId": {
2411	//       "description": "This is a required property. The `subscriptionId` is the subscription identifier and is unique for each customer. Since a `subscriptionId` changes when a subscription is updated, we recommend to not use this ID as a key for persistent data. And the `subscriptionId` can be found using the retrieve all reseller subscriptions method.",
2412	//       "location": "path",
2413	//       "required": true,
2414	//       "type": "string"
2415	//     }
2416	//   },
2417	//   "path": "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/changeRenewalSettings",
2418	//   "request": {
2419	//     "$ref": "RenewalSettings"
2420	//   },
2421	//   "response": {
2422	//     "$ref": "Subscription"
2423	//   },
2424	//   "scopes": [
2425	//     "https://www.googleapis.com/auth/apps.order"
2426	//   ]
2427	// }
2428
2429}
2430
2431// method id "reseller.subscriptions.changeSeats":
2432
2433type SubscriptionsChangeSeatsCall struct {
2434	s              *Service
2435	customerId     string
2436	subscriptionId string
2437	seats          *Seats
2438	urlParams_     gensupport.URLParams
2439	ctx_           context.Context
2440	header_        http.Header
2441}
2442
2443// ChangeSeats: Updates a subscription's user license settings. For more
2444// information about updating an annual commitment plan or a flexible
2445// plan subscription’s licenses, see Manage Subscriptions
2446// (/admin-sdk/reseller/v1/how-tos/manage_subscriptions#update_subscripti
2447// on_seat).
2448//
2449// - customerId: Either the customer's primary domain name or the
2450//   customer's unique identifier. If using the domain name, we do not
2451//   recommend using a `customerId` as a key for persistent data. If the
2452//   domain name for a `customerId` is changed, the Google system
2453//   automatically updates.
2454// - subscriptionId: This is a required property. The `subscriptionId`
2455//   is the subscription identifier and is unique for each customer.
2456//   Since a `subscriptionId` changes when a subscription is updated, we
2457//   recommend to not use this ID as a key for persistent data. And the
2458//   `subscriptionId` can be found using the retrieve all reseller
2459//   subscriptions method.
2460func (r *SubscriptionsService) ChangeSeats(customerId string, subscriptionId string, seats *Seats) *SubscriptionsChangeSeatsCall {
2461	c := &SubscriptionsChangeSeatsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2462	c.customerId = customerId
2463	c.subscriptionId = subscriptionId
2464	c.seats = seats
2465	return c
2466}
2467
2468// Fields allows partial responses to be retrieved. See
2469// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2470// for more information.
2471func (c *SubscriptionsChangeSeatsCall) Fields(s ...googleapi.Field) *SubscriptionsChangeSeatsCall {
2472	c.urlParams_.Set("fields", googleapi.CombineFields(s))
2473	return c
2474}
2475
2476// Context sets the context to be used in this call's Do method. Any
2477// pending HTTP request will be aborted if the provided context is
2478// canceled.
2479func (c *SubscriptionsChangeSeatsCall) Context(ctx context.Context) *SubscriptionsChangeSeatsCall {
2480	c.ctx_ = ctx
2481	return c
2482}
2483
2484// Header returns an http.Header that can be modified by the caller to
2485// add HTTP headers to the request.
2486func (c *SubscriptionsChangeSeatsCall) Header() http.Header {
2487	if c.header_ == nil {
2488		c.header_ = make(http.Header)
2489	}
2490	return c.header_
2491}
2492
2493func (c *SubscriptionsChangeSeatsCall) doRequest(alt string) (*http.Response, error) {
2494	reqHeaders := make(http.Header)
2495	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915")
2496	for k, v := range c.header_ {
2497		reqHeaders[k] = v
2498	}
2499	reqHeaders.Set("User-Agent", c.s.userAgent())
2500	var body io.Reader = nil
2501	body, err := googleapi.WithoutDataWrapper.JSONReader(c.seats)
2502	if err != nil {
2503		return nil, err
2504	}
2505	reqHeaders.Set("Content-Type", "application/json")
2506	c.urlParams_.Set("alt", alt)
2507	c.urlParams_.Set("prettyPrint", "false")
2508	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/changeSeats")
2509	urls += "?" + c.urlParams_.Encode()
2510	req, err := http.NewRequest("POST", urls, body)
2511	if err != nil {
2512		return nil, err
2513	}
2514	req.Header = reqHeaders
2515	googleapi.Expand(req.URL, map[string]string{
2516		"customerId":     c.customerId,
2517		"subscriptionId": c.subscriptionId,
2518	})
2519	return gensupport.SendRequest(c.ctx_, c.s.client, req)
2520}
2521
2522// Do executes the "reseller.subscriptions.changeSeats" call.
2523// Exactly one of *Subscription or error will be non-nil. Any non-2xx
2524// status code is an error. Response headers are in either
2525// *Subscription.ServerResponse.Header or (if a response was returned at
2526// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
2527// to check whether the returned error was because
2528// http.StatusNotModified was returned.
2529func (c *SubscriptionsChangeSeatsCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
2530	gensupport.SetOptions(c.urlParams_, opts...)
2531	res, err := c.doRequest("json")
2532	if res != nil && res.StatusCode == http.StatusNotModified {
2533		if res.Body != nil {
2534			res.Body.Close()
2535		}
2536		return nil, &googleapi.Error{
2537			Code:   res.StatusCode,
2538			Header: res.Header,
2539		}
2540	}
2541	if err != nil {
2542		return nil, err
2543	}
2544	defer googleapi.CloseBody(res)
2545	if err := googleapi.CheckResponse(res); err != nil {
2546		return nil, err
2547	}
2548	ret := &Subscription{
2549		ServerResponse: googleapi.ServerResponse{
2550			Header:         res.Header,
2551			HTTPStatusCode: res.StatusCode,
2552		},
2553	}
2554	target := &ret
2555	if err := gensupport.DecodeResponse(target, res); err != nil {
2556		return nil, err
2557	}
2558	return ret, nil
2559	// {
2560	//   "description": "Updates a subscription's user license settings. For more information about updating an annual commitment plan or a flexible plan subscription’s licenses, see [Manage Subscriptions](/admin-sdk/reseller/v1/how-tos/manage_subscriptions#update_subscription_seat).",
2561	//   "flatPath": "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/changeSeats",
2562	//   "httpMethod": "POST",
2563	//   "id": "reseller.subscriptions.changeSeats",
2564	//   "parameterOrder": [
2565	//     "customerId",
2566	//     "subscriptionId"
2567	//   ],
2568	//   "parameters": {
2569	//     "customerId": {
2570	//       "description": "Either the customer's primary domain name or the customer's unique identifier. If using the domain name, we do not recommend using a `customerId` as a key for persistent data. If the domain name for a `customerId` is changed, the Google system automatically updates.",
2571	//       "location": "path",
2572	//       "required": true,
2573	//       "type": "string"
2574	//     },
2575	//     "subscriptionId": {
2576	//       "description": "This is a required property. The `subscriptionId` is the subscription identifier and is unique for each customer. Since a `subscriptionId` changes when a subscription is updated, we recommend to not use this ID as a key for persistent data. And the `subscriptionId` can be found using the retrieve all reseller subscriptions method.",
2577	//       "location": "path",
2578	//       "required": true,
2579	//       "type": "string"
2580	//     }
2581	//   },
2582	//   "path": "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/changeSeats",
2583	//   "request": {
2584	//     "$ref": "Seats"
2585	//   },
2586	//   "response": {
2587	//     "$ref": "Subscription"
2588	//   },
2589	//   "scopes": [
2590	//     "https://www.googleapis.com/auth/apps.order"
2591	//   ]
2592	// }
2593
2594}
2595
2596// method id "reseller.subscriptions.delete":
2597
2598type SubscriptionsDeleteCall struct {
2599	s              *Service
2600	customerId     string
2601	subscriptionId string
2602	urlParams_     gensupport.URLParams
2603	ctx_           context.Context
2604	header_        http.Header
2605}
2606
2607// Delete: Cancels, suspends, or transfers a subscription to direct.
2608//
2609// - customerId: Either the customer's primary domain name or the
2610//   customer's unique identifier. If using the domain name, we do not
2611//   recommend using a `customerId` as a key for persistent data. If the
2612//   domain name for a `customerId` is changed, the Google system
2613//   automatically updates.
2614// - deletionType: The `deletionType` query string enables the
2615//   cancellation, downgrade, or suspension of a subscription.
2616// - subscriptionId: This is a required property. The `subscriptionId`
2617//   is the subscription identifier and is unique for each customer.
2618//   Since a `subscriptionId` changes when a subscription is updated, we
2619//   recommend to not use this ID as a key for persistent data. And the
2620//   `subscriptionId` can be found using the retrieve all reseller
2621//   subscriptions method.
2622func (r *SubscriptionsService) Delete(customerId string, subscriptionId string, deletionType string) *SubscriptionsDeleteCall {
2623	c := &SubscriptionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2624	c.customerId = customerId
2625	c.subscriptionId = subscriptionId
2626	c.urlParams_.Set("deletionType", deletionType)
2627	return c
2628}
2629
2630// Fields allows partial responses to be retrieved. See
2631// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2632// for more information.
2633func (c *SubscriptionsDeleteCall) Fields(s ...googleapi.Field) *SubscriptionsDeleteCall {
2634	c.urlParams_.Set("fields", googleapi.CombineFields(s))
2635	return c
2636}
2637
2638// Context sets the context to be used in this call's Do method. Any
2639// pending HTTP request will be aborted if the provided context is
2640// canceled.
2641func (c *SubscriptionsDeleteCall) Context(ctx context.Context) *SubscriptionsDeleteCall {
2642	c.ctx_ = ctx
2643	return c
2644}
2645
2646// Header returns an http.Header that can be modified by the caller to
2647// add HTTP headers to the request.
2648func (c *SubscriptionsDeleteCall) Header() http.Header {
2649	if c.header_ == nil {
2650		c.header_ = make(http.Header)
2651	}
2652	return c.header_
2653}
2654
2655func (c *SubscriptionsDeleteCall) doRequest(alt string) (*http.Response, error) {
2656	reqHeaders := make(http.Header)
2657	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915")
2658	for k, v := range c.header_ {
2659		reqHeaders[k] = v
2660	}
2661	reqHeaders.Set("User-Agent", c.s.userAgent())
2662	var body io.Reader = nil
2663	c.urlParams_.Set("alt", alt)
2664	c.urlParams_.Set("prettyPrint", "false")
2665	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}")
2666	urls += "?" + c.urlParams_.Encode()
2667	req, err := http.NewRequest("DELETE", urls, body)
2668	if err != nil {
2669		return nil, err
2670	}
2671	req.Header = reqHeaders
2672	googleapi.Expand(req.URL, map[string]string{
2673		"customerId":     c.customerId,
2674		"subscriptionId": c.subscriptionId,
2675	})
2676	return gensupport.SendRequest(c.ctx_, c.s.client, req)
2677}
2678
2679// Do executes the "reseller.subscriptions.delete" call.
2680func (c *SubscriptionsDeleteCall) Do(opts ...googleapi.CallOption) error {
2681	gensupport.SetOptions(c.urlParams_, opts...)
2682	res, err := c.doRequest("json")
2683	if err != nil {
2684		return err
2685	}
2686	defer googleapi.CloseBody(res)
2687	if err := googleapi.CheckResponse(res); err != nil {
2688		return err
2689	}
2690	return nil
2691	// {
2692	//   "description": "Cancels, suspends, or transfers a subscription to direct.",
2693	//   "flatPath": "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}",
2694	//   "httpMethod": "DELETE",
2695	//   "id": "reseller.subscriptions.delete",
2696	//   "parameterOrder": [
2697	//     "customerId",
2698	//     "subscriptionId",
2699	//     "deletionType"
2700	//   ],
2701	//   "parameters": {
2702	//     "customerId": {
2703	//       "description": "Either the customer's primary domain name or the customer's unique identifier. If using the domain name, we do not recommend using a `customerId` as a key for persistent data. If the domain name for a `customerId` is changed, the Google system automatically updates.",
2704	//       "location": "path",
2705	//       "required": true,
2706	//       "type": "string"
2707	//     },
2708	//     "deletionType": {
2709	//       "description": "The `deletionType` query string enables the cancellation, downgrade, or suspension of a subscription.",
2710	//       "enum": [
2711	//         "deletion_type_undefined",
2712	//         "cancel",
2713	//         "transfer_to_direct"
2714	//       ],
2715	//       "enumDescriptions": [
2716	//         "",
2717	//         "Cancels the subscription immediately. This does not apply to a G Suite subscription.",
2718	//         "Transfers a subscription directly to Google. The customer is immediately transferred to a direct billing relationship with Google and is given a short amount of time with no service interruption. The customer can then choose to set up billing directly with Google by using a credit card, or they can transfer to another reseller."
2719	//       ],
2720	//       "location": "query",
2721	//       "required": true,
2722	//       "type": "string"
2723	//     },
2724	//     "subscriptionId": {
2725	//       "description": "This is a required property. The `subscriptionId` is the subscription identifier and is unique for each customer. Since a `subscriptionId` changes when a subscription is updated, we recommend to not use this ID as a key for persistent data. And the `subscriptionId` can be found using the retrieve all reseller subscriptions method.",
2726	//       "location": "path",
2727	//       "required": true,
2728	//       "type": "string"
2729	//     }
2730	//   },
2731	//   "path": "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}",
2732	//   "scopes": [
2733	//     "https://www.googleapis.com/auth/apps.order"
2734	//   ]
2735	// }
2736
2737}
2738
2739// method id "reseller.subscriptions.get":
2740
2741type SubscriptionsGetCall struct {
2742	s              *Service
2743	customerId     string
2744	subscriptionId string
2745	urlParams_     gensupport.URLParams
2746	ifNoneMatch_   string
2747	ctx_           context.Context
2748	header_        http.Header
2749}
2750
2751// Get: Gets a specific subscription. The `subscriptionId` can be found
2752// using the Retrieve all reseller subscriptions
2753// (/admin-sdk/reseller/v1/how-tos/manage_subscriptions#get_all_subscript
2754// ions) method. For more information about retrieving a specific
2755// subscription, see the information descrived in manage subscriptions
2756// (/admin-sdk/reseller/v1/how-tos/manage_subscriptions#get_subscription)
2757// .
2758//
2759// - customerId: Either the customer's primary domain name or the
2760//   customer's unique identifier. If using the domain name, we do not
2761//   recommend using a `customerId` as a key for persistent data. If the
2762//   domain name for a `customerId` is changed, the Google system
2763//   automatically updates.
2764// - subscriptionId: This is a required property. The `subscriptionId`
2765//   is the subscription identifier and is unique for each customer.
2766//   Since a `subscriptionId` changes when a subscription is updated, we
2767//   recommend to not use this ID as a key for persistent data. And the
2768//   `subscriptionId` can be found using the retrieve all reseller
2769//   subscriptions method.
2770func (r *SubscriptionsService) Get(customerId string, subscriptionId string) *SubscriptionsGetCall {
2771	c := &SubscriptionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2772	c.customerId = customerId
2773	c.subscriptionId = subscriptionId
2774	return c
2775}
2776
2777// Fields allows partial responses to be retrieved. See
2778// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2779// for more information.
2780func (c *SubscriptionsGetCall) Fields(s ...googleapi.Field) *SubscriptionsGetCall {
2781	c.urlParams_.Set("fields", googleapi.CombineFields(s))
2782	return c
2783}
2784
2785// IfNoneMatch sets the optional parameter which makes the operation
2786// fail if the object's ETag matches the given value. This is useful for
2787// getting updates only after the object has changed since the last
2788// request. Use googleapi.IsNotModified to check whether the response
2789// error from Do is the result of In-None-Match.
2790func (c *SubscriptionsGetCall) IfNoneMatch(entityTag string) *SubscriptionsGetCall {
2791	c.ifNoneMatch_ = entityTag
2792	return c
2793}
2794
2795// Context sets the context to be used in this call's Do method. Any
2796// pending HTTP request will be aborted if the provided context is
2797// canceled.
2798func (c *SubscriptionsGetCall) Context(ctx context.Context) *SubscriptionsGetCall {
2799	c.ctx_ = ctx
2800	return c
2801}
2802
2803// Header returns an http.Header that can be modified by the caller to
2804// add HTTP headers to the request.
2805func (c *SubscriptionsGetCall) Header() http.Header {
2806	if c.header_ == nil {
2807		c.header_ = make(http.Header)
2808	}
2809	return c.header_
2810}
2811
2812func (c *SubscriptionsGetCall) doRequest(alt string) (*http.Response, error) {
2813	reqHeaders := make(http.Header)
2814	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915")
2815	for k, v := range c.header_ {
2816		reqHeaders[k] = v
2817	}
2818	reqHeaders.Set("User-Agent", c.s.userAgent())
2819	if c.ifNoneMatch_ != "" {
2820		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2821	}
2822	var body io.Reader = nil
2823	c.urlParams_.Set("alt", alt)
2824	c.urlParams_.Set("prettyPrint", "false")
2825	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}")
2826	urls += "?" + c.urlParams_.Encode()
2827	req, err := http.NewRequest("GET", urls, body)
2828	if err != nil {
2829		return nil, err
2830	}
2831	req.Header = reqHeaders
2832	googleapi.Expand(req.URL, map[string]string{
2833		"customerId":     c.customerId,
2834		"subscriptionId": c.subscriptionId,
2835	})
2836	return gensupport.SendRequest(c.ctx_, c.s.client, req)
2837}
2838
2839// Do executes the "reseller.subscriptions.get" call.
2840// Exactly one of *Subscription or error will be non-nil. Any non-2xx
2841// status code is an error. Response headers are in either
2842// *Subscription.ServerResponse.Header or (if a response was returned at
2843// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
2844// to check whether the returned error was because
2845// http.StatusNotModified was returned.
2846func (c *SubscriptionsGetCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
2847	gensupport.SetOptions(c.urlParams_, opts...)
2848	res, err := c.doRequest("json")
2849	if res != nil && res.StatusCode == http.StatusNotModified {
2850		if res.Body != nil {
2851			res.Body.Close()
2852		}
2853		return nil, &googleapi.Error{
2854			Code:   res.StatusCode,
2855			Header: res.Header,
2856		}
2857	}
2858	if err != nil {
2859		return nil, err
2860	}
2861	defer googleapi.CloseBody(res)
2862	if err := googleapi.CheckResponse(res); err != nil {
2863		return nil, err
2864	}
2865	ret := &Subscription{
2866		ServerResponse: googleapi.ServerResponse{
2867			Header:         res.Header,
2868			HTTPStatusCode: res.StatusCode,
2869		},
2870	}
2871	target := &ret
2872	if err := gensupport.DecodeResponse(target, res); err != nil {
2873		return nil, err
2874	}
2875	return ret, nil
2876	// {
2877	//   "description": "Gets a specific subscription. The `subscriptionId` can be found using the [Retrieve all reseller subscriptions](/admin-sdk/reseller/v1/how-tos/manage_subscriptions#get_all_subscriptions) method. For more information about retrieving a specific subscription, see the information descrived in [manage subscriptions](/admin-sdk/reseller/v1/how-tos/manage_subscriptions#get_subscription).",
2878	//   "flatPath": "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}",
2879	//   "httpMethod": "GET",
2880	//   "id": "reseller.subscriptions.get",
2881	//   "parameterOrder": [
2882	//     "customerId",
2883	//     "subscriptionId"
2884	//   ],
2885	//   "parameters": {
2886	//     "customerId": {
2887	//       "description": "Either the customer's primary domain name or the customer's unique identifier. If using the domain name, we do not recommend using a `customerId` as a key for persistent data. If the domain name for a `customerId` is changed, the Google system automatically updates.",
2888	//       "location": "path",
2889	//       "required": true,
2890	//       "type": "string"
2891	//     },
2892	//     "subscriptionId": {
2893	//       "description": "This is a required property. The `subscriptionId` is the subscription identifier and is unique for each customer. Since a `subscriptionId` changes when a subscription is updated, we recommend to not use this ID as a key for persistent data. And the `subscriptionId` can be found using the retrieve all reseller subscriptions method.",
2894	//       "location": "path",
2895	//       "required": true,
2896	//       "type": "string"
2897	//     }
2898	//   },
2899	//   "path": "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}",
2900	//   "response": {
2901	//     "$ref": "Subscription"
2902	//   },
2903	//   "scopes": [
2904	//     "https://www.googleapis.com/auth/apps.order",
2905	//     "https://www.googleapis.com/auth/apps.order.readonly"
2906	//   ]
2907	// }
2908
2909}
2910
2911// method id "reseller.subscriptions.insert":
2912
2913type SubscriptionsInsertCall struct {
2914	s            *Service
2915	customerId   string
2916	subscription *Subscription
2917	urlParams_   gensupport.URLParams
2918	ctx_         context.Context
2919	header_      http.Header
2920}
2921
2922// Insert: Creates or transfer a subscription. Create a subscription for
2923// a customer's account that you ordered using the Order a new customer
2924// account (/admin-sdk/reseller/v1/reference/customers/insert.html)
2925// method. For more information about creating a subscription for
2926// different payment plans, see manage subscriptions
2927// (/admin-sdk/reseller/v1/how-tos/manage_subscriptions#create_subscripti
2928// on).\ If you did not order the customer's account using the customer
2929// insert method, use the customer's `customerAuthToken` when creating a
2930// subscription for that customer. If transferring a G Suite
2931// subscription with an associated Google Drive or Google Vault
2932// subscription, use the batch operation
2933// (/admin-sdk/reseller/v1/how-tos/batch.html) to transfer all of these
2934// subscriptions. For more information, see how to transfer
2935// subscriptions
2936// (/admin-sdk/reseller/v1/how-tos/manage_subscriptions#transfer_a_subscr
2937// iption).
2938//
2939// - customerId: Either the customer's primary domain name or the
2940//   customer's unique identifier. If using the domain name, we do not
2941//   recommend using a `customerId` as a key for persistent data. If the
2942//   domain name for a `customerId` is changed, the Google system
2943//   automatically updates.
2944func (r *SubscriptionsService) Insert(customerId string, subscription *Subscription) *SubscriptionsInsertCall {
2945	c := &SubscriptionsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2946	c.customerId = customerId
2947	c.subscription = subscription
2948	return c
2949}
2950
2951// CustomerAuthToken sets the optional parameter "customerAuthToken":
2952// The `customerAuthToken` query string is required when creating a
2953// resold account that transfers a direct customer's subscription or
2954// transfers another reseller customer's subscription to your reseller
2955// management. This is a hexadecimal authentication token needed to
2956// complete the subscription transfer. For more information, see the
2957// administrator help center.
2958func (c *SubscriptionsInsertCall) CustomerAuthToken(customerAuthToken string) *SubscriptionsInsertCall {
2959	c.urlParams_.Set("customerAuthToken", customerAuthToken)
2960	return c
2961}
2962
2963// Fields allows partial responses to be retrieved. See
2964// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2965// for more information.
2966func (c *SubscriptionsInsertCall) Fields(s ...googleapi.Field) *SubscriptionsInsertCall {
2967	c.urlParams_.Set("fields", googleapi.CombineFields(s))
2968	return c
2969}
2970
2971// Context sets the context to be used in this call's Do method. Any
2972// pending HTTP request will be aborted if the provided context is
2973// canceled.
2974func (c *SubscriptionsInsertCall) Context(ctx context.Context) *SubscriptionsInsertCall {
2975	c.ctx_ = ctx
2976	return c
2977}
2978
2979// Header returns an http.Header that can be modified by the caller to
2980// add HTTP headers to the request.
2981func (c *SubscriptionsInsertCall) Header() http.Header {
2982	if c.header_ == nil {
2983		c.header_ = make(http.Header)
2984	}
2985	return c.header_
2986}
2987
2988func (c *SubscriptionsInsertCall) doRequest(alt string) (*http.Response, error) {
2989	reqHeaders := make(http.Header)
2990	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915")
2991	for k, v := range c.header_ {
2992		reqHeaders[k] = v
2993	}
2994	reqHeaders.Set("User-Agent", c.s.userAgent())
2995	var body io.Reader = nil
2996	body, err := googleapi.WithoutDataWrapper.JSONReader(c.subscription)
2997	if err != nil {
2998		return nil, err
2999	}
3000	reqHeaders.Set("Content-Type", "application/json")
3001	c.urlParams_.Set("alt", alt)
3002	c.urlParams_.Set("prettyPrint", "false")
3003	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}/subscriptions")
3004	urls += "?" + c.urlParams_.Encode()
3005	req, err := http.NewRequest("POST", urls, body)
3006	if err != nil {
3007		return nil, err
3008	}
3009	req.Header = reqHeaders
3010	googleapi.Expand(req.URL, map[string]string{
3011		"customerId": c.customerId,
3012	})
3013	return gensupport.SendRequest(c.ctx_, c.s.client, req)
3014}
3015
3016// Do executes the "reseller.subscriptions.insert" call.
3017// Exactly one of *Subscription or error will be non-nil. Any non-2xx
3018// status code is an error. Response headers are in either
3019// *Subscription.ServerResponse.Header or (if a response was returned at
3020// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
3021// to check whether the returned error was because
3022// http.StatusNotModified was returned.
3023func (c *SubscriptionsInsertCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
3024	gensupport.SetOptions(c.urlParams_, opts...)
3025	res, err := c.doRequest("json")
3026	if res != nil && res.StatusCode == http.StatusNotModified {
3027		if res.Body != nil {
3028			res.Body.Close()
3029		}
3030		return nil, &googleapi.Error{
3031			Code:   res.StatusCode,
3032			Header: res.Header,
3033		}
3034	}
3035	if err != nil {
3036		return nil, err
3037	}
3038	defer googleapi.CloseBody(res)
3039	if err := googleapi.CheckResponse(res); err != nil {
3040		return nil, err
3041	}
3042	ret := &Subscription{
3043		ServerResponse: googleapi.ServerResponse{
3044			Header:         res.Header,
3045			HTTPStatusCode: res.StatusCode,
3046		},
3047	}
3048	target := &ret
3049	if err := gensupport.DecodeResponse(target, res); err != nil {
3050		return nil, err
3051	}
3052	return ret, nil
3053	// {
3054	//   "description": "Creates or transfer a subscription. Create a subscription for a customer's account that you ordered using the [Order a new customer account](/admin-sdk/reseller/v1/reference/customers/insert.html) method. For more information about creating a subscription for different payment plans, see [manage subscriptions](/admin-sdk/reseller/v1/how-tos/manage_subscriptions#create_subscription).\\ If you did not order the customer's account using the customer insert method, use the customer's `customerAuthToken` when creating a subscription for that customer. If transferring a G Suite subscription with an associated Google Drive or Google Vault subscription, use the [batch operation](/admin-sdk/reseller/v1/how-tos/batch.html) to transfer all of these subscriptions. For more information, see how to [transfer subscriptions](/admin-sdk/reseller/v1/how-tos/manage_subscriptions#transfer_a_subscription).",
3055	//   "flatPath": "apps/reseller/v1/customers/{customerId}/subscriptions",
3056	//   "httpMethod": "POST",
3057	//   "id": "reseller.subscriptions.insert",
3058	//   "parameterOrder": [
3059	//     "customerId"
3060	//   ],
3061	//   "parameters": {
3062	//     "customerAuthToken": {
3063	//       "description": "The `customerAuthToken` query string is required when creating a resold account that transfers a direct customer's subscription or transfers another reseller customer's subscription to your reseller management. This is a hexadecimal authentication token needed to complete the subscription transfer. For more information, see the administrator help center.",
3064	//       "location": "query",
3065	//       "type": "string"
3066	//     },
3067	//     "customerId": {
3068	//       "description": "Either the customer's primary domain name or the customer's unique identifier. If using the domain name, we do not recommend using a `customerId` as a key for persistent data. If the domain name for a `customerId` is changed, the Google system automatically updates.",
3069	//       "location": "path",
3070	//       "required": true,
3071	//       "type": "string"
3072	//     }
3073	//   },
3074	//   "path": "apps/reseller/v1/customers/{customerId}/subscriptions",
3075	//   "request": {
3076	//     "$ref": "Subscription"
3077	//   },
3078	//   "response": {
3079	//     "$ref": "Subscription"
3080	//   },
3081	//   "scopes": [
3082	//     "https://www.googleapis.com/auth/apps.order"
3083	//   ]
3084	// }
3085
3086}
3087
3088// method id "reseller.subscriptions.list":
3089
3090type SubscriptionsListCall struct {
3091	s            *Service
3092	urlParams_   gensupport.URLParams
3093	ifNoneMatch_ string
3094	ctx_         context.Context
3095	header_      http.Header
3096}
3097
3098// List: Lists of subscriptions managed by the reseller. The list can be
3099// all subscriptions, all of a customer's subscriptions, or all of a
3100// customer's transferable subscriptions. Optionally, this method can
3101// filter the response by a `customerNamePrefix`. For more information,
3102// see manage subscriptions
3103// (/admin-sdk/reseller/v1/how-tos/manage_subscriptions).
3104func (r *SubscriptionsService) List() *SubscriptionsListCall {
3105	c := &SubscriptionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3106	return c
3107}
3108
3109// CustomerAuthToken sets the optional parameter "customerAuthToken":
3110// The `customerAuthToken` query string is required when creating a
3111// resold account that transfers a direct customer's subscription or
3112// transfers another reseller customer's subscription to your reseller
3113// management. This is a hexadecimal authentication token needed to
3114// complete the subscription transfer. For more information, see the
3115// administrator help center.
3116func (c *SubscriptionsListCall) CustomerAuthToken(customerAuthToken string) *SubscriptionsListCall {
3117	c.urlParams_.Set("customerAuthToken", customerAuthToken)
3118	return c
3119}
3120
3121// CustomerId sets the optional parameter "customerId": Either the
3122// customer's primary domain name or the customer's unique identifier.
3123// If using the domain name, we do not recommend using a `customerId` as
3124// a key for persistent data. If the domain name for a `customerId` is
3125// changed, the Google system automatically updates.
3126func (c *SubscriptionsListCall) CustomerId(customerId string) *SubscriptionsListCall {
3127	c.urlParams_.Set("customerId", customerId)
3128	return c
3129}
3130
3131// CustomerNamePrefix sets the optional parameter "customerNamePrefix":
3132// When retrieving all of your subscriptions and filtering for specific
3133// customers, you can enter a prefix for a customer name. Using an
3134// example customer group that includes `exam.com`, `example20.com` and
3135// `example.com`: - `exa` -- Returns all customer names that start with
3136// 'exa' which could include `exam.com`, `example20.com`, and
3137// `example.com`. A name prefix is similar to using a regular
3138// expression's asterisk, exa*. - `example` -- Returns `example20.com`
3139// and `example.com`.
3140func (c *SubscriptionsListCall) CustomerNamePrefix(customerNamePrefix string) *SubscriptionsListCall {
3141	c.urlParams_.Set("customerNamePrefix", customerNamePrefix)
3142	return c
3143}
3144
3145// MaxResults sets the optional parameter "maxResults": When retrieving
3146// a large list, the `maxResults` is the maximum number of results per
3147// page. The `nextPageToken` value takes you to the next page. The
3148// default is 20.
3149func (c *SubscriptionsListCall) MaxResults(maxResults int64) *SubscriptionsListCall {
3150	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
3151	return c
3152}
3153
3154// PageToken sets the optional parameter "pageToken": Token to specify
3155// next page in the list
3156func (c *SubscriptionsListCall) PageToken(pageToken string) *SubscriptionsListCall {
3157	c.urlParams_.Set("pageToken", pageToken)
3158	return c
3159}
3160
3161// Fields allows partial responses to be retrieved. See
3162// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
3163// for more information.
3164func (c *SubscriptionsListCall) Fields(s ...googleapi.Field) *SubscriptionsListCall {
3165	c.urlParams_.Set("fields", googleapi.CombineFields(s))
3166	return c
3167}
3168
3169// IfNoneMatch sets the optional parameter which makes the operation
3170// fail if the object's ETag matches the given value. This is useful for
3171// getting updates only after the object has changed since the last
3172// request. Use googleapi.IsNotModified to check whether the response
3173// error from Do is the result of In-None-Match.
3174func (c *SubscriptionsListCall) IfNoneMatch(entityTag string) *SubscriptionsListCall {
3175	c.ifNoneMatch_ = entityTag
3176	return c
3177}
3178
3179// Context sets the context to be used in this call's Do method. Any
3180// pending HTTP request will be aborted if the provided context is
3181// canceled.
3182func (c *SubscriptionsListCall) Context(ctx context.Context) *SubscriptionsListCall {
3183	c.ctx_ = ctx
3184	return c
3185}
3186
3187// Header returns an http.Header that can be modified by the caller to
3188// add HTTP headers to the request.
3189func (c *SubscriptionsListCall) Header() http.Header {
3190	if c.header_ == nil {
3191		c.header_ = make(http.Header)
3192	}
3193	return c.header_
3194}
3195
3196func (c *SubscriptionsListCall) doRequest(alt string) (*http.Response, error) {
3197	reqHeaders := make(http.Header)
3198	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915")
3199	for k, v := range c.header_ {
3200		reqHeaders[k] = v
3201	}
3202	reqHeaders.Set("User-Agent", c.s.userAgent())
3203	if c.ifNoneMatch_ != "" {
3204		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
3205	}
3206	var body io.Reader = nil
3207	c.urlParams_.Set("alt", alt)
3208	c.urlParams_.Set("prettyPrint", "false")
3209	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/subscriptions")
3210	urls += "?" + c.urlParams_.Encode()
3211	req, err := http.NewRequest("GET", urls, body)
3212	if err != nil {
3213		return nil, err
3214	}
3215	req.Header = reqHeaders
3216	return gensupport.SendRequest(c.ctx_, c.s.client, req)
3217}
3218
3219// Do executes the "reseller.subscriptions.list" call.
3220// Exactly one of *Subscriptions or error will be non-nil. Any non-2xx
3221// status code is an error. Response headers are in either
3222// *Subscriptions.ServerResponse.Header or (if a response was returned
3223// at all) in error.(*googleapi.Error).Header. Use
3224// googleapi.IsNotModified to check whether the returned error was
3225// because http.StatusNotModified was returned.
3226func (c *SubscriptionsListCall) Do(opts ...googleapi.CallOption) (*Subscriptions, error) {
3227	gensupport.SetOptions(c.urlParams_, opts...)
3228	res, err := c.doRequest("json")
3229	if res != nil && res.StatusCode == http.StatusNotModified {
3230		if res.Body != nil {
3231			res.Body.Close()
3232		}
3233		return nil, &googleapi.Error{
3234			Code:   res.StatusCode,
3235			Header: res.Header,
3236		}
3237	}
3238	if err != nil {
3239		return nil, err
3240	}
3241	defer googleapi.CloseBody(res)
3242	if err := googleapi.CheckResponse(res); err != nil {
3243		return nil, err
3244	}
3245	ret := &Subscriptions{
3246		ServerResponse: googleapi.ServerResponse{
3247			Header:         res.Header,
3248			HTTPStatusCode: res.StatusCode,
3249		},
3250	}
3251	target := &ret
3252	if err := gensupport.DecodeResponse(target, res); err != nil {
3253		return nil, err
3254	}
3255	return ret, nil
3256	// {
3257	//   "description": "Lists of subscriptions managed by the reseller. The list can be all subscriptions, all of a customer's subscriptions, or all of a customer's transferable subscriptions. Optionally, this method can filter the response by a `customerNamePrefix`. For more information, see [manage subscriptions](/admin-sdk/reseller/v1/how-tos/manage_subscriptions).",
3258	//   "flatPath": "apps/reseller/v1/subscriptions",
3259	//   "httpMethod": "GET",
3260	//   "id": "reseller.subscriptions.list",
3261	//   "parameterOrder": [],
3262	//   "parameters": {
3263	//     "customerAuthToken": {
3264	//       "description": "The `customerAuthToken` query string is required when creating a resold account that transfers a direct customer's subscription or transfers another reseller customer's subscription to your reseller management. This is a hexadecimal authentication token needed to complete the subscription transfer. For more information, see the administrator help center.",
3265	//       "location": "query",
3266	//       "type": "string"
3267	//     },
3268	//     "customerId": {
3269	//       "description": "Either the customer's primary domain name or the customer's unique identifier. If using the domain name, we do not recommend using a `customerId` as a key for persistent data. If the domain name for a `customerId` is changed, the Google system automatically updates.",
3270	//       "location": "query",
3271	//       "type": "string"
3272	//     },
3273	//     "customerNamePrefix": {
3274	//       "description": "When retrieving all of your subscriptions and filtering for specific customers, you can enter a prefix for a customer name. Using an example customer group that includes `exam.com`, `example20.com` and `example.com`: - `exa` -- Returns all customer names that start with 'exa' which could include `exam.com`, `example20.com`, and `example.com`. A name prefix is similar to using a regular expression's asterisk, exa*. - `example` -- Returns `example20.com` and `example.com`. ",
3275	//       "location": "query",
3276	//       "type": "string"
3277	//     },
3278	//     "maxResults": {
3279	//       "description": "When retrieving a large list, the `maxResults` is the maximum number of results per page. The `nextPageToken` value takes you to the next page. The default is 20.",
3280	//       "format": "uint32",
3281	//       "location": "query",
3282	//       "maximum": "100",
3283	//       "minimum": "1",
3284	//       "type": "integer"
3285	//     },
3286	//     "pageToken": {
3287	//       "description": "Token to specify next page in the list",
3288	//       "location": "query",
3289	//       "type": "string"
3290	//     }
3291	//   },
3292	//   "path": "apps/reseller/v1/subscriptions",
3293	//   "response": {
3294	//     "$ref": "Subscriptions"
3295	//   },
3296	//   "scopes": [
3297	//     "https://www.googleapis.com/auth/apps.order",
3298	//     "https://www.googleapis.com/auth/apps.order.readonly"
3299	//   ]
3300	// }
3301
3302}
3303
3304// Pages invokes f for each page of results.
3305// A non-nil error returned from f will halt the iteration.
3306// The provided context supersedes any context provided to the Context method.
3307func (c *SubscriptionsListCall) Pages(ctx context.Context, f func(*Subscriptions) error) error {
3308	c.ctx_ = ctx
3309	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
3310	for {
3311		x, err := c.Do()
3312		if err != nil {
3313			return err
3314		}
3315		if err := f(x); err != nil {
3316			return err
3317		}
3318		if x.NextPageToken == "" {
3319			return nil
3320		}
3321		c.PageToken(x.NextPageToken)
3322	}
3323}
3324
3325// method id "reseller.subscriptions.startPaidService":
3326
3327type SubscriptionsStartPaidServiceCall struct {
3328	s              *Service
3329	customerId     string
3330	subscriptionId string
3331	urlParams_     gensupport.URLParams
3332	ctx_           context.Context
3333	header_        http.Header
3334}
3335
3336// StartPaidService: Immediately move a 30-day free trial subscription
3337// to a paid service subscription. This method is only applicable if a
3338// payment plan has already been set up for the 30-day trial
3339// subscription. For more information, see manage subscriptions
3340// (/admin-sdk/reseller/v1/how-tos/manage_subscriptions#paid_service).
3341//
3342// - customerId: Either the customer's primary domain name or the
3343//   customer's unique identifier. If using the domain name, we do not
3344//   recommend using a `customerId` as a key for persistent data. If the
3345//   domain name for a `customerId` is changed, the Google system
3346//   automatically updates.
3347// - subscriptionId: This is a required property. The `subscriptionId`
3348//   is the subscription identifier and is unique for each customer.
3349//   Since a `subscriptionId` changes when a subscription is updated, we
3350//   recommend to not use this ID as a key for persistent data. And the
3351//   `subscriptionId` can be found using the retrieve all reseller
3352//   subscriptions method.
3353func (r *SubscriptionsService) StartPaidService(customerId string, subscriptionId string) *SubscriptionsStartPaidServiceCall {
3354	c := &SubscriptionsStartPaidServiceCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3355	c.customerId = customerId
3356	c.subscriptionId = subscriptionId
3357	return c
3358}
3359
3360// Fields allows partial responses to be retrieved. See
3361// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
3362// for more information.
3363func (c *SubscriptionsStartPaidServiceCall) Fields(s ...googleapi.Field) *SubscriptionsStartPaidServiceCall {
3364	c.urlParams_.Set("fields", googleapi.CombineFields(s))
3365	return c
3366}
3367
3368// Context sets the context to be used in this call's Do method. Any
3369// pending HTTP request will be aborted if the provided context is
3370// canceled.
3371func (c *SubscriptionsStartPaidServiceCall) Context(ctx context.Context) *SubscriptionsStartPaidServiceCall {
3372	c.ctx_ = ctx
3373	return c
3374}
3375
3376// Header returns an http.Header that can be modified by the caller to
3377// add HTTP headers to the request.
3378func (c *SubscriptionsStartPaidServiceCall) Header() http.Header {
3379	if c.header_ == nil {
3380		c.header_ = make(http.Header)
3381	}
3382	return c.header_
3383}
3384
3385func (c *SubscriptionsStartPaidServiceCall) doRequest(alt string) (*http.Response, error) {
3386	reqHeaders := make(http.Header)
3387	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915")
3388	for k, v := range c.header_ {
3389		reqHeaders[k] = v
3390	}
3391	reqHeaders.Set("User-Agent", c.s.userAgent())
3392	var body io.Reader = nil
3393	c.urlParams_.Set("alt", alt)
3394	c.urlParams_.Set("prettyPrint", "false")
3395	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/startPaidService")
3396	urls += "?" + c.urlParams_.Encode()
3397	req, err := http.NewRequest("POST", urls, body)
3398	if err != nil {
3399		return nil, err
3400	}
3401	req.Header = reqHeaders
3402	googleapi.Expand(req.URL, map[string]string{
3403		"customerId":     c.customerId,
3404		"subscriptionId": c.subscriptionId,
3405	})
3406	return gensupport.SendRequest(c.ctx_, c.s.client, req)
3407}
3408
3409// Do executes the "reseller.subscriptions.startPaidService" call.
3410// Exactly one of *Subscription or error will be non-nil. Any non-2xx
3411// status code is an error. Response headers are in either
3412// *Subscription.ServerResponse.Header or (if a response was returned at
3413// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
3414// to check whether the returned error was because
3415// http.StatusNotModified was returned.
3416func (c *SubscriptionsStartPaidServiceCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
3417	gensupport.SetOptions(c.urlParams_, opts...)
3418	res, err := c.doRequest("json")
3419	if res != nil && res.StatusCode == http.StatusNotModified {
3420		if res.Body != nil {
3421			res.Body.Close()
3422		}
3423		return nil, &googleapi.Error{
3424			Code:   res.StatusCode,
3425			Header: res.Header,
3426		}
3427	}
3428	if err != nil {
3429		return nil, err
3430	}
3431	defer googleapi.CloseBody(res)
3432	if err := googleapi.CheckResponse(res); err != nil {
3433		return nil, err
3434	}
3435	ret := &Subscription{
3436		ServerResponse: googleapi.ServerResponse{
3437			Header:         res.Header,
3438			HTTPStatusCode: res.StatusCode,
3439		},
3440	}
3441	target := &ret
3442	if err := gensupport.DecodeResponse(target, res); err != nil {
3443		return nil, err
3444	}
3445	return ret, nil
3446	// {
3447	//   "description": "Immediately move a 30-day free trial subscription to a paid service subscription. This method is only applicable if a payment plan has already been set up for the 30-day trial subscription. For more information, see [manage subscriptions](/admin-sdk/reseller/v1/how-tos/manage_subscriptions#paid_service).",
3448	//   "flatPath": "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/startPaidService",
3449	//   "httpMethod": "POST",
3450	//   "id": "reseller.subscriptions.startPaidService",
3451	//   "parameterOrder": [
3452	//     "customerId",
3453	//     "subscriptionId"
3454	//   ],
3455	//   "parameters": {
3456	//     "customerId": {
3457	//       "description": "Either the customer's primary domain name or the customer's unique identifier. If using the domain name, we do not recommend using a `customerId` as a key for persistent data. If the domain name for a `customerId` is changed, the Google system automatically updates.",
3458	//       "location": "path",
3459	//       "required": true,
3460	//       "type": "string"
3461	//     },
3462	//     "subscriptionId": {
3463	//       "description": "This is a required property. The `subscriptionId` is the subscription identifier and is unique for each customer. Since a `subscriptionId` changes when a subscription is updated, we recommend to not use this ID as a key for persistent data. And the `subscriptionId` can be found using the retrieve all reseller subscriptions method.",
3464	//       "location": "path",
3465	//       "required": true,
3466	//       "type": "string"
3467	//     }
3468	//   },
3469	//   "path": "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/startPaidService",
3470	//   "response": {
3471	//     "$ref": "Subscription"
3472	//   },
3473	//   "scopes": [
3474	//     "https://www.googleapis.com/auth/apps.order"
3475	//   ]
3476	// }
3477
3478}
3479
3480// method id "reseller.subscriptions.suspend":
3481
3482type SubscriptionsSuspendCall struct {
3483	s              *Service
3484	customerId     string
3485	subscriptionId string
3486	urlParams_     gensupport.URLParams
3487	ctx_           context.Context
3488	header_        http.Header
3489}
3490
3491// Suspend: Suspends an active subscription. You can use this method to
3492// suspend a paid subscription that is currently in the `ACTIVE` state.
3493// * For `FLEXIBLE` subscriptions, billing is paused. * For
3494// `ANNUAL_MONTHLY_PAY` or `ANNUAL_YEARLY_PAY` subscriptions: *
3495// Suspending the subscription does not change the renewal date that was
3496// originally committed to. * A suspended subscription does not renew.
3497// If you activate the subscription after the original renewal date, a
3498// new annual subscription will be created, starting on the day of
3499// activation. We strongly encourage you to suspend subscriptions only
3500// for short periods of time as suspensions over 60 days may result in
3501// the subscription being cancelled.
3502//
3503// - customerId: Either the customer's primary domain name or the
3504//   customer's unique identifier. If using the domain name, we do not
3505//   recommend using a `customerId` as a key for persistent data. If the
3506//   domain name for a `customerId` is changed, the Google system
3507//   automatically updates.
3508// - subscriptionId: This is a required property. The `subscriptionId`
3509//   is the subscription identifier and is unique for each customer.
3510//   Since a `subscriptionId` changes when a subscription is updated, we
3511//   recommend to not use this ID as a key for persistent data. And the
3512//   `subscriptionId` can be found using the retrieve all reseller
3513//   subscriptions method.
3514func (r *SubscriptionsService) Suspend(customerId string, subscriptionId string) *SubscriptionsSuspendCall {
3515	c := &SubscriptionsSuspendCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3516	c.customerId = customerId
3517	c.subscriptionId = subscriptionId
3518	return c
3519}
3520
3521// Fields allows partial responses to be retrieved. See
3522// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
3523// for more information.
3524func (c *SubscriptionsSuspendCall) Fields(s ...googleapi.Field) *SubscriptionsSuspendCall {
3525	c.urlParams_.Set("fields", googleapi.CombineFields(s))
3526	return c
3527}
3528
3529// Context sets the context to be used in this call's Do method. Any
3530// pending HTTP request will be aborted if the provided context is
3531// canceled.
3532func (c *SubscriptionsSuspendCall) Context(ctx context.Context) *SubscriptionsSuspendCall {
3533	c.ctx_ = ctx
3534	return c
3535}
3536
3537// Header returns an http.Header that can be modified by the caller to
3538// add HTTP headers to the request.
3539func (c *SubscriptionsSuspendCall) Header() http.Header {
3540	if c.header_ == nil {
3541		c.header_ = make(http.Header)
3542	}
3543	return c.header_
3544}
3545
3546func (c *SubscriptionsSuspendCall) doRequest(alt string) (*http.Response, error) {
3547	reqHeaders := make(http.Header)
3548	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915")
3549	for k, v := range c.header_ {
3550		reqHeaders[k] = v
3551	}
3552	reqHeaders.Set("User-Agent", c.s.userAgent())
3553	var body io.Reader = nil
3554	c.urlParams_.Set("alt", alt)
3555	c.urlParams_.Set("prettyPrint", "false")
3556	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/suspend")
3557	urls += "?" + c.urlParams_.Encode()
3558	req, err := http.NewRequest("POST", urls, body)
3559	if err != nil {
3560		return nil, err
3561	}
3562	req.Header = reqHeaders
3563	googleapi.Expand(req.URL, map[string]string{
3564		"customerId":     c.customerId,
3565		"subscriptionId": c.subscriptionId,
3566	})
3567	return gensupport.SendRequest(c.ctx_, c.s.client, req)
3568}
3569
3570// Do executes the "reseller.subscriptions.suspend" call.
3571// Exactly one of *Subscription or error will be non-nil. Any non-2xx
3572// status code is an error. Response headers are in either
3573// *Subscription.ServerResponse.Header or (if a response was returned at
3574// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
3575// to check whether the returned error was because
3576// http.StatusNotModified was returned.
3577func (c *SubscriptionsSuspendCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
3578	gensupport.SetOptions(c.urlParams_, opts...)
3579	res, err := c.doRequest("json")
3580	if res != nil && res.StatusCode == http.StatusNotModified {
3581		if res.Body != nil {
3582			res.Body.Close()
3583		}
3584		return nil, &googleapi.Error{
3585			Code:   res.StatusCode,
3586			Header: res.Header,
3587		}
3588	}
3589	if err != nil {
3590		return nil, err
3591	}
3592	defer googleapi.CloseBody(res)
3593	if err := googleapi.CheckResponse(res); err != nil {
3594		return nil, err
3595	}
3596	ret := &Subscription{
3597		ServerResponse: googleapi.ServerResponse{
3598			Header:         res.Header,
3599			HTTPStatusCode: res.StatusCode,
3600		},
3601	}
3602	target := &ret
3603	if err := gensupport.DecodeResponse(target, res); err != nil {
3604		return nil, err
3605	}
3606	return ret, nil
3607	// {
3608	//   "description": "Suspends an active subscription. You can use this method to suspend a paid subscription that is currently in the `ACTIVE` state. * For `FLEXIBLE` subscriptions, billing is paused. * For `ANNUAL_MONTHLY_PAY` or `ANNUAL_YEARLY_PAY` subscriptions: * Suspending the subscription does not change the renewal date that was originally committed to. * A suspended subscription does not renew. If you activate the subscription after the original renewal date, a new annual subscription will be created, starting on the day of activation. We strongly encourage you to suspend subscriptions only for short periods of time as suspensions over 60 days may result in the subscription being cancelled.",
3609	//   "flatPath": "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/suspend",
3610	//   "httpMethod": "POST",
3611	//   "id": "reseller.subscriptions.suspend",
3612	//   "parameterOrder": [
3613	//     "customerId",
3614	//     "subscriptionId"
3615	//   ],
3616	//   "parameters": {
3617	//     "customerId": {
3618	//       "description": "Either the customer's primary domain name or the customer's unique identifier. If using the domain name, we do not recommend using a `customerId` as a key for persistent data. If the domain name for a `customerId` is changed, the Google system automatically updates.",
3619	//       "location": "path",
3620	//       "required": true,
3621	//       "type": "string"
3622	//     },
3623	//     "subscriptionId": {
3624	//       "description": "This is a required property. The `subscriptionId` is the subscription identifier and is unique for each customer. Since a `subscriptionId` changes when a subscription is updated, we recommend to not use this ID as a key for persistent data. And the `subscriptionId` can be found using the retrieve all reseller subscriptions method.",
3625	//       "location": "path",
3626	//       "required": true,
3627	//       "type": "string"
3628	//     }
3629	//   },
3630	//   "path": "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/suspend",
3631	//   "response": {
3632	//     "$ref": "Subscription"
3633	//   },
3634	//   "scopes": [
3635	//     "https://www.googleapis.com/auth/apps.order"
3636	//   ]
3637	// }
3638
3639}
3640