Debian Codegraph @

mybusinessbusinesscalls/v1/mybusinessbusinesscalls-gen.go

raw
1 // Copyright 2023 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 mybusinessbusinesscalls provides access to the My Business Business Calls API.
8 //
9 // For product documentation, see: https://developers.google.com/my-business/
10 //
11 // # Creating a client
12 //
13 // Usage example:
14 //
15 // import "google.golang.org/api/mybusinessbusinesscalls/v1"
16 // ...
17 // ctx := context.Background()
18 // mybusinessbusinesscallsService, err := mybusinessbusinesscalls.NewService(ctx)
19 //
20 // In this example, Google Application Default Credentials are used for authentication.
21 //
22 // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
23 //
24 // # Other authentication options
25 //
26 // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
27 //
28 // mybusinessbusinesscallsService, err := mybusinessbusinesscalls.NewService(ctx, option.WithAPIKey("AIza..."))
29 //
30 // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
31 //
32 // config := &oauth2.Config{...}
33 // // ...
34 // token, err := config.Exchange(ctx, ...)
35 // mybusinessbusinesscallsService, err := mybusinessbusinesscalls.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
36 //
37 // See https://godoc.org/google.golang.org/api/option/ for details on options.
38 package mybusinessbusinesscalls // import "google.golang.org/api/mybusinessbusinesscalls/v1"
39
40 import (
41 "bytes"
42 "context"
43 "encoding/json"
44 "errors"
45 "fmt"
46 "io"
47 "net/http"
48 "net/url"
49 "strconv"
50 "strings"
51
52 googleapi "google.golang.org/api/googleapi"
53 internal "google.golang.org/api/internal"
54 gensupport "google.golang.org/api/internal/gensupport"
55 option "google.golang.org/api/option"
56 internaloption "google.golang.org/api/option/internaloption"
57 htransport "google.golang.org/api/transport/http"
58 )
59
60 // Always reference these packages, just in case the auto-generated code
61 // below doesn't.
62 var _ = bytes.NewBuffer
63 var _ = strconv.Itoa
64 var _ = fmt.Sprintf
65 var _ = json.NewDecoder
66 var _ = io.Copy
67 var _ = url.Parse
68 var _ = gensupport.MarshalJSON
69 var _ = googleapi.Version
70 var _ = errors.New
71 var _ = strings.Replace
72 var _ = context.Canceled
73 var _ = internaloption.WithDefaultEndpoint
74 var _ = internal.Version
75
76 const apiId = "mybusinessbusinesscalls:v1"
77 const apiName = "mybusinessbusinesscalls"
78 const apiVersion = "v1"
79 const basePath = "https://mybusinessbusinesscalls.googleapis.com/"
80 const mtlsBasePath = "https://mybusinessbusinesscalls.mtls.googleapis.com/"
81
82 // NewService creates a new Service.
83 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
84 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
85 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
86 client, endpoint, err := htransport.NewClient(ctx, opts...)
87 if err != nil {
88 return nil, err
89 }
90 s, err := New(client)
91 if err != nil {
92 return nil, err
93 }
94 if endpoint != "" {
95 s.BasePath = endpoint
96 }
97 return s, nil
98 }
99
100 // New creates a new Service. It uses the provided http.Client for requests.
101 //
102 // Deprecated: please use NewService instead.
103 // To provide a custom HTTP client, use option.WithHTTPClient.
104 // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
105 func New(client *http.Client) (*Service, error) {
106 if client == nil {
107 return nil, errors.New("client is nil")
108 }
109 s := &Service{client: client, BasePath: basePath}
110 s.Locations = NewLocationsService(s)
111 return s, nil
112 }
113
114 type Service struct {
115 client *http.Client
116 BasePath string // API endpoint base URL
117 UserAgent string // optional additional User-Agent fragment
118
119 Locations *LocationsService
120 }
121
122 func (s *Service) userAgent() string {
123 if s.UserAgent == "" {
124 return googleapi.UserAgent
125 }
126 return googleapi.UserAgent + " " + s.UserAgent
127 }
128
129 func NewLocationsService(s *Service) *LocationsService {
130 rs := &LocationsService{s: s}
131 rs.Businesscallsinsights = NewLocationsBusinesscallsinsightsService(s)
132 return rs
133 }
134
135 type LocationsService struct {
136 s *Service
137
138 Businesscallsinsights *LocationsBusinesscallsinsightsService
139 }
140
141 func NewLocationsBusinesscallsinsightsService(s *Service) *LocationsBusinesscallsinsightsService {
142 rs := &LocationsBusinesscallsinsightsService{s: s}
143 return rs
144 }
145
146 type LocationsBusinesscallsinsightsService struct {
147 s *Service
148 }
149
150 // AggregateMetrics: Metrics aggregated over the input time range.
151 type AggregateMetrics struct {
152 // AnsweredCallsCount: Total count of answered calls.
153 AnsweredCallsCount int64 `json:"answeredCallsCount,omitempty"`
154
155 // EndDate: End date for this metric.
156 EndDate *Date `json:"endDate,omitempty"`
157
158 // HourlyMetrics: A list of metrics by hour of day.
159 HourlyMetrics []*HourlyMetrics `json:"hourlyMetrics,omitempty"`
160
161 // MissedCallsCount: Total count of missed calls.
162 MissedCallsCount int64 `json:"missedCallsCount,omitempty"`
163
164 // StartDate: Date for this metric. If metric is monthly, only year and
165 // month are used.
166 StartDate *Date `json:"startDate,omitempty"`
167
168 // WeekdayMetrics: A list of metrics by day of week.
169 WeekdayMetrics []*WeekDayMetrics `json:"weekdayMetrics,omitempty"`
170
171 // ForceSendFields is a list of field names (e.g. "AnsweredCallsCount")
172 // to unconditionally include in API requests. By default, fields with
173 // empty or default values are omitted from API requests. However, any
174 // non-pointer, non-interface field appearing in ForceSendFields will be
175 // sent to the server regardless of whether the field is empty or not.
176 // This may be used to include empty fields in Patch requests.
177 ForceSendFields []string `json:"-"`
178
179 // NullFields is a list of field names (e.g. "AnsweredCallsCount") to
180 // include in API requests with the JSON null value. By default, fields
181 // with empty values are omitted from API requests. However, any field
182 // with an empty value appearing in NullFields will be sent to the
183 // server as null. It is an error if a field in this list has a
184 // non-empty value. This may be used to include null fields in Patch
185 // requests.
186 NullFields []string `json:"-"`
187 }
188
189 func (s *AggregateMetrics) MarshalJSON() ([]byte, error) {
190 type NoMethod AggregateMetrics
191 raw := NoMethod(*s)
192 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
193 }
194
195 // BusinessCallsInsights: Insights for calls made to a location.
196 type BusinessCallsInsights struct {
197 // AggregateMetrics: Metric for the time range based on start_date and
198 // end_date.
199 AggregateMetrics *AggregateMetrics `json:"aggregateMetrics,omitempty"`
200
201 // MetricType: The metric for which the value applies.
202 //
203 // Possible values:
204 // "METRIC_TYPE_UNSPECIFIED" - Type of metric is unspecified.
205 // "AGGREGATE_COUNT" - The metrics provided are counts aggregated over
206 // the input time_range.
207 MetricType string `json:"metricType,omitempty"`
208
209 // Name: Required. The resource name of the calls insights. Format:
210 // locations/{location}/businesscallsinsights
211 Name string `json:"name,omitempty"`
212
213 // ForceSendFields is a list of field names (e.g. "AggregateMetrics") to
214 // unconditionally include in API requests. By default, fields with
215 // empty or default values are omitted from API requests. However, any
216 // non-pointer, non-interface field appearing in ForceSendFields will be
217 // sent to the server regardless of whether the field is empty or not.
218 // This may be used to include empty fields in Patch requests.
219 ForceSendFields []string `json:"-"`
220
221 // NullFields is a list of field names (e.g. "AggregateMetrics") to
222 // include in API requests with the JSON null value. By default, fields
223 // with empty values are omitted from API requests. However, any field
224 // with an empty value appearing in NullFields will be sent to the
225 // server as null. It is an error if a field in this list has a
226 // non-empty value. This may be used to include null fields in Patch
227 // requests.
228 NullFields []string `json:"-"`
229 }
230
231 func (s *BusinessCallsInsights) MarshalJSON() ([]byte, error) {
232 type NoMethod BusinessCallsInsights
233 raw := NoMethod(*s)
234 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
235 }
236
237 // BusinessCallsSettings: Business calls settings for a location.
238 type BusinessCallsSettings struct {
239 // CallsState: Required. The state of this location's enrollment in
240 // Business calls.
241 //
242 // Possible values:
243 // "CALLS_STATE_UNSPECIFIED" - Unspecified.
244 // "ENABLED" - Business calls is enabled for the location.
245 // "DISABLED" - Business calls is disabled for the location.
246 CallsState string `json:"callsState,omitempty"`
247
248 // ConsentTime: Input only. Time when the end user provided consent to
249 // the API user to enable business calls.
250 ConsentTime string `json:"consentTime,omitempty"`
251
252 // Name: Required. The resource name of the calls settings. Format:
253 // locations/{location}/businesscallssettings
254 Name string `json:"name,omitempty"`
255
256 // ServerResponse contains the HTTP response code and headers from the
257 // server.
258 googleapi.ServerResponse `json:"-"`
259
260 // ForceSendFields is a list of field names (e.g. "CallsState") to
261 // unconditionally include in API requests. By default, fields with
262 // empty or default values are omitted from API requests. However, any
263 // non-pointer, non-interface field appearing in ForceSendFields will be
264 // sent to the server regardless of whether the field is empty or not.
265 // This may be used to include empty fields in Patch requests.
266 ForceSendFields []string `json:"-"`
267
268 // NullFields is a list of field names (e.g. "CallsState") to include in
269 // API requests with the JSON null value. By default, fields with empty
270 // values are omitted from API requests. However, any field with an
271 // empty value appearing in NullFields will be sent to the server as
272 // null. It is an error if a field in this list has a non-empty value.
273 // This may be used to include null fields in Patch requests.
274 NullFields []string `json:"-"`
275 }
276
277 func (s *BusinessCallsSettings) MarshalJSON() ([]byte, error) {
278 type NoMethod BusinessCallsSettings
279 raw := NoMethod(*s)
280 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
281 }
282
283 // Date: Represents a whole or partial calendar date, such as a
284 // birthday. The time of day and time zone are either specified
285 // elsewhere or are insignificant. The date is relative to the Gregorian
286 // Calendar. This can represent one of the following: * A full date,
287 // with non-zero year, month, and day values. * A month and day, with a
288 // zero year (for example, an anniversary). * A year on its own, with a
289 // zero month and a zero day. * A year and month, with a zero day (for
290 // example, a credit card expiration date). Related types: *
291 // google.type.TimeOfDay * google.type.DateTime *
292 // google.protobuf.Timestamp
293 type Date struct {
294 // Day: Day of a month. Must be from 1 to 31 and valid for the year and
295 // month, or 0 to specify a year by itself or a year and month where the
296 // day isn't significant.
297 Day int64 `json:"day,omitempty"`
298
299 // Month: Month of a year. Must be from 1 to 12, or 0 to specify a year
300 // without a month and day.
301 Month int64 `json:"month,omitempty"`
302
303 // Year: Year of the date. Must be from 1 to 9999, or 0 to specify a
304 // date without a year.
305 Year int64 `json:"year,omitempty"`
306
307 // ForceSendFields is a list of field names (e.g. "Day") to
308 // unconditionally include in API requests. By default, fields with
309 // empty or default values are omitted from API requests. However, any
310 // non-pointer, non-interface field appearing in ForceSendFields will be
311 // sent to the server regardless of whether the field is empty or not.
312 // This may be used to include empty fields in Patch requests.
313 ForceSendFields []string `json:"-"`
314
315 // NullFields is a list of field names (e.g. "Day") to include in API
316 // requests with the JSON null value. By default, fields with empty
317 // values are omitted from API requests. However, any field with an
318 // empty value appearing in NullFields will be sent to the server as
319 // null. It is an error if a field in this list has a non-empty value.
320 // This may be used to include null fields in Patch requests.
321 NullFields []string `json:"-"`
322 }
323
324 func (s *Date) MarshalJSON() ([]byte, error) {
325 type NoMethod Date
326 raw := NoMethod(*s)
327 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
328 }
329
330 // HourlyMetrics: Metrics for an hour.
331 type HourlyMetrics struct {
332 // Hour: Hour of the day. Allowed values are 0-23.
333 Hour int64 `json:"hour,omitempty"`
334
335 // MissedCallsCount: Total count of missed calls for this hour.
336 MissedCallsCount int64 `json:"missedCallsCount,omitempty"`
337
338 // ForceSendFields is a list of field names (e.g. "Hour") to
339 // unconditionally include in API requests. By default, fields with
340 // empty or default values are omitted from API requests. However, any
341 // non-pointer, non-interface field appearing in ForceSendFields will be
342 // sent to the server regardless of whether the field is empty or not.
343 // This may be used to include empty fields in Patch requests.
344 ForceSendFields []string `json:"-"`
345
346 // NullFields is a list of field names (e.g. "Hour") to include in API
347 // requests with the JSON null value. By default, fields with empty
348 // values are omitted from API requests. However, any field with an
349 // empty value appearing in NullFields will be sent to the server as
350 // null. It is an error if a field in this list has a non-empty value.
351 // This may be used to include null fields in Patch requests.
352 NullFields []string `json:"-"`
353 }
354
355 func (s *HourlyMetrics) MarshalJSON() ([]byte, error) {
356 type NoMethod HourlyMetrics
357 raw := NoMethod(*s)
358 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
359 }
360
361 // ListBusinessCallsInsightsResponse: Response message for
362 // ListBusinessCallsInsights.
363 type ListBusinessCallsInsightsResponse struct {
364 // BusinessCallsInsights: A collection of business calls insights for
365 // the location.
366 BusinessCallsInsights []*BusinessCallsInsights `json:"businessCallsInsights,omitempty"`
367
368 // NextPageToken: A token, which can be sent as `page_token` to retrieve
369 // the next page. If this field is omitted, there are no subsequent
370 // pages. Some of the metric_types (e.g, AGGREGATE_COUNT) returns a
371 // single page. For these metrics, the next_page_token will be empty.
372 NextPageToken string `json:"nextPageToken,omitempty"`
373
374 // ServerResponse contains the HTTP response code and headers from the
375 // server.
376 googleapi.ServerResponse `json:"-"`
377
378 // ForceSendFields is a list of field names (e.g.
379 // "BusinessCallsInsights") to unconditionally include in API requests.
380 // By default, fields with empty or default values are omitted from API
381 // requests. However, any non-pointer, non-interface field appearing in
382 // ForceSendFields will be sent to the server regardless of whether the
383 // field is empty or not. This may be used to include empty fields in
384 // Patch requests.
385 ForceSendFields []string `json:"-"`
386
387 // NullFields is a list of field names (e.g. "BusinessCallsInsights") to
388 // include in API requests with the JSON null value. By default, fields
389 // with empty values are omitted from API requests. However, any field
390 // with an empty value appearing in NullFields will be sent to the
391 // server as null. It is an error if a field in this list has a
392 // non-empty value. This may be used to include null fields in Patch
393 // requests.
394 NullFields []string `json:"-"`
395 }
396
397 func (s *ListBusinessCallsInsightsResponse) MarshalJSON() ([]byte, error) {
398 type NoMethod ListBusinessCallsInsightsResponse
399 raw := NoMethod(*s)
400 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
401 }
402
403 // WeekDayMetrics: Metrics for a week day.
404 type WeekDayMetrics struct {
405 // Day: Day of the week. Allowed values are Sunday - Saturday.
406 //
407 // Possible values:
408 // "DAY_OF_WEEK_UNSPECIFIED" - The day of the week is unspecified.
409 // "MONDAY" - Monday
410 // "TUESDAY" - Tuesday
411 // "WEDNESDAY" - Wednesday
412 // "THURSDAY" - Thursday
413 // "FRIDAY" - Friday
414 // "SATURDAY" - Saturday
415 // "SUNDAY" - Sunday
416 Day string `json:"day,omitempty"`
417
418 // MissedCallsCount: Total count of missed calls for this hour.
419 MissedCallsCount int64 `json:"missedCallsCount,omitempty"`
420
421 // ForceSendFields is a list of field names (e.g. "Day") to
422 // unconditionally include in API requests. By default, fields with
423 // empty or default values are omitted from API requests. However, any
424 // non-pointer, non-interface field appearing in ForceSendFields will be
425 // sent to the server regardless of whether the field is empty or not.
426 // This may be used to include empty fields in Patch requests.
427 ForceSendFields []string `json:"-"`
428
429 // NullFields is a list of field names (e.g. "Day") to include in API
430 // requests with the JSON null value. By default, fields with empty
431 // values are omitted from API requests. However, any field with an
432 // empty value appearing in NullFields will be sent to the server as
433 // null. It is an error if a field in this list has a non-empty value.
434 // This may be used to include null fields in Patch requests.
435 NullFields []string `json:"-"`
436 }
437
438 func (s *WeekDayMetrics) MarshalJSON() ([]byte, error) {
439 type NoMethod WeekDayMetrics
440 raw := NoMethod(*s)
441 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
442 }
443
444 // method id "mybusinessbusinesscalls.locations.getBusinesscallssettings":
445
446 type LocationsGetBusinesscallssettingsCall struct {
447 s *Service
448 name string
449 urlParams_ gensupport.URLParams
450 ifNoneMatch_ string
451 ctx_ context.Context
452 header_ http.Header
453 }
454
455 // GetBusinesscallssettings: Returns the Business calls settings
456 // resource for the given location.
457 //
458 // - name: The BusinessCallsSettings to get. The `name` field is used to
459 // identify the business call settings to get. Format:
460 // locations/{location_id}/businesscallssettings.
461 func (r *LocationsService) GetBusinesscallssettings(name string) *LocationsGetBusinesscallssettingsCall {
462 c := &LocationsGetBusinesscallssettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
463 c.name = name
464 return c
465 }
466
467 // Fields allows partial responses to be retrieved. See
468 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
469 // for more information.
470 func (c *LocationsGetBusinesscallssettingsCall) Fields(s ...googleapi.Field) *LocationsGetBusinesscallssettingsCall {
471 c.urlParams_.Set("fields", googleapi.CombineFields(s))
472 return c
473 }
474
475 // IfNoneMatch sets the optional parameter which makes the operation
476 // fail if the object's ETag matches the given value. This is useful for
477 // getting updates only after the object has changed since the last
478 // request. Use googleapi.IsNotModified to check whether the response
479 // error from Do is the result of In-None-Match.
480 func (c *LocationsGetBusinesscallssettingsCall) IfNoneMatch(entityTag string) *LocationsGetBusinesscallssettingsCall {
481 c.ifNoneMatch_ = entityTag
482 return c
483 }
484
485 // Context sets the context to be used in this call's Do method. Any
486 // pending HTTP request will be aborted if the provided context is
487 // canceled.
488 func (c *LocationsGetBusinesscallssettingsCall) Context(ctx context.Context) *LocationsGetBusinesscallssettingsCall {
489 c.ctx_ = ctx
490 return c
491 }
492
493 // Header returns an http.Header that can be modified by the caller to
494 // add HTTP headers to the request.
495 func (c *LocationsGetBusinesscallssettingsCall) Header() http.Header {
496 if c.header_ == nil {
497 c.header_ = make(http.Header)
498 }
499 return c.header_
500 }
501
502 func (c *LocationsGetBusinesscallssettingsCall) doRequest(alt string) (*http.Response, error) {
503 reqHeaders := make(http.Header)
504 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
505 for k, v := range c.header_ {
506 reqHeaders[k] = v
507 }
508 reqHeaders.Set("User-Agent", c.s.userAgent())
509 if c.ifNoneMatch_ != "" {
510 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
511 }
512 var body io.Reader = nil
513 c.urlParams_.Set("alt", alt)
514 c.urlParams_.Set("prettyPrint", "false")
515 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
516 urls += "?" + c.urlParams_.Encode()
517 req, err := http.NewRequest("GET", urls, body)
518 if err != nil {
519 return nil, err
520 }
521 req.Header = reqHeaders
522 googleapi.Expand(req.URL, map[string]string{
523 "name": c.name,
524 })
525 return gensupport.SendRequest(c.ctx_, c.s.client, req)
526 }
527
528 // Do executes the "mybusinessbusinesscalls.locations.getBusinesscallssettings" call.
529 // Exactly one of *BusinessCallsSettings or error will be non-nil. Any
530 // non-2xx status code is an error. Response headers are in either
531 // *BusinessCallsSettings.ServerResponse.Header or (if a response was
532 // returned at all) in error.(*googleapi.Error).Header. Use
533 // googleapi.IsNotModified to check whether the returned error was
534 // because http.StatusNotModified was returned.
535 func (c *LocationsGetBusinesscallssettingsCall) Do(opts ...googleapi.CallOption) (*BusinessCallsSettings, error) {
536 gensupport.SetOptions(c.urlParams_, opts...)
537 res, err := c.doRequest("json")
538 if res != nil && res.StatusCode == http.StatusNotModified {
539 if res.Body != nil {
540 res.Body.Close()
541 }
542 return nil, gensupport.WrapError(&googleapi.Error{
543 Code: res.StatusCode,
544 Header: res.Header,
545 })
546 }
547 if err != nil {
548 return nil, err
549 }
550 defer googleapi.CloseBody(res)
551 if err := googleapi.CheckResponse(res); err != nil {
552 return nil, gensupport.WrapError(err)
553 }
554 ret := &BusinessCallsSettings{
555 ServerResponse: googleapi.ServerResponse{
556 Header: res.Header,
557 HTTPStatusCode: res.StatusCode,
558 },
559 }
560 target := &ret
561 if err := gensupport.DecodeResponse(target, res); err != nil {
562 return nil, err
563 }
564 return ret, nil
565 // {
566 // "description": "Returns the Business calls settings resource for the given location.",
567 // "flatPath": "v1/locations/{locationsId}/businesscallssettings",
568 // "httpMethod": "GET",
569 // "id": "mybusinessbusinesscalls.locations.getBusinesscallssettings",
570 // "parameterOrder": [
571 // "name"
572 // ],
573 // "parameters": {
574 // "name": {
575 // "description": "Required. The BusinessCallsSettings to get. The `name` field is used to identify the business call settings to get. Format: locations/{location_id}/businesscallssettings.",
576 // "location": "path",
577 // "pattern": "^locations/[^/]+/businesscallssettings$",
578 // "required": true,
579 // "type": "string"
580 // }
581 // },
582 // "path": "v1/{+name}",
583 // "response": {
584 // "$ref": "BusinessCallsSettings"
585 // }
586 // }
587
588 }
589
590 // method id "mybusinessbusinesscalls.locations.updateBusinesscallssettings":
591
592 type LocationsUpdateBusinesscallssettingsCall struct {
593 s *Service
594 name string
595 businesscallssettings *BusinessCallsSettings
596 urlParams_ gensupport.URLParams
597 ctx_ context.Context
598 header_ http.Header
599 }
600
601 // UpdateBusinesscallssettings: Updates the Business call settings for
602 // the specified location.
603 //
604 // - name: The resource name of the calls settings. Format:
605 // locations/{location}/businesscallssettings.
606 func (r *LocationsService) UpdateBusinesscallssettings(name string, businesscallssettings *BusinessCallsSettings) *LocationsUpdateBusinesscallssettingsCall {
607 c := &LocationsUpdateBusinesscallssettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
608 c.name = name
609 c.businesscallssettings = businesscallssettings
610 return c
611 }
612
613 // UpdateMask sets the optional parameter "updateMask": Required. The
614 // list of fields to update.
615 func (c *LocationsUpdateBusinesscallssettingsCall) UpdateMask(updateMask string) *LocationsUpdateBusinesscallssettingsCall {
616 c.urlParams_.Set("updateMask", updateMask)
617 return c
618 }
619
620 // Fields allows partial responses to be retrieved. See
621 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
622 // for more information.
623 func (c *LocationsUpdateBusinesscallssettingsCall) Fields(s ...googleapi.Field) *LocationsUpdateBusinesscallssettingsCall {
624 c.urlParams_.Set("fields", googleapi.CombineFields(s))
625 return c
626 }
627
628 // Context sets the context to be used in this call's Do method. Any
629 // pending HTTP request will be aborted if the provided context is
630 // canceled.
631 func (c *LocationsUpdateBusinesscallssettingsCall) Context(ctx context.Context) *LocationsUpdateBusinesscallssettingsCall {
632 c.ctx_ = ctx
633 return c
634 }
635
636 // Header returns an http.Header that can be modified by the caller to
637 // add HTTP headers to the request.
638 func (c *LocationsUpdateBusinesscallssettingsCall) Header() http.Header {
639 if c.header_ == nil {
640 c.header_ = make(http.Header)
641 }
642 return c.header_
643 }
644
645 func (c *LocationsUpdateBusinesscallssettingsCall) doRequest(alt string) (*http.Response, error) {
646 reqHeaders := make(http.Header)
647 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
648 for k, v := range c.header_ {
649 reqHeaders[k] = v
650 }
651 reqHeaders.Set("User-Agent", c.s.userAgent())
652 var body io.Reader = nil
653 body, err := googleapi.WithoutDataWrapper.JSONReader(c.businesscallssettings)
654 if err != nil {
655 return nil, err
656 }
657 reqHeaders.Set("Content-Type", "application/json")
658 c.urlParams_.Set("alt", alt)
659 c.urlParams_.Set("prettyPrint", "false")
660 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
661 urls += "?" + c.urlParams_.Encode()
662 req, err := http.NewRequest("PATCH", urls, body)
663 if err != nil {
664 return nil, err
665 }
666 req.Header = reqHeaders
667 googleapi.Expand(req.URL, map[string]string{
668 "name": c.name,
669 })
670 return gensupport.SendRequest(c.ctx_, c.s.client, req)
671 }
672
673 // Do executes the "mybusinessbusinesscalls.locations.updateBusinesscallssettings" call.
674 // Exactly one of *BusinessCallsSettings or error will be non-nil. Any
675 // non-2xx status code is an error. Response headers are in either
676 // *BusinessCallsSettings.ServerResponse.Header or (if a response was
677 // returned at all) in error.(*googleapi.Error).Header. Use
678 // googleapi.IsNotModified to check whether the returned error was
679 // because http.StatusNotModified was returned.
680 func (c *LocationsUpdateBusinesscallssettingsCall) Do(opts ...googleapi.CallOption) (*BusinessCallsSettings, error) {
681 gensupport.SetOptions(c.urlParams_, opts...)
682 res, err := c.doRequest("json")
683 if res != nil && res.StatusCode == http.StatusNotModified {
684 if res.Body != nil {
685 res.Body.Close()
686 }
687 return nil, gensupport.WrapError(&googleapi.Error{
688 Code: res.StatusCode,
689 Header: res.Header,
690 })
691 }
692 if err != nil {
693 return nil, err
694 }
695 defer googleapi.CloseBody(res)
696 if err := googleapi.CheckResponse(res); err != nil {
697 return nil, gensupport.WrapError(err)
698 }
699 ret := &BusinessCallsSettings{
700 ServerResponse: googleapi.ServerResponse{
701 Header: res.Header,
702 HTTPStatusCode: res.StatusCode,
703 },
704 }
705 target := &ret
706 if err := gensupport.DecodeResponse(target, res); err != nil {
707 return nil, err
708 }
709 return ret, nil
710 // {
711 // "description": "Updates the Business call settings for the specified location.",
712 // "flatPath": "v1/locations/{locationsId}/businesscallssettings",
713 // "httpMethod": "PATCH",
714 // "id": "mybusinessbusinesscalls.locations.updateBusinesscallssettings",
715 // "parameterOrder": [
716 // "name"
717 // ],
718 // "parameters": {
719 // "name": {
720 // "description": "Required. The resource name of the calls settings. Format: locations/{location}/businesscallssettings",
721 // "location": "path",
722 // "pattern": "^locations/[^/]+/businesscallssettings$",
723 // "required": true,
724 // "type": "string"
725 // },
726 // "updateMask": {
727 // "description": "Required. The list of fields to update.",
728 // "format": "google-fieldmask",
729 // "location": "query",
730 // "type": "string"
731 // }
732 // },
733 // "path": "v1/{+name}",
734 // "request": {
735 // "$ref": "BusinessCallsSettings"
736 // },
737 // "response": {
738 // "$ref": "BusinessCallsSettings"
739 // }
740 // }
741
742 }
743
744 // method id "mybusinessbusinesscalls.locations.businesscallsinsights.list":
745
746 type LocationsBusinesscallsinsightsListCall struct {
747 s *Service
748 parent string
749 urlParams_ gensupport.URLParams
750 ifNoneMatch_ string
751 ctx_ context.Context
752 header_ http.Header
753 }
754
755 // List: Returns insights for Business calls for a location.
756 //
757 // - parent: The parent location to fetch calls insights for. Format:
758 // locations/{location_id}.
759 func (r *LocationsBusinesscallsinsightsService) List(parent string) *LocationsBusinesscallsinsightsListCall {
760 c := &LocationsBusinesscallsinsightsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
761 c.parent = parent
762 return c
763 }
764
765 // Filter sets the optional parameter "filter": A filter constraining
766 // the calls insights to return. The response includes only entries that
767 // match the filter. If the MetricType is not provided, AGGREGATE_COUNT
768 // is returned. If no end_date is provided, the last date for which data
769 // is available is used. If no start_date is provided, we will default
770 // to the first date for which data is available, which is currently 6
771 // months. If start_date is before the date when data is available, data
772 // is returned starting from the date when it is available. At this time
773 // we support following filters. 1. start_date="DATE" where date is in
774 // YYYY-MM-DD format. 2. end_date="DATE" where date is in YYYY-MM-DD
775 // format. 3. metric_type=XYZ where XYZ is a valid MetricType. 4.
776 // Conjunctions(AND) of all of the above. e.g., "start_date=2021-08-01
777 // AND end_date=2021-08-10 AND metric_type=AGGREGATE_COUNT" The
778 // AGGREGATE_COUNT metric_type ignores the DD part of the date.
779 func (c *LocationsBusinesscallsinsightsListCall) Filter(filter string) *LocationsBusinesscallsinsightsListCall {
780 c.urlParams_.Set("filter", filter)
781 return c
782 }
783
784 // PageSize sets the optional parameter "pageSize": The maximum number
785 // of BusinessCallsInsights to return. If unspecified, at most 20 will
786 // be returned. Some of the metric_types(e.g, AGGREGATE_COUNT) returns a
787 // single page. For these metrics, the page_size is ignored.
788 func (c *LocationsBusinesscallsinsightsListCall) PageSize(pageSize int64) *LocationsBusinesscallsinsightsListCall {
789 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
790 return c
791 }
792
793 // PageToken sets the optional parameter "pageToken": A page token,
794 // received from a previous `ListBusinessCallsInsights` call. Provide
795 // this to retrieve the subsequent page. When paginating, all other
796 // parameters provided to `ListBusinessCallsInsights` must match the
797 // call that provided the page token. Some of the metric_types (e.g,
798 // AGGREGATE_COUNT) returns a single page. For these metrics, the
799 // pake_token is ignored.
800 func (c *LocationsBusinesscallsinsightsListCall) PageToken(pageToken string) *LocationsBusinesscallsinsightsListCall {
801 c.urlParams_.Set("pageToken", pageToken)
802 return c
803 }
804
805 // Fields allows partial responses to be retrieved. See
806 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
807 // for more information.
808 func (c *LocationsBusinesscallsinsightsListCall) Fields(s ...googleapi.Field) *LocationsBusinesscallsinsightsListCall {
809 c.urlParams_.Set("fields", googleapi.CombineFields(s))
810 return c
811 }
812
813 // IfNoneMatch sets the optional parameter which makes the operation
814 // fail if the object's ETag matches the given value. This is useful for
815 // getting updates only after the object has changed since the last
816 // request. Use googleapi.IsNotModified to check whether the response
817 // error from Do is the result of In-None-Match.
818 func (c *LocationsBusinesscallsinsightsListCall) IfNoneMatch(entityTag string) *LocationsBusinesscallsinsightsListCall {
819 c.ifNoneMatch_ = entityTag
820 return c
821 }
822
823 // Context sets the context to be used in this call's Do method. Any
824 // pending HTTP request will be aborted if the provided context is
825 // canceled.
826 func (c *LocationsBusinesscallsinsightsListCall) Context(ctx context.Context) *LocationsBusinesscallsinsightsListCall {
827 c.ctx_ = ctx
828 return c
829 }
830
831 // Header returns an http.Header that can be modified by the caller to
832 // add HTTP headers to the request.
833 func (c *LocationsBusinesscallsinsightsListCall) Header() http.Header {
834 if c.header_ == nil {
835 c.header_ = make(http.Header)
836 }
837 return c.header_
838 }
839
840 func (c *LocationsBusinesscallsinsightsListCall) doRequest(alt string) (*http.Response, error) {
841 reqHeaders := make(http.Header)
842 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
843 for k, v := range c.header_ {
844 reqHeaders[k] = v
845 }
846 reqHeaders.Set("User-Agent", c.s.userAgent())
847 if c.ifNoneMatch_ != "" {
848 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
849 }
850 var body io.Reader = nil
851 c.urlParams_.Set("alt", alt)
852 c.urlParams_.Set("prettyPrint", "false")
853 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/businesscallsinsights")
854 urls += "?" + c.urlParams_.Encode()
855 req, err := http.NewRequest("GET", urls, body)
856 if err != nil {
857 return nil, err
858 }
859 req.Header = reqHeaders
860 googleapi.Expand(req.URL, map[string]string{
861 "parent": c.parent,
862 })
863 return gensupport.SendRequest(c.ctx_, c.s.client, req)
864 }
865
866 // Do executes the "mybusinessbusinesscalls.locations.businesscallsinsights.list" call.
867 // Exactly one of *ListBusinessCallsInsightsResponse or error will be
868 // non-nil. Any non-2xx status code is an error. Response headers are in
869 // either *ListBusinessCallsInsightsResponse.ServerResponse.Header or
870 // (if a response was returned at all) in
871 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
872 // whether the returned error was because http.StatusNotModified was
873 // returned.
874 func (c *LocationsBusinesscallsinsightsListCall) Do(opts ...googleapi.CallOption) (*ListBusinessCallsInsightsResponse, error) {
875 gensupport.SetOptions(c.urlParams_, opts...)
876 res, err := c.doRequest("json")
877 if res != nil && res.StatusCode == http.StatusNotModified {
878 if res.Body != nil {
879 res.Body.Close()
880 }
881 return nil, gensupport.WrapError(&googleapi.Error{
882 Code: res.StatusCode,
883 Header: res.Header,
884 })
885 }
886 if err != nil {
887 return nil, err
888 }
889 defer googleapi.CloseBody(res)
890 if err := googleapi.CheckResponse(res); err != nil {
891 return nil, gensupport.WrapError(err)
892 }
893 ret := &ListBusinessCallsInsightsResponse{
894 ServerResponse: googleapi.ServerResponse{
895 Header: res.Header,
896 HTTPStatusCode: res.StatusCode,
897 },
898 }
899 target := &ret
900 if err := gensupport.DecodeResponse(target, res); err != nil {
901 return nil, err
902 }
903 return ret, nil
904 // {
905 // "description": "Returns insights for Business calls for a location.",
906 // "flatPath": "v1/locations/{locationsId}/businesscallsinsights",
907 // "httpMethod": "GET",
908 // "id": "mybusinessbusinesscalls.locations.businesscallsinsights.list",
909 // "parameterOrder": [
910 // "parent"
911 // ],
912 // "parameters": {
913 // "filter": {
914 // "description": "Optional. A filter constraining the calls insights to return. The response includes only entries that match the filter. If the MetricType is not provided, AGGREGATE_COUNT is returned. If no end_date is provided, the last date for which data is available is used. If no start_date is provided, we will default to the first date for which data is available, which is currently 6 months. If start_date is before the date when data is available, data is returned starting from the date when it is available. At this time we support following filters. 1. start_date=\"DATE\" where date is in YYYY-MM-DD format. 2. end_date=\"DATE\" where date is in YYYY-MM-DD format. 3. metric_type=XYZ where XYZ is a valid MetricType. 4. Conjunctions(AND) of all of the above. e.g., \"start_date=2021-08-01 AND end_date=2021-08-10 AND metric_type=AGGREGATE_COUNT\" The AGGREGATE_COUNT metric_type ignores the DD part of the date.",
915 // "location": "query",
916 // "type": "string"
917 // },
918 // "pageSize": {
919 // "description": "Optional. The maximum number of BusinessCallsInsights to return. If unspecified, at most 20 will be returned. Some of the metric_types(e.g, AGGREGATE_COUNT) returns a single page. For these metrics, the page_size is ignored.",
920 // "format": "int32",
921 // "location": "query",
922 // "type": "integer"
923 // },
924 // "pageToken": {
925 // "description": "Optional. A page token, received from a previous `ListBusinessCallsInsights` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListBusinessCallsInsights` must match the call that provided the page token. Some of the metric_types (e.g, AGGREGATE_COUNT) returns a single page. For these metrics, the pake_token is ignored.",
926 // "location": "query",
927 // "type": "string"
928 // },
929 // "parent": {
930 // "description": "Required. The parent location to fetch calls insights for. Format: locations/{location_id}",
931 // "location": "path",
932 // "pattern": "^locations/[^/]+$",
933 // "required": true,
934 // "type": "string"
935 // }
936 // },
937 // "path": "v1/{+parent}/businesscallsinsights",
938 // "response": {
939 // "$ref": "ListBusinessCallsInsightsResponse"
940 // }
941 // }
942
943 }
944
945 // Pages invokes f for each page of results.
946 // A non-nil error returned from f will halt the iteration.
947 // The provided context supersedes any context provided to the Context method.
948 func (c *LocationsBusinesscallsinsightsListCall) Pages(ctx context.Context, f func(*ListBusinessCallsInsightsResponse) error) error {
949 c.ctx_ = ctx
950 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
951 for {
952 x, err := c.Do()
953 if err != nil {
954 return err
955 }
956 if err := f(x); err != nil {
957 return err
958 }
959 if x.NextPageToken == "" {
960 return nil
961 }
962 c.PageToken(x.NextPageToken)
963 }
964 }