// Copyright 2026 Google LLC. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Code generated file. DO NOT EDIT. // Package paymentsresellersubscription provides access to the Payments Reseller Subscription API. // // For product documentation, see: https://developers.google.com/payments/reseller/subscription/ // // # Library status // // These client libraries are officially supported by Google. However, this // library is considered complete and is in maintenance mode. This means // that we will address critical bugs and security issues but will not add // any new features. // // When possible, we recommend using our newer // [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go) // that are still actively being worked and iterated on. // // # Creating a client // // Usage example: // // import "google.golang.org/api/paymentsresellersubscription/v1" // ... // ctx := context.Background() // paymentsresellersubscriptionService, err := paymentsresellersubscription.NewService(ctx) // // In this example, Google Application Default Credentials are used for // authentication. For information on how to create and obtain Application // Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. // // # Other authentication options // // To use an API key for authentication (note: some APIs do not support API // keys), use [google.golang.org/api/option.WithAPIKey]: // // paymentsresellersubscriptionService, err := paymentsresellersubscription.NewService(ctx, option.WithAPIKey("AIza...")) // // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth // flow, use [google.golang.org/api/option.WithTokenSource]: // // config := &oauth2.Config{...} // // ... // token, err := config.Exchange(ctx, ...) // paymentsresellersubscriptionService, err := paymentsresellersubscription.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) // // See [google.golang.org/api/option.ClientOption] for details on options. package paymentsresellersubscription // import "google.golang.org/api/paymentsresellersubscription/v1" import ( "bytes" "context" "encoding/json" "errors" "fmt" "io" "log/slog" "net/http" "net/url" "strconv" "strings" "github.com/googleapis/gax-go/v2/internallog" googleapi "google.golang.org/api/googleapi" internal "google.golang.org/api/internal" gensupport "google.golang.org/api/internal/gensupport" option "google.golang.org/api/option" internaloption "google.golang.org/api/option/internaloption" htransport "google.golang.org/api/transport/http" ) // Always reference these packages, just in case the auto-generated code // below doesn't. var _ = bytes.NewBuffer var _ = strconv.Itoa var _ = fmt.Sprintf var _ = json.NewDecoder var _ = io.Copy var _ = url.Parse var _ = gensupport.MarshalJSON var _ = googleapi.Version var _ = errors.New var _ = strings.Replace var _ = context.Canceled var _ = internaloption.WithDefaultEndpoint var _ = internal.Version var _ = internallog.New const apiId = "paymentsresellersubscription:v1" const apiName = "paymentsresellersubscription" const apiVersion = "v1" const basePath = "https://paymentsresellersubscription.googleapis.com/" const basePathTemplate = "https://paymentsresellersubscription.UNIVERSE_DOMAIN/" const mtlsBasePath = "https://paymentsresellersubscription.mtls.googleapis.com/" // OAuth2 scopes used by this API. const ( // See and/or control the devices that you selected SdmServiceScope = "https://www.googleapis.com/auth/sdm.service" ) // NewService creates a new Service. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { scopesOption := internaloption.WithDefaultScopes( "https://www.googleapis.com/auth/sdm.service", ) // NOTE: prepend, so we don't override user-specified scopes. opts = append([]option.ClientOption{scopesOption}, opts...) opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate)) opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath)) opts = append(opts, internaloption.EnableNewAuthLibrary()) client, endpoint, err := htransport.NewClient(ctx, opts...) if err != nil { return nil, err } s := &Service{client: client, BasePath: basePath, logger: internaloption.GetLogger(opts)} s.Partners = NewPartnersService(s) if endpoint != "" { s.BasePath = endpoint } return s, nil } // New creates a new Service. It uses the provided http.Client for requests. // // Deprecated: please use NewService instead. // To provide a custom HTTP client, use option.WithHTTPClient. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. func New(client *http.Client) (*Service, error) { if client == nil { return nil, errors.New("client is nil") } return NewService(context.TODO(), option.WithHTTPClient(client)) } type Service struct { client *http.Client logger *slog.Logger BasePath string // API endpoint base URL UserAgent string // optional additional User-Agent fragment Partners *PartnersService } func (s *Service) userAgent() string { if s.UserAgent == "" { return googleapi.UserAgent } return googleapi.UserAgent + " " + s.UserAgent } func NewPartnersService(s *Service) *PartnersService { rs := &PartnersService{s: s} rs.Products = NewPartnersProductsService(s) rs.Promotions = NewPartnersPromotionsService(s) rs.Subscriptions = NewPartnersSubscriptionsService(s) rs.UserSessions = NewPartnersUserSessionsService(s) return rs } type PartnersService struct { s *Service Products *PartnersProductsService Promotions *PartnersPromotionsService Subscriptions *PartnersSubscriptionsService UserSessions *PartnersUserSessionsService } func NewPartnersProductsService(s *Service) *PartnersProductsService { rs := &PartnersProductsService{s: s} return rs } type PartnersProductsService struct { s *Service } func NewPartnersPromotionsService(s *Service) *PartnersPromotionsService { rs := &PartnersPromotionsService{s: s} return rs } type PartnersPromotionsService struct { s *Service } func NewPartnersSubscriptionsService(s *Service) *PartnersSubscriptionsService { rs := &PartnersSubscriptionsService{s: s} rs.LineItems = NewPartnersSubscriptionsLineItemsService(s) return rs } type PartnersSubscriptionsService struct { s *Service LineItems *PartnersSubscriptionsLineItemsService } func NewPartnersSubscriptionsLineItemsService(s *Service) *PartnersSubscriptionsLineItemsService { rs := &PartnersSubscriptionsLineItemsService{s: s} return rs } type PartnersSubscriptionsLineItemsService struct { s *Service } func NewPartnersUserSessionsService(s *Service) *PartnersUserSessionsService { rs := &PartnersUserSessionsService{s: s} return rs } type PartnersUserSessionsService struct { s *Service } // Amount: Describes the amount unit including the currency code. type Amount struct { // AmountMicros: Required. Amount in micros (1_000_000 micros = 1 currency // unit) AmountMicros int64 `json:"amountMicros,omitempty,string"` // CurrencyCode: Required. Currency codes in accordance with [ISO-4217 Currency // Codes] (https://en.wikipedia.org/wiki/ISO_4217). For example, USD. CurrencyCode string `json:"currencyCode,omitempty"` // ForceSendFields is a list of field names (e.g. "AmountMicros") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "AmountMicros") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s Amount) MarshalJSON() ([]byte, error) { type NoMethod Amount return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // CancelSubscriptionRequest: Request to cancel a subscription. type CancelSubscriptionRequest struct { // CancelImmediately: Optional. If true, Google will cancel the subscription // immediately, and may or may not (based on the contract) issue a prorated // refund for the remainder of the billing cycle. Otherwise, Google defers the // cancellation at renewal_time, and will not issue a refund. - YouTube // subscriptions must use this option currently. However, the user will still // have access to the subscription until the end of the billing cycle. CancelImmediately bool `json:"cancelImmediately,omitempty"` // CancellationReason: Specifies the reason for the cancellation. // // Possible values: // "CANCELLATION_REASON_UNSPECIFIED" - Reason is unspecified. Should not be // used. // "CANCELLATION_REASON_FRAUD" - Fraudulent transaction. // "CANCELLATION_REASON_REMORSE" - Buyer's remorse. // "CANCELLATION_REASON_ACCIDENTAL_PURCHASE" - Accidental purchase. // "CANCELLATION_REASON_PAST_DUE" - Payment is past due. // "CANCELLATION_REASON_ACCOUNT_CLOSED" - Used for notification only, do not // use in Cancel API. User account closed. // "CANCELLATION_REASON_UPGRADE_DOWNGRADE" - Used for notification only, do // not use in Cancel API. Cancellation due to upgrade or downgrade. // "CANCELLATION_REASON_USER_DELINQUENCY" - Cancellation due to user // delinquency // "CANCELLATION_REASON_SYSTEM_ERROR" - Used for notification only, do not // use in Cancel API. Cancellation due to an unrecoverable system error. // "CANCELLATION_REASON_SYSTEM_CANCEL" - Used for notification only, do not // use in Cancel API. The subscription is cancelled by Google automatically // since it is no longer valid. // "CANCELLATION_REASON_BILLING_SYSTEM_SWITCH" - Cancellation due to a // billing system switch. // "CANCELLATION_REASON_OTHER" - Other reason. CancellationReason string `json:"cancellationReason,omitempty"` // ForceSendFields is a list of field names (e.g. "CancelImmediately") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "CancelImmediately") to include in // API requests with the JSON null value. By default, fields with empty values // are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s CancelSubscriptionRequest) MarshalJSON() ([]byte, error) { type NoMethod CancelSubscriptionRequest return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // CancelSubscriptionResponse: Response that contains the cancelled // subscription resource. type CancelSubscriptionResponse struct { // Subscription: The cancelled subscription resource. Subscription *Subscription `json:"subscription,omitempty"` // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "Subscription") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Subscription") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s CancelSubscriptionResponse) MarshalJSON() ([]byte, error) { type NoMethod CancelSubscriptionResponse return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // CreateSubscriptionIntent: Intent message for creating a Subscription // resource. type CreateSubscriptionIntent struct { // CycleOptions: Optional. The cycle options for the subscription. CycleOptions *CycleOptions `json:"cycleOptions,omitempty"` // Parent: Required. The parent resource name, which is the identifier of the // partner. Parent string `json:"parent,omitempty"` // Subscription: Required. The Subscription to be created. Subscription *Subscription `json:"subscription,omitempty"` // SubscriptionId: Required. Identifies the subscription resource on the // Partner side. The value is restricted to 63 ASCII characters at the maximum. // If a subscription was previously created with the same subscription_id, we // will directly return that one. SubscriptionId string `json:"subscriptionId,omitempty"` // ForceSendFields is a list of field names (e.g. "CycleOptions") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "CycleOptions") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s CreateSubscriptionIntent) MarshalJSON() ([]byte, error) { type NoMethod CreateSubscriptionIntent return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // CycleOptions: The cycle options when starting and resuming a subscription. type CycleOptions struct { // InitialCycleDuration: Optional. The duration of the initial cycle. Only // `DAY` is supported. If set, Google will start the subscription with this // initial cycle duration starting at the request time (see available methods // below). A prorated charge will be applied. This option is available to the // following methods: - partners.subscriptions.provision - // partners.subscriptions.resume - partners.userSessions.generate InitialCycleDuration *Duration `json:"initialCycleDuration,omitempty"` // ForceSendFields is a list of field names (e.g. "InitialCycleDuration") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "InitialCycleDuration") to include // in API requests with the JSON null value. By default, fields with empty // values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s CycleOptions) MarshalJSON() ([]byte, error) { type NoMethod CycleOptions return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // Duration: Describes the length of a period of a time. type Duration struct { // Count: number of duration units to be included. Count int64 `json:"count,omitempty"` // Unit: The unit used for the duration // // Possible values: // "UNIT_UNSPECIFIED" - Default value, reserved as an invalid or an // unexpected value. // "MONTH" - Unit of a calendar month. // "DAY" - Unit of a day. // "HOUR" - Unit of an hour. It is used for testing. Unit string `json:"unit,omitempty"` // ForceSendFields is a list of field names (e.g. "Count") to unconditionally // include in API requests. By default, fields with empty or default values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Count") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s Duration) MarshalJSON() ([]byte, error) { type NoMethod Duration return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // EntitleSubscriptionIntent: Intent for entitling the previously provisioned // subscription to an end user. type EntitleSubscriptionIntent struct { // Name: Required. The name of the subscription resource that is entitled to // the current end user. It is in the format of // "partners/{partner_id}/subscriptions/{subscriptionId}". Name string `json:"name,omitempty"` // ForceSendFields is a list of field names (e.g. "Name") to unconditionally // include in API requests. By default, fields with empty or default values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Name") to include in API requests // with the JSON null value. By default, fields with empty values are omitted // from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s EntitleSubscriptionIntent) MarshalJSON() ([]byte, error) { type NoMethod EntitleSubscriptionIntent return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // EntitleSubscriptionRequest: Partner request for entitling the previously // provisioned subscription to an end user. The end user identity is inferred // from the request OAuth context. type EntitleSubscriptionRequest struct { // LineItemEntitlementDetails: Optional. The line items to be entitled. If // unspecified, all line items will be entitled. LineItemEntitlementDetails []*EntitleSubscriptionRequestLineItemEntitlementDetails `json:"lineItemEntitlementDetails,omitempty"` // ForceSendFields is a list of field names (e.g. "LineItemEntitlementDetails") // to unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "LineItemEntitlementDetails") to // include in API requests with the JSON null value. By default, fields with // empty values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s EntitleSubscriptionRequest) MarshalJSON() ([]byte, error) { type NoMethod EntitleSubscriptionRequest return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // EntitleSubscriptionRequestLineItemEntitlementDetails: The details of the // line item to be entitled. type EntitleSubscriptionRequestLineItemEntitlementDetails struct { // LineItemIndex: Required. The index of the line item to be entitled. LineItemIndex int64 `json:"lineItemIndex,omitempty"` // Products: Optional. Only applicable if the line item corresponds to a hard // bundle. Product resource names that identify the bundle elements to be // entitled in the line item. If unspecified, all bundle elements will be // entitled. The format is 'partners/{partner_id}/products/{product_id}'. Products []string `json:"products,omitempty"` // ForceSendFields is a list of field names (e.g. "LineItemIndex") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "LineItemIndex") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s EntitleSubscriptionRequestLineItemEntitlementDetails) MarshalJSON() ([]byte, error) { type NoMethod EntitleSubscriptionRequestLineItemEntitlementDetails return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // EntitleSubscriptionResponse: Response that contains the entitled // subscription resource. type EntitleSubscriptionResponse struct { // Subscription: The subscription that has user linked to it. Subscription *Subscription `json:"subscription,omitempty"` // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "Subscription") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Subscription") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s EntitleSubscriptionResponse) MarshalJSON() ([]byte, error) { type NoMethod EntitleSubscriptionResponse return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // ExtendSubscriptionRequest: Request message for extending a Subscription // resource. A new recurrence will be made based on the subscription schedule // defined by the original product. type ExtendSubscriptionRequest struct { // Extension: Required. Specifies details of the extension. Currently, the // duration of the extension must be exactly one billing cycle of the original // subscription. Extension *Extension `json:"extension,omitempty"` // RequestId: Required. Restricted to 36 ASCII characters. A random UUID is // recommended. The idempotency key for the request. The ID generation logic is // controlled by the partner. request_id should be the same as on retries of // the same request. A different request_id must be used for a extension of a // different cycle. RequestId string `json:"requestId,omitempty"` // ForceSendFields is a list of field names (e.g. "Extension") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Extension") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s ExtendSubscriptionRequest) MarshalJSON() ([]byte, error) { type NoMethod ExtendSubscriptionRequest return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // ExtendSubscriptionResponse: Response that contains the timestamps after the // extension. type ExtendSubscriptionResponse struct { // CycleEndTime: The time at which the subscription is expected to be extended, // in ISO 8061 format. UTC timezone. Example, // "cycleEndTime":"2019-08-31T17:28:54.564Z" CycleEndTime string `json:"cycleEndTime,omitempty"` // FreeTrialEndTime: End of the free trial period, in ISO 8061 format. UTC // timezone. Example, "freeTrialEndTime":"2019-08-31T17:28:54.564Z" This time // will be set the same as initial subscription creation time if no free trial // period is offered to the partner. FreeTrialEndTime string `json:"freeTrialEndTime,omitempty"` // RenewalTime: Output only. The time at which the subscription is expected to // be renewed by Google - a new charge will be incurred and the service // entitlement will be renewed. A non-immediate cancellation will take place at // this time too, before which, the service entitlement for the end user will // remain valid. UTC timezone in ISO 8061 format. For example: // "2019-08-31T17:28:54.564Z" RenewalTime string `json:"renewalTime,omitempty"` // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "CycleEndTime") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "CycleEndTime") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s ExtendSubscriptionResponse) MarshalJSON() ([]byte, error) { type NoMethod ExtendSubscriptionResponse return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // Extension: Describes the details of an extension request. type Extension struct { // Duration: Required. Specifies the period of access the subscription should // grant. Duration *Duration `json:"duration,omitempty"` // PartnerUserToken: Required. Identifier of the end-user in partner’s // system. PartnerUserToken string `json:"partnerUserToken,omitempty"` // ForceSendFields is a list of field names (e.g. "Duration") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Duration") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s Extension) MarshalJSON() ([]byte, error) { type NoMethod Extension return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // FindEligiblePromotionsRequest: Request to find eligible promotions for the // current user. type FindEligiblePromotionsRequest struct { // Filter: Optional. Specifies the filters for the promotion results. The // syntax is defined in https://google.aip.dev/160 with the following caveats: // 1. Only the following features are supported: - Logical operator `AND` - // Comparison operator `=` (no wildcards `*`) - Traversal operator `.` - Has // operator `:` (no wildcards `*`) 2. Only the following fields are supported: // - `applicableProducts` - `regionCodes` - // `youtubePayload.partnerEligibilityId` - `youtubePayload.postalCode` 3. // Unless explicitly mentioned above, other features are not supported. // Example: `applicableProducts:partners/partner1/products/product1 AND // regionCodes:US AND youtubePayload.postalCode=94043 AND // youtubePayload.partnerEligibilityId=eligibility-id` Filter string `json:"filter,omitempty"` // PageSize: Optional. The maximum number of promotions to return. The service // may return fewer than this value. If unspecified, at most 50 promotions will // be returned. The maximum value is 1000; values above 1000 will be coerced to // 1000. PageSize int64 `json:"pageSize,omitempty"` // PageToken: Optional. A page token, received from a previous // `FindEligiblePromotions` call. Provide this to retrieve the subsequent page. // When paginating, all other parameters provided to `FindEligiblePromotions` // must match the call that provided the page token. PageToken string `json:"pageToken,omitempty"` // ForceSendFields is a list of field names (e.g. "Filter") to unconditionally // include in API requests. By default, fields with empty or default values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Filter") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s FindEligiblePromotionsRequest) MarshalJSON() ([]byte, error) { type NoMethod FindEligiblePromotionsRequest return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // FindEligiblePromotionsResponse: Response containing the found promotions for // the current user. type FindEligiblePromotionsResponse struct { // NextPageToken: A token, which can be sent as `page_token` to retrieve the // next page. If this field is empty, there are no subsequent pages. NextPageToken string `json:"nextPageToken,omitempty"` // Promotions: The promotions for the current user. Promotions []*Promotion `json:"promotions,omitempty"` // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "NextPageToken") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "NextPageToken") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s FindEligiblePromotionsResponse) MarshalJSON() ([]byte, error) { type NoMethod FindEligiblePromotionsResponse return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // FiniteBillingCycleDetails: Details for a subscription line item with finite // billing cycles. type FiniteBillingCycleDetails struct { // BillingCycleCountLimit: The number of a subscription line item billing // cycles after which billing will stop automatically. BillingCycleCountLimit int64 `json:"billingCycleCountLimit,omitempty,string"` // ForceSendFields is a list of field names (e.g. "BillingCycleCountLimit") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "BillingCycleCountLimit") to // include in API requests with the JSON null value. By default, fields with // empty values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s FiniteBillingCycleDetails) MarshalJSON() ([]byte, error) { type NoMethod FiniteBillingCycleDetails return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // GenerateUserSessionRequest: Request to generate a user session. type GenerateUserSessionRequest struct { // IntentPayload: The user intent to generate the user session. IntentPayload *IntentPayload `json:"intentPayload,omitempty"` // ForceSendFields is a list of field names (e.g. "IntentPayload") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "IntentPayload") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s GenerateUserSessionRequest) MarshalJSON() ([]byte, error) { type NoMethod GenerateUserSessionRequest return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // GenerateUserSessionResponse: Response that contains the details for // generated user session. type GenerateUserSessionResponse struct { // UserSession: The generated user session. The token size is proportional to // the size of the intent payload. UserSession *UserSession `json:"userSession,omitempty"` // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "UserSession") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "UserSession") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s GenerateUserSessionResponse) MarshalJSON() ([]byte, error) { type NoMethod GenerateUserSessionResponse return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // GoogleHomePayload: Payload specific for Google Home products. type GoogleHomePayload struct { // AttachedToGoogleStructure: Output only. This identifies whether the // subscription is attached to a Google Home structure. AttachedToGoogleStructure bool `json:"attachedToGoogleStructure,omitempty"` // GoogleStructureId: Optional. Structure identifier on Google side. GoogleStructureId string `json:"googleStructureId,omitempty"` // PartnerStructureId: Optional. This identifies the structure ID on partner // side that the subscription should be applied to. Only required when the // partner requires structure mapping. PartnerStructureId string `json:"partnerStructureId,omitempty"` // ForceSendFields is a list of field names (e.g. "AttachedToGoogleStructure") // to unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "AttachedToGoogleStructure") to // include in API requests with the JSON null value. By default, fields with // empty values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s GoogleHomePayload) MarshalJSON() ([]byte, error) { type NoMethod GoogleHomePayload return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // GoogleOnePayload: Payload specific to Google One products. type GoogleOnePayload struct { // Campaigns: Campaign attributed to sales of this subscription. Campaigns []string `json:"campaigns,omitempty"` // Offering: The type of offering the subscription was sold by the partner. // e.g. VAS. // // Possible values: // "OFFERING_UNSPECIFIED" - The type of partner offering is unspecified. // "OFFERING_VAS_BUNDLE" - Google One product purchased as a Value added // service in addition to existing partner's products. Customer pays additional // amount for Google One product. // "OFFERING_VAS_STANDALONE" - Google One product purchased by itself by // customer as a value add service. Customer pays additional amount for Google // One product. // "OFFERING_HARD_BUNDLE" - Product purchased as part of a hard bundle where // Google One was included with the bundle. Google One pricing is included in // the bundle. // "OFFERING_SOFT_BUNDLE" - Purchased as part of a bundle where Google One // was provided as an option. Google One pricing is included in the bundle. Offering string `json:"offering,omitempty"` // SalesChannel: The type of sales channel through which the subscription was // sold. // // Possible values: // "CHANNEL_UNSPECIFIED" - The channel type is unspecified. // "CHANNEL_RETAIL" - Sold at store. // "CHANNEL_ONLINE_WEB" - Sold through partner website. // "CHANNEL_ONLINE_ANDROID_APP" - Sold through partner android app. // "CHANNEL_ONLINE_IOS_APP" - Sold through partner iOS app. SalesChannel string `json:"salesChannel,omitempty"` // StoreId: The identifier for the partner store where the subscription was // sold. StoreId string `json:"storeId,omitempty"` // ForceSendFields is a list of field names (e.g. "Campaigns") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Campaigns") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s GoogleOnePayload) MarshalJSON() ([]byte, error) { type NoMethod GoogleOnePayload return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // GoogleTypeLocalizedText: Localized variant of a text in a particular // language. type GoogleTypeLocalizedText struct { // LanguageCode: The text's BCP-47 language code, such as "en-US" or "sr-Latn". // For more information, see // http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. LanguageCode string `json:"languageCode,omitempty"` // Text: Localized string in the language corresponding to language_code below. Text string `json:"text,omitempty"` // ForceSendFields is a list of field names (e.g. "LanguageCode") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "LanguageCode") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s GoogleTypeLocalizedText) MarshalJSON() ([]byte, error) { type NoMethod GoogleTypeLocalizedText return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // IntentPayload: The payload that describes the user intent. type IntentPayload struct { // CreateIntent: The request to create a subscription. CreateIntent *CreateSubscriptionIntent `json:"createIntent,omitempty"` // EntitleIntent: The request to entitle a subscription. EntitleIntent *EntitleSubscriptionIntent `json:"entitleIntent,omitempty"` // IntentOptions: Optional. The additional features for the intent. IntentOptions *IntentPayloadIntentOptions `json:"intentOptions,omitempty"` // ForceSendFields is a list of field names (e.g. "CreateIntent") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "CreateIntent") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s IntentPayload) MarshalJSON() ([]byte, error) { type NoMethod IntentPayload return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // IntentPayloadIntentOptions: The options for the intent. type IntentPayloadIntentOptions struct { // EnableOfferOverride: Optional. If true, Google may use a different product // and promotion id from the ones in the `create_intent` based on the user's // eligibility. Only applicable for certain YouTube free trial offers. EnableOfferOverride bool `json:"enableOfferOverride,omitempty"` // ForceSendFields is a list of field names (e.g. "EnableOfferOverride") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "EnableOfferOverride") to include // in API requests with the JSON null value. By default, fields with empty // values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s IntentPayloadIntentOptions) MarshalJSON() ([]byte, error) { type NoMethod IntentPayloadIntentOptions return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // ListProductsResponse: Response that contains the products. type ListProductsResponse struct { // NextPageToken: A token, which can be sent as `page_token` to retrieve the // next page. If this field is empty, there are no subsequent pages. NextPageToken string `json:"nextPageToken,omitempty"` // Products: The products for the specified partner. Products []*Product `json:"products,omitempty"` // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "NextPageToken") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "NextPageToken") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s ListProductsResponse) MarshalJSON() ([]byte, error) { type NoMethod ListProductsResponse return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // ListPromotionsResponse: Response that contains the promotions. type ListPromotionsResponse struct { // NextPageToken: A token, which can be sent as `page_token` to retrieve the // next page. If this field is empty, there are no subsequent pages. NextPageToken string `json:"nextPageToken,omitempty"` // Promotions: The promotions for the specified partner. Promotions []*Promotion `json:"promotions,omitempty"` // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "NextPageToken") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "NextPageToken") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s ListPromotionsResponse) MarshalJSON() ([]byte, error) { type NoMethod ListPromotionsResponse return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // Location: Describes a location of an end user. type Location struct { // PostalCode: The postal code this location refers to. Ex. "94043" PostalCode string `json:"postalCode,omitempty"` // RegionCode: 2-letter ISO region code for current content region. Ex. // “US” Please refers to: https://en.wikipedia.org/wiki/ISO_3166-1 RegionCode string `json:"regionCode,omitempty"` // ForceSendFields is a list of field names (e.g. "PostalCode") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "PostalCode") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s Location) MarshalJSON() ([]byte, error) { type NoMethod Location return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // Product: A Product resource that defines a subscription service that can be // resold. type Product struct { // BundleDetails: Output only. Specifies the details for a bundle product. BundleDetails *ProductBundleDetails `json:"bundleDetails,omitempty"` // FiniteBillingCycleDetails: Optional. Details for a subscription line item // with finite billing cycles. If unset, the line item will be charged // indefinitely. FiniteBillingCycleDetails *FiniteBillingCycleDetails `json:"finiteBillingCycleDetails,omitempty"` // Name: Identifier. Response only. Resource name of the product. It will have // the format of "partners/{partner_id}/products/{product_id}" Name string `json:"name,omitempty"` // PriceConfigs: Output only. Price configs for the product in the available // regions. PriceConfigs []*ProductPriceConfig `json:"priceConfigs,omitempty"` // ProductType: Output only. Specifies the type of the product. // // Possible values: // "PRODUCT_TYPE_UNSPECIFIED" - Unspecified. It's reserved as an unexpected // value, should not be used. // "PRODUCT_TYPE_SUBSCRIPTION" - The product is a subscription. // "PRODUCT_TYPE_BUNDLE_SUBSCRIPTION" - The product is a bundled subscription // plan, which includes multiple subscription elements. ProductType string `json:"productType,omitempty"` // RegionCodes: Output only. 2-letter ISO region code where the product is // available in. Ex. "US" Please refer to: // https://en.wikipedia.org/wiki/ISO_3166-1 RegionCodes []string `json:"regionCodes,omitempty"` // SubscriptionBillingCycleDuration: Output only. Specifies the length of the // billing cycle of the subscription. SubscriptionBillingCycleDuration *Duration `json:"subscriptionBillingCycleDuration,omitempty"` // Titles: Output only. Localized human readable name of the product. Titles []*GoogleTypeLocalizedText `json:"titles,omitempty"` // ForceSendFields is a list of field names (e.g. "BundleDetails") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "BundleDetails") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s Product) MarshalJSON() ([]byte, error) { type NoMethod Product return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // ProductBundleDetails: Details for a bundle product. type ProductBundleDetails struct { // BundleElements: The individual products that are included in the bundle. BundleElements []*ProductBundleDetailsBundleElement `json:"bundleElements,omitempty"` // EntitlementMode: The entitlement mode of the bundle product. // // Possible values: // "ENTITLEMENT_MODE_UNSPECIFIED" - Unspecified. It's reserved as an // unexpected value, should not be used. // "ENTITLEMENT_MODE_FULL" - All the bundle elements must be fully activated // in a single request. // "ENTITLEMENT_MODE_INCREMENTAL" - The bundle elements could be // incrementally activated. EntitlementMode string `json:"entitlementMode,omitempty"` // ForceSendFields is a list of field names (e.g. "BundleElements") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "BundleElements") to include in // API requests with the JSON null value. By default, fields with empty values // are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s ProductBundleDetails) MarshalJSON() ([]byte, error) { type NoMethod ProductBundleDetails return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // ProductBundleDetailsBundleElement: The individual product that is included // in the bundle. type ProductBundleDetailsBundleElement struct { // Product: Required. Output only. Product resource name that identifies the // bundle element. The format is 'partners/{partner_id}/products/{product_id}'. Product string `json:"product,omitempty"` // ForceSendFields is a list of field names (e.g. "Product") to unconditionally // include in API requests. By default, fields with empty or default values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Product") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s ProductBundleDetailsBundleElement) MarshalJSON() ([]byte, error) { type NoMethod ProductBundleDetailsBundleElement return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // ProductPayload: Specifies product specific payload. type ProductPayload struct { // GoogleHomePayload: Payload specific to Google Home products. GoogleHomePayload *GoogleHomePayload `json:"googleHomePayload,omitempty"` // GoogleOnePayload: Product-specific payloads. Payload specific to Google One // products. GoogleOnePayload *GoogleOnePayload `json:"googleOnePayload,omitempty"` // YoutubePayload: Payload specific to Youtube products. YoutubePayload *YoutubePayload `json:"youtubePayload,omitempty"` // ForceSendFields is a list of field names (e.g. "GoogleHomePayload") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "GoogleHomePayload") to include in // API requests with the JSON null value. By default, fields with empty values // are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s ProductPayload) MarshalJSON() ([]byte, error) { type NoMethod ProductPayload return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // ProductPriceConfig: Configs the prices in an available region. type ProductPriceConfig struct { // Amount: Output only. The price in the region. Amount *Amount `json:"amount,omitempty"` // RegionCode: Output only. 2-letter ISO region code where the product is // available in. Ex. "US". RegionCode string `json:"regionCode,omitempty"` // ForceSendFields is a list of field names (e.g. "Amount") to unconditionally // include in API requests. By default, fields with empty or default values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Amount") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s ProductPriceConfig) MarshalJSON() ([]byte, error) { type NoMethod ProductPriceConfig return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // Promotion: A Promotion resource that defines a promotion for a subscription // that can be resold. type Promotion struct { // ApplicableProducts: Output only. The product ids this promotion can be // applied to. ApplicableProducts []string `json:"applicableProducts,omitempty"` // EndTime: Optional. Specifies the end time (exclusive) of the period that the // promotion is available in. If unset, the promotion is available // indefinitely. EndTime string `json:"endTime,omitempty"` // FreeTrialDuration: Optional. Specifies the duration of the free trial of the // subscription when promotion_type is PROMOTION_TYPE_FREE_TRIAL FreeTrialDuration *Duration `json:"freeTrialDuration,omitempty"` // IntroductoryPricingDetails: Optional. Specifies the introductory pricing // details when the promotion_type is PROMOTION_TYPE_INTRODUCTORY_PRICING. IntroductoryPricingDetails *PromotionIntroductoryPricingDetails `json:"introductoryPricingDetails,omitempty"` // Name: Identifier. Response only. Resource name of the subscription // promotion. It will have the format of // "partners/{partner_id}/promotion/{promotion_id}" Name string `json:"name,omitempty"` // PromotionType: Output only. Specifies the type of the promotion. // // Possible values: // "PROMOTION_TYPE_UNSPECIFIED" - The promotion type is unspecified. // "PROMOTION_TYPE_FREE_TRIAL" - The promotion is a free trial. // "PROMOTION_TYPE_INTRODUCTORY_PRICING" - The promotion is a reduced // introductory pricing. PromotionType string `json:"promotionType,omitempty"` // RegionCodes: Output only. 2-letter ISO region code where the promotion is // available in. Ex. "US" Please refer to: // https://en.wikipedia.org/wiki/ISO_3166-1 RegionCodes []string `json:"regionCodes,omitempty"` // StartTime: Optional. Specifies the start time (inclusive) of the period that // the promotion is available in. StartTime string `json:"startTime,omitempty"` // Titles: Output only. Localized human readable name of the promotion. Titles []*GoogleTypeLocalizedText `json:"titles,omitempty"` // ForceSendFields is a list of field names (e.g. "ApplicableProducts") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "ApplicableProducts") to include // in API requests with the JSON null value. By default, fields with empty // values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s Promotion) MarshalJSON() ([]byte, error) { type NoMethod Promotion return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // PromotionIntroductoryPricingDetails: The details of a introductory pricing // promotion. type PromotionIntroductoryPricingDetails struct { // IntroductoryPricingSpecs: Output only. Specifies the introductory pricing // periods. IntroductoryPricingSpecs []*PromotionIntroductoryPricingDetailsIntroductoryPricingSpec `json:"introductoryPricingSpecs,omitempty"` // ForceSendFields is a list of field names (e.g. "IntroductoryPricingSpecs") // to unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "IntroductoryPricingSpecs") to // include in API requests with the JSON null value. By default, fields with // empty values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s PromotionIntroductoryPricingDetails) MarshalJSON() ([]byte, error) { type NoMethod PromotionIntroductoryPricingDetails return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // PromotionIntroductoryPricingDetailsIntroductoryPricingSpec: The duration of // an introductory pricing promotion. type PromotionIntroductoryPricingDetailsIntroductoryPricingSpec struct { // DiscountAmount: Output only. The discount amount. The value is positive. DiscountAmount *Amount `json:"discountAmount,omitempty"` // DiscountRatioMicros: Output only. The discount percentage in micros. For // example, 50,000 represents 5%. DiscountRatioMicros int64 `json:"discountRatioMicros,omitempty,string"` // RecurrenceCount: Output only. The duration of an introductory offer in // billing cycles. RecurrenceCount int64 `json:"recurrenceCount,omitempty"` // RegionCode: Output only. 2-letter ISO region code where the product is // available in. Ex. "US". RegionCode string `json:"regionCode,omitempty"` // ForceSendFields is a list of field names (e.g. "DiscountAmount") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "DiscountAmount") to include in // API requests with the JSON null value. By default, fields with empty values // are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s PromotionIntroductoryPricingDetailsIntroductoryPricingSpec) MarshalJSON() ([]byte, error) { type NoMethod PromotionIntroductoryPricingDetailsIntroductoryPricingSpec return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // ResumeSubscriptionRequest: Request to resume a suspended subscription. type ResumeSubscriptionRequest struct { // CycleOptions: Optional. The cycle options for the subscription. CycleOptions *CycleOptions `json:"cycleOptions,omitempty"` // ResumeMode: Required. The mode to resume the subscription. // // Possible values: // "RESUME_MODE_UNSPECIFIED" - Reserved for invalid or unexpected value. Do // not use. // "RESUME_MODE_CYCLE_OPTIONS" - Resume the subscription using the input from // `cycle_options`. // "RESUME_MODE_RESTORE_EXISTING_BILLING_SCHEDULE" - Resume the subscription // with the existing billing schedule. The subscription's next renewal time // must still be in the future for this mode to be applicable. ResumeMode string `json:"resumeMode,omitempty"` // ForceSendFields is a list of field names (e.g. "CycleOptions") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "CycleOptions") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s ResumeSubscriptionRequest) MarshalJSON() ([]byte, error) { type NoMethod ResumeSubscriptionRequest return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // ResumeSubscriptionResponse: Response that contains the resumed subscription. type ResumeSubscriptionResponse struct { // Subscription: The resumed subscription resource. Subscription *Subscription `json:"subscription,omitempty"` // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "Subscription") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Subscription") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s ResumeSubscriptionResponse) MarshalJSON() ([]byte, error) { type NoMethod ResumeSubscriptionResponse return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // ServicePeriod: A description of what time period or moment in time the // product or service is being delivered over. type ServicePeriod struct { // EndTime: Optional. The end time of the service period. Time is exclusive. EndTime string `json:"endTime,omitempty"` // StartTime: Required. The start time of the service period. Time is // inclusive. StartTime string `json:"startTime,omitempty"` // ForceSendFields is a list of field names (e.g. "EndTime") to unconditionally // include in API requests. By default, fields with empty or default values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "EndTime") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s ServicePeriod) MarshalJSON() ([]byte, error) { type NoMethod ServicePeriod return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // Subscription: Acts as a central billing entity between an external partner // and Google. Google services use the subscription state to grant or revoke // the user's service entitlement. Note: The subscription state might not // perfectly align with the user's service entitlement. Some services might // continue providing access until the current cycle ends, even if the // subscription is immediately canceled. Consult the relevant contract or // product policy for specific details. type Subscription struct { // CancellationDetails: Output only. Describes the details of a cancelled // subscription. Only applicable to subscription of state `STATE_CANCELLED`. CancellationDetails *SubscriptionCancellationDetails `json:"cancellationDetails,omitempty"` // CreateTime: Output only. System generated timestamp when the subscription is // created. UTC timezone. CreateTime string `json:"createTime,omitempty"` // CycleEndTime: Output only. The time at which the subscription is expected to // be extended, in ISO 8061 format. UTC timezone. For example: // "2019-08-31T17:28:54.564Z" CycleEndTime string `json:"cycleEndTime,omitempty"` // EndUserEntitled: Output only. Indicates if the subscription is entitled to // the end user. EndUserEntitled bool `json:"endUserEntitled,omitempty"` // FreeTrialEndTime: Output only. End of the free trial period, in ISO 8061 // format. For example, "2019-08-31T17:28:54.564Z". It will be set the same as // createTime if no free trial promotion is specified. FreeTrialEndTime string `json:"freeTrialEndTime,omitempty"` // LineItems: Required. The line items of the subscription. LineItems []*SubscriptionLineItem `json:"lineItems,omitempty"` // MigrationDetails: Output only. Describes the details of the migrated // subscription. Only populated if this subscription is migrated from another // system. MigrationDetails *SubscriptionMigrationDetails `json:"migrationDetails,omitempty"` // Name: Identifier. Resource name of the subscription. It will have the format // of "partners/{partner_id}/subscriptions/{subscription_id}". This is // available for authorizeAddon, but otherwise is response only. Name string `json:"name,omitempty"` // PartnerUserToken: Required. Identifier of the end-user in partner’s // system. The value is restricted to 63 ASCII characters at the maximum. PartnerUserToken string `json:"partnerUserToken,omitempty"` // ProcessingState: Output only. Describes the processing state of the // subscription. See more details at the lifecycle of a subscription // (/payments/reseller/subscription/reference/index/Receive.Notifications#paymen // ts-subscription-lifecycle). // // Possible values: // "PROCESSING_STATE_UNSPECIFIED" - The processing state is unspecified. // "PROCESSING_STATE_CANCELLING" - The subscription is being cancelled. // "PROCESSING_STATE_RECURRING" - The subscription is recurring. // "PROCESSING_STATE_RESUMING" - The subscription is being resumed. ProcessingState string `json:"processingState,omitempty"` // Products: Optional. Deprecated: consider using `line_items` as the input. // Required. Resource name that identifies the purchased products. The format // will be 'partners/{partner_id}/products/{product_id}'. Products []string `json:"products,omitempty"` // PromotionSpecs: Optional. Subscription-level promotions. Only free trial is // supported on this level. It determines the first renewal time of the // subscription to be the end of the free trial period. Specify the promotion // resource name only when used as input. PromotionSpecs []*SubscriptionPromotionSpec `json:"promotionSpecs,omitempty"` // Promotions: Optional. Deprecated: consider using the top-level // `promotion_specs` as the input. Optional. Resource name that identifies one // or more promotions that can be applied on the product. A typical promotion // for a subscription is Free trial. The format will be // 'partners/{partner_id}/promotions/{promotion_id}'. Promotions []string `json:"promotions,omitempty"` // PurchaseTime: Optional. The timestamp when the user transaction was made // with the Partner. Specify for the case of "bundle with choice", and it must // be before the provision_time (when the user makes a selection). PurchaseTime string `json:"purchaseTime,omitempty"` // RedirectUri: Output only. The place where partners should redirect the // end-user to after creation. This field might also be populated when creation // failed. However, Partners should always prepare a default URL to redirect // the user in case this field is empty. RedirectUri string `json:"redirectUri,omitempty"` // RenewalTime: Output only. The time at which the subscription is expected to // be renewed by Google - a new charge will be incurred and the service // entitlement will be renewed. A non-immediate cancellation will take place at // this time too, before which, the service entitlement for the end user will // remain valid. UTC timezone in ISO 8061 format. For example: // "2019-08-31T17:28:54.564Z" RenewalTime string `json:"renewalTime,omitempty"` // ServiceLocation: Required. The location that the service is provided as // indicated by the partner. ServiceLocation *Location `json:"serviceLocation,omitempty"` // State: Output only. Describes the state of the subscription. See more // details at the lifecycle of a subscription // (/payments/reseller/subscription/reference/index/Receive.Notifications#paymen // ts-subscription-lifecycle). // // Possible values: // "STATE_UNSPECIFIED" - The state is unspecified. // "STATE_CREATED" - The subscription is created, a state before it is moved // to STATE_ACTIVE. // "STATE_ACTIVE" - The subscription is active. // "STATE_CANCELLED" - The subscription is cancelled. This is the final state // of the subscription, as it can no longer be modified or reactivated. // "STATE_IN_GRACE_PERIOD" - The subscription is in grace period. It can // happen: 1) in manual extend mode, the subscription is not extended by the // partner at the end of current cycle. 2) for outbound authorization enabled // partners, a renewal purchase order is rejected. // "STATE_CANCEL_AT_END_OF_CYCLE" - The subscription is waiting to be // cancelled by the next recurrence cycle. // "STATE_SUSPENDED" - The subscription is suspended. State string `json:"state,omitempty"` // UpdateTime: Output only. System generated timestamp when the subscription is // most recently updated. UTC timezone. UpdateTime string `json:"updateTime,omitempty"` // UpgradeDowngradeDetails: Optional. Details about the previous subscription // that this new subscription upgrades/downgrades from. Only populated if this // subscription is an upgrade/downgrade from another subscription. UpgradeDowngradeDetails *SubscriptionUpgradeDowngradeDetails `json:"upgradeDowngradeDetails,omitempty"` // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "CancellationDetails") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "CancellationDetails") to include // in API requests with the JSON null value. By default, fields with empty // values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s Subscription) MarshalJSON() ([]byte, error) { type NoMethod Subscription return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // SubscriptionCancellationDetails: Describes the details of a cancelled or // cancelling subscription. type SubscriptionCancellationDetails struct { // Reason: Output only. The reason of the cancellation. // // Possible values: // "CANCELLATION_REASON_UNSPECIFIED" - Reason is unspecified. Should not be // used. // "CANCELLATION_REASON_FRAUD" - Fraudulent transaction. // "CANCELLATION_REASON_REMORSE" - Buyer's remorse. // "CANCELLATION_REASON_ACCIDENTAL_PURCHASE" - Accidental purchase. // "CANCELLATION_REASON_PAST_DUE" - Payment is past due. // "CANCELLATION_REASON_ACCOUNT_CLOSED" - Used for notification only, do not // use in Cancel API. User account closed. // "CANCELLATION_REASON_UPGRADE_DOWNGRADE" - Used for notification only, do // not use in Cancel API. Cancellation due to upgrade or downgrade. // "CANCELLATION_REASON_USER_DELINQUENCY" - Cancellation due to user // delinquency // "CANCELLATION_REASON_SYSTEM_ERROR" - Used for notification only, do not // use in Cancel API. Cancellation due to an unrecoverable system error. // "CANCELLATION_REASON_SYSTEM_CANCEL" - Used for notification only, do not // use in Cancel API. The subscription is cancelled by Google automatically // since it is no longer valid. // "CANCELLATION_REASON_BILLING_SYSTEM_SWITCH" - Cancellation due to a // billing system switch. // "CANCELLATION_REASON_OTHER" - Other reason. Reason string `json:"reason,omitempty"` // ForceSendFields is a list of field names (e.g. "Reason") to unconditionally // include in API requests. By default, fields with empty or default values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Reason") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s SubscriptionCancellationDetails) MarshalJSON() ([]byte, error) { type NoMethod SubscriptionCancellationDetails return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // SubscriptionLineItem: Individual line item definition of a subscription. type SubscriptionLineItem struct { // Amount: Output only. The price of the product/service in this line item. The // amount could be the wholesale price, or it can include a cost of sale based // on the contract. Amount *Amount `json:"amount,omitempty"` // BundleDetails: Output only. The bundle details for the line item. Only // populated if the line item corresponds to a hard bundle. BundleDetails *SubscriptionLineItemBundleDetails `json:"bundleDetails,omitempty"` // Description: Output only. Description of this line item. Description string `json:"description,omitempty"` // FiniteBillingCycleDetails: Optional. Details for a subscription line item // with finite billing cycles. If unset, the line item will be charged // indefinitely. Used only with LINE_ITEM_RECURRENCE_TYPE_PERIODIC. FiniteBillingCycleDetails *FiniteBillingCycleDetails `json:"finiteBillingCycleDetails,omitempty"` // LineItemFreeTrialEndTime: Output only. The free trial end time will be // populated after the line item is successfully processed. End time of the // line item free trial period, in ISO 8061 format. For example, // "2019-08-31T17:28:54.564Z". It will be set the same as createTime if no free // trial promotion is specified. LineItemFreeTrialEndTime string `json:"lineItemFreeTrialEndTime,omitempty"` // LineItemIndex: Output only. A unique index of the subscription line item. LineItemIndex int64 `json:"lineItemIndex,omitempty"` // LineItemPromotionSpecs: Optional. The promotions applied on the line item. // It can be: - an introductory pricing promotion. - a free trial promotion. // This feature is not enabled. If used, the request will be rejected. When // used as input in Create or Provision API, specify its resource name only. LineItemPromotionSpecs []*SubscriptionPromotionSpec `json:"lineItemPromotionSpecs,omitempty"` // Name: Identifier. Resource name of the line item. Format: // partners/{partner}/subscriptions/{subscription}/lineItems/{lineItem} Name string `json:"name,omitempty"` // OneTimeRecurrenceDetails: Output only. Details only set for a ONE_TIME // recurrence line item. OneTimeRecurrenceDetails *SubscriptionLineItemOneTimeRecurrenceDetails `json:"oneTimeRecurrenceDetails,omitempty"` // Product: Required. Product resource name that identifies the product // associated with this line item. The format is // 'partners/{partner_id}/products/{product_id}'. Product string `json:"product,omitempty"` // ProductPayload: Optional. Product specific payload for this line item. ProductPayload *ProductPayload `json:"productPayload,omitempty"` // RecurrenceType: Output only. The recurrence type of the line item. // // Possible values: // "LINE_ITEM_RECURRENCE_TYPE_UNSPECIFIED" - The line item recurrence type is // unspecified. // "LINE_ITEM_RECURRENCE_TYPE_PERIODIC" - The line item recurs periodically. // "LINE_ITEM_RECURRENCE_TYPE_ONE_TIME" - The line item does not recur in the // future. RecurrenceType string `json:"recurrenceType,omitempty"` // State: Output only. The state of the line item. // // Possible values: // "LINE_ITEM_STATE_UNSPECIFIED" - Unspecified state. // "LINE_ITEM_STATE_ACTIVE" - The line item is in ACTIVE state. If the // subscription is cancelled or suspended, the line item will not be charged // even if the line item is active. // "LINE_ITEM_STATE_INACTIVE" - The line item is in INACTIVE state. // "LINE_ITEM_STATE_NEW" - The line item is new, and is not activated or // charged yet. // "LINE_ITEM_STATE_ACTIVATING" - The line item is being activated in order // to be charged. If a free trial applies to the line item, the line item is // pending a prorated charge at the end of the free trial period, as indicated // by `line_item_free_trial_end_time`. // "LINE_ITEM_STATE_DEACTIVATING" - The line item is being deactivated, and a // prorated refund in being processed. // "LINE_ITEM_STATE_WAITING_TO_DEACTIVATE" - The line item is scheduled to be // deactivated at the end of the current cycle. // "LINE_ITEM_STATE_OFF_CYCLE_CHARGING" - Line item is being charged // off-cycle. State string `json:"state,omitempty"` // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "Amount") to unconditionally // include in API requests. By default, fields with empty or default values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Amount") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s SubscriptionLineItem) MarshalJSON() ([]byte, error) { type NoMethod SubscriptionLineItem return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // SubscriptionLineItemBundleDetails: The bundle details for a line item // corresponding to a hard bundle. type SubscriptionLineItemBundleDetails struct { // BundleElementDetails: Output only. The details for each element in the hard // bundle. BundleElementDetails []*SubscriptionLineItemBundleDetailsBundleElementDetails `json:"bundleElementDetails,omitempty"` // ForceSendFields is a list of field names (e.g. "BundleElementDetails") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "BundleElementDetails") to include // in API requests with the JSON null value. By default, fields with empty // values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s SubscriptionLineItemBundleDetails) MarshalJSON() ([]byte, error) { type NoMethod SubscriptionLineItemBundleDetails return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // SubscriptionLineItemBundleDetailsBundleElementDetails: The details for an // element in the hard bundle. type SubscriptionLineItemBundleDetailsBundleElementDetails struct { // Product: Output only. Product resource name that identifies the bundle // element. The format is 'partners/{partner_id}/products/{product_id}'. Product string `json:"product,omitempty"` // UserAccountLinkedTime: Output only. The time when this product is linked to // an end user. UserAccountLinkedTime string `json:"userAccountLinkedTime,omitempty"` // ForceSendFields is a list of field names (e.g. "Product") to unconditionally // include in API requests. By default, fields with empty or default values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Product") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s SubscriptionLineItemBundleDetailsBundleElementDetails) MarshalJSON() ([]byte, error) { type NoMethod SubscriptionLineItemBundleDetailsBundleElementDetails return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // SubscriptionLineItemOneTimeRecurrenceDetails: Details for a ONE_TIME // recurrence line item. type SubscriptionLineItemOneTimeRecurrenceDetails struct { // ServicePeriod: Output only. The service period of the ONE_TIME line item. ServicePeriod *ServicePeriod `json:"servicePeriod,omitempty"` // ForceSendFields is a list of field names (e.g. "ServicePeriod") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "ServicePeriod") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s SubscriptionLineItemOneTimeRecurrenceDetails) MarshalJSON() ([]byte, error) { type NoMethod SubscriptionLineItemOneTimeRecurrenceDetails return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // SubscriptionMigrationDetails: Describes the details of the migrated // subscription. type SubscriptionMigrationDetails struct { // MigratedSubscriptionId: Output only. The migrated subscription id in the // legacy system. MigratedSubscriptionId string `json:"migratedSubscriptionId,omitempty"` // ForceSendFields is a list of field names (e.g. "MigratedSubscriptionId") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "MigratedSubscriptionId") to // include in API requests with the JSON null value. By default, fields with // empty values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s SubscriptionMigrationDetails) MarshalJSON() ([]byte, error) { type NoMethod SubscriptionMigrationDetails return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // SubscriptionPromotionSpec: Describes the spec for one promotion. type SubscriptionPromotionSpec struct { // FreeTrialDuration: Output only. The duration of the free trial if the // promotion is of type FREE_TRIAL. FreeTrialDuration *Duration `json:"freeTrialDuration,omitempty"` // IntroductoryPricingDetails: Output only. The details of the introductory // pricing spec if the promotion is of type INTRODUCTORY_PRICING. IntroductoryPricingDetails *PromotionIntroductoryPricingDetails `json:"introductoryPricingDetails,omitempty"` // Promotion: Required. Promotion resource name that identifies a promotion. // The format is 'partners/{partner_id}/promotions/{promotion_id}'. Promotion string `json:"promotion,omitempty"` // Type: Output only. The type of the promotion for the spec. // // Possible values: // "PROMOTION_TYPE_UNSPECIFIED" - The promotion type is unspecified. // "PROMOTION_TYPE_FREE_TRIAL" - The promotion is a free trial. // "PROMOTION_TYPE_INTRODUCTORY_PRICING" - The promotion is a reduced // introductory pricing. Type string `json:"type,omitempty"` // ForceSendFields is a list of field names (e.g. "FreeTrialDuration") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "FreeTrialDuration") to include in // API requests with the JSON null value. By default, fields with empty values // are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s SubscriptionPromotionSpec) MarshalJSON() ([]byte, error) { type NoMethod SubscriptionPromotionSpec return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // SubscriptionUpgradeDowngradeDetails: Details about the previous subscription // that this new subscription upgrades/downgrades from. type SubscriptionUpgradeDowngradeDetails struct { // BillingCycleSpec: Required. Specifies the billing cycle spec for the new // upgraded/downgraded subscription. // // Possible values: // "BILLING_CYCLE_SPEC_UNSPECIFIED" - Billing cycle spec is not specified. // "BILLING_CYCLE_SPEC_ALIGN_WITH_PREVIOUS_SUBSCRIPTION" - The billing cycle // of the new subscription starts immediately but aligns with the previous // subscription it upgrades or downgrades from. First cycle of the new // subscription will be prorated. // "BILLING_CYCLE_SPEC_START_IMMEDIATELY" - The billing cycle of the new // subscription starts immediately. // "BILLING_CYCLE_SPEC_DEFERRED_TO_NEXT_RECURRENCE" - The new subscription // will have the same `renewalTime` as the previous subscription, while the // previous subscription is scheduled for cancellation at that same time. BillingCycleSpec string `json:"billingCycleSpec,omitempty"` // PreviousSubscriptionId: Required. The previous subscription id to be // replaced. The format can be one of the following: 1. `subscription_id`: the // old subscription id under the same partner_id. 2. // `partners/{partner_id}/subscriptions/{subscription_id}`. A different // partner_id is allowed. But they must be under the same partner group. PreviousSubscriptionId string `json:"previousSubscriptionId,omitempty"` // ForceSendFields is a list of field names (e.g. "BillingCycleSpec") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "BillingCycleSpec") to include in // API requests with the JSON null value. By default, fields with empty values // are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s SubscriptionUpgradeDowngradeDetails) MarshalJSON() ([]byte, error) { type NoMethod SubscriptionUpgradeDowngradeDetails return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // SuspendSubscriptionRequest: Request to suspend a subscription. type SuspendSubscriptionRequest struct { } // SuspendSubscriptionResponse: Response that contains the suspended // subscription. type SuspendSubscriptionResponse struct { // Subscription: The suspended subscription resource. Subscription *Subscription `json:"subscription,omitempty"` // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "Subscription") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Subscription") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s SuspendSubscriptionResponse) MarshalJSON() ([]byte, error) { type NoMethod SuspendSubscriptionResponse return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // UndoCancelSubscriptionRequest: Request to revoke a cancellation request. type UndoCancelSubscriptionRequest struct { } // UndoCancelSubscriptionResponse: Response that contains the updated // subscription resource. type UndoCancelSubscriptionResponse struct { // Subscription: The updated subscription resource. Subscription *Subscription `json:"subscription,omitempty"` // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "Subscription") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Subscription") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s UndoCancelSubscriptionResponse) MarshalJSON() ([]byte, error) { type NoMethod UndoCancelSubscriptionResponse return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // UserSession: Contains a short-lived token containing information required to // interact with the Google Payments Reseller Platform via web endpoints. - // Generate a user session token dynamically for an authenticated user. Do not // share a token directly with a user in an unauthenticated context, such as // SMS or email. - You can regenerate new session tokens repeatedly for the // same `generate` request if necessary, regardless of whether previous tokens // have expired. Multiple sessions will not result in duplicate fulfillments // because the `subscription ID` guarantees uniqueness. For more integration // details, see the Google Managed Signup // (/payments/reseller/subscription/reference/index/User.Signup.Integration/Goog // le.Managed.Signup) documentation. type UserSession struct { // ExpireTime: Output only. The time at which the user session expires. ExpireTime string `json:"expireTime,omitempty"` // Token: Output only. The encrypted token of the user session, including the // information of the user's intent and request. This token should be provided // when redirecting the user to Google. Token string `json:"token,omitempty"` // ForceSendFields is a list of field names (e.g. "ExpireTime") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "ExpireTime") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s UserSession) MarshalJSON() ([]byte, error) { type NoMethod UserSession return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } // YoutubePayload: Payload specific to Youtube products. type YoutubePayload struct { // AccessEndTime: Output only. The access expiration time for this line item. AccessEndTime string `json:"accessEndTime,omitempty"` // PartnerEligibilityIds: The list of eligibility_ids which are applicable for // the line item. PartnerEligibilityIds []string `json:"partnerEligibilityIds,omitempty"` // PartnerPlanType: Optional. Specifies the plan type offered to the end user // by the partner. // // Possible values: // "PARTNER_PLAN_TYPE_UNSPECIFIED" - Unspecified. Should not use, reserved as // an invalid value. // "PARTNER_PLAN_TYPE_STANDALONE" - This item is offered as a standalone // product to the user. // "PARTNER_PLAN_TYPE_HARD_BUNDLE" - This item is bundled with another // partner offering, the item is provisioned at purchase time. // "PARTNER_PLAN_TYPE_SOFT_BUNDLE" - This item is bundled with another // partner offering, the item is provisioned after puchase, when the user opts // in this Google service. PartnerPlanType string `json:"partnerPlanType,omitempty"` // ForceSendFields is a list of field names (e.g. "AccessEndTime") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "AccessEndTime") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } func (s YoutubePayload) MarshalJSON() ([]byte, error) { type NoMethod YoutubePayload return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields) } type PartnersProductsListCall struct { s *Service parent string urlParams_ gensupport.URLParams ifNoneMatch_ string ctx_ context.Context header_ http.Header } // List: Currently, it doesn't support **YouTube** products. Retrieves the // products that can be resold by the partner. It should be authenticated with // a service account. // // - parent: The parent, the partner that can resell. Format: // partners/{partner}. func (r *PartnersProductsService) List(parent string) *PartnersProductsListCall { c := &PartnersProductsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.parent = parent return c } // Filter sets the optional parameter "filter": Specifies the filters for the // product results. The syntax is defined in https://google.aip.dev/160 with // the following caveats: 1. Only the following features are supported: - // Logical operator `AND` - Comparison operator `=` (no wildcards `*`) - // Traversal operator `.` - Has operator `:` (no wildcards `*`) 2. Only the // following fields are supported: - `regionCodes` - // `youtubePayload.partnerEligibilityId` - `youtubePayload.postalCode` 3. // Unless explicitly mentioned above, other features are not supported. // Example: `regionCodes:US AND youtubePayload.postalCode=94043 AND // youtubePayload.partnerEligibilityId=eligibility-id` func (c *PartnersProductsListCall) Filter(filter string) *PartnersProductsListCall { c.urlParams_.Set("filter", filter) return c } // PageSize sets the optional parameter "pageSize": The maximum number of // products to return. The service may return fewer than this value. If // unspecified, at most 50 products will be returned. The maximum value is // 1000; values above 1000 will be coerced to 1000. func (c *PartnersProductsListCall) PageSize(pageSize int64) *PartnersProductsListCall { c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) return c } // PageToken sets the optional parameter "pageToken": A page token, received // from a previous `ListProducts` call. Provide this to retrieve the subsequent // page. When paginating, all other parameters provided to `ListProducts` must // match the call that provided the page token. func (c *PartnersProductsListCall) PageToken(pageToken string) *PartnersProductsListCall { c.urlParams_.Set("pageToken", pageToken) return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more // details. func (c *PartnersProductsListCall) Fields(s ...googleapi.Field) *PartnersProductsListCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // IfNoneMatch sets an optional parameter which makes the operation fail if the // object's ETag matches the given value. This is useful for getting updates // only after the object has changed since the last request. func (c *PartnersProductsListCall) IfNoneMatch(entityTag string) *PartnersProductsListCall { c.ifNoneMatch_ = entityTag return c } // Context sets the context to be used in this call's Do method. func (c *PartnersProductsListCall) Context(ctx context.Context) *PartnersProductsListCall { c.ctx_ = ctx return c } // Header returns a http.Header that can be modified by the caller to add // headers to the request. func (c *PartnersProductsListCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *PartnersProductsListCall) doRequest(alt string) (*http.Response, error) { reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) if c.ifNoneMatch_ != "" { reqHeaders.Set("If-None-Match", c.ifNoneMatch_) } c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/products") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("GET", urls, nil) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "parent": c.parent, }) c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.products.list", "request", internallog.HTTPRequest(req, nil)) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "paymentsresellersubscription.partners.products.list" call. // Any non-2xx status code is an error. Response headers are in either // *ListProductsResponse.ServerResponse.Header or (if a response was returned // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to // check whether the returned error was because http.StatusNotModified was // returned. func (c *PartnersProductsListCall) Do(opts ...googleapi.CallOption) (*ListProductsResponse, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, gensupport.WrapError(&googleapi.Error{ Code: res.StatusCode, Header: res.Header, }) } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, gensupport.WrapError(err) } ret := &ListProductsResponse{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret b, err := gensupport.DecodeResponseBytes(target, res) if err != nil { return nil, err } c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.products.list", "response", internallog.HTTPResponse(res, b)) return ret, nil } // Pages invokes f for each page of results. // A non-nil error returned from f will halt the iteration. // The provided context supersedes any context provided to the Context method. func (c *PartnersProductsListCall) Pages(ctx context.Context, f func(*ListProductsResponse) error) error { c.ctx_ = ctx defer c.PageToken(c.urlParams_.Get("pageToken")) for { x, err := c.Do() if err != nil { return err } if err := f(x); err != nil { return err } if x.NextPageToken == "" { return nil } c.PageToken(x.NextPageToken) } } type PartnersPromotionsFindEligibleCall struct { s *Service parent string findeligiblepromotionsrequest *FindEligiblePromotionsRequest urlParams_ gensupport.URLParams ctx_ context.Context header_ http.Header } // FindEligible: Currently, it is only enabled for **YouTube**. Finds eligible // promotions for the current user. The API requires user authorization via // OAuth. The bare minimum oauth scope `openid` is sufficient, which will skip // the consent screen. // // - parent: The parent, the partner that can resell. Format: // partners/{partner}. func (r *PartnersPromotionsService) FindEligible(parent string, findeligiblepromotionsrequest *FindEligiblePromotionsRequest) *PartnersPromotionsFindEligibleCall { c := &PartnersPromotionsFindEligibleCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.parent = parent c.findeligiblepromotionsrequest = findeligiblepromotionsrequest return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more // details. func (c *PartnersPromotionsFindEligibleCall) Fields(s ...googleapi.Field) *PartnersPromotionsFindEligibleCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // Context sets the context to be used in this call's Do method. func (c *PartnersPromotionsFindEligibleCall) Context(ctx context.Context) *PartnersPromotionsFindEligibleCall { c.ctx_ = ctx return c } // Header returns a http.Header that can be modified by the caller to add // headers to the request. func (c *PartnersPromotionsFindEligibleCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *PartnersPromotionsFindEligibleCall) doRequest(alt string) (*http.Response, error) { reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.findeligiblepromotionsrequest) if err != nil { return nil, err } c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/promotions:findEligible") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("POST", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "parent": c.parent, }) c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.promotions.findEligible", "request", internallog.HTTPRequest(req, body.Bytes())) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "paymentsresellersubscription.partners.promotions.findEligible" call. // Any non-2xx status code is an error. Response headers are in either // *FindEligiblePromotionsResponse.ServerResponse.Header or (if a response was // returned at all) in error.(*googleapi.Error).Header. Use // googleapi.IsNotModified to check whether the returned error was because // http.StatusNotModified was returned. func (c *PartnersPromotionsFindEligibleCall) Do(opts ...googleapi.CallOption) (*FindEligiblePromotionsResponse, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, gensupport.WrapError(&googleapi.Error{ Code: res.StatusCode, Header: res.Header, }) } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, gensupport.WrapError(err) } ret := &FindEligiblePromotionsResponse{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret b, err := gensupport.DecodeResponseBytes(target, res) if err != nil { return nil, err } c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.promotions.findEligible", "response", internallog.HTTPResponse(res, b)) return ret, nil } // Pages invokes f for each page of results. // A non-nil error returned from f will halt the iteration. // The provided context supersedes any context provided to the Context method. func (c *PartnersPromotionsFindEligibleCall) Pages(ctx context.Context, f func(*FindEligiblePromotionsResponse) error) error { c.ctx_ = ctx defer func(pt string) { c.findeligiblepromotionsrequest.PageToken = pt }(c.findeligiblepromotionsrequest.PageToken) for { x, err := c.Do() if err != nil { return err } if err := f(x); err != nil { return err } if x.NextPageToken == "" { return nil } c.findeligiblepromotionsrequest.PageToken = x.NextPageToken } } type PartnersPromotionsListCall struct { s *Service parent string urlParams_ gensupport.URLParams ifNoneMatch_ string ctx_ context.Context header_ http.Header } // List: Currently, it doesn't support **YouTube** promotions. Retrieves the // promotions, such as free trial, that can be used by the partner. It should // be authenticated with a service account. // // - parent: The parent, the partner that can resell. Format: // partners/{partner}. func (r *PartnersPromotionsService) List(parent string) *PartnersPromotionsListCall { c := &PartnersPromotionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.parent = parent return c } // Filter sets the optional parameter "filter": Specifies the filters for the // promotion results. The syntax is defined in https://google.aip.dev/160 with // the following caveats: 1. Only the following features are supported: - // Logical operator `AND` - Comparison operator `=` (no wildcards `*`) - // Traversal operator `.` - Has operator `:` (no wildcards `*`) 2. Only the // following fields are supported: - `applicableProducts` - `regionCodes` - // `youtubePayload.partnerEligibilityId` - `youtubePayload.postalCode` 3. // Unless explicitly mentioned above, other features are not supported. // Example: `applicableProducts:partners/partner1/products/product1 AND // regionCodes:US AND youtubePayload.postalCode=94043 AND // youtubePayload.partnerEligibilityId=eligibility-id` func (c *PartnersPromotionsListCall) Filter(filter string) *PartnersPromotionsListCall { c.urlParams_.Set("filter", filter) return c } // PageSize sets the optional parameter "pageSize": The maximum number of // promotions to return. The service may return fewer than this value. If // unspecified, at most 50 promotions will be returned. The maximum value is // 1000; values above 1000 will be coerced to 1000. func (c *PartnersPromotionsListCall) PageSize(pageSize int64) *PartnersPromotionsListCall { c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) return c } // PageToken sets the optional parameter "pageToken": A page token, received // from a previous `ListPromotions` call. Provide this to retrieve the // subsequent page. When paginating, all other parameters provided to // `ListPromotions` must match the call that provided the page token. func (c *PartnersPromotionsListCall) PageToken(pageToken string) *PartnersPromotionsListCall { c.urlParams_.Set("pageToken", pageToken) return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more // details. func (c *PartnersPromotionsListCall) Fields(s ...googleapi.Field) *PartnersPromotionsListCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // IfNoneMatch sets an optional parameter which makes the operation fail if the // object's ETag matches the given value. This is useful for getting updates // only after the object has changed since the last request. func (c *PartnersPromotionsListCall) IfNoneMatch(entityTag string) *PartnersPromotionsListCall { c.ifNoneMatch_ = entityTag return c } // Context sets the context to be used in this call's Do method. func (c *PartnersPromotionsListCall) Context(ctx context.Context) *PartnersPromotionsListCall { c.ctx_ = ctx return c } // Header returns a http.Header that can be modified by the caller to add // headers to the request. func (c *PartnersPromotionsListCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *PartnersPromotionsListCall) doRequest(alt string) (*http.Response, error) { reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) if c.ifNoneMatch_ != "" { reqHeaders.Set("If-None-Match", c.ifNoneMatch_) } c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/promotions") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("GET", urls, nil) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "parent": c.parent, }) c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.promotions.list", "request", internallog.HTTPRequest(req, nil)) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "paymentsresellersubscription.partners.promotions.list" call. // Any non-2xx status code is an error. Response headers are in either // *ListPromotionsResponse.ServerResponse.Header or (if a response was returned // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to // check whether the returned error was because http.StatusNotModified was // returned. func (c *PartnersPromotionsListCall) Do(opts ...googleapi.CallOption) (*ListPromotionsResponse, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, gensupport.WrapError(&googleapi.Error{ Code: res.StatusCode, Header: res.Header, }) } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, gensupport.WrapError(err) } ret := &ListPromotionsResponse{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret b, err := gensupport.DecodeResponseBytes(target, res) if err != nil { return nil, err } c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.promotions.list", "response", internallog.HTTPResponse(res, b)) return ret, nil } // Pages invokes f for each page of results. // A non-nil error returned from f will halt the iteration. // The provided context supersedes any context provided to the Context method. func (c *PartnersPromotionsListCall) Pages(ctx context.Context, f func(*ListPromotionsResponse) error) error { c.ctx_ = ctx defer c.PageToken(c.urlParams_.Get("pageToken")) for { x, err := c.Do() if err != nil { return err } if err := f(x); err != nil { return err } if x.NextPageToken == "" { return nil } c.PageToken(x.NextPageToken) } } type PartnersSubscriptionsCancelCall struct { s *Service name string cancelsubscriptionrequest *CancelSubscriptionRequest urlParams_ gensupport.URLParams ctx_ context.Context header_ http.Header } // Cancel: Cancels a subscription service either immediately or by the end of // the current billing cycle for their customers. It should be called directly // by the partner using service accounts. // // - name: The name of the subscription resource to be cancelled. It will have // the format of "partners/{partner_id}/subscriptions/{subscription_id}". func (r *PartnersSubscriptionsService) Cancel(name string, cancelsubscriptionrequest *CancelSubscriptionRequest) *PartnersSubscriptionsCancelCall { c := &PartnersSubscriptionsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.name = name c.cancelsubscriptionrequest = cancelsubscriptionrequest return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more // details. func (c *PartnersSubscriptionsCancelCall) Fields(s ...googleapi.Field) *PartnersSubscriptionsCancelCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // Context sets the context to be used in this call's Do method. func (c *PartnersSubscriptionsCancelCall) Context(ctx context.Context) *PartnersSubscriptionsCancelCall { c.ctx_ = ctx return c } // Header returns a http.Header that can be modified by the caller to add // headers to the request. func (c *PartnersSubscriptionsCancelCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *PartnersSubscriptionsCancelCall) doRequest(alt string) (*http.Response, error) { reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.cancelsubscriptionrequest) if err != nil { return nil, err } c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:cancel") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("POST", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "name": c.name, }) c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.cancel", "request", internallog.HTTPRequest(req, body.Bytes())) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "paymentsresellersubscription.partners.subscriptions.cancel" call. // Any non-2xx status code is an error. Response headers are in either // *CancelSubscriptionResponse.ServerResponse.Header or (if a response was // returned at all) in error.(*googleapi.Error).Header. Use // googleapi.IsNotModified to check whether the returned error was because // http.StatusNotModified was returned. func (c *PartnersSubscriptionsCancelCall) Do(opts ...googleapi.CallOption) (*CancelSubscriptionResponse, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, gensupport.WrapError(&googleapi.Error{ Code: res.StatusCode, Header: res.Header, }) } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, gensupport.WrapError(err) } ret := &CancelSubscriptionResponse{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret b, err := gensupport.DecodeResponseBytes(target, res) if err != nil { return nil, err } c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.cancel", "response", internallog.HTTPResponse(res, b)) return ret, nil } type PartnersSubscriptionsCreateCall struct { s *Service parentid string subscription *Subscription urlParams_ gensupport.URLParams ctx_ context.Context header_ http.Header } // Create: Used by partners to create a subscription for their customers. The // created subscription is associated with the end user inferred from the end // user credentials. This API must be authorized by the end user using OAuth. // // - parent: The parent resource name, which is the identifier of the partner. // It will have the format of "partners/{partner_id}". func (r *PartnersSubscriptionsService) Create(parentid string, subscription *Subscription) *PartnersSubscriptionsCreateCall { c := &PartnersSubscriptionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.parentid = parentid c.subscription = subscription return c } // SubscriptionId sets the optional parameter "subscriptionId": Required. // Identifies the subscription resource on the Partner side. The value is // restricted to 63 ASCII characters at the maximum. If a subscription with the // same ID already exists, the creation fails with an `ALREADY_EXISTS` error. func (c *PartnersSubscriptionsCreateCall) SubscriptionId(subscriptionId string) *PartnersSubscriptionsCreateCall { c.urlParams_.Set("subscriptionId", subscriptionId) return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more // details. func (c *PartnersSubscriptionsCreateCall) Fields(s ...googleapi.Field) *PartnersSubscriptionsCreateCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // Context sets the context to be used in this call's Do method. func (c *PartnersSubscriptionsCreateCall) Context(ctx context.Context) *PartnersSubscriptionsCreateCall { c.ctx_ = ctx return c } // Header returns a http.Header that can be modified by the caller to add // headers to the request. func (c *PartnersSubscriptionsCreateCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *PartnersSubscriptionsCreateCall) doRequest(alt string) (*http.Response, error) { reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.subscription) if err != nil { return nil, err } c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/subscriptions") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("POST", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "parent": c.parentid, }) c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.create", "request", internallog.HTTPRequest(req, body.Bytes())) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "paymentsresellersubscription.partners.subscriptions.create" call. // Any non-2xx status code is an error. Response headers are in either // *Subscription.ServerResponse.Header or (if a response was returned at all) // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check // whether the returned error was because http.StatusNotModified was returned. func (c *PartnersSubscriptionsCreateCall) Do(opts ...googleapi.CallOption) (*Subscription, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, gensupport.WrapError(&googleapi.Error{ Code: res.StatusCode, Header: res.Header, }) } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, gensupport.WrapError(err) } ret := &Subscription{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret b, err := gensupport.DecodeResponseBytes(target, res) if err != nil { return nil, err } c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.create", "response", internallog.HTTPResponse(res, b)) return ret, nil } type PartnersSubscriptionsEntitleCall struct { s *Service name string entitlesubscriptionrequest *EntitleSubscriptionRequest urlParams_ gensupport.URLParams ctx_ context.Context header_ http.Header } // Entitle: Entitles a previously provisioned subscription to the current end // user. The end user identity is inferred from the authorized credential of // the request. This API must be authorized by the end user using OAuth. // // - name: The name of the subscription resource that is entitled to the // current end user. It will have the format of // "partners/{partner_id}/subscriptions/{subscription_id}". func (r *PartnersSubscriptionsService) Entitle(name string, entitlesubscriptionrequest *EntitleSubscriptionRequest) *PartnersSubscriptionsEntitleCall { c := &PartnersSubscriptionsEntitleCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.name = name c.entitlesubscriptionrequest = entitlesubscriptionrequest return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more // details. func (c *PartnersSubscriptionsEntitleCall) Fields(s ...googleapi.Field) *PartnersSubscriptionsEntitleCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // Context sets the context to be used in this call's Do method. func (c *PartnersSubscriptionsEntitleCall) Context(ctx context.Context) *PartnersSubscriptionsEntitleCall { c.ctx_ = ctx return c } // Header returns a http.Header that can be modified by the caller to add // headers to the request. func (c *PartnersSubscriptionsEntitleCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *PartnersSubscriptionsEntitleCall) doRequest(alt string) (*http.Response, error) { reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.entitlesubscriptionrequest) if err != nil { return nil, err } c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:entitle") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("POST", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "name": c.name, }) c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.entitle", "request", internallog.HTTPRequest(req, body.Bytes())) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "paymentsresellersubscription.partners.subscriptions.entitle" call. // Any non-2xx status code is an error. Response headers are in either // *EntitleSubscriptionResponse.ServerResponse.Header or (if a response was // returned at all) in error.(*googleapi.Error).Header. Use // googleapi.IsNotModified to check whether the returned error was because // http.StatusNotModified was returned. func (c *PartnersSubscriptionsEntitleCall) Do(opts ...googleapi.CallOption) (*EntitleSubscriptionResponse, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, gensupport.WrapError(&googleapi.Error{ Code: res.StatusCode, Header: res.Header, }) } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, gensupport.WrapError(err) } ret := &EntitleSubscriptionResponse{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret b, err := gensupport.DecodeResponseBytes(target, res) if err != nil { return nil, err } c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.entitle", "response", internallog.HTTPResponse(res, b)) return ret, nil } type PartnersSubscriptionsExtendCall struct { s *Service name string extendsubscriptionrequest *ExtendSubscriptionRequest urlParams_ gensupport.URLParams ctx_ context.Context header_ http.Header } // Extend: [Opt-in only] Most partners should be on auto-extend by default. // Extends a subscription service for their customers on an ongoing basis for // the subscription to remain active and renewable. It should be called // directly by the partner using service accounts. // // - name: The name of the subscription resource to be extended. It will have // the format of "partners/{partner_id}/subscriptions/{subscription_id}". func (r *PartnersSubscriptionsService) Extend(name string, extendsubscriptionrequest *ExtendSubscriptionRequest) *PartnersSubscriptionsExtendCall { c := &PartnersSubscriptionsExtendCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.name = name c.extendsubscriptionrequest = extendsubscriptionrequest return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more // details. func (c *PartnersSubscriptionsExtendCall) Fields(s ...googleapi.Field) *PartnersSubscriptionsExtendCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // Context sets the context to be used in this call's Do method. func (c *PartnersSubscriptionsExtendCall) Context(ctx context.Context) *PartnersSubscriptionsExtendCall { c.ctx_ = ctx return c } // Header returns a http.Header that can be modified by the caller to add // headers to the request. func (c *PartnersSubscriptionsExtendCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *PartnersSubscriptionsExtendCall) doRequest(alt string) (*http.Response, error) { reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.extendsubscriptionrequest) if err != nil { return nil, err } c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:extend") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("POST", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "name": c.name, }) c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.extend", "request", internallog.HTTPRequest(req, body.Bytes())) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "paymentsresellersubscription.partners.subscriptions.extend" call. // Any non-2xx status code is an error. Response headers are in either // *ExtendSubscriptionResponse.ServerResponse.Header or (if a response was // returned at all) in error.(*googleapi.Error).Header. Use // googleapi.IsNotModified to check whether the returned error was because // http.StatusNotModified was returned. func (c *PartnersSubscriptionsExtendCall) Do(opts ...googleapi.CallOption) (*ExtendSubscriptionResponse, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, gensupport.WrapError(&googleapi.Error{ Code: res.StatusCode, Header: res.Header, }) } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, gensupport.WrapError(err) } ret := &ExtendSubscriptionResponse{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret b, err := gensupport.DecodeResponseBytes(target, res) if err != nil { return nil, err } c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.extend", "response", internallog.HTTPResponse(res, b)) return ret, nil } type PartnersSubscriptionsGetCall struct { s *Service name string urlParams_ gensupport.URLParams ifNoneMatch_ string ctx_ context.Context header_ http.Header } // Get: Gets a subscription by id. It should be called directly by the partner // using service accounts. // // - name: The name of the subscription resource to retrieve. It will have the // format of "partners/{partner_id}/subscriptions/{subscription_id}". func (r *PartnersSubscriptionsService) Get(name string) *PartnersSubscriptionsGetCall { c := &PartnersSubscriptionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.name = name return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more // details. func (c *PartnersSubscriptionsGetCall) Fields(s ...googleapi.Field) *PartnersSubscriptionsGetCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // IfNoneMatch sets an optional parameter which makes the operation fail if the // object's ETag matches the given value. This is useful for getting updates // only after the object has changed since the last request. func (c *PartnersSubscriptionsGetCall) IfNoneMatch(entityTag string) *PartnersSubscriptionsGetCall { c.ifNoneMatch_ = entityTag return c } // Context sets the context to be used in this call's Do method. func (c *PartnersSubscriptionsGetCall) Context(ctx context.Context) *PartnersSubscriptionsGetCall { c.ctx_ = ctx return c } // Header returns a http.Header that can be modified by the caller to add // headers to the request. func (c *PartnersSubscriptionsGetCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *PartnersSubscriptionsGetCall) doRequest(alt string) (*http.Response, error) { reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) if c.ifNoneMatch_ != "" { reqHeaders.Set("If-None-Match", c.ifNoneMatch_) } c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("GET", urls, nil) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "name": c.name, }) c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.get", "request", internallog.HTTPRequest(req, nil)) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "paymentsresellersubscription.partners.subscriptions.get" call. // Any non-2xx status code is an error. Response headers are in either // *Subscription.ServerResponse.Header or (if a response was returned at all) // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check // whether the returned error was because http.StatusNotModified was returned. func (c *PartnersSubscriptionsGetCall) Do(opts ...googleapi.CallOption) (*Subscription, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, gensupport.WrapError(&googleapi.Error{ Code: res.StatusCode, Header: res.Header, }) } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, gensupport.WrapError(err) } ret := &Subscription{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret b, err := gensupport.DecodeResponseBytes(target, res) if err != nil { return nil, err } c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.get", "response", internallog.HTTPResponse(res, b)) return ret, nil } type PartnersSubscriptionsProvisionCall struct { s *Service parentid string subscription *Subscription urlParams_ gensupport.URLParams ctx_ context.Context header_ http.Header } // Provision: Used by partners to provision a subscription for their customers. // This creates a subscription without associating it with the end user // account. EntitleSubscription must be called separately using OAuth in order // for the end user account to be associated with the subscription. It should // be called directly by the partner using service accounts. // // - parent: The parent resource name, which is the identifier of the partner. // It will have the format of "partners/{partner_id}". func (r *PartnersSubscriptionsService) Provision(parentid string, subscription *Subscription) *PartnersSubscriptionsProvisionCall { c := &PartnersSubscriptionsProvisionCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.parentid = parentid c.subscription = subscription return c } // CycleOptionsInitialCycleDurationCount sets the optional parameter // "cycleOptions.initialCycleDuration.count": number of duration units to be // included. func (c *PartnersSubscriptionsProvisionCall) CycleOptionsInitialCycleDurationCount(cycleOptionsInitialCycleDurationCount int64) *PartnersSubscriptionsProvisionCall { c.urlParams_.Set("cycleOptions.initialCycleDuration.count", fmt.Sprint(cycleOptionsInitialCycleDurationCount)) return c } // CycleOptionsInitialCycleDurationUnit sets the optional parameter // "cycleOptions.initialCycleDuration.unit": The unit used for the duration // // Possible values: // // "UNIT_UNSPECIFIED" - Default value, reserved as an invalid or an // // unexpected value. // // "MONTH" - Unit of a calendar month. // "DAY" - Unit of a day. // "HOUR" - Unit of an hour. It is used for testing. func (c *PartnersSubscriptionsProvisionCall) CycleOptionsInitialCycleDurationUnit(cycleOptionsInitialCycleDurationUnit string) *PartnersSubscriptionsProvisionCall { c.urlParams_.Set("cycleOptions.initialCycleDuration.unit", cycleOptionsInitialCycleDurationUnit) return c } // SubscriptionId sets the optional parameter "subscriptionId": Required. // Identifies the subscription resource on the Partner side. The value is // restricted to 63 ASCII characters at the maximum. If a subscription with the // same ID already exists, the creation fails with an `ALREADY_EXISTS` error. func (c *PartnersSubscriptionsProvisionCall) SubscriptionId(subscriptionId string) *PartnersSubscriptionsProvisionCall { c.urlParams_.Set("subscriptionId", subscriptionId) return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more // details. func (c *PartnersSubscriptionsProvisionCall) Fields(s ...googleapi.Field) *PartnersSubscriptionsProvisionCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // Context sets the context to be used in this call's Do method. func (c *PartnersSubscriptionsProvisionCall) Context(ctx context.Context) *PartnersSubscriptionsProvisionCall { c.ctx_ = ctx return c } // Header returns a http.Header that can be modified by the caller to add // headers to the request. func (c *PartnersSubscriptionsProvisionCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *PartnersSubscriptionsProvisionCall) doRequest(alt string) (*http.Response, error) { reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.subscription) if err != nil { return nil, err } c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/subscriptions:provision") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("POST", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "parent": c.parentid, }) c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.provision", "request", internallog.HTTPRequest(req, body.Bytes())) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "paymentsresellersubscription.partners.subscriptions.provision" call. // Any non-2xx status code is an error. Response headers are in either // *Subscription.ServerResponse.Header or (if a response was returned at all) // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check // whether the returned error was because http.StatusNotModified was returned. func (c *PartnersSubscriptionsProvisionCall) Do(opts ...googleapi.CallOption) (*Subscription, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, gensupport.WrapError(&googleapi.Error{ Code: res.StatusCode, Header: res.Header, }) } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, gensupport.WrapError(err) } ret := &Subscription{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret b, err := gensupport.DecodeResponseBytes(target, res) if err != nil { return nil, err } c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.provision", "response", internallog.HTTPResponse(res, b)) return ret, nil } type PartnersSubscriptionsResumeCall struct { s *Service name string resumesubscriptionrequest *ResumeSubscriptionRequest urlParams_ gensupport.URLParams ctx_ context.Context header_ http.Header } // Resume: Resumes a suspended subscription. The new billing cycle will start // at the time of the request. It should be called directly by the partner // using service accounts. // // - name: The name of the subscription resource to be resumed. It will have // the format of "partners/{partner_id}/subscriptions/{subscription_id}". func (r *PartnersSubscriptionsService) Resume(name string, resumesubscriptionrequest *ResumeSubscriptionRequest) *PartnersSubscriptionsResumeCall { c := &PartnersSubscriptionsResumeCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.name = name c.resumesubscriptionrequest = resumesubscriptionrequest return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more // details. func (c *PartnersSubscriptionsResumeCall) Fields(s ...googleapi.Field) *PartnersSubscriptionsResumeCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // Context sets the context to be used in this call's Do method. func (c *PartnersSubscriptionsResumeCall) Context(ctx context.Context) *PartnersSubscriptionsResumeCall { c.ctx_ = ctx return c } // Header returns a http.Header that can be modified by the caller to add // headers to the request. func (c *PartnersSubscriptionsResumeCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *PartnersSubscriptionsResumeCall) doRequest(alt string) (*http.Response, error) { reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.resumesubscriptionrequest) if err != nil { return nil, err } c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:resume") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("POST", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "name": c.name, }) c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.resume", "request", internallog.HTTPRequest(req, body.Bytes())) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "paymentsresellersubscription.partners.subscriptions.resume" call. // Any non-2xx status code is an error. Response headers are in either // *ResumeSubscriptionResponse.ServerResponse.Header or (if a response was // returned at all) in error.(*googleapi.Error).Header. Use // googleapi.IsNotModified to check whether the returned error was because // http.StatusNotModified was returned. func (c *PartnersSubscriptionsResumeCall) Do(opts ...googleapi.CallOption) (*ResumeSubscriptionResponse, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, gensupport.WrapError(&googleapi.Error{ Code: res.StatusCode, Header: res.Header, }) } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, gensupport.WrapError(err) } ret := &ResumeSubscriptionResponse{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret b, err := gensupport.DecodeResponseBytes(target, res) if err != nil { return nil, err } c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.resume", "response", internallog.HTTPResponse(res, b)) return ret, nil } type PartnersSubscriptionsSuspendCall struct { s *Service name string suspendsubscriptionrequest *SuspendSubscriptionRequest urlParams_ gensupport.URLParams ctx_ context.Context header_ http.Header } // Suspend: Suspends a subscription. Contract terms may dictate if a prorated // refund will be issued upon suspension. It should be called directly by the // partner using service accounts. // // - name: The name of the subscription resource to be suspended. It will have // the format of "partners/{partner_id}/subscriptions/{subscription_id}". func (r *PartnersSubscriptionsService) Suspend(name string, suspendsubscriptionrequest *SuspendSubscriptionRequest) *PartnersSubscriptionsSuspendCall { c := &PartnersSubscriptionsSuspendCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.name = name c.suspendsubscriptionrequest = suspendsubscriptionrequest return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more // details. func (c *PartnersSubscriptionsSuspendCall) Fields(s ...googleapi.Field) *PartnersSubscriptionsSuspendCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // Context sets the context to be used in this call's Do method. func (c *PartnersSubscriptionsSuspendCall) Context(ctx context.Context) *PartnersSubscriptionsSuspendCall { c.ctx_ = ctx return c } // Header returns a http.Header that can be modified by the caller to add // headers to the request. func (c *PartnersSubscriptionsSuspendCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *PartnersSubscriptionsSuspendCall) doRequest(alt string) (*http.Response, error) { reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.suspendsubscriptionrequest) if err != nil { return nil, err } c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:suspend") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("POST", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "name": c.name, }) c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.suspend", "request", internallog.HTTPRequest(req, body.Bytes())) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "paymentsresellersubscription.partners.subscriptions.suspend" call. // Any non-2xx status code is an error. Response headers are in either // *SuspendSubscriptionResponse.ServerResponse.Header or (if a response was // returned at all) in error.(*googleapi.Error).Header. Use // googleapi.IsNotModified to check whether the returned error was because // http.StatusNotModified was returned. func (c *PartnersSubscriptionsSuspendCall) Do(opts ...googleapi.CallOption) (*SuspendSubscriptionResponse, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, gensupport.WrapError(&googleapi.Error{ Code: res.StatusCode, Header: res.Header, }) } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, gensupport.WrapError(err) } ret := &SuspendSubscriptionResponse{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret b, err := gensupport.DecodeResponseBytes(target, res) if err != nil { return nil, err } c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.suspend", "response", internallog.HTTPResponse(res, b)) return ret, nil } type PartnersSubscriptionsUndoCancelCall struct { s *Service name string undocancelsubscriptionrequest *UndoCancelSubscriptionRequest urlParams_ gensupport.URLParams ctx_ context.Context header_ http.Header } // UndoCancel: Currently, it is used by **Google One, Play Pass** partners. // Revokes the pending cancellation of a subscription, which is currently in // `STATE_CANCEL_AT_END_OF_CYCLE` state. If the subscription is already // cancelled, the request will fail. It should be called directly by the // partner using service accounts. // // - name: The name of the subscription resource whose pending cancellation // needs to be undone. It will have the format of // "partners/{partner_id}/subscriptions/{subscription_id}". func (r *PartnersSubscriptionsService) UndoCancel(name string, undocancelsubscriptionrequest *UndoCancelSubscriptionRequest) *PartnersSubscriptionsUndoCancelCall { c := &PartnersSubscriptionsUndoCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.name = name c.undocancelsubscriptionrequest = undocancelsubscriptionrequest return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more // details. func (c *PartnersSubscriptionsUndoCancelCall) Fields(s ...googleapi.Field) *PartnersSubscriptionsUndoCancelCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // Context sets the context to be used in this call's Do method. func (c *PartnersSubscriptionsUndoCancelCall) Context(ctx context.Context) *PartnersSubscriptionsUndoCancelCall { c.ctx_ = ctx return c } // Header returns a http.Header that can be modified by the caller to add // headers to the request. func (c *PartnersSubscriptionsUndoCancelCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *PartnersSubscriptionsUndoCancelCall) doRequest(alt string) (*http.Response, error) { reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.undocancelsubscriptionrequest) if err != nil { return nil, err } c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:undoCancel") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("POST", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "name": c.name, }) c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.undoCancel", "request", internallog.HTTPRequest(req, body.Bytes())) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "paymentsresellersubscription.partners.subscriptions.undoCancel" call. // Any non-2xx status code is an error. Response headers are in either // *UndoCancelSubscriptionResponse.ServerResponse.Header or (if a response was // returned at all) in error.(*googleapi.Error).Header. Use // googleapi.IsNotModified to check whether the returned error was because // http.StatusNotModified was returned. func (c *PartnersSubscriptionsUndoCancelCall) Do(opts ...googleapi.CallOption) (*UndoCancelSubscriptionResponse, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, gensupport.WrapError(&googleapi.Error{ Code: res.StatusCode, Header: res.Header, }) } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, gensupport.WrapError(err) } ret := &UndoCancelSubscriptionResponse{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret b, err := gensupport.DecodeResponseBytes(target, res) if err != nil { return nil, err } c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.undoCancel", "response", internallog.HTTPResponse(res, b)) return ret, nil } type PartnersSubscriptionsLineItemsPatchCall struct { s *Service name string subscriptionlineitem *SubscriptionLineItem urlParams_ gensupport.URLParams ctx_ context.Context header_ http.Header } // Patch: Updates a line item of a subscription. It should be authenticated // with a service account. // // - name: Identifier. Resource name of the line item. Format: // partners/{partner}/subscriptions/{subscription}/lineItems/{lineItem}. func (r *PartnersSubscriptionsLineItemsService) Patch(name string, subscriptionlineitem *SubscriptionLineItem) *PartnersSubscriptionsLineItemsPatchCall { c := &PartnersSubscriptionsLineItemsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.name = name c.subscriptionlineitem = subscriptionlineitem return c } // UpdateMask sets the optional parameter "updateMask": Required. The list of // fields to update. Only a limited set of fields can be updated. The allowed // fields are the following: - // `product_payload.googleHomePayload.googleStructureId` func (c *PartnersSubscriptionsLineItemsPatchCall) UpdateMask(updateMask string) *PartnersSubscriptionsLineItemsPatchCall { c.urlParams_.Set("updateMask", updateMask) return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more // details. func (c *PartnersSubscriptionsLineItemsPatchCall) Fields(s ...googleapi.Field) *PartnersSubscriptionsLineItemsPatchCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // Context sets the context to be used in this call's Do method. func (c *PartnersSubscriptionsLineItemsPatchCall) Context(ctx context.Context) *PartnersSubscriptionsLineItemsPatchCall { c.ctx_ = ctx return c } // Header returns a http.Header that can be modified by the caller to add // headers to the request. func (c *PartnersSubscriptionsLineItemsPatchCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *PartnersSubscriptionsLineItemsPatchCall) doRequest(alt string) (*http.Response, error) { reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.subscriptionlineitem) if err != nil { return nil, err } c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("PATCH", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "name": c.name, }) c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.lineItems.patch", "request", internallog.HTTPRequest(req, body.Bytes())) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "paymentsresellersubscription.partners.subscriptions.lineItems.patch" call. // Any non-2xx status code is an error. Response headers are in either // *SubscriptionLineItem.ServerResponse.Header or (if a response was returned // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to // check whether the returned error was because http.StatusNotModified was // returned. func (c *PartnersSubscriptionsLineItemsPatchCall) Do(opts ...googleapi.CallOption) (*SubscriptionLineItem, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, gensupport.WrapError(&googleapi.Error{ Code: res.StatusCode, Header: res.Header, }) } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, gensupport.WrapError(err) } ret := &SubscriptionLineItem{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret b, err := gensupport.DecodeResponseBytes(target, res) if err != nil { return nil, err } c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.subscriptions.lineItems.patch", "response", internallog.HTTPResponse(res, b)) return ret, nil } type PartnersUserSessionsGenerateCall struct { s *Service parent string generateusersessionrequest *GenerateUserSessionRequest urlParams_ gensupport.URLParams ctx_ context.Context header_ http.Header } // Generate: This API replaces user authorized OAuth consent based APIs // (Create, Entitle). Issues a timed session token for the given user intent. // You can use the session token to redirect the user to Google to finish the // signup flow. You can re-generate new session token repeatedly for the same // request if necessary, regardless of the previous tokens being expired or // not. By default, the session token is valid for 1 hour. // // - parent: The parent, the partner that can resell. Format: // partners/{partner}. func (r *PartnersUserSessionsService) Generate(parent string, generateusersessionrequest *GenerateUserSessionRequest) *PartnersUserSessionsGenerateCall { c := &PartnersUserSessionsGenerateCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.parent = parent c.generateusersessionrequest = generateusersessionrequest return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more // details. func (c *PartnersUserSessionsGenerateCall) Fields(s ...googleapi.Field) *PartnersUserSessionsGenerateCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // Context sets the context to be used in this call's Do method. func (c *PartnersUserSessionsGenerateCall) Context(ctx context.Context) *PartnersUserSessionsGenerateCall { c.ctx_ = ctx return c } // Header returns a http.Header that can be modified by the caller to add // headers to the request. func (c *PartnersUserSessionsGenerateCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *PartnersUserSessionsGenerateCall) doRequest(alt string) (*http.Response, error) { reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.generateusersessionrequest) if err != nil { return nil, err } c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/userSessions:generate") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("POST", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "parent": c.parent, }) c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.userSessions.generate", "request", internallog.HTTPRequest(req, body.Bytes())) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "paymentsresellersubscription.partners.userSessions.generate" call. // Any non-2xx status code is an error. Response headers are in either // *GenerateUserSessionResponse.ServerResponse.Header or (if a response was // returned at all) in error.(*googleapi.Error).Header. Use // googleapi.IsNotModified to check whether the returned error was because // http.StatusNotModified was returned. func (c *PartnersUserSessionsGenerateCall) Do(opts ...googleapi.CallOption) (*GenerateUserSessionResponse, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, gensupport.WrapError(&googleapi.Error{ Code: res.StatusCode, Header: res.Header, }) } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, gensupport.WrapError(err) } ret := &GenerateUserSessionResponse{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret b, err := gensupport.DecodeResponseBytes(target, res) if err != nil { return nil, err } c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "paymentsresellersubscription.partners.userSessions.generate", "response", internallog.HTTPResponse(res, b)) return ret, nil }