xref: /aosp_15_r20/external/googleapis/google/maps/regionlookup/v1alpha/region_identifier.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
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
15syntax = "proto3";
16
17package google.maps.regionlookup.v1alpha;
18
19import "google/api/field_behavior.proto";
20
21option cc_enable_arenas = true;
22option csharp_namespace = "Google.Maps.RegionLookup.V1Alpha";
23option go_package = "cloud.google.com/go/maps/regionlookup/apiv1alpha/regionlookuppb;regionlookuppb";
24option java_multiple_files = true;
25option java_outer_classname = "RegionIdentifierProto";
26option java_package = "com.google.maps.regionlookup.v1alpha";
27option objc_class_prefix = "MRLV1A";
28option php_namespace = "Google\\Maps\\RegionLookup\\V1alpha";
29
30// Region Identifier.
31//
32// Identifies a region to look up.
33//
34// One of place or unit_code must be specified. If none is specified,
35// an INVALID_ARGUMENT error is returned. region_code must also be specified
36// except when place_type is "country".
37//
38// place and unit_code specify a location to match a Place ID to. For
39// example if place is "California" and region_code "US" the API
40// returns the following matched_place_id results when the following
41// place_types are specified:
42//
43// place_type:                   matched_place_id results:
44// administrative_area_level_1   Place ID for The State of California
45// (All other supported types)   No Match
46//
47// If unit_code is "6" (FIPs code for California) and region_code is "US
48// the API returns the following matched_place_id results when the
49// following place_types are specified:
50//
51// place type:                   matched_place_id results:
52// administrative_area_level_1   Place ID for The State of California
53// (All other supported types)   No Match
54//
55// or if unit_code is "US" the API returns the following results when
56// the following place_types are specified:
57//
58// place type:                   matched_place_id results:
59// country                       Place ID for the United States
60// (All other supported types)   No Match
61//
62// If no match is found, matched_place_id is not set.
63//
64// Candidate Place IDs are returned when a lookup finds a region with a
65// different place_type then the one requested. For example if place is
66// "California" and place_type is "country" the Place ID for The State of
67// California is returned as a candidate in the candidate_place_ids field.
68//
69// Next available tag: 10
70message RegionIdentifier {
71  // Possible place types to match to.
72  enum PlaceType {
73    // Default value. This value is unused.
74    PLACE_TYPE_UNSPECIFIED = 0;
75
76    // Postal code.
77    POSTAL_CODE = 1;
78
79    // Administrative area level 1 (State in the US).
80    ADMINISTRATIVE_AREA_LEVEL_1 = 2;
81
82    // Administrative area level 2 (County in the US).
83    ADMINISTRATIVE_AREA_LEVEL_2 = 3;
84
85    // Locality (City).
86    LOCALITY = 4;
87
88    // Neighborhood.
89    NEIGHBORHOOD = 5;
90
91    // Country.
92    COUNTRY = 6;
93
94    // Sublocality.
95    SUBLOCALITY = 7;
96
97    // Administrative area level 3.
98    ADMINISTRATIVE_AREA_LEVEL_3 = 8;
99
100    // Administrative area level 4.
101    ADMINISTRATIVE_AREA_LEVEL_4 = 9;
102
103    // School district.
104    SCHOOL_DISTRICT = 10;
105  }
106
107  // The location must be specified by one of the following:
108  oneof location {
109    // The name of the region to match to a Place ID.
110    //
111    // The place field is used in combination with place_type to look up
112    // the region Place ID.
113    //
114    // For example:
115    // If place_type is "locality", a valid place can be "Palo Alto, CA".
116    //
117    // If place_type is "postal_code", a valid place can be "94109".
118    //
119    // If place_type is "country", a valid place can be "United States".
120    // etc.
121    //
122    // region_code is required when place is specified except when
123    // place_type is "country".
124    string place = 4;
125
126    // The FIPs state or county codes (US only) or ISO-3166-1 country code to be
127    // matched.
128    //
129    // The unit_code field is used in combination with place_type to look up
130    // the region Place ID.
131    //
132    // For example:
133    // If place_type is "country", a valid unit_code can be "US" (ISO-3166-1
134    // Alpha-2 code for United States) or "BR" (ISO-3166-1 Alpha-2 code for
135    // Brazil).
136    //
137    // If place_type is "administrative_area_level_1" (state) and region_code is
138    // "US", a valid unit_code can be "6" (FIPs code for California) or
139    // "12"(FIPs code for Florida).
140    //
141    // If place_type is "administrative_area_level_2" (county) and region_code
142    // is "US", a valid unit_code can be "6001" (FIPs code for Alameda County in
143    // California) or "12086" (FIPs code for Miami-Dade County in Florida).
144    //
145    // region_code is required when specifying a FIPs code. region_code is
146    // ignored for ISO-3166-1 country codes.
147    string unit_code = 5;
148  }
149
150  // Required. Place type to match.
151  PlaceType place_type = 6 [(google.api.field_behavior) = REQUIRED];
152
153  // The BCP-47 language code, such as "en-US" or "sr-Latn", corresponding to
154  // the language in which the place name and address is requested. If none is
155  // requested, then it defaults to English.
156  string language_code = 7;
157
158  // Two-letter ISO-3166 country/region code for the location you're trying to
159  // match. region_code is optional if place_type is "country".
160  string region_code = 8;
161}
162