1 // Copyright 2024 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 "net/http" 61 "net/url" 62 "strconv" 63 "strings" 64 65 googleapi "google.golang.org/api/googleapi" 66 internal "google.golang.org/api/internal" 67 gensupport "google.golang.org/api/internal/gensupport" 68 option "google.golang.org/api/option" 69 internaloption "google.golang.org/api/option/internaloption" 70 htransport "google.golang.org/api/transport/http" 71 ) 72 73 // Always reference these packages, just in case the auto-generated code 74 // below doesn't. 75 var _ = bytes.NewBuffer 76 var _ = strconv.Itoa 77 var _ = fmt.Sprintf 78 var _ = json.NewDecoder 79 var _ = io.Copy 80 var _ = url.Parse 81 var _ = gensupport.MarshalJSON 82 var _ = googleapi.Version 83 var _ = errors.New 84 var _ = strings.Replace 85 var _ = context.Canceled 86 var _ = internaloption.WithDefaultEndpoint 87 var _ = internal.Version 88 89 const apiId = "businessprofileperformance:v1" 90 const apiName = "businessprofileperformance" 91 const apiVersion = "v1" 92 const basePath = "https://businessprofileperformance.googleapis.com/" 93 const basePathTemplate = "https://businessprofileperformance.UNIVERSE_DOMAIN/" 94 const mtlsBasePath = "https://businessprofileperformance.mtls.googleapis.com/" 95 96 // NewService creates a new Service. 97 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 98 opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) 99 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate)) 100 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath)) 101 opts = append(opts, internaloption.EnableNewAuthLibrary()) 102 client, endpoint, err := htransport.NewClient(ctx, opts...) 103 if err != nil { 104 return nil, err 105 } 106 s, err := New(client) 107 if err != nil { 108 return nil, err 109 } 110 if endpoint != "" { 111 s.BasePath = endpoint 112 } 113 return s, nil 114 } 115 116 // New creates a new Service. It uses the provided http.Client for requests. 117 // 118 // Deprecated: please use NewService instead. 119 // To provide a custom HTTP client, use option.WithHTTPClient. 120 // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 121 func New(client *http.Client) (*Service, error) { 122 if client == nil { 123 return nil, errors.New("client is nil") 124 } 125 s := &Service{client: client, BasePath: basePath} 126 s.Locations = NewLocationsService(s) 127 return s, nil 128 } 129 130 type Service struct { 131 client *http.Client 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 day in 24 hour format. Should be from 0 to 23. An API may 511 // choose to allow the value "24:00:00" for scenarios like business closing 512 // time. 513 Hours int64 `json:"hours,omitempty"` 514 // Minutes: Minutes of hour of day. Must be from 0 to 59. 515 Minutes int64 `json:"minutes,omitempty"` 516 // Nanos: Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. 517 Nanos int64 `json:"nanos,omitempty"` 518 // Seconds: Seconds of minutes of the time. Must normally be from 0 to 59. An 519 // API may allow the value 60 if it allows leap-seconds. 520 Seconds int64 `json:"seconds,omitempty"` 521 // ForceSendFields is a list of field names (e.g. "Hours") to unconditionally 522 // include in API requests. By default, fields with empty or default values are 523 // omitted from API requests. See 524 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 525 // details. 526 ForceSendFields []string `json:"-"` 527 // NullFields is a list of field names (e.g. "Hours") to include in API 528 // requests with the JSON null value. By default, fields with empty values are 529 // omitted from API requests. See 530 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 531 NullFields []string `json:"-"` 532 } 533 534 func (s *TimeOfDay) MarshalJSON() ([]byte, error) { 535 type NoMethod TimeOfDay 536 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 537 } 538 539 // TimeSeries: Represents a timeseries. 540 type TimeSeries struct { 541 // DatedValues: List of datapoints in the timeseries, where each datapoint is a 542 // date-value pair. 543 DatedValues []*DatedValue `json:"datedValues,omitempty"` 544 // ForceSendFields is a list of field names (e.g. "DatedValues") to 545 // unconditionally include in API requests. By default, fields with empty or 546 // default values are omitted from API requests. See 547 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 548 // details. 549 ForceSendFields []string `json:"-"` 550 // NullFields is a list of field names (e.g. "DatedValues") to include in API 551 // requests with the JSON null value. By default, fields with empty values are 552 // omitted from API requests. See 553 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 554 NullFields []string `json:"-"` 555 } 556 557 func (s *TimeSeries) MarshalJSON() ([]byte, error) { 558 type NoMethod TimeSeries 559 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 560 } 561 562 type LocationsFetchMultiDailyMetricsTimeSeriesCall struct { 563 s *Service 564 location string 565 urlParams_ gensupport.URLParams 566 ifNoneMatch_ string 567 ctx_ context.Context 568 header_ http.Header 569 } 570 571 // FetchMultiDailyMetricsTimeSeries: Returns the values for each date from a 572 // given time range and optionally the sub entity type, where applicable, that 573 // are associated with the specific daily metrics. Example request: `GET 574 // 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` 575 // 576 // - location: The location for which the time series should be fetched. 577 // Format: locations/{location_id} where location_id is an unobfuscated 578 // listing id. 579 func (r *LocationsService) FetchMultiDailyMetricsTimeSeries(location string) *LocationsFetchMultiDailyMetricsTimeSeriesCall { 580 c := &LocationsFetchMultiDailyMetricsTimeSeriesCall{s: r.s, urlParams_: make(gensupport.URLParams)} 581 c.location = location 582 return c 583 } 584 585 // DailyMetrics sets the optional parameter "dailyMetrics": Required. The 586 // metrics to retrieve time series for. 587 // 588 // Possible values: 589 // 590 // "DAILY_METRIC_UNKNOWN" - Represents the default unknown value. 591 // "BUSINESS_IMPRESSIONS_DESKTOP_MAPS" - Business impressions on Google Maps 592 // 593 // on Desktop devices. Multiple impressions by a unique user within a single 594 // day are counted as a single impression. 595 // 596 // "BUSINESS_IMPRESSIONS_DESKTOP_SEARCH" - Business impressions on Google 597 // 598 // Search on Desktop devices. Multiple impressions by a unique user within a 599 // single day are counted as a single impression. 600 // 601 // "BUSINESS_IMPRESSIONS_MOBILE_MAPS" - Business impressions on Google Maps 602 // 603 // on Mobile devices. Multiple impressions by a unique user within a single day 604 // are counted as a single impression. 605 // 606 // "BUSINESS_IMPRESSIONS_MOBILE_SEARCH" - Business impressions on Google 607 // 608 // Search on Mobile devices. Multiple impressions by a unique user within a 609 // single day are counted as a single impression. 610 // 611 // "BUSINESS_CONVERSATIONS" - The number of message conversations received on 612 // 613 // the business profile. 614 // 615 // "BUSINESS_DIRECTION_REQUESTS" - The number of times a direction request 616 // 617 // was requested to the business location. 618 // 619 // "CALL_CLICKS" - The number of times the business profile call button was 620 // 621 // clicked. 622 // 623 // "WEBSITE_CLICKS" - The number of times the business profile website was 624 // 625 // clicked. 626 // 627 // "BUSINESS_BOOKINGS" - The number of bookings made from the business 628 // 629 // profile via Reserve with Google. 630 // 631 // "BUSINESS_FOOD_ORDERS" - The number of food orders received from the 632 // 633 // business profile. 634 // 635 // "BUSINESS_FOOD_MENU_CLICKS" - The number of clicks to view or interact 636 // 637 // with the menu content on the business profile. Multiple clicks by a unique 638 // user within a single day are counted as 1. 639 func (c *LocationsFetchMultiDailyMetricsTimeSeriesCall) DailyMetrics(dailyMetrics ...string) *LocationsFetchMultiDailyMetricsTimeSeriesCall { 640 c.urlParams_.SetMulti("dailyMetrics", append([]string{}, dailyMetrics...)) 641 return c 642 } 643 644 // DailyRangeEndDateDay sets the optional parameter "dailyRange.endDate.day": 645 // Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 646 // to specify a year by itself or a year and month where the day isn't 647 // significant. 648 func (c *LocationsFetchMultiDailyMetricsTimeSeriesCall) DailyRangeEndDateDay(dailyRangeEndDateDay int64) *LocationsFetchMultiDailyMetricsTimeSeriesCall { 649 c.urlParams_.Set("dailyRange.endDate.day", fmt.Sprint(dailyRangeEndDateDay)) 650 return c 651 } 652 653 // DailyRangeEndDateMonth sets the optional parameter 654 // "dailyRange.endDate.month": Month of a year. Must be from 1 to 12, or 0 to 655 // specify a year without a month and day. 656 func (c *LocationsFetchMultiDailyMetricsTimeSeriesCall) DailyRangeEndDateMonth(dailyRangeEndDateMonth int64) *LocationsFetchMultiDailyMetricsTimeSeriesCall { 657 c.urlParams_.Set("dailyRange.endDate.month", fmt.Sprint(dailyRangeEndDateMonth)) 658 return c 659 } 660 661 // DailyRangeEndDateYear sets the optional parameter "dailyRange.endDate.year": 662 // Year of the date. Must be from 1 to 9999, or 0 to specify a date without a 663 // year. 664 func (c *LocationsFetchMultiDailyMetricsTimeSeriesCall) DailyRangeEndDateYear(dailyRangeEndDateYear int64) *LocationsFetchMultiDailyMetricsTimeSeriesCall { 665 c.urlParams_.Set("dailyRange.endDate.year", fmt.Sprint(dailyRangeEndDateYear)) 666 return c 667 } 668 669 // DailyRangeStartDateDay sets the optional parameter 670 // "dailyRange.startDate.day": Day of a month. Must be from 1 to 31 and valid 671 // for the year and month, or 0 to specify a year by itself or a year and month 672 // where the day isn't significant. 673 func (c *LocationsFetchMultiDailyMetricsTimeSeriesCall) DailyRangeStartDateDay(dailyRangeStartDateDay int64) *LocationsFetchMultiDailyMetricsTimeSeriesCall { 674 c.urlParams_.Set("dailyRange.startDate.day", fmt.Sprint(dailyRangeStartDateDay)) 675 return c 676 } 677 678 // DailyRangeStartDateMonth sets the optional parameter 679 // "dailyRange.startDate.month": Month of a year. Must be from 1 to 12, or 0 to 680 // specify a year without a month and day. 681 func (c *LocationsFetchMultiDailyMetricsTimeSeriesCall) DailyRangeStartDateMonth(dailyRangeStartDateMonth int64) *LocationsFetchMultiDailyMetricsTimeSeriesCall { 682 c.urlParams_.Set("dailyRange.startDate.month", fmt.Sprint(dailyRangeStartDateMonth)) 683 return c 684 } 685 686 // DailyRangeStartDateYear sets the optional parameter 687 // "dailyRange.startDate.year": Year of the date. Must be from 1 to 9999, or 0 688 // to specify a date without a year. 689 func (c *LocationsFetchMultiDailyMetricsTimeSeriesCall) DailyRangeStartDateYear(dailyRangeStartDateYear int64) *LocationsFetchMultiDailyMetricsTimeSeriesCall { 690 c.urlParams_.Set("dailyRange.startDate.year", fmt.Sprint(dailyRangeStartDateYear)) 691 return c 692 } 693 694 // Fields allows partial responses to be retrieved. See 695 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 696 // details. 697 func (c *LocationsFetchMultiDailyMetricsTimeSeriesCall) Fields(s ...googleapi.Field) *LocationsFetchMultiDailyMetricsTimeSeriesCall { 698 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 699 return c 700 } 701 702 // IfNoneMatch sets an optional parameter which makes the operation fail if the 703 // object's ETag matches the given value. This is useful for getting updates 704 // only after the object has changed since the last request. 705 func (c *LocationsFetchMultiDailyMetricsTimeSeriesCall) IfNoneMatch(entityTag string) *LocationsFetchMultiDailyMetricsTimeSeriesCall { 706 c.ifNoneMatch_ = entityTag 707 return c 708 } 709 710 // Context sets the context to be used in this call's Do method. 711 func (c *LocationsFetchMultiDailyMetricsTimeSeriesCall) Context(ctx context.Context) *LocationsFetchMultiDailyMetricsTimeSeriesCall { 712 c.ctx_ = ctx 713 return c 714 } 715 716 // Header returns a http.Header that can be modified by the caller to add 717 // headers to the request. 718 func (c *LocationsFetchMultiDailyMetricsTimeSeriesCall) Header() http.Header { 719 if c.header_ == nil { 720 c.header_ = make(http.Header) 721 } 722 return c.header_ 723 } 724 725 func (c *LocationsFetchMultiDailyMetricsTimeSeriesCall) doRequest(alt string) (*http.Response, error) { 726 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) 727 if c.ifNoneMatch_ != "" { 728 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 729 } 730 var body io.Reader = nil 731 c.urlParams_.Set("alt", alt) 732 c.urlParams_.Set("prettyPrint", "false") 733 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+location}:fetchMultiDailyMetricsTimeSeries") 734 urls += "?" + c.urlParams_.Encode() 735 req, err := http.NewRequest("GET", urls, body) 736 if err != nil { 737 return nil, err 738 } 739 req.Header = reqHeaders 740 googleapi.Expand(req.URL, map[string]string{ 741 "location": c.location, 742 }) 743 return gensupport.SendRequest(c.ctx_, c.s.client, req) 744 } 745 746 // Do executes the "businessprofileperformance.locations.fetchMultiDailyMetricsTimeSeries" call. 747 // Any non-2xx status code is an error. Response headers are in either 748 // *FetchMultiDailyMetricsTimeSeriesResponse.ServerResponse.Header or (if a 749 // response was returned at all) in error.(*googleapi.Error).Header. Use 750 // googleapi.IsNotModified to check whether the returned error was because 751 // http.StatusNotModified was returned. 752 func (c *LocationsFetchMultiDailyMetricsTimeSeriesCall) Do(opts ...googleapi.CallOption) (*FetchMultiDailyMetricsTimeSeriesResponse, error) { 753 gensupport.SetOptions(c.urlParams_, opts...) 754 res, err := c.doRequest("json") 755 if res != nil && res.StatusCode == http.StatusNotModified { 756 if res.Body != nil { 757 res.Body.Close() 758 } 759 return nil, gensupport.WrapError(&googleapi.Error{ 760 Code: res.StatusCode, 761 Header: res.Header, 762 }) 763 } 764 if err != nil { 765 return nil, err 766 } 767 defer googleapi.CloseBody(res) 768 if err := googleapi.CheckResponse(res); err != nil { 769 return nil, gensupport.WrapError(err) 770 } 771 ret := &FetchMultiDailyMetricsTimeSeriesResponse{ 772 ServerResponse: googleapi.ServerResponse{ 773 Header: res.Header, 774 HTTPStatusCode: res.StatusCode, 775 }, 776 } 777 target := &ret 778 if err := gensupport.DecodeResponse(target, res); err != nil { 779 return nil, err 780 } 781 return ret, nil 782 } 783 784 type LocationsGetDailyMetricsTimeSeriesCall struct { 785 s *Service 786 name string 787 urlParams_ gensupport.URLParams 788 ifNoneMatch_ string 789 ctx_ context.Context 790 header_ http.Header 791 } 792 793 // GetDailyMetricsTimeSeries: Returns the values for each date from a given 794 // time range that are associated with the specific daily metric. Example 795 // request: `GET 796 // 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` 797 // 798 // - name: The location for which the time series should be fetched. Format: 799 // locations/{location_id} where location_id is an unobfuscated listing id. 800 func (r *LocationsService) GetDailyMetricsTimeSeries(name string) *LocationsGetDailyMetricsTimeSeriesCall { 801 c := &LocationsGetDailyMetricsTimeSeriesCall{s: r.s, urlParams_: make(gensupport.URLParams)} 802 c.name = name 803 return c 804 } 805 806 // DailyMetric sets the optional parameter "dailyMetric": Required. The metric 807 // to retrieve time series. 808 // 809 // Possible values: 810 // 811 // "DAILY_METRIC_UNKNOWN" - Represents the default unknown value. 812 // "BUSINESS_IMPRESSIONS_DESKTOP_MAPS" - Business impressions on Google Maps 813 // 814 // on Desktop devices. Multiple impressions by a unique user within a single 815 // day are counted as a single impression. 816 // 817 // "BUSINESS_IMPRESSIONS_DESKTOP_SEARCH" - Business impressions on Google 818 // 819 // Search on Desktop devices. Multiple impressions by a unique user within a 820 // single day are counted as a single impression. 821 // 822 // "BUSINESS_IMPRESSIONS_MOBILE_MAPS" - Business impressions on Google Maps 823 // 824 // on Mobile devices. Multiple impressions by a unique user within a single day 825 // are counted as a single impression. 826 // 827 // "BUSINESS_IMPRESSIONS_MOBILE_SEARCH" - Business impressions on Google 828 // 829 // Search on Mobile devices. Multiple impressions by a unique user within a 830 // single day are counted as a single impression. 831 // 832 // "BUSINESS_CONVERSATIONS" - The number of message conversations received on 833 // 834 // the business profile. 835 // 836 // "BUSINESS_DIRECTION_REQUESTS" - The number of times a direction request 837 // 838 // was requested to the business location. 839 // 840 // "CALL_CLICKS" - The number of times the business profile call button was 841 // 842 // clicked. 843 // 844 // "WEBSITE_CLICKS" - The number of times the business profile website was 845 // 846 // clicked. 847 // 848 // "BUSINESS_BOOKINGS" - The number of bookings made from the business 849 // 850 // profile via Reserve with Google. 851 // 852 // "BUSINESS_FOOD_ORDERS" - The number of food orders received from the 853 // 854 // business profile. 855 // 856 // "BUSINESS_FOOD_MENU_CLICKS" - The number of clicks to view or interact 857 // 858 // with the menu content on the business profile. Multiple clicks by a unique 859 // user within a single day are counted as 1. 860 func (c *LocationsGetDailyMetricsTimeSeriesCall) DailyMetric(dailyMetric string) *LocationsGetDailyMetricsTimeSeriesCall { 861 c.urlParams_.Set("dailyMetric", dailyMetric) 862 return c 863 } 864 865 // DailyRangeEndDateDay sets the optional parameter "dailyRange.endDate.day": 866 // Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 867 // to specify a year by itself or a year and month where the day isn't 868 // significant. 869 func (c *LocationsGetDailyMetricsTimeSeriesCall) DailyRangeEndDateDay(dailyRangeEndDateDay int64) *LocationsGetDailyMetricsTimeSeriesCall { 870 c.urlParams_.Set("dailyRange.endDate.day", fmt.Sprint(dailyRangeEndDateDay)) 871 return c 872 } 873 874 // DailyRangeEndDateMonth sets the optional parameter 875 // "dailyRange.endDate.month": Month of a year. Must be from 1 to 12, or 0 to 876 // specify a year without a month and day. 877 func (c *LocationsGetDailyMetricsTimeSeriesCall) DailyRangeEndDateMonth(dailyRangeEndDateMonth int64) *LocationsGetDailyMetricsTimeSeriesCall { 878 c.urlParams_.Set("dailyRange.endDate.month", fmt.Sprint(dailyRangeEndDateMonth)) 879 return c 880 } 881 882 // DailyRangeEndDateYear sets the optional parameter "dailyRange.endDate.year": 883 // Year of the date. Must be from 1 to 9999, or 0 to specify a date without a 884 // year. 885 func (c *LocationsGetDailyMetricsTimeSeriesCall) DailyRangeEndDateYear(dailyRangeEndDateYear int64) *LocationsGetDailyMetricsTimeSeriesCall { 886 c.urlParams_.Set("dailyRange.endDate.year", fmt.Sprint(dailyRangeEndDateYear)) 887 return c 888 } 889 890 // DailyRangeStartDateDay sets the optional parameter 891 // "dailyRange.startDate.day": Day of a month. Must be from 1 to 31 and valid 892 // for the year and month, or 0 to specify a year by itself or a year and month 893 // where the day isn't significant. 894 func (c *LocationsGetDailyMetricsTimeSeriesCall) DailyRangeStartDateDay(dailyRangeStartDateDay int64) *LocationsGetDailyMetricsTimeSeriesCall { 895 c.urlParams_.Set("dailyRange.startDate.day", fmt.Sprint(dailyRangeStartDateDay)) 896 return c 897 } 898 899 // DailyRangeStartDateMonth sets the optional parameter 900 // "dailyRange.startDate.month": Month of a year. Must be from 1 to 12, or 0 to 901 // specify a year without a month and day. 902 func (c *LocationsGetDailyMetricsTimeSeriesCall) DailyRangeStartDateMonth(dailyRangeStartDateMonth int64) *LocationsGetDailyMetricsTimeSeriesCall { 903 c.urlParams_.Set("dailyRange.startDate.month", fmt.Sprint(dailyRangeStartDateMonth)) 904 return c 905 } 906 907 // DailyRangeStartDateYear sets the optional parameter 908 // "dailyRange.startDate.year": Year of the date. Must be from 1 to 9999, or 0 909 // to specify a date without a year. 910 func (c *LocationsGetDailyMetricsTimeSeriesCall) DailyRangeStartDateYear(dailyRangeStartDateYear int64) *LocationsGetDailyMetricsTimeSeriesCall { 911 c.urlParams_.Set("dailyRange.startDate.year", fmt.Sprint(dailyRangeStartDateYear)) 912 return c 913 } 914 915 // DailySubEntityTypeDayOfWeek sets the optional parameter 916 // "dailySubEntityType.dayOfWeek": Represents the day of the week. Eg: MONDAY. 917 // Currently supported DailyMetrics = NONE. 918 // 919 // Possible values: 920 // 921 // "DAY_OF_WEEK_UNSPECIFIED" - The day of the week is unspecified. 922 // "MONDAY" - Monday 923 // "TUESDAY" - Tuesday 924 // "WEDNESDAY" - Wednesday 925 // "THURSDAY" - Thursday 926 // "FRIDAY" - Friday 927 // "SATURDAY" - Saturday 928 // "SUNDAY" - Sunday 929 func (c *LocationsGetDailyMetricsTimeSeriesCall) DailySubEntityTypeDayOfWeek(dailySubEntityTypeDayOfWeek string) *LocationsGetDailyMetricsTimeSeriesCall { 930 c.urlParams_.Set("dailySubEntityType.dayOfWeek", dailySubEntityTypeDayOfWeek) 931 return c 932 } 933 934 // DailySubEntityTypeTimeOfDayHours sets the optional parameter 935 // "dailySubEntityType.timeOfDay.hours": Hours of day in 24 hour format. Should 936 // be from 0 to 23. An API may choose to allow the value "24:00:00" for 937 // scenarios like business closing time. 938 func (c *LocationsGetDailyMetricsTimeSeriesCall) DailySubEntityTypeTimeOfDayHours(dailySubEntityTypeTimeOfDayHours int64) *LocationsGetDailyMetricsTimeSeriesCall { 939 c.urlParams_.Set("dailySubEntityType.timeOfDay.hours", fmt.Sprint(dailySubEntityTypeTimeOfDayHours)) 940 return c 941 } 942 943 // DailySubEntityTypeTimeOfDayMinutes sets the optional parameter 944 // "dailySubEntityType.timeOfDay.minutes": Minutes of hour of day. Must be from 945 // 0 to 59. 946 func (c *LocationsGetDailyMetricsTimeSeriesCall) DailySubEntityTypeTimeOfDayMinutes(dailySubEntityTypeTimeOfDayMinutes int64) *LocationsGetDailyMetricsTimeSeriesCall { 947 c.urlParams_.Set("dailySubEntityType.timeOfDay.minutes", fmt.Sprint(dailySubEntityTypeTimeOfDayMinutes)) 948 return c 949 } 950 951 // DailySubEntityTypeTimeOfDayNanos sets the optional parameter 952 // "dailySubEntityType.timeOfDay.nanos": Fractions of seconds in nanoseconds. 953 // Must be from 0 to 999,999,999. 954 func (c *LocationsGetDailyMetricsTimeSeriesCall) DailySubEntityTypeTimeOfDayNanos(dailySubEntityTypeTimeOfDayNanos int64) *LocationsGetDailyMetricsTimeSeriesCall { 955 c.urlParams_.Set("dailySubEntityType.timeOfDay.nanos", fmt.Sprint(dailySubEntityTypeTimeOfDayNanos)) 956 return c 957 } 958 959 // DailySubEntityTypeTimeOfDaySeconds sets the optional parameter 960 // "dailySubEntityType.timeOfDay.seconds": Seconds of minutes of the time. Must 961 // normally be from 0 to 59. An API may allow the value 60 if it allows 962 // leap-seconds. 963 func (c *LocationsGetDailyMetricsTimeSeriesCall) DailySubEntityTypeTimeOfDaySeconds(dailySubEntityTypeTimeOfDaySeconds int64) *LocationsGetDailyMetricsTimeSeriesCall { 964 c.urlParams_.Set("dailySubEntityType.timeOfDay.seconds", fmt.Sprint(dailySubEntityTypeTimeOfDaySeconds)) 965 return c 966 } 967 968 // Fields allows partial responses to be retrieved. See 969 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 970 // details. 971 func (c *LocationsGetDailyMetricsTimeSeriesCall) Fields(s ...googleapi.Field) *LocationsGetDailyMetricsTimeSeriesCall { 972 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 973 return c 974 } 975 976 // IfNoneMatch sets an optional parameter which makes the operation fail if the 977 // object's ETag matches the given value. This is useful for getting updates 978 // only after the object has changed since the last request. 979 func (c *LocationsGetDailyMetricsTimeSeriesCall) IfNoneMatch(entityTag string) *LocationsGetDailyMetricsTimeSeriesCall { 980 c.ifNoneMatch_ = entityTag 981 return c 982 } 983 984 // Context sets the context to be used in this call's Do method. 985 func (c *LocationsGetDailyMetricsTimeSeriesCall) Context(ctx context.Context) *LocationsGetDailyMetricsTimeSeriesCall { 986 c.ctx_ = ctx 987 return c 988 } 989 990 // Header returns a http.Header that can be modified by the caller to add 991 // headers to the request. 992 func (c *LocationsGetDailyMetricsTimeSeriesCall) Header() http.Header { 993 if c.header_ == nil { 994 c.header_ = make(http.Header) 995 } 996 return c.header_ 997 } 998 999 func (c *LocationsGetDailyMetricsTimeSeriesCall) doRequest(alt string) (*http.Response, error) { 1000 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) 1001 if c.ifNoneMatch_ != "" { 1002 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1003 } 1004 var body io.Reader = nil 1005 c.urlParams_.Set("alt", alt) 1006 c.urlParams_.Set("prettyPrint", "false") 1007 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:getDailyMetricsTimeSeries") 1008 urls += "?" + c.urlParams_.Encode() 1009 req, err := http.NewRequest("GET", urls, body) 1010 if err != nil { 1011 return nil, err 1012 } 1013 req.Header = reqHeaders 1014 googleapi.Expand(req.URL, map[string]string{ 1015 "name": c.name, 1016 }) 1017 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1018 } 1019 1020 // Do executes the "businessprofileperformance.locations.getDailyMetricsTimeSeries" call. 1021 // Any non-2xx status code is an error. Response headers are in either 1022 // *GetDailyMetricsTimeSeriesResponse.ServerResponse.Header or (if a response 1023 // was returned at all) in error.(*googleapi.Error).Header. Use 1024 // googleapi.IsNotModified to check whether the returned error was because 1025 // http.StatusNotModified was returned. 1026 func (c *LocationsGetDailyMetricsTimeSeriesCall) Do(opts ...googleapi.CallOption) (*GetDailyMetricsTimeSeriesResponse, error) { 1027 gensupport.SetOptions(c.urlParams_, opts...) 1028 res, err := c.doRequest("json") 1029 if res != nil && res.StatusCode == http.StatusNotModified { 1030 if res.Body != nil { 1031 res.Body.Close() 1032 } 1033 return nil, gensupport.WrapError(&googleapi.Error{ 1034 Code: res.StatusCode, 1035 Header: res.Header, 1036 }) 1037 } 1038 if err != nil { 1039 return nil, err 1040 } 1041 defer googleapi.CloseBody(res) 1042 if err := googleapi.CheckResponse(res); err != nil { 1043 return nil, gensupport.WrapError(err) 1044 } 1045 ret := &GetDailyMetricsTimeSeriesResponse{ 1046 ServerResponse: googleapi.ServerResponse{ 1047 Header: res.Header, 1048 HTTPStatusCode: res.StatusCode, 1049 }, 1050 } 1051 target := &ret 1052 if err := gensupport.DecodeResponse(target, res); err != nil { 1053 return nil, err 1054 } 1055 return ret, nil 1056 } 1057 1058 type LocationsSearchkeywordsImpressionsMonthlyListCall struct { 1059 s *Service 1060 parent string 1061 urlParams_ gensupport.URLParams 1062 ifNoneMatch_ string 1063 ctx_ context.Context 1064 header_ http.Header 1065 } 1066 1067 // List: Returns the search keywords used to find a business in search or maps. 1068 // Each search keyword is accompanied by impressions which are aggregated on a 1069 // monthly basis. Example request: `GET 1070 // 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` 1071 // 1072 // - parent: The location for which the time series should be fetched. Format: 1073 // locations/{location_id} where location_id is an unobfuscated listing id. 1074 func (r *LocationsSearchkeywordsImpressionsMonthlyService) List(parent string) *LocationsSearchkeywordsImpressionsMonthlyListCall { 1075 c := &LocationsSearchkeywordsImpressionsMonthlyListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1076 c.parent = parent 1077 return c 1078 } 1079 1080 // MonthlyRangeEndMonthDay sets the optional parameter 1081 // "monthlyRange.endMonth.day": Day of a month. Must be from 1 to 31 and valid 1082 // for the year and month, or 0 to specify a year by itself or a year and month 1083 // where the day isn't significant. 1084 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) MonthlyRangeEndMonthDay(monthlyRangeEndMonthDay int64) *LocationsSearchkeywordsImpressionsMonthlyListCall { 1085 c.urlParams_.Set("monthlyRange.endMonth.day", fmt.Sprint(monthlyRangeEndMonthDay)) 1086 return c 1087 } 1088 1089 // MonthlyRangeEndMonthMonth sets the optional parameter 1090 // "monthlyRange.endMonth.month": Month of a year. Must be from 1 to 12, or 0 1091 // to specify a year without a month and day. 1092 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) MonthlyRangeEndMonthMonth(monthlyRangeEndMonthMonth int64) *LocationsSearchkeywordsImpressionsMonthlyListCall { 1093 c.urlParams_.Set("monthlyRange.endMonth.month", fmt.Sprint(monthlyRangeEndMonthMonth)) 1094 return c 1095 } 1096 1097 // MonthlyRangeEndMonthYear sets the optional parameter 1098 // "monthlyRange.endMonth.year": Year of the date. Must be from 1 to 9999, or 0 1099 // to specify a date without a year. 1100 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) MonthlyRangeEndMonthYear(monthlyRangeEndMonthYear int64) *LocationsSearchkeywordsImpressionsMonthlyListCall { 1101 c.urlParams_.Set("monthlyRange.endMonth.year", fmt.Sprint(monthlyRangeEndMonthYear)) 1102 return c 1103 } 1104 1105 // MonthlyRangeStartMonthDay sets the optional parameter 1106 // "monthlyRange.startMonth.day": Day of a month. Must be from 1 to 31 and 1107 // valid for the year and month, or 0 to specify a year by itself or a year and 1108 // month where the day isn't significant. 1109 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) MonthlyRangeStartMonthDay(monthlyRangeStartMonthDay int64) *LocationsSearchkeywordsImpressionsMonthlyListCall { 1110 c.urlParams_.Set("monthlyRange.startMonth.day", fmt.Sprint(monthlyRangeStartMonthDay)) 1111 return c 1112 } 1113 1114 // MonthlyRangeStartMonthMonth sets the optional parameter 1115 // "monthlyRange.startMonth.month": Month of a year. Must be from 1 to 12, or 0 1116 // to specify a year without a month and day. 1117 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) MonthlyRangeStartMonthMonth(monthlyRangeStartMonthMonth int64) *LocationsSearchkeywordsImpressionsMonthlyListCall { 1118 c.urlParams_.Set("monthlyRange.startMonth.month", fmt.Sprint(monthlyRangeStartMonthMonth)) 1119 return c 1120 } 1121 1122 // MonthlyRangeStartMonthYear sets the optional parameter 1123 // "monthlyRange.startMonth.year": Year of the date. Must be from 1 to 9999, or 1124 // 0 to specify a date without a year. 1125 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) MonthlyRangeStartMonthYear(monthlyRangeStartMonthYear int64) *LocationsSearchkeywordsImpressionsMonthlyListCall { 1126 c.urlParams_.Set("monthlyRange.startMonth.year", fmt.Sprint(monthlyRangeStartMonthYear)) 1127 return c 1128 } 1129 1130 // PageSize sets the optional parameter "pageSize": The number of results 1131 // requested. The default page size is 100. Page size can be set to a maximum 1132 // of 100. 1133 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) PageSize(pageSize int64) *LocationsSearchkeywordsImpressionsMonthlyListCall { 1134 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1135 return c 1136 } 1137 1138 // PageToken sets the optional parameter "pageToken": A token indicating the 1139 // next paginated result to be returned. 1140 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) PageToken(pageToken string) *LocationsSearchkeywordsImpressionsMonthlyListCall { 1141 c.urlParams_.Set("pageToken", pageToken) 1142 return c 1143 } 1144 1145 // Fields allows partial responses to be retrieved. See 1146 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1147 // details. 1148 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) Fields(s ...googleapi.Field) *LocationsSearchkeywordsImpressionsMonthlyListCall { 1149 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1150 return c 1151 } 1152 1153 // IfNoneMatch sets an optional parameter which makes the operation fail if the 1154 // object's ETag matches the given value. This is useful for getting updates 1155 // only after the object has changed since the last request. 1156 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) IfNoneMatch(entityTag string) *LocationsSearchkeywordsImpressionsMonthlyListCall { 1157 c.ifNoneMatch_ = entityTag 1158 return c 1159 } 1160 1161 // Context sets the context to be used in this call's Do method. 1162 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) Context(ctx context.Context) *LocationsSearchkeywordsImpressionsMonthlyListCall { 1163 c.ctx_ = ctx 1164 return c 1165 } 1166 1167 // Header returns a http.Header that can be modified by the caller to add 1168 // headers to the request. 1169 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) Header() http.Header { 1170 if c.header_ == nil { 1171 c.header_ = make(http.Header) 1172 } 1173 return c.header_ 1174 } 1175 1176 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) doRequest(alt string) (*http.Response, error) { 1177 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) 1178 if c.ifNoneMatch_ != "" { 1179 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1180 } 1181 var body io.Reader = nil 1182 c.urlParams_.Set("alt", alt) 1183 c.urlParams_.Set("prettyPrint", "false") 1184 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/searchkeywords/impressions/monthly") 1185 urls += "?" + c.urlParams_.Encode() 1186 req, err := http.NewRequest("GET", urls, body) 1187 if err != nil { 1188 return nil, err 1189 } 1190 req.Header = reqHeaders 1191 googleapi.Expand(req.URL, map[string]string{ 1192 "parent": c.parent, 1193 }) 1194 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1195 } 1196 1197 // Do executes the "businessprofileperformance.locations.searchkeywords.impressions.monthly.list" call. 1198 // Any non-2xx status code is an error. Response headers are in either 1199 // *ListSearchKeywordImpressionsMonthlyResponse.ServerResponse.Header or (if a 1200 // response was returned at all) in error.(*googleapi.Error).Header. Use 1201 // googleapi.IsNotModified to check whether the returned error was because 1202 // http.StatusNotModified was returned. 1203 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) Do(opts ...googleapi.CallOption) (*ListSearchKeywordImpressionsMonthlyResponse, error) { 1204 gensupport.SetOptions(c.urlParams_, opts...) 1205 res, err := c.doRequest("json") 1206 if res != nil && res.StatusCode == http.StatusNotModified { 1207 if res.Body != nil { 1208 res.Body.Close() 1209 } 1210 return nil, gensupport.WrapError(&googleapi.Error{ 1211 Code: res.StatusCode, 1212 Header: res.Header, 1213 }) 1214 } 1215 if err != nil { 1216 return nil, err 1217 } 1218 defer googleapi.CloseBody(res) 1219 if err := googleapi.CheckResponse(res); err != nil { 1220 return nil, gensupport.WrapError(err) 1221 } 1222 ret := &ListSearchKeywordImpressionsMonthlyResponse{ 1223 ServerResponse: googleapi.ServerResponse{ 1224 Header: res.Header, 1225 HTTPStatusCode: res.StatusCode, 1226 }, 1227 } 1228 target := &ret 1229 if err := gensupport.DecodeResponse(target, res); err != nil { 1230 return nil, err 1231 } 1232 return ret, nil 1233 } 1234 1235 // Pages invokes f for each page of results. 1236 // A non-nil error returned from f will halt the iteration. 1237 // The provided context supersedes any context provided to the Context method. 1238 func (c *LocationsSearchkeywordsImpressionsMonthlyListCall) Pages(ctx context.Context, f func(*ListSearchKeywordImpressionsMonthlyResponse) error) error { 1239 c.ctx_ = ctx 1240 defer c.PageToken(c.urlParams_.Get("pageToken")) 1241 for { 1242 x, err := c.Do() 1243 if err != nil { 1244 return err 1245 } 1246 if err := f(x); err != nil { 1247 return err 1248 } 1249 if x.NextPageToken == "" { 1250 return nil 1251 } 1252 c.PageToken(x.NextPageToken) 1253 } 1254 } 1255