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