region_identifier.proto 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. // Copyright 2022 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.maps.regionlookup.v1alpha;
  16. import "google/api/field_behavior.proto";
  17. option cc_enable_arenas = true;
  18. option csharp_namespace = "Google.Maps.RegionLookup.V1Alpha";
  19. option go_package = "google.golang.org/genproto/googleapis/maps/regionlookup/v1alpha;regionlookup";
  20. option java_multiple_files = true;
  21. option java_outer_classname = "RegionIdentifierProto";
  22. option java_package = "com.google.maps.regionlookup.v1alpha";
  23. option objc_class_prefix = "MRLV1A";
  24. option php_namespace = "Google\\Maps\\RegionLookup\\V1alpha";
  25. // Region Identifier.
  26. //
  27. // Identifies a region to look up.
  28. //
  29. // One of place or unit_code must be specified. If none is specified,
  30. // an INVALID_ARGUMENT error is returned. region_code must also be specified
  31. // except when place_type is "country".
  32. //
  33. // place and unit_code specify a location to match a Place ID to. For
  34. // example if place is "California" and region_code "US" the API
  35. // returns the following matched_place_id results when the following
  36. // place_types are specified:
  37. //
  38. // place_type: matched_place_id results:
  39. // administrative_area_level_1 Place ID for The State of California
  40. // (All other supported types) No Match
  41. //
  42. // If unit_code is "6" (FIPs code for California) and region_code is "US
  43. // the API returns the following matched_place_id results when the
  44. // following place_types are specified:
  45. //
  46. // place type: matched_place_id results:
  47. // administrative_area_level_1 Place ID for The State of California
  48. // (All other supported types) No Match
  49. //
  50. // or if unit_code is "US" the API returns the following results when
  51. // the following place_types are specified:
  52. //
  53. // place type: matched_place_id results:
  54. // country Place ID for the United States
  55. // (All other supported types) No Match
  56. //
  57. // If no match is found, matched_place_id is not set.
  58. //
  59. // Candidate Place IDs are returned when a lookup finds a region with a
  60. // different place_type then the one requested. For example if place is
  61. // "California" and place_type is "country" the Place ID for The State of
  62. // California is returned as a candidate in the candidate_place_ids field.
  63. //
  64. // Next available tag: 10
  65. message RegionIdentifier {
  66. // Possible place types to match to.
  67. enum PlaceType {
  68. // Default value. This value is unused.
  69. PLACE_TYPE_UNSPECIFIED = 0;
  70. // Postal code.
  71. POSTAL_CODE = 1;
  72. // Administrative area level 1 (State in the US).
  73. ADMINISTRATIVE_AREA_LEVEL_1 = 2;
  74. // Administrative area level 2 (County in the US).
  75. ADMINISTRATIVE_AREA_LEVEL_2 = 3;
  76. // Locality (City).
  77. LOCALITY = 4;
  78. // Neighborhood.
  79. NEIGHBORHOOD = 5;
  80. // Country.
  81. COUNTRY = 6;
  82. // Sublocality.
  83. SUBLOCALITY = 7;
  84. // Administrative area level 3.
  85. ADMINISTRATIVE_AREA_LEVEL_3 = 8;
  86. // Administrative area level 4.
  87. ADMINISTRATIVE_AREA_LEVEL_4 = 9;
  88. // School district.
  89. SCHOOL_DISTRICT = 10;
  90. }
  91. // The location must be specified by one of the following:
  92. oneof location {
  93. // The name of the region to match to a Place ID.
  94. //
  95. // The place field is used in combination with place_type to look up
  96. // the region Place ID.
  97. //
  98. // For example:
  99. // If place_type is "locality", a valid place can be "Palo Alto, CA".
  100. //
  101. // If place_type is "postal_code", a valid place can be "94109".
  102. //
  103. // If place_type is "country", a valid place can be "United States".
  104. // etc.
  105. //
  106. // region_code is required when place is specified except when
  107. // place_type is "country".
  108. string place = 4;
  109. // The FIPs state or county codes (US only) or ISO-3166-1 country code to be
  110. // matched.
  111. //
  112. // The unit_code field is used in combination with place_type to look up
  113. // the region Place ID.
  114. //
  115. // For example:
  116. // If place_type is "country", a valid unit_code can be "US" (ISO-3166-1
  117. // Alpha-2 code for United States) or "BR" (ISO-3166-1 Alpha-2 code for
  118. // Brazil).
  119. //
  120. // If place_type is "administrative_area_level_1" (state) and region_code is
  121. // "US", a valid unit_code can be "6" (FIPs code for California) or
  122. // "12"(FIPs code for Florida).
  123. //
  124. // If place_type is "administrative_area_level_2" (county) and region_code
  125. // is "US", a valid unit_code can be "6001" (FIPs code for Alameda County in
  126. // California) or "12086" (FIPs code for Miami-Dade County in Florida).
  127. //
  128. // region_code is required when specifying a FIPs code. region_code is
  129. // ignored for ISO-3166-1 country codes.
  130. string unit_code = 5;
  131. }
  132. // Required. Place type to match.
  133. PlaceType place_type = 6 [(google.api.field_behavior) = REQUIRED];
  134. // The BCP-47 language code, such as "en-US" or "sr-Latn", corresponding to
  135. // the language in which the place name and address is requested. If none is
  136. // requested, then it defaults to English.
  137. string language_code = 7;
  138. // Two-letter ISO-3166 country/region code for the location you're trying to
  139. // match. region_code is optional if place_type is "country".
  140. string region_code = 8;
  141. }