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 mybusinessverifications provides access to the My Business Verifications 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/mybusinessverifications/v1" 27 // ... 28 // ctx := context.Background() 29 // mybusinessverificationsService, err := mybusinessverifications.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 // mybusinessverificationsService, err := mybusinessverifications.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 // mybusinessverificationsService, err := mybusinessverifications.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 49 // 50 // See [google.golang.org/api/option.ClientOption] for details on options. 51 package mybusinessverifications // import "google.golang.org/api/mybusinessverifications/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 = "mybusinessverifications:v1" 90 const apiName = "mybusinessverifications" 91 const apiVersion = "v1" 92 const basePath = "https://mybusinessverifications.googleapis.com/" 93 const basePathTemplate = "https://mybusinessverifications.UNIVERSE_DOMAIN/" 94 const mtlsBasePath = "https://mybusinessverifications.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.Verifications = NewLocationsVerificationsService(s) 148 return rs 149 } 150 151 type LocationsService struct { 152 s *Service 153 154 Verifications *LocationsVerificationsService 155 } 156 157 func NewLocationsVerificationsService(s *Service) *LocationsVerificationsService { 158 rs := &LocationsVerificationsService{s: s} 159 return rs 160 } 161 162 type LocationsVerificationsService struct { 163 s *Service 164 } 165 166 // AddressVerificationData: Display data for verifications through postcard. 167 type AddressVerificationData struct { 168 // Address: Address that a postcard can be sent to. 169 Address *PostalAddress `json:"address,omitempty"` 170 // Business: Merchant's business name. 171 Business string `json:"business,omitempty"` 172 // ExpectedDeliveryDaysRegion: Expected number of days it takes to deliver a 173 // postcard to the address's region. 174 ExpectedDeliveryDaysRegion int64 `json:"expectedDeliveryDaysRegion,omitempty"` 175 // ForceSendFields is a list of field names (e.g. "Address") to unconditionally 176 // include in API requests. By default, fields with empty or default values are 177 // omitted from API requests. See 178 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 179 // details. 180 ForceSendFields []string `json:"-"` 181 // NullFields is a list of field names (e.g. "Address") to include in API 182 // requests with the JSON null value. By default, fields with empty values are 183 // omitted from API requests. See 184 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 185 NullFields []string `json:"-"` 186 } 187 188 func (s *AddressVerificationData) MarshalJSON() ([]byte, error) { 189 type NoMethod AddressVerificationData 190 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 191 } 192 193 // CompleteVerificationRequest: Request message for 194 // Verifications.CompleteVerificationAction. 195 type CompleteVerificationRequest struct { 196 // Pin: Required. PIN code received by the merchant to complete the 197 // verification. 198 Pin string `json:"pin,omitempty"` 199 // ForceSendFields is a list of field names (e.g. "Pin") to unconditionally 200 // include in API requests. By default, fields with empty or default values are 201 // 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. "Pin") to include in API requests 206 // with the JSON null value. By default, fields with empty values are omitted 207 // 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 *CompleteVerificationRequest) MarshalJSON() ([]byte, error) { 213 type NoMethod CompleteVerificationRequest 214 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 215 } 216 217 // CompleteVerificationResponse: Response message for 218 // Verifications.CompleteVerificationAction. 219 type CompleteVerificationResponse struct { 220 // Verification: The completed verification. 221 Verification *Verification `json:"verification,omitempty"` 222 223 // ServerResponse contains the HTTP response code and headers from the server. 224 googleapi.ServerResponse `json:"-"` 225 // ForceSendFields is a list of field names (e.g. "Verification") to 226 // unconditionally include in API requests. By default, fields with empty or 227 // default values are omitted from API requests. See 228 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 229 // details. 230 ForceSendFields []string `json:"-"` 231 // NullFields is a list of field names (e.g. "Verification") to include in API 232 // requests with the JSON null value. By default, fields with empty values are 233 // omitted from API requests. See 234 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 235 NullFields []string `json:"-"` 236 } 237 238 func (s *CompleteVerificationResponse) MarshalJSON() ([]byte, error) { 239 type NoMethod CompleteVerificationResponse 240 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 241 } 242 243 // ComplyWithGuidelines: Indicates that the location fails to comply with our 244 // guidelines (https://support.google.com/business/answer/3038177). 245 type ComplyWithGuidelines struct { 246 // RecommendationReason: The reason why the location is being recommended to 247 // comply with guidelines. 248 // 249 // Possible values: 250 // "RECOMMENDATION_REASON_UNSPECIFIED" - Not specified. 251 // "BUSINESS_LOCATION_SUSPENDED" - The business location is suspended. To fix 252 // this issue, consult the [Help Center 253 // article](https://support.google.com/business/answer/4569145). 254 // "BUSINESS_LOCATION_DISABLED" - The business location is disabled. To fix 255 // this issue, consult the [Help Center 256 // article](https://support.google.com/business/answer/9334246). 257 RecommendationReason string `json:"recommendationReason,omitempty"` 258 // ForceSendFields is a list of field names (e.g. "RecommendationReason") to 259 // unconditionally include in API requests. By default, fields with empty or 260 // default values are omitted from API requests. See 261 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 262 // details. 263 ForceSendFields []string `json:"-"` 264 // NullFields is a list of field names (e.g. "RecommendationReason") to include 265 // in API requests with the JSON null value. By default, fields with empty 266 // values are omitted from API requests. See 267 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 268 NullFields []string `json:"-"` 269 } 270 271 func (s *ComplyWithGuidelines) MarshalJSON() ([]byte, error) { 272 type NoMethod ComplyWithGuidelines 273 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 274 } 275 276 // EmailVerificationData: Display data for verifications through email. 277 type EmailVerificationData struct { 278 // Domain: Domain name in the email address. e.g. "gmail.com" in foo@gmail.com 279 Domain string `json:"domain,omitempty"` 280 // IsUserNameEditable: Whether client is allowed to provide a different user 281 // name. 282 IsUserNameEditable bool `json:"isUserNameEditable,omitempty"` 283 // User: User name in the email address. e.g. "foo" in foo@gmail.com 284 User string `json:"user,omitempty"` 285 // ForceSendFields is a list of field names (e.g. "Domain") to unconditionally 286 // include in API requests. By default, fields with empty or default values are 287 // omitted from API requests. See 288 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 289 // details. 290 ForceSendFields []string `json:"-"` 291 // NullFields is a list of field names (e.g. "Domain") to include in API 292 // requests with the JSON null value. By default, fields with empty values are 293 // omitted from API requests. See 294 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 295 NullFields []string `json:"-"` 296 } 297 298 func (s *EmailVerificationData) MarshalJSON() ([]byte, error) { 299 type NoMethod EmailVerificationData 300 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 301 } 302 303 // FetchVerificationOptionsRequest: Request message for 304 // Verifications.FetchVerificationOptions. 305 type FetchVerificationOptionsRequest struct { 306 // Context: Optional. Extra context information for the verification of service 307 // businesses. Can only be applied to the locations whose business type is 308 // CUSTOMER_LOCATION_ONLY. Specifying an accurate address could enable more 309 // options. INVALID_ARGUMENT will be thrown if it is set for other business 310 // types of locations. 311 Context *ServiceBusinessContext `json:"context,omitempty"` 312 // LanguageCode: Required. The BCP 47 language code representing the language 313 // that is to be used for the verification process. Available options vary by 314 // language. 315 LanguageCode string `json:"languageCode,omitempty"` 316 // ForceSendFields is a list of field names (e.g. "Context") to unconditionally 317 // include in API requests. By default, fields with empty or default values are 318 // omitted from API requests. See 319 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 320 // details. 321 ForceSendFields []string `json:"-"` 322 // NullFields is a list of field names (e.g. "Context") to include in API 323 // requests with the JSON null value. By default, fields with empty values are 324 // omitted from API requests. See 325 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 326 NullFields []string `json:"-"` 327 } 328 329 func (s *FetchVerificationOptionsRequest) MarshalJSON() ([]byte, error) { 330 type NoMethod FetchVerificationOptionsRequest 331 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 332 } 333 334 // FetchVerificationOptionsResponse: Response message for 335 // Verifications.FetchVerificationOptions. 336 type FetchVerificationOptionsResponse struct { 337 // Options: The available verification options. 338 Options []*VerificationOption `json:"options,omitempty"` 339 340 // ServerResponse contains the HTTP response code and headers from the server. 341 googleapi.ServerResponse `json:"-"` 342 // ForceSendFields is a list of field names (e.g. "Options") to unconditionally 343 // include in API requests. By default, fields with empty or default values are 344 // omitted from API requests. See 345 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 346 // details. 347 ForceSendFields []string `json:"-"` 348 // NullFields is a list of field names (e.g. "Options") to include in API 349 // requests with the JSON null value. By default, fields with empty values are 350 // omitted from API requests. See 351 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 352 NullFields []string `json:"-"` 353 } 354 355 func (s *FetchVerificationOptionsResponse) MarshalJSON() ([]byte, error) { 356 type NoMethod FetchVerificationOptionsResponse 357 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 358 } 359 360 // ListVerificationsResponse: Response message for 361 // Verifications.ListVerifications. 362 type ListVerificationsResponse struct { 363 // NextPageToken: If the number of verifications exceeded the requested page 364 // size, this field will be populated with a token to fetch the next page of 365 // verification on a subsequent call. If there are no more attributes, this 366 // field will not be present in the response. 367 NextPageToken string `json:"nextPageToken,omitempty"` 368 // Verifications: List of the verifications. 369 Verifications []*Verification `json:"verifications,omitempty"` 370 371 // ServerResponse contains the HTTP response code and headers from the server. 372 googleapi.ServerResponse `json:"-"` 373 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 374 // unconditionally include in API requests. By default, fields with empty or 375 // default values are omitted from API requests. See 376 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 377 // details. 378 ForceSendFields []string `json:"-"` 379 // NullFields is a list of field names (e.g. "NextPageToken") to include in API 380 // requests with the JSON null value. By default, fields with empty values are 381 // omitted from API requests. See 382 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 383 NullFields []string `json:"-"` 384 } 385 386 func (s *ListVerificationsResponse) MarshalJSON() ([]byte, error) { 387 type NoMethod ListVerificationsResponse 388 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 389 } 390 391 // PostalAddress: Represents a postal address, e.g. for postal delivery or 392 // payments addresses. Given a postal address, a postal service can deliver 393 // items to a premise, P.O. Box or similar. It is not intended to model 394 // geographical locations (roads, towns, mountains). In typical usage an 395 // address would be created via user input or from importing existing data, 396 // depending on the type of process. Advice on address input / editing: - Use 397 // an internationalization-ready address widget such as 398 // https://github.com/google/libaddressinput) - Users should not be presented 399 // with UI elements for input or editing of fields outside countries where that 400 // field is used. For more guidance on how to use this schema, please see: 401 // https://support.google.com/business/answer/6397478 402 type PostalAddress struct { 403 // AddressLines: Unstructured address lines describing the lower levels of an 404 // address. Because values in address_lines do not have type information and 405 // may sometimes contain multiple values in a single field (e.g. "Austin, TX"), 406 // it is important that the line order is clear. The order of address lines 407 // should be "envelope order" for the country/region of the address. In places 408 // where this can vary (e.g. Japan), address_language is used to make it 409 // explicit (e.g. "ja" for large-to-small ordering and "ja-Latn" or "en" for 410 // small-to-large). This way, the most specific line of an address can be 411 // selected based on the language. The minimum permitted structural 412 // representation of an address consists of a region_code with all remaining 413 // information placed in the address_lines. It would be possible to format such 414 // an address very approximately without geocoding, but no semantic reasoning 415 // could be made about any of the address components until it was at least 416 // partially resolved. Creating an address only containing a region_code and 417 // address_lines, and then geocoding is the recommended way to handle 418 // completely unstructured addresses (as opposed to guessing which parts of the 419 // address should be localities or administrative areas). 420 AddressLines []string `json:"addressLines,omitempty"` 421 // AdministrativeArea: Optional. Highest administrative subdivision which is 422 // used for postal addresses of a country or region. For example, this can be a 423 // state, a province, an oblast, or a prefecture. Specifically, for Spain this 424 // is the province and not the autonomous community (e.g. "Barcelona" and not 425 // "Catalonia"). Many countries don't use an administrative area in postal 426 // addresses. E.g. in Switzerland this should be left unpopulated. 427 AdministrativeArea string `json:"administrativeArea,omitempty"` 428 // LanguageCode: Optional. BCP-47 language code of the contents of this address 429 // (if known). This is often the UI language of the input form or is expected 430 // to match one of the languages used in the address' country/region, or their 431 // transliterated equivalents. This can affect formatting in certain countries, 432 // but is not critical to the correctness of the data and will never affect any 433 // validation or other non-formatting related operations. If this value is not 434 // known, it should be omitted (rather than specifying a possibly incorrect 435 // default). Examples: "zh-Hant", "ja", "ja-Latn", "en". 436 LanguageCode string `json:"languageCode,omitempty"` 437 // Locality: Optional. Generally refers to the city/town portion of the 438 // address. Examples: US city, IT comune, UK post town. In regions of the world 439 // where localities are not well defined or do not fit into this structure 440 // well, leave locality empty and use address_lines. 441 Locality string `json:"locality,omitempty"` 442 // Organization: Optional. The name of the organization at the address. 443 Organization string `json:"organization,omitempty"` 444 // PostalCode: Optional. Postal code of the address. Not all countries use or 445 // require postal codes to be present, but where they are used, they may 446 // trigger additional validation with other parts of the address (e.g. 447 // state/zip validation in the U.S.A.). 448 PostalCode string `json:"postalCode,omitempty"` 449 // Recipients: Optional. The recipient at the address. This field may, under 450 // certain circumstances, contain multiline information. For example, it might 451 // contain "care of" information. 452 Recipients []string `json:"recipients,omitempty"` 453 // RegionCode: Required. CLDR region code of the country/region of the address. 454 // This is never inferred and it is up to the user to ensure the value is 455 // correct. See https://cldr.unicode.org/ and 456 // https://www.unicode.org/cldr/charts/30/supplemental/territory_information.html 457 // for details. Example: "CH" for Switzerland. 458 RegionCode string `json:"regionCode,omitempty"` 459 // Revision: The schema revision of the `PostalAddress`. This must be set to 0, 460 // which is the latest revision. All new revisions **must** be backward 461 // compatible with old revisions. 462 Revision int64 `json:"revision,omitempty"` 463 // SortingCode: Optional. Additional, country-specific, sorting code. This is 464 // not used in most regions. Where it is used, the value is either a string 465 // like "CEDEX", optionally followed by a number (e.g. "CEDEX 7"), or just a 466 // number alone, representing the "sector code" (Jamaica), "delivery area 467 // indicator" (Malawi) or "post office indicator" (e.g. Côte d'Ivoire). 468 SortingCode string `json:"sortingCode,omitempty"` 469 // Sublocality: Optional. Sublocality of the address. For example, this can be 470 // neighborhoods, boroughs, districts. 471 Sublocality string `json:"sublocality,omitempty"` 472 // ForceSendFields is a list of field names (e.g. "AddressLines") to 473 // unconditionally include in API requests. By default, fields with empty or 474 // default values are omitted from API requests. See 475 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 476 // details. 477 ForceSendFields []string `json:"-"` 478 // NullFields is a list of field names (e.g. "AddressLines") to include in API 479 // requests with the JSON null value. By default, fields with empty values are 480 // omitted from API requests. See 481 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 482 NullFields []string `json:"-"` 483 } 484 485 func (s *PostalAddress) MarshalJSON() ([]byte, error) { 486 type NoMethod PostalAddress 487 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 488 } 489 490 // ResolveOwnershipConflict: Indicates that the location duplicates another 491 // location that is in good standing. 492 type ResolveOwnershipConflict struct { 493 } 494 495 // ServiceBusinessContext: Additional data for service business verification. 496 type ServiceBusinessContext struct { 497 // Address: The verification address of the location. It is used to either 498 // enable more verification options or send a postcard. 499 Address *PostalAddress `json:"address,omitempty"` 500 // ForceSendFields is a list of field names (e.g. "Address") to unconditionally 501 // include in API requests. By default, fields with empty or default values are 502 // omitted from API requests. See 503 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 504 // details. 505 ForceSendFields []string `json:"-"` 506 // NullFields is a list of field names (e.g. "Address") to include in API 507 // requests with the JSON null value. By default, fields with empty values are 508 // omitted from API requests. See 509 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 510 NullFields []string `json:"-"` 511 } 512 513 func (s *ServiceBusinessContext) MarshalJSON() ([]byte, error) { 514 type NoMethod ServiceBusinessContext 515 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 516 } 517 518 // Verification: A verification represents a verification attempt on a 519 // location. 520 type Verification struct { 521 // Announcement: Optional. Response announcement set only if the method is 522 // VETTED_PARTNER. 523 Announcement string `json:"announcement,omitempty"` 524 // CreateTime: The timestamp when the verification is requested. 525 CreateTime string `json:"createTime,omitempty"` 526 // Method: The method of the verification. 527 // 528 // Possible values: 529 // "VERIFICATION_METHOD_UNSPECIFIED" - Default value, will result in errors. 530 // "ADDRESS" - Send a postcard with a verification PIN to a specific mailing 531 // address. The PIN is used to complete verification with Google. 532 // "EMAIL" - Send an email with a verification PIN to a specific email 533 // address. The PIN is used to complete verification with Google. 534 // "PHONE_CALL" - Make a phone call with a verification PIN to a specific 535 // phone number. The PIN is used to complete verification with Google. 536 // "SMS" - Send an SMS with a verification PIN to a specific phone number. 537 // The PIN is used to complete verification with Google. 538 // "AUTO" - Verify the location without additional user action. This option 539 // may not be available for all locations. 540 // "VETTED_PARTNER" - This option may not be available for all locations. 541 Method string `json:"method,omitempty"` 542 // Name: Resource name of the verification. 543 Name string `json:"name,omitempty"` 544 // State: The state of the verification. 545 // 546 // Possible values: 547 // "STATE_UNSPECIFIED" - Default value, will result in errors. 548 // "PENDING" - The verification is pending. 549 // "COMPLETED" - The verification is completed. 550 // "FAILED" - The verification is failed. 551 State string `json:"state,omitempty"` 552 // ForceSendFields is a list of field names (e.g. "Announcement") to 553 // unconditionally include in API requests. By default, fields with empty or 554 // default values are omitted from API requests. See 555 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 556 // details. 557 ForceSendFields []string `json:"-"` 558 // NullFields is a list of field names (e.g. "Announcement") to include in API 559 // requests with the JSON null value. By default, fields with empty values are 560 // omitted from API requests. See 561 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 562 NullFields []string `json:"-"` 563 } 564 565 func (s *Verification) MarshalJSON() ([]byte, error) { 566 type NoMethod Verification 567 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 568 } 569 570 // VerificationOption: The verification option represents how to verify the 571 // location (indicated by verification method) and where the verification will 572 // be sent to (indicated by display data). 573 type VerificationOption struct { 574 // AddressData: Set only if the method is MAIL. 575 AddressData *AddressVerificationData `json:"addressData,omitempty"` 576 // Announcement: Set only if the method is VETTED_PARTNER. 577 Announcement string `json:"announcement,omitempty"` 578 // EmailData: Set only if the method is EMAIL. 579 EmailData *EmailVerificationData `json:"emailData,omitempty"` 580 // PhoneNumber: Set only if the method is PHONE_CALL or SMS. Phone number that 581 // the PIN will be sent to. 582 PhoneNumber string `json:"phoneNumber,omitempty"` 583 // VerificationMethod: Method to verify the location. 584 // 585 // Possible values: 586 // "VERIFICATION_METHOD_UNSPECIFIED" - Default value, will result in errors. 587 // "ADDRESS" - Send a postcard with a verification PIN to a specific mailing 588 // address. The PIN is used to complete verification with Google. 589 // "EMAIL" - Send an email with a verification PIN to a specific email 590 // address. The PIN is used to complete verification with Google. 591 // "PHONE_CALL" - Make a phone call with a verification PIN to a specific 592 // phone number. The PIN is used to complete verification with Google. 593 // "SMS" - Send an SMS with a verification PIN to a specific phone number. 594 // The PIN is used to complete verification with Google. 595 // "AUTO" - Verify the location without additional user action. This option 596 // may not be available for all locations. 597 // "VETTED_PARTNER" - This option may not be available for all locations. 598 VerificationMethod string `json:"verificationMethod,omitempty"` 599 // ForceSendFields is a list of field names (e.g. "AddressData") to 600 // unconditionally include in API requests. By default, fields with empty or 601 // default values are omitted from API requests. See 602 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 603 // details. 604 ForceSendFields []string `json:"-"` 605 // NullFields is a list of field names (e.g. "AddressData") to include in API 606 // requests with the JSON null value. By default, fields with empty values are 607 // omitted from API requests. See 608 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 609 NullFields []string `json:"-"` 610 } 611 612 func (s *VerificationOption) MarshalJSON() ([]byte, error) { 613 type NoMethod VerificationOption 614 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 615 } 616 617 // VerificationToken: Token generated by a vetted partner 618 // (https://support.google.com/business/answer/7674102). 619 type VerificationToken struct { 620 // TokenString: The token string. 621 TokenString string `json:"tokenString,omitempty"` 622 // ForceSendFields is a list of field names (e.g. "TokenString") to 623 // unconditionally include in API requests. By default, fields with empty or 624 // default values are omitted from API requests. See 625 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 626 // details. 627 ForceSendFields []string `json:"-"` 628 // NullFields is a list of field names (e.g. "TokenString") to include in API 629 // requests with the JSON null value. By default, fields with empty values are 630 // omitted from API requests. See 631 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 632 NullFields []string `json:"-"` 633 } 634 635 func (s *VerificationToken) MarshalJSON() ([]byte, error) { 636 type NoMethod VerificationToken 637 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 638 } 639 640 // Verify: Indicates that the location requires verification. Contains 641 // information about the current verification actions performed on the 642 // location. 643 type Verify struct { 644 // HasPendingVerification: Indicates whether a verification process has already 645 // started, and can be completed by the location. 646 HasPendingVerification bool `json:"hasPendingVerification,omitempty"` 647 // ForceSendFields is a list of field names (e.g. "HasPendingVerification") to 648 // unconditionally include in API requests. By default, fields with empty or 649 // default values are omitted from API requests. See 650 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 651 // details. 652 ForceSendFields []string `json:"-"` 653 // NullFields is a list of field names (e.g. "HasPendingVerification") to 654 // include in API requests with the JSON null value. By default, fields with 655 // empty values are omitted from API requests. See 656 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 657 NullFields []string `json:"-"` 658 } 659 660 func (s *Verify) MarshalJSON() ([]byte, error) { 661 type NoMethod Verify 662 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 663 } 664 665 // VerifyLocationRequest: Request message for Verifications.VerifyLocation. 666 type VerifyLocationRequest struct { 667 // Context: Optional. Extra context information for the verification of service 668 // businesses. It is only required for the locations whose business type is 669 // CUSTOMER_LOCATION_ONLY. For ADDRESS verification, the address will be used 670 // to send out postcard. For other methods, it should be the same as the one 671 // that is passed to GetVerificationOptions. INVALID_ARGUMENT will be thrown if 672 // it is set for other types of business locations. 673 Context *ServiceBusinessContext `json:"context,omitempty"` 674 // EmailAddress: Optional. The input for EMAIL method. Email address where the 675 // PIN should be sent to. An email address is accepted only if it is one of the 676 // addresses provided by FetchVerificationOptions. If the EmailVerificationData 677 // has is_user_name_editable set to true, the client may specify a different 678 // user name (local-part) but must match the domain name. 679 EmailAddress string `json:"emailAddress,omitempty"` 680 // LanguageCode: Optional. The BCP 47 language code representing the language 681 // that is to be used for the verification process. 682 LanguageCode string `json:"languageCode,omitempty"` 683 // MailerContact: Optional. The input for ADDRESS method. Contact name the mail 684 // should be sent to. 685 MailerContact string `json:"mailerContact,omitempty"` 686 // Method: Required. Verification method. 687 // 688 // Possible values: 689 // "VERIFICATION_METHOD_UNSPECIFIED" - Default value, will result in errors. 690 // "ADDRESS" - Send a postcard with a verification PIN to a specific mailing 691 // address. The PIN is used to complete verification with Google. 692 // "EMAIL" - Send an email with a verification PIN to a specific email 693 // address. The PIN is used to complete verification with Google. 694 // "PHONE_CALL" - Make a phone call with a verification PIN to a specific 695 // phone number. The PIN is used to complete verification with Google. 696 // "SMS" - Send an SMS with a verification PIN to a specific phone number. 697 // The PIN is used to complete verification with Google. 698 // "AUTO" - Verify the location without additional user action. This option 699 // may not be available for all locations. 700 // "VETTED_PARTNER" - This option may not be available for all locations. 701 Method string `json:"method,omitempty"` 702 // PhoneNumber: Optional. The input for PHONE_CALL/SMS method The phone number 703 // that should be called or be sent SMS to. It must be one of the phone numbers 704 // in the eligible options. 705 PhoneNumber string `json:"phoneNumber,omitempty"` 706 // Token: Optional. The input for VETTED_PARTNER method available to select 707 // partners. (https://support.google.com/business/answer/7674102) The input is 708 // not needed for a vetted account. Token that is associated to the location. 709 // Token that is associated to the location. 710 Token *VerificationToken `json:"token,omitempty"` 711 // ForceSendFields is a list of field names (e.g. "Context") to unconditionally 712 // include in API requests. By default, fields with empty or default values are 713 // omitted from API requests. See 714 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 715 // details. 716 ForceSendFields []string `json:"-"` 717 // NullFields is a list of field names (e.g. "Context") to include in API 718 // requests with the JSON null value. By default, fields with empty values are 719 // omitted from API requests. See 720 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 721 NullFields []string `json:"-"` 722 } 723 724 func (s *VerifyLocationRequest) MarshalJSON() ([]byte, error) { 725 type NoMethod VerifyLocationRequest 726 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 727 } 728 729 // VerifyLocationResponse: Response message for Verifications.VerifyLocation. 730 type VerifyLocationResponse struct { 731 // Verification: The created verification request. 732 Verification *Verification `json:"verification,omitempty"` 733 734 // ServerResponse contains the HTTP response code and headers from the server. 735 googleapi.ServerResponse `json:"-"` 736 // ForceSendFields is a list of field names (e.g. "Verification") to 737 // unconditionally include in API requests. By default, fields with empty or 738 // default values are omitted from API requests. See 739 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 740 // details. 741 ForceSendFields []string `json:"-"` 742 // NullFields is a list of field names (e.g. "Verification") to include in API 743 // requests with the JSON null value. By default, fields with empty values are 744 // omitted from API requests. See 745 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 746 NullFields []string `json:"-"` 747 } 748 749 func (s *VerifyLocationResponse) MarshalJSON() ([]byte, error) { 750 type NoMethod VerifyLocationResponse 751 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 752 } 753 754 // VoiceOfMerchantState: Response message for 755 // VoiceOfMerchant.GetVoiceOfMerchantState. 756 type VoiceOfMerchantState struct { 757 // ComplyWithGuidelines: The location fails to comply with our guidelines 758 // (https://support.google.com/business/answer/3038177) and requires additional 759 // steps for reinstatement. To fix this issue, consult the Help Center Article 760 // (https://support.google.com/business/answer/4569145). 761 ComplyWithGuidelines *ComplyWithGuidelines `json:"complyWithGuidelines,omitempty"` 762 // HasBusinessAuthority: Indicates whether the location has the authority 763 // (ownership) over the business on Google. If true, another location cannot 764 // take over and become the dominant listing on Maps. However, edits will not 765 // become live unless Voice of Merchant is gained (i.e. has_voice_of_merchant 766 // is true). 767 HasBusinessAuthority bool `json:"hasBusinessAuthority,omitempty"` 768 // HasVoiceOfMerchant: Indicates whether the location is in good standing and 769 // has control over the business on Google. Any edits made to the location will 770 // propagate to Maps after passing the review phase. 771 HasVoiceOfMerchant bool `json:"hasVoiceOfMerchant,omitempty"` 772 // ResolveOwnershipConflict: This location duplicates another location that is 773 // in good standing. If you have access to the location in good standing, use 774 // that location's id to perform operations. Otherwise, request access from the 775 // current owner. 776 ResolveOwnershipConflict *ResolveOwnershipConflict `json:"resolveOwnershipConflict,omitempty"` 777 // Verify: Start or continue the verification process. 778 Verify *Verify `json:"verify,omitempty"` 779 // WaitForVoiceOfMerchant: Wait to gain Voice of Merchant. The location is 780 // under review for quality purposes. 781 WaitForVoiceOfMerchant *WaitForVoiceOfMerchant `json:"waitForVoiceOfMerchant,omitempty"` 782 783 // ServerResponse contains the HTTP response code and headers from the server. 784 googleapi.ServerResponse `json:"-"` 785 // ForceSendFields is a list of field names (e.g. "ComplyWithGuidelines") to 786 // unconditionally include in API requests. By default, fields with empty or 787 // default values are omitted from API requests. See 788 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 789 // details. 790 ForceSendFields []string `json:"-"` 791 // NullFields is a list of field names (e.g. "ComplyWithGuidelines") to include 792 // in API requests with the JSON null value. By default, fields with empty 793 // values are omitted from API requests. See 794 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 795 NullFields []string `json:"-"` 796 } 797 798 func (s *VoiceOfMerchantState) MarshalJSON() ([]byte, error) { 799 type NoMethod VoiceOfMerchantState 800 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 801 } 802 803 // WaitForVoiceOfMerchant: Indicates that the location will gain voice of 804 // merchant after passing review. 805 type WaitForVoiceOfMerchant struct { 806 } 807 808 type LocationsFetchVerificationOptionsCall struct { 809 s *Service 810 location string 811 fetchverificationoptionsrequest *FetchVerificationOptionsRequest 812 urlParams_ gensupport.URLParams 813 ctx_ context.Context 814 header_ http.Header 815 } 816 817 // FetchVerificationOptions: Reports all eligible verification options for a 818 // location in a specific language. 819 // 820 // - location: The location to verify. 821 func (r *LocationsService) FetchVerificationOptions(location string, fetchverificationoptionsrequest *FetchVerificationOptionsRequest) *LocationsFetchVerificationOptionsCall { 822 c := &LocationsFetchVerificationOptionsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 823 c.location = location 824 c.fetchverificationoptionsrequest = fetchverificationoptionsrequest 825 return c 826 } 827 828 // Fields allows partial responses to be retrieved. See 829 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 830 // details. 831 func (c *LocationsFetchVerificationOptionsCall) Fields(s ...googleapi.Field) *LocationsFetchVerificationOptionsCall { 832 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 833 return c 834 } 835 836 // Context sets the context to be used in this call's Do method. 837 func (c *LocationsFetchVerificationOptionsCall) Context(ctx context.Context) *LocationsFetchVerificationOptionsCall { 838 c.ctx_ = ctx 839 return c 840 } 841 842 // Header returns a http.Header that can be modified by the caller to add 843 // headers to the request. 844 func (c *LocationsFetchVerificationOptionsCall) Header() http.Header { 845 if c.header_ == nil { 846 c.header_ = make(http.Header) 847 } 848 return c.header_ 849 } 850 851 func (c *LocationsFetchVerificationOptionsCall) doRequest(alt string) (*http.Response, error) { 852 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 853 var body io.Reader = nil 854 body, err := googleapi.WithoutDataWrapper.JSONReader(c.fetchverificationoptionsrequest) 855 if err != nil { 856 return nil, err 857 } 858 c.urlParams_.Set("alt", alt) 859 c.urlParams_.Set("prettyPrint", "false") 860 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+location}:fetchVerificationOptions") 861 urls += "?" + c.urlParams_.Encode() 862 req, err := http.NewRequest("POST", urls, body) 863 if err != nil { 864 return nil, err 865 } 866 req.Header = reqHeaders 867 googleapi.Expand(req.URL, map[string]string{ 868 "location": c.location, 869 }) 870 return gensupport.SendRequest(c.ctx_, c.s.client, req) 871 } 872 873 // Do executes the "mybusinessverifications.locations.fetchVerificationOptions" call. 874 // Any non-2xx status code is an error. Response headers are in either 875 // *FetchVerificationOptionsResponse.ServerResponse.Header or (if a response 876 // was returned at all) in error.(*googleapi.Error).Header. Use 877 // googleapi.IsNotModified to check whether the returned error was because 878 // http.StatusNotModified was returned. 879 func (c *LocationsFetchVerificationOptionsCall) Do(opts ...googleapi.CallOption) (*FetchVerificationOptionsResponse, error) { 880 gensupport.SetOptions(c.urlParams_, opts...) 881 res, err := c.doRequest("json") 882 if res != nil && res.StatusCode == http.StatusNotModified { 883 if res.Body != nil { 884 res.Body.Close() 885 } 886 return nil, gensupport.WrapError(&googleapi.Error{ 887 Code: res.StatusCode, 888 Header: res.Header, 889 }) 890 } 891 if err != nil { 892 return nil, err 893 } 894 defer googleapi.CloseBody(res) 895 if err := googleapi.CheckResponse(res); err != nil { 896 return nil, gensupport.WrapError(err) 897 } 898 ret := &FetchVerificationOptionsResponse{ 899 ServerResponse: googleapi.ServerResponse{ 900 Header: res.Header, 901 HTTPStatusCode: res.StatusCode, 902 }, 903 } 904 target := &ret 905 if err := gensupport.DecodeResponse(target, res); err != nil { 906 return nil, err 907 } 908 return ret, nil 909 } 910 911 type LocationsGetVoiceOfMerchantStateCall struct { 912 s *Service 913 name string 914 urlParams_ gensupport.URLParams 915 ifNoneMatch_ string 916 ctx_ context.Context 917 header_ http.Header 918 } 919 920 // GetVoiceOfMerchantState: Gets the VoiceOfMerchant state. 921 // 922 // - name: Resource name of the location. 923 func (r *LocationsService) GetVoiceOfMerchantState(name string) *LocationsGetVoiceOfMerchantStateCall { 924 c := &LocationsGetVoiceOfMerchantStateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 925 c.name = name 926 return c 927 } 928 929 // Fields allows partial responses to be retrieved. See 930 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 931 // details. 932 func (c *LocationsGetVoiceOfMerchantStateCall) Fields(s ...googleapi.Field) *LocationsGetVoiceOfMerchantStateCall { 933 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 934 return c 935 } 936 937 // IfNoneMatch sets an optional parameter which makes the operation fail if the 938 // object's ETag matches the given value. This is useful for getting updates 939 // only after the object has changed since the last request. 940 func (c *LocationsGetVoiceOfMerchantStateCall) IfNoneMatch(entityTag string) *LocationsGetVoiceOfMerchantStateCall { 941 c.ifNoneMatch_ = entityTag 942 return c 943 } 944 945 // Context sets the context to be used in this call's Do method. 946 func (c *LocationsGetVoiceOfMerchantStateCall) Context(ctx context.Context) *LocationsGetVoiceOfMerchantStateCall { 947 c.ctx_ = ctx 948 return c 949 } 950 951 // Header returns a http.Header that can be modified by the caller to add 952 // headers to the request. 953 func (c *LocationsGetVoiceOfMerchantStateCall) Header() http.Header { 954 if c.header_ == nil { 955 c.header_ = make(http.Header) 956 } 957 return c.header_ 958 } 959 960 func (c *LocationsGetVoiceOfMerchantStateCall) doRequest(alt string) (*http.Response, error) { 961 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) 962 if c.ifNoneMatch_ != "" { 963 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 964 } 965 var body io.Reader = nil 966 c.urlParams_.Set("alt", alt) 967 c.urlParams_.Set("prettyPrint", "false") 968 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/VoiceOfMerchantState") 969 urls += "?" + c.urlParams_.Encode() 970 req, err := http.NewRequest("GET", urls, body) 971 if err != nil { 972 return nil, err 973 } 974 req.Header = reqHeaders 975 googleapi.Expand(req.URL, map[string]string{ 976 "name": c.name, 977 }) 978 return gensupport.SendRequest(c.ctx_, c.s.client, req) 979 } 980 981 // Do executes the "mybusinessverifications.locations.getVoiceOfMerchantState" call. 982 // Any non-2xx status code is an error. Response headers are in either 983 // *VoiceOfMerchantState.ServerResponse.Header or (if a response was returned 984 // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 985 // check whether the returned error was because http.StatusNotModified was 986 // returned. 987 func (c *LocationsGetVoiceOfMerchantStateCall) Do(opts ...googleapi.CallOption) (*VoiceOfMerchantState, error) { 988 gensupport.SetOptions(c.urlParams_, opts...) 989 res, err := c.doRequest("json") 990 if res != nil && res.StatusCode == http.StatusNotModified { 991 if res.Body != nil { 992 res.Body.Close() 993 } 994 return nil, gensupport.WrapError(&googleapi.Error{ 995 Code: res.StatusCode, 996 Header: res.Header, 997 }) 998 } 999 if err != nil { 1000 return nil, err 1001 } 1002 defer googleapi.CloseBody(res) 1003 if err := googleapi.CheckResponse(res); err != nil { 1004 return nil, gensupport.WrapError(err) 1005 } 1006 ret := &VoiceOfMerchantState{ 1007 ServerResponse: googleapi.ServerResponse{ 1008 Header: res.Header, 1009 HTTPStatusCode: res.StatusCode, 1010 }, 1011 } 1012 target := &ret 1013 if err := gensupport.DecodeResponse(target, res); err != nil { 1014 return nil, err 1015 } 1016 return ret, nil 1017 } 1018 1019 type LocationsVerifyCall struct { 1020 s *Service 1021 name string 1022 verifylocationrequest *VerifyLocationRequest 1023 urlParams_ gensupport.URLParams 1024 ctx_ context.Context 1025 header_ http.Header 1026 } 1027 1028 // Verify: Starts the verification process for a location. 1029 // 1030 // - name: Resource name of the location to verify. 1031 func (r *LocationsService) Verify(name string, verifylocationrequest *VerifyLocationRequest) *LocationsVerifyCall { 1032 c := &LocationsVerifyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1033 c.name = name 1034 c.verifylocationrequest = verifylocationrequest 1035 return c 1036 } 1037 1038 // Fields allows partial responses to be retrieved. See 1039 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1040 // details. 1041 func (c *LocationsVerifyCall) Fields(s ...googleapi.Field) *LocationsVerifyCall { 1042 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1043 return c 1044 } 1045 1046 // Context sets the context to be used in this call's Do method. 1047 func (c *LocationsVerifyCall) Context(ctx context.Context) *LocationsVerifyCall { 1048 c.ctx_ = ctx 1049 return c 1050 } 1051 1052 // Header returns a http.Header that can be modified by the caller to add 1053 // headers to the request. 1054 func (c *LocationsVerifyCall) Header() http.Header { 1055 if c.header_ == nil { 1056 c.header_ = make(http.Header) 1057 } 1058 return c.header_ 1059 } 1060 1061 func (c *LocationsVerifyCall) doRequest(alt string) (*http.Response, error) { 1062 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 1063 var body io.Reader = nil 1064 body, err := googleapi.WithoutDataWrapper.JSONReader(c.verifylocationrequest) 1065 if err != nil { 1066 return nil, err 1067 } 1068 c.urlParams_.Set("alt", alt) 1069 c.urlParams_.Set("prettyPrint", "false") 1070 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:verify") 1071 urls += "?" + c.urlParams_.Encode() 1072 req, err := http.NewRequest("POST", urls, body) 1073 if err != nil { 1074 return nil, err 1075 } 1076 req.Header = reqHeaders 1077 googleapi.Expand(req.URL, map[string]string{ 1078 "name": c.name, 1079 }) 1080 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1081 } 1082 1083 // Do executes the "mybusinessverifications.locations.verify" call. 1084 // Any non-2xx status code is an error. Response headers are in either 1085 // *VerifyLocationResponse.ServerResponse.Header or (if a response was returned 1086 // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1087 // check whether the returned error was because http.StatusNotModified was 1088 // returned. 1089 func (c *LocationsVerifyCall) Do(opts ...googleapi.CallOption) (*VerifyLocationResponse, error) { 1090 gensupport.SetOptions(c.urlParams_, opts...) 1091 res, err := c.doRequest("json") 1092 if res != nil && res.StatusCode == http.StatusNotModified { 1093 if res.Body != nil { 1094 res.Body.Close() 1095 } 1096 return nil, gensupport.WrapError(&googleapi.Error{ 1097 Code: res.StatusCode, 1098 Header: res.Header, 1099 }) 1100 } 1101 if err != nil { 1102 return nil, err 1103 } 1104 defer googleapi.CloseBody(res) 1105 if err := googleapi.CheckResponse(res); err != nil { 1106 return nil, gensupport.WrapError(err) 1107 } 1108 ret := &VerifyLocationResponse{ 1109 ServerResponse: googleapi.ServerResponse{ 1110 Header: res.Header, 1111 HTTPStatusCode: res.StatusCode, 1112 }, 1113 } 1114 target := &ret 1115 if err := gensupport.DecodeResponse(target, res); err != nil { 1116 return nil, err 1117 } 1118 return ret, nil 1119 } 1120 1121 type LocationsVerificationsCompleteCall struct { 1122 s *Service 1123 name string 1124 completeverificationrequest *CompleteVerificationRequest 1125 urlParams_ gensupport.URLParams 1126 ctx_ context.Context 1127 header_ http.Header 1128 } 1129 1130 // Complete: Completes a `PENDING` verification. It is only necessary for non 1131 // `AUTO` verification methods. `AUTO` verification request is instantly 1132 // `VERIFIED` upon creation. 1133 // 1134 // - name: Resource name of the verification to complete. 1135 func (r *LocationsVerificationsService) Complete(name string, completeverificationrequest *CompleteVerificationRequest) *LocationsVerificationsCompleteCall { 1136 c := &LocationsVerificationsCompleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1137 c.name = name 1138 c.completeverificationrequest = completeverificationrequest 1139 return c 1140 } 1141 1142 // Fields allows partial responses to be retrieved. See 1143 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1144 // details. 1145 func (c *LocationsVerificationsCompleteCall) Fields(s ...googleapi.Field) *LocationsVerificationsCompleteCall { 1146 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1147 return c 1148 } 1149 1150 // Context sets the context to be used in this call's Do method. 1151 func (c *LocationsVerificationsCompleteCall) Context(ctx context.Context) *LocationsVerificationsCompleteCall { 1152 c.ctx_ = ctx 1153 return c 1154 } 1155 1156 // Header returns a http.Header that can be modified by the caller to add 1157 // headers to the request. 1158 func (c *LocationsVerificationsCompleteCall) Header() http.Header { 1159 if c.header_ == nil { 1160 c.header_ = make(http.Header) 1161 } 1162 return c.header_ 1163 } 1164 1165 func (c *LocationsVerificationsCompleteCall) doRequest(alt string) (*http.Response, error) { 1166 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 1167 var body io.Reader = nil 1168 body, err := googleapi.WithoutDataWrapper.JSONReader(c.completeverificationrequest) 1169 if err != nil { 1170 return nil, err 1171 } 1172 c.urlParams_.Set("alt", alt) 1173 c.urlParams_.Set("prettyPrint", "false") 1174 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:complete") 1175 urls += "?" + c.urlParams_.Encode() 1176 req, err := http.NewRequest("POST", urls, body) 1177 if err != nil { 1178 return nil, err 1179 } 1180 req.Header = reqHeaders 1181 googleapi.Expand(req.URL, map[string]string{ 1182 "name": c.name, 1183 }) 1184 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1185 } 1186 1187 // Do executes the "mybusinessverifications.locations.verifications.complete" call. 1188 // Any non-2xx status code is an error. Response headers are in either 1189 // *CompleteVerificationResponse.ServerResponse.Header or (if a response was 1190 // returned at all) in error.(*googleapi.Error).Header. Use 1191 // googleapi.IsNotModified to check whether the returned error was because 1192 // http.StatusNotModified was returned. 1193 func (c *LocationsVerificationsCompleteCall) Do(opts ...googleapi.CallOption) (*CompleteVerificationResponse, error) { 1194 gensupport.SetOptions(c.urlParams_, opts...) 1195 res, err := c.doRequest("json") 1196 if res != nil && res.StatusCode == http.StatusNotModified { 1197 if res.Body != nil { 1198 res.Body.Close() 1199 } 1200 return nil, gensupport.WrapError(&googleapi.Error{ 1201 Code: res.StatusCode, 1202 Header: res.Header, 1203 }) 1204 } 1205 if err != nil { 1206 return nil, err 1207 } 1208 defer googleapi.CloseBody(res) 1209 if err := googleapi.CheckResponse(res); err != nil { 1210 return nil, gensupport.WrapError(err) 1211 } 1212 ret := &CompleteVerificationResponse{ 1213 ServerResponse: googleapi.ServerResponse{ 1214 Header: res.Header, 1215 HTTPStatusCode: res.StatusCode, 1216 }, 1217 } 1218 target := &ret 1219 if err := gensupport.DecodeResponse(target, res); err != nil { 1220 return nil, err 1221 } 1222 return ret, nil 1223 } 1224 1225 type LocationsVerificationsListCall struct { 1226 s *Service 1227 parent string 1228 urlParams_ gensupport.URLParams 1229 ifNoneMatch_ string 1230 ctx_ context.Context 1231 header_ http.Header 1232 } 1233 1234 // List: List verifications of a location, ordered by create time. 1235 // 1236 // - parent: Resource name of the location that verification requests belong 1237 // to. 1238 func (r *LocationsVerificationsService) List(parent string) *LocationsVerificationsListCall { 1239 c := &LocationsVerificationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1240 c.parent = parent 1241 return c 1242 } 1243 1244 // PageSize sets the optional parameter "pageSize": How many verification to 1245 // include per page. Minimum is 1, and the default and maximum page size is 1246 // 100. 1247 func (c *LocationsVerificationsListCall) PageSize(pageSize int64) *LocationsVerificationsListCall { 1248 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1249 return c 1250 } 1251 1252 // PageToken sets the optional parameter "pageToken": If specified, returns the 1253 // next page of verifications. 1254 func (c *LocationsVerificationsListCall) PageToken(pageToken string) *LocationsVerificationsListCall { 1255 c.urlParams_.Set("pageToken", pageToken) 1256 return c 1257 } 1258 1259 // Fields allows partial responses to be retrieved. See 1260 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1261 // details. 1262 func (c *LocationsVerificationsListCall) Fields(s ...googleapi.Field) *LocationsVerificationsListCall { 1263 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1264 return c 1265 } 1266 1267 // IfNoneMatch sets an optional parameter which makes the operation fail if the 1268 // object's ETag matches the given value. This is useful for getting updates 1269 // only after the object has changed since the last request. 1270 func (c *LocationsVerificationsListCall) IfNoneMatch(entityTag string) *LocationsVerificationsListCall { 1271 c.ifNoneMatch_ = entityTag 1272 return c 1273 } 1274 1275 // Context sets the context to be used in this call's Do method. 1276 func (c *LocationsVerificationsListCall) Context(ctx context.Context) *LocationsVerificationsListCall { 1277 c.ctx_ = ctx 1278 return c 1279 } 1280 1281 // Header returns a http.Header that can be modified by the caller to add 1282 // headers to the request. 1283 func (c *LocationsVerificationsListCall) Header() http.Header { 1284 if c.header_ == nil { 1285 c.header_ = make(http.Header) 1286 } 1287 return c.header_ 1288 } 1289 1290 func (c *LocationsVerificationsListCall) doRequest(alt string) (*http.Response, error) { 1291 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) 1292 if c.ifNoneMatch_ != "" { 1293 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1294 } 1295 var body io.Reader = nil 1296 c.urlParams_.Set("alt", alt) 1297 c.urlParams_.Set("prettyPrint", "false") 1298 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/verifications") 1299 urls += "?" + c.urlParams_.Encode() 1300 req, err := http.NewRequest("GET", urls, body) 1301 if err != nil { 1302 return nil, err 1303 } 1304 req.Header = reqHeaders 1305 googleapi.Expand(req.URL, map[string]string{ 1306 "parent": c.parent, 1307 }) 1308 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1309 } 1310 1311 // Do executes the "mybusinessverifications.locations.verifications.list" call. 1312 // Any non-2xx status code is an error. Response headers are in either 1313 // *ListVerificationsResponse.ServerResponse.Header or (if a response was 1314 // returned at all) in error.(*googleapi.Error).Header. Use 1315 // googleapi.IsNotModified to check whether the returned error was because 1316 // http.StatusNotModified was returned. 1317 func (c *LocationsVerificationsListCall) Do(opts ...googleapi.CallOption) (*ListVerificationsResponse, error) { 1318 gensupport.SetOptions(c.urlParams_, opts...) 1319 res, err := c.doRequest("json") 1320 if res != nil && res.StatusCode == http.StatusNotModified { 1321 if res.Body != nil { 1322 res.Body.Close() 1323 } 1324 return nil, gensupport.WrapError(&googleapi.Error{ 1325 Code: res.StatusCode, 1326 Header: res.Header, 1327 }) 1328 } 1329 if err != nil { 1330 return nil, err 1331 } 1332 defer googleapi.CloseBody(res) 1333 if err := googleapi.CheckResponse(res); err != nil { 1334 return nil, gensupport.WrapError(err) 1335 } 1336 ret := &ListVerificationsResponse{ 1337 ServerResponse: googleapi.ServerResponse{ 1338 Header: res.Header, 1339 HTTPStatusCode: res.StatusCode, 1340 }, 1341 } 1342 target := &ret 1343 if err := gensupport.DecodeResponse(target, res); err != nil { 1344 return nil, err 1345 } 1346 return ret, nil 1347 } 1348 1349 // Pages invokes f for each page of results. 1350 // A non-nil error returned from f will halt the iteration. 1351 // The provided context supersedes any context provided to the Context method. 1352 func (c *LocationsVerificationsListCall) Pages(ctx context.Context, f func(*ListVerificationsResponse) error) error { 1353 c.ctx_ = ctx 1354 defer c.PageToken(c.urlParams_.Get("pageToken")) 1355 for { 1356 x, err := c.Do() 1357 if err != nil { 1358 return err 1359 } 1360 if err := f(x); err != nil { 1361 return err 1362 } 1363 if x.NextPageToken == "" { 1364 return nil 1365 } 1366 c.PageToken(x.NextPageToken) 1367 } 1368 } 1369