Debian Codegraph @

google/type/phone_number.proto

raw
1 // Copyright 2026 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
15 syntax = "proto3";
16
17 package google.type;
18
19 option go_package = "google.golang.org/genproto/googleapis/type/phone_number;phone_number";
20 option java_multiple_files = true;
21 option java_outer_classname = "PhoneNumberProto";
22 option java_package = "com.google.type";
23 option objc_class_prefix = "GTP";
24
25 // An object representing a phone number, suitable as an API wire format.
26 //
27 // This representation:
28 //
29 // - should not be used for locale-specific formatting of a phone number, such
30 // as "+1 (650) 253-0000 ext. 123"
31 //
32 // - is not designed for efficient storage
33 // - may not be suitable for dialing - specialized libraries (see references)
34 // should be used to parse the number for that purpose
35 //
36 // To do something meaningful with this number, such as format it for various
37 // use-cases, convert it to an `i18n.phonenumbers.PhoneNumber` object first.
38 //
39 // For instance, in Java this would be:
40 //
41 // com.google.type.PhoneNumber wireProto =
42 // com.google.type.PhoneNumber.newBuilder().build();
43 // com.google.i18n.phonenumbers.Phonenumber.PhoneNumber phoneNumber =
44 // PhoneNumberUtil.getInstance().parse(wireProto.getE164Number(), "ZZ");
45 // if (!wireProto.getExtension().isEmpty()) {
46 // phoneNumber.setExtension(wireProto.getExtension());
47 // }
48 //
49 // Reference(s):
50 // - https://github.com/google/libphonenumber
51 message PhoneNumber {
52 // An object representing a short code, which is a phone number that is
53 // typically much shorter than regular phone numbers and can be used to
54 // address messages in MMS and SMS systems, as well as for abbreviated dialing
55 // (For example "Text 611 to see how many minutes you have remaining on your
56 // plan.").
57 //
58 // Short codes are restricted to a region and are not internationally
59 // dialable, which means the same short code can exist in different regions,
60 // with different usage and pricing, even if those regions share the same
61 // country calling code (For example: US and CA).
62 message ShortCode {
63 // Required. The BCP-47 region code of the location where calls to this
64 // short code can be made, such as "US" and "BB".
65 //
66 // Reference(s):
67 // - http://www.unicode.org/reports/tr35/#unicode_region_subtag
68 string region_code = 1;
69
70 // Required. The short code digits, without a leading plus ('+') or country
71 // calling code. For example "611".
72 string number = 2;
73 }
74
75 // Required. Either a regular number, or a short code. New fields may be
76 // added to the oneof below in the future, so clients should ignore phone
77 // numbers for which none of the fields they coded against are set.
78 oneof kind {
79 // The phone number, represented as a leading plus sign ('+'), followed by a
80 // phone number that uses a relaxed ITU E.164 format consisting of the
81 // country calling code (1 to 3 digits) and the subscriber number, with no
82 // additional spaces or formatting. For example:
83 //
84 // - correct: "+15552220123"
85 //
86 // - incorrect: "+1 (555) 222-01234 x123"
87 //
88 // The ITU E.164 format limits the latter to 12 digits, but in practice not
89 // all countries respect that, so we relax that restriction here.
90 // National-only numbers are not allowed.
91 //
92 // References:
93 //
94 // - https://www.itu.int/rec/T-REC-E.164-201011-I
95 //
96 // - https://en.wikipedia.org/wiki/E.164.
97 //
98 // - https://en.wikipedia.org/wiki/List_of_country_calling_codes
99 string e164_number = 1;
100
101 // A short code.
102 //
103 // Reference(s):
104 // - https://wikipedia.org/wiki/Short_code
105 ShortCode short_code = 2;
106 }
107
108 // The phone number's extension. The extension is not standardized in ITU
109 // recommendations, except for being defined as a series of numbers with a
110 // maximum length of 40 digits. Other than digits, some other dialing
111 // characters such as ',' (indicating a wait) or '#' may be stored here.
112 //
113 // Note that no regions currently use extensions with short codes, so this
114 // field is normally only set in conjunction with an E.164 number. It is held
115 // separately from the E.164 number to allow for short code extensions in the
116 // future.
117 string extension = 3;
118 }