Debian Codegraph @

businessprofileperformance/v1/businessprofileperformance-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 businessprofileperformance provides access to the Business Profile Performance API.
8 //
9 // For product documentation, see: https://developers.google.com/my-business/
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/businessprofileperformance/v1"
27 // ...
28 // ctx := context.Background()
29 // businessprofileperformanceService, err := businessprofileperformance.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 // businessprofileperformanceService, err := businessprofileperformance.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 // businessprofileperformanceService, err := businessprofileperformance.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
49 //
50 // See [google.golang.org/api/option.ClientOption] for details on options.
51 package businessprofileperformance // import "google.golang.org/api/businessprofileperformance/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 = "businessprofileperformance:v1"
93 const apiName = "businessprofileperformance"
94 const apiVersion = "v1"
95 const basePath = "https://businessprofileperformance.googleapis.com/"
96 const basePathTemplate = "https://businessprofileperformance.UNIVERSE_DOMAIN/"
97 const mtlsBasePath = "https://businessprofileperformance.mtls.googleapis.com/"
98
99 // NewService creates a new Service.
100 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
101 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
102 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
103 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
104 opts = append(opts, internaloption.EnableNewAuthLibrary())
105 client, endpoint, err := htransport.NewClient(ctx, opts...)
106 if err != nil {
107 return nil, err
108 }
109 s := &Service{client: client, BasePath: basePath, logger: internaloption.GetLogger(opts)}
110 s.Locations = NewLocationsService(s)
111 if endpoint != "" {
112 s.BasePath = endpoint
113 }
114 return s, nil
115 }
116
117 // New creates a new Service. It uses the provided http.Client for requests.
118 //
119 // Deprecated: please use NewService instead.
120 // To provide a custom HTTP client, use option.WithHTTPClient.
121 // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
122 func New(client *http.Client) (*Service, error) {
123 if client == nil {
124 return nil, errors.New("client is nil")
125 }
126 return NewService(context.TODO(), option.WithHTTPClient(client))
127 }
128
129 type Service struct {
130 client *http.Client
131 logger *slog.Logger
132 BasePath string // API endpoint base URL
133 UserAgent string // optional additional User-Agent fragment
134
135 Locations *LocationsService
136 }
137
138 func (s *Service) userAgent() string {
139 if s.UserAgent == "" {
140 return googleapi.UserAgent
141 }
142 return googleapi.UserAgent + " " + s.UserAgent
143 }
144
145 func NewLocationsService(s *Service) *LocationsService {
146 rs := &LocationsService{s: s}
147 rs.Searchkeywords = NewLocationsSearchkeywordsService(s)
148 return rs
149 }
150
151 type LocationsService struct {
152 s *Service
153
154 Searchkeywords *LocationsSearchkeywordsService
155 }
156
157 func NewLocationsSearchkeywordsService(s *Service) *LocationsSearchkeywordsService {
158 rs := &LocationsSearchkeywordsService{s: s}
159 rs.Impressions = NewLocationsSearchkeywordsImpressionsService(s)
160 return rs
161 }
162
163 type LocationsSearchkeywordsService struct {
164 s *Service
165
166 Impressions *LocationsSearchkeywordsImpressionsService
167 }
168
169 func NewLocationsSearchkeywordsImpressionsService(s *Service) *LocationsSearchkeywordsImpressionsService {
170 rs := &LocationsSearchkeywordsImpressionsService{s: s}
171 rs.Monthly = NewLocationsSearchkeywordsImpressionsMonthlyService(s)
172 return rs
173 }
174
175 type LocationsSearchkeywordsImpressionsService struct {
176 s *Service
177
178 Monthly *LocationsSearchkeywordsImpressionsMonthlyService
179 }
180
181 func NewLocationsSearchkeywordsImpressionsMonthlyService(s *Service) *LocationsSearchkeywordsImpressionsMonthlyService {
182 rs := &LocationsSearchkeywordsImpressionsMonthlyService{s: s}
183 return rs
184 }
185
186 type LocationsSearchkeywordsImpressionsMonthlyService struct {
187 s *Service
188 }
189
190 // DailyMetricTimeSeries: Represents a single datapoint, where each datapoint
191 // is a DailyMetric-DailySubEntityType-TimeSeries tuple.
192 type DailyMetricTimeSeries struct {
193 // DailyMetric: The DailyMetric that the TimeSeries represents.
194 //
195 // Possible values:
196 // "DAILY_METRIC_UNKNOWN" - Represents the default unknown value.
197 // "BUSINESS_IMPRESSIONS_DESKTOP_MAPS" - Business impressions on Google Maps
198 // on Desktop devices. Multiple impressions by a unique user within a single
199 // day are counted as a single impression.
200 // "BUSINESS_IMPRESSIONS_DESKTOP_SEARCH" - Business impressions on Google
201 // Search on Desktop devices. Multiple impressions by a unique user within a
202 // single day are counted as a single impression.
203 // "BUSINESS_IMPRESSIONS_MOBILE_MAPS" - Business impressions on Google Maps
204 // on Mobile devices. Multiple impressions by a unique user within a single day
205 // are counted as a single impression.
206 // "BUSINESS_IMPRESSIONS_MOBILE_SEARCH" - Business impressions on Google
207 // Search on Mobile devices. Multiple impressions by a unique user within a
208 // single day are counted as a single impression.
209 // "BUSINESS_CONVERSATIONS" - The number of message conversations received on
210 // the business profile.
211 // "BUSINESS_DIRECTION_REQUESTS" - The number of times a direction request
212 // was requested to the business location.
213 // "CALL_CLICKS" - The number of times the business profile call button was
214 // clicked.
215 // "WEBSITE_CLICKS" - The number of times the business profile website was
216 // clicked.
217 // "BUSINESS_BOOKINGS" - The number of bookings made from the business
218 // profile via Reserve with Google.
219 // "BUSINESS_FOOD_ORDERS" - The number of food orders received from the
220 // business profile.
221 // "BUSINESS_FOOD_MENU_CLICKS" - The number of clicks to view or interact
222 // with the menu content on the business profile. Multiple clicks by a unique
223 // user within a single day are counted as 1.
224 DailyMetric string `json:"dailyMetric,omitempty"`
225 // DailySubEntityType: The DailySubEntityType that the TimeSeries represents.
226 // Will not be present when breakdown does not exist.
227 DailySubEntityType *DailySubEntityType `json:"dailySubEntityType,omitempty"`
228 // TimeSeries: List of datapoints where each datapoint is a date-value pair.
229 TimeSeries *TimeSeries `json:"timeSeries,omitempty"`
230 // ForceSendFields is a list of field names (e.g. "DailyMetric") to
231 // unconditionally include in API requests. By default, fields with empty or
232 // default values are omitted from API requests. See
233 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
234 // details.
235 ForceSendFields []string `json:"-"`
236 // NullFields is a list of field names (e.g. "DailyMetric") to include in API
237 // requests with the JSON null value. By default, fields with empty values are
238 // omitted from API requests. See
239 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
240 NullFields []string `json:"-"`
241 }
242
243 func (s DailyMetricTimeSeries) MarshalJSON() ([]byte, error) {
244 type NoMethod DailyMetricTimeSeries
245 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
246 }
247
248 // DailySubEntityType: Represents all possible subentity types that are
249 // associated with DailyMetrics.
250 type DailySubEntityType struct {
251 // DayOfWeek: Represents the day of the week. Eg: MONDAY. Currently supported
252 // DailyMetrics = NONE.
253 //
254 // Possible values:
255 // "DAY_OF_WEEK_UNSPECIFIED" - The day of the week is unspecified.
256 // "MONDAY" - Monday
257 // "TUESDAY" - Tuesday
258 // "WEDNESDAY" - Wednesday
259 // "THURSDAY" - Thursday
260 // "FRIDAY" - Friday
261 // "SATURDAY" - Saturday
262 // "SUNDAY" - Sunday
263 DayOfWeek string `json:"dayOfWeek,omitempty"`
264 // TimeOfDay: Represents the time of the day in 24 hour format. Eg: 13:34:20
265 // Currently supported DailyMetrics = NONE.
266 TimeOfDay *TimeOfDay `json:"timeOfDay,omitempty"`
267 // ForceSendFields is a list of field names (e.g. "DayOfWeek") to
268 // unconditionally include in API requests. By default, fields with empty or
269 // default values are omitted from API requests. See
270 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
271 // details.
272 ForceSendFields []string `json:"-"`
273 // NullFields is a list of field names (e.g. "DayOfWeek") to include in API
274 // requests with the JSON null value. By default, fields with empty values are
275 // omitted from API requests. See
276 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
277 NullFields []string `json:"-"`
278 }
279
280 func (s DailySubEntityType) MarshalJSON() ([]byte, error) {
281 type NoMethod DailySubEntityType
282 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
283 }
284
285 // Date: Represents a whole or partial calendar date, such as a birthday. The
286 // time of day and time zone are either specified elsewhere or are
287 // insignificant. The date is relative to the Gregorian Calendar. This can
288 // represent one of the following: * A full date, with non-zero year, month,
289 // and day values. * A month and day, with a zero year (for example, an
290 // anniversary). * A year on its own, with a zero month and a zero day. * A
291 // year and month, with a zero day (for example, a credit card expiration
292 // date). Related types: * google.type.TimeOfDay * google.type.DateTime *
293 // google.protobuf.Timestamp
294 type Date struct {
295 // Day: Day of a month. Must be from 1 to 31 and valid for the year and month,
296 // or 0 to specify a year by itself or a year and month where the day isn't
297 // significant.
298 Day int64 `json:"day,omitempty"`
299 // Month: Month of a year. Must be from 1 to 12, or 0 to specify a year without
300 // a month and day.
301 Month int64 `json:"month,omitempty"`
302 // Year: Year of the date. Must be from 1 to 9999, or 0 to specify a date
303 // without a year.
304 Year int64 `json:"year,omitempty"`
305 // ForceSendFields is a list of field names (e.g. "Day") to unconditionally
306 // include in API requests. By default, fields with empty or default values are
307 // omitted from API requests. See
308 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
309 // details.
310 ForceSendFields []string `json:"-"`
311 // NullFields is a list of field names (e.g. "Day") to include in API requests
312 // with the JSON null value. By default, fields with empty values are omitted
313 // from API requests. See
314 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
315 NullFields []string `json:"-"`
316 }
317
318 func (s Date) MarshalJSON() ([]byte, error) {
319 type NoMethod Date
320 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
321 }
322
323 // DatedValue: Represents a single datapoint in the timeseries, where each
324 // datapoint is a date-value pair.
325 type DatedValue struct {
326 // Date: The date that the datapoint corresponds to. This represents a month
327 // value if the day field is not set.
328 Date *Date `json:"date,omitempty"`
329 // Value: The value of the datapoint. This will not be present when the value
330 // is zero.
331 Value int64 `json:"value,omitempty,string"`
332 // ForceSendFields is a list of field names (e.g. "Date") to unconditionally
333 // include in API requests. By default, fields with empty or default values are
334 // omitted from API requests. See
335 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
336 // details.
337 ForceSendFields []string `json:"-"`
338 // NullFields is a list of field names (e.g. "Date") to include in API requests
339 // with the JSON null value. By default, fields with empty values are omitted
340 // from API requests. See
341 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
342 NullFields []string `json:"-"`
343 }
344
345 func (s DatedValue) MarshalJSON() ([]byte, error) {
346 type NoMethod DatedValue
347 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
348 }
349
350 // FetchMultiDailyMetricsTimeSeriesResponse: Represents the response for
351 // FetchMultiDailyMetricsTimeSeries.
352 type FetchMultiDailyMetricsTimeSeriesResponse struct {
353 // MultiDailyMetricTimeSeries: DailyMetrics and their corresponding time
354 // series.
355 MultiDailyMetricTimeSeries []*MultiDailyMetricTimeSeries `json:"multiDailyMetricTimeSeries,omitempty"`
356
357 // ServerResponse contains the HTTP response code and headers from the server.
358 googleapi.ServerResponse `json:"-"`
359 // ForceSendFields is a list of field names (e.g. "MultiDailyMetricTimeSeries")
360 // to unconditionally include in API requests. By default, fields with empty or
361 // default values are omitted from API requests. See
362 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
363 // details.
364 ForceSendFields []string `json:"-"`
365 // NullFields is a list of field names (e.g. "MultiDailyMetricTimeSeries") to
366 // include in API requests with the JSON null value. By default, fields with
367 // empty values are omitted from API requests. See
368 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
369 NullFields []string `json:"-"`
370 }
371
372 func (s FetchMultiDailyMetricsTimeSeriesResponse) MarshalJSON() ([]byte, error) {
373 type NoMethod FetchMultiDailyMetricsTimeSeriesResponse
374 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
375 }
376
377 // GetDailyMetricsTimeSeriesResponse: Represents the response for
378 // GetDailyMetricsTimeSeries.
379 type GetDailyMetricsTimeSeriesResponse struct {
380 // TimeSeries: The daily time series.
381 TimeSeries *TimeSeries `json:"timeSeries,omitempty"`
382
383 // ServerResponse contains the HTTP response code and headers from the server.
384 googleapi.ServerResponse `json:"-"`
385 // ForceSendFields is a list of field names (e.g. "TimeSeries") to
386 // unconditionally include in API requests. By default, fields with empty or
387 // default values are omitted from API requests. See
388 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
389 // details.
390 ForceSendFields []string `json:"-"`
391 // NullFields is a list of field names (e.g. "TimeSeries") to include in API
392 // requests with the JSON null value. By default, fields with empty values are
393 // omitted from API requests. See
394 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
395 NullFields []string `json:"-"`
396 }
397
398 func (s GetDailyMetricsTimeSeriesResponse) MarshalJSON() ([]byte, error) {
399 type NoMethod GetDailyMetricsTimeSeriesResponse
400 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
401 }
402
403 // InsightsValue: Represents an insights value.
404 type InsightsValue struct {
405 // Threshold: Represents the threshold below which the actual value falls.
406 Threshold int64 `json:"threshold,omitempty,string"`
407 // Value: Represents the actual value.
408 Value int64 `json:"value,omitempty,string"`
409 // ForceSendFields is a list of field names (e.g. "Threshold") to
410 // unconditionally include in API requests. By default, fields with empty or
411 // default values are omitted from API requests. See
412 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
413 // details.
414 ForceSendFields []string `json:"-"`
415 // NullFields is a list of field names (e.g. "Threshold") to include in API
416 // requests with the JSON null value. By default, fields with empty values are
417 // omitted from API requests. See
418 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
419 NullFields []string `json:"-"`
420 }
421
422 func (s InsightsValue) MarshalJSON() ([]byte, error) {
423 type NoMethod InsightsValue
424 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
425 }
426
427 // ListSearchKeywordImpressionsMonthlyResponse: Represents the response for
428 // ListSearchKeywordImpressionsMonthly.
429 type ListSearchKeywordImpressionsMonthlyResponse struct {
430 // NextPageToken: A token indicating the last paginated result returned. This
431 // can be used by succeeding requests to get the next "page" of keywords. It
432 // will only be present when there are more results to be returned.
433 NextPageToken string `json:"nextPageToken,omitempty"`
434 // SearchKeywordsCounts: Search terms which have been used to find a business.
435 SearchKeywordsCounts []*SearchKeywordCount `json:"searchKeywordsCounts,omitempty"`
436
437 // ServerResponse contains the HTTP response code and headers from the server.
438 googleapi.ServerResponse `json:"-"`
439 // ForceSendFields is a list of field names (e.g. "NextPageToken") to
440 // unconditionally include in API requests. By default, fields with empty or
441 // default values are omitted from API requests. See
442 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
443 // details.
444 ForceSendFields []string `json:"-"`
445 // NullFields is a list of field names (e.g. "NextPageToken") to include in API
446 // requests with the JSON null value. By default, fields with empty values are
447 // omitted from API requests. See
448 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
449 NullFields []string `json:"-"`
450 }
451
452 func (s ListSearchKeywordImpressionsMonthlyResponse) MarshalJSON() ([]byte, error) {
453 type NoMethod ListSearchKeywordImpressionsMonthlyResponse
454 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
455 }
456
457 // MultiDailyMetricTimeSeries: Represents a list of tuples of
458 // DailyMetric-DailySubEntityType-TimeSeries.
459 type MultiDailyMetricTimeSeries struct {
460 // DailyMetricTimeSeries: List of DailyMetric-TimeSeries pairs.
461 DailyMetricTimeSeries []*DailyMetricTimeSeries `json:"dailyMetricTimeSeries,omitempty"`
462 // ForceSendFields is a list of field names (e.g. "DailyMetricTimeSeries") to
463 // unconditionally include in API requests. By default, fields with empty or
464 // default values are omitted from API requests. See
465 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
466 // details.
467 ForceSendFields []string `json:"-"`
468 // NullFields is a list of field names (e.g. "DailyMetricTimeSeries") to
469 // include in API requests with the JSON null value. By default, fields with
470 // empty values are omitted from API requests. See
471 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
472 NullFields []string `json:"-"`
473 }
474
475 func (s MultiDailyMetricTimeSeries) MarshalJSON() ([]byte, error) {
476 type NoMethod MultiDailyMetricTimeSeries
477 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
478 }
479
480 // SearchKeywordCount: Represents a single search keyword and its value.
481 type SearchKeywordCount struct {
482 // InsightsValue: One of either: 1) The sum of the number of unique users that
483 // used the keyword in a month, aggregated for each month requested. 2) A
484 // threshold that indicates that the actual value is below this threshold.
485 InsightsValue *InsightsValue `json:"insightsValue,omitempty"`
486 // SearchKeyword: The lower-cased string that the user entered.
487 SearchKeyword string `json:"searchKeyword,omitempty"`
488 // ForceSendFields is a list of field names (e.g. "InsightsValue") to
489 // unconditionally include in API requests. By default, fields with empty or
490 // default values are omitted from API requests. See
491 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
492 // details.
493 ForceSendFields []string `json:"-"`
494 // NullFields is a list of field names (e.g. "InsightsValue") to include in API
495 // requests with the JSON null value. By default, fields with empty values are
496 // omitted from API requests. See
497 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
498 NullFields []string `json:"-"`
499 }
500
501 func (s SearchKeywordCount) MarshalJSON() ([]byte, error) {
502 type NoMethod SearchKeywordCount
503 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
504 }
505
506 // TimeOfDay: Represents a time of day. The date and time zone are either not
507 // significant or are specified elsewhere. An API may choose to allow leap
508 // seconds. Related types are google.type.Date and `google.protobuf.Timestamp`.
509 type TimeOfDay struct {
510 // Hours: Hours of a day in 24 hour format. Must be greater than or equal to 0
511 // and typically must be less than or equal to 23. An API may choose to allow
512 // the value "24:00:00" for scenarios like business closing time.
513 Hours int64 `json:"hours,omitempty"`
514 // Minutes: Minutes of an hour. Must be greater than or equal to 0 and less
515 // than or equal to 59.
516 Minutes int64 `json:"minutes,omitempty"`
517 // Nanos: Fractions of seconds, in nanoseconds. Must be greater than or equal
518 // to 0 and less than or equal to 999,999,999.
519 Nanos int64 `json:"nanos,omitempty"`
520 // Seconds: Seconds of a minute. Must be greater than or equal to 0 and
521 // typically must be less than or equal to 59. An API may allow the value 60 if
522 // it allows leap-seconds.
523 Seconds int64 `json:"seconds,omitempty"`
524 // ForceSendFields is a list of field names (e.g. "Hours") to unconditionally
525 // include in API requests. By default, fields with empty or default values are
526 // omitted from API requests. See
527 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
528 // details.
529 ForceSendFields []string `json:"-"`
530 // NullFields is a list of field names (e.g. "Hours") to include in API
531 // requests with the JSON null value. By default, fields with empty values are
532 // omitted from API requests. See
533 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
534 NullFields []string `json:"-"`
535 }
536
537 func (s TimeOfDay) MarshalJSON() ([]byte, error) {
538 type NoMethod TimeOfDay
539 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
540 }
541
542 // TimeSeries: Represents a timeseries.
543 type TimeSeries struct {
544 // DatedValues: List of datapoints in the timeseries, where each datapoint is a
545 // date-value pair.
546 DatedValues []*DatedValue `json:"datedValues,omitempty"`
547 // ForceSendFields is a list of field names (e.g. "DatedValues") to
548 // unconditionally include in API requests. By default, fields with empty or
549 // default values are omitted from API requests. See
550 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
551 // details.
552 ForceSendFields []string `json:"-"`
553 // NullFields is a list of field names (e.g. "DatedValues") to include in API
554 // requests with the JSON null value. By default, fields with empty values are
555 // omitted from API requests. See
556 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
557 NullFields []string `json:"-"`
558 }
559
560 func (s TimeSeries) MarshalJSON() ([]byte, error) {
561 type NoMethod TimeSeries
562 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
563 }
564
565 type LocationsFetchMultiDailyMetricsTimeSeriesCall struct {
566 s *Service
567 location string
568 urlParams_ gensupport.URLParams
569 ifNoneMatch_ string
570 ctx_ context.Context
571 header_ http.Header
572 }
573
574 // FetchMultiDailyMetricsTimeSeries: Returns the values for each date from a
575 // given time range and optionally the sub entity type, where applicable, that
576 // are associated with the specific daily metrics. Example request: `GET
577 // https://businessprofileperformance.googleapis.com/v1/locations/12345:fetchMultiDailyMetricsTimeSeries?dailyMetrics=WEBSITE_CLICKS&dailyMetrics=CALL_CLICKS&daily_range.start_date.year=2022&daily_range.start_date.month=1&daily_range.start_date.day=1&daily_range.end_date.year=2022&daily_range.end_date.month=3&daily_range.end_date.day=31`
578 //
579 // - location: The location for which the time series should be fetched.
580 // Format: locations/{location_id} where location_id is an unobfuscated
581 // listing id.
582 func (r *LocationsService) FetchMultiDailyMetricsTimeSeries(location string) *LocationsFetchMultiDailyMetricsTimeSeriesCall {
583 c := &LocationsFetchMultiDailyMetricsTimeSeriesCall{s: r.s, urlParams_: make(gensupport.URLParams)}
584 c.location = location
585 return c
586 }
587
588 // DailyMetrics sets the optional parameter "dailyMetrics": Required. The
589 // metrics to retrieve time series for.
590 //
591 // Possible values:
592 //
593 // "DAILY_METRIC_UNKNOWN" - Represents the default unknown value.
594 // "BUSINESS_IMPRESSIONS_DESKTOP_MAPS" - Business impressions on Google Maps
595 //
596 // on Desktop devices. Multiple impressions by a unique user within a single
597 // day are counted as a single impression.
598 //
599 // "BUSINESS_IMPRESSIONS_DESKTOP_SEARCH" - Business impressions on Google
600 //
601 // Search on Desktop devices. Multiple impressions by a unique user within a
602 // single day are counted as a single impression.
603 //
604 // "BUSINESS_IMPRESSIONS_MOBILE_MAPS" - Business impressions on Google Maps
605 //
606 // on Mobile devices. Multiple impressions by a unique user within a single day
607 // are counted as a single impression.
608 //
609 // "BUSINESS_IMPRESSIONS_MOBILE_SEARCH" - Business impressions on Google
610 //
611 // Search on Mobile devices. Multiple impressions by a unique user within a
612 // single day are counted as a single impression.
613 //
614 // "BUSINESS_CONVERSATIONS" - The number of message conversations received on
615 //
616 // the business profile.
617 //
618 // "BUSINESS_DIRECTION_REQUESTS" - The number of times a direction request
619 //
620 // was requested to the business location.
621 //
622 // "CALL_CLICKS" - The number of times the business profile call button was
623 //
624 // clicked.
625 //
626 // "WEBSITE_CLICKS" - The number of times the business profile website was
627 //
628 // clicked.
629 //
630 // "BUSINESS_BOOKINGS" - The number of bookings made from the business
631 //
632 // profile via Reserve with Google.
633 //
634 // "BUSINESS_FOOD_ORDERS" - The number of food orders received from the
635 //
636 // business profile.
637 //
638 // "BUSINESS_FOOD_MENU_CLICKS" - The number of clicks to view or interact
639 //
640 // with the menu content on the business profile. Multiple clicks by a unique
641 // user within a single day are counted as 1.
642 func (c *LocationsFetchMultiDailyMetricsTimeSeriesCall) DailyMetrics(dailyMetrics ...string) *LocationsFetchMultiDailyMetricsTimeSeriesCall {
643 c.urlParams_.SetMulti("dailyMetrics", append([]string{}, dailyMetrics...))
644 return c
645 }
646
647 // DailyRangeEndDateDay sets the optional parameter "dailyRange.endDate.day":
648 // Day of a month. Must be from 1 to 31 and valid for the year and month, or 0
649 // to specify a year by itself or a year and month where the day isn't
650 // significant.
651 func (c *LocationsFetchMultiDailyMetricsTimeSeriesCall) DailyRangeEndDateDay(dailyRangeEndDateDay int64) *LocationsFetchMultiDailyMetricsTimeSeriesCall {
652 c.urlParams_.Set("dailyRange.endDate.day", fmt.Sprint(dailyRangeEndDateDay))
653 return c
654 }
655
656 // DailyRangeEndDateMonth sets the optional parameter
657 // "dailyRange.endDate.month": Month of a year. Must be from 1 to 12, or 0 to
658 // specify a year without a month and day.
659 func (c *LocationsFetchMultiDailyMetricsTimeSeriesCall) DailyRangeEndDateMonth(dailyRangeEndDateMonth int64) *LocationsFetchMultiDailyMetricsTimeSeriesCall {
660 c.urlParams_.Set("dailyRange.endDate.month", fmt.Sprint(dailyRangeEndDateMonth))
661 return c
662 }
663
664 // DailyRangeEndDateYear sets the optional parameter "dailyRange.endDate.year":
665 // Year of the date. Must be from 1 to 9999, or 0 to specify a date without a
666 // year.
667 func (c *LocationsFetchMultiDailyMetricsTimeSeriesCall) DailyRangeEndDateYear(dailyRangeEndDateYear int64) *LocationsFetchMultiDailyMetricsTimeSeriesCall {
668 c.urlParams_.Set("dailyRange.endDate.year", fmt.Sprint(dailyRangeEndDateYear))
669 return c
670 }
671
672 // DailyRangeStartDateDay sets the optional parameter
673 // "dailyRange.startDate.day": Day of a month. Must be from 1 to 31 and valid
674 // for the year and month, or 0 to specify a year by itself or a year and month
675 // where the day isn't significant.
676 func (c *LocationsFetchMultiDailyMetricsTimeSeriesCall) DailyRangeStartDateDay(dailyRangeStartDateDay int64) *LocationsFetchMultiDailyMetricsTimeSeriesCall {
677 c.urlParams_.Set("dailyRange.startDate.day", fmt.Sprint(dailyRangeStartDateDay))
678 return c
679 }
680
681 // DailyRangeStartDateMonth sets the optional parameter
682 // "dailyRange.startDate.month": Month of a year. Must be from 1 to 12, or 0 to
683 // specify a year without a month and day.
684 func (c *LocationsFetchMultiDailyMetricsTimeSeriesCall) DailyRangeStartDateMonth(dailyRangeStartDateMonth int64) *LocationsFetchMultiDailyMetricsTimeSeriesCall {
685 c.urlParams_.Set("dailyRange.startDate.month", fmt.Sprint(dailyRangeStartDateMonth))
686 return c
687 }
688
689 // DailyRangeStartDateYear sets the optional parameter
690 // "dailyRange.startDate.year": Year of the date. Must be from 1 to 9999, or 0
691 // to specify a date without a year.
692 func (c *LocationsFetchMultiDailyMetricsTimeSeriesCall) DailyRangeStartDateYear(dailyRangeStartDateYear int64) *LocationsFetchMultiDailyMetricsTimeSeriesCall {
693 c.urlParams_.Set("dailyRange.startDate.year", fmt.Sprint(dailyRangeStartDateYear))
694 return c
695 }
696
697 // Fields allows partial responses to be retrieved. See
698 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
699 // details.
700 func (c *LocationsFetchMultiDailyMetricsTimeSeriesCall) Fields(s ...googleapi.Field) *LocationsFetchMultiDailyMetricsTimeSeriesCall {
701 c.urlParams_.Set("fields", googleapi.CombineFields(s))
702 return c
703 }
704
705 // IfNoneMatch sets an optional parameter which makes the operation fail if the
706 // object's ETag matches the given value. This is useful for getting updates
707 // only after the object has changed since the last request.
708 func (c *LocationsFetchMultiDailyMetricsTimeSeriesCall) IfNoneMatch(entityTag string) *LocationsFetchMultiDailyMetricsTimeSeriesCall {
709 c.ifNoneMatch_ = entityTag
710 return c
711 }
712
713 // Context sets the context to be used in this call's Do method.
714 func (c *LocationsFetchMultiDailyMetricsTimeSeriesCall) Context(ctx context.Context) *LocationsFetchMultiDailyMetricsTimeSeriesCall {
715 c.ctx_ = ctx
716 return c
717 }
718
719 // Header returns a http.Header that can be modified by the caller to add
720 // headers to the request.
721 func (c *LocationsFetchMultiDailyMetricsTimeSeriesCall) Header() http.Header {
722 if c.header_ == nil {
723 c.header_ = make(http.Header)
724 }
725 return c.header_
726 }
727
728 func (c *LocationsFetchMultiDailyMetricsTimeSeriesCall) doRequest(alt string) (*http.Response, error) {
729 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
730 if c.ifNoneMatch_ != "" {
731 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
732 }
733 c.urlParams_.Set("alt", alt)
734 c.urlParams_.Set("prettyPrint", "false")
735 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+location}:fetchMultiDailyMetricsTimeSeries")
736 urls += "?" + c.urlParams_.Encode()
737 req, err := http.NewRequest("GET", urls, nil)
738 if err != nil {
739 return nil, err
740 }
741 req.Header = reqHeaders
742 googleapi.Expand(req.URL, map[string]string{
743 "location": c.location,
744 })
745 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "businessprofileperformance.locations.fetchMultiDailyMetricsTimeSeries", "request", internallog.HTTPRequest(req, nil))
746 return gensupport.SendRequest(c.ctx_, c.s.client, req)
747 }
748
749 // Do executes the "businessprofileperformance.locations.fetchMultiDailyMetricsTimeSeries" call.
750 // Any non-2xx status code is an error. Response headers are in either
751 // *FetchMultiDailyMetricsTimeSeriesResponse.ServerResponse.Header or (if a
752 // response was returned at all) in error.(*googleapi.Error).Header. Use
753 // googleapi.IsNotModified to check whether the returned error was because
754 // http.StatusNotModified was returned.
755 func (c *LocationsFetchMultiDailyMetricsTimeSeriesCall) Do(opts ...googleapi.CallOption) (*FetchMultiDailyMetricsTimeSeriesResponse, error) {
756 gensupport.SetOptions(c.urlParams_, opts...)
757 res, err := c.doRequest("json")
758 if res != nil && res.StatusCode == http.StatusNotModified {
759 if res.Body != nil {
760 res.Body.Close()
761 }
762 return nil, gensupport.WrapError(&googleapi.Error{
763 Code: res.StatusCode,
764 Header: res.Header,
765 })
766 }
767 if err != nil {
768 return nil, err
769 }
770 defer googleapi.CloseBody(res)
771 if err := googleapi.CheckResponse(res); err != nil {
772 return nil, gensupport.WrapError(err)
773 }
774 ret := &FetchMultiDailyMetricsTimeSeriesResponse{
775 ServerResponse: googleapi.ServerResponse{
776 Header: res.Header,
777 HTTPStatusCode: res.StatusCode,
778 },
779 }
780 target := &ret
781 b, err := gensupport.DecodeResponseBytes(target, res)
782 if err != nil {
783 return nil, err
784 }
785 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "businessprofileperformance.locations.fetchMultiDailyMetricsTimeSeries", "response", internallog.HTTPResponse(res, b))
786 return ret, nil
787 }
788
789 type LocationsGetDailyMetricsTimeSeriesCall struct {
790 s *Service
791 name string
792 urlParams_ gensupport.URLParams
793 ifNoneMatch_ string
794 ctx_ context.Context
795 header_ http.Header
796 }
797
798 // GetDailyMetricsTimeSeries: Returns the values for each date from a given
799 // time range that are associated with the specific daily metric. Example
800 // request: `GET
801 // https://businessprofileperformance.googleapis.com/v1/locations/12345:getDailyMetricsTimeSeries?dailyMetric=WEBSITE_CLICKS&daily_range.start_date.year=2022&daily_range.start_date.month=1&daily_range.start_date.day=1&daily_range.end_date.year=2022&daily_range.end_date.month=3&daily_range.end_date.day=31`
802 //
803 // - name: The location for which the time series should be fetched. Format:
804 // locations/{location_id} where location_id is an unobfuscated listing id.
805 func (r *LocationsService) GetDailyMetricsTimeSeries(name string) *LocationsGetDailyMetricsTimeSeriesCall {
806 c := &LocationsGetDailyMetricsTimeSeriesCall{s: r.s, urlParams_: make(gensupport.URLParams)}
807 c.name = name
808 return c
809 }
810
811 // DailyMetric sets the optional parameter "dailyMetric": Required. The metric
812 // to retrieve time series.
813 //
814 // Possible values:
815 //
816 // "DAILY_METRIC_UNKNOWN" - Represents the default unknown value.
817 // "BUSINESS_IMPRESSIONS_DESKTOP_MAPS" - Business impressions on Google Maps
818 //
819 // on Desktop devices. Multiple impressions by a unique user within a single
820 // day are counted as a single impression.
821 //
822 // "BUSINESS_IMPRESSIONS_DESKTOP_SEARCH" - Business impressions on Google
823 //
824 // Search on Desktop devices. Multiple impressions by a unique user within a
825 // single day are counted as a single impression.
826 //
827 // "BUSINESS_IMPRESSIONS_MOBILE_MAPS" - Business impressions on Google Maps
828 //
829 // on Mobile devices. Multiple impressions by a unique user within a single day
830 // are counted as a single impression.
831 //
832 // "BUSINESS_IMPRESSIONS_MOBILE_SEARCH" - Business impressions on Google
833 //
834 // Search on Mobile devices. Multiple impressions by a unique user within a
835 // single day are counted as a single impression.
836 //
837 // "BUSINESS_CONVERSATIONS" - The number of message conversations received on
838 //
839 // the business profile.
840 //
841 // "BUSINESS_DIRECTION_REQUESTS" - The number of times a direction request
842 //
843 // was requested to the business location.
844 //
845 // "CALL_CLICKS" - The number of times the business profile call button was
846 //
847 // clicked.
848 //
849 // "WEBSITE_CLICKS" - The number of times the business profile website was
850 //
851 // clicked.
852 //
853 // "BUSINESS_BOOKINGS" - The number of bookings made from the business
854 //
855 // profile via Reserve with Google.
856 //
857 // "BUSINESS_FOOD_ORDERS" - The number of food orders received from the
858 //
859 // business profile.
860 //
861 // "BUSINESS_FOOD_MENU_CLICKS" - The number of clicks to view or interact
862 //
863 // with the menu content on the business profile. Multiple clicks by a unique
864 // user within a single day are counted as 1.
865 func (c *LocationsGetDailyMetricsTimeSeriesCall) DailyMetric(dailyMetric string) *LocationsGetDailyMetricsTimeSeriesCall {
866 c.urlParams_.Set("dailyMetric", dailyMetric)
867 return c
868 }
869
870 // DailyRangeEndDateDay sets the optional parameter "dailyRange.endDate.day":
871 // Day of a month. Must be from 1 to 31 and valid for the year and month, or 0
872 // to specify a year by itself or a year and month where the day isn't
873 // significant.
874 func (c *LocationsGetDailyMetricsTimeSeriesCall) DailyRangeEndDateDay(dailyRangeEndDateDay int64) *LocationsGetDailyMetricsTimeSeriesCall {
875 c.urlParams_.Set("dailyRange.endDate.day", fmt.Sprint(dailyRangeEndDateDay))
876 return c
877 }
878
879 // DailyRangeEndDateMonth sets the optional parameter
880 // "dailyRange.endDate.month": Month of a year. Must be from 1 to 12, or 0 to
881 // specify a year without a month and day.
882 func (c *LocationsGetDailyMetricsTimeSeriesCall) DailyRangeEndDateMonth(dailyRangeEndDateMonth int64) *LocationsGetDailyMetricsTimeSeriesCall {
883 c.urlParams_.Set("dailyRange.endDate.month", fmt.Sprint(dailyRangeEndDateMonth))
884 return c
885 }
886
887 // DailyRangeEndDateYear sets the optional parameter "dailyRange.endDate.year":
888 // Year of the date. Must be from 1 to 9999, or 0 to specify a date without a
889 // year.
890 func (c *LocationsGetDailyMetricsTimeSeriesCall) DailyRangeEndDateYear(dailyRangeEndDateYear int64) *LocationsGetDailyMetricsTimeSeriesCall {
891 c.urlParams_.Set("dailyRange.endDate.year", fmt.Sprint(dailyRangeEndDateYear))
892 return c
893 }
894
895 // DailyRangeStartDateDay sets the optional parameter
896 // "dailyRange.startDate.day": Day of a month. Must be from 1 to 31 and valid
897 // for the year and month, or 0 to specify a year by itself or a year and month
898 // where the day isn't significant.
899 func (c *LocationsGetDailyMetricsTimeSeriesCall) DailyRangeStartDateDay(dailyRangeStartDateDay int64) *LocationsGetDailyMetricsTimeSeriesCall {
900 c.urlParams_.Set("dailyRange.startDate.day", fmt.Sprint(dailyRangeStartDateDay))
901 return c
902 }
903
904 // DailyRangeStartDateMonth sets the optional parameter
905 // "dailyRange.startDate.month": Month of a year. Must be from 1 to 12, or 0 to
906 // specify a year without a month and day.
907 func (c *LocationsGetDailyMetricsTimeSeriesCall) DailyRangeStartDateMonth(dailyRangeStartDateMonth int64) *LocationsGetDailyMetricsTimeSeriesCall {
908 c.urlParams_.Set("dailyRange.startDate.month", fmt.Sprint(dailyRangeStartDateMonth))
909 return c
910 }
911
912 // DailyRangeStartDateYear sets the optional parameter
913 // "dailyRange.startDate.year": Year of the date. Must be from 1 to 9999, or 0
914 // to specify a date without a year.
915 func (c *LocationsGetDailyMetricsTimeSeriesCall) DailyRangeStartDateYear(dailyRangeStartDateYear int64) *LocationsGetDailyMetricsTimeSeriesCall {
916 c.urlParams_.Set("dailyRange.startDate.year", fmt.Sprint(dailyRangeStartDateYear))
917 return c
918 }
919
920 // DailySubEntityTypeDayOfWeek sets the optional parameter
921 // "dailySubEntityType.dayOfWeek": Represents the day of the week. Eg: MONDAY.
922 // Currently supported DailyMetrics = NONE.
923 //
924 // Possible values:
925 //
926 // "DAY_OF_WEEK_UNSPECIFIED" - The day of the week is unspecified.
927 // "MONDAY" - Monday
928 // "TUESDAY" - Tuesday
929 // "WEDNESDAY" - Wednesday
930 // "THURSDAY" - Thursday
931 // "FRIDAY" - Friday
932 // "SATURDAY" - Saturday
933 // "SUNDAY" - Sunday
934 func (c *LocationsGetDailyMetricsTimeSeriesCall) DailySubEntityTypeDayOfWeek(dailySubEntityTypeDayOfWeek string) *LocationsGetDailyMetricsTimeSeriesCall {
935 c.urlParams_.Set("dailySubEntityType.dayOfWeek", dailySubEntityTypeDayOfWeek)
936 return c
937 }
938
939 // DailySubEntityTypeTimeOfDayHours sets the optional parameter
940 // "dailySubEntityType.timeOfDay.hours": Hours of a day in 24 hour format. Must
941 // be greater than or equal to 0 and typically must be less than or equal to
942 // 23. An API may choose to allow the value "24:00:00" for scenarios like
943 // business closing time.
944 func (c *LocationsGetDailyMetricsTimeSeriesCall) DailySubEntityTypeTimeOfDayHours(dailySubEntityTypeTimeOfDayHours int64) *LocationsGetDailyMetricsTimeSeriesCall {
945 c.urlParams_.Set("dailySubEntityType.timeOfDay.hours", fmt.Sprint(dailySubEntityTypeTimeOfDayHours))
946 return c
947 }
948
949 // DailySubEntityTypeTimeOfDayMinutes sets the optional parameter
950 // "dailySubEntityType.timeOfDay.minutes": Minutes of an hour. Must be greater
951 // than or equal to 0 and less than or equal to 59.
952 func (c *LocationsGetDailyMetricsTimeSeriesCall) DailySubEntityTypeTimeOfDayMinutes(dailySubEntityTypeTimeOfDayMinutes int64) *LocationsGetDailyMetricsTimeSeriesCall {
953 c.urlParams_.Set("dailySubEntityType.timeOfDay.minutes", fmt.Sprint(dailySubEntityTypeTimeOfDayMinutes))
954 return c
955 }
956
957 // DailySubEntityTypeTimeOfDayNanos sets the optional parameter
958 // "dailySubEntityType.timeOfDay.nanos": Fractions of seconds, in nanoseconds.
959 // Must be greater than or equal to 0 and less than or equal to 999,999,999.
960 func (c *LocationsGetDailyMetricsTimeSeriesCall) DailySubEntityTypeTimeOfDayNanos(dailySubEntityTypeTimeOfDayNanos int64) *LocationsGetDailyMetricsTimeSeriesCall {
961 c.urlParams_.Set("dailySubEntityType.timeOfDay.nanos", fmt.Sprint(dailySubEntityTypeTimeOfDayNanos))
962 return c
963 }
964
965 // DailySubEntityTypeTimeOfDaySeconds sets the optional parameter
966 // "dailySubEntityType.timeOfDay.seconds": Seconds of a minute. Must be greater
967 // than or equal to 0 and typically must be less than or equal to 59. An API
968 // may allow the value 60 if it allows leap-seconds.
969 func (c *LocationsGetDailyMetricsTimeSeriesCall) DailySubEntityTypeTimeOfDaySeconds(dailySubEntityTypeTimeOfDaySeconds int64) *LocationsGetDailyMetricsTimeSeriesCall {
970 c.urlParams_.Set("dailySubEntityType.timeOfDay.seconds", fmt.Sprint(dailySubEntityTypeTimeOfDaySeconds))
971 return c
972 }
973
974 // Fields allows partial responses to be retrieved. See
975 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
976 // details.
977 func (c *LocationsGetDailyMetricsTimeSeriesCall) Fields(s ...googleapi.Field) *LocationsGetDailyMetricsTimeSeriesCall {
978 c.urlParams_.Set("fields", googleapi.CombineFields(s))
979 return c
980 }
981
982 // IfNoneMatch sets an optional parameter which makes the operation fail if the
983 // object's ETag matches the given value. This is useful for getting updates
984 // only after the object has changed since the last request.
985 func (c *LocationsGetDailyMetricsTimeSeriesCall) IfNoneMatch(entityTag string) *LocationsGetDailyMetricsTimeSeriesCall {
986 c.ifNoneMatch_ = entityTag
987 return c
988 }
989
990 // Context sets the context to be used in this call's Do method.
991 func (c *LocationsGetDailyMetricsTimeSeriesCall) Context(ctx context.Context) *LocationsGetDailyMetricsTimeSeriesCall {
992 c.ctx_ = ctx
993 return c
994 }
995
996 // Header returns a http.Header that can be modified by the caller to add
997 // headers to the request.
998 func (c *LocationsGetDailyMetricsTimeSeriesCall) Header() http.Header {
999 if c.header_ == nil {
1000 c.header_ = make(http.Header)
1001 }
1002 return c.header_
1003 }
1004
1005 func (c *LocationsGetDailyMetricsTimeSeriesCall) doRequest(alt string) (*http.Response, error) {
1006 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1007 if c.ifNoneMatch_ != "" {
1008 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1009 }
1010 c.urlParams_.Set("alt", alt)
1011 c.urlParams_.Set("prettyPrint", "false")
1012 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:getDailyMetricsTimeSeries")
1013 urls += "?" + c.urlParams_.Encode()
1014 req, err := http.NewRequest("GET", urls, nil)
1015 if err != nil {
1016 return nil, err
1017 }
1018 req.Header = reqHeaders
1019 googleapi.Expand(req.URL, map[string]string{
1020 "name": c.name,
1021 })
1022 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "businessprofileperformance.locations.getDailyMetricsTimeSeries", "request", internallog.HTTPRequest(req, nil))
1023 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1024 }
1025
1026 // Do executes the "businessprofileperformance.locations.getDailyMetricsTimeSeries" call.
1027 // Any non-2xx status code is an error. Response headers are in either
1028 // *GetDailyMetricsTimeSeriesResponse.ServerResponse.Header or (if a response
1029 // was returned at all) in error.(*googleapi.Error).Header. Use
1030 // googleapi.IsNotModified to check whether the returned error was because
1031 // http.StatusNotModified was returned.
1032 func (c *LocationsGetDailyMetricsTimeSeriesCall) Do(opts ...googleapi.CallOption) (*GetDailyMetricsTimeSeriesResponse, error) {
1033 gensupport.SetOptions(c.urlParams_, opts...)
1034 res, err := c.doRequest("json")
1035 if res != nil && res.StatusCode == http.StatusNotModified {
1036 if res.Body != nil {
1037 res.Body.Close()
1038 }
1039 return nil, gensupport.WrapError(&googleapi.Error{
1040 Code: res.StatusCode,
1041 Header: res.Header,
1042 })
1043 }
1044 if err != nil {
1045 return nil, err
1046 }
1047 defer googleapi.CloseBody(res)
1048 if err := googleapi.CheckResponse(res); err != nil {
1049 return nil, gensupport.WrapError(err)
1050 }
1051 ret := &GetDailyMetricsTimeSeriesResponse{
1052 ServerResponse: googleapi.ServerResponse{
1053 Header: res.Header,
1054 HTTPStatusCode: res.StatusCode,
1055 },
1056 }
1057 target := &ret
1058 b, err := gensupport.DecodeResponseBytes(target, res)
1059 if err != nil {
1060 return nil, err
1061 }
1062 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "businessprofileperformance.locations.getDailyMetricsTimeSeries", "response", internallog.HTTPResponse(res, b))
1063 return ret, nil
1064 }
1065
1066 type LocationsSearchkeywordsImpressionsMonthlyListCall struct {
1067 s *Service
1068 parent string
1069 urlParams_ gensupport.URLParams
1070 ifNoneMatch_ string
1071 ctx_ context.Context
1072 header_ http.Header
1073 }
1074
1075 // List: Returns the search keywords used to find a business in search or maps.
1076 // Each search keyword is accompanied by impressions which are aggregated on a
1077 // monthly basis. Example request: `GET
1078 // https://businessprofileperformance.googleapis.com/v1/locations/12345/searchkeywords/impressions/monthly?monthly_range.start_month.year=2022&monthly_range.start_month.month=1&monthly_range.end_month.year=2022&monthly_range.end_month.month=3`
1079 //
1080 // - parent: The location for which the time series should be fetched. Format:
1081 // locations/{location_id} where location_id is an unobfuscated listing id.
1082 func (r *LocationsSearchkeywordsImpressionsMonthlyService) List(parent string) *LocationsSearchkeywordsImpressionsMonthlyListCall {
1083 c := &LocationsSearchkeywordsImpressionsMonthlyListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1084 c.parent = parent
1085 return c
1086 }
1087
1088 // MonthlyRangeEndMonthDay sets the optional parameter
1089 // "monthlyRange.endMonth.day": Day of a month. Must be from 1 to 31 and valid
1090 // for the year and month, or 0 to specify a year by itself or a year and month
1091 // where the day isn't significant.
1092 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) MonthlyRangeEndMonthDay(monthlyRangeEndMonthDay int64) *LocationsSearchkeywordsImpressionsMonthlyListCall {
1093 c.urlParams_.Set("monthlyRange.endMonth.day", fmt.Sprint(monthlyRangeEndMonthDay))
1094 return c
1095 }
1096
1097 // MonthlyRangeEndMonthMonth sets the optional parameter
1098 // "monthlyRange.endMonth.month": Month of a year. Must be from 1 to 12, or 0
1099 // to specify a year without a month and day.
1100 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) MonthlyRangeEndMonthMonth(monthlyRangeEndMonthMonth int64) *LocationsSearchkeywordsImpressionsMonthlyListCall {
1101 c.urlParams_.Set("monthlyRange.endMonth.month", fmt.Sprint(monthlyRangeEndMonthMonth))
1102 return c
1103 }
1104
1105 // MonthlyRangeEndMonthYear sets the optional parameter
1106 // "monthlyRange.endMonth.year": Year of the date. Must be from 1 to 9999, or 0
1107 // to specify a date without a year.
1108 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) MonthlyRangeEndMonthYear(monthlyRangeEndMonthYear int64) *LocationsSearchkeywordsImpressionsMonthlyListCall {
1109 c.urlParams_.Set("monthlyRange.endMonth.year", fmt.Sprint(monthlyRangeEndMonthYear))
1110 return c
1111 }
1112
1113 // MonthlyRangeStartMonthDay sets the optional parameter
1114 // "monthlyRange.startMonth.day": Day of a month. Must be from 1 to 31 and
1115 // valid for the year and month, or 0 to specify a year by itself or a year and
1116 // month where the day isn't significant.
1117 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) MonthlyRangeStartMonthDay(monthlyRangeStartMonthDay int64) *LocationsSearchkeywordsImpressionsMonthlyListCall {
1118 c.urlParams_.Set("monthlyRange.startMonth.day", fmt.Sprint(monthlyRangeStartMonthDay))
1119 return c
1120 }
1121
1122 // MonthlyRangeStartMonthMonth sets the optional parameter
1123 // "monthlyRange.startMonth.month": Month of a year. Must be from 1 to 12, or 0
1124 // to specify a year without a month and day.
1125 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) MonthlyRangeStartMonthMonth(monthlyRangeStartMonthMonth int64) *LocationsSearchkeywordsImpressionsMonthlyListCall {
1126 c.urlParams_.Set("monthlyRange.startMonth.month", fmt.Sprint(monthlyRangeStartMonthMonth))
1127 return c
1128 }
1129
1130 // MonthlyRangeStartMonthYear sets the optional parameter
1131 // "monthlyRange.startMonth.year": Year of the date. Must be from 1 to 9999, or
1132 // 0 to specify a date without a year.
1133 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) MonthlyRangeStartMonthYear(monthlyRangeStartMonthYear int64) *LocationsSearchkeywordsImpressionsMonthlyListCall {
1134 c.urlParams_.Set("monthlyRange.startMonth.year", fmt.Sprint(monthlyRangeStartMonthYear))
1135 return c
1136 }
1137
1138 // PageSize sets the optional parameter "pageSize": The number of results
1139 // requested. The default page size is 100. Page size can be set to a maximum
1140 // of 100.
1141 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) PageSize(pageSize int64) *LocationsSearchkeywordsImpressionsMonthlyListCall {
1142 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
1143 return c
1144 }
1145
1146 // PageToken sets the optional parameter "pageToken": A token indicating the
1147 // next paginated result to be returned.
1148 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) PageToken(pageToken string) *LocationsSearchkeywordsImpressionsMonthlyListCall {
1149 c.urlParams_.Set("pageToken", pageToken)
1150 return c
1151 }
1152
1153 // Fields allows partial responses to be retrieved. See
1154 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1155 // details.
1156 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) Fields(s ...googleapi.Field) *LocationsSearchkeywordsImpressionsMonthlyListCall {
1157 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1158 return c
1159 }
1160
1161 // IfNoneMatch sets an optional parameter which makes the operation fail if the
1162 // object's ETag matches the given value. This is useful for getting updates
1163 // only after the object has changed since the last request.
1164 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) IfNoneMatch(entityTag string) *LocationsSearchkeywordsImpressionsMonthlyListCall {
1165 c.ifNoneMatch_ = entityTag
1166 return c
1167 }
1168
1169 // Context sets the context to be used in this call's Do method.
1170 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) Context(ctx context.Context) *LocationsSearchkeywordsImpressionsMonthlyListCall {
1171 c.ctx_ = ctx
1172 return c
1173 }
1174
1175 // Header returns a http.Header that can be modified by the caller to add
1176 // headers to the request.
1177 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) Header() http.Header {
1178 if c.header_ == nil {
1179 c.header_ = make(http.Header)
1180 }
1181 return c.header_
1182 }
1183
1184 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) doRequest(alt string) (*http.Response, error) {
1185 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1186 if c.ifNoneMatch_ != "" {
1187 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1188 }
1189 c.urlParams_.Set("alt", alt)
1190 c.urlParams_.Set("prettyPrint", "false")
1191 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/searchkeywords/impressions/monthly")
1192 urls += "?" + c.urlParams_.Encode()
1193 req, err := http.NewRequest("GET", urls, nil)
1194 if err != nil {
1195 return nil, err
1196 }
1197 req.Header = reqHeaders
1198 googleapi.Expand(req.URL, map[string]string{
1199 "parent": c.parent,
1200 })
1201 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "businessprofileperformance.locations.searchkeywords.impressions.monthly.list", "request", internallog.HTTPRequest(req, nil))
1202 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1203 }
1204
1205 // Do executes the "businessprofileperformance.locations.searchkeywords.impressions.monthly.list" call.
1206 // Any non-2xx status code is an error. Response headers are in either
1207 // *ListSearchKeywordImpressionsMonthlyResponse.ServerResponse.Header or (if a
1208 // response was returned at all) in error.(*googleapi.Error).Header. Use
1209 // googleapi.IsNotModified to check whether the returned error was because
1210 // http.StatusNotModified was returned.
1211 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) Do(opts ...googleapi.CallOption) (*ListSearchKeywordImpressionsMonthlyResponse, error) {
1212 gensupport.SetOptions(c.urlParams_, opts...)
1213 res, err := c.doRequest("json")
1214 if res != nil && res.StatusCode == http.StatusNotModified {
1215 if res.Body != nil {
1216 res.Body.Close()
1217 }
1218 return nil, gensupport.WrapError(&googleapi.Error{
1219 Code: res.StatusCode,
1220 Header: res.Header,
1221 })
1222 }
1223 if err != nil {
1224 return nil, err
1225 }
1226 defer googleapi.CloseBody(res)
1227 if err := googleapi.CheckResponse(res); err != nil {
1228 return nil, gensupport.WrapError(err)
1229 }
1230 ret := &ListSearchKeywordImpressionsMonthlyResponse{
1231 ServerResponse: googleapi.ServerResponse{
1232 Header: res.Header,
1233 HTTPStatusCode: res.StatusCode,
1234 },
1235 }
1236 target := &ret
1237 b, err := gensupport.DecodeResponseBytes(target, res)
1238 if err != nil {
1239 return nil, err
1240 }
1241 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "businessprofileperformance.locations.searchkeywords.impressions.monthly.list", "response", internallog.HTTPResponse(res, b))
1242 return ret, nil
1243 }
1244
1245 // Pages invokes f for each page of results.
1246 // A non-nil error returned from f will halt the iteration.
1247 // The provided context supersedes any context provided to the Context method.
1248 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) Pages(ctx context.Context, f func(*ListSearchKeywordImpressionsMonthlyResponse) error) error {
1249 c.ctx_ = ctx
1250 defer c.PageToken(c.urlParams_.Get("pageToken"))
1251 for {
1252 x, err := c.Do()
1253 if err != nil {
1254 return err
1255 }
1256 if err := f(x); err != nil {
1257 return err
1258 }
1259 if x.NextPageToken == "" {
1260 return nil
1261 }
1262 c.PageToken(x.NextPageToken)
1263 }
1264 }