~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/google.golang.org/api/androidpublisher/v1.1/androidpublisher-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 androidpublisher provides access to the Google Play Android Developer API.
 
2
//
 
3
// See https://developers.google.com/android-publisher
 
4
//
 
5
// Usage example:
 
6
//
 
7
//   import "google.golang.org/api/androidpublisher/v1.1"
 
8
//   ...
 
9
//   androidpublisherService, err := androidpublisher.New(oauthHttpClient)
 
10
package androidpublisher
 
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 = "androidpublisher:v1.1"
 
38
const apiName = "androidpublisher"
 
39
const apiVersion = "v1.1"
 
40
const basePath = "https://www.googleapis.com/androidpublisher/v1.1/applications/"
 
41
 
 
42
// OAuth2 scopes used by this API.
 
43
const (
 
44
        // View and manage your Google Play Android Developer account
 
45
        AndroidpublisherScope = "https://www.googleapis.com/auth/androidpublisher"
 
46
)
 
47
 
 
48
func New(client *http.Client) (*Service, error) {
 
49
        if client == nil {
 
50
                return nil, errors.New("client is nil")
 
51
        }
 
52
        s := &Service{client: client, BasePath: basePath}
 
53
        s.Inapppurchases = NewInapppurchasesService(s)
 
54
        s.Purchases = NewPurchasesService(s)
 
55
        return s, nil
 
56
}
 
57
 
 
58
type Service struct {
 
59
        client   *http.Client
 
60
        BasePath string // API endpoint base URL
 
61
 
 
62
        Inapppurchases *InapppurchasesService
 
63
 
 
64
        Purchases *PurchasesService
 
65
}
 
66
 
 
67
func NewInapppurchasesService(s *Service) *InapppurchasesService {
 
68
        rs := &InapppurchasesService{s: s}
 
69
        return rs
 
70
}
 
71
 
 
72
type InapppurchasesService struct {
 
73
        s *Service
 
74
}
 
75
 
 
76
func NewPurchasesService(s *Service) *PurchasesService {
 
77
        rs := &PurchasesService{s: s}
 
78
        return rs
 
79
}
 
80
 
 
81
type PurchasesService struct {
 
82
        s *Service
 
83
}
 
84
 
 
85
type InappPurchase struct {
 
86
        // ConsumptionState: The consumption state of the inapp product.
 
87
        // Possible values are:
 
88
        // - Yet to be consumed
 
89
        // - Consumed
 
90
        ConsumptionState int64 `json:"consumptionState,omitempty"`
 
91
 
 
92
        // DeveloperPayload: A developer-specified string that contains
 
93
        // supplemental information about an order.
 
94
        DeveloperPayload string `json:"developerPayload,omitempty"`
 
95
 
 
96
        // Kind: This kind represents an inappPurchase object in the
 
97
        // androidpublisher service.
 
98
        Kind string `json:"kind,omitempty"`
 
99
 
 
100
        // PurchaseState: The purchase state of the order. Possible values are:
 
101
        //
 
102
        // - Purchased
 
103
        // - Cancelled
 
104
        PurchaseState int64 `json:"purchaseState,omitempty"`
 
105
 
 
106
        // PurchaseTime: The time the product was purchased, in milliseconds
 
107
        // since the epoch (Jan 1, 1970).
 
108
        PurchaseTime int64 `json:"purchaseTime,omitempty,string"`
 
109
}
 
110
 
 
111
type SubscriptionPurchase struct {
 
112
        // AutoRenewing: Whether the subscription will automatically be renewed
 
113
        // when it reaches its current expiry time.
 
114
        AutoRenewing bool `json:"autoRenewing,omitempty"`
 
115
 
 
116
        // InitiationTimestampMsec: Time at which the subscription was granted,
 
117
        // in milliseconds since Epoch.
 
118
        InitiationTimestampMsec int64 `json:"initiationTimestampMsec,omitempty,string"`
 
119
 
 
120
        // Kind: This kind represents a subscriptionPurchase object in the
 
121
        // androidpublisher service.
 
122
        Kind string `json:"kind,omitempty"`
 
123
 
 
124
        // ValidUntilTimestampMsec: Time at which the subscription will expire,
 
125
        // in milliseconds since Epoch.
 
126
        ValidUntilTimestampMsec int64 `json:"validUntilTimestampMsec,omitempty,string"`
 
127
}
 
128
 
 
129
// method id "androidpublisher.inapppurchases.get":
 
130
 
 
131
type InapppurchasesGetCall struct {
 
132
        s           *Service
 
133
        packageName string
 
134
        productId   string
 
135
        token       string
 
136
        opt_        map[string]interface{}
 
137
}
 
138
 
 
139
// Get: Checks the purchase and consumption status of an inapp item.
 
140
func (r *InapppurchasesService) Get(packageName string, productId string, token string) *InapppurchasesGetCall {
 
141
        c := &InapppurchasesGetCall{s: r.s, opt_: make(map[string]interface{})}
 
142
        c.packageName = packageName
 
143
        c.productId = productId
 
144
        c.token = token
 
145
        return c
 
146
}
 
147
 
 
148
// Fields allows partial responses to be retrieved.
 
149
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
150
// for more information.
 
151
func (c *InapppurchasesGetCall) Fields(s ...googleapi.Field) *InapppurchasesGetCall {
 
152
        c.opt_["fields"] = googleapi.CombineFields(s)
 
153
        return c
 
154
}
 
155
 
 
156
func (c *InapppurchasesGetCall) Do() (*InappPurchase, error) {
 
157
        var body io.Reader = nil
 
158
        params := make(url.Values)
 
159
        params.Set("alt", "json")
 
160
        if v, ok := c.opt_["fields"]; ok {
 
161
                params.Set("fields", fmt.Sprintf("%v", v))
 
162
        }
 
163
        urls := googleapi.ResolveRelative(c.s.BasePath, "{packageName}/inapp/{productId}/purchases/{token}")
 
164
        urls += "?" + params.Encode()
 
165
        req, _ := http.NewRequest("GET", urls, body)
 
166
        googleapi.Expand(req.URL, map[string]string{
 
167
                "packageName": c.packageName,
 
168
                "productId":   c.productId,
 
169
                "token":       c.token,
 
170
        })
 
171
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
172
        res, err := c.s.client.Do(req)
 
173
        if err != nil {
 
174
                return nil, err
 
175
        }
 
176
        defer googleapi.CloseBody(res)
 
177
        if err := googleapi.CheckResponse(res); err != nil {
 
178
                return nil, err
 
179
        }
 
180
        var ret *InappPurchase
 
181
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
182
                return nil, err
 
183
        }
 
184
        return ret, nil
 
185
        // {
 
186
        //   "description": "Checks the purchase and consumption status of an inapp item.",
 
187
        //   "httpMethod": "GET",
 
188
        //   "id": "androidpublisher.inapppurchases.get",
 
189
        //   "parameterOrder": [
 
190
        //     "packageName",
 
191
        //     "productId",
 
192
        //     "token"
 
193
        //   ],
 
194
        //   "parameters": {
 
195
        //     "packageName": {
 
196
        //       "description": "The package name of the application the inapp product was sold in (for example, 'com.some.thing').",
 
197
        //       "location": "path",
 
198
        //       "required": true,
 
199
        //       "type": "string"
 
200
        //     },
 
201
        //     "productId": {
 
202
        //       "description": "The inapp product SKU (for example, 'com.some.thing.inapp1').",
 
203
        //       "location": "path",
 
204
        //       "required": true,
 
205
        //       "type": "string"
 
206
        //     },
 
207
        //     "token": {
 
208
        //       "description": "The token provided to the user's device when the inapp product was purchased.",
 
209
        //       "location": "path",
 
210
        //       "required": true,
 
211
        //       "type": "string"
 
212
        //     }
 
213
        //   },
 
214
        //   "path": "{packageName}/inapp/{productId}/purchases/{token}",
 
215
        //   "response": {
 
216
        //     "$ref": "InappPurchase"
 
217
        //   },
 
218
        //   "scopes": [
 
219
        //     "https://www.googleapis.com/auth/androidpublisher"
 
220
        //   ]
 
221
        // }
 
222
 
 
223
}
 
224
 
 
225
// method id "androidpublisher.purchases.cancel":
 
226
 
 
227
type PurchasesCancelCall struct {
 
228
        s              *Service
 
229
        packageName    string
 
230
        subscriptionId string
 
231
        token          string
 
232
        opt_           map[string]interface{}
 
233
}
 
234
 
 
235
// Cancel: Cancels a user's subscription purchase. The subscription
 
236
// remains valid until its expiration time.
 
237
func (r *PurchasesService) Cancel(packageName string, subscriptionId string, token string) *PurchasesCancelCall {
 
238
        c := &PurchasesCancelCall{s: r.s, opt_: make(map[string]interface{})}
 
239
        c.packageName = packageName
 
240
        c.subscriptionId = subscriptionId
 
241
        c.token = token
 
242
        return c
 
243
}
 
244
 
 
245
// Fields allows partial responses to be retrieved.
 
246
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
247
// for more information.
 
248
func (c *PurchasesCancelCall) Fields(s ...googleapi.Field) *PurchasesCancelCall {
 
249
        c.opt_["fields"] = googleapi.CombineFields(s)
 
250
        return c
 
251
}
 
252
 
 
253
func (c *PurchasesCancelCall) Do() error {
 
254
        var body io.Reader = nil
 
255
        params := make(url.Values)
 
256
        params.Set("alt", "json")
 
257
        if v, ok := c.opt_["fields"]; ok {
 
258
                params.Set("fields", fmt.Sprintf("%v", v))
 
259
        }
 
260
        urls := googleapi.ResolveRelative(c.s.BasePath, "{packageName}/subscriptions/{subscriptionId}/purchases/{token}/cancel")
 
261
        urls += "?" + params.Encode()
 
262
        req, _ := http.NewRequest("POST", urls, body)
 
263
        googleapi.Expand(req.URL, map[string]string{
 
264
                "packageName":    c.packageName,
 
265
                "subscriptionId": c.subscriptionId,
 
266
                "token":          c.token,
 
267
        })
 
268
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
269
        res, err := c.s.client.Do(req)
 
270
        if err != nil {
 
271
                return err
 
272
        }
 
273
        defer googleapi.CloseBody(res)
 
274
        if err := googleapi.CheckResponse(res); err != nil {
 
275
                return err
 
276
        }
 
277
        return nil
 
278
        // {
 
279
        //   "description": "Cancels a user's subscription purchase. The subscription remains valid until its expiration time.",
 
280
        //   "httpMethod": "POST",
 
281
        //   "id": "androidpublisher.purchases.cancel",
 
282
        //   "parameterOrder": [
 
283
        //     "packageName",
 
284
        //     "subscriptionId",
 
285
        //     "token"
 
286
        //   ],
 
287
        //   "parameters": {
 
288
        //     "packageName": {
 
289
        //       "description": "The package name of the application for which this subscription was purchased (for example, 'com.some.thing').",
 
290
        //       "location": "path",
 
291
        //       "required": true,
 
292
        //       "type": "string"
 
293
        //     },
 
294
        //     "subscriptionId": {
 
295
        //       "description": "The purchased subscription ID (for example, 'monthly001').",
 
296
        //       "location": "path",
 
297
        //       "required": true,
 
298
        //       "type": "string"
 
299
        //     },
 
300
        //     "token": {
 
301
        //       "description": "The token provided to the user's device when the subscription was purchased.",
 
302
        //       "location": "path",
 
303
        //       "required": true,
 
304
        //       "type": "string"
 
305
        //     }
 
306
        //   },
 
307
        //   "path": "{packageName}/subscriptions/{subscriptionId}/purchases/{token}/cancel",
 
308
        //   "scopes": [
 
309
        //     "https://www.googleapis.com/auth/androidpublisher"
 
310
        //   ]
 
311
        // }
 
312
 
 
313
}
 
314
 
 
315
// method id "androidpublisher.purchases.get":
 
316
 
 
317
type PurchasesGetCall struct {
 
318
        s              *Service
 
319
        packageName    string
 
320
        subscriptionId string
 
321
        token          string
 
322
        opt_           map[string]interface{}
 
323
}
 
324
 
 
325
// Get: Checks whether a user's subscription purchase is valid and
 
326
// returns its expiry time.
 
327
func (r *PurchasesService) Get(packageName string, subscriptionId string, token string) *PurchasesGetCall {
 
328
        c := &PurchasesGetCall{s: r.s, opt_: make(map[string]interface{})}
 
329
        c.packageName = packageName
 
330
        c.subscriptionId = subscriptionId
 
331
        c.token = token
 
332
        return c
 
333
}
 
334
 
 
335
// Fields allows partial responses to be retrieved.
 
336
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
337
// for more information.
 
338
func (c *PurchasesGetCall) Fields(s ...googleapi.Field) *PurchasesGetCall {
 
339
        c.opt_["fields"] = googleapi.CombineFields(s)
 
340
        return c
 
341
}
 
342
 
 
343
func (c *PurchasesGetCall) Do() (*SubscriptionPurchase, error) {
 
344
        var body io.Reader = nil
 
345
        params := make(url.Values)
 
346
        params.Set("alt", "json")
 
347
        if v, ok := c.opt_["fields"]; ok {
 
348
                params.Set("fields", fmt.Sprintf("%v", v))
 
349
        }
 
350
        urls := googleapi.ResolveRelative(c.s.BasePath, "{packageName}/subscriptions/{subscriptionId}/purchases/{token}")
 
351
        urls += "?" + params.Encode()
 
352
        req, _ := http.NewRequest("GET", urls, body)
 
353
        googleapi.Expand(req.URL, map[string]string{
 
354
                "packageName":    c.packageName,
 
355
                "subscriptionId": c.subscriptionId,
 
356
                "token":          c.token,
 
357
        })
 
358
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
359
        res, err := c.s.client.Do(req)
 
360
        if err != nil {
 
361
                return nil, err
 
362
        }
 
363
        defer googleapi.CloseBody(res)
 
364
        if err := googleapi.CheckResponse(res); err != nil {
 
365
                return nil, err
 
366
        }
 
367
        var ret *SubscriptionPurchase
 
368
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
369
                return nil, err
 
370
        }
 
371
        return ret, nil
 
372
        // {
 
373
        //   "description": "Checks whether a user's subscription purchase is valid and returns its expiry time.",
 
374
        //   "httpMethod": "GET",
 
375
        //   "id": "androidpublisher.purchases.get",
 
376
        //   "parameterOrder": [
 
377
        //     "packageName",
 
378
        //     "subscriptionId",
 
379
        //     "token"
 
380
        //   ],
 
381
        //   "parameters": {
 
382
        //     "packageName": {
 
383
        //       "description": "The package name of the application for which this subscription was purchased (for example, 'com.some.thing').",
 
384
        //       "location": "path",
 
385
        //       "required": true,
 
386
        //       "type": "string"
 
387
        //     },
 
388
        //     "subscriptionId": {
 
389
        //       "description": "The purchased subscription ID (for example, 'monthly001').",
 
390
        //       "location": "path",
 
391
        //       "required": true,
 
392
        //       "type": "string"
 
393
        //     },
 
394
        //     "token": {
 
395
        //       "description": "The token provided to the user's device when the subscription was purchased.",
 
396
        //       "location": "path",
 
397
        //       "required": true,
 
398
        //       "type": "string"
 
399
        //     }
 
400
        //   },
 
401
        //   "path": "{packageName}/subscriptions/{subscriptionId}/purchases/{token}",
 
402
        //   "response": {
 
403
        //     "$ref": "SubscriptionPurchase"
 
404
        //   },
 
405
        //   "scopes": [
 
406
        //     "https://www.googleapis.com/auth/androidpublisher"
 
407
        //   ]
 
408
        // }
 
409
 
 
410
}