~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/google.golang.org/api/adexchangebuyer/v1.1/adexchangebuyer-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 adexchangebuyer provides access to the Ad Exchange Buyer API.
 
2
//
 
3
// See https://developers.google.com/ad-exchange/buyer-rest
 
4
//
 
5
// Usage example:
 
6
//
 
7
//   import "google.golang.org/api/adexchangebuyer/v1.1"
 
8
//   ...
 
9
//   adexchangebuyerService, err := adexchangebuyer.New(oauthHttpClient)
 
10
package adexchangebuyer
 
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 = "adexchangebuyer:v1.1"
 
38
const apiName = "adexchangebuyer"
 
39
const apiVersion = "v1.1"
 
40
const basePath = "https://www.googleapis.com/adexchangebuyer/v1.1/"
 
41
 
 
42
// OAuth2 scopes used by this API.
 
43
const (
 
44
        // Manage your Ad Exchange buyer account configuration
 
45
        AdexchangeBuyerScope = "https://www.googleapis.com/auth/adexchange.buyer"
 
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.Accounts = NewAccountsService(s)
 
54
        s.Creatives = NewCreativesService(s)
 
55
        return s, nil
 
56
}
 
57
 
 
58
type Service struct {
 
59
        client   *http.Client
 
60
        BasePath string // API endpoint base URL
 
61
 
 
62
        Accounts *AccountsService
 
63
 
 
64
        Creatives *CreativesService
 
65
}
 
66
 
 
67
func NewAccountsService(s *Service) *AccountsService {
 
68
        rs := &AccountsService{s: s}
 
69
        return rs
 
70
}
 
71
 
 
72
type AccountsService struct {
 
73
        s *Service
 
74
}
 
75
 
 
76
func NewCreativesService(s *Service) *CreativesService {
 
77
        rs := &CreativesService{s: s}
 
78
        return rs
 
79
}
 
80
 
 
81
type CreativesService struct {
 
82
        s *Service
 
83
}
 
84
 
 
85
type Account struct {
 
86
        // BidderLocation: Your bidder locations that have distinct URLs.
 
87
        BidderLocation []*AccountBidderLocation `json:"bidderLocation,omitempty"`
 
88
 
 
89
        // CookieMatchingNid: The nid parameter value used in cookie match
 
90
        // requests. Please contact your technical account manager if you need
 
91
        // to change this.
 
92
        CookieMatchingNid string `json:"cookieMatchingNid,omitempty"`
 
93
 
 
94
        // CookieMatchingUrl: The base URL used in cookie match requests.
 
95
        CookieMatchingUrl string `json:"cookieMatchingUrl,omitempty"`
 
96
 
 
97
        // Id: Account id.
 
98
        Id int64 `json:"id,omitempty"`
 
99
 
 
100
        // Kind: Resource type.
 
101
        Kind string `json:"kind,omitempty"`
 
102
 
 
103
        // MaximumActiveCreatives: The maximum number of active creatives that
 
104
        // an account can have, where a creative is active if it was inserted or
 
105
        // bid with in the last 30 days. Please contact your technical account
 
106
        // manager if you need to change this.
 
107
        MaximumActiveCreatives int64 `json:"maximumActiveCreatives,omitempty"`
 
108
 
 
109
        // MaximumTotalQps: The sum of all bidderLocation.maximumQps values
 
110
        // cannot exceed this. Please contact your technical account manager if
 
111
        // you need to change this.
 
112
        MaximumTotalQps int64 `json:"maximumTotalQps,omitempty"`
 
113
 
 
114
        // NumberActiveCreatives: The number of creatives that this account
 
115
        // inserted or bid with in the last 30 days.
 
116
        NumberActiveCreatives int64 `json:"numberActiveCreatives,omitempty"`
 
117
}
 
118
 
 
119
type AccountBidderLocation struct {
 
120
        // MaximumQps: The maximum queries per second the Ad Exchange will send.
 
121
        MaximumQps int64 `json:"maximumQps,omitempty"`
 
122
 
 
123
        // Region: The geographical region the Ad Exchange should send requests
 
124
        // from. Only used by some quota systems, but always setting the value
 
125
        // is recommended. Allowed values:
 
126
        // - ASIA
 
127
        // - EUROPE
 
128
        // - US_EAST
 
129
        // -
 
130
        // US_WEST
 
131
        Region string `json:"region,omitempty"`
 
132
 
 
133
        // Url: The URL to which the Ad Exchange will send bid requests.
 
134
        Url string `json:"url,omitempty"`
 
135
}
 
136
 
 
137
type AccountsList struct {
 
138
        // Items: A list of accounts.
 
139
        Items []*Account `json:"items,omitempty"`
 
140
 
 
141
        // Kind: Resource type.
 
142
        Kind string `json:"kind,omitempty"`
 
143
}
 
144
 
 
145
type Creative struct {
 
146
        // HTMLSnippet: The HTML snippet that displays the ad when inserted in
 
147
        // the web page. If set, videoURL should not be set.
 
148
        HTMLSnippet string `json:"HTMLSnippet,omitempty"`
 
149
 
 
150
        // AccountId: Account id.
 
151
        AccountId int64 `json:"accountId,omitempty"`
 
152
 
 
153
        // AdvertiserId: Detected advertiser id, if any. Read-only. This field
 
154
        // should not be set in requests.
 
155
        AdvertiserId googleapi.Int64s `json:"advertiserId,omitempty"`
 
156
 
 
157
        // AdvertiserName: The name of the company being advertised in the
 
158
        // creative.
 
159
        AdvertiserName string `json:"advertiserName,omitempty"`
 
160
 
 
161
        // Attribute: All attributes for the ads that may be shown from this
 
162
        // snippet.
 
163
        Attribute []int64 `json:"attribute,omitempty"`
 
164
 
 
165
        // BuyerCreativeId: A buyer-specific id identifying the creative in this
 
166
        // ad.
 
167
        BuyerCreativeId string `json:"buyerCreativeId,omitempty"`
 
168
 
 
169
        // ClickThroughUrl: The set of destination urls for the snippet.
 
170
        ClickThroughUrl []string `json:"clickThroughUrl,omitempty"`
 
171
 
 
172
        // DisapprovalReasons: The reason for disapproval, if any. Note that not
 
173
        // all disapproval reasons may be categorized, so it is possible for the
 
174
        // creative to have a status of DISAPPROVED with an empty list for
 
175
        // disapproval_reasons. In this case, please reach out to your TAM to
 
176
        // help debug the issue. Read-only. This field should not be set in
 
177
        // requests.
 
178
        DisapprovalReasons []string `json:"disapprovalReasons,omitempty"`
 
179
 
 
180
        // Height: Ad height.
 
181
        Height int64 `json:"height,omitempty"`
 
182
 
 
183
        // Kind: Resource type.
 
184
        Kind string `json:"kind,omitempty"`
 
185
 
 
186
        // ProductCategories: Detected product categories, if any. Read-only.
 
187
        // This field should not be set in requests.
 
188
        ProductCategories []int64 `json:"productCategories,omitempty"`
 
189
 
 
190
        // RestrictedCategories: All restricted categories for the ads that may
 
191
        // be shown from this snippet.
 
192
        RestrictedCategories []int64 `json:"restrictedCategories,omitempty"`
 
193
 
 
194
        // SensitiveCategories: Detected sensitive categories, if any.
 
195
        // Read-only. This field should not be set in requests.
 
196
        SensitiveCategories []int64 `json:"sensitiveCategories,omitempty"`
 
197
 
 
198
        // Status: Creative serving status. Read-only. This field should not be
 
199
        // set in requests.
 
200
        Status string `json:"status,omitempty"`
 
201
 
 
202
        // VendorType: All vendor types for the ads that may be shown from this
 
203
        // snippet.
 
204
        VendorType []int64 `json:"vendorType,omitempty"`
 
205
 
 
206
        // VideoURL: The url to fetch a video ad. If set, HTMLSnippet should not
 
207
        // be set.
 
208
        VideoURL string `json:"videoURL,omitempty"`
 
209
 
 
210
        // Width: Ad width.
 
211
        Width int64 `json:"width,omitempty"`
 
212
}
 
213
 
 
214
type CreativesList struct {
 
215
        // Items: A list of creatives.
 
216
        Items []*Creative `json:"items,omitempty"`
 
217
 
 
218
        // Kind: Resource type.
 
219
        Kind string `json:"kind,omitempty"`
 
220
 
 
221
        // NextPageToken: Continuation token used to page through creatives. To
 
222
        // retrieve the next page of results, set the next request's "pageToken"
 
223
        // value to this.
 
224
        NextPageToken string `json:"nextPageToken,omitempty"`
 
225
}
 
226
 
 
227
// method id "adexchangebuyer.accounts.get":
 
228
 
 
229
type AccountsGetCall struct {
 
230
        s    *Service
 
231
        id   int64
 
232
        opt_ map[string]interface{}
 
233
}
 
234
 
 
235
// Get: Gets one account by ID.
 
236
func (r *AccountsService) Get(id int64) *AccountsGetCall {
 
237
        c := &AccountsGetCall{s: r.s, opt_: make(map[string]interface{})}
 
238
        c.id = id
 
239
        return c
 
240
}
 
241
 
 
242
// Fields allows partial responses to be retrieved.
 
243
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
244
// for more information.
 
245
func (c *AccountsGetCall) Fields(s ...googleapi.Field) *AccountsGetCall {
 
246
        c.opt_["fields"] = googleapi.CombineFields(s)
 
247
        return c
 
248
}
 
249
 
 
250
func (c *AccountsGetCall) Do() (*Account, error) {
 
251
        var body io.Reader = nil
 
252
        params := make(url.Values)
 
253
        params.Set("alt", "json")
 
254
        if v, ok := c.opt_["fields"]; ok {
 
255
                params.Set("fields", fmt.Sprintf("%v", v))
 
256
        }
 
257
        urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{id}")
 
258
        urls += "?" + params.Encode()
 
259
        req, _ := http.NewRequest("GET", urls, body)
 
260
        googleapi.Expand(req.URL, map[string]string{
 
261
                "id": strconv.FormatInt(c.id, 10),
 
262
        })
 
263
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
264
        res, err := c.s.client.Do(req)
 
265
        if err != nil {
 
266
                return nil, err
 
267
        }
 
268
        defer googleapi.CloseBody(res)
 
269
        if err := googleapi.CheckResponse(res); err != nil {
 
270
                return nil, err
 
271
        }
 
272
        var ret *Account
 
273
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
274
                return nil, err
 
275
        }
 
276
        return ret, nil
 
277
        // {
 
278
        //   "description": "Gets one account by ID.",
 
279
        //   "httpMethod": "GET",
 
280
        //   "id": "adexchangebuyer.accounts.get",
 
281
        //   "parameterOrder": [
 
282
        //     "id"
 
283
        //   ],
 
284
        //   "parameters": {
 
285
        //     "id": {
 
286
        //       "description": "The account id",
 
287
        //       "format": "int32",
 
288
        //       "location": "path",
 
289
        //       "required": true,
 
290
        //       "type": "integer"
 
291
        //     }
 
292
        //   },
 
293
        //   "path": "accounts/{id}",
 
294
        //   "response": {
 
295
        //     "$ref": "Account"
 
296
        //   },
 
297
        //   "scopes": [
 
298
        //     "https://www.googleapis.com/auth/adexchange.buyer"
 
299
        //   ]
 
300
        // }
 
301
 
 
302
}
 
303
 
 
304
// method id "adexchangebuyer.accounts.list":
 
305
 
 
306
type AccountsListCall struct {
 
307
        s    *Service
 
308
        opt_ map[string]interface{}
 
309
}
 
310
 
 
311
// List: Retrieves the authenticated user's list of accounts.
 
312
func (r *AccountsService) List() *AccountsListCall {
 
313
        c := &AccountsListCall{s: r.s, opt_: make(map[string]interface{})}
 
314
        return c
 
315
}
 
316
 
 
317
// Fields allows partial responses to be retrieved.
 
318
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
319
// for more information.
 
320
func (c *AccountsListCall) Fields(s ...googleapi.Field) *AccountsListCall {
 
321
        c.opt_["fields"] = googleapi.CombineFields(s)
 
322
        return c
 
323
}
 
324
 
 
325
func (c *AccountsListCall) Do() (*AccountsList, error) {
 
326
        var body io.Reader = nil
 
327
        params := make(url.Values)
 
328
        params.Set("alt", "json")
 
329
        if v, ok := c.opt_["fields"]; ok {
 
330
                params.Set("fields", fmt.Sprintf("%v", v))
 
331
        }
 
332
        urls := googleapi.ResolveRelative(c.s.BasePath, "accounts")
 
333
        urls += "?" + params.Encode()
 
334
        req, _ := http.NewRequest("GET", urls, body)
 
335
        googleapi.SetOpaque(req.URL)
 
336
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
337
        res, err := c.s.client.Do(req)
 
338
        if err != nil {
 
339
                return nil, err
 
340
        }
 
341
        defer googleapi.CloseBody(res)
 
342
        if err := googleapi.CheckResponse(res); err != nil {
 
343
                return nil, err
 
344
        }
 
345
        var ret *AccountsList
 
346
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
347
                return nil, err
 
348
        }
 
349
        return ret, nil
 
350
        // {
 
351
        //   "description": "Retrieves the authenticated user's list of accounts.",
 
352
        //   "httpMethod": "GET",
 
353
        //   "id": "adexchangebuyer.accounts.list",
 
354
        //   "path": "accounts",
 
355
        //   "response": {
 
356
        //     "$ref": "AccountsList"
 
357
        //   },
 
358
        //   "scopes": [
 
359
        //     "https://www.googleapis.com/auth/adexchange.buyer"
 
360
        //   ]
 
361
        // }
 
362
 
 
363
}
 
364
 
 
365
// method id "adexchangebuyer.accounts.patch":
 
366
 
 
367
type AccountsPatchCall struct {
 
368
        s       *Service
 
369
        id      int64
 
370
        account *Account
 
371
        opt_    map[string]interface{}
 
372
}
 
373
 
 
374
// Patch: Updates an existing account. This method supports patch
 
375
// semantics.
 
376
func (r *AccountsService) Patch(id int64, account *Account) *AccountsPatchCall {
 
377
        c := &AccountsPatchCall{s: r.s, opt_: make(map[string]interface{})}
 
378
        c.id = id
 
379
        c.account = account
 
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 *AccountsPatchCall) Fields(s ...googleapi.Field) *AccountsPatchCall {
 
387
        c.opt_["fields"] = googleapi.CombineFields(s)
 
388
        return c
 
389
}
 
390
 
 
391
func (c *AccountsPatchCall) Do() (*Account, error) {
 
392
        var body io.Reader = nil
 
393
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.account)
 
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_["fields"]; ok {
 
401
                params.Set("fields", fmt.Sprintf("%v", v))
 
402
        }
 
403
        urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{id}")
 
404
        urls += "?" + params.Encode()
 
405
        req, _ := http.NewRequest("PATCH", urls, body)
 
406
        googleapi.Expand(req.URL, map[string]string{
 
407
                "id": strconv.FormatInt(c.id, 10),
 
408
        })
 
409
        req.Header.Set("Content-Type", ctype)
 
410
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
411
        res, err := c.s.client.Do(req)
 
412
        if err != nil {
 
413
                return nil, err
 
414
        }
 
415
        defer googleapi.CloseBody(res)
 
416
        if err := googleapi.CheckResponse(res); err != nil {
 
417
                return nil, err
 
418
        }
 
419
        var ret *Account
 
420
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
421
                return nil, err
 
422
        }
 
423
        return ret, nil
 
424
        // {
 
425
        //   "description": "Updates an existing account. This method supports patch semantics.",
 
426
        //   "httpMethod": "PATCH",
 
427
        //   "id": "adexchangebuyer.accounts.patch",
 
428
        //   "parameterOrder": [
 
429
        //     "id"
 
430
        //   ],
 
431
        //   "parameters": {
 
432
        //     "id": {
 
433
        //       "description": "The account id",
 
434
        //       "format": "int32",
 
435
        //       "location": "path",
 
436
        //       "required": true,
 
437
        //       "type": "integer"
 
438
        //     }
 
439
        //   },
 
440
        //   "path": "accounts/{id}",
 
441
        //   "request": {
 
442
        //     "$ref": "Account"
 
443
        //   },
 
444
        //   "response": {
 
445
        //     "$ref": "Account"
 
446
        //   },
 
447
        //   "scopes": [
 
448
        //     "https://www.googleapis.com/auth/adexchange.buyer"
 
449
        //   ]
 
450
        // }
 
451
 
 
452
}
 
453
 
 
454
// method id "adexchangebuyer.accounts.update":
 
455
 
 
456
type AccountsUpdateCall struct {
 
457
        s       *Service
 
458
        id      int64
 
459
        account *Account
 
460
        opt_    map[string]interface{}
 
461
}
 
462
 
 
463
// Update: Updates an existing account.
 
464
func (r *AccountsService) Update(id int64, account *Account) *AccountsUpdateCall {
 
465
        c := &AccountsUpdateCall{s: r.s, opt_: make(map[string]interface{})}
 
466
        c.id = id
 
467
        c.account = account
 
468
        return c
 
469
}
 
470
 
 
471
// Fields allows partial responses to be retrieved.
 
472
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
473
// for more information.
 
474
func (c *AccountsUpdateCall) Fields(s ...googleapi.Field) *AccountsUpdateCall {
 
475
        c.opt_["fields"] = googleapi.CombineFields(s)
 
476
        return c
 
477
}
 
478
 
 
479
func (c *AccountsUpdateCall) Do() (*Account, error) {
 
480
        var body io.Reader = nil
 
481
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.account)
 
482
        if err != nil {
 
483
                return nil, err
 
484
        }
 
485
        ctype := "application/json"
 
486
        params := make(url.Values)
 
487
        params.Set("alt", "json")
 
488
        if v, ok := c.opt_["fields"]; ok {
 
489
                params.Set("fields", fmt.Sprintf("%v", v))
 
490
        }
 
491
        urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{id}")
 
492
        urls += "?" + params.Encode()
 
493
        req, _ := http.NewRequest("PUT", urls, body)
 
494
        googleapi.Expand(req.URL, map[string]string{
 
495
                "id": strconv.FormatInt(c.id, 10),
 
496
        })
 
497
        req.Header.Set("Content-Type", ctype)
 
498
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
499
        res, err := c.s.client.Do(req)
 
500
        if err != nil {
 
501
                return nil, err
 
502
        }
 
503
        defer googleapi.CloseBody(res)
 
504
        if err := googleapi.CheckResponse(res); err != nil {
 
505
                return nil, err
 
506
        }
 
507
        var ret *Account
 
508
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
509
                return nil, err
 
510
        }
 
511
        return ret, nil
 
512
        // {
 
513
        //   "description": "Updates an existing account.",
 
514
        //   "httpMethod": "PUT",
 
515
        //   "id": "adexchangebuyer.accounts.update",
 
516
        //   "parameterOrder": [
 
517
        //     "id"
 
518
        //   ],
 
519
        //   "parameters": {
 
520
        //     "id": {
 
521
        //       "description": "The account id",
 
522
        //       "format": "int32",
 
523
        //       "location": "path",
 
524
        //       "required": true,
 
525
        //       "type": "integer"
 
526
        //     }
 
527
        //   },
 
528
        //   "path": "accounts/{id}",
 
529
        //   "request": {
 
530
        //     "$ref": "Account"
 
531
        //   },
 
532
        //   "response": {
 
533
        //     "$ref": "Account"
 
534
        //   },
 
535
        //   "scopes": [
 
536
        //     "https://www.googleapis.com/auth/adexchange.buyer"
 
537
        //   ]
 
538
        // }
 
539
 
 
540
}
 
541
 
 
542
// method id "adexchangebuyer.creatives.get":
 
543
 
 
544
type CreativesGetCall struct {
 
545
        s               *Service
 
546
        accountId       int64
 
547
        buyerCreativeId string
 
548
        opt_            map[string]interface{}
 
549
}
 
550
 
 
551
// Get: Gets the status for a single creative. A creative will be
 
552
// available 30-40 minutes after submission.
 
553
func (r *CreativesService) Get(accountId int64, buyerCreativeId string) *CreativesGetCall {
 
554
        c := &CreativesGetCall{s: r.s, opt_: make(map[string]interface{})}
 
555
        c.accountId = accountId
 
556
        c.buyerCreativeId = buyerCreativeId
 
557
        return c
 
558
}
 
559
 
 
560
// Fields allows partial responses to be retrieved.
 
561
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
562
// for more information.
 
563
func (c *CreativesGetCall) Fields(s ...googleapi.Field) *CreativesGetCall {
 
564
        c.opt_["fields"] = googleapi.CombineFields(s)
 
565
        return c
 
566
}
 
567
 
 
568
func (c *CreativesGetCall) Do() (*Creative, error) {
 
569
        var body io.Reader = nil
 
570
        params := make(url.Values)
 
571
        params.Set("alt", "json")
 
572
        if v, ok := c.opt_["fields"]; ok {
 
573
                params.Set("fields", fmt.Sprintf("%v", v))
 
574
        }
 
575
        urls := googleapi.ResolveRelative(c.s.BasePath, "creatives/{accountId}/{buyerCreativeId}")
 
576
        urls += "?" + params.Encode()
 
577
        req, _ := http.NewRequest("GET", urls, body)
 
578
        googleapi.Expand(req.URL, map[string]string{
 
579
                "accountId":       strconv.FormatInt(c.accountId, 10),
 
580
                "buyerCreativeId": c.buyerCreativeId,
 
581
        })
 
582
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
583
        res, err := c.s.client.Do(req)
 
584
        if err != nil {
 
585
                return nil, err
 
586
        }
 
587
        defer googleapi.CloseBody(res)
 
588
        if err := googleapi.CheckResponse(res); err != nil {
 
589
                return nil, err
 
590
        }
 
591
        var ret *Creative
 
592
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
593
                return nil, err
 
594
        }
 
595
        return ret, nil
 
596
        // {
 
597
        //   "description": "Gets the status for a single creative. A creative will be available 30-40 minutes after submission.",
 
598
        //   "httpMethod": "GET",
 
599
        //   "id": "adexchangebuyer.creatives.get",
 
600
        //   "parameterOrder": [
 
601
        //     "accountId",
 
602
        //     "buyerCreativeId"
 
603
        //   ],
 
604
        //   "parameters": {
 
605
        //     "accountId": {
 
606
        //       "description": "The id for the account that will serve this creative.",
 
607
        //       "format": "int32",
 
608
        //       "location": "path",
 
609
        //       "required": true,
 
610
        //       "type": "integer"
 
611
        //     },
 
612
        //     "buyerCreativeId": {
 
613
        //       "description": "The buyer-specific id for this creative.",
 
614
        //       "location": "path",
 
615
        //       "required": true,
 
616
        //       "type": "string"
 
617
        //     }
 
618
        //   },
 
619
        //   "path": "creatives/{accountId}/{buyerCreativeId}",
 
620
        //   "response": {
 
621
        //     "$ref": "Creative"
 
622
        //   },
 
623
        //   "scopes": [
 
624
        //     "https://www.googleapis.com/auth/adexchange.buyer"
 
625
        //   ]
 
626
        // }
 
627
 
 
628
}
 
629
 
 
630
// method id "adexchangebuyer.creatives.insert":
 
631
 
 
632
type CreativesInsertCall struct {
 
633
        s        *Service
 
634
        creative *Creative
 
635
        opt_     map[string]interface{}
 
636
}
 
637
 
 
638
// Insert: Submit a new creative.
 
639
func (r *CreativesService) Insert(creative *Creative) *CreativesInsertCall {
 
640
        c := &CreativesInsertCall{s: r.s, opt_: make(map[string]interface{})}
 
641
        c.creative = creative
 
642
        return c
 
643
}
 
644
 
 
645
// Fields allows partial responses to be retrieved.
 
646
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
647
// for more information.
 
648
func (c *CreativesInsertCall) Fields(s ...googleapi.Field) *CreativesInsertCall {
 
649
        c.opt_["fields"] = googleapi.CombineFields(s)
 
650
        return c
 
651
}
 
652
 
 
653
func (c *CreativesInsertCall) Do() (*Creative, error) {
 
654
        var body io.Reader = nil
 
655
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.creative)
 
656
        if err != nil {
 
657
                return nil, err
 
658
        }
 
659
        ctype := "application/json"
 
660
        params := make(url.Values)
 
661
        params.Set("alt", "json")
 
662
        if v, ok := c.opt_["fields"]; ok {
 
663
                params.Set("fields", fmt.Sprintf("%v", v))
 
664
        }
 
665
        urls := googleapi.ResolveRelative(c.s.BasePath, "creatives")
 
666
        urls += "?" + params.Encode()
 
667
        req, _ := http.NewRequest("POST", urls, body)
 
668
        googleapi.SetOpaque(req.URL)
 
669
        req.Header.Set("Content-Type", ctype)
 
670
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
671
        res, err := c.s.client.Do(req)
 
672
        if err != nil {
 
673
                return nil, err
 
674
        }
 
675
        defer googleapi.CloseBody(res)
 
676
        if err := googleapi.CheckResponse(res); err != nil {
 
677
                return nil, err
 
678
        }
 
679
        var ret *Creative
 
680
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
681
                return nil, err
 
682
        }
 
683
        return ret, nil
 
684
        // {
 
685
        //   "description": "Submit a new creative.",
 
686
        //   "httpMethod": "POST",
 
687
        //   "id": "adexchangebuyer.creatives.insert",
 
688
        //   "path": "creatives",
 
689
        //   "request": {
 
690
        //     "$ref": "Creative"
 
691
        //   },
 
692
        //   "response": {
 
693
        //     "$ref": "Creative"
 
694
        //   },
 
695
        //   "scopes": [
 
696
        //     "https://www.googleapis.com/auth/adexchange.buyer"
 
697
        //   ]
 
698
        // }
 
699
 
 
700
}
 
701
 
 
702
// method id "adexchangebuyer.creatives.list":
 
703
 
 
704
type CreativesListCall struct {
 
705
        s    *Service
 
706
        opt_ map[string]interface{}
 
707
}
 
708
 
 
709
// List: Retrieves a list of the authenticated user's active creatives.
 
710
// A creative will be available 30-40 minutes after submission.
 
711
func (r *CreativesService) List() *CreativesListCall {
 
712
        c := &CreativesListCall{s: r.s, opt_: make(map[string]interface{})}
 
713
        return c
 
714
}
 
715
 
 
716
// MaxResults sets the optional parameter "maxResults": Maximum number
 
717
// of entries returned on one result page. If not set, the default is
 
718
// 100.
 
719
func (c *CreativesListCall) MaxResults(maxResults int64) *CreativesListCall {
 
720
        c.opt_["maxResults"] = maxResults
 
721
        return c
 
722
}
 
723
 
 
724
// PageToken sets the optional parameter "pageToken": A continuation
 
725
// token, used to page through ad clients. To retrieve the next page,
 
726
// set this parameter to the value of "nextPageToken" from the previous
 
727
// response.
 
728
func (c *CreativesListCall) PageToken(pageToken string) *CreativesListCall {
 
729
        c.opt_["pageToken"] = pageToken
 
730
        return c
 
731
}
 
732
 
 
733
// StatusFilter sets the optional parameter "statusFilter": When
 
734
// specified, only creatives having the given status are returned.
 
735
func (c *CreativesListCall) StatusFilter(statusFilter string) *CreativesListCall {
 
736
        c.opt_["statusFilter"] = statusFilter
 
737
        return c
 
738
}
 
739
 
 
740
// Fields allows partial responses to be retrieved.
 
741
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
742
// for more information.
 
743
func (c *CreativesListCall) Fields(s ...googleapi.Field) *CreativesListCall {
 
744
        c.opt_["fields"] = googleapi.CombineFields(s)
 
745
        return c
 
746
}
 
747
 
 
748
func (c *CreativesListCall) Do() (*CreativesList, error) {
 
749
        var body io.Reader = nil
 
750
        params := make(url.Values)
 
751
        params.Set("alt", "json")
 
752
        if v, ok := c.opt_["maxResults"]; ok {
 
753
                params.Set("maxResults", fmt.Sprintf("%v", v))
 
754
        }
 
755
        if v, ok := c.opt_["pageToken"]; ok {
 
756
                params.Set("pageToken", fmt.Sprintf("%v", v))
 
757
        }
 
758
        if v, ok := c.opt_["statusFilter"]; ok {
 
759
                params.Set("statusFilter", fmt.Sprintf("%v", v))
 
760
        }
 
761
        if v, ok := c.opt_["fields"]; ok {
 
762
                params.Set("fields", fmt.Sprintf("%v", v))
 
763
        }
 
764
        urls := googleapi.ResolveRelative(c.s.BasePath, "creatives")
 
765
        urls += "?" + params.Encode()
 
766
        req, _ := http.NewRequest("GET", urls, body)
 
767
        googleapi.SetOpaque(req.URL)
 
768
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
769
        res, err := c.s.client.Do(req)
 
770
        if err != nil {
 
771
                return nil, err
 
772
        }
 
773
        defer googleapi.CloseBody(res)
 
774
        if err := googleapi.CheckResponse(res); err != nil {
 
775
                return nil, err
 
776
        }
 
777
        var ret *CreativesList
 
778
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
779
                return nil, err
 
780
        }
 
781
        return ret, nil
 
782
        // {
 
783
        //   "description": "Retrieves a list of the authenticated user's active creatives. A creative will be available 30-40 minutes after submission.",
 
784
        //   "httpMethod": "GET",
 
785
        //   "id": "adexchangebuyer.creatives.list",
 
786
        //   "parameters": {
 
787
        //     "maxResults": {
 
788
        //       "description": "Maximum number of entries returned on one result page. If not set, the default is 100. Optional.",
 
789
        //       "format": "uint32",
 
790
        //       "location": "query",
 
791
        //       "maximum": "1000",
 
792
        //       "minimum": "1",
 
793
        //       "type": "integer"
 
794
        //     },
 
795
        //     "pageToken": {
 
796
        //       "description": "A continuation token, used to page through ad clients. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response. Optional.",
 
797
        //       "location": "query",
 
798
        //       "type": "string"
 
799
        //     },
 
800
        //     "statusFilter": {
 
801
        //       "description": "When specified, only creatives having the given status are returned.",
 
802
        //       "enum": [
 
803
        //         "approved",
 
804
        //         "disapproved",
 
805
        //         "not_checked"
 
806
        //       ],
 
807
        //       "enumDescriptions": [
 
808
        //         "Creatives which have been approved.",
 
809
        //         "Creatives which have been disapproved.",
 
810
        //         "Creatives whose status is not yet checked."
 
811
        //       ],
 
812
        //       "location": "query",
 
813
        //       "type": "string"
 
814
        //     }
 
815
        //   },
 
816
        //   "path": "creatives",
 
817
        //   "response": {
 
818
        //     "$ref": "CreativesList"
 
819
        //   },
 
820
        //   "scopes": [
 
821
        //     "https://www.googleapis.com/auth/adexchange.buyer"
 
822
        //   ]
 
823
        // }
 
824
 
 
825
}