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 localservices
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 = "localservices:v1"
90 const apiName = "localservices"
91 const apiVersion = "v1"
92 const basePath = "https://localservices.googleapis.com/"
93 const basePathTemplate = "https://localservices.UNIVERSE_DOMAIN/"
94 const mtlsBasePath = "https://localservices.mtls.googleapis.com/"
95
96
97 const (
98
99 AdwordsScope = "https://www.googleapis.com/auth/adwords"
100 )
101
102
103 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
104 scopesOption := internaloption.WithDefaultScopes(
105 "https://www.googleapis.com/auth/adwords",
106 )
107
108 opts = append([]option.ClientOption{scopesOption}, opts...)
109 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
110 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
111 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
112 opts = append(opts, internaloption.EnableNewAuthLibrary())
113 client, endpoint, err := htransport.NewClient(ctx, opts...)
114 if err != nil {
115 return nil, err
116 }
117 s, err := New(client)
118 if err != nil {
119 return nil, err
120 }
121 if endpoint != "" {
122 s.BasePath = endpoint
123 }
124 return s, nil
125 }
126
127
128
129
130
131
132 func New(client *http.Client) (*Service, error) {
133 if client == nil {
134 return nil, errors.New("client is nil")
135 }
136 s := &Service{client: client, BasePath: basePath}
137 s.AccountReports = NewAccountReportsService(s)
138 s.DetailedLeadReports = NewDetailedLeadReportsService(s)
139 return s, nil
140 }
141
142 type Service struct {
143 client *http.Client
144 BasePath string
145 UserAgent string
146
147 AccountReports *AccountReportsService
148
149 DetailedLeadReports *DetailedLeadReportsService
150 }
151
152 func (s *Service) userAgent() string {
153 if s.UserAgent == "" {
154 return googleapi.UserAgent
155 }
156 return googleapi.UserAgent + " " + s.UserAgent
157 }
158
159 func NewAccountReportsService(s *Service) *AccountReportsService {
160 rs := &AccountReportsService{s: s}
161 return rs
162 }
163
164 type AccountReportsService struct {
165 s *Service
166 }
167
168 func NewDetailedLeadReportsService(s *Service) *DetailedLeadReportsService {
169 rs := &DetailedLeadReportsService{s: s}
170 return rs
171 }
172
173 type DetailedLeadReportsService struct {
174 s *Service
175 }
176
177
178
179
180 type GoogleAdsHomeservicesLocalservicesV1AccountReport struct {
181
182 AccountId int64 `json:"accountId,omitempty,string"`
183
184 AggregatorInfo *GoogleAdsHomeservicesLocalservicesV1AggregatorInfo `json:"aggregatorInfo,omitempty"`
185
186 AverageFiveStarRating float64 `json:"averageFiveStarRating,omitempty"`
187
188
189 AverageWeeklyBudget float64 `json:"averageWeeklyBudget,omitempty"`
190
191 BusinessName string `json:"businessName,omitempty"`
192
193 CurrencyCode string `json:"currencyCode,omitempty"`
194
195
196 CurrentPeriodChargedLeads int64 `json:"currentPeriodChargedLeads,omitempty,string"`
197
198
199 CurrentPeriodConnectedPhoneCalls int64 `json:"currentPeriodConnectedPhoneCalls,omitempty,string"`
200
201
202 CurrentPeriodPhoneCalls int64 `json:"currentPeriodPhoneCalls,omitempty,string"`
203
204
205 CurrentPeriodTotalCost float64 `json:"currentPeriodTotalCost,omitempty"`
206
207
208 ImpressionsLastTwoDays int64 `json:"impressionsLastTwoDays,omitempty,string"`
209
210
211
212
213 PhoneLeadResponsiveness float64 `json:"phoneLeadResponsiveness,omitempty"`
214
215
216 PreviousPeriodChargedLeads int64 `json:"previousPeriodChargedLeads,omitempty,string"`
217
218
219 PreviousPeriodConnectedPhoneCalls int64 `json:"previousPeriodConnectedPhoneCalls,omitempty,string"`
220
221
222 PreviousPeriodPhoneCalls int64 `json:"previousPeriodPhoneCalls,omitempty,string"`
223
224
225 PreviousPeriodTotalCost float64 `json:"previousPeriodTotalCost,omitempty"`
226
227 TotalReview int64 `json:"totalReview,omitempty"`
228
229
230
231
232
233 ForceSendFields []string `json:"-"`
234
235
236
237
238 NullFields []string `json:"-"`
239 }
240
241 func (s *GoogleAdsHomeservicesLocalservicesV1AccountReport) MarshalJSON() ([]byte, error) {
242 type NoMethod GoogleAdsHomeservicesLocalservicesV1AccountReport
243 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
244 }
245
246 func (s *GoogleAdsHomeservicesLocalservicesV1AccountReport) UnmarshalJSON(data []byte) error {
247 type NoMethod GoogleAdsHomeservicesLocalservicesV1AccountReport
248 var s1 struct {
249 AverageFiveStarRating gensupport.JSONFloat64 `json:"averageFiveStarRating"`
250 AverageWeeklyBudget gensupport.JSONFloat64 `json:"averageWeeklyBudget"`
251 CurrentPeriodTotalCost gensupport.JSONFloat64 `json:"currentPeriodTotalCost"`
252 PhoneLeadResponsiveness gensupport.JSONFloat64 `json:"phoneLeadResponsiveness"`
253 PreviousPeriodTotalCost gensupport.JSONFloat64 `json:"previousPeriodTotalCost"`
254 *NoMethod
255 }
256 s1.NoMethod = (*NoMethod)(s)
257 if err := json.Unmarshal(data, &s1); err != nil {
258 return err
259 }
260 s.AverageFiveStarRating = float64(s1.AverageFiveStarRating)
261 s.AverageWeeklyBudget = float64(s1.AverageWeeklyBudget)
262 s.CurrentPeriodTotalCost = float64(s1.CurrentPeriodTotalCost)
263 s.PhoneLeadResponsiveness = float64(s1.PhoneLeadResponsiveness)
264 s.PreviousPeriodTotalCost = float64(s1.PreviousPeriodTotalCost)
265 return nil
266 }
267
268
269
270 type GoogleAdsHomeservicesLocalservicesV1AggregatorInfo struct {
271
272
273 AggregatorProviderId string `json:"aggregatorProviderId,omitempty"`
274
275
276
277
278
279 ForceSendFields []string `json:"-"`
280
281
282
283
284 NullFields []string `json:"-"`
285 }
286
287 func (s *GoogleAdsHomeservicesLocalservicesV1AggregatorInfo) MarshalJSON() ([]byte, error) {
288 type NoMethod GoogleAdsHomeservicesLocalservicesV1AggregatorInfo
289 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
290 }
291
292
293
294 type GoogleAdsHomeservicesLocalservicesV1BookingLead struct {
295
296
297 BookingAppointmentTimestamp string `json:"bookingAppointmentTimestamp,omitempty"`
298
299 ConsumerEmail string `json:"consumerEmail,omitempty"`
300
301 ConsumerPhoneNumber string `json:"consumerPhoneNumber,omitempty"`
302
303 CustomerName string `json:"customerName,omitempty"`
304
305 JobType string `json:"jobType,omitempty"`
306
307
308
309
310
311 ForceSendFields []string `json:"-"`
312
313
314
315
316 NullFields []string `json:"-"`
317 }
318
319 func (s *GoogleAdsHomeservicesLocalservicesV1BookingLead) MarshalJSON() ([]byte, error) {
320 type NoMethod GoogleAdsHomeservicesLocalservicesV1BookingLead
321 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
322 }
323
324
325
326
327 type GoogleAdsHomeservicesLocalservicesV1DetailedLeadReport struct {
328
329 AccountId int64 `json:"accountId,omitempty,string"`
330
331 AggregatorInfo *GoogleAdsHomeservicesLocalservicesV1AggregatorInfo `json:"aggregatorInfo,omitempty"`
332
333 BookingLead *GoogleAdsHomeservicesLocalservicesV1BookingLead `json:"bookingLead,omitempty"`
334
335 BusinessName string `json:"businessName,omitempty"`
336
337
338
339
340
341
342 ChargeStatus string `json:"chargeStatus,omitempty"`
343
344 CurrencyCode string `json:"currencyCode,omitempty"`
345
346 DisputeStatus string `json:"disputeStatus,omitempty"`
347
348 Geo string `json:"geo,omitempty"`
349
350 GoogleAdsLeadId int64 `json:"googleAdsLeadId,omitempty,string"`
351
352 LeadCategory string `json:"leadCategory,omitempty"`
353
354 LeadCreationTimestamp string `json:"leadCreationTimestamp,omitempty"`
355
356
357 LeadId int64 `json:"leadId,omitempty,string"`
358
359 LeadPrice float64 `json:"leadPrice,omitempty"`
360
361
362
363
364
365
366
367 LeadType string `json:"leadType,omitempty"`
368
369 MessageLead *GoogleAdsHomeservicesLocalservicesV1MessageLead `json:"messageLead,omitempty"`
370
371 PhoneLead *GoogleAdsHomeservicesLocalservicesV1PhoneLead `json:"phoneLead,omitempty"`
372
373 Timezone *GoogleTypeTimeZone `json:"timezone,omitempty"`
374
375
376
377
378
379 ForceSendFields []string `json:"-"`
380
381
382
383
384 NullFields []string `json:"-"`
385 }
386
387 func (s *GoogleAdsHomeservicesLocalservicesV1DetailedLeadReport) MarshalJSON() ([]byte, error) {
388 type NoMethod GoogleAdsHomeservicesLocalservicesV1DetailedLeadReport
389 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
390 }
391
392 func (s *GoogleAdsHomeservicesLocalservicesV1DetailedLeadReport) UnmarshalJSON(data []byte) error {
393 type NoMethod GoogleAdsHomeservicesLocalservicesV1DetailedLeadReport
394 var s1 struct {
395 LeadPrice gensupport.JSONFloat64 `json:"leadPrice"`
396 *NoMethod
397 }
398 s1.NoMethod = (*NoMethod)(s)
399 if err := json.Unmarshal(data, &s1); err != nil {
400 return err
401 }
402 s.LeadPrice = float64(s1.LeadPrice)
403 return nil
404 }
405
406
407
408 type GoogleAdsHomeservicesLocalservicesV1MessageLead struct {
409
410 ConsumerPhoneNumber string `json:"consumerPhoneNumber,omitempty"`
411
412 CustomerName string `json:"customerName,omitempty"`
413
414 JobType string `json:"jobType,omitempty"`
415
416 PostalCode string `json:"postalCode,omitempty"`
417
418
419
420
421
422 ForceSendFields []string `json:"-"`
423
424
425
426
427 NullFields []string `json:"-"`
428 }
429
430 func (s *GoogleAdsHomeservicesLocalservicesV1MessageLead) MarshalJSON() ([]byte, error) {
431 type NoMethod GoogleAdsHomeservicesLocalservicesV1MessageLead
432 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
433 }
434
435
436
437 type GoogleAdsHomeservicesLocalservicesV1PhoneLead struct {
438
439
440 ChargedCallTimestamp string `json:"chargedCallTimestamp,omitempty"`
441
442
443 ChargedConnectedCallDurationSeconds string `json:"chargedConnectedCallDurationSeconds,omitempty"`
444
445 ConsumerPhoneNumber string `json:"consumerPhoneNumber,omitempty"`
446
447
448
449
450
451 ForceSendFields []string `json:"-"`
452
453
454
455
456 NullFields []string `json:"-"`
457 }
458
459 func (s *GoogleAdsHomeservicesLocalservicesV1PhoneLead) MarshalJSON() ([]byte, error) {
460 type NoMethod GoogleAdsHomeservicesLocalservicesV1PhoneLead
461 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
462 }
463
464
465
466
467
468 type GoogleAdsHomeservicesLocalservicesV1SearchAccountReportsResponse struct {
469
470
471 AccountReports []*GoogleAdsHomeservicesLocalservicesV1AccountReport `json:"accountReports,omitempty"`
472
473
474
475 NextPageToken string `json:"nextPageToken,omitempty"`
476
477
478 googleapi.ServerResponse `json:"-"`
479
480
481
482
483
484 ForceSendFields []string `json:"-"`
485
486
487
488
489 NullFields []string `json:"-"`
490 }
491
492 func (s *GoogleAdsHomeservicesLocalservicesV1SearchAccountReportsResponse) MarshalJSON() ([]byte, error) {
493 type NoMethod GoogleAdsHomeservicesLocalservicesV1SearchAccountReportsResponse
494 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
495 }
496
497
498
499
500
501
502 type GoogleAdsHomeservicesLocalservicesV1SearchDetailedLeadReportsResponse struct {
503
504
505 DetailedLeadReports []*GoogleAdsHomeservicesLocalservicesV1DetailedLeadReport `json:"detailedLeadReports,omitempty"`
506
507
508
509 NextPageToken string `json:"nextPageToken,omitempty"`
510
511
512 googleapi.ServerResponse `json:"-"`
513
514
515
516
517
518 ForceSendFields []string `json:"-"`
519
520
521
522
523 NullFields []string `json:"-"`
524 }
525
526 func (s *GoogleAdsHomeservicesLocalservicesV1SearchDetailedLeadReportsResponse) MarshalJSON() ([]byte, error) {
527 type NoMethod GoogleAdsHomeservicesLocalservicesV1SearchDetailedLeadReportsResponse
528 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
529 }
530
531
532
533 type GoogleTypeTimeZone struct {
534
535 Id string `json:"id,omitempty"`
536
537 Version string `json:"version,omitempty"`
538
539
540
541
542
543 ForceSendFields []string `json:"-"`
544
545
546
547
548 NullFields []string `json:"-"`
549 }
550
551 func (s *GoogleTypeTimeZone) MarshalJSON() ([]byte, error) {
552 type NoMethod GoogleTypeTimeZone
553 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
554 }
555
556 type AccountReportsSearchCall struct {
557 s *Service
558 urlParams_ gensupport.URLParams
559 ifNoneMatch_ string
560 ctx_ context.Context
561 header_ http.Header
562 }
563
564
565
566
567
568 func (r *AccountReportsService) Search() *AccountReportsSearchCall {
569 c := &AccountReportsSearchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
570 return c
571 }
572
573
574
575
576 func (c *AccountReportsSearchCall) EndDateDay(endDateDay int64) *AccountReportsSearchCall {
577 c.urlParams_.Set("endDate.day", fmt.Sprint(endDateDay))
578 return c
579 }
580
581
582
583 func (c *AccountReportsSearchCall) EndDateMonth(endDateMonth int64) *AccountReportsSearchCall {
584 c.urlParams_.Set("endDate.month", fmt.Sprint(endDateMonth))
585 return c
586 }
587
588
589
590 func (c *AccountReportsSearchCall) EndDateYear(endDateYear int64) *AccountReportsSearchCall {
591 c.urlParams_.Set("endDate.year", fmt.Sprint(endDateYear))
592 return c
593 }
594
595
596
597
598 func (c *AccountReportsSearchCall) PageSize(pageSize int64) *AccountReportsSearchCall {
599 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
600 return c
601 }
602
603
604
605
606 func (c *AccountReportsSearchCall) PageToken(pageToken string) *AccountReportsSearchCall {
607 c.urlParams_.Set("pageToken", pageToken)
608 return c
609 }
610
611
612
613
614
615
616
617
618
619 func (c *AccountReportsSearchCall) Query(query string) *AccountReportsSearchCall {
620 c.urlParams_.Set("query", query)
621 return c
622 }
623
624
625
626
627 func (c *AccountReportsSearchCall) StartDateDay(startDateDay int64) *AccountReportsSearchCall {
628 c.urlParams_.Set("startDate.day", fmt.Sprint(startDateDay))
629 return c
630 }
631
632
633
634 func (c *AccountReportsSearchCall) StartDateMonth(startDateMonth int64) *AccountReportsSearchCall {
635 c.urlParams_.Set("startDate.month", fmt.Sprint(startDateMonth))
636 return c
637 }
638
639
640
641 func (c *AccountReportsSearchCall) StartDateYear(startDateYear int64) *AccountReportsSearchCall {
642 c.urlParams_.Set("startDate.year", fmt.Sprint(startDateYear))
643 return c
644 }
645
646
647
648
649 func (c *AccountReportsSearchCall) Fields(s ...googleapi.Field) *AccountReportsSearchCall {
650 c.urlParams_.Set("fields", googleapi.CombineFields(s))
651 return c
652 }
653
654
655
656
657 func (c *AccountReportsSearchCall) IfNoneMatch(entityTag string) *AccountReportsSearchCall {
658 c.ifNoneMatch_ = entityTag
659 return c
660 }
661
662
663 func (c *AccountReportsSearchCall) Context(ctx context.Context) *AccountReportsSearchCall {
664 c.ctx_ = ctx
665 return c
666 }
667
668
669
670 func (c *AccountReportsSearchCall) Header() http.Header {
671 if c.header_ == nil {
672 c.header_ = make(http.Header)
673 }
674 return c.header_
675 }
676
677 func (c *AccountReportsSearchCall) doRequest(alt string) (*http.Response, error) {
678 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
679 if c.ifNoneMatch_ != "" {
680 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
681 }
682 var body io.Reader = nil
683 c.urlParams_.Set("alt", alt)
684 c.urlParams_.Set("prettyPrint", "false")
685 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/accountReports:search")
686 urls += "?" + c.urlParams_.Encode()
687 req, err := http.NewRequest("GET", urls, body)
688 if err != nil {
689 return nil, err
690 }
691 req.Header = reqHeaders
692 return gensupport.SendRequest(c.ctx_, c.s.client, req)
693 }
694
695
696
697
698
699
700
701 func (c *AccountReportsSearchCall) Do(opts ...googleapi.CallOption) (*GoogleAdsHomeservicesLocalservicesV1SearchAccountReportsResponse, error) {
702 gensupport.SetOptions(c.urlParams_, opts...)
703 res, err := c.doRequest("json")
704 if res != nil && res.StatusCode == http.StatusNotModified {
705 if res.Body != nil {
706 res.Body.Close()
707 }
708 return nil, gensupport.WrapError(&googleapi.Error{
709 Code: res.StatusCode,
710 Header: res.Header,
711 })
712 }
713 if err != nil {
714 return nil, err
715 }
716 defer googleapi.CloseBody(res)
717 if err := googleapi.CheckResponse(res); err != nil {
718 return nil, gensupport.WrapError(err)
719 }
720 ret := &GoogleAdsHomeservicesLocalservicesV1SearchAccountReportsResponse{
721 ServerResponse: googleapi.ServerResponse{
722 Header: res.Header,
723 HTTPStatusCode: res.StatusCode,
724 },
725 }
726 target := &ret
727 if err := gensupport.DecodeResponse(target, res); err != nil {
728 return nil, err
729 }
730 return ret, nil
731 }
732
733
734
735
736 func (c *AccountReportsSearchCall) Pages(ctx context.Context, f func(*GoogleAdsHomeservicesLocalservicesV1SearchAccountReportsResponse) error) error {
737 c.ctx_ = ctx
738 defer c.PageToken(c.urlParams_.Get("pageToken"))
739 for {
740 x, err := c.Do()
741 if err != nil {
742 return err
743 }
744 if err := f(x); err != nil {
745 return err
746 }
747 if x.NextPageToken == "" {
748 return nil
749 }
750 c.PageToken(x.NextPageToken)
751 }
752 }
753
754 type DetailedLeadReportsSearchCall struct {
755 s *Service
756 urlParams_ gensupport.URLParams
757 ifNoneMatch_ string
758 ctx_ context.Context
759 header_ http.Header
760 }
761
762
763
764
765
766 func (r *DetailedLeadReportsService) Search() *DetailedLeadReportsSearchCall {
767 c := &DetailedLeadReportsSearchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
768 return c
769 }
770
771
772
773
774 func (c *DetailedLeadReportsSearchCall) EndDateDay(endDateDay int64) *DetailedLeadReportsSearchCall {
775 c.urlParams_.Set("endDate.day", fmt.Sprint(endDateDay))
776 return c
777 }
778
779
780
781 func (c *DetailedLeadReportsSearchCall) EndDateMonth(endDateMonth int64) *DetailedLeadReportsSearchCall {
782 c.urlParams_.Set("endDate.month", fmt.Sprint(endDateMonth))
783 return c
784 }
785
786
787
788 func (c *DetailedLeadReportsSearchCall) EndDateYear(endDateYear int64) *DetailedLeadReportsSearchCall {
789 c.urlParams_.Set("endDate.year", fmt.Sprint(endDateYear))
790 return c
791 }
792
793
794
795
796 func (c *DetailedLeadReportsSearchCall) PageSize(pageSize int64) *DetailedLeadReportsSearchCall {
797 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
798 return c
799 }
800
801
802
803
804 func (c *DetailedLeadReportsSearchCall) PageToken(pageToken string) *DetailedLeadReportsSearchCall {
805 c.urlParams_.Set("pageToken", pageToken)
806 return c
807 }
808
809
810
811
812
813
814
815
816
817 func (c *DetailedLeadReportsSearchCall) Query(query string) *DetailedLeadReportsSearchCall {
818 c.urlParams_.Set("query", query)
819 return c
820 }
821
822
823
824
825 func (c *DetailedLeadReportsSearchCall) StartDateDay(startDateDay int64) *DetailedLeadReportsSearchCall {
826 c.urlParams_.Set("startDate.day", fmt.Sprint(startDateDay))
827 return c
828 }
829
830
831
832 func (c *DetailedLeadReportsSearchCall) StartDateMonth(startDateMonth int64) *DetailedLeadReportsSearchCall {
833 c.urlParams_.Set("startDate.month", fmt.Sprint(startDateMonth))
834 return c
835 }
836
837
838
839 func (c *DetailedLeadReportsSearchCall) StartDateYear(startDateYear int64) *DetailedLeadReportsSearchCall {
840 c.urlParams_.Set("startDate.year", fmt.Sprint(startDateYear))
841 return c
842 }
843
844
845
846
847 func (c *DetailedLeadReportsSearchCall) Fields(s ...googleapi.Field) *DetailedLeadReportsSearchCall {
848 c.urlParams_.Set("fields", googleapi.CombineFields(s))
849 return c
850 }
851
852
853
854
855 func (c *DetailedLeadReportsSearchCall) IfNoneMatch(entityTag string) *DetailedLeadReportsSearchCall {
856 c.ifNoneMatch_ = entityTag
857 return c
858 }
859
860
861 func (c *DetailedLeadReportsSearchCall) Context(ctx context.Context) *DetailedLeadReportsSearchCall {
862 c.ctx_ = ctx
863 return c
864 }
865
866
867
868 func (c *DetailedLeadReportsSearchCall) Header() http.Header {
869 if c.header_ == nil {
870 c.header_ = make(http.Header)
871 }
872 return c.header_
873 }
874
875 func (c *DetailedLeadReportsSearchCall) doRequest(alt string) (*http.Response, error) {
876 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
877 if c.ifNoneMatch_ != "" {
878 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
879 }
880 var body io.Reader = nil
881 c.urlParams_.Set("alt", alt)
882 c.urlParams_.Set("prettyPrint", "false")
883 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/detailedLeadReports:search")
884 urls += "?" + c.urlParams_.Encode()
885 req, err := http.NewRequest("GET", urls, body)
886 if err != nil {
887 return nil, err
888 }
889 req.Header = reqHeaders
890 return gensupport.SendRequest(c.ctx_, c.s.client, req)
891 }
892
893
894
895
896
897
898
899 func (c *DetailedLeadReportsSearchCall) Do(opts ...googleapi.CallOption) (*GoogleAdsHomeservicesLocalservicesV1SearchDetailedLeadReportsResponse, error) {
900 gensupport.SetOptions(c.urlParams_, opts...)
901 res, err := c.doRequest("json")
902 if res != nil && res.StatusCode == http.StatusNotModified {
903 if res.Body != nil {
904 res.Body.Close()
905 }
906 return nil, gensupport.WrapError(&googleapi.Error{
907 Code: res.StatusCode,
908 Header: res.Header,
909 })
910 }
911 if err != nil {
912 return nil, err
913 }
914 defer googleapi.CloseBody(res)
915 if err := googleapi.CheckResponse(res); err != nil {
916 return nil, gensupport.WrapError(err)
917 }
918 ret := &GoogleAdsHomeservicesLocalservicesV1SearchDetailedLeadReportsResponse{
919 ServerResponse: googleapi.ServerResponse{
920 Header: res.Header,
921 HTTPStatusCode: res.StatusCode,
922 },
923 }
924 target := &ret
925 if err := gensupport.DecodeResponse(target, res); err != nil {
926 return nil, err
927 }
928 return ret, nil
929 }
930
931
932
933
934 func (c *DetailedLeadReportsSearchCall) Pages(ctx context.Context, f func(*GoogleAdsHomeservicesLocalservicesV1SearchDetailedLeadReportsResponse) error) error {
935 c.ctx_ = ctx
936 defer c.PageToken(c.urlParams_.Get("pageToken"))
937 for {
938 x, err := c.Do()
939 if err != nil {
940 return err
941 }
942 if err := f(x); err != nil {
943 return err
944 }
945 if x.NextPageToken == "" {
946 return nil
947 }
948 c.PageToken(x.NextPageToken)
949 }
950 }
951
View as plain text