Debian Codegraph @

mybusinessplaceactions/v1/mybusinessplaceactions-gen.go

raw symbols SCIP
1 // Copyright 2026 Google LLC.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // Code generated file. DO NOT EDIT.
6
7 // Package mybusinessplaceactions provides access to the My Business Place Actions 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/mybusinessplaceactions/v1"
27 // ...
28 // ctx := context.Background()
29 // mybusinessplaceactionsService, err := mybusinessplaceactions.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 // mybusinessplaceactionsService, err := mybusinessplaceactions.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 // mybusinessplaceactionsService, err := mybusinessplaceactions.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
49 //
50 // See [google.golang.org/api/option.ClientOption] for details on options.
51 package mybusinessplaceactions // import "google.golang.org/api/mybusinessplaceactions/v1"
52
53 import (
54 "bytes"
55 "context"
56 "encoding/json"
57 "errors"
58 "fmt"
59 "io"
60 "log/slog"
61 "net/http"
62 "net/url"
63 "strconv"
64 "strings"
65
66 "github.com/googleapis/gax-go/v2/internallog"
67 googleapi "google.golang.org/api/googleapi"
68 internal "google.golang.org/api/internal"
69 gensupport "google.golang.org/api/internal/gensupport"
70 option "google.golang.org/api/option"
71 internaloption "google.golang.org/api/option/internaloption"
72 htransport "google.golang.org/api/transport/http"
73 )
74
75 // Always reference these packages, just in case the auto-generated code
76 // below doesn't.
77 var _ = bytes.NewBuffer
78 var _ = strconv.Itoa
79 var _ = fmt.Sprintf
80 var _ = json.NewDecoder
81 var _ = io.Copy
82 var _ = url.Parse
83 var _ = gensupport.MarshalJSON
84 var _ = googleapi.Version
85 var _ = errors.New
86 var _ = strings.Replace
87 var _ = context.Canceled
88 var _ = internaloption.WithDefaultEndpoint
89 var _ = internal.Version
90 var _ = internallog.New
91
92 const apiId = "mybusinessplaceactions:v1"
93 const apiName = "mybusinessplaceactions"
94 const apiVersion = "v1"
95 const basePath = "https://mybusinessplaceactions.googleapis.com/"
96 const basePathTemplate = "https://mybusinessplaceactions.UNIVERSE_DOMAIN/"
97 const mtlsBasePath = "https://mybusinessplaceactions.mtls.googleapis.com/"
98
99 // NewService creates a new Service.
100 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
101 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
102 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
103 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
104 opts = append(opts, internaloption.EnableNewAuthLibrary())
105 client, endpoint, err := htransport.NewClient(ctx, opts...)
106 if err != nil {
107 return nil, err
108 }
109 s := &Service{client: client, BasePath: basePath, logger: internaloption.GetLogger(opts)}
110 s.Locations = NewLocationsService(s)
111 s.PlaceActionTypeMetadata = NewPlaceActionTypeMetadataService(s)
112 if endpoint != "" {
113 s.BasePath = endpoint
114 }
115 return s, nil
116 }
117
118 // New creates a new Service. It uses the provided http.Client for requests.
119 //
120 // Deprecated: please use NewService instead.
121 // To provide a custom HTTP client, use option.WithHTTPClient.
122 // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
123 func New(client *http.Client) (*Service, error) {
124 if client == nil {
125 return nil, errors.New("client is nil")
126 }
127 return NewService(context.TODO(), option.WithHTTPClient(client))
128 }
129
130 type Service struct {
131 client *http.Client
132 logger *slog.Logger
133 BasePath string // API endpoint base URL
134 UserAgent string // optional additional User-Agent fragment
135
136 Locations *LocationsService
137
138 PlaceActionTypeMetadata *PlaceActionTypeMetadataService
139 }
140
141 func (s *Service) userAgent() string {
142 if s.UserAgent == "" {
143 return googleapi.UserAgent
144 }
145 return googleapi.UserAgent + " " + s.UserAgent
146 }
147
148 func NewLocationsService(s *Service) *LocationsService {
149 rs := &LocationsService{s: s}
150 rs.PlaceActionLinks = NewLocationsPlaceActionLinksService(s)
151 return rs
152 }
153
154 type LocationsService struct {
155 s *Service
156
157 PlaceActionLinks *LocationsPlaceActionLinksService
158 }
159
160 func NewLocationsPlaceActionLinksService(s *Service) *LocationsPlaceActionLinksService {
161 rs := &LocationsPlaceActionLinksService{s: s}
162 return rs
163 }
164
165 type LocationsPlaceActionLinksService struct {
166 s *Service
167 }
168
169 func NewPlaceActionTypeMetadataService(s *Service) *PlaceActionTypeMetadataService {
170 rs := &PlaceActionTypeMetadataService{s: s}
171 return rs
172 }
173
174 type PlaceActionTypeMetadataService struct {
175 s *Service
176 }
177
178 // Empty: A generic empty message that you can re-use to avoid defining
179 // duplicated empty messages in your APIs. A typical example is to use it as
180 // the request or the response type of an API method. For instance: service Foo
181 // { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
182 type Empty struct {
183 // ServerResponse contains the HTTP response code and headers from the server.
184 googleapi.ServerResponse `json:"-"`
185 }
186
187 // ListPlaceActionLinksResponse: Response message for
188 // PlaceActions.ListPlaceActionLinks.
189 type ListPlaceActionLinksResponse struct {
190 // NextPageToken: If there are more place action links than the requested page
191 // size, then this field is populated with a token to fetch the next page of
192 // results.
193 NextPageToken string `json:"nextPageToken,omitempty"`
194 // PlaceActionLinks: The returned list of place action links.
195 PlaceActionLinks []*PlaceActionLink `json:"placeActionLinks,omitempty"`
196
197 // ServerResponse contains the HTTP response code and headers from the server.
198 googleapi.ServerResponse `json:"-"`
199 // ForceSendFields is a list of field names (e.g. "NextPageToken") to
200 // unconditionally include in API requests. By default, fields with empty or
201 // default values are omitted from API requests. See
202 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
203 // details.
204 ForceSendFields []string `json:"-"`
205 // NullFields is a list of field names (e.g. "NextPageToken") to include in API
206 // requests with the JSON null value. By default, fields with empty values are
207 // omitted from API requests. See
208 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
209 NullFields []string `json:"-"`
210 }
211
212 func (s ListPlaceActionLinksResponse) MarshalJSON() ([]byte, error) {
213 type NoMethod ListPlaceActionLinksResponse
214 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
215 }
216
217 // ListPlaceActionTypeMetadataResponse: Response message for
218 // PlaceActions.ListPlaceActionTypeMetadata.
219 type ListPlaceActionTypeMetadataResponse struct {
220 // NextPageToken: If the number of action types exceeded the requested page
221 // size, this field will be populated with a token to fetch the next page on a
222 // subsequent call to `placeActionTypeMetadata.list`. If there are no more
223 // results, this field will not be present in the response.
224 NextPageToken string `json:"nextPageToken,omitempty"`
225 // PlaceActionTypeMetadata: A collection of metadata for the available place
226 // action types.
227 PlaceActionTypeMetadata []*PlaceActionTypeMetadata `json:"placeActionTypeMetadata,omitempty"`
228
229 // ServerResponse contains the HTTP response code and headers from the server.
230 googleapi.ServerResponse `json:"-"`
231 // ForceSendFields is a list of field names (e.g. "NextPageToken") to
232 // unconditionally include in API requests. By default, fields with empty or
233 // default values are omitted from API requests. See
234 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
235 // details.
236 ForceSendFields []string `json:"-"`
237 // NullFields is a list of field names (e.g. "NextPageToken") to include in API
238 // requests with the JSON null value. By default, fields with empty values are
239 // omitted from API requests. See
240 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
241 NullFields []string `json:"-"`
242 }
243
244 func (s ListPlaceActionTypeMetadataResponse) MarshalJSON() ([]byte, error) {
245 type NoMethod ListPlaceActionTypeMetadataResponse
246 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
247 }
248
249 // PlaceActionLink: Represents a place action link and its attributes.
250 type PlaceActionLink struct {
251 // CreateTime: Output only. The time when the place action link was created.
252 CreateTime string `json:"createTime,omitempty"`
253 // IsEditable: Output only. Indicates whether this link can be edited by the
254 // client.
255 IsEditable bool `json:"isEditable,omitempty"`
256 // IsPreferred: Optional. Whether this link is preferred by the merchant. Only
257 // one link can be marked as preferred per place action type at a location. If
258 // a future request marks a different link as preferred for the same place
259 // action type, then the current preferred link (if any exists) will lose its
260 // preference.
261 IsPreferred bool `json:"isPreferred,omitempty"`
262 // Name: Optional. The resource name, in the format
263 // `locations/{location_id}/placeActionLinks/{place_action_link_id}`. The name
264 // field will only be considered in UpdatePlaceActionLink and
265 // DeletePlaceActionLink requests for updating and deleting links respectively.
266 // However, it will be ignored in CreatePlaceActionLink request, where
267 // `place_action_link_id` will be assigned by the server on successful creation
268 // of a new link and returned as part of the response.
269 Name string `json:"name,omitempty"`
270 // PlaceActionType: Required. The type of place action that can be performed
271 // using this link.
272 //
273 // Possible values:
274 // "PLACE_ACTION_TYPE_UNSPECIFIED" - Not specified.
275 // "APPOINTMENT" - The action type is booking an appointment.
276 // "ONLINE_APPOINTMENT" - The action type is booking an online appointment.
277 // "DINING_RESERVATION" - The action type is making a dining reservation.
278 // "FOOD_ORDERING" - The action type is ordering food for delivery and/or
279 // takeout.
280 // "FOOD_DELIVERY" - The action type is ordering food for delivery.
281 // "FOOD_TAKEOUT" - The action type is ordering food for takeout.
282 // "SHOP_ONLINE" - The action type is shopping, that can be delivery and/or
283 // pickup.
284 // "SOLOPRENEUR_APPOINTMENT" - The action type is booking an appointment with
285 // a Solopneuer partner.
286 PlaceActionType string `json:"placeActionType,omitempty"`
287 // ProviderType: Output only. Specifies the provider type.
288 //
289 // Possible values:
290 // "PROVIDER_TYPE_UNSPECIFIED" - Not specified.
291 // "MERCHANT" - A 1P provider such as a merchant, or an agency on behalf of a
292 // merchant.
293 // "AGGREGATOR_3P" - A 3P aggregator, such as a `Reserve with Google`
294 // partner.
295 ProviderType string `json:"providerType,omitempty"`
296 // UpdateTime: Output only. The time when the place action link was last
297 // modified.
298 UpdateTime string `json:"updateTime,omitempty"`
299 // Uri: Required. The link uri. The same uri can be reused for different action
300 // types across different locations. However, only one place action link is
301 // allowed for each unique combination of (uri, place action type, location).
302 Uri string `json:"uri,omitempty"`
303
304 // ServerResponse contains the HTTP response code and headers from the server.
305 googleapi.ServerResponse `json:"-"`
306 // ForceSendFields is a list of field names (e.g. "CreateTime") to
307 // unconditionally include in API requests. By default, fields with empty or
308 // default values are omitted from API requests. See
309 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
310 // details.
311 ForceSendFields []string `json:"-"`
312 // NullFields is a list of field names (e.g. "CreateTime") to include in API
313 // requests with the JSON null value. By default, fields with empty values are
314 // omitted from API requests. See
315 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
316 NullFields []string `json:"-"`
317 }
318
319 func (s PlaceActionLink) MarshalJSON() ([]byte, error) {
320 type NoMethod PlaceActionLink
321 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
322 }
323
324 // PlaceActionTypeMetadata: Metadata for supported place action types.
325 type PlaceActionTypeMetadata struct {
326 // DisplayName: The localized display name for the attribute, if available;
327 // otherwise, the English display name.
328 DisplayName string `json:"displayName,omitempty"`
329 // PlaceActionType: The place action type.
330 //
331 // Possible values:
332 // "PLACE_ACTION_TYPE_UNSPECIFIED" - Not specified.
333 // "APPOINTMENT" - The action type is booking an appointment.
334 // "ONLINE_APPOINTMENT" - The action type is booking an online appointment.
335 // "DINING_RESERVATION" - The action type is making a dining reservation.
336 // "FOOD_ORDERING" - The action type is ordering food for delivery and/or
337 // takeout.
338 // "FOOD_DELIVERY" - The action type is ordering food for delivery.
339 // "FOOD_TAKEOUT" - The action type is ordering food for takeout.
340 // "SHOP_ONLINE" - The action type is shopping, that can be delivery and/or
341 // pickup.
342 // "SOLOPRENEUR_APPOINTMENT" - The action type is booking an appointment with
343 // a Solopneuer partner.
344 PlaceActionType string `json:"placeActionType,omitempty"`
345 // ForceSendFields is a list of field names (e.g. "DisplayName") to
346 // unconditionally include in API requests. By default, fields with empty or
347 // default values are omitted from API requests. See
348 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
349 // details.
350 ForceSendFields []string `json:"-"`
351 // NullFields is a list of field names (e.g. "DisplayName") to include in API
352 // requests with the JSON null value. By default, fields with empty values are
353 // omitted from API requests. See
354 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
355 NullFields []string `json:"-"`
356 }
357
358 func (s PlaceActionTypeMetadata) MarshalJSON() ([]byte, error) {
359 type NoMethod PlaceActionTypeMetadata
360 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
361 }
362
363 type LocationsPlaceActionLinksCreateCall struct {
364 s *Service
365 parent string
366 placeactionlink *PlaceActionLink
367 urlParams_ gensupport.URLParams
368 ctx_ context.Context
369 header_ http.Header
370 }
371
372 // Create: Creates a place action link associated with the specified location,
373 // and returns it. The request is considered duplicate if the `parent`,
374 // `place_action_link.uri` and `place_action_link.place_action_type` are the
375 // same as a previous request.
376 //
377 // - parent: The resource name of the location where to create this place
378 // action link. `locations/{location_id}`.
379 func (r *LocationsPlaceActionLinksService) Create(parent string, placeactionlink *PlaceActionLink) *LocationsPlaceActionLinksCreateCall {
380 c := &LocationsPlaceActionLinksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
381 c.parent = parent
382 c.placeactionlink = placeactionlink
383 return c
384 }
385
386 // Fields allows partial responses to be retrieved. See
387 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
388 // details.
389 func (c *LocationsPlaceActionLinksCreateCall) Fields(s ...googleapi.Field) *LocationsPlaceActionLinksCreateCall {
390 c.urlParams_.Set("fields", googleapi.CombineFields(s))
391 return c
392 }
393
394 // Context sets the context to be used in this call's Do method.
395 func (c *LocationsPlaceActionLinksCreateCall) Context(ctx context.Context) *LocationsPlaceActionLinksCreateCall {
396 c.ctx_ = ctx
397 return c
398 }
399
400 // Header returns a http.Header that can be modified by the caller to add
401 // headers to the request.
402 func (c *LocationsPlaceActionLinksCreateCall) Header() http.Header {
403 if c.header_ == nil {
404 c.header_ = make(http.Header)
405 }
406 return c.header_
407 }
408
409 func (c *LocationsPlaceActionLinksCreateCall) doRequest(alt string) (*http.Response, error) {
410 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
411 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.placeactionlink)
412 if err != nil {
413 return nil, err
414 }
415 c.urlParams_.Set("alt", alt)
416 c.urlParams_.Set("prettyPrint", "false")
417 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/placeActionLinks")
418 urls += "?" + c.urlParams_.Encode()
419 req, err := http.NewRequest("POST", urls, body)
420 if err != nil {
421 return nil, err
422 }
423 req.Header = reqHeaders
424 googleapi.Expand(req.URL, map[string]string{
425 "parent": c.parent,
426 })
427 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "mybusinessplaceactions.locations.placeActionLinks.create", "request", internallog.HTTPRequest(req, body.Bytes()))
428 return gensupport.SendRequest(c.ctx_, c.s.client, req)
429 }
430
431 // Do executes the "mybusinessplaceactions.locations.placeActionLinks.create" call.
432 // Any non-2xx status code is an error. Response headers are in either
433 // *PlaceActionLink.ServerResponse.Header or (if a response was returned at
434 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
435 // check whether the returned error was because http.StatusNotModified was
436 // returned.
437 func (c *LocationsPlaceActionLinksCreateCall) Do(opts ...googleapi.CallOption) (*PlaceActionLink, error) {
438 gensupport.SetOptions(c.urlParams_, opts...)
439 res, err := c.doRequest("json")
440 if res != nil && res.StatusCode == http.StatusNotModified {
441 if res.Body != nil {
442 res.Body.Close()
443 }
444 return nil, gensupport.WrapError(&googleapi.Error{
445 Code: res.StatusCode,
446 Header: res.Header,
447 })
448 }
449 if err != nil {
450 return nil, err
451 }
452 defer googleapi.CloseBody(res)
453 if err := googleapi.CheckResponse(res); err != nil {
454 return nil, gensupport.WrapError(err)
455 }
456 ret := &PlaceActionLink{
457 ServerResponse: googleapi.ServerResponse{
458 Header: res.Header,
459 HTTPStatusCode: res.StatusCode,
460 },
461 }
462 target := &ret
463 b, err := gensupport.DecodeResponseBytes(target, res)
464 if err != nil {
465 return nil, err
466 }
467 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "mybusinessplaceactions.locations.placeActionLinks.create", "response", internallog.HTTPResponse(res, b))
468 return ret, nil
469 }
470
471 type LocationsPlaceActionLinksDeleteCall struct {
472 s *Service
473 name string
474 urlParams_ gensupport.URLParams
475 ctx_ context.Context
476 header_ http.Header
477 }
478
479 // Delete: Deletes a place action link from the specified location.
480 //
481 // - name: The resource name of the place action link to remove from the
482 // location.
483 func (r *LocationsPlaceActionLinksService) Delete(name string) *LocationsPlaceActionLinksDeleteCall {
484 c := &LocationsPlaceActionLinksDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
485 c.name = name
486 return c
487 }
488
489 // Fields allows partial responses to be retrieved. See
490 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
491 // details.
492 func (c *LocationsPlaceActionLinksDeleteCall) Fields(s ...googleapi.Field) *LocationsPlaceActionLinksDeleteCall {
493 c.urlParams_.Set("fields", googleapi.CombineFields(s))
494 return c
495 }
496
497 // Context sets the context to be used in this call's Do method.
498 func (c *LocationsPlaceActionLinksDeleteCall) Context(ctx context.Context) *LocationsPlaceActionLinksDeleteCall {
499 c.ctx_ = ctx
500 return c
501 }
502
503 // Header returns a http.Header that can be modified by the caller to add
504 // headers to the request.
505 func (c *LocationsPlaceActionLinksDeleteCall) Header() http.Header {
506 if c.header_ == nil {
507 c.header_ = make(http.Header)
508 }
509 return c.header_
510 }
511
512 func (c *LocationsPlaceActionLinksDeleteCall) doRequest(alt string) (*http.Response, error) {
513 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
514 c.urlParams_.Set("alt", alt)
515 c.urlParams_.Set("prettyPrint", "false")
516 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
517 urls += "?" + c.urlParams_.Encode()
518 req, err := http.NewRequest("DELETE", urls, nil)
519 if err != nil {
520 return nil, err
521 }
522 req.Header = reqHeaders
523 googleapi.Expand(req.URL, map[string]string{
524 "name": c.name,
525 })
526 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "mybusinessplaceactions.locations.placeActionLinks.delete", "request", internallog.HTTPRequest(req, nil))
527 return gensupport.SendRequest(c.ctx_, c.s.client, req)
528 }
529
530 // Do executes the "mybusinessplaceactions.locations.placeActionLinks.delete" call.
531 // Any non-2xx status code is an error. Response headers are in either
532 // *Empty.ServerResponse.Header or (if a response was returned at all) in
533 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
534 // whether the returned error was because http.StatusNotModified was returned.
535 func (c *LocationsPlaceActionLinksDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, 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 := &Empty{
555 ServerResponse: googleapi.ServerResponse{
556 Header: res.Header,
557 HTTPStatusCode: res.StatusCode,
558 },
559 }
560 target := &ret
561 b, err := gensupport.DecodeResponseBytes(target, res)
562 if err != nil {
563 return nil, err
564 }
565 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "mybusinessplaceactions.locations.placeActionLinks.delete", "response", internallog.HTTPResponse(res, b))
566 return ret, nil
567 }
568
569 type LocationsPlaceActionLinksGetCall struct {
570 s *Service
571 name string
572 urlParams_ gensupport.URLParams
573 ifNoneMatch_ string
574 ctx_ context.Context
575 header_ http.Header
576 }
577
578 // Get: Gets the specified place action link.
579 //
580 // - name: The name of the place action link to fetch.
581 func (r *LocationsPlaceActionLinksService) Get(name string) *LocationsPlaceActionLinksGetCall {
582 c := &LocationsPlaceActionLinksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
583 c.name = name
584 return c
585 }
586
587 // Fields allows partial responses to be retrieved. See
588 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
589 // details.
590 func (c *LocationsPlaceActionLinksGetCall) Fields(s ...googleapi.Field) *LocationsPlaceActionLinksGetCall {
591 c.urlParams_.Set("fields", googleapi.CombineFields(s))
592 return c
593 }
594
595 // IfNoneMatch sets an optional parameter which makes the operation fail if the
596 // object's ETag matches the given value. This is useful for getting updates
597 // only after the object has changed since the last request.
598 func (c *LocationsPlaceActionLinksGetCall) IfNoneMatch(entityTag string) *LocationsPlaceActionLinksGetCall {
599 c.ifNoneMatch_ = entityTag
600 return c
601 }
602
603 // Context sets the context to be used in this call's Do method.
604 func (c *LocationsPlaceActionLinksGetCall) Context(ctx context.Context) *LocationsPlaceActionLinksGetCall {
605 c.ctx_ = ctx
606 return c
607 }
608
609 // Header returns a http.Header that can be modified by the caller to add
610 // headers to the request.
611 func (c *LocationsPlaceActionLinksGetCall) Header() http.Header {
612 if c.header_ == nil {
613 c.header_ = make(http.Header)
614 }
615 return c.header_
616 }
617
618 func (c *LocationsPlaceActionLinksGetCall) doRequest(alt string) (*http.Response, error) {
619 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
620 if c.ifNoneMatch_ != "" {
621 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
622 }
623 c.urlParams_.Set("alt", alt)
624 c.urlParams_.Set("prettyPrint", "false")
625 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
626 urls += "?" + c.urlParams_.Encode()
627 req, err := http.NewRequest("GET", urls, nil)
628 if err != nil {
629 return nil, err
630 }
631 req.Header = reqHeaders
632 googleapi.Expand(req.URL, map[string]string{
633 "name": c.name,
634 })
635 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "mybusinessplaceactions.locations.placeActionLinks.get", "request", internallog.HTTPRequest(req, nil))
636 return gensupport.SendRequest(c.ctx_, c.s.client, req)
637 }
638
639 // Do executes the "mybusinessplaceactions.locations.placeActionLinks.get" call.
640 // Any non-2xx status code is an error. Response headers are in either
641 // *PlaceActionLink.ServerResponse.Header or (if a response was returned at
642 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
643 // check whether the returned error was because http.StatusNotModified was
644 // returned.
645 func (c *LocationsPlaceActionLinksGetCall) Do(opts ...googleapi.CallOption) (*PlaceActionLink, error) {
646 gensupport.SetOptions(c.urlParams_, opts...)
647 res, err := c.doRequest("json")
648 if res != nil && res.StatusCode == http.StatusNotModified {
649 if res.Body != nil {
650 res.Body.Close()
651 }
652 return nil, gensupport.WrapError(&googleapi.Error{
653 Code: res.StatusCode,
654 Header: res.Header,
655 })
656 }
657 if err != nil {
658 return nil, err
659 }
660 defer googleapi.CloseBody(res)
661 if err := googleapi.CheckResponse(res); err != nil {
662 return nil, gensupport.WrapError(err)
663 }
664 ret := &PlaceActionLink{
665 ServerResponse: googleapi.ServerResponse{
666 Header: res.Header,
667 HTTPStatusCode: res.StatusCode,
668 },
669 }
670 target := &ret
671 b, err := gensupport.DecodeResponseBytes(target, res)
672 if err != nil {
673 return nil, err
674 }
675 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "mybusinessplaceactions.locations.placeActionLinks.get", "response", internallog.HTTPResponse(res, b))
676 return ret, nil
677 }
678
679 type LocationsPlaceActionLinksListCall struct {
680 s *Service
681 parent string
682 urlParams_ gensupport.URLParams
683 ifNoneMatch_ string
684 ctx_ context.Context
685 header_ http.Header
686 }
687
688 // List: Lists the place action links for the specified location.
689 //
690 // - parent: The name of the location whose place action links will be listed.
691 // `locations/{location_id}`.
692 func (r *LocationsPlaceActionLinksService) List(parent string) *LocationsPlaceActionLinksListCall {
693 c := &LocationsPlaceActionLinksListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
694 c.parent = parent
695 return c
696 }
697
698 // Filter sets the optional parameter "filter": A filter constraining the place
699 // action links to return. The response includes entries that match the filter.
700 // We support only the following filter: 1. place_action_type=XYZ where XYZ is
701 // a valid PlaceActionType.
702 func (c *LocationsPlaceActionLinksListCall) Filter(filter string) *LocationsPlaceActionLinksListCall {
703 c.urlParams_.Set("filter", filter)
704 return c
705 }
706
707 // PageSize sets the optional parameter "pageSize": How many place action links
708 // to return per page. Default of 10. The minimum is 1.
709 func (c *LocationsPlaceActionLinksListCall) PageSize(pageSize int64) *LocationsPlaceActionLinksListCall {
710 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
711 return c
712 }
713
714 // PageToken sets the optional parameter "pageToken": If specified, returns the
715 // next page of place action links.
716 func (c *LocationsPlaceActionLinksListCall) PageToken(pageToken string) *LocationsPlaceActionLinksListCall {
717 c.urlParams_.Set("pageToken", pageToken)
718 return c
719 }
720
721 // Fields allows partial responses to be retrieved. See
722 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
723 // details.
724 func (c *LocationsPlaceActionLinksListCall) Fields(s ...googleapi.Field) *LocationsPlaceActionLinksListCall {
725 c.urlParams_.Set("fields", googleapi.CombineFields(s))
726 return c
727 }
728
729 // IfNoneMatch sets an optional parameter which makes the operation fail if the
730 // object's ETag matches the given value. This is useful for getting updates
731 // only after the object has changed since the last request.
732 func (c *LocationsPlaceActionLinksListCall) IfNoneMatch(entityTag string) *LocationsPlaceActionLinksListCall {
733 c.ifNoneMatch_ = entityTag
734 return c
735 }
736
737 // Context sets the context to be used in this call's Do method.
738 func (c *LocationsPlaceActionLinksListCall) Context(ctx context.Context) *LocationsPlaceActionLinksListCall {
739 c.ctx_ = ctx
740 return c
741 }
742
743 // Header returns a http.Header that can be modified by the caller to add
744 // headers to the request.
745 func (c *LocationsPlaceActionLinksListCall) Header() http.Header {
746 if c.header_ == nil {
747 c.header_ = make(http.Header)
748 }
749 return c.header_
750 }
751
752 func (c *LocationsPlaceActionLinksListCall) doRequest(alt string) (*http.Response, error) {
753 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
754 if c.ifNoneMatch_ != "" {
755 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
756 }
757 c.urlParams_.Set("alt", alt)
758 c.urlParams_.Set("prettyPrint", "false")
759 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/placeActionLinks")
760 urls += "?" + c.urlParams_.Encode()
761 req, err := http.NewRequest("GET", urls, nil)
762 if err != nil {
763 return nil, err
764 }
765 req.Header = reqHeaders
766 googleapi.Expand(req.URL, map[string]string{
767 "parent": c.parent,
768 })
769 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "mybusinessplaceactions.locations.placeActionLinks.list", "request", internallog.HTTPRequest(req, nil))
770 return gensupport.SendRequest(c.ctx_, c.s.client, req)
771 }
772
773 // Do executes the "mybusinessplaceactions.locations.placeActionLinks.list" call.
774 // Any non-2xx status code is an error. Response headers are in either
775 // *ListPlaceActionLinksResponse.ServerResponse.Header or (if a response was
776 // returned at all) in error.(*googleapi.Error).Header. Use
777 // googleapi.IsNotModified to check whether the returned error was because
778 // http.StatusNotModified was returned.
779 func (c *LocationsPlaceActionLinksListCall) Do(opts ...googleapi.CallOption) (*ListPlaceActionLinksResponse, error) {
780 gensupport.SetOptions(c.urlParams_, opts...)
781 res, err := c.doRequest("json")
782 if res != nil && res.StatusCode == http.StatusNotModified {
783 if res.Body != nil {
784 res.Body.Close()
785 }
786 return nil, gensupport.WrapError(&googleapi.Error{
787 Code: res.StatusCode,
788 Header: res.Header,
789 })
790 }
791 if err != nil {
792 return nil, err
793 }
794 defer googleapi.CloseBody(res)
795 if err := googleapi.CheckResponse(res); err != nil {
796 return nil, gensupport.WrapError(err)
797 }
798 ret := &ListPlaceActionLinksResponse{
799 ServerResponse: googleapi.ServerResponse{
800 Header: res.Header,
801 HTTPStatusCode: res.StatusCode,
802 },
803 }
804 target := &ret
805 b, err := gensupport.DecodeResponseBytes(target, res)
806 if err != nil {
807 return nil, err
808 }
809 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "mybusinessplaceactions.locations.placeActionLinks.list", "response", internallog.HTTPResponse(res, b))
810 return ret, nil
811 }
812
813 // Pages invokes f for each page of results.
814 // A non-nil error returned from f will halt the iteration.
815 // The provided context supersedes any context provided to the Context method.
816 func (c *LocationsPlaceActionLinksListCall) Pages(ctx context.Context, f func(*ListPlaceActionLinksResponse) error) error {
817 c.ctx_ = ctx
818 defer c.PageToken(c.urlParams_.Get("pageToken"))
819 for {
820 x, err := c.Do()
821 if err != nil {
822 return err
823 }
824 if err := f(x); err != nil {
825 return err
826 }
827 if x.NextPageToken == "" {
828 return nil
829 }
830 c.PageToken(x.NextPageToken)
831 }
832 }
833
834 type LocationsPlaceActionLinksPatchCall struct {
835 s *Service
836 name string
837 placeactionlink *PlaceActionLink
838 urlParams_ gensupport.URLParams
839 ctx_ context.Context
840 header_ http.Header
841 }
842
843 // Patch: Updates the specified place action link and returns it.
844 //
845 // - name: Optional. The resource name, in the format
846 // `locations/{location_id}/placeActionLinks/{place_action_link_id}`. The
847 // name field will only be considered in UpdatePlaceActionLink and
848 // DeletePlaceActionLink requests for updating and deleting links
849 // respectively. However, it will be ignored in CreatePlaceActionLink
850 // request, where `place_action_link_id` will be assigned by the server on
851 // successful creation of a new link and returned as part of the response.
852 func (r *LocationsPlaceActionLinksService) Patch(name string, placeactionlink *PlaceActionLink) *LocationsPlaceActionLinksPatchCall {
853 c := &LocationsPlaceActionLinksPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
854 c.name = name
855 c.placeactionlink = placeactionlink
856 return c
857 }
858
859 // UpdateMask sets the optional parameter "updateMask": Required. The specific
860 // fields to update. The only editable fields are `uri`, `place_action_type`
861 // and `is_preferred`. If the updated link already exists at the same location
862 // with the same `place_action_type` and `uri`, fails with an `ALREADY_EXISTS`
863 // error.
864 func (c *LocationsPlaceActionLinksPatchCall) UpdateMask(updateMask string) *LocationsPlaceActionLinksPatchCall {
865 c.urlParams_.Set("updateMask", updateMask)
866 return c
867 }
868
869 // Fields allows partial responses to be retrieved. See
870 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
871 // details.
872 func (c *LocationsPlaceActionLinksPatchCall) Fields(s ...googleapi.Field) *LocationsPlaceActionLinksPatchCall {
873 c.urlParams_.Set("fields", googleapi.CombineFields(s))
874 return c
875 }
876
877 // Context sets the context to be used in this call's Do method.
878 func (c *LocationsPlaceActionLinksPatchCall) Context(ctx context.Context) *LocationsPlaceActionLinksPatchCall {
879 c.ctx_ = ctx
880 return c
881 }
882
883 // Header returns a http.Header that can be modified by the caller to add
884 // headers to the request.
885 func (c *LocationsPlaceActionLinksPatchCall) Header() http.Header {
886 if c.header_ == nil {
887 c.header_ = make(http.Header)
888 }
889 return c.header_
890 }
891
892 func (c *LocationsPlaceActionLinksPatchCall) doRequest(alt string) (*http.Response, error) {
893 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
894 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.placeactionlink)
895 if err != nil {
896 return nil, err
897 }
898 c.urlParams_.Set("alt", alt)
899 c.urlParams_.Set("prettyPrint", "false")
900 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
901 urls += "?" + c.urlParams_.Encode()
902 req, err := http.NewRequest("PATCH", urls, body)
903 if err != nil {
904 return nil, err
905 }
906 req.Header = reqHeaders
907 googleapi.Expand(req.URL, map[string]string{
908 "name": c.name,
909 })
910 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "mybusinessplaceactions.locations.placeActionLinks.patch", "request", internallog.HTTPRequest(req, body.Bytes()))
911 return gensupport.SendRequest(c.ctx_, c.s.client, req)
912 }
913
914 // Do executes the "mybusinessplaceactions.locations.placeActionLinks.patch" call.
915 // Any non-2xx status code is an error. Response headers are in either
916 // *PlaceActionLink.ServerResponse.Header or (if a response was returned at
917 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
918 // check whether the returned error was because http.StatusNotModified was
919 // returned.
920 func (c *LocationsPlaceActionLinksPatchCall) Do(opts ...googleapi.CallOption) (*PlaceActionLink, error) {
921 gensupport.SetOptions(c.urlParams_, opts...)
922 res, err := c.doRequest("json")
923 if res != nil && res.StatusCode == http.StatusNotModified {
924 if res.Body != nil {
925 res.Body.Close()
926 }
927 return nil, gensupport.WrapError(&googleapi.Error{
928 Code: res.StatusCode,
929 Header: res.Header,
930 })
931 }
932 if err != nil {
933 return nil, err
934 }
935 defer googleapi.CloseBody(res)
936 if err := googleapi.CheckResponse(res); err != nil {
937 return nil, gensupport.WrapError(err)
938 }
939 ret := &PlaceActionLink{
940 ServerResponse: googleapi.ServerResponse{
941 Header: res.Header,
942 HTTPStatusCode: res.StatusCode,
943 },
944 }
945 target := &ret
946 b, err := gensupport.DecodeResponseBytes(target, res)
947 if err != nil {
948 return nil, err
949 }
950 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "mybusinessplaceactions.locations.placeActionLinks.patch", "response", internallog.HTTPResponse(res, b))
951 return ret, nil
952 }
953
954 type PlaceActionTypeMetadataListCall struct {
955 s *Service
956 urlParams_ gensupport.URLParams
957 ifNoneMatch_ string
958 ctx_ context.Context
959 header_ http.Header
960 }
961
962 // List: Returns the list of available place action types for a location or
963 // country.
964 func (r *PlaceActionTypeMetadataService) List() *PlaceActionTypeMetadataListCall {
965 c := &PlaceActionTypeMetadataListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
966 return c
967 }
968
969 // Filter sets the optional parameter "filter": A filter constraining the place
970 // action types to return metadata for. The response includes entries that
971 // match the filter. We support only the following filters: 1. location=XYZ
972 // where XYZ is a string indicating the resource name of a location, in the
973 // format `locations/{location_id}`. 2. region_code=XYZ where XYZ is a Unicode
974 // CLDR region code to find available action types. If no filter is provided,
975 // all place action types are returned.
976 func (c *PlaceActionTypeMetadataListCall) Filter(filter string) *PlaceActionTypeMetadataListCall {
977 c.urlParams_.Set("filter", filter)
978 return c
979 }
980
981 // LanguageCode sets the optional parameter "languageCode": The IETF BCP-47
982 // code of language to get display names in. If this language is not available,
983 // they will be provided in English.
984 func (c *PlaceActionTypeMetadataListCall) LanguageCode(languageCode string) *PlaceActionTypeMetadataListCall {
985 c.urlParams_.Set("languageCode", languageCode)
986 return c
987 }
988
989 // PageSize sets the optional parameter "pageSize": How many action types to
990 // include per page. Default is 10, minimum is 1.
991 func (c *PlaceActionTypeMetadataListCall) PageSize(pageSize int64) *PlaceActionTypeMetadataListCall {
992 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
993 return c
994 }
995
996 // PageToken sets the optional parameter "pageToken": If specified, the next
997 // page of place action type metadata is retrieved. The `pageToken` is returned
998 // when a call to `placeActionTypeMetadata.list` returns more results than can
999 // fit into the requested page size.
1000 func (c *PlaceActionTypeMetadataListCall) PageToken(pageToken string) *PlaceActionTypeMetadataListCall {
1001 c.urlParams_.Set("pageToken", pageToken)
1002 return c
1003 }
1004
1005 // Fields allows partial responses to be retrieved. See
1006 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1007 // details.
1008 func (c *PlaceActionTypeMetadataListCall) Fields(s ...googleapi.Field) *PlaceActionTypeMetadataListCall {
1009 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1010 return c
1011 }
1012
1013 // IfNoneMatch sets an optional parameter which makes the operation fail if the
1014 // object's ETag matches the given value. This is useful for getting updates
1015 // only after the object has changed since the last request.
1016 func (c *PlaceActionTypeMetadataListCall) IfNoneMatch(entityTag string) *PlaceActionTypeMetadataListCall {
1017 c.ifNoneMatch_ = entityTag
1018 return c
1019 }
1020
1021 // Context sets the context to be used in this call's Do method.
1022 func (c *PlaceActionTypeMetadataListCall) Context(ctx context.Context) *PlaceActionTypeMetadataListCall {
1023 c.ctx_ = ctx
1024 return c
1025 }
1026
1027 // Header returns a http.Header that can be modified by the caller to add
1028 // headers to the request.
1029 func (c *PlaceActionTypeMetadataListCall) Header() http.Header {
1030 if c.header_ == nil {
1031 c.header_ = make(http.Header)
1032 }
1033 return c.header_
1034 }
1035
1036 func (c *PlaceActionTypeMetadataListCall) doRequest(alt string) (*http.Response, error) {
1037 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1038 if c.ifNoneMatch_ != "" {
1039 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1040 }
1041 c.urlParams_.Set("alt", alt)
1042 c.urlParams_.Set("prettyPrint", "false")
1043 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/placeActionTypeMetadata")
1044 urls += "?" + c.urlParams_.Encode()
1045 req, err := http.NewRequest("GET", urls, nil)
1046 if err != nil {
1047 return nil, err
1048 }
1049 req.Header = reqHeaders
1050 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "mybusinessplaceactions.placeActionTypeMetadata.list", "request", internallog.HTTPRequest(req, nil))
1051 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1052 }
1053
1054 // Do executes the "mybusinessplaceactions.placeActionTypeMetadata.list" call.
1055 // Any non-2xx status code is an error. Response headers are in either
1056 // *ListPlaceActionTypeMetadataResponse.ServerResponse.Header or (if a response
1057 // was returned at all) in error.(*googleapi.Error).Header. Use
1058 // googleapi.IsNotModified to check whether the returned error was because
1059 // http.StatusNotModified was returned.
1060 func (c *PlaceActionTypeMetadataListCall) Do(opts ...googleapi.CallOption) (*ListPlaceActionTypeMetadataResponse, error) {
1061 gensupport.SetOptions(c.urlParams_, opts...)
1062 res, err := c.doRequest("json")
1063 if res != nil && res.StatusCode == http.StatusNotModified {
1064 if res.Body != nil {
1065 res.Body.Close()
1066 }
1067 return nil, gensupport.WrapError(&googleapi.Error{
1068 Code: res.StatusCode,
1069 Header: res.Header,
1070 })
1071 }
1072 if err != nil {
1073 return nil, err
1074 }
1075 defer googleapi.CloseBody(res)
1076 if err := googleapi.CheckResponse(res); err != nil {
1077 return nil, gensupport.WrapError(err)
1078 }
1079 ret := &ListPlaceActionTypeMetadataResponse{
1080 ServerResponse: googleapi.ServerResponse{
1081 Header: res.Header,
1082 HTTPStatusCode: res.StatusCode,
1083 },
1084 }
1085 target := &ret
1086 b, err := gensupport.DecodeResponseBytes(target, res)
1087 if err != nil {
1088 return nil, err
1089 }
1090 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "mybusinessplaceactions.placeActionTypeMetadata.list", "response", internallog.HTTPResponse(res, b))
1091 return ret, nil
1092 }
1093
1094 // Pages invokes f for each page of results.
1095 // A non-nil error returned from f will halt the iteration.
1096 // The provided context supersedes any context provided to the Context method.
1097 func (c *PlaceActionTypeMetadataListCall) Pages(ctx context.Context, f func(*ListPlaceActionTypeMetadataResponse) error) error {
1098 c.ctx_ = ctx
1099 defer c.PageToken(c.urlParams_.Get("pageToken"))
1100 for {
1101 x, err := c.Do()
1102 if err != nil {
1103 return err
1104 }
1105 if err := f(x); err != nil {
1106 return err
1107 }
1108 if x.NextPageToken == "" {
1109 return nil
1110 }
1111 c.PageToken(x.NextPageToken)
1112 }
1113 }