1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51 package adexperiencereport
52
53 import (
54 "bytes"
55 "context"
56 "encoding/json"
57 "errors"
58 "fmt"
59 "io"
60 "net/http"
61 "net/url"
62 "strconv"
63 "strings"
64
65 googleapi "google.golang.org/api/googleapi"
66 internal "google.golang.org/api/internal"
67 gensupport "google.golang.org/api/internal/gensupport"
68 option "google.golang.org/api/option"
69 internaloption "google.golang.org/api/option/internaloption"
70 htransport "google.golang.org/api/transport/http"
71 )
72
73
74
75 var _ = bytes.NewBuffer
76 var _ = strconv.Itoa
77 var _ = fmt.Sprintf
78 var _ = json.NewDecoder
79 var _ = io.Copy
80 var _ = url.Parse
81 var _ = gensupport.MarshalJSON
82 var _ = googleapi.Version
83 var _ = errors.New
84 var _ = strings.Replace
85 var _ = context.Canceled
86 var _ = internaloption.WithDefaultEndpoint
87 var _ = internal.Version
88
89 const apiId = "adexperiencereport:v1"
90 const apiName = "adexperiencereport"
91 const apiVersion = "v1"
92 const basePath = "https://adexperiencereport.googleapis.com/"
93 const basePathTemplate = "https://adexperiencereport.UNIVERSE_DOMAIN/"
94 const mtlsBasePath = "https://adexperiencereport.mtls.googleapis.com/"
95
96
97 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
98 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
99 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
100 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
101 opts = append(opts, internaloption.EnableNewAuthLibrary())
102 client, endpoint, err := htransport.NewClient(ctx, opts...)
103 if err != nil {
104 return nil, err
105 }
106 s, err := New(client)
107 if err != nil {
108 return nil, err
109 }
110 if endpoint != "" {
111 s.BasePath = endpoint
112 }
113 return s, nil
114 }
115
116
117
118
119
120
121 func New(client *http.Client) (*Service, error) {
122 if client == nil {
123 return nil, errors.New("client is nil")
124 }
125 s := &Service{client: client, BasePath: basePath}
126 s.Sites = NewSitesService(s)
127 s.ViolatingSites = NewViolatingSitesService(s)
128 return s, nil
129 }
130
131 type Service struct {
132 client *http.Client
133 BasePath string
134 UserAgent string
135
136 Sites *SitesService
137
138 ViolatingSites *ViolatingSitesService
139 }
140
141 func (s *Service) userAgent() string {
142 if s.UserAgent == "" {
143 return googleapi.UserAgent
144 }
145 return googleapi.UserAgent + " " + s.UserAgent
146 }
147
148 func NewSitesService(s *Service) *SitesService {
149 rs := &SitesService{s: s}
150 return rs
151 }
152
153 type SitesService struct {
154 s *Service
155 }
156
157 func NewViolatingSitesService(s *Service) *ViolatingSitesService {
158 rs := &ViolatingSitesService{s: s}
159 return rs
160 }
161
162 type ViolatingSitesService struct {
163 s *Service
164 }
165
166
167 type PlatformSummary struct {
168
169
170
171
172
173
174
175 BetterAdsStatus string `json:"betterAdsStatus,omitempty"`
176
177
178
179 EnforcementTime string `json:"enforcementTime,omitempty"`
180
181
182
183
184
185
186
187
188
189 FilterStatus string `json:"filterStatus,omitempty"`
190
191
192 LastChangeTime string `json:"lastChangeTime,omitempty"`
193
194
195
196
197
198
199
200
201
202 Region []string `json:"region,omitempty"`
203
204
205
206
207
208 ReportUrl string `json:"reportUrl,omitempty"`
209
210 UnderReview bool `json:"underReview,omitempty"`
211
212
213
214
215
216 ForceSendFields []string `json:"-"`
217
218
219
220
221 NullFields []string `json:"-"`
222 }
223
224 func (s *PlatformSummary) MarshalJSON() ([]byte, error) {
225 type NoMethod PlatformSummary
226 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
227 }
228
229
230 type SiteSummaryResponse struct {
231
232 DesktopSummary *PlatformSummary `json:"desktopSummary,omitempty"`
233
234 MobileSummary *PlatformSummary `json:"mobileSummary,omitempty"`
235
236 ReviewedSite string `json:"reviewedSite,omitempty"`
237
238
239 googleapi.ServerResponse `json:"-"`
240
241
242
243
244
245 ForceSendFields []string `json:"-"`
246
247
248
249
250 NullFields []string `json:"-"`
251 }
252
253 func (s *SiteSummaryResponse) MarshalJSON() ([]byte, error) {
254 type NoMethod SiteSummaryResponse
255 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
256 }
257
258
259 type ViolatingSitesResponse struct {
260
261 ViolatingSites []*SiteSummaryResponse `json:"violatingSites,omitempty"`
262
263
264 googleapi.ServerResponse `json:"-"`
265
266
267
268
269
270 ForceSendFields []string `json:"-"`
271
272
273
274
275 NullFields []string `json:"-"`
276 }
277
278 func (s *ViolatingSitesResponse) MarshalJSON() ([]byte, error) {
279 type NoMethod ViolatingSitesResponse
280 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
281 }
282
283 type SitesGetCall struct {
284 s *Service
285 name string
286 urlParams_ gensupport.URLParams
287 ifNoneMatch_ string
288 ctx_ context.Context
289 header_ http.Header
290 }
291
292
293
294
295
296 func (r *SitesService) Get(name string) *SitesGetCall {
297 c := &SitesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
298 c.name = name
299 return c
300 }
301
302
303
304
305 func (c *SitesGetCall) Fields(s ...googleapi.Field) *SitesGetCall {
306 c.urlParams_.Set("fields", googleapi.CombineFields(s))
307 return c
308 }
309
310
311
312
313 func (c *SitesGetCall) IfNoneMatch(entityTag string) *SitesGetCall {
314 c.ifNoneMatch_ = entityTag
315 return c
316 }
317
318
319 func (c *SitesGetCall) Context(ctx context.Context) *SitesGetCall {
320 c.ctx_ = ctx
321 return c
322 }
323
324
325
326 func (c *SitesGetCall) Header() http.Header {
327 if c.header_ == nil {
328 c.header_ = make(http.Header)
329 }
330 return c.header_
331 }
332
333 func (c *SitesGetCall) doRequest(alt string) (*http.Response, error) {
334 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
335 if c.ifNoneMatch_ != "" {
336 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
337 }
338 var body io.Reader = nil
339 c.urlParams_.Set("alt", alt)
340 c.urlParams_.Set("prettyPrint", "false")
341 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
342 urls += "?" + c.urlParams_.Encode()
343 req, err := http.NewRequest("GET", urls, body)
344 if err != nil {
345 return nil, err
346 }
347 req.Header = reqHeaders
348 googleapi.Expand(req.URL, map[string]string{
349 "name": c.name,
350 })
351 return gensupport.SendRequest(c.ctx_, c.s.client, req)
352 }
353
354
355
356
357
358
359
360 func (c *SitesGetCall) Do(opts ...googleapi.CallOption) (*SiteSummaryResponse, error) {
361 gensupport.SetOptions(c.urlParams_, opts...)
362 res, err := c.doRequest("json")
363 if res != nil && res.StatusCode == http.StatusNotModified {
364 if res.Body != nil {
365 res.Body.Close()
366 }
367 return nil, gensupport.WrapError(&googleapi.Error{
368 Code: res.StatusCode,
369 Header: res.Header,
370 })
371 }
372 if err != nil {
373 return nil, err
374 }
375 defer googleapi.CloseBody(res)
376 if err := googleapi.CheckResponse(res); err != nil {
377 return nil, gensupport.WrapError(err)
378 }
379 ret := &SiteSummaryResponse{
380 ServerResponse: googleapi.ServerResponse{
381 Header: res.Header,
382 HTTPStatusCode: res.StatusCode,
383 },
384 }
385 target := &ret
386 if err := gensupport.DecodeResponse(target, res); err != nil {
387 return nil, err
388 }
389 return ret, nil
390 }
391
392 type ViolatingSitesListCall struct {
393 s *Service
394 urlParams_ gensupport.URLParams
395 ifNoneMatch_ string
396 ctx_ context.Context
397 header_ http.Header
398 }
399
400
401
402 func (r *ViolatingSitesService) List() *ViolatingSitesListCall {
403 c := &ViolatingSitesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
404 return c
405 }
406
407
408
409
410 func (c *ViolatingSitesListCall) Fields(s ...googleapi.Field) *ViolatingSitesListCall {
411 c.urlParams_.Set("fields", googleapi.CombineFields(s))
412 return c
413 }
414
415
416
417
418 func (c *ViolatingSitesListCall) IfNoneMatch(entityTag string) *ViolatingSitesListCall {
419 c.ifNoneMatch_ = entityTag
420 return c
421 }
422
423
424 func (c *ViolatingSitesListCall) Context(ctx context.Context) *ViolatingSitesListCall {
425 c.ctx_ = ctx
426 return c
427 }
428
429
430
431 func (c *ViolatingSitesListCall) Header() http.Header {
432 if c.header_ == nil {
433 c.header_ = make(http.Header)
434 }
435 return c.header_
436 }
437
438 func (c *ViolatingSitesListCall) doRequest(alt string) (*http.Response, error) {
439 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
440 if c.ifNoneMatch_ != "" {
441 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
442 }
443 var body io.Reader = nil
444 c.urlParams_.Set("alt", alt)
445 c.urlParams_.Set("prettyPrint", "false")
446 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/violatingSites")
447 urls += "?" + c.urlParams_.Encode()
448 req, err := http.NewRequest("GET", urls, body)
449 if err != nil {
450 return nil, err
451 }
452 req.Header = reqHeaders
453 return gensupport.SendRequest(c.ctx_, c.s.client, req)
454 }
455
456
457
458
459
460
461
462 func (c *ViolatingSitesListCall) Do(opts ...googleapi.CallOption) (*ViolatingSitesResponse, error) {
463 gensupport.SetOptions(c.urlParams_, opts...)
464 res, err := c.doRequest("json")
465 if res != nil && res.StatusCode == http.StatusNotModified {
466 if res.Body != nil {
467 res.Body.Close()
468 }
469 return nil, gensupport.WrapError(&googleapi.Error{
470 Code: res.StatusCode,
471 Header: res.Header,
472 })
473 }
474 if err != nil {
475 return nil, err
476 }
477 defer googleapi.CloseBody(res)
478 if err := googleapi.CheckResponse(res); err != nil {
479 return nil, gensupport.WrapError(err)
480 }
481 ret := &ViolatingSitesResponse{
482 ServerResponse: googleapi.ServerResponse{
483 Header: res.Header,
484 HTTPStatusCode: res.StatusCode,
485 },
486 }
487 target := &ret
488 if err := gensupport.DecodeResponse(target, res); err != nil {
489 return nil, err
490 }
491 return ret, nil
492 }
493
View as plain text