Debian Codegraph @

paymentsresellersubscription/v1/paymentsresellersubscription-gen.go

raw symbols SCIP
1 // Copyright 2026 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 paymentsresellersubscription provides access to the Payments Reseller Subscription API.
8 //
9 // For product documentation, see: https://developers.google.com/payments/reseller/subscription/
10 //
11 // # Library status
12 //
13 // These client libraries are officially supported by Google. However, this
14 // library is considered complete and is in maintenance mode. This means
15 // that we will address critical bugs and security issues but will not add
16 // any new features.
17 //
18 // When possible, we recommend using our newer
19 // [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go)
20 // that are still actively being worked and iterated on.
21 //
22 // # Creating a client
23 //
24 // Usage example:
25 //
26 // import "google.golang.org/api/paymentsresellersubscription/v1"
27 // ...
28 // ctx := context.Background()
29 // paymentsresellersubscriptionService, err := paymentsresellersubscription.NewService(ctx)
30 //
31 // In this example, Google Application Default Credentials are used for
32 // authentication. For information on how to create and obtain Application
33 // Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
34 //
35 // # Other authentication options
36 //
37 // To use an API key for authentication (note: some APIs do not support API
38 // keys), use [google.golang.org/api/option.WithAPIKey]:
39 //
40 // paymentsresellersubscriptionService, err := paymentsresellersubscription.NewService(ctx, option.WithAPIKey("AIza..."))
41 //
42 // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth
43 // flow, use [google.golang.org/api/option.WithTokenSource]:
44 //
45 // config := &oauth2.Config{...}
46 // // ...
47 // token, err := config.Exchange(ctx, ...)
48 // paymentsresellersubscriptionService, err := paymentsresellersubscription.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
49 //
50 // See [google.golang.org/api/option.ClientOption] for details on options.
51 package paymentsresellersubscription // import "google.golang.org/api/paymentsresellersubscription/v1"
52
53 import (
54 "bytes"
55 "context"
56 "encoding/json"
57 "errors"
58 "fmt"
59 "io"
60 "log/slog"
61 "net/http"
62 "net/url"
63 "strconv"
64 "strings"
65
66 "github.com/googleapis/gax-go/v2/internallog"
67 googleapi "google.golang.org/api/googleapi"
68 internal "google.golang.org/api/internal"
69 gensupport "google.golang.org/api/internal/gensupport"
70 option "google.golang.org/api/option"
71 internaloption "google.golang.org/api/option/internaloption"
72 htransport "google.golang.org/api/transport/http"
73 )
74
75 // Always reference these packages, just in case the auto-generated code
76 // below doesn't.
77 var _ = bytes.NewBuffer
78 var _ = strconv.Itoa
79 var _ = fmt.Sprintf
80 var _ = json.NewDecoder
81 var _ = io.Copy
82 var _ = url.Parse
83 var _ = gensupport.MarshalJSON
84 var _ = googleapi.Version
85 var _ = errors.New
86 var _ = strings.Replace
87 var _ = context.Canceled
88 var _ = internaloption.WithDefaultEndpoint
89 var _ = internal.Version
90 var _ = internallog.New
91
92 const apiId = "paymentsresellersubscription:v1"
93 const apiName = "paymentsresellersubscription"
94 const apiVersion = "v1"
95 const basePath = "https://paymentsresellersubscription.googleapis.com/"
96 const basePathTemplate = "https://paymentsresellersubscription.UNIVERSE_DOMAIN/"
97 const mtlsBasePath = "https://paymentsresellersubscription.mtls.googleapis.com/"
98
99 // OAuth2 scopes used by this API.
100 const (
101 // See and/or control the devices that you selected
102 SdmServiceScope = "https://www.googleapis.com/auth/sdm.service"
103 )
104
105 // NewService creates a new Service.
106 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
107 scopesOption := internaloption.WithDefaultScopes(
108 "https://www.googleapis.com/auth/sdm.service",
109 )
110 // NOTE: prepend, so we don't override user-specified scopes.
111 opts = append([]option.ClientOption{scopesOption}, opts...)
112 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
113 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
114 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
115 opts = append(opts, internaloption.EnableNewAuthLibrary())
116 client, endpoint, err := htransport.NewClient(ctx, opts...)
117 if err != nil {
118 return nil, err
119 }
120 s := &Service{client: client, BasePath: basePath, logger: internaloption.GetLogger(opts)}
121 s.Partners = NewPartnersService(s)
122 if endpoint != "" {
123 s.BasePath = endpoint
124 }
125 return s, nil
126 }
127
128 // New creates a new Service. It uses the provided http.Client for requests.
129 //
130 // Deprecated: please use NewService instead.
131 // To provide a custom HTTP client, use option.WithHTTPClient.
132 // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
133 func New(client *http.Client) (*Service, error) {
134 if client == nil {
135 return nil, errors.New("client is nil")
136 }
137 return NewService(context.TODO(), option.WithHTTPClient(client))
138 }
139
140 type Service struct {
141 client *http.Client
142 logger *slog.Logger
143 BasePath string // API endpoint base URL
144 UserAgent string // optional additional User-Agent fragment
145
146 Partners *PartnersService
147 }
148
149 func (s *Service) userAgent() string {
150 if s.UserAgent == "" {
151 return googleapi.UserAgent
152 }
153 return googleapi.UserAgent + " " + s.UserAgent
154 }
155
156 func NewPartnersService(s *Service) *PartnersService {
157 rs := &PartnersService{s: s}
158 rs.Products = NewPartnersProductsService(s)
159 rs.Promotions = NewPartnersPromotionsService(s)
160 rs.Subscriptions = NewPartnersSubscriptionsService(s)
161 rs.UserSessions = NewPartnersUserSessionsService(s)
162 return rs
163 }
164
165 type PartnersService struct {
166 s *Service
167
168 Products *PartnersProductsService
169
170 Promotions *PartnersPromotionsService
171
172 Subscriptions *PartnersSubscriptionsService
173
174 UserSessions *PartnersUserSessionsService
175 }
176
177 func NewPartnersProductsService(s *Service) *PartnersProductsService {
178 rs := &PartnersProductsService{s: s}
179 return rs
180 }
181
182 type PartnersProductsService struct {
183 s *Service
184 }
185
186 func NewPartnersPromotionsService(s *Service) *PartnersPromotionsService {
187 rs := &PartnersPromotionsService{s: s}
188 return rs
189 }
190
191 type PartnersPromotionsService struct {
192 s *Service
193 }
194
195 func NewPartnersSubscriptionsService(s *Service) *PartnersSubscriptionsService {
196 rs := &PartnersSubscriptionsService{s: s}
197 rs.LineItems = NewPartnersSubscriptionsLineItemsService(s)
198 return rs
199 }
200
201 type PartnersSubscriptionsService struct {
202 s *Service
203
204 LineItems *PartnersSubscriptionsLineItemsService
205 }
206
207 func NewPartnersSubscriptionsLineItemsService(s *Service) *PartnersSubscriptionsLineItemsService {
208 rs := &PartnersSubscriptionsLineItemsService{s: s}
209 return rs
210 }
211
212 type PartnersSubscriptionsLineItemsService struct {
213 s *Service
214 }
215
216 func NewPartnersUserSessionsService(s *Service) *PartnersUserSessionsService {
217 rs := &PartnersUserSessionsService{s: s}
218 return rs
219 }
220
221 type PartnersUserSessionsService struct {
222 s *Service
223 }
224
225 // Amount: Describes the amount unit including the currency code.
226 type Amount struct {
227 // AmountMicros: Required. Amount in micros (1_000_000 micros = 1 currency
228 // unit)
229 AmountMicros int64 `json:"amountMicros,omitempty,string"`
230 // CurrencyCode: Required. Currency codes in accordance with [ISO-4217 Currency
231 // Codes] (https://en.wikipedia.org/wiki/ISO_4217). For example, USD.
232 CurrencyCode string `json:"currencyCode,omitempty"`
233 // ForceSendFields is a list of field names (e.g. "AmountMicros") to
234 // unconditionally include in API requests. By default, fields with empty or
235 // default values are omitted from API requests. See
236 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
237 // details.
238 ForceSendFields []string `json:"-"`
239 // NullFields is a list of field names (e.g. "AmountMicros") to include in API
240 // requests with the JSON null value. By default, fields with empty values are
241 // omitted from API requests. See
242 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
243 NullFields []string `json:"-"`
244 }
245
246 func (s Amount) MarshalJSON() ([]byte, error) {
247 type NoMethod Amount
248 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
249 }
250
251 // CancelSubscriptionRequest: Request to cancel a subscription.
252 type CancelSubscriptionRequest struct {
253 // CancelImmediately: Optional. If true, Google will cancel the subscription
254 // immediately, and may or may not (based on the contract) issue a prorated
255 // refund for the remainder of the billing cycle. Otherwise, Google defers the
256 // cancellation at renewal_time, and will not issue a refund. - YouTube
257 // subscriptions must use this option currently. However, the user will still
258 // have access to the subscription until the end of the billing cycle.
259 CancelImmediately bool `json:"cancelImmediately,omitempty"`
260 // CancellationReason: Specifies the reason for the cancellation.
261 //
262 // Possible values:
263 // "CANCELLATION_REASON_UNSPECIFIED" - Reason is unspecified. Should not be
264 // used.
265 // "CANCELLATION_REASON_FRAUD" - Fraudulent transaction.
266 // "CANCELLATION_REASON_REMORSE" - Buyer's remorse.
267 // "CANCELLATION_REASON_ACCIDENTAL_PURCHASE" - Accidental purchase.
268 // "CANCELLATION_REASON_PAST_DUE" - Payment is past due.
269 // "CANCELLATION_REASON_ACCOUNT_CLOSED" - Used for notification only, do not
270 // use in Cancel API. User account closed.
271 // "CANCELLATION_REASON_UPGRADE_DOWNGRADE" - Used for notification only, do
272 // not use in Cancel API. Cancellation due to upgrade or downgrade.
273 // "CANCELLATION_REASON_USER_DELINQUENCY" - Cancellation due to user
274 // delinquency
275 // "CANCELLATION_REASON_SYSTEM_ERROR" - Used for notification only, do not
276 // use in Cancel API. Cancellation due to an unrecoverable system error.
277 // "CANCELLATION_REASON_SYSTEM_CANCEL" - Used for notification only, do not
278 // use in Cancel API. The subscription is cancelled by Google automatically
279 // since it is no longer valid.
280 // "CANCELLATION_REASON_BILLING_SYSTEM_SWITCH" - Cancellation due to a
281 // billing system switch.
282 // "CANCELLATION_REASON_OTHER" - Other reason.
283 CancellationReason string `json:"cancellationReason,omitempty"`
284 // ForceSendFields is a list of field names (e.g. "CancelImmediately") to
285 // unconditionally include in API requests. By default, fields with empty or
286 // default values are omitted from API requests. See
287 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
288 // details.
289 ForceSendFields []string `json:"-"`
290 // NullFields is a list of field names (e.g. "CancelImmediately") to include in
291 // API requests with the JSON null value. By default, fields with empty values
292 // are omitted from API requests. See
293 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
294 NullFields []string `json:"-"`
295 }
296
297 func (s CancelSubscriptionRequest) MarshalJSON() ([]byte, error) {
298 type NoMethod CancelSubscriptionRequest
299 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
300 }
301
302 // CancelSubscriptionResponse: Response that contains the cancelled
303 // subscription resource.
304 type CancelSubscriptionResponse struct {
305 // Subscription: The cancelled subscription resource.
306 Subscription *Subscription `json:"subscription,omitempty"`
307
308 // ServerResponse contains the HTTP response code and headers from the server.
309 googleapi.ServerResponse `json:"-"`
310 // ForceSendFields is a list of field names (e.g. "Subscription") to
311 // unconditionally include in API requests. By default, fields with empty or
312 // default values are omitted from API requests. See
313 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
314 // details.
315 ForceSendFields []string `json:"-"`
316 // NullFields is a list of field names (e.g. "Subscription") to include in API
317 // requests with the JSON null value. By default, fields with empty values are
318 // omitted from API requests. See
319 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
320 NullFields []string `json:"-"`
321 }
322
323 func (s CancelSubscriptionResponse) MarshalJSON() ([]byte, error) {
324 type NoMethod CancelSubscriptionResponse
325 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
326 }
327
328 // CreateSubscriptionIntent: Intent message for creating a Subscription
329 // resource.
330 type CreateSubscriptionIntent struct {
331 // CycleOptions: Optional. The cycle options for the subscription.
332 CycleOptions *CycleOptions `json:"cycleOptions,omitempty"`
333 // Parent: Required. The parent resource name, which is the identifier of the
334 // partner.
335 Parent string `json:"parent,omitempty"`
336 // Subscription: Required. The Subscription to be created.
337 Subscription *Subscription `json:"subscription,omitempty"`
338 // SubscriptionId: Required. Identifies the subscription resource on the
339 // Partner side. The value is restricted to 63 ASCII characters at the maximum.
340 // If a subscription was previously created with the same subscription_id, we
341 // will directly return that one.
342 SubscriptionId string `json:"subscriptionId,omitempty"`
343 // ForceSendFields is a list of field names (e.g. "CycleOptions") to
344 // unconditionally include in API requests. By default, fields with empty or
345 // default values are omitted from API requests. See
346 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
347 // details.
348 ForceSendFields []string `json:"-"`
349 // NullFields is a list of field names (e.g. "CycleOptions") to include in API
350 // requests with the JSON null value. By default, fields with empty values are
351 // omitted from API requests. See
352 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
353 NullFields []string `json:"-"`
354 }
355
356 func (s CreateSubscriptionIntent) MarshalJSON() ([]byte, error) {
357 type NoMethod CreateSubscriptionIntent
358 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
359 }
360
361 // CycleOptions: The cycle options when starting and resuming a subscription.
362 type CycleOptions struct {
363 // InitialCycleDuration: Optional. The duration of the initial cycle. Only
364 // `DAY` is supported. If set, Google will start the subscription with this
365 // initial cycle duration starting at the request time (see available methods
366 // below). A prorated charge will be applied. This option is available to the
367 // following methods: - partners.subscriptions.provision -
368 // partners.subscriptions.resume - partners.userSessions.generate
369 InitialCycleDuration *Duration `json:"initialCycleDuration,omitempty"`
370 // ForceSendFields is a list of field names (e.g. "InitialCycleDuration") to
371 // unconditionally include in API requests. By default, fields with empty or
372 // default values are omitted from API requests. See
373 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
374 // details.
375 ForceSendFields []string `json:"-"`
376 // NullFields is a list of field names (e.g. "InitialCycleDuration") to include
377 // in API requests with the JSON null value. By default, fields with empty
378 // values are omitted from API requests. See
379 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
380 NullFields []string `json:"-"`
381 }
382
383 func (s CycleOptions) MarshalJSON() ([]byte, error) {
384 type NoMethod CycleOptions
385 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
386 }
387
388 // Duration: Describes the length of a period of a time.
389 type Duration struct {
390 // Count: number of duration units to be included.
391 Count int64 `json:"count,omitempty"`
392 // Unit: The unit used for the duration
393 //
394 // Possible values:
395 // "UNIT_UNSPECIFIED" - Default value, reserved as an invalid or an
396 // unexpected value.
397 // "MONTH" - Unit of a calendar month.
398 // "DAY" - Unit of a day.
399 // "HOUR" - Unit of an hour. It is used for testing.
400 Unit string `json:"unit,omitempty"`
401 // ForceSendFields is a list of field names (e.g. "Count") to unconditionally
402 // include in API requests. By default, fields with empty or default values are
403 // omitted from API requests. See
404 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
405 // details.
406 ForceSendFields []string `json:"-"`
407 // NullFields is a list of field names (e.g. "Count") to include in API
408 // requests with the JSON null value. By default, fields with empty values are
409 // omitted from API requests. See
410 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
411 NullFields []string `json:"-"`
412 }
413
414 func (s Duration) MarshalJSON() ([]byte, error) {
415 type NoMethod Duration
416 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
417 }
418
419 // EntitleSubscriptionIntent: Intent for entitling the previously provisioned
420 // subscription to an end user.
421 type EntitleSubscriptionIntent struct {
422 // Name: Required. The name of the subscription resource that is entitled to
423 // the current end user. It is in the format of
424 // "partners/{partner_id}/subscriptions/{subscriptionId}".
425 Name string `json:"name,omitempty"`
426 // ForceSendFields is a list of field names (e.g. "Name") to unconditionally
427 // include in API requests. By default, fields with empty or default values are
428 // omitted from API requests. See
429 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
430 // details.
431 ForceSendFields []string `json:"-"`
432 // NullFields is a list of field names (e.g. "Name") to include in API requests
433 // with the JSON null value. By default, fields with empty values are omitted
434 // from API requests. See
435 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
436 NullFields []string `json:"-"`
437 }
438
439 func (s EntitleSubscriptionIntent) MarshalJSON() ([]byte, error) {
440 type NoMethod EntitleSubscriptionIntent
441 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
442 }
443
444 // EntitleSubscriptionRequest: Partner request for entitling the previously
445 // provisioned subscription to an end user. The end user identity is inferred
446 // from the request OAuth context.
447 type EntitleSubscriptionRequest struct {
448 // LineItemEntitlementDetails: Optional. The line items to be entitled. If
449 // unspecified, all line items will be entitled.
450 LineItemEntitlementDetails []*EntitleSubscriptionRequestLineItemEntitlementDetails `json:"lineItemEntitlementDetails,omitempty"`
451 // ForceSendFields is a list of field names (e.g. "LineItemEntitlementDetails")
452 // to unconditionally include in API requests. By default, fields with empty or
453 // default values are omitted from API requests. See
454 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
455 // details.
456 ForceSendFields []string `json:"-"`
457 // NullFields is a list of field names (e.g. "LineItemEntitlementDetails") to
458 // include in API requests with the JSON null value. By default, fields with
459 // empty values are omitted from API requests. See
460 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
461 NullFields []string `json:"-"`
462 }
463
464 func (s EntitleSubscriptionRequest) MarshalJSON() ([]byte, error) {
465 type NoMethod EntitleSubscriptionRequest
466 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
467 }
468
469 // EntitleSubscriptionRequestLineItemEntitlementDetails: The details of the
470 // line item to be entitled.
471 type EntitleSubscriptionRequestLineItemEntitlementDetails struct {
472 // LineItemIndex: Required. The index of the line item to be entitled.
473 LineItemIndex int64 `json:"lineItemIndex,omitempty"`
474 // Products: Optional. Only applicable if the line item corresponds to a hard
475 // bundle. Product resource names that identify the bundle elements to be
476 // entitled in the line item. If unspecified, all bundle elements will be
477 // entitled. The format is 'partners/{partner_id}/products/{product_id}'.
478 Products []string `json:"products,omitempty"`
479 // ForceSendFields is a list of field names (e.g. "LineItemIndex") to
480 // unconditionally include in API requests. By default, fields with empty or
481 // default values are omitted from API requests. See
482 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
483 // details.
484 ForceSendFields []string `json:"-"`
485 // NullFields is a list of field names (e.g. "LineItemIndex") to include in API
486 // requests with the JSON null value. By default, fields with empty values are
487 // omitted from API requests. See
488 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
489 NullFields []string `json:"-"`
490 }
491
492 func (s EntitleSubscriptionRequestLineItemEntitlementDetails) MarshalJSON() ([]byte, error) {
493 type NoMethod EntitleSubscriptionRequestLineItemEntitlementDetails
494 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
495 }
496
497 // EntitleSubscriptionResponse: Response that contains the entitled
498 // subscription resource.
499 type EntitleSubscriptionResponse struct {
500 // Subscription: The subscription that has user linked to it.
501 Subscription *Subscription `json:"subscription,omitempty"`
502
503 // ServerResponse contains the HTTP response code and headers from the server.
504 googleapi.ServerResponse `json:"-"`
505 // ForceSendFields is a list of field names (e.g. "Subscription") to
506 // unconditionally include in API requests. By default, fields with empty or
507 // default values are omitted from API requests. See
508 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
509 // details.
510 ForceSendFields []string `json:"-"`
511 // NullFields is a list of field names (e.g. "Subscription") to include in API
512 // requests with the JSON null value. By default, fields with empty values are
513 // omitted from API requests. See
514 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
515 NullFields []string `json:"-"`
516 }
517
518 func (s EntitleSubscriptionResponse) MarshalJSON() ([]byte, error) {
519 type NoMethod EntitleSubscriptionResponse
520 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
521 }
522
523 // ExtendSubscriptionRequest: Request message for extending a Subscription
524 // resource. A new recurrence will be made based on the subscription schedule
525 // defined by the original product.
526 type ExtendSubscriptionRequest struct {
527 // Extension: Required. Specifies details of the extension. Currently, the
528 // duration of the extension must be exactly one billing cycle of the original
529 // subscription.
530 Extension *Extension `json:"extension,omitempty"`
531 // RequestId: Required. Restricted to 36 ASCII characters. A random UUID is
532 // recommended. The idempotency key for the request. The ID generation logic is
533 // controlled by the partner. request_id should be the same as on retries of
534 // the same request. A different request_id must be used for a extension of a
535 // different cycle.
536 RequestId string `json:"requestId,omitempty"`
537 // ForceSendFields is a list of field names (e.g. "Extension") to
538 // unconditionally include in API requests. By default, fields with empty or
539 // default values are omitted from API requests. See
540 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
541 // details.
542 ForceSendFields []string `json:"-"`
543 // NullFields is a list of field names (e.g. "Extension") to include in API
544 // requests with the JSON null value. By default, fields with empty values are
545 // omitted from API requests. See
546 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
547 NullFields []string `json:"-"`
548 }
549
550 func (s ExtendSubscriptionRequest) MarshalJSON() ([]byte, error) {
551 type NoMethod ExtendSubscriptionRequest
552 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
553 }
554
555 // ExtendSubscriptionResponse: Response that contains the timestamps after the
556 // extension.
557 type ExtendSubscriptionResponse struct {
558 // CycleEndTime: The time at which the subscription is expected to be extended,
559 // in ISO 8061 format. UTC timezone. Example,
560 // "cycleEndTime":"2019-08-31T17:28:54.564Z"
561 CycleEndTime string `json:"cycleEndTime,omitempty"`
562 // FreeTrialEndTime: End of the free trial period, in ISO 8061 format. UTC
563 // timezone. Example, "freeTrialEndTime":"2019-08-31T17:28:54.564Z" This time
564 // will be set the same as initial subscription creation time if no free trial
565 // period is offered to the partner.
566 FreeTrialEndTime string `json:"freeTrialEndTime,omitempty"`
567 // RenewalTime: Output only. The time at which the subscription is expected to
568 // be renewed by Google - a new charge will be incurred and the service
569 // entitlement will be renewed. A non-immediate cancellation will take place at
570 // this time too, before which, the service entitlement for the end user will
571 // remain valid. UTC timezone in ISO 8061 format. For example:
572 // "2019-08-31T17:28:54.564Z"
573 RenewalTime string `json:"renewalTime,omitempty"`
574
575 // ServerResponse contains the HTTP response code and headers from the server.
576 googleapi.ServerResponse `json:"-"`
577 // ForceSendFields is a list of field names (e.g. "CycleEndTime") to
578 // unconditionally include in API requests. By default, fields with empty or
579 // default values are omitted from API requests. See
580 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
581 // details.
582 ForceSendFields []string `json:"-"`
583 // NullFields is a list of field names (e.g. "CycleEndTime") to include in API
584 // requests with the JSON null value. By default, fields with empty values are
585 // omitted from API requests. See
586 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
587 NullFields []string `json:"-"`
588 }
589
590 func (s ExtendSubscriptionResponse) MarshalJSON() ([]byte, error) {
591 type NoMethod ExtendSubscriptionResponse
592 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
593 }
594
595 // Extension: Describes the details of an extension request.
596 type Extension struct {
597 // Duration: Required. Specifies the period of access the subscription should
598 // grant.
599 Duration *Duration `json:"duration,omitempty"`
600 // PartnerUserToken: Required. Identifier of the end-user in partner’s
601 // system.
602 PartnerUserToken string `json:"partnerUserToken,omitempty"`
603 // ForceSendFields is a list of field names (e.g. "Duration") to
604 // unconditionally include in API requests. By default, fields with empty or
605 // default values are omitted from API requests. See
606 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
607 // details.
608 ForceSendFields []string `json:"-"`
609 // NullFields is a list of field names (e.g. "Duration") to include in API
610 // requests with the JSON null value. By default, fields with empty values are
611 // omitted from API requests. See
612 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
613 NullFields []string `json:"-"`
614 }
615
616 func (s Extension) MarshalJSON() ([]byte, error) {
617 type NoMethod Extension
618 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
619 }
620
621 // FindEligiblePromotionsRequest: Request to find eligible promotions for the
622 // current user.
623 type FindEligiblePromotionsRequest struct {
624 // Filter: Optional. Specifies the filters for the promotion results. The
625 // syntax is defined in https://google.aip.dev/160 with the following caveats:
626 // 1. Only the following features are supported: - Logical operator `AND` -
627 // Comparison operator `=` (no wildcards `*`) - Traversal operator `.` - Has
628 // operator `:` (no wildcards `*`) 2. Only the following fields are supported:
629 // - `applicableProducts` - `regionCodes` -
630 // `youtubePayload.partnerEligibilityId` - `youtubePayload.postalCode` 3.
631 // Unless explicitly mentioned above, other features are not supported.
632 // Example: `applicableProducts:partners/partner1/products/product1 AND
633 // regionCodes:US AND youtubePayload.postalCode=94043 AND
634 // youtubePayload.partnerEligibilityId=eligibility-id`
635 Filter string `json:"filter,omitempty"`
636 // PageSize: Optional. The maximum number of promotions to return. The service
637 // may return fewer than this value. If unspecified, at most 50 promotions will
638 // be returned. The maximum value is 1000; values above 1000 will be coerced to
639 // 1000.
640 PageSize int64 `json:"pageSize,omitempty"`
641 // PageToken: Optional. A page token, received from a previous
642 // `FindEligiblePromotions` call. Provide this to retrieve the subsequent page.
643 // When paginating, all other parameters provided to `FindEligiblePromotions`
644 // must match the call that provided the page token.
645 PageToken string `json:"pageToken,omitempty"`
646 // ForceSendFields is a list of field names (e.g. "Filter") to unconditionally
647 // include in API requests. By default, fields with empty or default values are
648 // omitted from API requests. See
649 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
650 // details.
651 ForceSendFields []string `json:"-"`
652 // NullFields is a list of field names (e.g. "Filter") to include in API
653 // requests with the JSON null value. By default, fields with empty values are
654 // omitted from API requests. See
655 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
656 NullFields []string `json:"-"`
657 }
658
659 func (s FindEligiblePromotionsRequest) MarshalJSON() ([]byte, error) {
660 type NoMethod FindEligiblePromotionsRequest
661 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
662 }
663
664 // FindEligiblePromotionsResponse: Response containing the found promotions for
665 // the current user.
666 type FindEligiblePromotionsResponse struct {
667 // NextPageToken: A token, which can be sent as `page_token` to retrieve the
668 // next page. If this field is empty, there are no subsequent pages.
669 NextPageToken string `json:"nextPageToken,omitempty"`
670 // Promotions: The promotions for the current user.
671 Promotions []*Promotion `json:"promotions,omitempty"`
672
673 // ServerResponse contains the HTTP response code and headers from the server.
674 googleapi.ServerResponse `json:"-"`
675 // ForceSendFields is a list of field names (e.g. "NextPageToken") to
676 // unconditionally include in API requests. By default, fields with empty or
677 // default values are omitted from API requests. See
678 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
679 // details.
680 ForceSendFields []string `json:"-"`
681 // NullFields is a list of field names (e.g. "NextPageToken") to include in API
682 // requests with the JSON null value. By default, fields with empty values are
683 // omitted from API requests. See
684 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
685 NullFields []string `json:"-"`
686 }
687
688 func (s FindEligiblePromotionsResponse) MarshalJSON() ([]byte, error) {
689 type NoMethod FindEligiblePromotionsResponse
690 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
691 }
692
693 // FiniteBillingCycleDetails: Details for a subscription line item with finite
694 // billing cycles.
695 type FiniteBillingCycleDetails struct {
696 // BillingCycleCountLimit: The number of a subscription line item billing
697 // cycles after which billing will stop automatically.
698 BillingCycleCountLimit int64 `json:"billingCycleCountLimit,omitempty,string"`
699 // ForceSendFields is a list of field names (e.g. "BillingCycleCountLimit") to
700 // unconditionally include in API requests. By default, fields with empty or
701 // default values are omitted from API requests. See
702 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
703 // details.
704 ForceSendFields []string `json:"-"`
705 // NullFields is a list of field names (e.g. "BillingCycleCountLimit") to
706 // include in API requests with the JSON null value. By default, fields with
707 // empty values are omitted from API requests. See
708 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
709 NullFields []string `json:"-"`
710 }
711
712 func (s FiniteBillingCycleDetails) MarshalJSON() ([]byte, error) {
713 type NoMethod FiniteBillingCycleDetails
714 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
715 }
716
717 // GenerateUserSessionRequest: Request to generate a user session.
718 type GenerateUserSessionRequest struct {
719 // IntentPayload: The user intent to generate the user session.
720 IntentPayload *IntentPayload `json:"intentPayload,omitempty"`
721 // ForceSendFields is a list of field names (e.g. "IntentPayload") to
722 // unconditionally include in API requests. By default, fields with empty or
723 // default values are omitted from API requests. See
724 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
725 // details.
726 ForceSendFields []string `json:"-"`
727 // NullFields is a list of field names (e.g. "IntentPayload") to include in API
728 // requests with the JSON null value. By default, fields with empty values are
729 // omitted from API requests. See
730 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
731 NullFields []string `json:"-"`
732 }
733
734 func (s GenerateUserSessionRequest) MarshalJSON() ([]byte, error) {
735 type NoMethod GenerateUserSessionRequest
736 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
737 }
738
739 // GenerateUserSessionResponse: Response that contains the details for
740 // generated user session.
741 type GenerateUserSessionResponse struct {
742 // UserSession: The generated user session. The token size is proportional to
743 // the size of the intent payload.
744 UserSession *UserSession `json:"userSession,omitempty"`
745
746 // ServerResponse contains the HTTP response code and headers from the server.
747 googleapi.ServerResponse `json:"-"`
748 // ForceSendFields is a list of field names (e.g. "UserSession") to
749 // unconditionally include in API requests. By default, fields with empty or
750 // default values are omitted from API requests. See
751 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
752 // details.
753 ForceSendFields []string `json:"-"`
754 // NullFields is a list of field names (e.g. "UserSession") to include in API
755 // requests with the JSON null value. By default, fields with empty values are
756 // omitted from API requests. See
757 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
758 NullFields []string `json:"-"`
759 }
760
761 func (s GenerateUserSessionResponse) MarshalJSON() ([]byte, error) {
762 type NoMethod GenerateUserSessionResponse
763 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
764 }
765
766 // GoogleHomePayload: Payload specific for Google Home products.
767 type GoogleHomePayload struct {
768 // AttachedToGoogleStructure: Output only. This identifies whether the
769 // subscription is attached to a Google Home structure.
770 AttachedToGoogleStructure bool `json:"attachedToGoogleStructure,omitempty"`
771 // GoogleStructureId: Optional. Structure identifier on Google side.
772 GoogleStructureId string `json:"googleStructureId,omitempty"`
773 // PartnerStructureId: Optional. This identifies the structure ID on partner
774 // side that the subscription should be applied to. Only required when the
775 // partner requires structure mapping.
776 PartnerStructureId string `json:"partnerStructureId,omitempty"`
777 // ForceSendFields is a list of field names (e.g. "AttachedToGoogleStructure")
778 // to unconditionally include in API requests. By default, fields with empty or
779 // default values are omitted from API requests. See
780 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
781 // details.
782 ForceSendFields []string `json:"-"`
783 // NullFields is a list of field names (e.g. "AttachedToGoogleStructure") to
784 // include in API requests with the JSON null value. By default, fields with
785 // empty values are omitted from API requests. See
786 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
787 NullFields []string `json:"-"`
788 }
789
790 func (s GoogleHomePayload) MarshalJSON() ([]byte, error) {
791 type NoMethod GoogleHomePayload
792 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
793 }
794
795 // GoogleOnePayload: Payload specific to Google One products.
796 type GoogleOnePayload struct {
797 // Campaigns: Campaign attributed to sales of this subscription.
798 Campaigns []string `json:"campaigns,omitempty"`
799 // Offering: The type of offering the subscription was sold by the partner.
800 // e.g. VAS.
801 //
802 // Possible values:
803 // "OFFERING_UNSPECIFIED" - The type of partner offering is unspecified.
804 // "OFFERING_VAS_BUNDLE" - Google One product purchased as a Value added
805 // service in addition to existing partner's products. Customer pays additional
806 // amount for Google One product.
807 // "OFFERING_VAS_STANDALONE" - Google One product purchased by itself by
808 // customer as a value add service. Customer pays additional amount for Google
809 // One product.
810 // "OFFERING_HARD_BUNDLE" - Product purchased as part of a hard bundle where
811 // Google One was included with the bundle. Google One pricing is included in
812 // the bundle.
813 // "OFFERING_SOFT_BUNDLE" - Purchased as part of a bundle where Google One
814 // was provided as an option. Google One pricing is included in the bundle.
815 Offering string `json:"offering,omitempty"`
816 // SalesChannel: The type of sales channel through which the subscription was
817 // sold.
818 //
819 // Possible values:
820 // "CHANNEL_UNSPECIFIED" - The channel type is unspecified.
821 // "CHANNEL_RETAIL" - Sold at store.
822 // "CHANNEL_ONLINE_WEB" - Sold through partner website.
823 // "CHANNEL_ONLINE_ANDROID_APP" - Sold through partner android app.
824 // "CHANNEL_ONLINE_IOS_APP" - Sold through partner iOS app.
825 SalesChannel string `json:"salesChannel,omitempty"`
826 // StoreId: The identifier for the partner store where the subscription was
827 // sold.
828 StoreId string `json:"storeId,omitempty"`
829 // ForceSendFields is a list of field names (e.g. "Campaigns") to
830 // unconditionally include in API requests. By default, fields with empty or
831 // default values are omitted from API requests. See
832 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
833 // details.
834 ForceSendFields []string `json:"-"`
835 // NullFields is a list of field names (e.g. "Campaigns") to include in API
836 // requests with the JSON null value. By default, fields with empty values are
837 // omitted from API requests. See
838 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
839 NullFields []string `json:"-"`
840 }
841
842 func (s GoogleOnePayload) MarshalJSON() ([]byte, error) {
843 type NoMethod GoogleOnePayload
844 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
845 }
846
847 // GoogleTypeLocalizedText: Localized variant of a text in a particular
848 // language.
849 type GoogleTypeLocalizedText struct {
850 // LanguageCode: The text's BCP-47 language code, such as "en-US" or "sr-Latn".
851 // For more information, see
852 // http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
853 LanguageCode string `json:"languageCode,omitempty"`
854 // Text: Localized string in the language corresponding to language_code below.
855 Text string `json:"text,omitempty"`
856 // ForceSendFields is a list of field names (e.g. "LanguageCode") to
857 // unconditionally include in API requests. By default, fields with empty or
858 // default values are omitted from API requests. See
859 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
860 // details.
861 ForceSendFields []string `json:"-"`
862 // NullFields is a list of field names (e.g. "LanguageCode") to include in API
863 // requests with the JSON null value. By default, fields with empty values are
864 // omitted from API requests. See
865 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
866 NullFields []string `json:"-"`
867 }
868
869 func (s GoogleTypeLocalizedText) MarshalJSON() ([]byte, error) {
870 type NoMethod GoogleTypeLocalizedText
871 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
872 }
873
874 // IntentPayload: The payload that describes the user intent.
875 type IntentPayload struct {
876 // CreateIntent: The request to create a subscription.
877 CreateIntent *CreateSubscriptionIntent `json:"createIntent,omitempty"`
878 // EntitleIntent: The request to entitle a subscription.
879 EntitleIntent *EntitleSubscriptionIntent `json:"entitleIntent,omitempty"`
880 // IntentOptions: Optional. The additional features for the intent.
881 IntentOptions *IntentPayloadIntentOptions `json:"intentOptions,omitempty"`
882 // ForceSendFields is a list of field names (e.g. "CreateIntent") to
883 // unconditionally include in API requests. By default, fields with empty or
884 // default values are omitted from API requests. See
885 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
886 // details.
887 ForceSendFields []string `json:"-"`
888 // NullFields is a list of field names (e.g. "CreateIntent") to include in API
889 // requests with the JSON null value. By default, fields with empty values are
890 // omitted from API requests. See
891 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
892 NullFields []string `json:"-"`
893 }
894
895 func (s IntentPayload) MarshalJSON() ([]byte, error) {
896 type NoMethod IntentPayload
897 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
898 }
899
900 // IntentPayloadIntentOptions: The options for the intent.
901 type IntentPayloadIntentOptions struct {
902 // EnableOfferOverride: Optional. If true, Google may use a different product
903 // and promotion id from the ones in the `create_intent` based on the user's
904 // eligibility. Only applicable for certain YouTube free trial offers.
905 EnableOfferOverride bool `json:"enableOfferOverride,omitempty"`
906 // ForceSendFields is a list of field names (e.g. "EnableOfferOverride") to
907 // unconditionally include in API requests. By default, fields with empty or
908 // default values are omitted from API requests. See
909 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
910 // details.
911 ForceSendFields []string `json:"-"`
912 // NullFields is a list of field names (e.g. "EnableOfferOverride") to include
913 // in API requests with the JSON null value. By default, fields with empty
914 // values are omitted from API requests. See
915 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
916 NullFields []string `json:"-"`
917 }
918
919 func (s IntentPayloadIntentOptions) MarshalJSON() ([]byte, error) {
920 type NoMethod IntentPayloadIntentOptions
921 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
922 }
923
924 // ListProductsResponse: Response that contains the products.
925 type ListProductsResponse struct {
926 // NextPageToken: A token, which can be sent as `page_token` to retrieve the
927 // next page. If this field is empty, there are no subsequent pages.
928 NextPageToken string `json:"nextPageToken,omitempty"`
929 // Products: The products for the specified partner.
930 Products []*Product `json:"products,omitempty"`
931
932 // ServerResponse contains the HTTP response code and headers from the server.
933 googleapi.ServerResponse `json:"-"`
934 // ForceSendFields is a list of field names (e.g. "NextPageToken") to
935 // unconditionally include in API requests. By default, fields with empty or
936 // default values are omitted from API requests. See
937 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
938 // details.
939 ForceSendFields []string `json:"-"`
940 // NullFields is a list of field names (e.g. "NextPageToken") to include in API
941 // requests with the JSON null value. By default, fields with empty values are
942 // omitted from API requests. See
943 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
944 NullFields []string `json:"-"`
945 }
946
947 func (s ListProductsResponse) MarshalJSON() ([]byte, error) {
948 type NoMethod ListProductsResponse
949 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
950 }
951
952 // ListPromotionsResponse: Response that contains the promotions.
953 type ListPromotionsResponse struct {
954 // NextPageToken: A token, which can be sent as `page_token` to retrieve the
955 // next page. If this field is empty, there are no subsequent pages.
956 NextPageToken string `json:"nextPageToken,omitempty"`
957 // Promotions: The promotions for the specified partner.
958 Promotions []*Promotion `json:"promotions,omitempty"`
959
960 // ServerResponse contains the HTTP response code and headers from the server.
961 googleapi.ServerResponse `json:"-"`
962 // ForceSendFields is a list of field names (e.g. "NextPageToken") to
963 // unconditionally include in API requests. By default, fields with empty or
964 // default values are omitted from API requests. See
965 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
966 // details.
967 ForceSendFields []string `json:"-"`
968 // NullFields is a list of field names (e.g. "NextPageToken") to include in API
969 // requests with the JSON null value. By default, fields with empty values are
970 // omitted from API requests. See
971 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
972 NullFields []string `json:"-"`
973 }
974
975 func (s ListPromotionsResponse) MarshalJSON() ([]byte, error) {
976 type NoMethod ListPromotionsResponse
977 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
978 }
979
980 // Location: Describes a location of an end user.
981 type Location struct {
982 // PostalCode: The postal code this location refers to. Ex. "94043"
983 PostalCode string `json:"postalCode,omitempty"`
984 // RegionCode: 2-letter ISO region code for current content region. Ex.
985 // “US” Please refers to: https://en.wikipedia.org/wiki/ISO_3166-1
986 RegionCode string `json:"regionCode,omitempty"`
987 // ForceSendFields is a list of field names (e.g. "PostalCode") to
988 // unconditionally include in API requests. By default, fields with empty or
989 // default values are omitted from API requests. See
990 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
991 // details.
992 ForceSendFields []string `json:"-"`
993 // NullFields is a list of field names (e.g. "PostalCode") to include in API
994 // requests with the JSON null value. By default, fields with empty values are
995 // omitted from API requests. See
996 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
997 NullFields []string `json:"-"`
998 }
999
1000 func (s Location) MarshalJSON() ([]byte, error) {
1001 type NoMethod Location
1002 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1003 }
1004
1005 // Product: A Product resource that defines a subscription service that can be
1006 // resold.
1007 type Product struct {
1008 // BundleDetails: Output only. Specifies the details for a bundle product.
1009 BundleDetails *ProductBundleDetails `json:"bundleDetails,omitempty"`
1010 // FiniteBillingCycleDetails: Optional. Details for a subscription line item
1011 // with finite billing cycles. If unset, the line item will be charged
1012 // indefinitely.
1013 FiniteBillingCycleDetails *FiniteBillingCycleDetails `json:"finiteBillingCycleDetails,omitempty"`
1014 // Name: Identifier. Response only. Resource name of the product. It will have
1015 // the format of "partners/{partner_id}/products/{product_id}"
1016 Name string `json:"name,omitempty"`
1017 // PriceConfigs: Output only. Price configs for the product in the available
1018 // regions.
1019 PriceConfigs []*ProductPriceConfig `json:"priceConfigs,omitempty"`
1020 // ProductType: Output only. Specifies the type of the product.
1021 //
1022 // Possible values:
1023 // "PRODUCT_TYPE_UNSPECIFIED" - Unspecified. It's reserved as an unexpected
1024 // value, should not be used.
1025 // "PRODUCT_TYPE_SUBSCRIPTION" - The product is a subscription.
1026 // "PRODUCT_TYPE_BUNDLE_SUBSCRIPTION" - The product is a bundled subscription
1027 // plan, which includes multiple subscription elements.
1028 ProductType string `json:"productType,omitempty"`
1029 // RegionCodes: Output only. 2-letter ISO region code where the product is
1030 // available in. Ex. "US" Please refer to:
1031 // https://en.wikipedia.org/wiki/ISO_3166-1
1032 RegionCodes []string `json:"regionCodes,omitempty"`
1033 // SubscriptionBillingCycleDuration: Output only. Specifies the length of the
1034 // billing cycle of the subscription.
1035 SubscriptionBillingCycleDuration *Duration `json:"subscriptionBillingCycleDuration,omitempty"`
1036 // Titles: Output only. Localized human readable name of the product.
1037 Titles []*GoogleTypeLocalizedText `json:"titles,omitempty"`
1038 // ForceSendFields is a list of field names (e.g. "BundleDetails") to
1039 // unconditionally include in API requests. By default, fields with empty or
1040 // default values are omitted from API requests. See
1041 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1042 // details.
1043 ForceSendFields []string `json:"-"`
1044 // NullFields is a list of field names (e.g. "BundleDetails") to include in API
1045 // requests with the JSON null value. By default, fields with empty values are
1046 // omitted from API requests. See
1047 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1048 NullFields []string `json:"-"`
1049 }
1050
1051 func (s Product) MarshalJSON() ([]byte, error) {
1052 type NoMethod Product
1053 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1054 }
1055
1056 // ProductBundleDetails: Details for a bundle product.
1057 type ProductBundleDetails struct {
1058 // BundleElements: The individual products that are included in the bundle.
1059 BundleElements []*ProductBundleDetailsBundleElement `json:"bundleElements,omitempty"`
1060 // EntitlementMode: The entitlement mode of the bundle product.
1061 //
1062 // Possible values:
1063 // "ENTITLEMENT_MODE_UNSPECIFIED" - Unspecified. It's reserved as an
1064 // unexpected value, should not be used.
1065 // "ENTITLEMENT_MODE_FULL" - All the bundle elements must be fully activated
1066 // in a single request.
1067 // "ENTITLEMENT_MODE_INCREMENTAL" - The bundle elements could be
1068 // incrementally activated.
1069 EntitlementMode string `json:"entitlementMode,omitempty"`
1070 // ForceSendFields is a list of field names (e.g. "BundleElements") to
1071 // unconditionally include in API requests. By default, fields with empty or
1072 // default values are omitted from API requests. See
1073 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1074 // details.
1075 ForceSendFields []string `json:"-"`
1076 // NullFields is a list of field names (e.g. "BundleElements") to include in
1077 // API requests with the JSON null value. By default, fields with empty values
1078 // are omitted from API requests. See
1079 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1080 NullFields []string `json:"-"`
1081 }
1082
1083 func (s ProductBundleDetails) MarshalJSON() ([]byte, error) {
1084 type NoMethod ProductBundleDetails
1085 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1086 }
1087
1088 // ProductBundleDetailsBundleElement: The individual product that is included
1089 // in the bundle.
1090 type ProductBundleDetailsBundleElement struct {
1091 // Product: Required. Output only. Product resource name that identifies the
1092 // bundle element. The format is 'partners/{partner_id}/products/{product_id}'.
1093 Product string `json:"product,omitempty"`
1094 // ForceSendFields is a list of field names (e.g. "Product") to unconditionally
1095 // include in API requests. By default, fields with empty or default values are
1096 // omitted from API requests. See
1097 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1098 // details.
1099 ForceSendFields []string `json:"-"`
1100 // NullFields is a list of field names (e.g. "Product") to include in API
1101 // requests with the JSON null value. By default, fields with empty values are
1102 // omitted from API requests. See
1103 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1104 NullFields []string `json:"-"`
1105 }
1106
1107 func (s ProductBundleDetailsBundleElement) MarshalJSON() ([]byte, error) {
1108 type NoMethod ProductBundleDetailsBundleElement
1109 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1110 }
1111
1112 // ProductPayload: Specifies product specific payload.
1113 type ProductPayload struct {
1114 // GoogleHomePayload: Payload specific to Google Home products.
1115 GoogleHomePayload *GoogleHomePayload `json:"googleHomePayload,omitempty"`
1116 // GoogleOnePayload: Product-specific payloads. Payload specific to Google One
1117 // products.
1118 GoogleOnePayload *GoogleOnePayload `json:"googleOnePayload,omitempty"`
1119 // YoutubePayload: Payload specific to Youtube products.
1120 YoutubePayload *YoutubePayload `json:"youtubePayload,omitempty"`
1121 // ForceSendFields is a list of field names (e.g. "GoogleHomePayload") to
1122 // unconditionally include in API requests. By default, fields with empty or
1123 // default values are omitted from API requests. See
1124 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1125 // details.
1126 ForceSendFields []string `json:"-"`
1127 // NullFields is a list of field names (e.g. "GoogleHomePayload") to include in
1128 // API requests with the JSON null value. By default, fields with empty values
1129 // are omitted from API requests. See
1130 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1131 NullFields []string `json:"-"`
1132 }
1133
1134 func (s ProductPayload) MarshalJSON() ([]byte, error) {
1135 type NoMethod ProductPayload
1136 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1137 }
1138
1139 // ProductPriceConfig: Configs the prices in an available region.
1140 type ProductPriceConfig struct {
1141 // Amount: Output only. The price in the region.
1142 Amount *Amount `json:"amount,omitempty"`
1143 // RegionCode: Output only. 2-letter ISO region code where the product is
1144 // available in. Ex. "US".
1145 RegionCode string `json:"regionCode,omitempty"`
1146 // ForceSendFields is a list of field names (e.g. "Amount") to unconditionally
1147 // include in API requests. By default, fields with empty or default values are
1148 // omitted from API requests. See
1149 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1150 // details.
1151 ForceSendFields []string `json:"-"`
1152 // NullFields is a list of field names (e.g. "Amount") to include in API
1153 // requests with the JSON null value. By default, fields with empty values are
1154 // omitted from API requests. See
1155 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1156 NullFields []string `json:"-"`
1157 }
1158
1159 func (s ProductPriceConfig) MarshalJSON() ([]byte, error) {
1160 type NoMethod ProductPriceConfig
1161 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1162 }
1163
1164 // Promotion: A Promotion resource that defines a promotion for a subscription
1165 // that can be resold.
1166 type Promotion struct {
1167 // ApplicableProducts: Output only. The product ids this promotion can be
1168 // applied to.
1169 ApplicableProducts []string `json:"applicableProducts,omitempty"`
1170 // EndTime: Optional. Specifies the end time (exclusive) of the period that the
1171 // promotion is available in. If unset, the promotion is available
1172 // indefinitely.
1173 EndTime string `json:"endTime,omitempty"`
1174 // FreeTrialDuration: Optional. Specifies the duration of the free trial of the
1175 // subscription when promotion_type is PROMOTION_TYPE_FREE_TRIAL
1176 FreeTrialDuration *Duration `json:"freeTrialDuration,omitempty"`
1177 // IntroductoryPricingDetails: Optional. Specifies the introductory pricing
1178 // details when the promotion_type is PROMOTION_TYPE_INTRODUCTORY_PRICING.
1179 IntroductoryPricingDetails *PromotionIntroductoryPricingDetails `json:"introductoryPricingDetails,omitempty"`
1180 // Name: Identifier. Response only. Resource name of the subscription
1181 // promotion. It will have the format of
1182 // "partners/{partner_id}/promotion/{promotion_id}"
1183 Name string `json:"name,omitempty"`
1184 // PromotionType: Output only. Specifies the type of the promotion.
1185 //
1186 // Possible values:
1187 // "PROMOTION_TYPE_UNSPECIFIED" - The promotion type is unspecified.
1188 // "PROMOTION_TYPE_FREE_TRIAL" - The promotion is a free trial.
1189 // "PROMOTION_TYPE_INTRODUCTORY_PRICING" - The promotion is a reduced
1190 // introductory pricing.
1191 PromotionType string `json:"promotionType,omitempty"`
1192 // RegionCodes: Output only. 2-letter ISO region code where the promotion is
1193 // available in. Ex. "US" Please refer to:
1194 // https://en.wikipedia.org/wiki/ISO_3166-1
1195 RegionCodes []string `json:"regionCodes,omitempty"`
1196 // StartTime: Optional. Specifies the start time (inclusive) of the period that
1197 // the promotion is available in.
1198 StartTime string `json:"startTime,omitempty"`
1199 // Titles: Output only. Localized human readable name of the promotion.
1200 Titles []*GoogleTypeLocalizedText `json:"titles,omitempty"`
1201 // ForceSendFields is a list of field names (e.g. "ApplicableProducts") to
1202 // unconditionally include in API requests. By default, fields with empty or
1203 // default values are omitted from API requests. See
1204 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1205 // details.
1206 ForceSendFields []string `json:"-"`
1207 // NullFields is a list of field names (e.g. "ApplicableProducts") to include
1208 // in API requests with the JSON null value. By default, fields with empty
1209 // values are omitted from API requests. See
1210 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1211 NullFields []string `json:"-"`
1212 }
1213
1214 func (s Promotion) MarshalJSON() ([]byte, error) {
1215 type NoMethod Promotion
1216 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1217 }
1218
1219 // PromotionIntroductoryPricingDetails: The details of a introductory pricing
1220 // promotion.
1221 type PromotionIntroductoryPricingDetails struct {
1222 // IntroductoryPricingSpecs: Output only. Specifies the introductory pricing
1223 // periods.
1224 IntroductoryPricingSpecs []*PromotionIntroductoryPricingDetailsIntroductoryPricingSpec `json:"introductoryPricingSpecs,omitempty"`
1225 // ForceSendFields is a list of field names (e.g. "IntroductoryPricingSpecs")
1226 // to unconditionally include in API requests. By default, fields with empty or
1227 // default values are omitted from API requests. See
1228 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1229 // details.
1230 ForceSendFields []string `json:"-"`
1231 // NullFields is a list of field names (e.g. "IntroductoryPricingSpecs") to
1232 // include in API requests with the JSON null value. By default, fields with
1233 // empty values are omitted from API requests. See
1234 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1235 NullFields []string `json:"-"`
1236 }
1237
1238 func (s PromotionIntroductoryPricingDetails) MarshalJSON() ([]byte, error) {
1239 type NoMethod PromotionIntroductoryPricingDetails
1240 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1241 }
1242
1243 // PromotionIntroductoryPricingDetailsIntroductoryPricingSpec: The duration of
1244 // an introductory pricing promotion.
1245 type PromotionIntroductoryPricingDetailsIntroductoryPricingSpec struct {
1246 // DiscountAmount: Output only. The discount amount. The value is positive.
1247 DiscountAmount *Amount `json:"discountAmount,omitempty"`
1248 // DiscountRatioMicros: Output only. The discount percentage in micros. For
1249 // example, 50,000 represents 5%.
1250 DiscountRatioMicros int64 `json:"discountRatioMicros,omitempty,string"`
1251 // RecurrenceCount: Output only. The duration of an introductory offer in
1252 // billing cycles.
1253 RecurrenceCount int64 `json:"recurrenceCount,omitempty"`
1254 // RegionCode: Output only. 2-letter ISO region code where the product is
1255 // available in. Ex. "US".
1256 RegionCode string `json:"regionCode,omitempty"`
1257 // ForceSendFields is a list of field names (e.g. "DiscountAmount") to
1258 // unconditionally include in API requests. By default, fields with empty or
1259 // default values are omitted from API requests. See
1260 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1261 // details.
1262 ForceSendFields []string `json:"-"`
1263 // NullFields is a list of field names (e.g. "DiscountAmount") to include in
1264 // API requests with the JSON null value. By default, fields with empty values
1265 // are omitted from API requests. See
1266 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1267 NullFields []string `json:"-"`
1268 }
1269
1270 func (s PromotionIntroductoryPricingDetailsIntroductoryPricingSpec) MarshalJSON() ([]byte, error) {
1271 type NoMethod PromotionIntroductoryPricingDetailsIntroductoryPricingSpec
1272 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1273 }
1274
1275 // ResumeSubscriptionRequest: Request to resume a suspended subscription.
1276 type ResumeSubscriptionRequest struct {
1277 // CycleOptions: Optional. The cycle options for the subscription.
1278 CycleOptions *CycleOptions `json:"cycleOptions,omitempty"`
1279 // ResumeMode: Required. The mode to resume the subscription.
1280 //
1281 // Possible values:
1282 // "RESUME_MODE_UNSPECIFIED" - Reserved for invalid or unexpected value. Do
1283 // not use.
1284 // "RESUME_MODE_CYCLE_OPTIONS" - Resume the subscription using the input from
1285 // `cycle_options`.
1286 // "RESUME_MODE_RESTORE_EXISTING_BILLING_SCHEDULE" - Resume the subscription
1287 // with the existing billing schedule. The subscription's next renewal time
1288 // must still be in the future for this mode to be applicable.
1289 ResumeMode string `json:"resumeMode,omitempty"`
1290 // ForceSendFields is a list of field names (e.g. "CycleOptions") to
1291 // unconditionally include in API requests. By default, fields with empty or
1292 // default values are omitted from API requests. See
1293 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1294 // details.
1295 ForceSendFields []string `json:"-"`
1296 // NullFields is a list of field names (e.g. "CycleOptions") to include in API
1297 // requests with the JSON null value. By default, fields with empty values are
1298 // omitted from API requests. See
1299 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1300 NullFields []string `json:"-"`
1301 }
1302
1303 func (s ResumeSubscriptionRequest) MarshalJSON() ([]byte, error) {
1304 type NoMethod ResumeSubscriptionRequest
1305 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1306 }
1307
1308 // ResumeSubscriptionResponse: Response that contains the resumed subscription.
1309 type ResumeSubscriptionResponse struct {
1310 // Subscription: The resumed subscription resource.
1311 Subscription *Subscription `json:"subscription,omitempty"`
1312
1313 // ServerResponse contains the HTTP response code and headers from the server.
1314 googleapi.ServerResponse `json:"-"`
1315 // ForceSendFields is a list of field names (e.g. "Subscription") to
1316 // unconditionally include in API requests. By default, fields with empty or
1317 // default values are omitted from API requests. See
1318 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1319 // details.
1320 ForceSendFields []string `json:"-"`
1321 // NullFields is a list of field names (e.g. "Subscription") to include in API
1322 // requests with the JSON null value. By default, fields with empty values are
1323 // omitted from API requests. See
1324 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1325 NullFields []string `json:"-"`
1326 }
1327
1328 func (s ResumeSubscriptionResponse) MarshalJSON() ([]byte, error) {
1329 type NoMethod ResumeSubscriptionResponse
1330 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1331 }
1332
1333 // ServicePeriod: A description of what time period or moment in time the
1334 // product or service is being delivered over.
1335 type ServicePeriod struct {
1336 // EndTime: Optional. The end time of the service period. Time is exclusive.
1337 EndTime string `json:"endTime,omitempty"`
1338 // StartTime: Required. The start time of the service period. Time is
1339 // inclusive.
1340 StartTime string `json:"startTime,omitempty"`
1341 // ForceSendFields is a list of field names (e.g. "EndTime") to unconditionally
1342 // include in API requests. By default, fields with empty or default values are
1343 // omitted from API requests. See
1344 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1345 // details.
1346 ForceSendFields []string `json:"-"`
1347 // NullFields is a list of field names (e.g. "EndTime") to include in API
1348 // requests with the JSON null value. By default, fields with empty values are
1349 // omitted from API requests. See
1350 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1351 NullFields []string `json:"-"`
1352 }
1353
1354 func (s ServicePeriod) MarshalJSON() ([]byte, error) {
1355 type NoMethod ServicePeriod
1356 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1357 }
1358
1359 // Subscription: Acts as a central billing entity between an external partner
1360 // and Google. Google services use the subscription state to grant or revoke
1361 // the user's service entitlement. Note: The subscription state might not
1362 // perfectly align with the user's service entitlement. Some services might
1363 // continue providing access until the current cycle ends, even if the
1364 // subscription is immediately canceled. Consult the relevant contract or
1365 // product policy for specific details.
1366 type Subscription struct {
1367 // CancellationDetails: Output only. Describes the details of a cancelled
1368 // subscription. Only applicable to subscription of state `STATE_CANCELLED`.
1369 CancellationDetails *SubscriptionCancellationDetails `json:"cancellationDetails,omitempty"`
1370 // CreateTime: Output only. System generated timestamp when the subscription is
1371 // created. UTC timezone.
1372 CreateTime string `json:"createTime,omitempty"`
1373 // CycleEndTime: Output only. The time at which the subscription is expected to
1374 // be extended, in ISO 8061 format. UTC timezone. For example:
1375 // "2019-08-31T17:28:54.564Z"
1376 CycleEndTime string `json:"cycleEndTime,omitempty"`
1377 // EndUserEntitled: Output only. Indicates if the subscription is entitled to
1378 // the end user.
1379 EndUserEntitled bool `json:"endUserEntitled,omitempty"`
1380 // FreeTrialEndTime: Output only. End of the free trial period, in ISO 8061
1381 // format. For example, "2019-08-31T17:28:54.564Z". It will be set the same as
1382 // createTime if no free trial promotion is specified.
1383 FreeTrialEndTime string `json:"freeTrialEndTime,omitempty"`
1384 // LineItems: Required. The line items of the subscription.
1385 LineItems []*SubscriptionLineItem `json:"lineItems,omitempty"`
1386 // MigrationDetails: Output only. Describes the details of the migrated
1387 // subscription. Only populated if this subscription is migrated from another
1388 // system.
1389 MigrationDetails *SubscriptionMigrationDetails `json:"migrationDetails,omitempty"`
1390 // Name: Identifier. Resource name of the subscription. It will have the format
1391 // of "partners/{partner_id}/subscriptions/{subscription_id}". This is
1392 // available for authorizeAddon, but otherwise is response only.
1393 Name string `json:"name,omitempty"`
1394 // PartnerUserToken: Required. Identifier of the end-user in partner’s
1395 // system. The value is restricted to 63 ASCII characters at the maximum.
1396 PartnerUserToken string `json:"partnerUserToken,omitempty"`
1397 // ProcessingState: Output only. Describes the processing state of the
1398 // subscription. See more details at the lifecycle of a subscription
1399 // (/payments/reseller/subscription/reference/index/Receive.Notifications#paymen
1400 // ts-subscription-lifecycle).
1401 //
1402 // Possible values:
1403 // "PROCESSING_STATE_UNSPECIFIED" - The processing state is unspecified.
1404 // "PROCESSING_STATE_CANCELLING" - The subscription is being cancelled.
1405 // "PROCESSING_STATE_RECURRING" - The subscription is recurring.
1406 // "PROCESSING_STATE_RESUMING" - The subscription is being resumed.
1407 ProcessingState string `json:"processingState,omitempty"`
1408 // Products: Optional. Deprecated: consider using `line_items` as the input.
1409 // Required. Resource name that identifies the purchased products. The format
1410 // will be 'partners/{partner_id}/products/{product_id}'.
1411 Products []string `json:"products,omitempty"`
1412 // PromotionSpecs: Optional. Subscription-level promotions. Only free trial is
1413 // supported on this level. It determines the first renewal time of the
1414 // subscription to be the end of the free trial period. Specify the promotion
1415 // resource name only when used as input.
1416 PromotionSpecs []*SubscriptionPromotionSpec `json:"promotionSpecs,omitempty"`
1417 // Promotions: Optional. Deprecated: consider using the top-level
1418 // `promotion_specs` as the input. Optional. Resource name that identifies one
1419 // or more promotions that can be applied on the product. A typical promotion
1420 // for a subscription is Free trial. The format will be
1421 // 'partners/{partner_id}/promotions/{promotion_id}'.
1422 Promotions []string `json:"promotions,omitempty"`
1423 // PurchaseTime: Optional. The timestamp when the user transaction was made
1424 // with the Partner. Specify for the case of "bundle with choice", and it must
1425 // be before the provision_time (when the user makes a selection).
1426 PurchaseTime string `json:"purchaseTime,omitempty"`
1427 // RedirectUri: Output only. The place where partners should redirect the
1428 // end-user to after creation. This field might also be populated when creation
1429 // failed. However, Partners should always prepare a default URL to redirect
1430 // the user in case this field is empty.
1431 RedirectUri string `json:"redirectUri,omitempty"`
1432 // RenewalTime: Output only. The time at which the subscription is expected to
1433 // be renewed by Google - a new charge will be incurred and the service
1434 // entitlement will be renewed. A non-immediate cancellation will take place at
1435 // this time too, before which, the service entitlement for the end user will
1436 // remain valid. UTC timezone in ISO 8061 format. For example:
1437 // "2019-08-31T17:28:54.564Z"
1438 RenewalTime string `json:"renewalTime,omitempty"`
1439 // ServiceLocation: Required. The location that the service is provided as
1440 // indicated by the partner.
1441 ServiceLocation *Location `json:"serviceLocation,omitempty"`
1442 // State: Output only. Describes the state of the subscription. See more
1443 // details at the lifecycle of a subscription
1444 // (/payments/reseller/subscription/reference/index/Receive.Notifications#paymen
1445 // ts-subscription-lifecycle).
1446 //
1447 // Possible values:
1448 // "STATE_UNSPECIFIED" - The state is unspecified.
1449 // "STATE_CREATED" - The subscription is created, a state before it is moved
1450 // to STATE_ACTIVE.
1451 // "STATE_ACTIVE" - The subscription is active.
1452 // "STATE_CANCELLED" - The subscription is cancelled. This is the final state
1453 // of the subscription, as it can no longer be modified or reactivated.
1454 // "STATE_IN_GRACE_PERIOD" - The subscription is in grace period. It can
1455 // happen: 1) in manual extend mode, the subscription is not extended by the
1456 // partner at the end of current cycle. 2) for outbound authorization enabled
1457 // partners, a renewal purchase order is rejected.
1458 // "STATE_CANCEL_AT_END_OF_CYCLE" - The subscription is waiting to be
1459 // cancelled by the next recurrence cycle.
1460 // "STATE_SUSPENDED" - The subscription is suspended.
1461 State string `json:"state,omitempty"`
1462 // UpdateTime: Output only. System generated timestamp when the subscription is
1463 // most recently updated. UTC timezone.
1464 UpdateTime string `json:"updateTime,omitempty"`
1465 // UpgradeDowngradeDetails: Optional. Details about the previous subscription
1466 // that this new subscription upgrades/downgrades from. Only populated if this
1467 // subscription is an upgrade/downgrade from another subscription.
1468 UpgradeDowngradeDetails *SubscriptionUpgradeDowngradeDetails `json:"upgradeDowngradeDetails,omitempty"`
1469
1470 // ServerResponse contains the HTTP response code and headers from the server.
1471 googleapi.ServerResponse `json:"-"`
1472 // ForceSendFields is a list of field names (e.g. "CancellationDetails") to
1473 // unconditionally include in API requests. By default, fields with empty or
1474 // default values are omitted from API requests. See
1475 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1476 // details.
1477 ForceSendFields []string `json:"-"`
1478 // NullFields is a list of field names (e.g. "CancellationDetails") to include
1479 // in API requests with the JSON null value. By default, fields with empty
1480 // values are omitted from API requests. See
1481 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1482 NullFields []string `json:"-"`
1483 }
1484
1485 func (s Subscription) MarshalJSON() ([]byte, error) {
1486 type NoMethod Subscription
1487 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1488 }
1489
1490 // SubscriptionCancellationDetails: Describes the details of a cancelled or
1491 // cancelling subscription.
1492 type SubscriptionCancellationDetails struct {
1493 // Reason: Output only. The reason of the cancellation.
1494 //
1495 // Possible values:
1496 // "CANCELLATION_REASON_UNSPECIFIED" - Reason is unspecified. Should not be
1497 // used.
1498 // "CANCELLATION_REASON_FRAUD" - Fraudulent transaction.
1499 // "CANCELLATION_REASON_REMORSE" - Buyer's remorse.
1500 // "CANCELLATION_REASON_ACCIDENTAL_PURCHASE" - Accidental purchase.
1501 // "CANCELLATION_REASON_PAST_DUE" - Payment is past due.
1502 // "CANCELLATION_REASON_ACCOUNT_CLOSED" - Used for notification only, do not
1503 // use in Cancel API. User account closed.
1504 // "CANCELLATION_REASON_UPGRADE_DOWNGRADE" - Used for notification only, do
1505 // not use in Cancel API. Cancellation due to upgrade or downgrade.
1506 // "CANCELLATION_REASON_USER_DELINQUENCY" - Cancellation due to user
1507 // delinquency
1508 // "CANCELLATION_REASON_SYSTEM_ERROR" - Used for notification only, do not
1509 // use in Cancel API. Cancellation due to an unrecoverable system error.
1510 // "CANCELLATION_REASON_SYSTEM_CANCEL" - Used for notification only, do not
1511 // use in Cancel API. The subscription is cancelled by Google automatically
1512 // since it is no longer valid.
1513 // "CANCELLATION_REASON_BILLING_SYSTEM_SWITCH" - Cancellation due to a
1514 // billing system switch.
1515 // "CANCELLATION_REASON_OTHER" - Other reason.
1516 Reason string `json:"reason,omitempty"`
1517 // ForceSendFields is a list of field names (e.g. "Reason") to unconditionally
1518 // include in API requests. By default, fields with empty or default values are
1519 // omitted from API requests. See
1520 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1521 // details.
1522 ForceSendFields []string `json:"-"`
1523 // NullFields is a list of field names (e.g. "Reason") to include in API
1524 // requests with the JSON null value. By default, fields with empty values are
1525 // omitted from API requests. See
1526 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1527 NullFields []string `json:"-"`
1528 }
1529
1530 func (s SubscriptionCancellationDetails) MarshalJSON() ([]byte, error) {
1531 type NoMethod SubscriptionCancellationDetails
1532 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1533 }
1534
1535 // SubscriptionLineItem: Individual line item definition of a subscription.
1536 type SubscriptionLineItem struct {
1537 // Amount: Output only. The price of the product/service in this line item. The
1538 // amount could be the wholesale price, or it can include a cost of sale based
1539 // on the contract.
1540 Amount *Amount `json:"amount,omitempty"`
1541 // BundleDetails: Output only. The bundle details for the line item. Only
1542 // populated if the line item corresponds to a hard bundle.
1543 BundleDetails *SubscriptionLineItemBundleDetails `json:"bundleDetails,omitempty"`
1544 // Description: Output only. Description of this line item.
1545 Description string `json:"description,omitempty"`
1546 // FiniteBillingCycleDetails: Optional. Details for a subscription line item
1547 // with finite billing cycles. If unset, the line item will be charged
1548 // indefinitely. Used only with LINE_ITEM_RECURRENCE_TYPE_PERIODIC.
1549 FiniteBillingCycleDetails *FiniteBillingCycleDetails `json:"finiteBillingCycleDetails,omitempty"`
1550 // LineItemFreeTrialEndTime: Output only. The free trial end time will be
1551 // populated after the line item is successfully processed. End time of the
1552 // line item free trial period, in ISO 8061 format. For example,
1553 // "2019-08-31T17:28:54.564Z". It will be set the same as createTime if no free
1554 // trial promotion is specified.
1555 LineItemFreeTrialEndTime string `json:"lineItemFreeTrialEndTime,omitempty"`
1556 // LineItemIndex: Output only. A unique index of the subscription line item.
1557 LineItemIndex int64 `json:"lineItemIndex,omitempty"`
1558 // LineItemPromotionSpecs: Optional. The promotions applied on the line item.
1559 // It can be: - an introductory pricing promotion. - a free trial promotion.
1560 // This feature is not enabled. If used, the request will be rejected. When
1561 // used as input in Create or Provision API, specify its resource name only.
1562 LineItemPromotionSpecs []*SubscriptionPromotionSpec `json:"lineItemPromotionSpecs,omitempty"`
1563 // Name: Identifier. Resource name of the line item. Format:
1564 // partners/{partner}/subscriptions/{subscription}/lineItems/{lineItem}
1565 Name string `json:"name,omitempty"`
1566 // OneTimeRecurrenceDetails: Output only. Details only set for a ONE_TIME
1567 // recurrence line item.
1568 OneTimeRecurrenceDetails *SubscriptionLineItemOneTimeRecurrenceDetails `json:"oneTimeRecurrenceDetails,omitempty"`
1569 // Product: Required. Product resource name that identifies the product
1570 // associated with this line item. The format is
1571 // 'partners/{partner_id}/products/{product_id}'.
1572 Product string `json:"product,omitempty"`
1573 // ProductPayload: Optional. Product specific payload for this line item.
1574 ProductPayload *ProductPayload `json:"productPayload,omitempty"`
1575 // RecurrenceType: Output only. The recurrence type of the line item.
1576 //
1577 // Possible values:
1578 // "LINE_ITEM_RECURRENCE_TYPE_UNSPECIFIED" - The line item recurrence type is
1579 // unspecified.
1580 // "LINE_ITEM_RECURRENCE_TYPE_PERIODIC" - The line item recurs periodically.
1581 // "LINE_ITEM_RECURRENCE_TYPE_ONE_TIME" - The line item does not recur in the
1582 // future.
1583 RecurrenceType string `json:"recurrenceType,omitempty"`
1584 // State: Output only. The state of the line item.
1585 //
1586 // Possible values:
1587 // "LINE_ITEM_STATE_UNSPECIFIED" - Unspecified state.
1588 // "LINE_ITEM_STATE_ACTIVE" - The line item is in ACTIVE state. If the
1589 // subscription is cancelled or suspended, the line item will not be charged
1590 // even if the line item is active.
1591 // "LINE_ITEM_STATE_INACTIVE" - The line item is in INACTIVE state.
1592 // "LINE_ITEM_STATE_NEW" - The line item is new, and is not activated or
1593 // charged yet.
1594 // "LINE_ITEM_STATE_ACTIVATING" - The line item is being activated in order
1595 // to be charged. If a free trial applies to the line item, the line item is
1596 // pending a prorated charge at the end of the free trial period, as indicated
1597 // by `line_item_free_trial_end_time`.
1598 // "LINE_ITEM_STATE_DEACTIVATING" - The line item is being deactivated, and a
1599 // prorated refund in being processed.
1600 // "LINE_ITEM_STATE_WAITING_TO_DEACTIVATE" - The line item is scheduled to be
1601 // deactivated at the end of the current cycle.
1602 // "LINE_ITEM_STATE_OFF_CYCLE_CHARGING" - Line item is being charged
1603 // off-cycle.
1604 State string `json:"state,omitempty"`
1605
1606 // ServerResponse contains the HTTP response code and headers from the server.
1607 googleapi.ServerResponse `json:"-"`
1608 // ForceSendFields is a list of field names (e.g. "Amount") to unconditionally
1609 // include in API requests. By default, fields with empty or default values are
1610 // omitted from API requests. See
1611 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1612 // details.
1613 ForceSendFields []string `json:"-"`
1614 // NullFields is a list of field names (e.g. "Amount") to include in API
1615 // requests with the JSON null value. By default, fields with empty values are
1616 // omitted from API requests. See
1617 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1618 NullFields []string `json:"-"`
1619 }
1620
1621 func (s SubscriptionLineItem) MarshalJSON() ([]byte, error) {
1622 type NoMethod SubscriptionLineItem
1623 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1624 }
1625
1626 // SubscriptionLineItemBundleDetails: The bundle details for a line item
1627 // corresponding to a hard bundle.
1628 type SubscriptionLineItemBundleDetails struct {
1629 // BundleElementDetails: Output only. The details for each element in the hard
1630 // bundle.
1631 BundleElementDetails []*SubscriptionLineItemBundleDetailsBundleElementDetails `json:"bundleElementDetails,omitempty"`
1632 // ForceSendFields is a list of field names (e.g. "BundleElementDetails") to
1633 // unconditionally include in API requests. By default, fields with empty or
1634 // default values are omitted from API requests. See
1635 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1636 // details.
1637 ForceSendFields []string `json:"-"`
1638 // NullFields is a list of field names (e.g. "BundleElementDetails") to include
1639 // in API requests with the JSON null value. By default, fields with empty
1640 // values are omitted from API requests. See
1641 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1642 NullFields []string `json:"-"`
1643 }
1644
1645 func (s SubscriptionLineItemBundleDetails) MarshalJSON() ([]byte, error) {
1646 type NoMethod SubscriptionLineItemBundleDetails
1647 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1648 }
1649
1650 // SubscriptionLineItemBundleDetailsBundleElementDetails: The details for an
1651 // element in the hard bundle.
1652 type SubscriptionLineItemBundleDetailsBundleElementDetails struct {
1653 // Product: Output only. Product resource name that identifies the bundle
1654 // element. The format is 'partners/{partner_id}/products/{product_id}'.
1655 Product string `json:"product,omitempty"`
1656 // UserAccountLinkedTime: Output only. The time when this product is linked to
1657 // an end user.
1658 UserAccountLinkedTime string `json:"userAccountLinkedTime,omitempty"`
1659 // ForceSendFields is a list of field names (e.g. "Product") to unconditionally
1660 // include in API requests. By default, fields with empty or default values are
1661 // omitted from API requests. See
1662 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1663 // details.
1664 ForceSendFields []string `json:"-"`
1665 // NullFields is a list of field names (e.g. "Product") to include in API
1666 // requests with the JSON null value. By default, fields with empty values are
1667 // omitted from API requests. See
1668 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1669 NullFields []string `json:"-"`
1670 }
1671
1672 func (s SubscriptionLineItemBundleDetailsBundleElementDetails) MarshalJSON() ([]byte, error) {
1673 type NoMethod SubscriptionLineItemBundleDetailsBundleElementDetails
1674 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1675 }
1676
1677 // SubscriptionLineItemOneTimeRecurrenceDetails: Details for a ONE_TIME
1678 // recurrence line item.
1679 type SubscriptionLineItemOneTimeRecurrenceDetails struct {
1680 // ServicePeriod: Output only. The service period of the ONE_TIME line item.
1681 ServicePeriod *ServicePeriod `json:"servicePeriod,omitempty"`
1682 // ForceSendFields is a list of field names (e.g. "ServicePeriod") to
1683 // unconditionally include in API requests. By default, fields with empty or
1684 // default values are omitted from API requests. See
1685 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1686 // details.
1687 ForceSendFields []string `json:"-"`
1688 // NullFields is a list of field names (e.g. "ServicePeriod") to include in API
1689 // requests with the JSON null value. By default, fields with empty values are
1690 // omitted from API requests. See
1691 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1692 NullFields []string `json:"-"`
1693 }
1694
1695 func (s SubscriptionLineItemOneTimeRecurrenceDetails) MarshalJSON() ([]byte, error) {
1696 type NoMethod SubscriptionLineItemOneTimeRecurrenceDetails
1697 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1698 }
1699
1700 // SubscriptionMigrationDetails: Describes the details of the migrated
1701 // subscription.
1702 type SubscriptionMigrationDetails struct {
1703 // MigratedSubscriptionId: Output only. The migrated subscription id in the
1704 // legacy system.
1705 MigratedSubscriptionId string `json:"migratedSubscriptionId,omitempty"`
1706 // ForceSendFields is a list of field names (e.g. "MigratedSubscriptionId") to
1707 // unconditionally include in API requests. By default, fields with empty or
1708 // default values are omitted from API requests. See
1709 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1710 // details.
1711 ForceSendFields []string `json:"-"`
1712 // NullFields is a list of field names (e.g. "MigratedSubscriptionId") to
1713 // include in API requests with the JSON null value. By default, fields with
1714 // empty values are omitted from API requests. See
1715 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1716 NullFields []string `json:"-"`
1717 }
1718
1719 func (s SubscriptionMigrationDetails) MarshalJSON() ([]byte, error) {
1720 type NoMethod SubscriptionMigrationDetails
1721 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1722 }
1723
1724 // SubscriptionPromotionSpec: Describes the spec for one promotion.
1725 type SubscriptionPromotionSpec struct {
1726 // FreeTrialDuration: Output only. The duration of the free trial if the
1727 // promotion is of type FREE_TRIAL.
1728 FreeTrialDuration *Duration `json:"freeTrialDuration,omitempty"`
1729 // IntroductoryPricingDetails: Output only. The details of the introductory
1730 // pricing spec if the promotion is of type INTRODUCTORY_PRICING.
1731 IntroductoryPricingDetails *PromotionIntroductoryPricingDetails `json:"introductoryPricingDetails,omitempty"`
1732 // Promotion: Required. Promotion resource name that identifies a promotion.
1733 // The format is 'partners/{partner_id}/promotions/{promotion_id}'.
1734 Promotion string `json:"promotion,omitempty"`
1735 // Type: Output only. The type of the promotion for the spec.
1736 //
1737 // Possible values:
1738 // "PROMOTION_TYPE_UNSPECIFIED" - The promotion type is unspecified.
1739 // "PROMOTION_TYPE_FREE_TRIAL" - The promotion is a free trial.
1740 // "PROMOTION_TYPE_INTRODUCTORY_PRICING" - The promotion is a reduced
1741 // introductory pricing.
1742 Type string `json:"type,omitempty"`
1743 // ForceSendFields is a list of field names (e.g. "FreeTrialDuration") to
1744 // unconditionally include in API requests. By default, fields with empty or
1745 // default values are omitted from API requests. See
1746 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1747 // details.
1748 ForceSendFields []string `json:"-"`
1749 // NullFields is a list of field names (e.g. "FreeTrialDuration") to include in
1750 // API requests with the JSON null value. By default, fields with empty values
1751 // are omitted from API requests. See
1752 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1753 NullFields []string `json:"-"`
1754 }
1755
1756 func (s SubscriptionPromotionSpec) MarshalJSON() ([]byte, error) {
1757 type NoMethod SubscriptionPromotionSpec
1758 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1759 }
1760
1761 // SubscriptionUpgradeDowngradeDetails: Details about the previous subscription
1762 // that this new subscription upgrades/downgrades from.
1763 type SubscriptionUpgradeDowngradeDetails struct {
1764 // BillingCycleSpec: Required. Specifies the billing cycle spec for the new
1765 // upgraded/downgraded subscription.
1766 //
1767 // Possible values:
1768 // "BILLING_CYCLE_SPEC_UNSPECIFIED" - Billing cycle spec is not specified.
1769 // "BILLING_CYCLE_SPEC_ALIGN_WITH_PREVIOUS_SUBSCRIPTION" - The billing cycle
1770 // of the new subscription starts immediately but aligns with the previous
1771 // subscription it upgrades or downgrades from. First cycle of the new
1772 // subscription will be prorated.
1773 // "BILLING_CYCLE_SPEC_START_IMMEDIATELY" - The billing cycle of the new
1774 // subscription starts immediately.
1775 // "BILLING_CYCLE_SPEC_DEFERRED_TO_NEXT_RECURRENCE" - The new subscription
1776 // will have the same `renewalTime` as the previous subscription, while the
1777 // previous subscription is scheduled for cancellation at that same time.
1778 BillingCycleSpec string `json:"billingCycleSpec,omitempty"`
1779 // PreviousSubscriptionId: Required. The previous subscription id to be
1780 // replaced. The format can be one of the following: 1. `subscription_id`: the
1781 // old subscription id under the same partner_id. 2.
1782 // `partners/{partner_id}/subscriptions/{subscription_id}`. A different
1783 // partner_id is allowed. But they must be under the same partner group.
1784 PreviousSubscriptionId string `json:"previousSubscriptionId,omitempty"`
1785 // ForceSendFields is a list of field names (e.g. "BillingCycleSpec") to
1786 // unconditionally include in API requests. By default, fields with empty or
1787 // default values are omitted from API requests. See
1788 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1789 // details.
1790 ForceSendFields []string `json:"-"`
1791 // NullFields is a list of field names (e.g. "BillingCycleSpec") to include in
1792 // API requests with the JSON null value. By default, fields with empty values
1793 // are omitted from API requests. See
1794 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1795 NullFields []string `json:"-"`
1796 }
1797
1798 func (s SubscriptionUpgradeDowngradeDetails) MarshalJSON() ([]byte, error) {
1799 type NoMethod SubscriptionUpgradeDowngradeDetails
1800 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1801 }
1802
1803 // SuspendSubscriptionRequest: Request to suspend a subscription.
1804 type SuspendSubscriptionRequest struct {
1805 }
1806
1807 // SuspendSubscriptionResponse: Response that contains the suspended
1808 // subscription.
1809 type SuspendSubscriptionResponse struct {
1810 // Subscription: The suspended subscription resource.
1811 Subscription *Subscription `json:"subscription,omitempty"`
1812
1813 // ServerResponse contains the HTTP response code and headers from the server.
1814 googleapi.ServerResponse `json:"-"`
1815 // ForceSendFields is a list of field names (e.g. "Subscription") to
1816 // unconditionally include in API requests. By default, fields with empty or
1817 // default values are omitted from API requests. See
1818 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1819 // details.
1820 ForceSendFields []string `json:"-"`
1821 // NullFields is a list of field names (e.g. "Subscription") to include in API
1822 // requests with the JSON null value. By default, fields with empty values are
1823 // omitted from API requests. See
1824 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1825 NullFields []string `json:"-"`
1826 }
1827
1828 func (s SuspendSubscriptionResponse) MarshalJSON() ([]byte, error) {
1829 type NoMethod SuspendSubscriptionResponse
1830 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1831 }
1832
1833 // UndoCancelSubscriptionRequest: Request to revoke a cancellation request.
1834 type UndoCancelSubscriptionRequest struct {
1835 }
1836
1837 // UndoCancelSubscriptionResponse: Response that contains the updated
1838 // subscription resource.
1839 type UndoCancelSubscriptionResponse struct {
1840 // Subscription: The updated subscription resource.
1841 Subscription *Subscription `json:"subscription,omitempty"`
1842
1843 // ServerResponse contains the HTTP response code and headers from the server.
1844 googleapi.ServerResponse `json:"-"`
1845 // ForceSendFields is a list of field names (e.g. "Subscription") to
1846 // unconditionally include in API requests. By default, fields with empty or
1847 // default values are omitted from API requests. See
1848 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1849 // details.
1850 ForceSendFields []string `json:"-"`
1851 // NullFields is a list of field names (e.g. "Subscription") to include in API
1852 // requests with the JSON null value. By default, fields with empty values are
1853 // omitted from API requests. See
1854 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1855 NullFields []string `json:"-"`
1856 }
1857
1858 func (s UndoCancelSubscriptionResponse) MarshalJSON() ([]byte, error) {
1859 type NoMethod UndoCancelSubscriptionResponse
1860 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1861 }
1862
1863 // UserSession: Contains a short-lived token containing information required to
1864 // interact with the Google Payments Reseller Platform via web endpoints. -
1865 // Generate a user session token dynamically for an authenticated user. Do not
1866 // share a token directly with a user in an unauthenticated context, such as
1867 // SMS or email. - You can regenerate new session tokens repeatedly for the
1868 // same `generate` request if necessary, regardless of whether previous tokens
1869 // have expired. Multiple sessions will not result in duplicate fulfillments
1870 // because the `subscription ID` guarantees uniqueness. For more integration
1871 // details, see the Google Managed Signup
1872 // (/payments/reseller/subscription/reference/index/User.Signup.Integration/Goog
1873 // le.Managed.Signup) documentation.
1874 type UserSession struct {
1875 // ExpireTime: Output only. The time at which the user session expires.
1876 ExpireTime string `json:"expireTime,omitempty"`
1877 // Token: Output only. The encrypted token of the user session, including the
1878 // information of the user's intent and request. This token should be provided
1879 // when redirecting the user to Google.
1880 Token string `json:"token,omitempty"`
1881 // ForceSendFields is a list of field names (e.g. "ExpireTime") to
1882 // unconditionally include in API requests. By default, fields with empty or
1883 // default values are omitted from API requests. See
1884 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1885 // details.
1886 ForceSendFields []string `json:"-"`
1887 // NullFields is a list of field names (e.g. "ExpireTime") to include in API
1888 // requests with the JSON null value. By default, fields with empty values are
1889 // omitted from API requests. See
1890 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1891 NullFields []string `json:"-"`
1892 }
1893
1894 func (s UserSession) MarshalJSON() ([]byte, error) {
1895 type NoMethod UserSession
1896 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1897 }
1898
1899 // YoutubePayload: Payload specific to Youtube products.
1900 type YoutubePayload struct {
1901 // AccessEndTime: Output only. The access expiration time for this line item.
1902 AccessEndTime string `json:"accessEndTime,omitempty"`
1903 // PartnerEligibilityIds: The list of eligibility_ids which are applicable for
1904 // the line item.
1905 PartnerEligibilityIds []string `json:"partnerEligibilityIds,omitempty"`
1906 // PartnerPlanType: Optional. Specifies the plan type offered to the end user
1907 // by the partner.
1908 //
1909 // Possible values:
1910 // "PARTNER_PLAN_TYPE_UNSPECIFIED" - Unspecified. Should not use, reserved as
1911 // an invalid value.
1912 // "PARTNER_PLAN_TYPE_STANDALONE" - This item is offered as a standalone
1913 // product to the user.
1914 // "PARTNER_PLAN_TYPE_HARD_BUNDLE" - This item is bundled with another
1915 // partner offering, the item is provisioned at purchase time.
1916 // "PARTNER_PLAN_TYPE_SOFT_BUNDLE" - This item is bundled with another
1917 // partner offering, the item is provisioned after puchase, when the user opts
1918 // in this Google service.
1919 PartnerPlanType string `json:"partnerPlanType,omitempty"`
1920 // ForceSendFields is a list of field names (e.g. "AccessEndTime") to
1921 // unconditionally include in API requests. By default, fields with empty or
1922 // default values are omitted from API requests. See
1923 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1924 // details.
1925 ForceSendFields []string `json:"-"`
1926 // NullFields is a list of field names (e.g. "AccessEndTime") to include in API
1927 // requests with the JSON null value. By default, fields with empty values are
1928 // omitted from API requests. See
1929 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1930 NullFields []string `json:"-"`
1931 }
1932
1933 func (s YoutubePayload) MarshalJSON() ([]byte, error) {
1934 type NoMethod YoutubePayload
1935 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1936 }
1937
1938 type PartnersProductsListCall struct {
1939 s *Service
1940 parent string
1941 urlParams_ gensupport.URLParams
1942 ifNoneMatch_ string
1943 ctx_ context.Context
1944 header_ http.Header
1945 }
1946
1947 // List: Currently, it doesn't support **YouTube** products. Retrieves the
1948 // products that can be resold by the partner. It should be authenticated with
1949 // a service account.
1950 //
1951 // - parent: The parent, the partner that can resell. Format:
1952 // partners/{partner}.
1953 func (r *PartnersProductsService) List(parent string) *PartnersProductsListCall {
1954 c := &PartnersProductsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1955 c.parent = parent
1956 return c
1957 }
1958
1959 // Filter sets the optional parameter "filter": Specifies the filters for the
1960 // product results. The syntax is defined in https://google.aip.dev/160 with
1961 // the following caveats: 1. Only the following features are supported: -
1962 // Logical operator `AND` - Comparison operator `=` (no wildcards `*`) -
1963 // Traversal operator `.` - Has operator `:` (no wildcards `*`) 2. Only the
1964 // following fields are supported: - `regionCodes` -
1965 // `youtubePayload.partnerEligibilityId` - `youtubePayload.postalCode` 3.
1966 // Unless explicitly mentioned above, other features are not supported.
1967 // Example: `regionCodes:US AND youtubePayload.postalCode=94043 AND
1968 // youtubePayload.partnerEligibilityId=eligibility-id`
1969 func (c *PartnersProductsListCall) Filter(filter string) *PartnersProductsListCall {
1970 c.urlParams_.Set("filter", filter)
1971 return c
1972 }
1973
1974 // PageSize sets the optional parameter "pageSize": The maximum number of
1975 // products to return. The service may return fewer than this value. If
1976 // unspecified, at most 50 products will be returned. The maximum value is
1977 // 1000; values above 1000 will be coerced to 1000.
1978 func (c *PartnersProductsListCall) PageSize(pageSize int64) *PartnersProductsListCall {
1979 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
1980 return c
1981 }
1982
1983 // PageToken sets the optional parameter "pageToken": A page token, received
1984 // from a previous `ListProducts` call. Provide this to retrieve the subsequent
1985 // page. When paginating, all other parameters provided to `ListProducts` must
1986 // match the call that provided the page token.
1987 func (c *PartnersProductsListCall) PageToken(pageToken string) *PartnersProductsListCall {
1988 c.urlParams_.Set("pageToken", pageToken)
1989 return c
1990 }
1991
1992 // Fields allows partial responses to be retrieved. See
1993 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1994 // details.
1995 func (c *PartnersProductsListCall) Fields(s ...googleapi.Field) *PartnersProductsListCall {
1996 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1997 return c
1998 }
1999
2000 // IfNoneMatch sets an optional parameter which makes the operation fail if the
2001 // object's ETag matches the given value. This is useful for getting updates
2002 // only after the object has changed since the last request.
2003 func (c *PartnersProductsListCall) IfNoneMatch(entityTag string) *PartnersProductsListCall {
2004 c.ifNoneMatch_ = entityTag
2005 return c
2006 }
2007
2008 // Context sets the context to be used in this call's Do method.
2009 func (c *PartnersProductsListCall) Context(ctx context.Context) *PartnersProductsListCall {
2010 c.ctx_ = ctx
2011 return c
2012 }
2013
2014 // Header returns a http.Header that can be modified by the caller to add
2015 // headers to the request.
2016 func (c *PartnersProductsListCall) Header() http.Header {
2017 if c.header_ == nil {
2018 c.header_ = make(http.Header)
2019 }
2020 return c.header_
2021 }
2022
2023 func (c *PartnersProductsListCall) doRequest(alt string) (*http.Response, error) {
2024 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2025 if c.ifNoneMatch_ != "" {
2026 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2027 }
2028 c.urlParams_.Set("alt", alt)
2029 c.urlParams_.Set("prettyPrint", "false")
2030 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/products")
2031 urls += "?" + c.urlParams_.Encode()
2032 req, err := http.NewRequest("GET", urls, nil)
2033 if err != nil {
2034 return nil, err
2035 }
2036 req.Header = reqHeaders
2037 googleapi.Expand(req.URL, map[string]string{
2038 "parent": c.parent,
2039 })
2040 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.products.list", "request", internallog.HTTPRequest(req, nil))
2041 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2042 }
2043
2044 // Do executes the "paymentsresellersubscription.partners.products.list" call.
2045 // Any non-2xx status code is an error. Response headers are in either
2046 // *ListProductsResponse.ServerResponse.Header or (if a response was returned
2047 // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
2048 // check whether the returned error was because http.StatusNotModified was
2049 // returned.
2050 func (c *PartnersProductsListCall) Do(opts ...googleapi.CallOption) (*ListProductsResponse, error) {
2051 gensupport.SetOptions(c.urlParams_, opts...)
2052 res, err := c.doRequest("json")
2053 if res != nil && res.StatusCode == http.StatusNotModified {
2054 if res.Body != nil {
2055 res.Body.Close()
2056 }
2057 return nil, gensupport.WrapError(&googleapi.Error{
2058 Code: res.StatusCode,
2059 Header: res.Header,
2060 })
2061 }
2062 if err != nil {
2063 return nil, err
2064 }
2065 defer googleapi.CloseBody(res)
2066 if err := googleapi.CheckResponse(res); err != nil {
2067 return nil, gensupport.WrapError(err)
2068 }
2069 ret := &ListProductsResponse{
2070 ServerResponse: googleapi.ServerResponse{
2071 Header: res.Header,
2072 HTTPStatusCode: res.StatusCode,
2073 },
2074 }
2075 target := &ret
2076 b, err := gensupport.DecodeResponseBytes(target, res)
2077 if err != nil {
2078 return nil, err
2079 }
2080 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.products.list", "response", internallog.HTTPResponse(res, b))
2081 return ret, nil
2082 }
2083
2084 // Pages invokes f for each page of results.
2085 // A non-nil error returned from f will halt the iteration.
2086 // The provided context supersedes any context provided to the Context method.
2087 func (c *PartnersProductsListCall) Pages(ctx context.Context, f func(*ListProductsResponse) error) error {
2088 c.ctx_ = ctx
2089 defer c.PageToken(c.urlParams_.Get("pageToken"))
2090 for {
2091 x, err := c.Do()
2092 if err != nil {
2093 return err
2094 }
2095 if err := f(x); err != nil {
2096 return err
2097 }
2098 if x.NextPageToken == "" {
2099 return nil
2100 }
2101 c.PageToken(x.NextPageToken)
2102 }
2103 }
2104
2105 type PartnersPromotionsFindEligibleCall struct {
2106 s *Service
2107 parent string
2108 findeligiblepromotionsrequest *FindEligiblePromotionsRequest
2109 urlParams_ gensupport.URLParams
2110 ctx_ context.Context
2111 header_ http.Header
2112 }
2113
2114 // FindEligible: Currently, it is only enabled for **YouTube**. Finds eligible
2115 // promotions for the current user. The API requires user authorization via
2116 // OAuth. The bare minimum oauth scope `openid` is sufficient, which will skip
2117 // the consent screen.
2118 //
2119 // - parent: The parent, the partner that can resell. Format:
2120 // partners/{partner}.
2121 func (r *PartnersPromotionsService) FindEligible(parent string, findeligiblepromotionsrequest *FindEligiblePromotionsRequest) *PartnersPromotionsFindEligibleCall {
2122 c := &PartnersPromotionsFindEligibleCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2123 c.parent = parent
2124 c.findeligiblepromotionsrequest = findeligiblepromotionsrequest
2125 return c
2126 }
2127
2128 // Fields allows partial responses to be retrieved. See
2129 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
2130 // details.
2131 func (c *PartnersPromotionsFindEligibleCall) Fields(s ...googleapi.Field) *PartnersPromotionsFindEligibleCall {
2132 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2133 return c
2134 }
2135
2136 // Context sets the context to be used in this call's Do method.
2137 func (c *PartnersPromotionsFindEligibleCall) Context(ctx context.Context) *PartnersPromotionsFindEligibleCall {
2138 c.ctx_ = ctx
2139 return c
2140 }
2141
2142 // Header returns a http.Header that can be modified by the caller to add
2143 // headers to the request.
2144 func (c *PartnersPromotionsFindEligibleCall) Header() http.Header {
2145 if c.header_ == nil {
2146 c.header_ = make(http.Header)
2147 }
2148 return c.header_
2149 }
2150
2151 func (c *PartnersPromotionsFindEligibleCall) doRequest(alt string) (*http.Response, error) {
2152 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2153 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.findeligiblepromotionsrequest)
2154 if err != nil {
2155 return nil, err
2156 }
2157 c.urlParams_.Set("alt", alt)
2158 c.urlParams_.Set("prettyPrint", "false")
2159 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/promotions:findEligible")
2160 urls += "?" + c.urlParams_.Encode()
2161 req, err := http.NewRequest("POST", urls, body)
2162 if err != nil {
2163 return nil, err
2164 }
2165 req.Header = reqHeaders
2166 googleapi.Expand(req.URL, map[string]string{
2167 "parent": c.parent,
2168 })
2169 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.promotions.findEligible", "request", internallog.HTTPRequest(req, body.Bytes()))
2170 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2171 }
2172
2173 // Do executes the "paymentsresellersubscription.partners.promotions.findEligible" call.
2174 // Any non-2xx status code is an error. Response headers are in either
2175 // *FindEligiblePromotionsResponse.ServerResponse.Header or (if a response was
2176 // returned at all) in error.(*googleapi.Error).Header. Use
2177 // googleapi.IsNotModified to check whether the returned error was because
2178 // http.StatusNotModified was returned.
2179 func (c *PartnersPromotionsFindEligibleCall) Do(opts ...googleapi.CallOption) (*FindEligiblePromotionsResponse, error) {
2180 gensupport.SetOptions(c.urlParams_, opts...)
2181 res, err := c.doRequest("json")
2182 if res != nil && res.StatusCode == http.StatusNotModified {
2183 if res.Body != nil {
2184 res.Body.Close()
2185 }
2186 return nil, gensupport.WrapError(&googleapi.Error{
2187 Code: res.StatusCode,
2188 Header: res.Header,
2189 })
2190 }
2191 if err != nil {
2192 return nil, err
2193 }
2194 defer googleapi.CloseBody(res)
2195 if err := googleapi.CheckResponse(res); err != nil {
2196 return nil, gensupport.WrapError(err)
2197 }
2198 ret := &FindEligiblePromotionsResponse{
2199 ServerResponse: googleapi.ServerResponse{
2200 Header: res.Header,
2201 HTTPStatusCode: res.StatusCode,
2202 },
2203 }
2204 target := &ret
2205 b, err := gensupport.DecodeResponseBytes(target, res)
2206 if err != nil {
2207 return nil, err
2208 }
2209 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.promotions.findEligible", "response", internallog.HTTPResponse(res, b))
2210 return ret, nil
2211 }
2212
2213 // Pages invokes f for each page of results.
2214 // A non-nil error returned from f will halt the iteration.
2215 // The provided context supersedes any context provided to the Context method.
2216 func (c *PartnersPromotionsFindEligibleCall) Pages(ctx context.Context, f func(*FindEligiblePromotionsResponse) error) error {
2217 c.ctx_ = ctx
2218 defer func(pt string) { c.findeligiblepromotionsrequest.PageToken = pt }(c.findeligiblepromotionsrequest.PageToken)
2219 for {
2220 x, err := c.Do()
2221 if err != nil {
2222 return err
2223 }
2224 if err := f(x); err != nil {
2225 return err
2226 }
2227 if x.NextPageToken == "" {
2228 return nil
2229 }
2230 c.findeligiblepromotionsrequest.PageToken = x.NextPageToken
2231 }
2232 }
2233
2234 type PartnersPromotionsListCall struct {
2235 s *Service
2236 parent string
2237 urlParams_ gensupport.URLParams
2238 ifNoneMatch_ string
2239 ctx_ context.Context
2240 header_ http.Header
2241 }
2242
2243 // List: Currently, it doesn't support **YouTube** promotions. Retrieves the
2244 // promotions, such as free trial, that can be used by the partner. It should
2245 // be authenticated with a service account.
2246 //
2247 // - parent: The parent, the partner that can resell. Format:
2248 // partners/{partner}.
2249 func (r *PartnersPromotionsService) List(parent string) *PartnersPromotionsListCall {
2250 c := &PartnersPromotionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2251 c.parent = parent
2252 return c
2253 }
2254
2255 // Filter sets the optional parameter "filter": Specifies the filters for the
2256 // promotion results. The syntax is defined in https://google.aip.dev/160 with
2257 // the following caveats: 1. Only the following features are supported: -
2258 // Logical operator `AND` - Comparison operator `=` (no wildcards `*`) -
2259 // Traversal operator `.` - Has operator `:` (no wildcards `*`) 2. Only the
2260 // following fields are supported: - `applicableProducts` - `regionCodes` -
2261 // `youtubePayload.partnerEligibilityId` - `youtubePayload.postalCode` 3.
2262 // Unless explicitly mentioned above, other features are not supported.
2263 // Example: `applicableProducts:partners/partner1/products/product1 AND
2264 // regionCodes:US AND youtubePayload.postalCode=94043 AND
2265 // youtubePayload.partnerEligibilityId=eligibility-id`
2266 func (c *PartnersPromotionsListCall) Filter(filter string) *PartnersPromotionsListCall {
2267 c.urlParams_.Set("filter", filter)
2268 return c
2269 }
2270
2271 // PageSize sets the optional parameter "pageSize": The maximum number of
2272 // promotions to return. The service may return fewer than this value. If
2273 // unspecified, at most 50 promotions will be returned. The maximum value is
2274 // 1000; values above 1000 will be coerced to 1000.
2275 func (c *PartnersPromotionsListCall) PageSize(pageSize int64) *PartnersPromotionsListCall {
2276 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
2277 return c
2278 }
2279
2280 // PageToken sets the optional parameter "pageToken": A page token, received
2281 // from a previous `ListPromotions` call. Provide this to retrieve the
2282 // subsequent page. When paginating, all other parameters provided to
2283 // `ListPromotions` must match the call that provided the page token.
2284 func (c *PartnersPromotionsListCall) PageToken(pageToken string) *PartnersPromotionsListCall {
2285 c.urlParams_.Set("pageToken", pageToken)
2286 return c
2287 }
2288
2289 // Fields allows partial responses to be retrieved. See
2290 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
2291 // details.
2292 func (c *PartnersPromotionsListCall) Fields(s ...googleapi.Field) *PartnersPromotionsListCall {
2293 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2294 return c
2295 }
2296
2297 // IfNoneMatch sets an optional parameter which makes the operation fail if the
2298 // object's ETag matches the given value. This is useful for getting updates
2299 // only after the object has changed since the last request.
2300 func (c *PartnersPromotionsListCall) IfNoneMatch(entityTag string) *PartnersPromotionsListCall {
2301 c.ifNoneMatch_ = entityTag
2302 return c
2303 }
2304
2305 // Context sets the context to be used in this call's Do method.
2306 func (c *PartnersPromotionsListCall) Context(ctx context.Context) *PartnersPromotionsListCall {
2307 c.ctx_ = ctx
2308 return c
2309 }
2310
2311 // Header returns a http.Header that can be modified by the caller to add
2312 // headers to the request.
2313 func (c *PartnersPromotionsListCall) Header() http.Header {
2314 if c.header_ == nil {
2315 c.header_ = make(http.Header)
2316 }
2317 return c.header_
2318 }
2319
2320 func (c *PartnersPromotionsListCall) doRequest(alt string) (*http.Response, error) {
2321 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2322 if c.ifNoneMatch_ != "" {
2323 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2324 }
2325 c.urlParams_.Set("alt", alt)
2326 c.urlParams_.Set("prettyPrint", "false")
2327 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/promotions")
2328 urls += "?" + c.urlParams_.Encode()
2329 req, err := http.NewRequest("GET", urls, nil)
2330 if err != nil {
2331 return nil, err
2332 }
2333 req.Header = reqHeaders
2334 googleapi.Expand(req.URL, map[string]string{
2335 "parent": c.parent,
2336 })
2337 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.promotions.list", "request", internallog.HTTPRequest(req, nil))
2338 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2339 }
2340
2341 // Do executes the "paymentsresellersubscription.partners.promotions.list" call.
2342 // Any non-2xx status code is an error. Response headers are in either
2343 // *ListPromotionsResponse.ServerResponse.Header or (if a response was returned
2344 // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
2345 // check whether the returned error was because http.StatusNotModified was
2346 // returned.
2347 func (c *PartnersPromotionsListCall) Do(opts ...googleapi.CallOption) (*ListPromotionsResponse, error) {
2348 gensupport.SetOptions(c.urlParams_, opts...)
2349 res, err := c.doRequest("json")
2350 if res != nil && res.StatusCode == http.StatusNotModified {
2351 if res.Body != nil {
2352 res.Body.Close()
2353 }
2354 return nil, gensupport.WrapError(&googleapi.Error{
2355 Code: res.StatusCode,
2356 Header: res.Header,
2357 })
2358 }
2359 if err != nil {
2360 return nil, err
2361 }
2362 defer googleapi.CloseBody(res)
2363 if err := googleapi.CheckResponse(res); err != nil {
2364 return nil, gensupport.WrapError(err)
2365 }
2366 ret := &ListPromotionsResponse{
2367 ServerResponse: googleapi.ServerResponse{
2368 Header: res.Header,
2369 HTTPStatusCode: res.StatusCode,
2370 },
2371 }
2372 target := &ret
2373 b, err := gensupport.DecodeResponseBytes(target, res)
2374 if err != nil {
2375 return nil, err
2376 }
2377 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.promotions.list", "response", internallog.HTTPResponse(res, b))
2378 return ret, nil
2379 }
2380
2381 // Pages invokes f for each page of results.
2382 // A non-nil error returned from f will halt the iteration.
2383 // The provided context supersedes any context provided to the Context method.
2384 func (c *PartnersPromotionsListCall) Pages(ctx context.Context, f func(*ListPromotionsResponse) error) error {
2385 c.ctx_ = ctx
2386 defer c.PageToken(c.urlParams_.Get("pageToken"))
2387 for {
2388 x, err := c.Do()
2389 if err != nil {
2390 return err
2391 }
2392 if err := f(x); err != nil {
2393 return err
2394 }
2395 if x.NextPageToken == "" {
2396 return nil
2397 }
2398 c.PageToken(x.NextPageToken)
2399 }
2400 }
2401
2402 type PartnersSubscriptionsCancelCall struct {
2403 s *Service
2404 name string
2405 cancelsubscriptionrequest *CancelSubscriptionRequest
2406 urlParams_ gensupport.URLParams
2407 ctx_ context.Context
2408 header_ http.Header
2409 }
2410
2411 // Cancel: Cancels a subscription service either immediately or by the end of
2412 // the current billing cycle for their customers. It should be called directly
2413 // by the partner using service accounts.
2414 //
2415 // - name: The name of the subscription resource to be cancelled. It will have
2416 // the format of "partners/{partner_id}/subscriptions/{subscription_id}".
2417 func (r *PartnersSubscriptionsService) Cancel(name string, cancelsubscriptionrequest *CancelSubscriptionRequest) *PartnersSubscriptionsCancelCall {
2418 c := &PartnersSubscriptionsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2419 c.name = name
2420 c.cancelsubscriptionrequest = cancelsubscriptionrequest
2421 return c
2422 }
2423
2424 // Fields allows partial responses to be retrieved. See
2425 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
2426 // details.
2427 func (c *PartnersSubscriptionsCancelCall) Fields(s ...googleapi.Field) *PartnersSubscriptionsCancelCall {
2428 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2429 return c
2430 }
2431
2432 // Context sets the context to be used in this call's Do method.
2433 func (c *PartnersSubscriptionsCancelCall) Context(ctx context.Context) *PartnersSubscriptionsCancelCall {
2434 c.ctx_ = ctx
2435 return c
2436 }
2437
2438 // Header returns a http.Header that can be modified by the caller to add
2439 // headers to the request.
2440 func (c *PartnersSubscriptionsCancelCall) Header() http.Header {
2441 if c.header_ == nil {
2442 c.header_ = make(http.Header)
2443 }
2444 return c.header_
2445 }
2446
2447 func (c *PartnersSubscriptionsCancelCall) doRequest(alt string) (*http.Response, error) {
2448 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2449 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.cancelsubscriptionrequest)
2450 if err != nil {
2451 return nil, err
2452 }
2453 c.urlParams_.Set("alt", alt)
2454 c.urlParams_.Set("prettyPrint", "false")
2455 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:cancel")
2456 urls += "?" + c.urlParams_.Encode()
2457 req, err := http.NewRequest("POST", urls, body)
2458 if err != nil {
2459 return nil, err
2460 }
2461 req.Header = reqHeaders
2462 googleapi.Expand(req.URL, map[string]string{
2463 "name": c.name,
2464 })
2465 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.cancel", "request", internallog.HTTPRequest(req, body.Bytes()))
2466 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2467 }
2468
2469 // Do executes the "paymentsresellersubscription.partners.subscriptions.cancel" call.
2470 // Any non-2xx status code is an error. Response headers are in either
2471 // *CancelSubscriptionResponse.ServerResponse.Header or (if a response was
2472 // returned at all) in error.(*googleapi.Error).Header. Use
2473 // googleapi.IsNotModified to check whether the returned error was because
2474 // http.StatusNotModified was returned.
2475 func (c *PartnersSubscriptionsCancelCall) Do(opts ...googleapi.CallOption) (*CancelSubscriptionResponse, error) {
2476 gensupport.SetOptions(c.urlParams_, opts...)
2477 res, err := c.doRequest("json")
2478 if res != nil && res.StatusCode == http.StatusNotModified {
2479 if res.Body != nil {
2480 res.Body.Close()
2481 }
2482 return nil, gensupport.WrapError(&googleapi.Error{
2483 Code: res.StatusCode,
2484 Header: res.Header,
2485 })
2486 }
2487 if err != nil {
2488 return nil, err
2489 }
2490 defer googleapi.CloseBody(res)
2491 if err := googleapi.CheckResponse(res); err != nil {
2492 return nil, gensupport.WrapError(err)
2493 }
2494 ret := &CancelSubscriptionResponse{
2495 ServerResponse: googleapi.ServerResponse{
2496 Header: res.Header,
2497 HTTPStatusCode: res.StatusCode,
2498 },
2499 }
2500 target := &ret
2501 b, err := gensupport.DecodeResponseBytes(target, res)
2502 if err != nil {
2503 return nil, err
2504 }
2505 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.cancel", "response", internallog.HTTPResponse(res, b))
2506 return ret, nil
2507 }
2508
2509 type PartnersSubscriptionsCreateCall struct {
2510 s *Service
2511 parentid string
2512 subscription *Subscription
2513 urlParams_ gensupport.URLParams
2514 ctx_ context.Context
2515 header_ http.Header
2516 }
2517
2518 // Create: Used by partners to create a subscription for their customers. The
2519 // created subscription is associated with the end user inferred from the end
2520 // user credentials. This API must be authorized by the end user using OAuth.
2521 //
2522 // - parent: The parent resource name, which is the identifier of the partner.
2523 // It will have the format of "partners/{partner_id}".
2524 func (r *PartnersSubscriptionsService) Create(parentid string, subscription *Subscription) *PartnersSubscriptionsCreateCall {
2525 c := &PartnersSubscriptionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2526 c.parentid = parentid
2527 c.subscription = subscription
2528 return c
2529 }
2530
2531 // SubscriptionId sets the optional parameter "subscriptionId": Required.
2532 // Identifies the subscription resource on the Partner side. The value is
2533 // restricted to 63 ASCII characters at the maximum. If a subscription with the
2534 // same ID already exists, the creation fails with an `ALREADY_EXISTS` error.
2535 func (c *PartnersSubscriptionsCreateCall) SubscriptionId(subscriptionId string) *PartnersSubscriptionsCreateCall {
2536 c.urlParams_.Set("subscriptionId", subscriptionId)
2537 return c
2538 }
2539
2540 // Fields allows partial responses to be retrieved. See
2541 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
2542 // details.
2543 func (c *PartnersSubscriptionsCreateCall) Fields(s ...googleapi.Field) *PartnersSubscriptionsCreateCall {
2544 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2545 return c
2546 }
2547
2548 // Context sets the context to be used in this call's Do method.
2549 func (c *PartnersSubscriptionsCreateCall) Context(ctx context.Context) *PartnersSubscriptionsCreateCall {
2550 c.ctx_ = ctx
2551 return c
2552 }
2553
2554 // Header returns a http.Header that can be modified by the caller to add
2555 // headers to the request.
2556 func (c *PartnersSubscriptionsCreateCall) Header() http.Header {
2557 if c.header_ == nil {
2558 c.header_ = make(http.Header)
2559 }
2560 return c.header_
2561 }
2562
2563 func (c *PartnersSubscriptionsCreateCall) doRequest(alt string) (*http.Response, error) {
2564 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2565 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.subscription)
2566 if err != nil {
2567 return nil, err
2568 }
2569 c.urlParams_.Set("alt", alt)
2570 c.urlParams_.Set("prettyPrint", "false")
2571 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/subscriptions")
2572 urls += "?" + c.urlParams_.Encode()
2573 req, err := http.NewRequest("POST", urls, body)
2574 if err != nil {
2575 return nil, err
2576 }
2577 req.Header = reqHeaders
2578 googleapi.Expand(req.URL, map[string]string{
2579 "parent": c.parentid,
2580 })
2581 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.create", "request", internallog.HTTPRequest(req, body.Bytes()))
2582 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2583 }
2584
2585 // Do executes the "paymentsresellersubscription.partners.subscriptions.create" call.
2586 // Any non-2xx status code is an error. Response headers are in either
2587 // *Subscription.ServerResponse.Header or (if a response was returned at all)
2588 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
2589 // whether the returned error was because http.StatusNotModified was returned.
2590 func (c *PartnersSubscriptionsCreateCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
2591 gensupport.SetOptions(c.urlParams_, opts...)
2592 res, err := c.doRequest("json")
2593 if res != nil && res.StatusCode == http.StatusNotModified {
2594 if res.Body != nil {
2595 res.Body.Close()
2596 }
2597 return nil, gensupport.WrapError(&googleapi.Error{
2598 Code: res.StatusCode,
2599 Header: res.Header,
2600 })
2601 }
2602 if err != nil {
2603 return nil, err
2604 }
2605 defer googleapi.CloseBody(res)
2606 if err := googleapi.CheckResponse(res); err != nil {
2607 return nil, gensupport.WrapError(err)
2608 }
2609 ret := &Subscription{
2610 ServerResponse: googleapi.ServerResponse{
2611 Header: res.Header,
2612 HTTPStatusCode: res.StatusCode,
2613 },
2614 }
2615 target := &ret
2616 b, err := gensupport.DecodeResponseBytes(target, res)
2617 if err != nil {
2618 return nil, err
2619 }
2620 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.create", "response", internallog.HTTPResponse(res, b))
2621 return ret, nil
2622 }
2623
2624 type PartnersSubscriptionsEntitleCall struct {
2625 s *Service
2626 name string
2627 entitlesubscriptionrequest *EntitleSubscriptionRequest
2628 urlParams_ gensupport.URLParams
2629 ctx_ context.Context
2630 header_ http.Header
2631 }
2632
2633 // Entitle: Entitles a previously provisioned subscription to the current end
2634 // user. The end user identity is inferred from the authorized credential of
2635 // the request. This API must be authorized by the end user using OAuth.
2636 //
2637 // - name: The name of the subscription resource that is entitled to the
2638 // current end user. It will have the format of
2639 // "partners/{partner_id}/subscriptions/{subscription_id}".
2640 func (r *PartnersSubscriptionsService) Entitle(name string, entitlesubscriptionrequest *EntitleSubscriptionRequest) *PartnersSubscriptionsEntitleCall {
2641 c := &PartnersSubscriptionsEntitleCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2642 c.name = name
2643 c.entitlesubscriptionrequest = entitlesubscriptionrequest
2644 return c
2645 }
2646
2647 // Fields allows partial responses to be retrieved. See
2648 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
2649 // details.
2650 func (c *PartnersSubscriptionsEntitleCall) Fields(s ...googleapi.Field) *PartnersSubscriptionsEntitleCall {
2651 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2652 return c
2653 }
2654
2655 // Context sets the context to be used in this call's Do method.
2656 func (c *PartnersSubscriptionsEntitleCall) Context(ctx context.Context) *PartnersSubscriptionsEntitleCall {
2657 c.ctx_ = ctx
2658 return c
2659 }
2660
2661 // Header returns a http.Header that can be modified by the caller to add
2662 // headers to the request.
2663 func (c *PartnersSubscriptionsEntitleCall) Header() http.Header {
2664 if c.header_ == nil {
2665 c.header_ = make(http.Header)
2666 }
2667 return c.header_
2668 }
2669
2670 func (c *PartnersSubscriptionsEntitleCall) doRequest(alt string) (*http.Response, error) {
2671 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2672 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.entitlesubscriptionrequest)
2673 if err != nil {
2674 return nil, err
2675 }
2676 c.urlParams_.Set("alt", alt)
2677 c.urlParams_.Set("prettyPrint", "false")
2678 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:entitle")
2679 urls += "?" + c.urlParams_.Encode()
2680 req, err := http.NewRequest("POST", urls, body)
2681 if err != nil {
2682 return nil, err
2683 }
2684 req.Header = reqHeaders
2685 googleapi.Expand(req.URL, map[string]string{
2686 "name": c.name,
2687 })
2688 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.entitle", "request", internallog.HTTPRequest(req, body.Bytes()))
2689 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2690 }
2691
2692 // Do executes the "paymentsresellersubscription.partners.subscriptions.entitle" call.
2693 // Any non-2xx status code is an error. Response headers are in either
2694 // *EntitleSubscriptionResponse.ServerResponse.Header or (if a response was
2695 // returned at all) in error.(*googleapi.Error).Header. Use
2696 // googleapi.IsNotModified to check whether the returned error was because
2697 // http.StatusNotModified was returned.
2698 func (c *PartnersSubscriptionsEntitleCall) Do(opts ...googleapi.CallOption) (*EntitleSubscriptionResponse, error) {
2699 gensupport.SetOptions(c.urlParams_, opts...)
2700 res, err := c.doRequest("json")
2701 if res != nil && res.StatusCode == http.StatusNotModified {
2702 if res.Body != nil {
2703 res.Body.Close()
2704 }
2705 return nil, gensupport.WrapError(&googleapi.Error{
2706 Code: res.StatusCode,
2707 Header: res.Header,
2708 })
2709 }
2710 if err != nil {
2711 return nil, err
2712 }
2713 defer googleapi.CloseBody(res)
2714 if err := googleapi.CheckResponse(res); err != nil {
2715 return nil, gensupport.WrapError(err)
2716 }
2717 ret := &EntitleSubscriptionResponse{
2718 ServerResponse: googleapi.ServerResponse{
2719 Header: res.Header,
2720 HTTPStatusCode: res.StatusCode,
2721 },
2722 }
2723 target := &ret
2724 b, err := gensupport.DecodeResponseBytes(target, res)
2725 if err != nil {
2726 return nil, err
2727 }
2728 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.entitle", "response", internallog.HTTPResponse(res, b))
2729 return ret, nil
2730 }
2731
2732 type PartnersSubscriptionsExtendCall struct {
2733 s *Service
2734 name string
2735 extendsubscriptionrequest *ExtendSubscriptionRequest
2736 urlParams_ gensupport.URLParams
2737 ctx_ context.Context
2738 header_ http.Header
2739 }
2740
2741 // Extend: [Opt-in only] Most partners should be on auto-extend by default.
2742 // Extends a subscription service for their customers on an ongoing basis for
2743 // the subscription to remain active and renewable. It should be called
2744 // directly by the partner using service accounts.
2745 //
2746 // - name: The name of the subscription resource to be extended. It will have
2747 // the format of "partners/{partner_id}/subscriptions/{subscription_id}".
2748 func (r *PartnersSubscriptionsService) Extend(name string, extendsubscriptionrequest *ExtendSubscriptionRequest) *PartnersSubscriptionsExtendCall {
2749 c := &PartnersSubscriptionsExtendCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2750 c.name = name
2751 c.extendsubscriptionrequest = extendsubscriptionrequest
2752 return c
2753 }
2754
2755 // Fields allows partial responses to be retrieved. See
2756 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
2757 // details.
2758 func (c *PartnersSubscriptionsExtendCall) Fields(s ...googleapi.Field) *PartnersSubscriptionsExtendCall {
2759 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2760 return c
2761 }
2762
2763 // Context sets the context to be used in this call's Do method.
2764 func (c *PartnersSubscriptionsExtendCall) Context(ctx context.Context) *PartnersSubscriptionsExtendCall {
2765 c.ctx_ = ctx
2766 return c
2767 }
2768
2769 // Header returns a http.Header that can be modified by the caller to add
2770 // headers to the request.
2771 func (c *PartnersSubscriptionsExtendCall) Header() http.Header {
2772 if c.header_ == nil {
2773 c.header_ = make(http.Header)
2774 }
2775 return c.header_
2776 }
2777
2778 func (c *PartnersSubscriptionsExtendCall) doRequest(alt string) (*http.Response, error) {
2779 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2780 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.extendsubscriptionrequest)
2781 if err != nil {
2782 return nil, err
2783 }
2784 c.urlParams_.Set("alt", alt)
2785 c.urlParams_.Set("prettyPrint", "false")
2786 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:extend")
2787 urls += "?" + c.urlParams_.Encode()
2788 req, err := http.NewRequest("POST", urls, body)
2789 if err != nil {
2790 return nil, err
2791 }
2792 req.Header = reqHeaders
2793 googleapi.Expand(req.URL, map[string]string{
2794 "name": c.name,
2795 })
2796 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.extend", "request", internallog.HTTPRequest(req, body.Bytes()))
2797 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2798 }
2799
2800 // Do executes the "paymentsresellersubscription.partners.subscriptions.extend" call.
2801 // Any non-2xx status code is an error. Response headers are in either
2802 // *ExtendSubscriptionResponse.ServerResponse.Header or (if a response was
2803 // returned at all) in error.(*googleapi.Error).Header. Use
2804 // googleapi.IsNotModified to check whether the returned error was because
2805 // http.StatusNotModified was returned.
2806 func (c *PartnersSubscriptionsExtendCall) Do(opts ...googleapi.CallOption) (*ExtendSubscriptionResponse, error) {
2807 gensupport.SetOptions(c.urlParams_, opts...)
2808 res, err := c.doRequest("json")
2809 if res != nil && res.StatusCode == http.StatusNotModified {
2810 if res.Body != nil {
2811 res.Body.Close()
2812 }
2813 return nil, gensupport.WrapError(&googleapi.Error{
2814 Code: res.StatusCode,
2815 Header: res.Header,
2816 })
2817 }
2818 if err != nil {
2819 return nil, err
2820 }
2821 defer googleapi.CloseBody(res)
2822 if err := googleapi.CheckResponse(res); err != nil {
2823 return nil, gensupport.WrapError(err)
2824 }
2825 ret := &ExtendSubscriptionResponse{
2826 ServerResponse: googleapi.ServerResponse{
2827 Header: res.Header,
2828 HTTPStatusCode: res.StatusCode,
2829 },
2830 }
2831 target := &ret
2832 b, err := gensupport.DecodeResponseBytes(target, res)
2833 if err != nil {
2834 return nil, err
2835 }
2836 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.extend", "response", internallog.HTTPResponse(res, b))
2837 return ret, nil
2838 }
2839
2840 type PartnersSubscriptionsGetCall struct {
2841 s *Service
2842 name string
2843 urlParams_ gensupport.URLParams
2844 ifNoneMatch_ string
2845 ctx_ context.Context
2846 header_ http.Header
2847 }
2848
2849 // Get: Gets a subscription by id. It should be called directly by the partner
2850 // using service accounts.
2851 //
2852 // - name: The name of the subscription resource to retrieve. It will have the
2853 // format of "partners/{partner_id}/subscriptions/{subscription_id}".
2854 func (r *PartnersSubscriptionsService) Get(name string) *PartnersSubscriptionsGetCall {
2855 c := &PartnersSubscriptionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2856 c.name = name
2857 return c
2858 }
2859
2860 // Fields allows partial responses to be retrieved. See
2861 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
2862 // details.
2863 func (c *PartnersSubscriptionsGetCall) Fields(s ...googleapi.Field) *PartnersSubscriptionsGetCall {
2864 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2865 return c
2866 }
2867
2868 // IfNoneMatch sets an optional parameter which makes the operation fail if the
2869 // object's ETag matches the given value. This is useful for getting updates
2870 // only after the object has changed since the last request.
2871 func (c *PartnersSubscriptionsGetCall) IfNoneMatch(entityTag string) *PartnersSubscriptionsGetCall {
2872 c.ifNoneMatch_ = entityTag
2873 return c
2874 }
2875
2876 // Context sets the context to be used in this call's Do method.
2877 func (c *PartnersSubscriptionsGetCall) Context(ctx context.Context) *PartnersSubscriptionsGetCall {
2878 c.ctx_ = ctx
2879 return c
2880 }
2881
2882 // Header returns a http.Header that can be modified by the caller to add
2883 // headers to the request.
2884 func (c *PartnersSubscriptionsGetCall) Header() http.Header {
2885 if c.header_ == nil {
2886 c.header_ = make(http.Header)
2887 }
2888 return c.header_
2889 }
2890
2891 func (c *PartnersSubscriptionsGetCall) doRequest(alt string) (*http.Response, error) {
2892 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2893 if c.ifNoneMatch_ != "" {
2894 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2895 }
2896 c.urlParams_.Set("alt", alt)
2897 c.urlParams_.Set("prettyPrint", "false")
2898 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
2899 urls += "?" + c.urlParams_.Encode()
2900 req, err := http.NewRequest("GET", urls, nil)
2901 if err != nil {
2902 return nil, err
2903 }
2904 req.Header = reqHeaders
2905 googleapi.Expand(req.URL, map[string]string{
2906 "name": c.name,
2907 })
2908 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.get", "request", internallog.HTTPRequest(req, nil))
2909 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2910 }
2911
2912 // Do executes the "paymentsresellersubscription.partners.subscriptions.get" call.
2913 // Any non-2xx status code is an error. Response headers are in either
2914 // *Subscription.ServerResponse.Header or (if a response was returned at all)
2915 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
2916 // whether the returned error was because http.StatusNotModified was returned.
2917 func (c *PartnersSubscriptionsGetCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
2918 gensupport.SetOptions(c.urlParams_, opts...)
2919 res, err := c.doRequest("json")
2920 if res != nil && res.StatusCode == http.StatusNotModified {
2921 if res.Body != nil {
2922 res.Body.Close()
2923 }
2924 return nil, gensupport.WrapError(&googleapi.Error{
2925 Code: res.StatusCode,
2926 Header: res.Header,
2927 })
2928 }
2929 if err != nil {
2930 return nil, err
2931 }
2932 defer googleapi.CloseBody(res)
2933 if err := googleapi.CheckResponse(res); err != nil {
2934 return nil, gensupport.WrapError(err)
2935 }
2936 ret := &Subscription{
2937 ServerResponse: googleapi.ServerResponse{
2938 Header: res.Header,
2939 HTTPStatusCode: res.StatusCode,
2940 },
2941 }
2942 target := &ret
2943 b, err := gensupport.DecodeResponseBytes(target, res)
2944 if err != nil {
2945 return nil, err
2946 }
2947 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.get", "response", internallog.HTTPResponse(res, b))
2948 return ret, nil
2949 }
2950
2951 type PartnersSubscriptionsProvisionCall struct {
2952 s *Service
2953 parentid string
2954 subscription *Subscription
2955 urlParams_ gensupport.URLParams
2956 ctx_ context.Context
2957 header_ http.Header
2958 }
2959
2960 // Provision: Used by partners to provision a subscription for their customers.
2961 // This creates a subscription without associating it with the end user
2962 // account. EntitleSubscription must be called separately using OAuth in order
2963 // for the end user account to be associated with the subscription. It should
2964 // be called directly by the partner using service accounts.
2965 //
2966 // - parent: The parent resource name, which is the identifier of the partner.
2967 // It will have the format of "partners/{partner_id}".
2968 func (r *PartnersSubscriptionsService) Provision(parentid string, subscription *Subscription) *PartnersSubscriptionsProvisionCall {
2969 c := &PartnersSubscriptionsProvisionCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2970 c.parentid = parentid
2971 c.subscription = subscription
2972 return c
2973 }
2974
2975 // CycleOptionsInitialCycleDurationCount sets the optional parameter
2976 // "cycleOptions.initialCycleDuration.count": number of duration units to be
2977 // included.
2978 func (c *PartnersSubscriptionsProvisionCall) CycleOptionsInitialCycleDurationCount(cycleOptionsInitialCycleDurationCount int64) *PartnersSubscriptionsProvisionCall {
2979 c.urlParams_.Set("cycleOptions.initialCycleDuration.count", fmt.Sprint(cycleOptionsInitialCycleDurationCount))
2980 return c
2981 }
2982
2983 // CycleOptionsInitialCycleDurationUnit sets the optional parameter
2984 // "cycleOptions.initialCycleDuration.unit": The unit used for the duration
2985 //
2986 // Possible values:
2987 //
2988 // "UNIT_UNSPECIFIED" - Default value, reserved as an invalid or an
2989 //
2990 // unexpected value.
2991 //
2992 // "MONTH" - Unit of a calendar month.
2993 // "DAY" - Unit of a day.
2994 // "HOUR" - Unit of an hour. It is used for testing.
2995 func (c *PartnersSubscriptionsProvisionCall) CycleOptionsInitialCycleDurationUnit(cycleOptionsInitialCycleDurationUnit string) *PartnersSubscriptionsProvisionCall {
2996 c.urlParams_.Set("cycleOptions.initialCycleDuration.unit", cycleOptionsInitialCycleDurationUnit)
2997 return c
2998 }
2999
3000 // SubscriptionId sets the optional parameter "subscriptionId": Required.
3001 // Identifies the subscription resource on the Partner side. The value is
3002 // restricted to 63 ASCII characters at the maximum. If a subscription with the
3003 // same ID already exists, the creation fails with an `ALREADY_EXISTS` error.
3004 func (c *PartnersSubscriptionsProvisionCall) SubscriptionId(subscriptionId string) *PartnersSubscriptionsProvisionCall {
3005 c.urlParams_.Set("subscriptionId", subscriptionId)
3006 return c
3007 }
3008
3009 // Fields allows partial responses to be retrieved. See
3010 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
3011 // details.
3012 func (c *PartnersSubscriptionsProvisionCall) Fields(s ...googleapi.Field) *PartnersSubscriptionsProvisionCall {
3013 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3014 return c
3015 }
3016
3017 // Context sets the context to be used in this call's Do method.
3018 func (c *PartnersSubscriptionsProvisionCall) Context(ctx context.Context) *PartnersSubscriptionsProvisionCall {
3019 c.ctx_ = ctx
3020 return c
3021 }
3022
3023 // Header returns a http.Header that can be modified by the caller to add
3024 // headers to the request.
3025 func (c *PartnersSubscriptionsProvisionCall) Header() http.Header {
3026 if c.header_ == nil {
3027 c.header_ = make(http.Header)
3028 }
3029 return c.header_
3030 }
3031
3032 func (c *PartnersSubscriptionsProvisionCall) doRequest(alt string) (*http.Response, error) {
3033 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
3034 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.subscription)
3035 if err != nil {
3036 return nil, err
3037 }
3038 c.urlParams_.Set("alt", alt)
3039 c.urlParams_.Set("prettyPrint", "false")
3040 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/subscriptions:provision")
3041 urls += "?" + c.urlParams_.Encode()
3042 req, err := http.NewRequest("POST", urls, body)
3043 if err != nil {
3044 return nil, err
3045 }
3046 req.Header = reqHeaders
3047 googleapi.Expand(req.URL, map[string]string{
3048 "parent": c.parentid,
3049 })
3050 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.provision", "request", internallog.HTTPRequest(req, body.Bytes()))
3051 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3052 }
3053
3054 // Do executes the "paymentsresellersubscription.partners.subscriptions.provision" call.
3055 // Any non-2xx status code is an error. Response headers are in either
3056 // *Subscription.ServerResponse.Header or (if a response was returned at all)
3057 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
3058 // whether the returned error was because http.StatusNotModified was returned.
3059 func (c *PartnersSubscriptionsProvisionCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
3060 gensupport.SetOptions(c.urlParams_, opts...)
3061 res, err := c.doRequest("json")
3062 if res != nil && res.StatusCode == http.StatusNotModified {
3063 if res.Body != nil {
3064 res.Body.Close()
3065 }
3066 return nil, gensupport.WrapError(&googleapi.Error{
3067 Code: res.StatusCode,
3068 Header: res.Header,
3069 })
3070 }
3071 if err != nil {
3072 return nil, err
3073 }
3074 defer googleapi.CloseBody(res)
3075 if err := googleapi.CheckResponse(res); err != nil {
3076 return nil, gensupport.WrapError(err)
3077 }
3078 ret := &Subscription{
3079 ServerResponse: googleapi.ServerResponse{
3080 Header: res.Header,
3081 HTTPStatusCode: res.StatusCode,
3082 },
3083 }
3084 target := &ret
3085 b, err := gensupport.DecodeResponseBytes(target, res)
3086 if err != nil {
3087 return nil, err
3088 }
3089 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.provision", "response", internallog.HTTPResponse(res, b))
3090 return ret, nil
3091 }
3092
3093 type PartnersSubscriptionsResumeCall struct {
3094 s *Service
3095 name string
3096 resumesubscriptionrequest *ResumeSubscriptionRequest
3097 urlParams_ gensupport.URLParams
3098 ctx_ context.Context
3099 header_ http.Header
3100 }
3101
3102 // Resume: Resumes a suspended subscription. The new billing cycle will start
3103 // at the time of the request. It should be called directly by the partner
3104 // using service accounts.
3105 //
3106 // - name: The name of the subscription resource to be resumed. It will have
3107 // the format of "partners/{partner_id}/subscriptions/{subscription_id}".
3108 func (r *PartnersSubscriptionsService) Resume(name string, resumesubscriptionrequest *ResumeSubscriptionRequest) *PartnersSubscriptionsResumeCall {
3109 c := &PartnersSubscriptionsResumeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3110 c.name = name
3111 c.resumesubscriptionrequest = resumesubscriptionrequest
3112 return c
3113 }
3114
3115 // Fields allows partial responses to be retrieved. See
3116 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
3117 // details.
3118 func (c *PartnersSubscriptionsResumeCall) Fields(s ...googleapi.Field) *PartnersSubscriptionsResumeCall {
3119 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3120 return c
3121 }
3122
3123 // Context sets the context to be used in this call's Do method.
3124 func (c *PartnersSubscriptionsResumeCall) Context(ctx context.Context) *PartnersSubscriptionsResumeCall {
3125 c.ctx_ = ctx
3126 return c
3127 }
3128
3129 // Header returns a http.Header that can be modified by the caller to add
3130 // headers to the request.
3131 func (c *PartnersSubscriptionsResumeCall) Header() http.Header {
3132 if c.header_ == nil {
3133 c.header_ = make(http.Header)
3134 }
3135 return c.header_
3136 }
3137
3138 func (c *PartnersSubscriptionsResumeCall) doRequest(alt string) (*http.Response, error) {
3139 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
3140 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.resumesubscriptionrequest)
3141 if err != nil {
3142 return nil, err
3143 }
3144 c.urlParams_.Set("alt", alt)
3145 c.urlParams_.Set("prettyPrint", "false")
3146 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:resume")
3147 urls += "?" + c.urlParams_.Encode()
3148 req, err := http.NewRequest("POST", urls, body)
3149 if err != nil {
3150 return nil, err
3151 }
3152 req.Header = reqHeaders
3153 googleapi.Expand(req.URL, map[string]string{
3154 "name": c.name,
3155 })
3156 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.resume", "request", internallog.HTTPRequest(req, body.Bytes()))
3157 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3158 }
3159
3160 // Do executes the "paymentsresellersubscription.partners.subscriptions.resume" call.
3161 // Any non-2xx status code is an error. Response headers are in either
3162 // *ResumeSubscriptionResponse.ServerResponse.Header or (if a response was
3163 // returned at all) in error.(*googleapi.Error).Header. Use
3164 // googleapi.IsNotModified to check whether the returned error was because
3165 // http.StatusNotModified was returned.
3166 func (c *PartnersSubscriptionsResumeCall) Do(opts ...googleapi.CallOption) (*ResumeSubscriptionResponse, error) {
3167 gensupport.SetOptions(c.urlParams_, opts...)
3168 res, err := c.doRequest("json")
3169 if res != nil && res.StatusCode == http.StatusNotModified {
3170 if res.Body != nil {
3171 res.Body.Close()
3172 }
3173 return nil, gensupport.WrapError(&googleapi.Error{
3174 Code: res.StatusCode,
3175 Header: res.Header,
3176 })
3177 }
3178 if err != nil {
3179 return nil, err
3180 }
3181 defer googleapi.CloseBody(res)
3182 if err := googleapi.CheckResponse(res); err != nil {
3183 return nil, gensupport.WrapError(err)
3184 }
3185 ret := &ResumeSubscriptionResponse{
3186 ServerResponse: googleapi.ServerResponse{
3187 Header: res.Header,
3188 HTTPStatusCode: res.StatusCode,
3189 },
3190 }
3191 target := &ret
3192 b, err := gensupport.DecodeResponseBytes(target, res)
3193 if err != nil {
3194 return nil, err
3195 }
3196 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.resume", "response", internallog.HTTPResponse(res, b))
3197 return ret, nil
3198 }
3199
3200 type PartnersSubscriptionsSuspendCall struct {
3201 s *Service
3202 name string
3203 suspendsubscriptionrequest *SuspendSubscriptionRequest
3204 urlParams_ gensupport.URLParams
3205 ctx_ context.Context
3206 header_ http.Header
3207 }
3208
3209 // Suspend: Suspends a subscription. Contract terms may dictate if a prorated
3210 // refund will be issued upon suspension. It should be called directly by the
3211 // partner using service accounts.
3212 //
3213 // - name: The name of the subscription resource to be suspended. It will have
3214 // the format of "partners/{partner_id}/subscriptions/{subscription_id}".
3215 func (r *PartnersSubscriptionsService) Suspend(name string, suspendsubscriptionrequest *SuspendSubscriptionRequest) *PartnersSubscriptionsSuspendCall {
3216 c := &PartnersSubscriptionsSuspendCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3217 c.name = name
3218 c.suspendsubscriptionrequest = suspendsubscriptionrequest
3219 return c
3220 }
3221
3222 // Fields allows partial responses to be retrieved. See
3223 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
3224 // details.
3225 func (c *PartnersSubscriptionsSuspendCall) Fields(s ...googleapi.Field) *PartnersSubscriptionsSuspendCall {
3226 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3227 return c
3228 }
3229
3230 // Context sets the context to be used in this call's Do method.
3231 func (c *PartnersSubscriptionsSuspendCall) Context(ctx context.Context) *PartnersSubscriptionsSuspendCall {
3232 c.ctx_ = ctx
3233 return c
3234 }
3235
3236 // Header returns a http.Header that can be modified by the caller to add
3237 // headers to the request.
3238 func (c *PartnersSubscriptionsSuspendCall) Header() http.Header {
3239 if c.header_ == nil {
3240 c.header_ = make(http.Header)
3241 }
3242 return c.header_
3243 }
3244
3245 func (c *PartnersSubscriptionsSuspendCall) doRequest(alt string) (*http.Response, error) {
3246 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
3247 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.suspendsubscriptionrequest)
3248 if err != nil {
3249 return nil, err
3250 }
3251 c.urlParams_.Set("alt", alt)
3252 c.urlParams_.Set("prettyPrint", "false")
3253 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:suspend")
3254 urls += "?" + c.urlParams_.Encode()
3255 req, err := http.NewRequest("POST", urls, body)
3256 if err != nil {
3257 return nil, err
3258 }
3259 req.Header = reqHeaders
3260 googleapi.Expand(req.URL, map[string]string{
3261 "name": c.name,
3262 })
3263 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.suspend", "request", internallog.HTTPRequest(req, body.Bytes()))
3264 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3265 }
3266
3267 // Do executes the "paymentsresellersubscription.partners.subscriptions.suspend" call.
3268 // Any non-2xx status code is an error. Response headers are in either
3269 // *SuspendSubscriptionResponse.ServerResponse.Header or (if a response was
3270 // returned at all) in error.(*googleapi.Error).Header. Use
3271 // googleapi.IsNotModified to check whether the returned error was because
3272 // http.StatusNotModified was returned.
3273 func (c *PartnersSubscriptionsSuspendCall) Do(opts ...googleapi.CallOption) (*SuspendSubscriptionResponse, error) {
3274 gensupport.SetOptions(c.urlParams_, opts...)
3275 res, err := c.doRequest("json")
3276 if res != nil && res.StatusCode == http.StatusNotModified {
3277 if res.Body != nil {
3278 res.Body.Close()
3279 }
3280 return nil, gensupport.WrapError(&googleapi.Error{
3281 Code: res.StatusCode,
3282 Header: res.Header,
3283 })
3284 }
3285 if err != nil {
3286 return nil, err
3287 }
3288 defer googleapi.CloseBody(res)
3289 if err := googleapi.CheckResponse(res); err != nil {
3290 return nil, gensupport.WrapError(err)
3291 }
3292 ret := &SuspendSubscriptionResponse{
3293 ServerResponse: googleapi.ServerResponse{
3294 Header: res.Header,
3295 HTTPStatusCode: res.StatusCode,
3296 },
3297 }
3298 target := &ret
3299 b, err := gensupport.DecodeResponseBytes(target, res)
3300 if err != nil {
3301 return nil, err
3302 }
3303 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.suspend", "response", internallog.HTTPResponse(res, b))
3304 return ret, nil
3305 }
3306
3307 type PartnersSubscriptionsUndoCancelCall struct {
3308 s *Service
3309 name string
3310 undocancelsubscriptionrequest *UndoCancelSubscriptionRequest
3311 urlParams_ gensupport.URLParams
3312 ctx_ context.Context
3313 header_ http.Header
3314 }
3315
3316 // UndoCancel: Currently, it is used by **Google One, Play Pass** partners.
3317 // Revokes the pending cancellation of a subscription, which is currently in
3318 // `STATE_CANCEL_AT_END_OF_CYCLE` state. If the subscription is already
3319 // cancelled, the request will fail. It should be called directly by the
3320 // partner using service accounts.
3321 //
3322 // - name: The name of the subscription resource whose pending cancellation
3323 // needs to be undone. It will have the format of
3324 // "partners/{partner_id}/subscriptions/{subscription_id}".
3325 func (r *PartnersSubscriptionsService) UndoCancel(name string, undocancelsubscriptionrequest *UndoCancelSubscriptionRequest) *PartnersSubscriptionsUndoCancelCall {
3326 c := &PartnersSubscriptionsUndoCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3327 c.name = name
3328 c.undocancelsubscriptionrequest = undocancelsubscriptionrequest
3329 return c
3330 }
3331
3332 // Fields allows partial responses to be retrieved. See
3333 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
3334 // details.
3335 func (c *PartnersSubscriptionsUndoCancelCall) Fields(s ...googleapi.Field) *PartnersSubscriptionsUndoCancelCall {
3336 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3337 return c
3338 }
3339
3340 // Context sets the context to be used in this call's Do method.
3341 func (c *PartnersSubscriptionsUndoCancelCall) Context(ctx context.Context) *PartnersSubscriptionsUndoCancelCall {
3342 c.ctx_ = ctx
3343 return c
3344 }
3345
3346 // Header returns a http.Header that can be modified by the caller to add
3347 // headers to the request.
3348 func (c *PartnersSubscriptionsUndoCancelCall) Header() http.Header {
3349 if c.header_ == nil {
3350 c.header_ = make(http.Header)
3351 }
3352 return c.header_
3353 }
3354
3355 func (c *PartnersSubscriptionsUndoCancelCall) doRequest(alt string) (*http.Response, error) {
3356 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
3357 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.undocancelsubscriptionrequest)
3358 if err != nil {
3359 return nil, err
3360 }
3361 c.urlParams_.Set("alt", alt)
3362 c.urlParams_.Set("prettyPrint", "false")
3363 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:undoCancel")
3364 urls += "?" + c.urlParams_.Encode()
3365 req, err := http.NewRequest("POST", urls, body)
3366 if err != nil {
3367 return nil, err
3368 }
3369 req.Header = reqHeaders
3370 googleapi.Expand(req.URL, map[string]string{
3371 "name": c.name,
3372 })
3373 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.undoCancel", "request", internallog.HTTPRequest(req, body.Bytes()))
3374 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3375 }
3376
3377 // Do executes the "paymentsresellersubscription.partners.subscriptions.undoCancel" call.
3378 // Any non-2xx status code is an error. Response headers are in either
3379 // *UndoCancelSubscriptionResponse.ServerResponse.Header or (if a response was
3380 // returned at all) in error.(*googleapi.Error).Header. Use
3381 // googleapi.IsNotModified to check whether the returned error was because
3382 // http.StatusNotModified was returned.
3383 func (c *PartnersSubscriptionsUndoCancelCall) Do(opts ...googleapi.CallOption) (*UndoCancelSubscriptionResponse, error) {
3384 gensupport.SetOptions(c.urlParams_, opts...)
3385 res, err := c.doRequest("json")
3386 if res != nil && res.StatusCode == http.StatusNotModified {
3387 if res.Body != nil {
3388 res.Body.Close()
3389 }
3390 return nil, gensupport.WrapError(&googleapi.Error{
3391 Code: res.StatusCode,
3392 Header: res.Header,
3393 })
3394 }
3395 if err != nil {
3396 return nil, err
3397 }
3398 defer googleapi.CloseBody(res)
3399 if err := googleapi.CheckResponse(res); err != nil {
3400 return nil, gensupport.WrapError(err)
3401 }
3402 ret := &UndoCancelSubscriptionResponse{
3403 ServerResponse: googleapi.ServerResponse{
3404 Header: res.Header,
3405 HTTPStatusCode: res.StatusCode,
3406 },
3407 }
3408 target := &ret
3409 b, err := gensupport.DecodeResponseBytes(target, res)
3410 if err != nil {
3411 return nil, err
3412 }
3413 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.undoCancel", "response", internallog.HTTPResponse(res, b))
3414 return ret, nil
3415 }
3416
3417 type PartnersSubscriptionsLineItemsPatchCall struct {
3418 s *Service
3419 name string
3420 subscriptionlineitem *SubscriptionLineItem
3421 urlParams_ gensupport.URLParams
3422 ctx_ context.Context
3423 header_ http.Header
3424 }
3425
3426 // Patch: Updates a line item of a subscription. It should be authenticated
3427 // with a service account.
3428 //
3429 // - name: Identifier. Resource name of the line item. Format:
3430 // partners/{partner}/subscriptions/{subscription}/lineItems/{lineItem}.
3431 func (r *PartnersSubscriptionsLineItemsService) Patch(name string, subscriptionlineitem *SubscriptionLineItem) *PartnersSubscriptionsLineItemsPatchCall {
3432 c := &PartnersSubscriptionsLineItemsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3433 c.name = name
3434 c.subscriptionlineitem = subscriptionlineitem
3435 return c
3436 }
3437
3438 // UpdateMask sets the optional parameter "updateMask": Required. The list of
3439 // fields to update. Only a limited set of fields can be updated. The allowed
3440 // fields are the following: -
3441 // `product_payload.googleHomePayload.googleStructureId`
3442 func (c *PartnersSubscriptionsLineItemsPatchCall) UpdateMask(updateMask string) *PartnersSubscriptionsLineItemsPatchCall {
3443 c.urlParams_.Set("updateMask", updateMask)
3444 return c
3445 }
3446
3447 // Fields allows partial responses to be retrieved. See
3448 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
3449 // details.
3450 func (c *PartnersSubscriptionsLineItemsPatchCall) Fields(s ...googleapi.Field) *PartnersSubscriptionsLineItemsPatchCall {
3451 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3452 return c
3453 }
3454
3455 // Context sets the context to be used in this call's Do method.
3456 func (c *PartnersSubscriptionsLineItemsPatchCall) Context(ctx context.Context) *PartnersSubscriptionsLineItemsPatchCall {
3457 c.ctx_ = ctx
3458 return c
3459 }
3460
3461 // Header returns a http.Header that can be modified by the caller to add
3462 // headers to the request.
3463 func (c *PartnersSubscriptionsLineItemsPatchCall) Header() http.Header {
3464 if c.header_ == nil {
3465 c.header_ = make(http.Header)
3466 }
3467 return c.header_
3468 }
3469
3470 func (c *PartnersSubscriptionsLineItemsPatchCall) doRequest(alt string) (*http.Response, error) {
3471 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
3472 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.subscriptionlineitem)
3473 if err != nil {
3474 return nil, err
3475 }
3476 c.urlParams_.Set("alt", alt)
3477 c.urlParams_.Set("prettyPrint", "false")
3478 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
3479 urls += "?" + c.urlParams_.Encode()
3480 req, err := http.NewRequest("PATCH", urls, body)
3481 if err != nil {
3482 return nil, err
3483 }
3484 req.Header = reqHeaders
3485 googleapi.Expand(req.URL, map[string]string{
3486 "name": c.name,
3487 })
3488 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.lineItems.patch", "request", internallog.HTTPRequest(req, body.Bytes()))
3489 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3490 }
3491
3492 // Do executes the "paymentsresellersubscription.partners.subscriptions.lineItems.patch" call.
3493 // Any non-2xx status code is an error. Response headers are in either
3494 // *SubscriptionLineItem.ServerResponse.Header or (if a response was returned
3495 // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
3496 // check whether the returned error was because http.StatusNotModified was
3497 // returned.
3498 func (c *PartnersSubscriptionsLineItemsPatchCall) Do(opts ...googleapi.CallOption) (*SubscriptionLineItem, error) {
3499 gensupport.SetOptions(c.urlParams_, opts...)
3500 res, err := c.doRequest("json")
3501 if res != nil && res.StatusCode == http.StatusNotModified {
3502 if res.Body != nil {
3503 res.Body.Close()
3504 }
3505 return nil, gensupport.WrapError(&googleapi.Error{
3506 Code: res.StatusCode,
3507 Header: res.Header,
3508 })
3509 }
3510 if err != nil {
3511 return nil, err
3512 }
3513 defer googleapi.CloseBody(res)
3514 if err := googleapi.CheckResponse(res); err != nil {
3515 return nil, gensupport.WrapError(err)
3516 }
3517 ret := &SubscriptionLineItem{
3518 ServerResponse: googleapi.ServerResponse{
3519 Header: res.Header,
3520 HTTPStatusCode: res.StatusCode,
3521 },
3522 }
3523 target := &ret
3524 b, err := gensupport.DecodeResponseBytes(target, res)
3525 if err != nil {
3526 return nil, err
3527 }
3528 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.lineItems.patch", "response", internallog.HTTPResponse(res, b))
3529 return ret, nil
3530 }
3531
3532 type PartnersUserSessionsGenerateCall struct {
3533 s *Service
3534 parent string
3535 generateusersessionrequest *GenerateUserSessionRequest
3536 urlParams_ gensupport.URLParams
3537 ctx_ context.Context
3538 header_ http.Header
3539 }
3540
3541 // Generate: This API replaces user authorized OAuth consent based APIs
3542 // (Create, Entitle). Issues a timed session token for the given user intent.
3543 // You can use the session token to redirect the user to Google to finish the
3544 // signup flow. You can re-generate new session token repeatedly for the same
3545 // request if necessary, regardless of the previous tokens being expired or
3546 // not. By default, the session token is valid for 1 hour.
3547 //
3548 // - parent: The parent, the partner that can resell. Format:
3549 // partners/{partner}.
3550 func (r *PartnersUserSessionsService) Generate(parent string, generateusersessionrequest *GenerateUserSessionRequest) *PartnersUserSessionsGenerateCall {
3551 c := &PartnersUserSessionsGenerateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3552 c.parent = parent
3553 c.generateusersessionrequest = generateusersessionrequest
3554 return c
3555 }
3556
3557 // Fields allows partial responses to be retrieved. See
3558 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
3559 // details.
3560 func (c *PartnersUserSessionsGenerateCall) Fields(s ...googleapi.Field) *PartnersUserSessionsGenerateCall {
3561 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3562 return c
3563 }
3564
3565 // Context sets the context to be used in this call's Do method.
3566 func (c *PartnersUserSessionsGenerateCall) Context(ctx context.Context) *PartnersUserSessionsGenerateCall {
3567 c.ctx_ = ctx
3568 return c
3569 }
3570
3571 // Header returns a http.Header that can be modified by the caller to add
3572 // headers to the request.
3573 func (c *PartnersUserSessionsGenerateCall) Header() http.Header {
3574 if c.header_ == nil {
3575 c.header_ = make(http.Header)
3576 }
3577 return c.header_
3578 }
3579
3580 func (c *PartnersUserSessionsGenerateCall) doRequest(alt string) (*http.Response, error) {
3581 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
3582 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.generateusersessionrequest)
3583 if err != nil {
3584 return nil, err
3585 }
3586 c.urlParams_.Set("alt", alt)
3587 c.urlParams_.Set("prettyPrint", "false")
3588 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/userSessions:generate")
3589 urls += "?" + c.urlParams_.Encode()
3590 req, err := http.NewRequest("POST", urls, body)
3591 if err != nil {
3592 return nil, err
3593 }
3594 req.Header = reqHeaders
3595 googleapi.Expand(req.URL, map[string]string{
3596 "parent": c.parent,
3597 })
3598 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.userSessions.generate", "request", internallog.HTTPRequest(req, body.Bytes()))
3599 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3600 }
3601
3602 // Do executes the "paymentsresellersubscription.partners.userSessions.generate" call.
3603 // Any non-2xx status code is an error. Response headers are in either
3604 // *GenerateUserSessionResponse.ServerResponse.Header or (if a response was
3605 // returned at all) in error.(*googleapi.Error).Header. Use
3606 // googleapi.IsNotModified to check whether the returned error was because
3607 // http.StatusNotModified was returned.
3608 func (c *PartnersUserSessionsGenerateCall) Do(opts ...googleapi.CallOption) (*GenerateUserSessionResponse, error) {
3609 gensupport.SetOptions(c.urlParams_, opts...)
3610 res, err := c.doRequest("json")
3611 if res != nil && res.StatusCode == http.StatusNotModified {
3612 if res.Body != nil {
3613 res.Body.Close()
3614 }
3615 return nil, gensupport.WrapError(&googleapi.Error{
3616 Code: res.StatusCode,
3617 Header: res.Header,
3618 })
3619 }
3620 if err != nil {
3621 return nil, err
3622 }
3623 defer googleapi.CloseBody(res)
3624 if err := googleapi.CheckResponse(res); err != nil {
3625 return nil, gensupport.WrapError(err)
3626 }
3627 ret := &GenerateUserSessionResponse{
3628 ServerResponse: googleapi.ServerResponse{
3629 Header: res.Header,
3630 HTTPStatusCode: res.StatusCode,
3631 },
3632 }
3633 target := &ret
3634 b, err := gensupport.DecodeResponseBytes(target, res)
3635 if err != nil {
3636 return nil, err
3637 }
3638 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.userSessions.generate", "response", internallog.HTTPResponse(res, b))
3639 return ret, nil
3640 }