1
// Package reseller provides access to the Enterprise Apps Reseller API.
3
// See https://developers.google.com/google-apps/reseller/
7
// import "google.golang.org/api/reseller/v1sandbox"
9
// resellerService, err := reseller.New(oauthHttpClient)
17
"google.golang.org/api/googleapi"
25
// Always reference these packages, just in case the auto-generated code
27
var _ = bytes.NewBuffer
30
var _ = json.NewDecoder
33
var _ = googleapi.Version
35
var _ = strings.Replace
37
const apiId = "reseller:v1sandbox"
38
const apiName = "reseller"
39
const apiVersion = "v1sandbox"
40
const basePath = "https://www.googleapis.com/apps/reseller/v1sandbox/"
42
// OAuth2 scopes used by this API.
44
// Manage users on your domain
45
AppsOrderScope = "https://www.googleapis.com/auth/apps.order"
47
// Manage users on your domain
48
AppsOrderReadonlyScope = "https://www.googleapis.com/auth/apps.order.readonly"
51
func New(client *http.Client) (*Service, error) {
53
return nil, errors.New("client is nil")
55
s := &Service{client: client, BasePath: basePath}
56
s.Customers = NewCustomersService(s)
57
s.Subscriptions = NewSubscriptionsService(s)
63
BasePath string // API endpoint base URL
65
Customers *CustomersService
67
Subscriptions *SubscriptionsService
70
func NewCustomersService(s *Service) *CustomersService {
71
rs := &CustomersService{s: s}
75
type CustomersService struct {
79
func NewSubscriptionsService(s *Service) *SubscriptionsService {
80
rs := &SubscriptionsService{s: s}
84
type SubscriptionsService struct {
89
// AddressLine1: Address line 1 of the address.
90
AddressLine1 string `json:"addressLine1,omitempty"`
92
// AddressLine2: Address line 2 of the address.
93
AddressLine2 string `json:"addressLine2,omitempty"`
95
// AddressLine3: Address line 3 of the address.
96
AddressLine3 string `json:"addressLine3,omitempty"`
98
// ContactName: Name of the contact person.
99
ContactName string `json:"contactName,omitempty"`
101
// CountryCode: ISO 3166 country code.
102
CountryCode string `json:"countryCode,omitempty"`
104
// Kind: Identifies the resource as a customer address.
105
Kind string `json:"kind,omitempty"`
107
// Locality: Name of the locality. This is in accordance with -
108
// http://portablecontacts.net/draft-spec.html#address_element.
109
Locality string `json:"locality,omitempty"`
111
// OrganizationName: Name of the organization.
112
OrganizationName string `json:"organizationName,omitempty"`
114
// PostalCode: The postal code. This is in accordance with -
115
// http://portablecontacts.net/draft-spec.html#address_element.
116
PostalCode string `json:"postalCode,omitempty"`
118
// Region: Name of the region. This is in accordance with -
119
// http://portablecontacts.net/draft-spec.html#address_element.
120
Region string `json:"region,omitempty"`
123
type ChangePlanRequest struct {
124
// Kind: Identifies the resource as a subscription change plan request.
125
Kind string `json:"kind,omitempty"`
127
// PlanName: Name of the plan to change to.
128
PlanName string `json:"planName,omitempty"`
130
// PurchaseOrderId: Purchase order id for your order tracking purposes.
131
PurchaseOrderId string `json:"purchaseOrderId,omitempty"`
133
// Seats: Number/Limit of seats in the new plan.
134
Seats *Seats `json:"seats,omitempty"`
137
type Customer struct {
138
// AlternateEmail: The alternate email of the customer.
139
AlternateEmail string `json:"alternateEmail,omitempty"`
141
// CustomerDomain: The domain name of the customer.
142
CustomerDomain string `json:"customerDomain,omitempty"`
144
// CustomerId: The id of the customer.
145
CustomerId string `json:"customerId,omitempty"`
147
// Kind: Identifies the resource as a customer.
148
Kind string `json:"kind,omitempty"`
150
// PhoneNumber: The phone number of the customer.
151
PhoneNumber string `json:"phoneNumber,omitempty"`
153
// PostalAddress: The postal address of the customer.
154
PostalAddress *Address `json:"postalAddress,omitempty"`
156
// ResourceUiUrl: Ui url for customer resource.
157
ResourceUiUrl string `json:"resourceUiUrl,omitempty"`
160
type RenewalSettings struct {
161
// Kind: Identifies the resource as a subscription renewal setting.
162
Kind string `json:"kind,omitempty"`
164
// RenewalType: Subscription renewal type.
165
RenewalType string `json:"renewalType,omitempty"`
169
// Kind: Identifies the resource as a subscription change plan request.
170
Kind string `json:"kind,omitempty"`
172
// LicensedNumberOfSeats: Read only field containing the current number
173
// of licensed seats. Resellers can utilize this field to gather
174
// insights into usage for FLEXIBLE Google-Apps subscriptions and other
175
// secondary subscriptions (e.g. Google-Vault, Drive-storage).
176
LicensedNumberOfSeats int64 `json:"licensedNumberOfSeats,omitempty"`
178
// MaximumNumberOfSeats: Maximum number of seats that can be purchased.
179
// This needs to be provided only for a non-commitment plan. For a
180
// commitment plan it is decided by the contract.
181
MaximumNumberOfSeats int64 `json:"maximumNumberOfSeats,omitempty"`
183
// NumberOfSeats: Number of seats to purchase. This is applicable only
184
// for a commitment plan.
185
NumberOfSeats int64 `json:"numberOfSeats,omitempty"`
188
type Subscription struct {
189
// CreationTime: Creation time of this subscription in milliseconds
191
CreationTime int64 `json:"creationTime,omitempty,string"`
193
// CustomerId: The id of the customer to whom the subscription belongs.
194
CustomerId string `json:"customerId,omitempty"`
196
// Kind: Identifies the resource as a Subscription.
197
Kind string `json:"kind,omitempty"`
199
// Plan: Plan details of the subscription
200
Plan *SubscriptionPlan `json:"plan,omitempty"`
202
// PurchaseOrderId: Purchase order id for your order tracking purposes.
203
PurchaseOrderId string `json:"purchaseOrderId,omitempty"`
205
// RenewalSettings: Renewal settings of the subscription.
206
RenewalSettings *RenewalSettings `json:"renewalSettings,omitempty"`
208
// ResourceUiUrl: Ui url for subscription resource.
209
ResourceUiUrl string `json:"resourceUiUrl,omitempty"`
211
// Seats: Number/Limit of seats in the new plan.
212
Seats *Seats `json:"seats,omitempty"`
214
// SkuId: Name of the sku for which this subscription is purchased.
215
SkuId string `json:"skuId,omitempty"`
217
// Status: Status of the subscription.
218
Status string `json:"status,omitempty"`
220
// SubscriptionId: The id of the subscription.
221
SubscriptionId string `json:"subscriptionId,omitempty"`
223
// TransferInfo: Transfer related information for the subscription.
224
TransferInfo *SubscriptionTransferInfo `json:"transferInfo,omitempty"`
226
// TrialSettings: Trial Settings of the subscription.
227
TrialSettings *SubscriptionTrialSettings `json:"trialSettings,omitempty"`
230
type SubscriptionPlan struct {
231
// CommitmentInterval: Interval of the commitment if it is a commitment
233
CommitmentInterval *SubscriptionPlanCommitmentInterval `json:"commitmentInterval,omitempty"`
235
// IsCommitmentPlan: Whether the plan is a commitment plan or not.
236
IsCommitmentPlan bool `json:"isCommitmentPlan,omitempty"`
238
// PlanName: The plan name of this subscription's plan.
239
PlanName string `json:"planName,omitempty"`
242
type SubscriptionPlanCommitmentInterval struct {
243
// EndTime: End time of the commitment interval in milliseconds since
245
EndTime int64 `json:"endTime,omitempty,string"`
247
// StartTime: Start time of the commitment interval in milliseconds
249
StartTime int64 `json:"startTime,omitempty,string"`
252
type SubscriptionTransferInfo struct {
253
MinimumTransferableSeats int64 `json:"minimumTransferableSeats,omitempty"`
255
// TransferabilityExpirationTime: Time when transfer token or intent to
256
// transfer will expire.
257
TransferabilityExpirationTime int64 `json:"transferabilityExpirationTime,omitempty,string"`
260
type SubscriptionTrialSettings struct {
261
// IsInTrial: Whether the subscription is in trial.
262
IsInTrial bool `json:"isInTrial,omitempty"`
264
// TrialEndTime: End time of the trial in milliseconds since Unix epoch.
265
TrialEndTime int64 `json:"trialEndTime,omitempty,string"`
268
type Subscriptions struct {
269
// Kind: Identifies the resource as a collection of subscriptions.
270
Kind string `json:"kind,omitempty"`
272
// NextPageToken: The continuation token, used to page through large
273
// result sets. Provide this value in a subsequent request to return the
274
// next page of results.
275
NextPageToken string `json:"nextPageToken,omitempty"`
277
// Subscriptions: The subscriptions in this page of results.
278
Subscriptions []*Subscription `json:"subscriptions,omitempty"`
281
// method id "reseller.customers.get":
283
type CustomersGetCall struct {
286
opt_ map[string]interface{}
289
// Get: Gets a customer resource if one exists and is owned by the
291
func (r *CustomersService) Get(customerId string) *CustomersGetCall {
292
c := &CustomersGetCall{s: r.s, opt_: make(map[string]interface{})}
293
c.customerId = customerId
297
// Fields allows partial responses to be retrieved.
298
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
299
// for more information.
300
func (c *CustomersGetCall) Fields(s ...googleapi.Field) *CustomersGetCall {
301
c.opt_["fields"] = googleapi.CombineFields(s)
305
func (c *CustomersGetCall) Do() (*Customer, error) {
306
var body io.Reader = nil
307
params := make(url.Values)
308
params.Set("alt", "json")
309
if v, ok := c.opt_["fields"]; ok {
310
params.Set("fields", fmt.Sprintf("%v", v))
312
urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}")
313
urls += "?" + params.Encode()
314
req, _ := http.NewRequest("GET", urls, body)
315
googleapi.Expand(req.URL, map[string]string{
316
"customerId": c.customerId,
318
req.Header.Set("User-Agent", "google-api-go-client/0.5")
319
res, err := c.s.client.Do(req)
323
defer googleapi.CloseBody(res)
324
if err := googleapi.CheckResponse(res); err != nil {
328
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
333
// "description": "Gets a customer resource if one exists and is owned by the reseller.",
334
// "httpMethod": "GET",
335
// "id": "reseller.customers.get",
336
// "parameterOrder": [
341
// "description": "Id of the Customer",
342
// "location": "path",
347
// "path": "customers/{customerId}",
349
// "$ref": "Customer"
352
// "https://www.googleapis.com/auth/apps.order",
353
// "https://www.googleapis.com/auth/apps.order.readonly"
359
// method id "reseller.customers.insert":
361
type CustomersInsertCall struct {
364
opt_ map[string]interface{}
367
// Insert: Creates a customer resource if one does not already exist.
368
func (r *CustomersService) Insert(customer *Customer) *CustomersInsertCall {
369
c := &CustomersInsertCall{s: r.s, opt_: make(map[string]interface{})}
370
c.customer = customer
374
// CustomerAuthToken sets the optional parameter "customerAuthToken": An
375
// auth token needed for inserting a customer for which domain already
376
// exists. Can be generated at
377
// https://www.google.com/a/cpanel//TransferToken.
378
func (c *CustomersInsertCall) CustomerAuthToken(customerAuthToken string) *CustomersInsertCall {
379
c.opt_["customerAuthToken"] = customerAuthToken
383
// Fields allows partial responses to be retrieved.
384
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
385
// for more information.
386
func (c *CustomersInsertCall) Fields(s ...googleapi.Field) *CustomersInsertCall {
387
c.opt_["fields"] = googleapi.CombineFields(s)
391
func (c *CustomersInsertCall) Do() (*Customer, error) {
392
var body io.Reader = nil
393
body, err := googleapi.WithoutDataWrapper.JSONReader(c.customer)
397
ctype := "application/json"
398
params := make(url.Values)
399
params.Set("alt", "json")
400
if v, ok := c.opt_["customerAuthToken"]; ok {
401
params.Set("customerAuthToken", fmt.Sprintf("%v", v))
403
if v, ok := c.opt_["fields"]; ok {
404
params.Set("fields", fmt.Sprintf("%v", v))
406
urls := googleapi.ResolveRelative(c.s.BasePath, "customers")
407
urls += "?" + params.Encode()
408
req, _ := http.NewRequest("POST", urls, body)
409
googleapi.SetOpaque(req.URL)
410
req.Header.Set("Content-Type", ctype)
411
req.Header.Set("User-Agent", "google-api-go-client/0.5")
412
res, err := c.s.client.Do(req)
416
defer googleapi.CloseBody(res)
417
if err := googleapi.CheckResponse(res); err != nil {
421
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
426
// "description": "Creates a customer resource if one does not already exist.",
427
// "httpMethod": "POST",
428
// "id": "reseller.customers.insert",
430
// "customerAuthToken": {
431
// "description": "An auth token needed for inserting a customer for which domain already exists. Can be generated at https://www.google.com/a/cpanel//TransferToken. Optional.",
432
// "location": "query",
436
// "path": "customers",
438
// "$ref": "Customer"
441
// "$ref": "Customer"
444
// "https://www.googleapis.com/auth/apps.order"
450
// method id "reseller.customers.patch":
452
type CustomersPatchCall struct {
456
opt_ map[string]interface{}
459
// Patch: Update a customer resource if one it exists and is owned by
460
// the reseller. This method supports patch semantics.
461
func (r *CustomersService) Patch(customerId string, customer *Customer) *CustomersPatchCall {
462
c := &CustomersPatchCall{s: r.s, opt_: make(map[string]interface{})}
463
c.customerId = customerId
464
c.customer = customer
468
// Fields allows partial responses to be retrieved.
469
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
470
// for more information.
471
func (c *CustomersPatchCall) Fields(s ...googleapi.Field) *CustomersPatchCall {
472
c.opt_["fields"] = googleapi.CombineFields(s)
476
func (c *CustomersPatchCall) Do() (*Customer, error) {
477
var body io.Reader = nil
478
body, err := googleapi.WithoutDataWrapper.JSONReader(c.customer)
482
ctype := "application/json"
483
params := make(url.Values)
484
params.Set("alt", "json")
485
if v, ok := c.opt_["fields"]; ok {
486
params.Set("fields", fmt.Sprintf("%v", v))
488
urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}")
489
urls += "?" + params.Encode()
490
req, _ := http.NewRequest("PATCH", urls, body)
491
googleapi.Expand(req.URL, map[string]string{
492
"customerId": c.customerId,
494
req.Header.Set("Content-Type", ctype)
495
req.Header.Set("User-Agent", "google-api-go-client/0.5")
496
res, err := c.s.client.Do(req)
500
defer googleapi.CloseBody(res)
501
if err := googleapi.CheckResponse(res); err != nil {
505
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
510
// "description": "Update a customer resource if one it exists and is owned by the reseller. This method supports patch semantics.",
511
// "httpMethod": "PATCH",
512
// "id": "reseller.customers.patch",
513
// "parameterOrder": [
518
// "description": "Id of the Customer",
519
// "location": "path",
524
// "path": "customers/{customerId}",
526
// "$ref": "Customer"
529
// "$ref": "Customer"
532
// "https://www.googleapis.com/auth/apps.order"
538
// method id "reseller.customers.update":
540
type CustomersUpdateCall struct {
544
opt_ map[string]interface{}
547
// Update: Update a customer resource if one it exists and is owned by
549
func (r *CustomersService) Update(customerId string, customer *Customer) *CustomersUpdateCall {
550
c := &CustomersUpdateCall{s: r.s, opt_: make(map[string]interface{})}
551
c.customerId = customerId
552
c.customer = customer
556
// Fields allows partial responses to be retrieved.
557
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
558
// for more information.
559
func (c *CustomersUpdateCall) Fields(s ...googleapi.Field) *CustomersUpdateCall {
560
c.opt_["fields"] = googleapi.CombineFields(s)
564
func (c *CustomersUpdateCall) Do() (*Customer, error) {
565
var body io.Reader = nil
566
body, err := googleapi.WithoutDataWrapper.JSONReader(c.customer)
570
ctype := "application/json"
571
params := make(url.Values)
572
params.Set("alt", "json")
573
if v, ok := c.opt_["fields"]; ok {
574
params.Set("fields", fmt.Sprintf("%v", v))
576
urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}")
577
urls += "?" + params.Encode()
578
req, _ := http.NewRequest("PUT", urls, body)
579
googleapi.Expand(req.URL, map[string]string{
580
"customerId": c.customerId,
582
req.Header.Set("Content-Type", ctype)
583
req.Header.Set("User-Agent", "google-api-go-client/0.5")
584
res, err := c.s.client.Do(req)
588
defer googleapi.CloseBody(res)
589
if err := googleapi.CheckResponse(res); err != nil {
593
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
598
// "description": "Update a customer resource if one it exists and is owned by the reseller.",
599
// "httpMethod": "PUT",
600
// "id": "reseller.customers.update",
601
// "parameterOrder": [
606
// "description": "Id of the Customer",
607
// "location": "path",
612
// "path": "customers/{customerId}",
614
// "$ref": "Customer"
617
// "$ref": "Customer"
620
// "https://www.googleapis.com/auth/apps.order"
626
// method id "reseller.subscriptions.activate":
628
type SubscriptionsActivateCall struct {
631
subscriptionId string
632
opt_ map[string]interface{}
635
// Activate: Activates a subscription previously suspended by the
637
func (r *SubscriptionsService) Activate(customerId string, subscriptionId string) *SubscriptionsActivateCall {
638
c := &SubscriptionsActivateCall{s: r.s, opt_: make(map[string]interface{})}
639
c.customerId = customerId
640
c.subscriptionId = subscriptionId
644
// Fields allows partial responses to be retrieved.
645
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
646
// for more information.
647
func (c *SubscriptionsActivateCall) Fields(s ...googleapi.Field) *SubscriptionsActivateCall {
648
c.opt_["fields"] = googleapi.CombineFields(s)
652
func (c *SubscriptionsActivateCall) Do() (*Subscription, error) {
653
var body io.Reader = nil
654
params := make(url.Values)
655
params.Set("alt", "json")
656
if v, ok := c.opt_["fields"]; ok {
657
params.Set("fields", fmt.Sprintf("%v", v))
659
urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}/subscriptions/{subscriptionId}/activate")
660
urls += "?" + params.Encode()
661
req, _ := http.NewRequest("POST", urls, body)
662
googleapi.Expand(req.URL, map[string]string{
663
"customerId": c.customerId,
664
"subscriptionId": c.subscriptionId,
666
req.Header.Set("User-Agent", "google-api-go-client/0.5")
667
res, err := c.s.client.Do(req)
671
defer googleapi.CloseBody(res)
672
if err := googleapi.CheckResponse(res); err != nil {
675
var ret *Subscription
676
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
681
// "description": "Activates a subscription previously suspended by the reseller",
682
// "httpMethod": "POST",
683
// "id": "reseller.subscriptions.activate",
684
// "parameterOrder": [
690
// "description": "Id of the Customer",
691
// "location": "path",
695
// "subscriptionId": {
696
// "description": "Id of the subscription, which is unique for a customer",
697
// "location": "path",
702
// "path": "customers/{customerId}/subscriptions/{subscriptionId}/activate",
704
// "$ref": "Subscription"
707
// "https://www.googleapis.com/auth/apps.order"
713
// method id "reseller.subscriptions.changePlan":
715
type SubscriptionsChangePlanCall struct {
718
subscriptionId string
719
changeplanrequest *ChangePlanRequest
720
opt_ map[string]interface{}
723
// ChangePlan: Changes the plan of a subscription
724
func (r *SubscriptionsService) ChangePlan(customerId string, subscriptionId string, changeplanrequest *ChangePlanRequest) *SubscriptionsChangePlanCall {
725
c := &SubscriptionsChangePlanCall{s: r.s, opt_: make(map[string]interface{})}
726
c.customerId = customerId
727
c.subscriptionId = subscriptionId
728
c.changeplanrequest = changeplanrequest
732
// Fields allows partial responses to be retrieved.
733
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
734
// for more information.
735
func (c *SubscriptionsChangePlanCall) Fields(s ...googleapi.Field) *SubscriptionsChangePlanCall {
736
c.opt_["fields"] = googleapi.CombineFields(s)
740
func (c *SubscriptionsChangePlanCall) Do() (*Subscription, error) {
741
var body io.Reader = nil
742
body, err := googleapi.WithoutDataWrapper.JSONReader(c.changeplanrequest)
746
ctype := "application/json"
747
params := make(url.Values)
748
params.Set("alt", "json")
749
if v, ok := c.opt_["fields"]; ok {
750
params.Set("fields", fmt.Sprintf("%v", v))
752
urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}/subscriptions/{subscriptionId}/changePlan")
753
urls += "?" + params.Encode()
754
req, _ := http.NewRequest("POST", urls, body)
755
googleapi.Expand(req.URL, map[string]string{
756
"customerId": c.customerId,
757
"subscriptionId": c.subscriptionId,
759
req.Header.Set("Content-Type", ctype)
760
req.Header.Set("User-Agent", "google-api-go-client/0.5")
761
res, err := c.s.client.Do(req)
765
defer googleapi.CloseBody(res)
766
if err := googleapi.CheckResponse(res); err != nil {
769
var ret *Subscription
770
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
775
// "description": "Changes the plan of a subscription",
776
// "httpMethod": "POST",
777
// "id": "reseller.subscriptions.changePlan",
778
// "parameterOrder": [
784
// "description": "Id of the Customer",
785
// "location": "path",
789
// "subscriptionId": {
790
// "description": "Id of the subscription, which is unique for a customer",
791
// "location": "path",
796
// "path": "customers/{customerId}/subscriptions/{subscriptionId}/changePlan",
798
// "$ref": "ChangePlanRequest"
801
// "$ref": "Subscription"
804
// "https://www.googleapis.com/auth/apps.order"
810
// method id "reseller.subscriptions.changeRenewalSettings":
812
type SubscriptionsChangeRenewalSettingsCall struct {
815
subscriptionId string
816
renewalsettings *RenewalSettings
817
opt_ map[string]interface{}
820
// ChangeRenewalSettings: Changes the renewal settings of a subscription
821
func (r *SubscriptionsService) ChangeRenewalSettings(customerId string, subscriptionId string, renewalsettings *RenewalSettings) *SubscriptionsChangeRenewalSettingsCall {
822
c := &SubscriptionsChangeRenewalSettingsCall{s: r.s, opt_: make(map[string]interface{})}
823
c.customerId = customerId
824
c.subscriptionId = subscriptionId
825
c.renewalsettings = renewalsettings
829
// Fields allows partial responses to be retrieved.
830
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
831
// for more information.
832
func (c *SubscriptionsChangeRenewalSettingsCall) Fields(s ...googleapi.Field) *SubscriptionsChangeRenewalSettingsCall {
833
c.opt_["fields"] = googleapi.CombineFields(s)
837
func (c *SubscriptionsChangeRenewalSettingsCall) Do() (*Subscription, error) {
838
var body io.Reader = nil
839
body, err := googleapi.WithoutDataWrapper.JSONReader(c.renewalsettings)
843
ctype := "application/json"
844
params := make(url.Values)
845
params.Set("alt", "json")
846
if v, ok := c.opt_["fields"]; ok {
847
params.Set("fields", fmt.Sprintf("%v", v))
849
urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}/subscriptions/{subscriptionId}/changeRenewalSettings")
850
urls += "?" + params.Encode()
851
req, _ := http.NewRequest("POST", urls, body)
852
googleapi.Expand(req.URL, map[string]string{
853
"customerId": c.customerId,
854
"subscriptionId": c.subscriptionId,
856
req.Header.Set("Content-Type", ctype)
857
req.Header.Set("User-Agent", "google-api-go-client/0.5")
858
res, err := c.s.client.Do(req)
862
defer googleapi.CloseBody(res)
863
if err := googleapi.CheckResponse(res); err != nil {
866
var ret *Subscription
867
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
872
// "description": "Changes the renewal settings of a subscription",
873
// "httpMethod": "POST",
874
// "id": "reseller.subscriptions.changeRenewalSettings",
875
// "parameterOrder": [
881
// "description": "Id of the Customer",
882
// "location": "path",
886
// "subscriptionId": {
887
// "description": "Id of the subscription, which is unique for a customer",
888
// "location": "path",
893
// "path": "customers/{customerId}/subscriptions/{subscriptionId}/changeRenewalSettings",
895
// "$ref": "RenewalSettings"
898
// "$ref": "Subscription"
901
// "https://www.googleapis.com/auth/apps.order"
907
// method id "reseller.subscriptions.changeSeats":
909
type SubscriptionsChangeSeatsCall struct {
912
subscriptionId string
914
opt_ map[string]interface{}
917
// ChangeSeats: Changes the seats configuration of a subscription
918
func (r *SubscriptionsService) ChangeSeats(customerId string, subscriptionId string, seats *Seats) *SubscriptionsChangeSeatsCall {
919
c := &SubscriptionsChangeSeatsCall{s: r.s, opt_: make(map[string]interface{})}
920
c.customerId = customerId
921
c.subscriptionId = subscriptionId
926
// Fields allows partial responses to be retrieved.
927
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
928
// for more information.
929
func (c *SubscriptionsChangeSeatsCall) Fields(s ...googleapi.Field) *SubscriptionsChangeSeatsCall {
930
c.opt_["fields"] = googleapi.CombineFields(s)
934
func (c *SubscriptionsChangeSeatsCall) Do() (*Subscription, error) {
935
var body io.Reader = nil
936
body, err := googleapi.WithoutDataWrapper.JSONReader(c.seats)
940
ctype := "application/json"
941
params := make(url.Values)
942
params.Set("alt", "json")
943
if v, ok := c.opt_["fields"]; ok {
944
params.Set("fields", fmt.Sprintf("%v", v))
946
urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}/subscriptions/{subscriptionId}/changeSeats")
947
urls += "?" + params.Encode()
948
req, _ := http.NewRequest("POST", urls, body)
949
googleapi.Expand(req.URL, map[string]string{
950
"customerId": c.customerId,
951
"subscriptionId": c.subscriptionId,
953
req.Header.Set("Content-Type", ctype)
954
req.Header.Set("User-Agent", "google-api-go-client/0.5")
955
res, err := c.s.client.Do(req)
959
defer googleapi.CloseBody(res)
960
if err := googleapi.CheckResponse(res); err != nil {
963
var ret *Subscription
964
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
969
// "description": "Changes the seats configuration of a subscription",
970
// "httpMethod": "POST",
971
// "id": "reseller.subscriptions.changeSeats",
972
// "parameterOrder": [
978
// "description": "Id of the Customer",
979
// "location": "path",
983
// "subscriptionId": {
984
// "description": "Id of the subscription, which is unique for a customer",
985
// "location": "path",
990
// "path": "customers/{customerId}/subscriptions/{subscriptionId}/changeSeats",
995
// "$ref": "Subscription"
998
// "https://www.googleapis.com/auth/apps.order"
1004
// method id "reseller.subscriptions.delete":
1006
type SubscriptionsDeleteCall struct {
1009
subscriptionId string
1011
opt_ map[string]interface{}
1014
// Delete: Cancels/Downgrades a subscription.
1015
func (r *SubscriptionsService) Delete(customerId string, subscriptionId string, deletionType string) *SubscriptionsDeleteCall {
1016
c := &SubscriptionsDeleteCall{s: r.s, opt_: make(map[string]interface{})}
1017
c.customerId = customerId
1018
c.subscriptionId = subscriptionId
1019
c.deletionType = deletionType
1023
// Fields allows partial responses to be retrieved.
1024
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1025
// for more information.
1026
func (c *SubscriptionsDeleteCall) Fields(s ...googleapi.Field) *SubscriptionsDeleteCall {
1027
c.opt_["fields"] = googleapi.CombineFields(s)
1031
func (c *SubscriptionsDeleteCall) Do() error {
1032
var body io.Reader = nil
1033
params := make(url.Values)
1034
params.Set("alt", "json")
1035
params.Set("deletionType", fmt.Sprintf("%v", c.deletionType))
1036
if v, ok := c.opt_["fields"]; ok {
1037
params.Set("fields", fmt.Sprintf("%v", v))
1039
urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}/subscriptions/{subscriptionId}")
1040
urls += "?" + params.Encode()
1041
req, _ := http.NewRequest("DELETE", urls, body)
1042
googleapi.Expand(req.URL, map[string]string{
1043
"customerId": c.customerId,
1044
"subscriptionId": c.subscriptionId,
1046
req.Header.Set("User-Agent", "google-api-go-client/0.5")
1047
res, err := c.s.client.Do(req)
1051
defer googleapi.CloseBody(res)
1052
if err := googleapi.CheckResponse(res); err != nil {
1057
// "description": "Cancels/Downgrades a subscription.",
1058
// "httpMethod": "DELETE",
1059
// "id": "reseller.subscriptions.delete",
1060
// "parameterOrder": [
1062
// "subscriptionId",
1067
// "description": "Id of the Customer",
1068
// "location": "path",
1069
// "required": true,
1072
// "deletionType": {
1073
// "description": "Whether the subscription is to be fully cancelled or downgraded",
1079
// "enumDescriptions": [
1080
// "Cancels the subscription immediately",
1081
// "Downgrades a Google Apps for Business subscription to Google Apps",
1082
// "Suspends the subscriptions for 4 days before cancelling it"
1084
// "location": "query",
1085
// "required": true,
1088
// "subscriptionId": {
1089
// "description": "Id of the subscription, which is unique for a customer",
1090
// "location": "path",
1091
// "required": true,
1095
// "path": "customers/{customerId}/subscriptions/{subscriptionId}",
1097
// "https://www.googleapis.com/auth/apps.order"
1103
// method id "reseller.subscriptions.get":
1105
type SubscriptionsGetCall struct {
1108
subscriptionId string
1109
opt_ map[string]interface{}
1112
// Get: Gets a subscription of the customer.
1113
func (r *SubscriptionsService) Get(customerId string, subscriptionId string) *SubscriptionsGetCall {
1114
c := &SubscriptionsGetCall{s: r.s, opt_: make(map[string]interface{})}
1115
c.customerId = customerId
1116
c.subscriptionId = subscriptionId
1120
// Fields allows partial responses to be retrieved.
1121
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1122
// for more information.
1123
func (c *SubscriptionsGetCall) Fields(s ...googleapi.Field) *SubscriptionsGetCall {
1124
c.opt_["fields"] = googleapi.CombineFields(s)
1128
func (c *SubscriptionsGetCall) Do() (*Subscription, error) {
1129
var body io.Reader = nil
1130
params := make(url.Values)
1131
params.Set("alt", "json")
1132
if v, ok := c.opt_["fields"]; ok {
1133
params.Set("fields", fmt.Sprintf("%v", v))
1135
urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}/subscriptions/{subscriptionId}")
1136
urls += "?" + params.Encode()
1137
req, _ := http.NewRequest("GET", urls, body)
1138
googleapi.Expand(req.URL, map[string]string{
1139
"customerId": c.customerId,
1140
"subscriptionId": c.subscriptionId,
1142
req.Header.Set("User-Agent", "google-api-go-client/0.5")
1143
res, err := c.s.client.Do(req)
1147
defer googleapi.CloseBody(res)
1148
if err := googleapi.CheckResponse(res); err != nil {
1151
var ret *Subscription
1152
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
1157
// "description": "Gets a subscription of the customer.",
1158
// "httpMethod": "GET",
1159
// "id": "reseller.subscriptions.get",
1160
// "parameterOrder": [
1166
// "description": "Id of the Customer",
1167
// "location": "path",
1168
// "required": true,
1171
// "subscriptionId": {
1172
// "description": "Id of the subscription, which is unique for a customer",
1173
// "location": "path",
1174
// "required": true,
1178
// "path": "customers/{customerId}/subscriptions/{subscriptionId}",
1180
// "$ref": "Subscription"
1183
// "https://www.googleapis.com/auth/apps.order",
1184
// "https://www.googleapis.com/auth/apps.order.readonly"
1190
// method id "reseller.subscriptions.insert":
1192
type SubscriptionsInsertCall struct {
1195
subscription *Subscription
1196
opt_ map[string]interface{}
1199
// Insert: Creates/Transfers a subscription for the customer.
1200
func (r *SubscriptionsService) Insert(customerId string, subscription *Subscription) *SubscriptionsInsertCall {
1201
c := &SubscriptionsInsertCall{s: r.s, opt_: make(map[string]interface{})}
1202
c.customerId = customerId
1203
c.subscription = subscription
1207
// CustomerAuthToken sets the optional parameter "customerAuthToken": An
1208
// auth token needed for transferring a subscription. Can be generated
1209
// at https://www.google.com/a/cpanel/customer-domain/TransferToken.
1210
func (c *SubscriptionsInsertCall) CustomerAuthToken(customerAuthToken string) *SubscriptionsInsertCall {
1211
c.opt_["customerAuthToken"] = customerAuthToken
1215
// Fields allows partial responses to be retrieved.
1216
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1217
// for more information.
1218
func (c *SubscriptionsInsertCall) Fields(s ...googleapi.Field) *SubscriptionsInsertCall {
1219
c.opt_["fields"] = googleapi.CombineFields(s)
1223
func (c *SubscriptionsInsertCall) Do() (*Subscription, error) {
1224
var body io.Reader = nil
1225
body, err := googleapi.WithoutDataWrapper.JSONReader(c.subscription)
1229
ctype := "application/json"
1230
params := make(url.Values)
1231
params.Set("alt", "json")
1232
if v, ok := c.opt_["customerAuthToken"]; ok {
1233
params.Set("customerAuthToken", fmt.Sprintf("%v", v))
1235
if v, ok := c.opt_["fields"]; ok {
1236
params.Set("fields", fmt.Sprintf("%v", v))
1238
urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}/subscriptions")
1239
urls += "?" + params.Encode()
1240
req, _ := http.NewRequest("POST", urls, body)
1241
googleapi.Expand(req.URL, map[string]string{
1242
"customerId": c.customerId,
1244
req.Header.Set("Content-Type", ctype)
1245
req.Header.Set("User-Agent", "google-api-go-client/0.5")
1246
res, err := c.s.client.Do(req)
1250
defer googleapi.CloseBody(res)
1251
if err := googleapi.CheckResponse(res); err != nil {
1254
var ret *Subscription
1255
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
1260
// "description": "Creates/Transfers a subscription for the customer.",
1261
// "httpMethod": "POST",
1262
// "id": "reseller.subscriptions.insert",
1263
// "parameterOrder": [
1267
// "customerAuthToken": {
1268
// "description": "An auth token needed for transferring a subscription. Can be generated at https://www.google.com/a/cpanel/customer-domain/TransferToken. Optional.",
1269
// "location": "query",
1273
// "description": "Id of the Customer",
1274
// "location": "path",
1275
// "required": true,
1279
// "path": "customers/{customerId}/subscriptions",
1281
// "$ref": "Subscription"
1284
// "$ref": "Subscription"
1287
// "https://www.googleapis.com/auth/apps.order"
1293
// method id "reseller.subscriptions.list":
1295
type SubscriptionsListCall struct {
1297
opt_ map[string]interface{}
1300
// List: Lists subscriptions of a reseller, optionally filtered by a
1301
// customer name prefix.
1302
func (r *SubscriptionsService) List() *SubscriptionsListCall {
1303
c := &SubscriptionsListCall{s: r.s, opt_: make(map[string]interface{})}
1307
// CustomerAuthToken sets the optional parameter "customerAuthToken": An
1308
// auth token needed if the customer is not a resold customer of this
1309
// reseller. Can be generated at
1310
// https://www.google.com/a/cpanel/customer-domain/TransferToken.
1311
func (c *SubscriptionsListCall) CustomerAuthToken(customerAuthToken string) *SubscriptionsListCall {
1312
c.opt_["customerAuthToken"] = customerAuthToken
1316
// CustomerId sets the optional parameter "customerId": Id of the
1318
func (c *SubscriptionsListCall) CustomerId(customerId string) *SubscriptionsListCall {
1319
c.opt_["customerId"] = customerId
1323
// CustomerNamePrefix sets the optional parameter "customerNamePrefix":
1324
// Prefix of the customer's domain name by which the subscriptions
1325
// should be filtered. Optional
1326
func (c *SubscriptionsListCall) CustomerNamePrefix(customerNamePrefix string) *SubscriptionsListCall {
1327
c.opt_["customerNamePrefix"] = customerNamePrefix
1331
// MaxResults sets the optional parameter "maxResults": Maximum number
1332
// of results to return
1333
func (c *SubscriptionsListCall) MaxResults(maxResults int64) *SubscriptionsListCall {
1334
c.opt_["maxResults"] = maxResults
1338
// PageToken sets the optional parameter "pageToken": Token to specify
1339
// next page in the list
1340
func (c *SubscriptionsListCall) PageToken(pageToken string) *SubscriptionsListCall {
1341
c.opt_["pageToken"] = pageToken
1345
// Fields allows partial responses to be retrieved.
1346
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1347
// for more information.
1348
func (c *SubscriptionsListCall) Fields(s ...googleapi.Field) *SubscriptionsListCall {
1349
c.opt_["fields"] = googleapi.CombineFields(s)
1353
func (c *SubscriptionsListCall) Do() (*Subscriptions, error) {
1354
var body io.Reader = nil
1355
params := make(url.Values)
1356
params.Set("alt", "json")
1357
if v, ok := c.opt_["customerAuthToken"]; ok {
1358
params.Set("customerAuthToken", fmt.Sprintf("%v", v))
1360
if v, ok := c.opt_["customerId"]; ok {
1361
params.Set("customerId", fmt.Sprintf("%v", v))
1363
if v, ok := c.opt_["customerNamePrefix"]; ok {
1364
params.Set("customerNamePrefix", fmt.Sprintf("%v", v))
1366
if v, ok := c.opt_["maxResults"]; ok {
1367
params.Set("maxResults", fmt.Sprintf("%v", v))
1369
if v, ok := c.opt_["pageToken"]; ok {
1370
params.Set("pageToken", fmt.Sprintf("%v", v))
1372
if v, ok := c.opt_["fields"]; ok {
1373
params.Set("fields", fmt.Sprintf("%v", v))
1375
urls := googleapi.ResolveRelative(c.s.BasePath, "subscriptions")
1376
urls += "?" + params.Encode()
1377
req, _ := http.NewRequest("GET", urls, body)
1378
googleapi.SetOpaque(req.URL)
1379
req.Header.Set("User-Agent", "google-api-go-client/0.5")
1380
res, err := c.s.client.Do(req)
1384
defer googleapi.CloseBody(res)
1385
if err := googleapi.CheckResponse(res); err != nil {
1388
var ret *Subscriptions
1389
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
1394
// "description": "Lists subscriptions of a reseller, optionally filtered by a customer name prefix.",
1395
// "httpMethod": "GET",
1396
// "id": "reseller.subscriptions.list",
1398
// "customerAuthToken": {
1399
// "description": "An auth token needed if the customer is not a resold customer of this reseller. Can be generated at https://www.google.com/a/cpanel/customer-domain/TransferToken.Optional.",
1400
// "location": "query",
1404
// "description": "Id of the Customer",
1405
// "location": "query",
1408
// "customerNamePrefix": {
1409
// "description": "Prefix of the customer's domain name by which the subscriptions should be filtered. Optional",
1410
// "location": "query",
1414
// "description": "Maximum number of results to return",
1415
// "format": "uint32",
1416
// "location": "query",
1417
// "maximum": "100",
1419
// "type": "integer"
1422
// "description": "Token to specify next page in the list",
1423
// "location": "query",
1427
// "path": "subscriptions",
1429
// "$ref": "Subscriptions"
1432
// "https://www.googleapis.com/auth/apps.order",
1433
// "https://www.googleapis.com/auth/apps.order.readonly"
1439
// method id "reseller.subscriptions.startPaidService":
1441
type SubscriptionsStartPaidServiceCall struct {
1444
subscriptionId string
1445
opt_ map[string]interface{}
1448
// StartPaidService: Starts paid service of a trial subscription
1449
func (r *SubscriptionsService) StartPaidService(customerId string, subscriptionId string) *SubscriptionsStartPaidServiceCall {
1450
c := &SubscriptionsStartPaidServiceCall{s: r.s, opt_: make(map[string]interface{})}
1451
c.customerId = customerId
1452
c.subscriptionId = subscriptionId
1456
// Fields allows partial responses to be retrieved.
1457
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1458
// for more information.
1459
func (c *SubscriptionsStartPaidServiceCall) Fields(s ...googleapi.Field) *SubscriptionsStartPaidServiceCall {
1460
c.opt_["fields"] = googleapi.CombineFields(s)
1464
func (c *SubscriptionsStartPaidServiceCall) Do() (*Subscription, error) {
1465
var body io.Reader = nil
1466
params := make(url.Values)
1467
params.Set("alt", "json")
1468
if v, ok := c.opt_["fields"]; ok {
1469
params.Set("fields", fmt.Sprintf("%v", v))
1471
urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}/subscriptions/{subscriptionId}/startPaidService")
1472
urls += "?" + params.Encode()
1473
req, _ := http.NewRequest("POST", urls, body)
1474
googleapi.Expand(req.URL, map[string]string{
1475
"customerId": c.customerId,
1476
"subscriptionId": c.subscriptionId,
1478
req.Header.Set("User-Agent", "google-api-go-client/0.5")
1479
res, err := c.s.client.Do(req)
1483
defer googleapi.CloseBody(res)
1484
if err := googleapi.CheckResponse(res); err != nil {
1487
var ret *Subscription
1488
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
1493
// "description": "Starts paid service of a trial subscription",
1494
// "httpMethod": "POST",
1495
// "id": "reseller.subscriptions.startPaidService",
1496
// "parameterOrder": [
1502
// "description": "Id of the Customer",
1503
// "location": "path",
1504
// "required": true,
1507
// "subscriptionId": {
1508
// "description": "Id of the subscription, which is unique for a customer",
1509
// "location": "path",
1510
// "required": true,
1514
// "path": "customers/{customerId}/subscriptions/{subscriptionId}/startPaidService",
1516
// "$ref": "Subscription"
1519
// "https://www.googleapis.com/auth/apps.order"
1525
// method id "reseller.subscriptions.suspend":
1527
type SubscriptionsSuspendCall struct {
1530
subscriptionId string
1531
opt_ map[string]interface{}
1534
// Suspend: Suspends an active subscription
1535
func (r *SubscriptionsService) Suspend(customerId string, subscriptionId string) *SubscriptionsSuspendCall {
1536
c := &SubscriptionsSuspendCall{s: r.s, opt_: make(map[string]interface{})}
1537
c.customerId = customerId
1538
c.subscriptionId = subscriptionId
1542
// Fields allows partial responses to be retrieved.
1543
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1544
// for more information.
1545
func (c *SubscriptionsSuspendCall) Fields(s ...googleapi.Field) *SubscriptionsSuspendCall {
1546
c.opt_["fields"] = googleapi.CombineFields(s)
1550
func (c *SubscriptionsSuspendCall) Do() (*Subscription, error) {
1551
var body io.Reader = nil
1552
params := make(url.Values)
1553
params.Set("alt", "json")
1554
if v, ok := c.opt_["fields"]; ok {
1555
params.Set("fields", fmt.Sprintf("%v", v))
1557
urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}/subscriptions/{subscriptionId}/suspend")
1558
urls += "?" + params.Encode()
1559
req, _ := http.NewRequest("POST", urls, body)
1560
googleapi.Expand(req.URL, map[string]string{
1561
"customerId": c.customerId,
1562
"subscriptionId": c.subscriptionId,
1564
req.Header.Set("User-Agent", "google-api-go-client/0.5")
1565
res, err := c.s.client.Do(req)
1569
defer googleapi.CloseBody(res)
1570
if err := googleapi.CheckResponse(res); err != nil {
1573
var ret *Subscription
1574
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
1579
// "description": "Suspends an active subscription",
1580
// "httpMethod": "POST",
1581
// "id": "reseller.subscriptions.suspend",
1582
// "parameterOrder": [
1588
// "description": "Id of the Customer",
1589
// "location": "path",
1590
// "required": true,
1593
// "subscriptionId": {
1594
// "description": "Id of the subscription, which is unique for a customer",
1595
// "location": "path",
1596
// "required": true,
1600
// "path": "customers/{customerId}/subscriptions/{subscriptionId}/suspend",
1602
// "$ref": "Subscription"
1605
// "https://www.googleapis.com/auth/apps.order"