Debian Codegraph @

localservices/v1/localservices-gen.go

raw
1 // Copyright 2026 Google LLC.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // Code generated file. DO NOT EDIT.
6
7 // Package localservices provides access to the Local Services API.
8 //
9 // For product documentation, see: https://ads.google.com/local-services-ads/
10 //
11 // # Library status
12 //
13 // These client libraries are officially supported by Google. However, this
14 // library is considered complete and is in maintenance mode. This means
15 // that we will address critical bugs and security issues but will not add
16 // any new features.
17 //
18 // When possible, we recommend using our newer
19 // [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go)
20 // that are still actively being worked and iterated on.
21 //
22 // # Creating a client
23 //
24 // Usage example:
25 //
26 // import "google.golang.org/api/localservices/v1"
27 // ...
28 // ctx := context.Background()
29 // localservicesService, err := localservices.NewService(ctx)
30 //
31 // In this example, Google Application Default Credentials are used for
32 // authentication. For information on how to create and obtain Application
33 // Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
34 //
35 // # Other authentication options
36 //
37 // To use an API key for authentication (note: some APIs do not support API
38 // keys), use [google.golang.org/api/option.WithAPIKey]:
39 //
40 // localservicesService, err := localservices.NewService(ctx, option.WithAPIKey("AIza..."))
41 //
42 // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth
43 // flow, use [google.golang.org/api/option.WithTokenSource]:
44 //
45 // config := &oauth2.Config{...}
46 // // ...
47 // token, err := config.Exchange(ctx, ...)
48 // localservicesService, err := localservices.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
49 //
50 // See [google.golang.org/api/option.ClientOption] for details on options.
51 package localservices // import "google.golang.org/api/localservices/v1"
52
53 import (
54 "bytes"
55 "context"
56 "encoding/json"
57 "errors"
58 "fmt"
59 "io"
60 "log/slog"
61 "net/http"
62 "net/url"
63 "strconv"
64 "strings"
65
66 "github.com/googleapis/gax-go/v2/internallog"
67 googleapi "google.golang.org/api/googleapi"
68 internal "google.golang.org/api/internal"
69 gensupport "google.golang.org/api/internal/gensupport"
70 option "google.golang.org/api/option"
71 internaloption "google.golang.org/api/option/internaloption"
72 htransport "google.golang.org/api/transport/http"
73 )
74
75 // Always reference these packages, just in case the auto-generated code
76 // below doesn't.
77 var _ = bytes.NewBuffer
78 var _ = strconv.Itoa
79 var _ = fmt.Sprintf
80 var _ = json.NewDecoder
81 var _ = io.Copy
82 var _ = url.Parse
83 var _ = gensupport.MarshalJSON
84 var _ = googleapi.Version
85 var _ = errors.New
86 var _ = strings.Replace
87 var _ = context.Canceled
88 var _ = internaloption.WithDefaultEndpoint
89 var _ = internal.Version
90 var _ = internallog.New
91
92 const apiId = "localservices:v1"
93 const apiName = "localservices"
94 const apiVersion = "v1"
95 const basePath = "https://localservices.googleapis.com/"
96 const basePathTemplate = "https://localservices.UNIVERSE_DOMAIN/"
97 const mtlsBasePath = "https://localservices.mtls.googleapis.com/"
98
99 // OAuth2 scopes used by this API.
100 const (
101 // See, edit, create, and delete your Google Ads accounts and data.
102 AdwordsScope = "https://www.googleapis.com/auth/adwords"
103 )
104
105 // NewService creates a new Service.
106 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
107 scopesOption := internaloption.WithDefaultScopes(
108 "https://www.googleapis.com/auth/adwords",
109 )
110 // NOTE: prepend, so we don't override user-specified scopes.
111 opts = append([]option.ClientOption{scopesOption}, opts...)
112 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
113 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
114 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
115 opts = append(opts, internaloption.EnableNewAuthLibrary())
116 client, endpoint, err := htransport.NewClient(ctx, opts...)
117 if err != nil {
118 return nil, err
119 }
120 s := &Service{client: client, BasePath: basePath, logger: internaloption.GetLogger(opts)}
121 s.AccountReports = NewAccountReportsService(s)
122 s.DetailedLeadReports = NewDetailedLeadReportsService(s)
123 if endpoint != "" {
124 s.BasePath = endpoint
125 }
126 return s, nil
127 }
128
129 // New creates a new Service. It uses the provided http.Client for requests.
130 //
131 // Deprecated: please use NewService instead.
132 // To provide a custom HTTP client, use option.WithHTTPClient.
133 // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
134 func New(client *http.Client) (*Service, error) {
135 if client == nil {
136 return nil, errors.New("client is nil")
137 }
138 return NewService(context.TODO(), option.WithHTTPClient(client))
139 }
140
141 type Service struct {
142 client *http.Client
143 logger *slog.Logger
144 BasePath string // API endpoint base URL
145 UserAgent string // optional additional User-Agent fragment
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 // GoogleAdsHomeservicesLocalservicesV1AccountReport: An Account Report of a
178 // GLS account identified by their account id containing aggregate data
179 // gathered from a particular date range. Next ID: 18
180 type GoogleAdsHomeservicesLocalservicesV1AccountReport struct {
181 // AccountId: Unique identifier of the GLS account.
182 AccountId int64 `json:"accountId,omitempty,string"`
183 // AggregatorInfo: Aggregator specific information related to the account.
184 AggregatorInfo *GoogleAdsHomeservicesLocalservicesV1AggregatorInfo `json:"aggregatorInfo,omitempty"`
185 // AverageFiveStarRating: Average review rating score from 1-5 stars.
186 AverageFiveStarRating float64 `json:"averageFiveStarRating,omitempty"`
187 // AverageWeeklyBudget: Average weekly budget in the currency code of the
188 // account.
189 AverageWeeklyBudget float64 `json:"averageWeeklyBudget,omitempty"`
190 // BusinessName: Business name of the account.
191 BusinessName string `json:"businessName,omitempty"`
192 // CurrencyCode: Currency code of the account.
193 CurrencyCode string `json:"currencyCode,omitempty"`
194 // CurrentPeriodChargedLeads: Number of charged leads the account received in
195 // current specified period.
196 CurrentPeriodChargedLeads int64 `json:"currentPeriodChargedLeads,omitempty,string"`
197 // CurrentPeriodConnectedPhoneCalls: Number of connected phone calls (duration
198 // over 30s) in current specified period.
199 CurrentPeriodConnectedPhoneCalls int64 `json:"currentPeriodConnectedPhoneCalls,omitempty,string"`
200 // CurrentPeriodPhoneCalls: Number of phone calls in current specified period,
201 // including both connected and unconnected calls.
202 CurrentPeriodPhoneCalls int64 `json:"currentPeriodPhoneCalls,omitempty,string"`
203 // CurrentPeriodTotalCost: Total cost of the account in current specified
204 // period in the account's specified currency.
205 CurrentPeriodTotalCost float64 `json:"currentPeriodTotalCost,omitempty"`
206 // ImpressionsLastTwoDays: Number of impressions that customers have had in the
207 // past 2 days.
208 ImpressionsLastTwoDays int64 `json:"impressionsLastTwoDays,omitempty,string"`
209 // PhoneLeadResponsiveness: Phone lead responsiveness of the account for the
210 // past 90 days from current date. This is computed by taking the total number
211 // of connected calls from charged phone leads and dividing by the total number
212 // of calls received.
213 PhoneLeadResponsiveness float64 `json:"phoneLeadResponsiveness,omitempty"`
214 // PreviousPeriodChargedLeads: Number of charged leads the account received in
215 // previous specified period.
216 PreviousPeriodChargedLeads int64 `json:"previousPeriodChargedLeads,omitempty,string"`
217 // PreviousPeriodConnectedPhoneCalls: Number of connected phone calls (duration
218 // over 30s) in previous specified period.
219 PreviousPeriodConnectedPhoneCalls int64 `json:"previousPeriodConnectedPhoneCalls,omitempty,string"`
220 // PreviousPeriodPhoneCalls: Number of phone calls in previous specified
221 // period, including both connected and unconnected calls.
222 PreviousPeriodPhoneCalls int64 `json:"previousPeriodPhoneCalls,omitempty,string"`
223 // PreviousPeriodTotalCost: Total cost of the account in previous specified
224 // period in the account's specified currency.
225 PreviousPeriodTotalCost float64 `json:"previousPeriodTotalCost,omitempty"`
226 // TotalReview: Total number of reviews the account has up to current date.
227 TotalReview int64 `json:"totalReview,omitempty"`
228 // ForceSendFields is a list of field names (e.g. "AccountId") to
229 // unconditionally include in API requests. By default, fields with empty or
230 // default values are omitted from API requests. See
231 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
232 // details.
233 ForceSendFields []string `json:"-"`
234 // NullFields is a list of field names (e.g. "AccountId") to include in API
235 // requests with the JSON null value. By default, fields with empty values are
236 // omitted from API requests. See
237 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
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 // GoogleAdsHomeservicesLocalservicesV1AggregatorInfo: Conatiner for aggregator
269 // specific information if lead is for an aggregator GLS account.
270 type GoogleAdsHomeservicesLocalservicesV1AggregatorInfo struct {
271 // AggregatorProviderId: Provider id (listed in aggregator system) which maps
272 // to a account id in GLS system.
273 AggregatorProviderId string `json:"aggregatorProviderId,omitempty"`
274 // ForceSendFields is a list of field names (e.g. "AggregatorProviderId") to
275 // unconditionally include in API requests. By default, fields with empty or
276 // default values are omitted from API requests. See
277 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
278 // details.
279 ForceSendFields []string `json:"-"`
280 // NullFields is a list of field names (e.g. "AggregatorProviderId") to include
281 // in API requests with the JSON null value. By default, fields with empty
282 // values are omitted from API requests. See
283 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
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 // GoogleAdsHomeservicesLocalservicesV1BookingLead: Container for booking lead
293 // specific information.
294 type GoogleAdsHomeservicesLocalservicesV1BookingLead struct {
295 // BookingAppointmentTimestamp: Timestamp of when service is provided by
296 // advertiser.
297 BookingAppointmentTimestamp string `json:"bookingAppointmentTimestamp,omitempty"`
298 // ConsumerEmail: Consumer email associated with the booking lead.
299 ConsumerEmail string `json:"consumerEmail,omitempty"`
300 // ConsumerPhoneNumber: Consumer phone number associated with the booking lead.
301 ConsumerPhoneNumber string `json:"consumerPhoneNumber,omitempty"`
302 // CustomerName: Name of the customer who created the lead.
303 CustomerName string `json:"customerName,omitempty"`
304 // JobType: The job type of the specified lead.
305 JobType string `json:"jobType,omitempty"`
306 // ForceSendFields is a list of field names (e.g.
307 // "BookingAppointmentTimestamp") to unconditionally include in API requests.
308 // By default, fields with empty or default values are omitted from API
309 // requests. See https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields
310 // for more details.
311 ForceSendFields []string `json:"-"`
312 // NullFields is a list of field names (e.g. "BookingAppointmentTimestamp") to
313 // include in API requests with the JSON null value. By default, fields with
314 // empty values are omitted from API requests. See
315 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
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 // GoogleAdsHomeservicesLocalservicesV1DetailedLeadReport: A Detailed Lead
325 // Report of a lead identified by their lead id and contains consumer, account,
326 // monetization, and lead data.
327 type GoogleAdsHomeservicesLocalservicesV1DetailedLeadReport struct {
328 // AccountId: Identifies account that received the lead.
329 AccountId int64 `json:"accountId,omitempty,string"`
330 // AggregatorInfo: Aggregator specific information related to the lead.
331 AggregatorInfo *GoogleAdsHomeservicesLocalservicesV1AggregatorInfo `json:"aggregatorInfo,omitempty"`
332 // BookingLead: More information associated to only booking leads.
333 BookingLead *GoogleAdsHomeservicesLocalservicesV1BookingLead `json:"bookingLead,omitempty"`
334 // BusinessName: Business name associated to the account.
335 BusinessName string `json:"businessName,omitempty"`
336 // ChargeStatus: Whether the lead has been charged.
337 //
338 // Possible values:
339 // "CHARGE_STATUS_UNSPECIFIED" - Not specified.
340 // "CHARGED" - Charged.
341 // "NOT_CHARGED" - Not charged.
342 ChargeStatus string `json:"chargeStatus,omitempty"`
343 // CurrencyCode: Currency code.
344 CurrencyCode string `json:"currencyCode,omitempty"`
345 // DisputeStatus: Dispute status related to the lead.
346 DisputeStatus string `json:"disputeStatus,omitempty"`
347 // Geo: Location of the associated account's home city.
348 Geo string `json:"geo,omitempty"`
349 // GoogleAdsLeadId: Unique identifier of a Detailed Lead Report.
350 GoogleAdsLeadId int64 `json:"googleAdsLeadId,omitempty,string"`
351 // LeadCategory: Lead category (e.g. hvac, plumber)
352 LeadCategory string `json:"leadCategory,omitempty"`
353 // LeadCreationTimestamp: Timestamp of when the lead was created.
354 LeadCreationTimestamp string `json:"leadCreationTimestamp,omitempty"`
355 // LeadId: Deprecated in favor of google_ads_lead_id. Unique identifier of a
356 // Detailed Lead Report.
357 LeadId int64 `json:"leadId,omitempty,string"`
358 // LeadPrice: Price of the lead (available only after it has been charged).
359 LeadPrice float64 `json:"leadPrice,omitempty"`
360 // LeadType: Lead type.
361 //
362 // Possible values:
363 // "LEAD_TYPE_UNSPECIFIED" - Not specified.
364 // "MESSAGE" - Message lead.
365 // "PHONE_CALL" - Phone call lead.
366 // "BOOKING" - Booking lead.
367 LeadType string `json:"leadType,omitempty"`
368 // MessageLead: More information associated to only message leads.
369 MessageLead *GoogleAdsHomeservicesLocalservicesV1MessageLead `json:"messageLead,omitempty"`
370 // PhoneLead: More information associated to only phone leads.
371 PhoneLead *GoogleAdsHomeservicesLocalservicesV1PhoneLead `json:"phoneLead,omitempty"`
372 // Timezone: Timezone of the particular provider associated to a lead.
373 Timezone *GoogleTypeTimeZone `json:"timezone,omitempty"`
374 // ForceSendFields is a list of field names (e.g. "AccountId") to
375 // unconditionally include in API requests. By default, fields with empty or
376 // default values are omitted from API requests. See
377 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
378 // details.
379 ForceSendFields []string `json:"-"`
380 // NullFields is a list of field names (e.g. "AccountId") to include in API
381 // requests with the JSON null value. By default, fields with empty values are
382 // omitted from API requests. See
383 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
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 // GoogleAdsHomeservicesLocalservicesV1MessageLead: Container for message lead
407 // specific information.
408 type GoogleAdsHomeservicesLocalservicesV1MessageLead struct {
409 // ConsumerPhoneNumber: Consumer phone number associated with the message lead.
410 ConsumerPhoneNumber string `json:"consumerPhoneNumber,omitempty"`
411 // CustomerName: Name of the customer who created the lead.
412 CustomerName string `json:"customerName,omitempty"`
413 // JobType: The job type of the specified lead.
414 JobType string `json:"jobType,omitempty"`
415 // PostalCode: The postal code of the customer who created the lead.
416 PostalCode string `json:"postalCode,omitempty"`
417 // ForceSendFields is a list of field names (e.g. "ConsumerPhoneNumber") to
418 // unconditionally include in API requests. By default, fields with empty or
419 // default values are omitted from API requests. See
420 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
421 // details.
422 ForceSendFields []string `json:"-"`
423 // NullFields is a list of field names (e.g. "ConsumerPhoneNumber") to include
424 // in API requests with the JSON null value. By default, fields with empty
425 // values are omitted from API requests. See
426 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
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 // GoogleAdsHomeservicesLocalservicesV1PhoneLead: Container for phone lead
436 // specific information.
437 type GoogleAdsHomeservicesLocalservicesV1PhoneLead struct {
438 // ChargedCallTimestamp: Timestamp of the phone call which resulted in a
439 // charged phone lead.
440 ChargedCallTimestamp string `json:"chargedCallTimestamp,omitempty"`
441 // ChargedConnectedCallDurationSeconds: Duration of the charged phone call in
442 // seconds.
443 ChargedConnectedCallDurationSeconds string `json:"chargedConnectedCallDurationSeconds,omitempty"`
444 // ConsumerPhoneNumber: Consumer phone number associated with the phone lead.
445 ConsumerPhoneNumber string `json:"consumerPhoneNumber,omitempty"`
446 // ForceSendFields is a list of field names (e.g. "ChargedCallTimestamp") to
447 // unconditionally include in API requests. By default, fields with empty or
448 // default values are omitted from API requests. See
449 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
450 // details.
451 ForceSendFields []string `json:"-"`
452 // NullFields is a list of field names (e.g. "ChargedCallTimestamp") to include
453 // in API requests with the JSON null value. By default, fields with empty
454 // values are omitted from API requests. See
455 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
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 // GoogleAdsHomeservicesLocalservicesV1SearchAccountReportsResponse: A page of
465 // the response received from the SearchAccountReports method. A paginated
466 // response where more pages are available has `next_page_token` set. This
467 // token can be used in a subsequent request to retrieve the next request page.
468 type GoogleAdsHomeservicesLocalservicesV1SearchAccountReportsResponse struct {
469 // AccountReports: List of account reports which maps 1:1 to a particular
470 // linked GLS account.
471 AccountReports []*GoogleAdsHomeservicesLocalservicesV1AccountReport `json:"accountReports,omitempty"`
472 // NextPageToken: Pagination token to retrieve the next page of results. When
473 // `next_page_token` is not filled in, there is no next page and the list
474 // returned is the last page in the result set.
475 NextPageToken string `json:"nextPageToken,omitempty"`
476
477 // ServerResponse contains the HTTP response code and headers from the server.
478 googleapi.ServerResponse `json:"-"`
479 // ForceSendFields is a list of field names (e.g. "AccountReports") to
480 // unconditionally include in API requests. By default, fields with empty or
481 // default values are omitted from API requests. See
482 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
483 // details.
484 ForceSendFields []string `json:"-"`
485 // NullFields is a list of field names (e.g. "AccountReports") to include in
486 // API requests with the JSON null value. By default, fields with empty values
487 // are omitted from API requests. See
488 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
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 // GoogleAdsHomeservicesLocalservicesV1SearchDetailedLeadReportsResponse: A
498 // page of the response received from the SearchDetailedLeadReports method. A
499 // paginated response where more pages are available has `next_page_token` set.
500 // This token can be used in a subsequent request to retrieve the next request
501 // page.
502 type GoogleAdsHomeservicesLocalservicesV1SearchDetailedLeadReportsResponse struct {
503 // DetailedLeadReports: List of detailed lead reports uniquely identified by
504 // external lead id.
505 DetailedLeadReports []*GoogleAdsHomeservicesLocalservicesV1DetailedLeadReport `json:"detailedLeadReports,omitempty"`
506 // NextPageToken: Pagination token to retrieve the next page of results. When
507 // `next_page_token` is not filled in, there is no next page and the list
508 // returned is the last page in the result set.
509 NextPageToken string `json:"nextPageToken,omitempty"`
510
511 // ServerResponse contains the HTTP response code and headers from the server.
512 googleapi.ServerResponse `json:"-"`
513 // ForceSendFields is a list of field names (e.g. "DetailedLeadReports") to
514 // unconditionally include in API requests. By default, fields with empty or
515 // default values are omitted from API requests. See
516 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
517 // details.
518 ForceSendFields []string `json:"-"`
519 // NullFields is a list of field names (e.g. "DetailedLeadReports") to include
520 // in API requests with the JSON null value. By default, fields with empty
521 // values are omitted from API requests. See
522 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
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 // GoogleTypeTimeZone: Represents a time zone from the IANA Time Zone Database
532 // (https://www.iana.org/time-zones).
533 type GoogleTypeTimeZone struct {
534 // Id: IANA Time Zone Database time zone. For example "America/New_York".
535 Id string `json:"id,omitempty"`
536 // Version: Optional. IANA Time Zone Database version number. For example
537 // "2019a".
538 Version string `json:"version,omitempty"`
539 // ForceSendFields is a list of field names (e.g. "Id") to unconditionally
540 // include in API requests. By default, fields with empty or default values are
541 // omitted from API requests. See
542 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
543 // details.
544 ForceSendFields []string `json:"-"`
545 // NullFields is a list of field names (e.g. "Id") to include in API requests
546 // with the JSON null value. By default, fields with empty values are omitted
547 // from API requests. See
548 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
549 NullFields []string `json:"-"`
550 }
551
552 func (s GoogleTypeTimeZone) MarshalJSON() ([]byte, error) {
553 type NoMethod GoogleTypeTimeZone
554 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
555 }
556
557 type AccountReportsSearchCall struct {
558 s *Service
559 urlParams_ gensupport.URLParams
560 ifNoneMatch_ string
561 ctx_ context.Context
562 header_ http.Header
563 }
564
565 // Search: Get account reports containing aggregate account data of all linked
566 // GLS accounts. Caller needs to provide their manager customer id and the
567 // associated auth credential that allows them read permissions on their linked
568 // accounts.
569 func (r *AccountReportsService) Search() *AccountReportsSearchCall {
570 c := &AccountReportsSearchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
571 return c
572 }
573
574 // EndDateDay sets the optional parameter "endDate.day": Day of a month. Must
575 // be from 1 to 31 and valid for the year and month, or 0 to specify a year by
576 // itself or a year and month where the day isn't significant.
577 func (c *AccountReportsSearchCall) EndDateDay(endDateDay int64) *AccountReportsSearchCall {
578 c.urlParams_.Set("endDate.day", fmt.Sprint(endDateDay))
579 return c
580 }
581
582 // EndDateMonth sets the optional parameter "endDate.month": Month of a year.
583 // Must be from 1 to 12, or 0 to specify a year without a month and day.
584 func (c *AccountReportsSearchCall) EndDateMonth(endDateMonth int64) *AccountReportsSearchCall {
585 c.urlParams_.Set("endDate.month", fmt.Sprint(endDateMonth))
586 return c
587 }
588
589 // EndDateYear sets the optional parameter "endDate.year": Year of the date.
590 // Must be from 1 to 9999, or 0 to specify a date without a year.
591 func (c *AccountReportsSearchCall) EndDateYear(endDateYear int64) *AccountReportsSearchCall {
592 c.urlParams_.Set("endDate.year", fmt.Sprint(endDateYear))
593 return c
594 }
595
596 // PageSize sets the optional parameter "pageSize": The maximum number of
597 // accounts to return. If the page size is unset, page size will default to
598 // 1000. Maximum page_size is 10000.
599 func (c *AccountReportsSearchCall) PageSize(pageSize int64) *AccountReportsSearchCall {
600 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
601 return c
602 }
603
604 // PageToken sets the optional parameter "pageToken": The `next_page_token`
605 // value returned from a previous request to SearchAccountReports that
606 // indicates where listing should continue.
607 func (c *AccountReportsSearchCall) PageToken(pageToken string) *AccountReportsSearchCall {
608 c.urlParams_.Set("pageToken", pageToken)
609 return c
610 }
611
612 // Query sets the optional parameter "query": A query string for searching for
613 // account reports. Caller must provide a customer id of their MCC account with
614 // an associated Gaia Mint that allows read permission on their linked
615 // accounts. Search expressions are case insensitive. Example query: | Query |
616 // Description |
617 // |-------------------------|-----------------------------------------------|
618 // | manager_customer_id:123 | Get Account Report for Manager with id 123. |
619 // Required.
620 func (c *AccountReportsSearchCall) Query(query string) *AccountReportsSearchCall {
621 c.urlParams_.Set("query", query)
622 return c
623 }
624
625 // StartDateDay sets the optional parameter "startDate.day": Day of a month.
626 // Must be from 1 to 31 and valid for the year and month, or 0 to specify a
627 // year by itself or a year and month where the day isn't significant.
628 func (c *AccountReportsSearchCall) StartDateDay(startDateDay int64) *AccountReportsSearchCall {
629 c.urlParams_.Set("startDate.day", fmt.Sprint(startDateDay))
630 return c
631 }
632
633 // StartDateMonth sets the optional parameter "startDate.month": Month of a
634 // year. Must be from 1 to 12, or 0 to specify a year without a month and day.
635 func (c *AccountReportsSearchCall) StartDateMonth(startDateMonth int64) *AccountReportsSearchCall {
636 c.urlParams_.Set("startDate.month", fmt.Sprint(startDateMonth))
637 return c
638 }
639
640 // StartDateYear sets the optional parameter "startDate.year": Year of the
641 // date. Must be from 1 to 9999, or 0 to specify a date without a year.
642 func (c *AccountReportsSearchCall) StartDateYear(startDateYear int64) *AccountReportsSearchCall {
643 c.urlParams_.Set("startDate.year", fmt.Sprint(startDateYear))
644 return c
645 }
646
647 // Fields allows partial responses to be retrieved. See
648 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
649 // details.
650 func (c *AccountReportsSearchCall) Fields(s ...googleapi.Field) *AccountReportsSearchCall {
651 c.urlParams_.Set("fields", googleapi.CombineFields(s))
652 return c
653 }
654
655 // IfNoneMatch sets an optional parameter which makes the operation fail if the
656 // object's ETag matches the given value. This is useful for getting updates
657 // only after the object has changed since the last request.
658 func (c *AccountReportsSearchCall) IfNoneMatch(entityTag string) *AccountReportsSearchCall {
659 c.ifNoneMatch_ = entityTag
660 return c
661 }
662
663 // Context sets the context to be used in this call's Do method.
664 func (c *AccountReportsSearchCall) Context(ctx context.Context) *AccountReportsSearchCall {
665 c.ctx_ = ctx
666 return c
667 }
668
669 // Header returns a http.Header that can be modified by the caller to add
670 // headers to the request.
671 func (c *AccountReportsSearchCall) Header() http.Header {
672 if c.header_ == nil {
673 c.header_ = make(http.Header)
674 }
675 return c.header_
676 }
677
678 func (c *AccountReportsSearchCall) doRequest(alt string) (*http.Response, error) {
679 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
680 if c.ifNoneMatch_ != "" {
681 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
682 }
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, nil)
688 if err != nil {
689 return nil, err
690 }
691 req.Header = reqHeaders
692 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "localservices.accountReports.search", "request", internallog.HTTPRequest(req, nil))
693 return gensupport.SendRequest(c.ctx_, c.s.client, req)
694 }
695
696 // Do executes the "localservices.accountReports.search" call.
697 // Any non-2xx status code is an error. Response headers are in either
698 // *GoogleAdsHomeservicesLocalservicesV1SearchAccountReportsResponse.ServerRespo
699 // nse.Header or (if a response was returned at all) in
700 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
701 // whether the returned error was because http.StatusNotModified was returned.
702 func (c *AccountReportsSearchCall) Do(opts ...googleapi.CallOption) (*GoogleAdsHomeservicesLocalservicesV1SearchAccountReportsResponse, error) {
703 gensupport.SetOptions(c.urlParams_, opts...)
704 res, err := c.doRequest("json")
705 if res != nil && res.StatusCode == http.StatusNotModified {
706 if res.Body != nil {
707 res.Body.Close()
708 }
709 return nil, gensupport.WrapError(&googleapi.Error{
710 Code: res.StatusCode,
711 Header: res.Header,
712 })
713 }
714 if err != nil {
715 return nil, err
716 }
717 defer googleapi.CloseBody(res)
718 if err := googleapi.CheckResponse(res); err != nil {
719 return nil, gensupport.WrapError(err)
720 }
721 ret := &GoogleAdsHomeservicesLocalservicesV1SearchAccountReportsResponse{
722 ServerResponse: googleapi.ServerResponse{
723 Header: res.Header,
724 HTTPStatusCode: res.StatusCode,
725 },
726 }
727 target := &ret
728 b, err := gensupport.DecodeResponseBytes(target, res)
729 if err != nil {
730 return nil, err
731 }
732 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "localservices.accountReports.search", "response", internallog.HTTPResponse(res, b))
733 return ret, nil
734 }
735
736 // Pages invokes f for each page of results.
737 // A non-nil error returned from f will halt the iteration.
738 // The provided context supersedes any context provided to the Context method.
739 func (c *AccountReportsSearchCall) Pages(ctx context.Context, f func(*GoogleAdsHomeservicesLocalservicesV1SearchAccountReportsResponse) error) error {
740 c.ctx_ = ctx
741 defer c.PageToken(c.urlParams_.Get("pageToken"))
742 for {
743 x, err := c.Do()
744 if err != nil {
745 return err
746 }
747 if err := f(x); err != nil {
748 return err
749 }
750 if x.NextPageToken == "" {
751 return nil
752 }
753 c.PageToken(x.NextPageToken)
754 }
755 }
756
757 type DetailedLeadReportsSearchCall struct {
758 s *Service
759 urlParams_ gensupport.URLParams
760 ifNoneMatch_ string
761 ctx_ context.Context
762 header_ http.Header
763 }
764
765 // Search: Get detailed lead reports containing leads that have been received
766 // by all linked GLS accounts. Caller needs to provide their manager customer
767 // id and the associated auth credential that allows them read permissions on
768 // their linked accounts.
769 func (r *DetailedLeadReportsService) Search() *DetailedLeadReportsSearchCall {
770 c := &DetailedLeadReportsSearchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
771 return c
772 }
773
774 // EndDateDay sets the optional parameter "endDate.day": Day of a month. Must
775 // be from 1 to 31 and valid for the year and month, or 0 to specify a year by
776 // itself or a year and month where the day isn't significant.
777 func (c *DetailedLeadReportsSearchCall) EndDateDay(endDateDay int64) *DetailedLeadReportsSearchCall {
778 c.urlParams_.Set("endDate.day", fmt.Sprint(endDateDay))
779 return c
780 }
781
782 // EndDateMonth sets the optional parameter "endDate.month": Month of a year.
783 // Must be from 1 to 12, or 0 to specify a year without a month and day.
784 func (c *DetailedLeadReportsSearchCall) EndDateMonth(endDateMonth int64) *DetailedLeadReportsSearchCall {
785 c.urlParams_.Set("endDate.month", fmt.Sprint(endDateMonth))
786 return c
787 }
788
789 // EndDateYear sets the optional parameter "endDate.year": Year of the date.
790 // Must be from 1 to 9999, or 0 to specify a date without a year.
791 func (c *DetailedLeadReportsSearchCall) EndDateYear(endDateYear int64) *DetailedLeadReportsSearchCall {
792 c.urlParams_.Set("endDate.year", fmt.Sprint(endDateYear))
793 return c
794 }
795
796 // PageSize sets the optional parameter "pageSize": The maximum number of
797 // accounts to return. If the page size is unset, page size will default to
798 // 1000. Maximum page_size is 10000.
799 func (c *DetailedLeadReportsSearchCall) PageSize(pageSize int64) *DetailedLeadReportsSearchCall {
800 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
801 return c
802 }
803
804 // PageToken sets the optional parameter "pageToken": The `next_page_token`
805 // value returned from a previous request to SearchDetailedLeadReports that
806 // indicates where listing should continue.
807 func (c *DetailedLeadReportsSearchCall) PageToken(pageToken string) *DetailedLeadReportsSearchCall {
808 c.urlParams_.Set("pageToken", pageToken)
809 return c
810 }
811
812 // Query sets the optional parameter "query": A query string for searching for
813 // account reports. Caller must provide a customer id of their MCC account with
814 // an associated Gaia Mint that allows read permission on their linked
815 // accounts. Search expressions are case insensitive. Example query: | Query |
816 // Description |
817 // |-------------------------|-----------------------------------------------|
818 // | manager_customer_id:123 | Get Detailed Lead Report for Manager with id | |
819 // | 123. | Required.
820 func (c *DetailedLeadReportsSearchCall) Query(query string) *DetailedLeadReportsSearchCall {
821 c.urlParams_.Set("query", query)
822 return c
823 }
824
825 // StartDateDay sets the optional parameter "startDate.day": Day of a month.
826 // Must be from 1 to 31 and valid for the year and month, or 0 to specify a
827 // year by itself or a year and month where the day isn't significant.
828 func (c *DetailedLeadReportsSearchCall) StartDateDay(startDateDay int64) *DetailedLeadReportsSearchCall {
829 c.urlParams_.Set("startDate.day", fmt.Sprint(startDateDay))
830 return c
831 }
832
833 // StartDateMonth sets the optional parameter "startDate.month": Month of a
834 // year. Must be from 1 to 12, or 0 to specify a year without a month and day.
835 func (c *DetailedLeadReportsSearchCall) StartDateMonth(startDateMonth int64) *DetailedLeadReportsSearchCall {
836 c.urlParams_.Set("startDate.month", fmt.Sprint(startDateMonth))
837 return c
838 }
839
840 // StartDateYear sets the optional parameter "startDate.year": Year of the
841 // date. Must be from 1 to 9999, or 0 to specify a date without a year.
842 func (c *DetailedLeadReportsSearchCall) StartDateYear(startDateYear int64) *DetailedLeadReportsSearchCall {
843 c.urlParams_.Set("startDate.year", fmt.Sprint(startDateYear))
844 return c
845 }
846
847 // Fields allows partial responses to be retrieved. See
848 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
849 // details.
850 func (c *DetailedLeadReportsSearchCall) Fields(s ...googleapi.Field) *DetailedLeadReportsSearchCall {
851 c.urlParams_.Set("fields", googleapi.CombineFields(s))
852 return c
853 }
854
855 // IfNoneMatch sets an optional parameter which makes the operation fail if the
856 // object's ETag matches the given value. This is useful for getting updates
857 // only after the object has changed since the last request.
858 func (c *DetailedLeadReportsSearchCall) IfNoneMatch(entityTag string) *DetailedLeadReportsSearchCall {
859 c.ifNoneMatch_ = entityTag
860 return c
861 }
862
863 // Context sets the context to be used in this call's Do method.
864 func (c *DetailedLeadReportsSearchCall) Context(ctx context.Context) *DetailedLeadReportsSearchCall {
865 c.ctx_ = ctx
866 return c
867 }
868
869 // Header returns a http.Header that can be modified by the caller to add
870 // headers to the request.
871 func (c *DetailedLeadReportsSearchCall) Header() http.Header {
872 if c.header_ == nil {
873 c.header_ = make(http.Header)
874 }
875 return c.header_
876 }
877
878 func (c *DetailedLeadReportsSearchCall) doRequest(alt string) (*http.Response, error) {
879 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
880 if c.ifNoneMatch_ != "" {
881 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
882 }
883 c.urlParams_.Set("alt", alt)
884 c.urlParams_.Set("prettyPrint", "false")
885 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/detailedLeadReports:search")
886 urls += "?" + c.urlParams_.Encode()
887 req, err := http.NewRequest("GET", urls, nil)
888 if err != nil {
889 return nil, err
890 }
891 req.Header = reqHeaders
892 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "localservices.detailedLeadReports.search", "request", internallog.HTTPRequest(req, nil))
893 return gensupport.SendRequest(c.ctx_, c.s.client, req)
894 }
895
896 // Do executes the "localservices.detailedLeadReports.search" call.
897 // Any non-2xx status code is an error. Response headers are in either
898 // *GoogleAdsHomeservicesLocalservicesV1SearchDetailedLeadReportsResponse.Server
899 // Response.Header or (if a response was returned at all) in
900 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
901 // whether the returned error was because http.StatusNotModified was returned.
902 func (c *DetailedLeadReportsSearchCall) Do(opts ...googleapi.CallOption) (*GoogleAdsHomeservicesLocalservicesV1SearchDetailedLeadReportsResponse, error) {
903 gensupport.SetOptions(c.urlParams_, opts...)
904 res, err := c.doRequest("json")
905 if res != nil && res.StatusCode == http.StatusNotModified {
906 if res.Body != nil {
907 res.Body.Close()
908 }
909 return nil, gensupport.WrapError(&googleapi.Error{
910 Code: res.StatusCode,
911 Header: res.Header,
912 })
913 }
914 if err != nil {
915 return nil, err
916 }
917 defer googleapi.CloseBody(res)
918 if err := googleapi.CheckResponse(res); err != nil {
919 return nil, gensupport.WrapError(err)
920 }
921 ret := &GoogleAdsHomeservicesLocalservicesV1SearchDetailedLeadReportsResponse{
922 ServerResponse: googleapi.ServerResponse{
923 Header: res.Header,
924 HTTPStatusCode: res.StatusCode,
925 },
926 }
927 target := &ret
928 b, err := gensupport.DecodeResponseBytes(target, res)
929 if err != nil {
930 return nil, err
931 }
932 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "localservices.detailedLeadReports.search", "response", internallog.HTTPResponse(res, b))
933 return ret, nil
934 }
935
936 // Pages invokes f for each page of results.
937 // A non-nil error returned from f will halt the iteration.
938 // The provided context supersedes any context provided to the Context method.
939 func (c *DetailedLeadReportsSearchCall) Pages(ctx context.Context, f func(*GoogleAdsHomeservicesLocalservicesV1SearchDetailedLeadReportsResponse) error) error {
940 c.ctx_ = ctx
941 defer c.PageToken(c.urlParams_.Get("pageToken"))
942 for {
943 x, err := c.Do()
944 if err != nil {
945 return err
946 }
947 if err := f(x); err != nil {
948 return err
949 }
950 if x.NextPageToken == "" {
951 return nil
952 }
953 c.PageToken(x.NextPageToken)
954 }
955 }