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