~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/google.golang.org/api/reseller/v1sandbox/reseller-gen.go

  • Committer: Nicholas Skaggs
  • Date: 2016-10-24 20:56:05 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161024205605-z8lta0uvuhtxwzwl
Initi with beta15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Package reseller provides access to the Enterprise Apps Reseller API.
 
2
//
 
3
// See https://developers.google.com/google-apps/reseller/
 
4
//
 
5
// Usage example:
 
6
//
 
7
//   import "google.golang.org/api/reseller/v1sandbox"
 
8
//   ...
 
9
//   resellerService, err := reseller.New(oauthHttpClient)
 
10
package reseller
 
11
 
 
12
import (
 
13
        "bytes"
 
14
        "encoding/json"
 
15
        "errors"
 
16
        "fmt"
 
17
        "google.golang.org/api/googleapi"
 
18
        "io"
 
19
        "net/http"
 
20
        "net/url"
 
21
        "strconv"
 
22
        "strings"
 
23
)
 
24
 
 
25
// Always reference these packages, just in case the auto-generated code
 
26
// below doesn't.
 
27
var _ = bytes.NewBuffer
 
28
var _ = strconv.Itoa
 
29
var _ = fmt.Sprintf
 
30
var _ = json.NewDecoder
 
31
var _ = io.Copy
 
32
var _ = url.Parse
 
33
var _ = googleapi.Version
 
34
var _ = errors.New
 
35
var _ = strings.Replace
 
36
 
 
37
const apiId = "reseller:v1sandbox"
 
38
const apiName = "reseller"
 
39
const apiVersion = "v1sandbox"
 
40
const basePath = "https://www.googleapis.com/apps/reseller/v1sandbox/"
 
41
 
 
42
// OAuth2 scopes used by this API.
 
43
const (
 
44
        // Manage users on your domain
 
45
        AppsOrderScope = "https://www.googleapis.com/auth/apps.order"
 
46
 
 
47
        // Manage users on your domain
 
48
        AppsOrderReadonlyScope = "https://www.googleapis.com/auth/apps.order.readonly"
 
49
)
 
50
 
 
51
func New(client *http.Client) (*Service, error) {
 
52
        if client == nil {
 
53
                return nil, errors.New("client is nil")
 
54
        }
 
55
        s := &Service{client: client, BasePath: basePath}
 
56
        s.Customers = NewCustomersService(s)
 
57
        s.Subscriptions = NewSubscriptionsService(s)
 
58
        return s, nil
 
59
}
 
60
 
 
61
type Service struct {
 
62
        client   *http.Client
 
63
        BasePath string // API endpoint base URL
 
64
 
 
65
        Customers *CustomersService
 
66
 
 
67
        Subscriptions *SubscriptionsService
 
68
}
 
69
 
 
70
func NewCustomersService(s *Service) *CustomersService {
 
71
        rs := &CustomersService{s: s}
 
72
        return rs
 
73
}
 
74
 
 
75
type CustomersService struct {
 
76
        s *Service
 
77
}
 
78
 
 
79
func NewSubscriptionsService(s *Service) *SubscriptionsService {
 
80
        rs := &SubscriptionsService{s: s}
 
81
        return rs
 
82
}
 
83
 
 
84
type SubscriptionsService struct {
 
85
        s *Service
 
86
}
 
87
 
 
88
type Address struct {
 
89
        // AddressLine1: Address line 1 of the address.
 
90
        AddressLine1 string `json:"addressLine1,omitempty"`
 
91
 
 
92
        // AddressLine2: Address line 2 of the address.
 
93
        AddressLine2 string `json:"addressLine2,omitempty"`
 
94
 
 
95
        // AddressLine3: Address line 3 of the address.
 
96
        AddressLine3 string `json:"addressLine3,omitempty"`
 
97
 
 
98
        // ContactName: Name of the contact person.
 
99
        ContactName string `json:"contactName,omitempty"`
 
100
 
 
101
        // CountryCode: ISO 3166 country code.
 
102
        CountryCode string `json:"countryCode,omitempty"`
 
103
 
 
104
        // Kind: Identifies the resource as a customer address.
 
105
        Kind string `json:"kind,omitempty"`
 
106
 
 
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"`
 
110
 
 
111
        // OrganizationName: Name of the organization.
 
112
        OrganizationName string `json:"organizationName,omitempty"`
 
113
 
 
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"`
 
117
 
 
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"`
 
121
}
 
122
 
 
123
type ChangePlanRequest struct {
 
124
        // Kind: Identifies the resource as a subscription change plan request.
 
125
        Kind string `json:"kind,omitempty"`
 
126
 
 
127
        // PlanName: Name of the plan to change to.
 
128
        PlanName string `json:"planName,omitempty"`
 
129
 
 
130
        // PurchaseOrderId: Purchase order id for your order tracking purposes.
 
131
        PurchaseOrderId string `json:"purchaseOrderId,omitempty"`
 
132
 
 
133
        // Seats: Number/Limit of seats in the new plan.
 
134
        Seats *Seats `json:"seats,omitempty"`
 
135
}
 
136
 
 
137
type Customer struct {
 
138
        // AlternateEmail: The alternate email of the customer.
 
139
        AlternateEmail string `json:"alternateEmail,omitempty"`
 
140
 
 
141
        // CustomerDomain: The domain name of the customer.
 
142
        CustomerDomain string `json:"customerDomain,omitempty"`
 
143
 
 
144
        // CustomerId: The id of the customer.
 
145
        CustomerId string `json:"customerId,omitempty"`
 
146
 
 
147
        // Kind: Identifies the resource as a customer.
 
148
        Kind string `json:"kind,omitempty"`
 
149
 
 
150
        // PhoneNumber: The phone number of the customer.
 
151
        PhoneNumber string `json:"phoneNumber,omitempty"`
 
152
 
 
153
        // PostalAddress: The postal address of the customer.
 
154
        PostalAddress *Address `json:"postalAddress,omitempty"`
 
155
 
 
156
        // ResourceUiUrl: Ui url for customer resource.
 
157
        ResourceUiUrl string `json:"resourceUiUrl,omitempty"`
 
158
}
 
159
 
 
160
type RenewalSettings struct {
 
161
        // Kind: Identifies the resource as a subscription renewal setting.
 
162
        Kind string `json:"kind,omitempty"`
 
163
 
 
164
        // RenewalType: Subscription renewal type.
 
165
        RenewalType string `json:"renewalType,omitempty"`
 
166
}
 
167
 
 
168
type Seats struct {
 
169
        // Kind: Identifies the resource as a subscription change plan request.
 
170
        Kind string `json:"kind,omitempty"`
 
171
 
 
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"`
 
177
 
 
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"`
 
182
 
 
183
        // NumberOfSeats: Number of seats to purchase. This is applicable only
 
184
        // for a commitment plan.
 
185
        NumberOfSeats int64 `json:"numberOfSeats,omitempty"`
 
186
}
 
187
 
 
188
type Subscription struct {
 
189
        // CreationTime: Creation time of this subscription in milliseconds
 
190
        // since Unix epoch.
 
191
        CreationTime int64 `json:"creationTime,omitempty,string"`
 
192
 
 
193
        // CustomerId: The id of the customer to whom the subscription belongs.
 
194
        CustomerId string `json:"customerId,omitempty"`
 
195
 
 
196
        // Kind: Identifies the resource as a Subscription.
 
197
        Kind string `json:"kind,omitempty"`
 
198
 
 
199
        // Plan: Plan details of the subscription
 
200
        Plan *SubscriptionPlan `json:"plan,omitempty"`
 
201
 
 
202
        // PurchaseOrderId: Purchase order id for your order tracking purposes.
 
203
        PurchaseOrderId string `json:"purchaseOrderId,omitempty"`
 
204
 
 
205
        // RenewalSettings: Renewal settings of the subscription.
 
206
        RenewalSettings *RenewalSettings `json:"renewalSettings,omitempty"`
 
207
 
 
208
        // ResourceUiUrl: Ui url for subscription resource.
 
209
        ResourceUiUrl string `json:"resourceUiUrl,omitempty"`
 
210
 
 
211
        // Seats: Number/Limit of seats in the new plan.
 
212
        Seats *Seats `json:"seats,omitempty"`
 
213
 
 
214
        // SkuId: Name of the sku for which this subscription is purchased.
 
215
        SkuId string `json:"skuId,omitempty"`
 
216
 
 
217
        // Status: Status of the subscription.
 
218
        Status string `json:"status,omitempty"`
 
219
 
 
220
        // SubscriptionId: The id of the subscription.
 
221
        SubscriptionId string `json:"subscriptionId,omitempty"`
 
222
 
 
223
        // TransferInfo: Transfer related information for the subscription.
 
224
        TransferInfo *SubscriptionTransferInfo `json:"transferInfo,omitempty"`
 
225
 
 
226
        // TrialSettings: Trial Settings of the subscription.
 
227
        TrialSettings *SubscriptionTrialSettings `json:"trialSettings,omitempty"`
 
228
}
 
229
 
 
230
type SubscriptionPlan struct {
 
231
        // CommitmentInterval: Interval of the commitment if it is a commitment
 
232
        // plan.
 
233
        CommitmentInterval *SubscriptionPlanCommitmentInterval `json:"commitmentInterval,omitempty"`
 
234
 
 
235
        // IsCommitmentPlan: Whether the plan is a commitment plan or not.
 
236
        IsCommitmentPlan bool `json:"isCommitmentPlan,omitempty"`
 
237
 
 
238
        // PlanName: The plan name of this subscription's plan.
 
239
        PlanName string `json:"planName,omitempty"`
 
240
}
 
241
 
 
242
type SubscriptionPlanCommitmentInterval struct {
 
243
        // EndTime: End time of the commitment interval in milliseconds since
 
244
        // Unix epoch.
 
245
        EndTime int64 `json:"endTime,omitempty,string"`
 
246
 
 
247
        // StartTime: Start time of the commitment interval in milliseconds
 
248
        // since Unix epoch.
 
249
        StartTime int64 `json:"startTime,omitempty,string"`
 
250
}
 
251
 
 
252
type SubscriptionTransferInfo struct {
 
253
        MinimumTransferableSeats int64 `json:"minimumTransferableSeats,omitempty"`
 
254
 
 
255
        // TransferabilityExpirationTime: Time when transfer token or intent to
 
256
        // transfer will expire.
 
257
        TransferabilityExpirationTime int64 `json:"transferabilityExpirationTime,omitempty,string"`
 
258
}
 
259
 
 
260
type SubscriptionTrialSettings struct {
 
261
        // IsInTrial: Whether the subscription is in trial.
 
262
        IsInTrial bool `json:"isInTrial,omitempty"`
 
263
 
 
264
        // TrialEndTime: End time of the trial in milliseconds since Unix epoch.
 
265
        TrialEndTime int64 `json:"trialEndTime,omitempty,string"`
 
266
}
 
267
 
 
268
type Subscriptions struct {
 
269
        // Kind: Identifies the resource as a collection of subscriptions.
 
270
        Kind string `json:"kind,omitempty"`
 
271
 
 
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"`
 
276
 
 
277
        // Subscriptions: The subscriptions in this page of results.
 
278
        Subscriptions []*Subscription `json:"subscriptions,omitempty"`
 
279
}
 
280
 
 
281
// method id "reseller.customers.get":
 
282
 
 
283
type CustomersGetCall struct {
 
284
        s          *Service
 
285
        customerId string
 
286
        opt_       map[string]interface{}
 
287
}
 
288
 
 
289
// Get: Gets a customer resource if one exists and is owned by the
 
290
// reseller.
 
291
func (r *CustomersService) Get(customerId string) *CustomersGetCall {
 
292
        c := &CustomersGetCall{s: r.s, opt_: make(map[string]interface{})}
 
293
        c.customerId = customerId
 
294
        return c
 
295
}
 
296
 
 
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)
 
302
        return c
 
303
}
 
304
 
 
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))
 
311
        }
 
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,
 
317
        })
 
318
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
319
        res, err := c.s.client.Do(req)
 
320
        if err != nil {
 
321
                return nil, err
 
322
        }
 
323
        defer googleapi.CloseBody(res)
 
324
        if err := googleapi.CheckResponse(res); err != nil {
 
325
                return nil, err
 
326
        }
 
327
        var ret *Customer
 
328
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
329
                return nil, err
 
330
        }
 
331
        return ret, nil
 
332
        // {
 
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": [
 
337
        //     "customerId"
 
338
        //   ],
 
339
        //   "parameters": {
 
340
        //     "customerId": {
 
341
        //       "description": "Id of the Customer",
 
342
        //       "location": "path",
 
343
        //       "required": true,
 
344
        //       "type": "string"
 
345
        //     }
 
346
        //   },
 
347
        //   "path": "customers/{customerId}",
 
348
        //   "response": {
 
349
        //     "$ref": "Customer"
 
350
        //   },
 
351
        //   "scopes": [
 
352
        //     "https://www.googleapis.com/auth/apps.order",
 
353
        //     "https://www.googleapis.com/auth/apps.order.readonly"
 
354
        //   ]
 
355
        // }
 
356
 
 
357
}
 
358
 
 
359
// method id "reseller.customers.insert":
 
360
 
 
361
type CustomersInsertCall struct {
 
362
        s        *Service
 
363
        customer *Customer
 
364
        opt_     map[string]interface{}
 
365
}
 
366
 
 
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
 
371
        return c
 
372
}
 
373
 
 
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
 
380
        return c
 
381
}
 
382
 
 
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)
 
388
        return c
 
389
}
 
390
 
 
391
func (c *CustomersInsertCall) Do() (*Customer, error) {
 
392
        var body io.Reader = nil
 
393
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.customer)
 
394
        if err != nil {
 
395
                return nil, err
 
396
        }
 
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))
 
402
        }
 
403
        if v, ok := c.opt_["fields"]; ok {
 
404
                params.Set("fields", fmt.Sprintf("%v", v))
 
405
        }
 
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)
 
413
        if err != nil {
 
414
                return nil, err
 
415
        }
 
416
        defer googleapi.CloseBody(res)
 
417
        if err := googleapi.CheckResponse(res); err != nil {
 
418
                return nil, err
 
419
        }
 
420
        var ret *Customer
 
421
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
422
                return nil, err
 
423
        }
 
424
        return ret, nil
 
425
        // {
 
426
        //   "description": "Creates a customer resource if one does not already exist.",
 
427
        //   "httpMethod": "POST",
 
428
        //   "id": "reseller.customers.insert",
 
429
        //   "parameters": {
 
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",
 
433
        //       "type": "string"
 
434
        //     }
 
435
        //   },
 
436
        //   "path": "customers",
 
437
        //   "request": {
 
438
        //     "$ref": "Customer"
 
439
        //   },
 
440
        //   "response": {
 
441
        //     "$ref": "Customer"
 
442
        //   },
 
443
        //   "scopes": [
 
444
        //     "https://www.googleapis.com/auth/apps.order"
 
445
        //   ]
 
446
        // }
 
447
 
 
448
}
 
449
 
 
450
// method id "reseller.customers.patch":
 
451
 
 
452
type CustomersPatchCall struct {
 
453
        s          *Service
 
454
        customerId string
 
455
        customer   *Customer
 
456
        opt_       map[string]interface{}
 
457
}
 
458
 
 
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
 
465
        return c
 
466
}
 
467
 
 
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)
 
473
        return c
 
474
}
 
475
 
 
476
func (c *CustomersPatchCall) Do() (*Customer, error) {
 
477
        var body io.Reader = nil
 
478
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.customer)
 
479
        if err != nil {
 
480
                return nil, err
 
481
        }
 
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))
 
487
        }
 
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,
 
493
        })
 
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)
 
497
        if err != nil {
 
498
                return nil, err
 
499
        }
 
500
        defer googleapi.CloseBody(res)
 
501
        if err := googleapi.CheckResponse(res); err != nil {
 
502
                return nil, err
 
503
        }
 
504
        var ret *Customer
 
505
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
506
                return nil, err
 
507
        }
 
508
        return ret, nil
 
509
        // {
 
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": [
 
514
        //     "customerId"
 
515
        //   ],
 
516
        //   "parameters": {
 
517
        //     "customerId": {
 
518
        //       "description": "Id of the Customer",
 
519
        //       "location": "path",
 
520
        //       "required": true,
 
521
        //       "type": "string"
 
522
        //     }
 
523
        //   },
 
524
        //   "path": "customers/{customerId}",
 
525
        //   "request": {
 
526
        //     "$ref": "Customer"
 
527
        //   },
 
528
        //   "response": {
 
529
        //     "$ref": "Customer"
 
530
        //   },
 
531
        //   "scopes": [
 
532
        //     "https://www.googleapis.com/auth/apps.order"
 
533
        //   ]
 
534
        // }
 
535
 
 
536
}
 
537
 
 
538
// method id "reseller.customers.update":
 
539
 
 
540
type CustomersUpdateCall struct {
 
541
        s          *Service
 
542
        customerId string
 
543
        customer   *Customer
 
544
        opt_       map[string]interface{}
 
545
}
 
546
 
 
547
// Update: Update a customer resource if one it exists and is owned by
 
548
// the reseller.
 
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
 
553
        return c
 
554
}
 
555
 
 
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)
 
561
        return c
 
562
}
 
563
 
 
564
func (c *CustomersUpdateCall) Do() (*Customer, error) {
 
565
        var body io.Reader = nil
 
566
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.customer)
 
567
        if err != nil {
 
568
                return nil, err
 
569
        }
 
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))
 
575
        }
 
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,
 
581
        })
 
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)
 
585
        if err != nil {
 
586
                return nil, err
 
587
        }
 
588
        defer googleapi.CloseBody(res)
 
589
        if err := googleapi.CheckResponse(res); err != nil {
 
590
                return nil, err
 
591
        }
 
592
        var ret *Customer
 
593
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
594
                return nil, err
 
595
        }
 
596
        return ret, nil
 
597
        // {
 
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": [
 
602
        //     "customerId"
 
603
        //   ],
 
604
        //   "parameters": {
 
605
        //     "customerId": {
 
606
        //       "description": "Id of the Customer",
 
607
        //       "location": "path",
 
608
        //       "required": true,
 
609
        //       "type": "string"
 
610
        //     }
 
611
        //   },
 
612
        //   "path": "customers/{customerId}",
 
613
        //   "request": {
 
614
        //     "$ref": "Customer"
 
615
        //   },
 
616
        //   "response": {
 
617
        //     "$ref": "Customer"
 
618
        //   },
 
619
        //   "scopes": [
 
620
        //     "https://www.googleapis.com/auth/apps.order"
 
621
        //   ]
 
622
        // }
 
623
 
 
624
}
 
625
 
 
626
// method id "reseller.subscriptions.activate":
 
627
 
 
628
type SubscriptionsActivateCall struct {
 
629
        s              *Service
 
630
        customerId     string
 
631
        subscriptionId string
 
632
        opt_           map[string]interface{}
 
633
}
 
634
 
 
635
// Activate: Activates a subscription previously suspended by the
 
636
// reseller
 
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
 
641
        return c
 
642
}
 
643
 
 
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)
 
649
        return c
 
650
}
 
651
 
 
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))
 
658
        }
 
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,
 
665
        })
 
666
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
667
        res, err := c.s.client.Do(req)
 
668
        if err != nil {
 
669
                return nil, err
 
670
        }
 
671
        defer googleapi.CloseBody(res)
 
672
        if err := googleapi.CheckResponse(res); err != nil {
 
673
                return nil, err
 
674
        }
 
675
        var ret *Subscription
 
676
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
677
                return nil, err
 
678
        }
 
679
        return ret, nil
 
680
        // {
 
681
        //   "description": "Activates a subscription previously suspended by the reseller",
 
682
        //   "httpMethod": "POST",
 
683
        //   "id": "reseller.subscriptions.activate",
 
684
        //   "parameterOrder": [
 
685
        //     "customerId",
 
686
        //     "subscriptionId"
 
687
        //   ],
 
688
        //   "parameters": {
 
689
        //     "customerId": {
 
690
        //       "description": "Id of the Customer",
 
691
        //       "location": "path",
 
692
        //       "required": true,
 
693
        //       "type": "string"
 
694
        //     },
 
695
        //     "subscriptionId": {
 
696
        //       "description": "Id of the subscription, which is unique for a customer",
 
697
        //       "location": "path",
 
698
        //       "required": true,
 
699
        //       "type": "string"
 
700
        //     }
 
701
        //   },
 
702
        //   "path": "customers/{customerId}/subscriptions/{subscriptionId}/activate",
 
703
        //   "response": {
 
704
        //     "$ref": "Subscription"
 
705
        //   },
 
706
        //   "scopes": [
 
707
        //     "https://www.googleapis.com/auth/apps.order"
 
708
        //   ]
 
709
        // }
 
710
 
 
711
}
 
712
 
 
713
// method id "reseller.subscriptions.changePlan":
 
714
 
 
715
type SubscriptionsChangePlanCall struct {
 
716
        s                 *Service
 
717
        customerId        string
 
718
        subscriptionId    string
 
719
        changeplanrequest *ChangePlanRequest
 
720
        opt_              map[string]interface{}
 
721
}
 
722
 
 
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
 
729
        return c
 
730
}
 
731
 
 
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)
 
737
        return c
 
738
}
 
739
 
 
740
func (c *SubscriptionsChangePlanCall) Do() (*Subscription, error) {
 
741
        var body io.Reader = nil
 
742
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.changeplanrequest)
 
743
        if err != nil {
 
744
                return nil, err
 
745
        }
 
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))
 
751
        }
 
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,
 
758
        })
 
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)
 
762
        if err != nil {
 
763
                return nil, err
 
764
        }
 
765
        defer googleapi.CloseBody(res)
 
766
        if err := googleapi.CheckResponse(res); err != nil {
 
767
                return nil, err
 
768
        }
 
769
        var ret *Subscription
 
770
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
771
                return nil, err
 
772
        }
 
773
        return ret, nil
 
774
        // {
 
775
        //   "description": "Changes the plan of a subscription",
 
776
        //   "httpMethod": "POST",
 
777
        //   "id": "reseller.subscriptions.changePlan",
 
778
        //   "parameterOrder": [
 
779
        //     "customerId",
 
780
        //     "subscriptionId"
 
781
        //   ],
 
782
        //   "parameters": {
 
783
        //     "customerId": {
 
784
        //       "description": "Id of the Customer",
 
785
        //       "location": "path",
 
786
        //       "required": true,
 
787
        //       "type": "string"
 
788
        //     },
 
789
        //     "subscriptionId": {
 
790
        //       "description": "Id of the subscription, which is unique for a customer",
 
791
        //       "location": "path",
 
792
        //       "required": true,
 
793
        //       "type": "string"
 
794
        //     }
 
795
        //   },
 
796
        //   "path": "customers/{customerId}/subscriptions/{subscriptionId}/changePlan",
 
797
        //   "request": {
 
798
        //     "$ref": "ChangePlanRequest"
 
799
        //   },
 
800
        //   "response": {
 
801
        //     "$ref": "Subscription"
 
802
        //   },
 
803
        //   "scopes": [
 
804
        //     "https://www.googleapis.com/auth/apps.order"
 
805
        //   ]
 
806
        // }
 
807
 
 
808
}
 
809
 
 
810
// method id "reseller.subscriptions.changeRenewalSettings":
 
811
 
 
812
type SubscriptionsChangeRenewalSettingsCall struct {
 
813
        s               *Service
 
814
        customerId      string
 
815
        subscriptionId  string
 
816
        renewalsettings *RenewalSettings
 
817
        opt_            map[string]interface{}
 
818
}
 
819
 
 
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
 
826
        return c
 
827
}
 
828
 
 
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)
 
834
        return c
 
835
}
 
836
 
 
837
func (c *SubscriptionsChangeRenewalSettingsCall) Do() (*Subscription, error) {
 
838
        var body io.Reader = nil
 
839
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.renewalsettings)
 
840
        if err != nil {
 
841
                return nil, err
 
842
        }
 
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))
 
848
        }
 
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,
 
855
        })
 
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)
 
859
        if err != nil {
 
860
                return nil, err
 
861
        }
 
862
        defer googleapi.CloseBody(res)
 
863
        if err := googleapi.CheckResponse(res); err != nil {
 
864
                return nil, err
 
865
        }
 
866
        var ret *Subscription
 
867
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
868
                return nil, err
 
869
        }
 
870
        return ret, nil
 
871
        // {
 
872
        //   "description": "Changes the renewal settings of a subscription",
 
873
        //   "httpMethod": "POST",
 
874
        //   "id": "reseller.subscriptions.changeRenewalSettings",
 
875
        //   "parameterOrder": [
 
876
        //     "customerId",
 
877
        //     "subscriptionId"
 
878
        //   ],
 
879
        //   "parameters": {
 
880
        //     "customerId": {
 
881
        //       "description": "Id of the Customer",
 
882
        //       "location": "path",
 
883
        //       "required": true,
 
884
        //       "type": "string"
 
885
        //     },
 
886
        //     "subscriptionId": {
 
887
        //       "description": "Id of the subscription, which is unique for a customer",
 
888
        //       "location": "path",
 
889
        //       "required": true,
 
890
        //       "type": "string"
 
891
        //     }
 
892
        //   },
 
893
        //   "path": "customers/{customerId}/subscriptions/{subscriptionId}/changeRenewalSettings",
 
894
        //   "request": {
 
895
        //     "$ref": "RenewalSettings"
 
896
        //   },
 
897
        //   "response": {
 
898
        //     "$ref": "Subscription"
 
899
        //   },
 
900
        //   "scopes": [
 
901
        //     "https://www.googleapis.com/auth/apps.order"
 
902
        //   ]
 
903
        // }
 
904
 
 
905
}
 
906
 
 
907
// method id "reseller.subscriptions.changeSeats":
 
908
 
 
909
type SubscriptionsChangeSeatsCall struct {
 
910
        s              *Service
 
911
        customerId     string
 
912
        subscriptionId string
 
913
        seats          *Seats
 
914
        opt_           map[string]interface{}
 
915
}
 
916
 
 
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
 
922
        c.seats = seats
 
923
        return c
 
924
}
 
925
 
 
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)
 
931
        return c
 
932
}
 
933
 
 
934
func (c *SubscriptionsChangeSeatsCall) Do() (*Subscription, error) {
 
935
        var body io.Reader = nil
 
936
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.seats)
 
937
        if err != nil {
 
938
                return nil, err
 
939
        }
 
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))
 
945
        }
 
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,
 
952
        })
 
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)
 
956
        if err != nil {
 
957
                return nil, err
 
958
        }
 
959
        defer googleapi.CloseBody(res)
 
960
        if err := googleapi.CheckResponse(res); err != nil {
 
961
                return nil, err
 
962
        }
 
963
        var ret *Subscription
 
964
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
965
                return nil, err
 
966
        }
 
967
        return ret, nil
 
968
        // {
 
969
        //   "description": "Changes the seats configuration of a subscription",
 
970
        //   "httpMethod": "POST",
 
971
        //   "id": "reseller.subscriptions.changeSeats",
 
972
        //   "parameterOrder": [
 
973
        //     "customerId",
 
974
        //     "subscriptionId"
 
975
        //   ],
 
976
        //   "parameters": {
 
977
        //     "customerId": {
 
978
        //       "description": "Id of the Customer",
 
979
        //       "location": "path",
 
980
        //       "required": true,
 
981
        //       "type": "string"
 
982
        //     },
 
983
        //     "subscriptionId": {
 
984
        //       "description": "Id of the subscription, which is unique for a customer",
 
985
        //       "location": "path",
 
986
        //       "required": true,
 
987
        //       "type": "string"
 
988
        //     }
 
989
        //   },
 
990
        //   "path": "customers/{customerId}/subscriptions/{subscriptionId}/changeSeats",
 
991
        //   "request": {
 
992
        //     "$ref": "Seats"
 
993
        //   },
 
994
        //   "response": {
 
995
        //     "$ref": "Subscription"
 
996
        //   },
 
997
        //   "scopes": [
 
998
        //     "https://www.googleapis.com/auth/apps.order"
 
999
        //   ]
 
1000
        // }
 
1001
 
 
1002
}
 
1003
 
 
1004
// method id "reseller.subscriptions.delete":
 
1005
 
 
1006
type SubscriptionsDeleteCall struct {
 
1007
        s              *Service
 
1008
        customerId     string
 
1009
        subscriptionId string
 
1010
        deletionType   string
 
1011
        opt_           map[string]interface{}
 
1012
}
 
1013
 
 
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
 
1020
        return c
 
1021
}
 
1022
 
 
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)
 
1028
        return c
 
1029
}
 
1030
 
 
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))
 
1038
        }
 
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,
 
1045
        })
 
1046
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
1047
        res, err := c.s.client.Do(req)
 
1048
        if err != nil {
 
1049
                return err
 
1050
        }
 
1051
        defer googleapi.CloseBody(res)
 
1052
        if err := googleapi.CheckResponse(res); err != nil {
 
1053
                return err
 
1054
        }
 
1055
        return nil
 
1056
        // {
 
1057
        //   "description": "Cancels/Downgrades a subscription.",
 
1058
        //   "httpMethod": "DELETE",
 
1059
        //   "id": "reseller.subscriptions.delete",
 
1060
        //   "parameterOrder": [
 
1061
        //     "customerId",
 
1062
        //     "subscriptionId",
 
1063
        //     "deletionType"
 
1064
        //   ],
 
1065
        //   "parameters": {
 
1066
        //     "customerId": {
 
1067
        //       "description": "Id of the Customer",
 
1068
        //       "location": "path",
 
1069
        //       "required": true,
 
1070
        //       "type": "string"
 
1071
        //     },
 
1072
        //     "deletionType": {
 
1073
        //       "description": "Whether the subscription is to be fully cancelled or downgraded",
 
1074
        //       "enum": [
 
1075
        //         "cancel",
 
1076
        //         "downgrade",
 
1077
        //         "suspend"
 
1078
        //       ],
 
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"
 
1083
        //       ],
 
1084
        //       "location": "query",
 
1085
        //       "required": true,
 
1086
        //       "type": "string"
 
1087
        //     },
 
1088
        //     "subscriptionId": {
 
1089
        //       "description": "Id of the subscription, which is unique for a customer",
 
1090
        //       "location": "path",
 
1091
        //       "required": true,
 
1092
        //       "type": "string"
 
1093
        //     }
 
1094
        //   },
 
1095
        //   "path": "customers/{customerId}/subscriptions/{subscriptionId}",
 
1096
        //   "scopes": [
 
1097
        //     "https://www.googleapis.com/auth/apps.order"
 
1098
        //   ]
 
1099
        // }
 
1100
 
 
1101
}
 
1102
 
 
1103
// method id "reseller.subscriptions.get":
 
1104
 
 
1105
type SubscriptionsGetCall struct {
 
1106
        s              *Service
 
1107
        customerId     string
 
1108
        subscriptionId string
 
1109
        opt_           map[string]interface{}
 
1110
}
 
1111
 
 
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
 
1117
        return c
 
1118
}
 
1119
 
 
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)
 
1125
        return c
 
1126
}
 
1127
 
 
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))
 
1134
        }
 
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,
 
1141
        })
 
1142
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
1143
        res, err := c.s.client.Do(req)
 
1144
        if err != nil {
 
1145
                return nil, err
 
1146
        }
 
1147
        defer googleapi.CloseBody(res)
 
1148
        if err := googleapi.CheckResponse(res); err != nil {
 
1149
                return nil, err
 
1150
        }
 
1151
        var ret *Subscription
 
1152
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
1153
                return nil, err
 
1154
        }
 
1155
        return ret, nil
 
1156
        // {
 
1157
        //   "description": "Gets a subscription of the customer.",
 
1158
        //   "httpMethod": "GET",
 
1159
        //   "id": "reseller.subscriptions.get",
 
1160
        //   "parameterOrder": [
 
1161
        //     "customerId",
 
1162
        //     "subscriptionId"
 
1163
        //   ],
 
1164
        //   "parameters": {
 
1165
        //     "customerId": {
 
1166
        //       "description": "Id of the Customer",
 
1167
        //       "location": "path",
 
1168
        //       "required": true,
 
1169
        //       "type": "string"
 
1170
        //     },
 
1171
        //     "subscriptionId": {
 
1172
        //       "description": "Id of the subscription, which is unique for a customer",
 
1173
        //       "location": "path",
 
1174
        //       "required": true,
 
1175
        //       "type": "string"
 
1176
        //     }
 
1177
        //   },
 
1178
        //   "path": "customers/{customerId}/subscriptions/{subscriptionId}",
 
1179
        //   "response": {
 
1180
        //     "$ref": "Subscription"
 
1181
        //   },
 
1182
        //   "scopes": [
 
1183
        //     "https://www.googleapis.com/auth/apps.order",
 
1184
        //     "https://www.googleapis.com/auth/apps.order.readonly"
 
1185
        //   ]
 
1186
        // }
 
1187
 
 
1188
}
 
1189
 
 
1190
// method id "reseller.subscriptions.insert":
 
1191
 
 
1192
type SubscriptionsInsertCall struct {
 
1193
        s            *Service
 
1194
        customerId   string
 
1195
        subscription *Subscription
 
1196
        opt_         map[string]interface{}
 
1197
}
 
1198
 
 
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
 
1204
        return c
 
1205
}
 
1206
 
 
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
 
1212
        return c
 
1213
}
 
1214
 
 
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)
 
1220
        return c
 
1221
}
 
1222
 
 
1223
func (c *SubscriptionsInsertCall) Do() (*Subscription, error) {
 
1224
        var body io.Reader = nil
 
1225
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.subscription)
 
1226
        if err != nil {
 
1227
                return nil, err
 
1228
        }
 
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))
 
1234
        }
 
1235
        if v, ok := c.opt_["fields"]; ok {
 
1236
                params.Set("fields", fmt.Sprintf("%v", v))
 
1237
        }
 
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,
 
1243
        })
 
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)
 
1247
        if err != nil {
 
1248
                return nil, err
 
1249
        }
 
1250
        defer googleapi.CloseBody(res)
 
1251
        if err := googleapi.CheckResponse(res); err != nil {
 
1252
                return nil, err
 
1253
        }
 
1254
        var ret *Subscription
 
1255
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
1256
                return nil, err
 
1257
        }
 
1258
        return ret, nil
 
1259
        // {
 
1260
        //   "description": "Creates/Transfers a subscription for the customer.",
 
1261
        //   "httpMethod": "POST",
 
1262
        //   "id": "reseller.subscriptions.insert",
 
1263
        //   "parameterOrder": [
 
1264
        //     "customerId"
 
1265
        //   ],
 
1266
        //   "parameters": {
 
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",
 
1270
        //       "type": "string"
 
1271
        //     },
 
1272
        //     "customerId": {
 
1273
        //       "description": "Id of the Customer",
 
1274
        //       "location": "path",
 
1275
        //       "required": true,
 
1276
        //       "type": "string"
 
1277
        //     }
 
1278
        //   },
 
1279
        //   "path": "customers/{customerId}/subscriptions",
 
1280
        //   "request": {
 
1281
        //     "$ref": "Subscription"
 
1282
        //   },
 
1283
        //   "response": {
 
1284
        //     "$ref": "Subscription"
 
1285
        //   },
 
1286
        //   "scopes": [
 
1287
        //     "https://www.googleapis.com/auth/apps.order"
 
1288
        //   ]
 
1289
        // }
 
1290
 
 
1291
}
 
1292
 
 
1293
// method id "reseller.subscriptions.list":
 
1294
 
 
1295
type SubscriptionsListCall struct {
 
1296
        s    *Service
 
1297
        opt_ map[string]interface{}
 
1298
}
 
1299
 
 
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{})}
 
1304
        return c
 
1305
}
 
1306
 
 
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
 
1313
        return c
 
1314
}
 
1315
 
 
1316
// CustomerId sets the optional parameter "customerId": Id of the
 
1317
// Customer
 
1318
func (c *SubscriptionsListCall) CustomerId(customerId string) *SubscriptionsListCall {
 
1319
        c.opt_["customerId"] = customerId
 
1320
        return c
 
1321
}
 
1322
 
 
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
 
1328
        return c
 
1329
}
 
1330
 
 
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
 
1335
        return c
 
1336
}
 
1337
 
 
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
 
1342
        return c
 
1343
}
 
1344
 
 
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)
 
1350
        return c
 
1351
}
 
1352
 
 
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))
 
1359
        }
 
1360
        if v, ok := c.opt_["customerId"]; ok {
 
1361
                params.Set("customerId", fmt.Sprintf("%v", v))
 
1362
        }
 
1363
        if v, ok := c.opt_["customerNamePrefix"]; ok {
 
1364
                params.Set("customerNamePrefix", fmt.Sprintf("%v", v))
 
1365
        }
 
1366
        if v, ok := c.opt_["maxResults"]; ok {
 
1367
                params.Set("maxResults", fmt.Sprintf("%v", v))
 
1368
        }
 
1369
        if v, ok := c.opt_["pageToken"]; ok {
 
1370
                params.Set("pageToken", fmt.Sprintf("%v", v))
 
1371
        }
 
1372
        if v, ok := c.opt_["fields"]; ok {
 
1373
                params.Set("fields", fmt.Sprintf("%v", v))
 
1374
        }
 
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)
 
1381
        if err != nil {
 
1382
                return nil, err
 
1383
        }
 
1384
        defer googleapi.CloseBody(res)
 
1385
        if err := googleapi.CheckResponse(res); err != nil {
 
1386
                return nil, err
 
1387
        }
 
1388
        var ret *Subscriptions
 
1389
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
1390
                return nil, err
 
1391
        }
 
1392
        return ret, nil
 
1393
        // {
 
1394
        //   "description": "Lists subscriptions of a reseller, optionally filtered by a customer name prefix.",
 
1395
        //   "httpMethod": "GET",
 
1396
        //   "id": "reseller.subscriptions.list",
 
1397
        //   "parameters": {
 
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",
 
1401
        //       "type": "string"
 
1402
        //     },
 
1403
        //     "customerId": {
 
1404
        //       "description": "Id of the Customer",
 
1405
        //       "location": "query",
 
1406
        //       "type": "string"
 
1407
        //     },
 
1408
        //     "customerNamePrefix": {
 
1409
        //       "description": "Prefix of the customer's domain name by which the subscriptions should be filtered. Optional",
 
1410
        //       "location": "query",
 
1411
        //       "type": "string"
 
1412
        //     },
 
1413
        //     "maxResults": {
 
1414
        //       "description": "Maximum number of results to return",
 
1415
        //       "format": "uint32",
 
1416
        //       "location": "query",
 
1417
        //       "maximum": "100",
 
1418
        //       "minimum": "1",
 
1419
        //       "type": "integer"
 
1420
        //     },
 
1421
        //     "pageToken": {
 
1422
        //       "description": "Token to specify next page in the list",
 
1423
        //       "location": "query",
 
1424
        //       "type": "string"
 
1425
        //     }
 
1426
        //   },
 
1427
        //   "path": "subscriptions",
 
1428
        //   "response": {
 
1429
        //     "$ref": "Subscriptions"
 
1430
        //   },
 
1431
        //   "scopes": [
 
1432
        //     "https://www.googleapis.com/auth/apps.order",
 
1433
        //     "https://www.googleapis.com/auth/apps.order.readonly"
 
1434
        //   ]
 
1435
        // }
 
1436
 
 
1437
}
 
1438
 
 
1439
// method id "reseller.subscriptions.startPaidService":
 
1440
 
 
1441
type SubscriptionsStartPaidServiceCall struct {
 
1442
        s              *Service
 
1443
        customerId     string
 
1444
        subscriptionId string
 
1445
        opt_           map[string]interface{}
 
1446
}
 
1447
 
 
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
 
1453
        return c
 
1454
}
 
1455
 
 
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)
 
1461
        return c
 
1462
}
 
1463
 
 
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))
 
1470
        }
 
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,
 
1477
        })
 
1478
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
1479
        res, err := c.s.client.Do(req)
 
1480
        if err != nil {
 
1481
                return nil, err
 
1482
        }
 
1483
        defer googleapi.CloseBody(res)
 
1484
        if err := googleapi.CheckResponse(res); err != nil {
 
1485
                return nil, err
 
1486
        }
 
1487
        var ret *Subscription
 
1488
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
1489
                return nil, err
 
1490
        }
 
1491
        return ret, nil
 
1492
        // {
 
1493
        //   "description": "Starts paid service of a trial subscription",
 
1494
        //   "httpMethod": "POST",
 
1495
        //   "id": "reseller.subscriptions.startPaidService",
 
1496
        //   "parameterOrder": [
 
1497
        //     "customerId",
 
1498
        //     "subscriptionId"
 
1499
        //   ],
 
1500
        //   "parameters": {
 
1501
        //     "customerId": {
 
1502
        //       "description": "Id of the Customer",
 
1503
        //       "location": "path",
 
1504
        //       "required": true,
 
1505
        //       "type": "string"
 
1506
        //     },
 
1507
        //     "subscriptionId": {
 
1508
        //       "description": "Id of the subscription, which is unique for a customer",
 
1509
        //       "location": "path",
 
1510
        //       "required": true,
 
1511
        //       "type": "string"
 
1512
        //     }
 
1513
        //   },
 
1514
        //   "path": "customers/{customerId}/subscriptions/{subscriptionId}/startPaidService",
 
1515
        //   "response": {
 
1516
        //     "$ref": "Subscription"
 
1517
        //   },
 
1518
        //   "scopes": [
 
1519
        //     "https://www.googleapis.com/auth/apps.order"
 
1520
        //   ]
 
1521
        // }
 
1522
 
 
1523
}
 
1524
 
 
1525
// method id "reseller.subscriptions.suspend":
 
1526
 
 
1527
type SubscriptionsSuspendCall struct {
 
1528
        s              *Service
 
1529
        customerId     string
 
1530
        subscriptionId string
 
1531
        opt_           map[string]interface{}
 
1532
}
 
1533
 
 
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
 
1539
        return c
 
1540
}
 
1541
 
 
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)
 
1547
        return c
 
1548
}
 
1549
 
 
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))
 
1556
        }
 
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,
 
1563
        })
 
1564
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
1565
        res, err := c.s.client.Do(req)
 
1566
        if err != nil {
 
1567
                return nil, err
 
1568
        }
 
1569
        defer googleapi.CloseBody(res)
 
1570
        if err := googleapi.CheckResponse(res); err != nil {
 
1571
                return nil, err
 
1572
        }
 
1573
        var ret *Subscription
 
1574
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
1575
                return nil, err
 
1576
        }
 
1577
        return ret, nil
 
1578
        // {
 
1579
        //   "description": "Suspends an active subscription",
 
1580
        //   "httpMethod": "POST",
 
1581
        //   "id": "reseller.subscriptions.suspend",
 
1582
        //   "parameterOrder": [
 
1583
        //     "customerId",
 
1584
        //     "subscriptionId"
 
1585
        //   ],
 
1586
        //   "parameters": {
 
1587
        //     "customerId": {
 
1588
        //       "description": "Id of the Customer",
 
1589
        //       "location": "path",
 
1590
        //       "required": true,
 
1591
        //       "type": "string"
 
1592
        //     },
 
1593
        //     "subscriptionId": {
 
1594
        //       "description": "Id of the subscription, which is unique for a customer",
 
1595
        //       "location": "path",
 
1596
        //       "required": true,
 
1597
        //       "type": "string"
 
1598
        //     }
 
1599
        //   },
 
1600
        //   "path": "customers/{customerId}/subscriptions/{subscriptionId}/suspend",
 
1601
        //   "response": {
 
1602
        //     "$ref": "Subscription"
 
1603
        //   },
 
1604
        //   "scopes": [
 
1605
        //     "https://www.googleapis.com/auth/apps.order"
 
1606
        //   ]
 
1607
        // }
 
1608
 
 
1609
}