proto_types/common/google.type.rs
1// This file is @generated by prost-build.
2/// Represents a time of day. The date and time zone are either not significant
3/// or are specified elsewhere. An API may choose to allow leap seconds. Related
4/// types are [google.type.Date][google.type.Date] and
5/// `google.protobuf.Timestamp`.
6#[cfg(feature = "timeofday")]
7#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
8#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
9pub struct TimeOfDay {
10 /// Hours of day in 24 hour format. Should be from 0 to 23. An API may choose
11 /// to allow the value "24:00:00" for scenarios like business closing time.
12 #[prost(int32, tag = "1")]
13 pub hours: i32,
14 /// Minutes of hour of day. Must be from 0 to 59.
15 #[prost(int32, tag = "2")]
16 pub minutes: i32,
17 /// Seconds of minutes of the time. Must normally be from 0 to 59. An API may
18 /// allow the value 60 if it allows leap-seconds.
19 #[prost(int32, tag = "3")]
20 pub seconds: i32,
21 /// Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999.
22 #[prost(int32, tag = "4")]
23 pub nanos: i32,
24}
25/// Localized variant of a text in a particular language.
26#[cfg(feature = "localized_text")]
27#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
28#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
29#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
30pub struct LocalizedText {
31 /// Localized string in the language corresponding to `language_code' below.
32 #[prost(string, tag = "1")]
33 pub text: ::prost::alloc::string::String,
34 /// The text's BCP-47 language code, such as "en-US" or "sr-Latn".
35 ///
36 /// For more information, see
37 /// <http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.>
38 #[prost(string, tag = "2")]
39 pub language_code: ::prost::alloc::string::String,
40}
41/// A quaternion is defined as the quotient of two directed lines in a
42/// three-dimensional space or equivalently as the quotient of two Euclidean
43/// vectors (<https://en.wikipedia.org/wiki/Quaternion>).
44///
45/// Quaternions are often used in calculations involving three-dimensional
46/// rotations (<https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation>),
47/// as they provide greater mathematical robustness by avoiding the gimbal lock
48/// problems that can be encountered when using Euler angles
49/// (<https://en.wikipedia.org/wiki/Gimbal_lock>).
50///
51/// Quaternions are generally represented in this form:
52///
53/// w + xi + yj + zk
54///
55/// where x, y, z, and w are real numbers, and i, j, and k are three imaginary
56/// numbers.
57///
58/// Our naming choice `(x, y, z, w)` comes from the desire to avoid confusion for
59/// those interested in the geometric properties of the quaternion in the 3D
60/// Cartesian space. Other texts often use alternative names or subscripts, such
61/// as `(a, b, c, d)`, `(1, i, j, k)`, or `(0, 1, 2, 3)`, which are perhaps
62/// better suited for mathematical interpretations.
63///
64/// To avoid any confusion, as well as to maintain compatibility with a large
65/// number of software libraries, the quaternions represented using the protocol
66/// buffer below *must* follow the Hamilton convention, which defines `ij = k`
67/// (i.e. a right-handed algebra), and therefore:
68///
69/// i^2 = j^2 = k^2 = ijk = −1
70/// ij = −ji = k
71/// jk = −kj = i
72/// ki = −ik = j
73///
74/// Please DO NOT use this to represent quaternions that follow the JPL
75/// convention, or any of the other quaternion flavors out there.
76///
77/// Definitions:
78///
79/// - Quaternion norm (or magnitude): `sqrt(x^2 + y^2 + z^2 + w^2)`.
80/// - Unit (or normalized) quaternion: a quaternion whose norm is 1.
81/// - Pure quaternion: a quaternion whose scalar component (`w`) is 0.
82/// - Rotation quaternion: a unit quaternion used to represent rotation.
83/// - Orientation quaternion: a unit quaternion used to represent orientation.
84///
85/// A quaternion can be normalized by dividing it by its norm. The resulting
86/// quaternion maintains the same direction, but has a norm of 1, i.e. it moves
87/// on the unit sphere. This is generally necessary for rotation and orientation
88/// quaternions, to avoid rounding errors:
89/// <https://en.wikipedia.org/wiki/Rotation_formalisms_in_three_dimensions>
90///
91/// Note that `(x, y, z, w)` and `(-x, -y, -z, -w)` represent the same rotation,
92/// but normalization would be even more useful, e.g. for comparison purposes, if
93/// it would produce a unique representation. It is thus recommended that `w` be
94/// kept positive, which can be achieved by changing all the signs when `w` is
95/// negative.
96///
97#[cfg(feature = "quaternion")]
98#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
99#[derive(Clone, Copy, PartialEq, ::prost::Message)]
100pub struct Quaternion {
101 /// The x component.
102 #[prost(double, tag = "1")]
103 pub x: f64,
104 /// The y component.
105 #[prost(double, tag = "2")]
106 pub y: f64,
107 /// The z component.
108 #[prost(double, tag = "3")]
109 pub z: f64,
110 /// The scalar component.
111 #[prost(double, tag = "4")]
112 pub w: f64,
113}
114/// A `CalendarPeriod` represents the abstract concept of a time period that has
115/// a canonical start. Grammatically, "the start of the current
116/// `CalendarPeriod`." All calendar times begin at midnight UTC.
117#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
118#[repr(i32)]
119pub enum CalendarPeriod {
120 /// Undefined period, raises an error.
121 Unspecified = 0,
122 /// A day.
123 Day = 1,
124 /// A week. Weeks begin on Monday, following
125 /// [ISO 8601](<https://en.wikipedia.org/wiki/ISO_week_date>).
126 Week = 2,
127 /// A fortnight. The first calendar fortnight of the year begins at the start
128 /// of week 1 according to
129 /// [ISO 8601](<https://en.wikipedia.org/wiki/ISO_week_date>).
130 Fortnight = 3,
131 /// A month.
132 Month = 4,
133 /// A quarter. Quarters start on dates 1-Jan, 1-Apr, 1-Jul, and 1-Oct of each
134 /// year.
135 Quarter = 5,
136 /// A half-year. Half-years start on dates 1-Jan and 1-Jul.
137 Half = 6,
138 /// A year.
139 Year = 7,
140}
141impl CalendarPeriod {
142 /// String value of the enum field names used in the ProtoBuf definition.
143 ///
144 /// The values are not transformed in any way and thus are considered stable
145 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
146 pub fn as_str_name(&self) -> &'static str {
147 match self {
148 Self::Unspecified => "CALENDAR_PERIOD_UNSPECIFIED",
149 Self::Day => "DAY",
150 Self::Week => "WEEK",
151 Self::Fortnight => "FORTNIGHT",
152 Self::Month => "MONTH",
153 Self::Quarter => "QUARTER",
154 Self::Half => "HALF",
155 Self::Year => "YEAR",
156 }
157 }
158 /// Creates an enum from field names used in the ProtoBuf definition.
159 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
160 match value {
161 "CALENDAR_PERIOD_UNSPECIFIED" => Some(Self::Unspecified),
162 "DAY" => Some(Self::Day),
163 "WEEK" => Some(Self::Week),
164 "FORTNIGHT" => Some(Self::Fortnight),
165 "MONTH" => Some(Self::Month),
166 "QUARTER" => Some(Self::Quarter),
167 "HALF" => Some(Self::Half),
168 "YEAR" => Some(Self::Year),
169 _ => None,
170 }
171 }
172}
173
174/// Represents an amount of money with its currency type.
175#[cfg(feature = "money")]
176#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
177#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
178#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
179pub struct Money {
180 /// The three-letter currency code defined in ISO 4217.
181 #[prost(string, tag = "1")]
182 pub currency_code: ::prost::alloc::string::String,
183 /// The whole units of the amount.
184 /// For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar.
185 #[prost(int64, tag = "2")]
186 pub units: i64,
187 /// Number of nano (10^-9) units of the amount.
188 /// The value must be between -999,999,999 and +999,999,999 inclusive.
189 /// If `units` is positive, `nanos` must be positive or zero.
190 /// If `units` is zero, `nanos` can be positive, zero, or negative.
191 /// If `units` is negative, `nanos` must be negative or zero.
192 /// For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.
193 #[prost(int32, tag = "3")]
194 pub nanos: i32,
195}
196/// Represents civil time (or occasionally physical time).
197///
198/// This type can represent a civil time in one of a few possible ways:
199///
200/// * When utc_offset is set and time_zone is unset: a civil time on a calendar
201/// day with a particular offset from UTC.
202/// * When time_zone is set and utc_offset is unset: a civil time on a calendar
203/// day in a particular time zone.
204/// * When neither time_zone nor utc_offset is set: a civil time on a calendar
205/// day in local time.
206///
207/// The date is relative to the Proleptic Gregorian Calendar.
208///
209/// If year is 0, the DateTime is considered not to have a specific year. month
210/// and day must have valid, non-zero values.
211///
212/// This type may also be used to represent a physical time if all the date and
213/// time fields are set and either case of the `time_offset` oneof is set.
214/// Consider using `Timestamp` message for physical time instead. If your use
215/// case also would like to store the user's timezone, that can be done in
216/// another field.
217///
218/// This type is more flexible than some applications may want. Make sure to
219/// document and validate your application's limitations.
220#[cfg(feature = "datetime")]
221#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
222pub struct DateTime {
223 /// Optional. Year of date. Must be from 1 to 9999, or 0 if specifying a
224 /// datetime without a year.
225 #[prost(int32, tag = "1")]
226 pub year: i32,
227 /// Required. Month of year. Must be from 1 to 12.
228 #[prost(int32, tag = "2")]
229 pub month: i32,
230 /// Required. Day of month. Must be from 1 to 31 and valid for the year and
231 /// month.
232 #[prost(int32, tag = "3")]
233 pub day: i32,
234 /// Required. Hours of day in 24 hour format. Should be from 0 to 23. An API
235 /// may choose to allow the value "24:00:00" for scenarios like business
236 /// closing time.
237 #[prost(int32, tag = "4")]
238 pub hours: i32,
239 /// Required. Minutes of hour of day. Must be from 0 to 59.
240 #[prost(int32, tag = "5")]
241 pub minutes: i32,
242 /// Required. Seconds of minutes of the time. Must normally be from 0 to 59. An
243 /// API may allow the value 60 if it allows leap-seconds.
244 #[prost(int32, tag = "6")]
245 pub seconds: i32,
246 /// Required. Fractions of seconds in nanoseconds. Must be from 0 to
247 /// 999,999,999.
248 #[prost(int32, tag = "7")]
249 pub nanos: i32,
250 /// Optional. Specifies either the UTC offset or the time zone of the DateTime.
251 /// Choose carefully between them, considering that time zone data may change
252 /// in the future (for example, a country modifies their DST start/end dates,
253 /// and future DateTimes in the affected range had already been stored).
254 /// If omitted, the DateTime is considered to be in local time.
255 #[prost(oneof = "date_time::TimeOffset", tags = "8, 9")]
256 pub time_offset: ::core::option::Option<date_time::TimeOffset>,
257}
258/// Nested message and enum types in `DateTime`.
259#[cfg(feature = "datetime")]
260pub mod date_time {
261 /// Optional. Specifies either the UTC offset or the time zone of the DateTime.
262 /// Choose carefully between them, considering that time zone data may change
263 /// in the future (for example, a country modifies their DST start/end dates,
264 /// and future DateTimes in the affected range had already been stored).
265 /// If omitted, the DateTime is considered to be in local time.
266 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
267 #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
268 pub enum TimeOffset {
269 /// UTC offset. Must be whole seconds, between -18 hours and +18 hours.
270 /// For example, a UTC offset of -4:00 would be represented as
271 /// { seconds: -14400 }.
272 #[prost(message, tag = "8")]
273 UtcOffset(crate::protobuf::Duration),
274 /// Time zone.
275 #[prost(message, tag = "9")]
276 TimeZone(super::TimeZone),
277 }
278}
279
280/// Represents a time zone from the
281/// [IANA Time Zone Database](<https://www.iana.org/time-zones>).
282#[cfg(feature = "datetime")]
283#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
284#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
285pub struct TimeZone {
286 /// IANA Time Zone Database time zone, e.g. "America/New_York".
287 #[prost(string, tag = "1")]
288 pub id: ::prost::alloc::string::String,
289 /// Optional. IANA Time Zone Database version number, e.g. "2019a".
290 #[prost(string, tag = "2")]
291 pub version: ::prost::alloc::string::String,
292}
293/// An object that represents a latitude/longitude pair. This is expressed as a
294/// pair of doubles to represent degrees latitude and degrees longitude. Unless
295/// specified otherwise, this must conform to the
296/// <a href="<http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84>
297/// standard</a>. Values must be within normalized ranges.
298#[cfg(feature = "latlng")]
299#[derive(Clone, Copy, PartialEq, ::prost::Message)]
300#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
301pub struct LatLng {
302 /// The latitude in degrees. It must be in the range \[-90.0, +90.0\].
303 #[prost(double, tag = "1")]
304 pub latitude: f64,
305 /// The longitude in degrees. It must be in the range \[-180.0, +180.0\].
306 #[prost(double, tag = "2")]
307 pub longitude: f64,
308}
309/// Represents a postal address, e.g. for postal delivery or payments addresses.
310/// Given a postal address, a postal service can deliver items to a premise, P.O.
311/// Box or similar.
312/// It is not intended to model geographical locations (roads, towns,
313/// mountains).
314///
315/// In typical usage an address would be created via user input or from importing
316/// existing data, depending on the type of process.
317///
318/// Advice on address input / editing:
319/// - Use an i18n-ready address widget such as
320/// <https://github.com/google/libaddressinput>)
321/// - Users should not be presented with UI elements for input or editing of
322/// fields outside countries where that field is used.
323///
324/// For more guidance on how to use this schema, please see:
325/// <https://support.google.com/business/answer/6397478>
326#[cfg(feature = "postal_address")]
327#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
328#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
329#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
330pub struct PostalAddress {
331 /// The schema revision of the `PostalAddress`. This must be set to 0, which is
332 /// the latest revision.
333 ///
334 /// All new revisions **must** be backward compatible with old revisions.
335 #[prost(int32, tag = "1")]
336 pub revision: i32,
337 /// Required. CLDR region code of the country/region of the address. This
338 /// is never inferred and it is up to the user to ensure the value is
339 /// correct. See <http://cldr.unicode.org/> and
340 /// <http://www.unicode.org/cldr/charts/30/supplemental/territory_information.html>
341 /// for details. Example: "CH" for Switzerland.
342 #[prost(string, tag = "2")]
343 pub region_code: ::prost::alloc::string::String,
344 /// Optional. BCP-47 language code of the contents of this address (if
345 /// known). This is often the UI language of the input form or is expected
346 /// to match one of the languages used in the address' country/region, or their
347 /// transliterated equivalents.
348 /// This can affect formatting in certain countries, but is not critical
349 /// to the correctness of the data and will never affect any validation or
350 /// other non-formatting related operations.
351 ///
352 /// If this value is not known, it should be omitted (rather than specifying a
353 /// possibly incorrect default).
354 ///
355 /// Examples: "zh-Hant", "ja", "ja-Latn", "en".
356 #[prost(string, tag = "3")]
357 pub language_code: ::prost::alloc::string::String,
358 /// Optional. Postal code of the address. Not all countries use or require
359 /// postal codes to be present, but where they are used, they may trigger
360 /// additional validation with other parts of the address (e.g. state/zip
361 /// validation in the U.S.A.).
362 #[prost(string, tag = "4")]
363 pub postal_code: ::prost::alloc::string::String,
364 /// Optional. Additional, country-specific, sorting code. This is not used
365 /// in most regions. Where it is used, the value is either a string like
366 /// "CEDEX", optionally followed by a number (e.g. "CEDEX 7"), or just a number
367 /// alone, representing the "sector code" (Jamaica), "delivery area indicator"
368 /// (Malawi) or "post office indicator" (e.g. Côte d'Ivoire).
369 #[prost(string, tag = "5")]
370 pub sorting_code: ::prost::alloc::string::String,
371 /// Optional. Highest administrative subdivision which is used for postal
372 /// addresses of a country or region.
373 /// For example, this can be a state, a province, an oblast, or a prefecture.
374 /// Specifically, for Spain this is the province and not the autonomous
375 /// community (e.g. "Barcelona" and not "Catalonia").
376 /// Many countries don't use an administrative area in postal addresses. E.g.
377 /// in Switzerland this should be left unpopulated.
378 #[prost(string, tag = "6")]
379 pub administrative_area: ::prost::alloc::string::String,
380 /// Optional. Generally refers to the city/town portion of the address.
381 /// Examples: US city, IT comune, UK post town.
382 /// In regions of the world where localities are not well defined or do not fit
383 /// into this structure well, leave locality empty and use address_lines.
384 #[prost(string, tag = "7")]
385 pub locality: ::prost::alloc::string::String,
386 /// Optional. Sublocality of the address.
387 /// For example, this can be neighborhoods, boroughs, districts.
388 #[prost(string, tag = "8")]
389 pub sublocality: ::prost::alloc::string::String,
390 /// Unstructured address lines describing the lower levels of an address.
391 ///
392 /// Because values in address_lines do not have type information and may
393 /// sometimes contain multiple values in a single field (e.g.
394 /// "Austin, TX"), it is important that the line order is clear. The order of
395 /// address lines should be "envelope order" for the country/region of the
396 /// address. In places where this can vary (e.g. Japan), address_language is
397 /// used to make it explicit (e.g. "ja" for large-to-small ordering and
398 /// "ja-Latn" or "en" for small-to-large). This way, the most specific line of
399 /// an address can be selected based on the language.
400 ///
401 /// The minimum permitted structural representation of an address consists
402 /// of a region_code with all remaining information placed in the
403 /// address_lines. It would be possible to format such an address very
404 /// approximately without geocoding, but no semantic reasoning could be
405 /// made about any of the address components until it was at least
406 /// partially resolved.
407 ///
408 /// Creating an address only containing a region_code and address_lines, and
409 /// then geocoding is the recommended way to handle completely unstructured
410 /// addresses (as opposed to guessing which parts of the address should be
411 /// localities or administrative areas).
412 #[prost(string, repeated, tag = "9")]
413 pub address_lines: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
414 /// Optional. The recipient at the address.
415 /// This field may, under certain circumstances, contain multiline information.
416 /// For example, it might contain "care of" information.
417 #[prost(string, repeated, tag = "10")]
418 pub recipients: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
419 /// Optional. The name of the organization at the address.
420 #[prost(string, tag = "11")]
421 pub organization: ::prost::alloc::string::String,
422}
423/// Represents a whole or partial calendar date, such as a birthday. The time of
424/// day and time zone are either specified elsewhere or are insignificant. The
425/// date is relative to the Gregorian Calendar. This can represent one of the
426/// following:
427///
428/// * A full date, with non-zero year, month, and day values
429/// * A month and day value, with a zero year, such as an anniversary
430/// * A year on its own, with zero month and day values
431/// * A year and month value, with a zero day, such as a credit card expiration
432/// date
433///
434/// Related types are [google.type.TimeOfDay][google.type.TimeOfDay] and
435/// `google.protobuf.Timestamp`.
436#[cfg(feature = "date")]
437#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
438pub struct Date {
439 /// Year of the date. Must be from 1 to 9999, or 0 to specify a date without
440 /// a year.
441 #[prost(int32, tag = "1")]
442 pub year: i32,
443 /// Month of a year. Must be from 1 to 12, or 0 to specify a year without a
444 /// month and day.
445 #[prost(int32, tag = "2")]
446 pub month: i32,
447 /// Day of a month. Must be from 1 to 31 and valid for the year and month, or 0
448 /// to specify a year by itself or a year and month where the day isn't
449 /// significant.
450 #[prost(int32, tag = "3")]
451 pub day: i32,
452}
453/// Represents a time interval, encoded as a Timestamp start (inclusive) and a
454/// Timestamp end (exclusive).
455///
456/// The start must be less than or equal to the end.
457/// When the start equals the end, the interval is empty (matches no time).
458/// When both start and end are unspecified, the interval matches any time.
459#[cfg(feature = "interval")]
460#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
461#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
462#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
463pub struct Interval {
464 /// Optional. Inclusive start of the interval.
465 ///
466 /// If specified, a Timestamp matching this interval will have to be the same
467 /// or after the start.
468 #[prost(message, optional, tag = "1")]
469 pub start_time: ::core::option::Option<crate::protobuf::Timestamp>,
470 /// Optional. Exclusive end of the interval.
471 ///
472 /// If specified, a Timestamp matching this interval will have to be before the
473 /// end.
474 #[prost(message, optional, tag = "2")]
475 pub end_time: ::core::option::Option<crate::protobuf::Timestamp>,
476}
477/// Represents a textual expression in the Common Expression Language (CEL)
478/// syntax. CEL is a C-like expression language. The syntax and semantics of CEL
479/// are documented at <https://github.com/google/cel-spec.>
480///
481/// Example (Comparison):
482///
483/// title: "Summary size limit"
484/// description: "Determines if a summary is less than 100 chars"
485/// expression: "document.summary.size() < 100"
486///
487/// Example (Equality):
488///
489/// title: "Requestor is owner"
490/// description: "Determines if requestor is the document owner"
491/// expression: "document.owner == request.auth.claims.email"
492///
493/// Example (Logic):
494///
495/// title: "Public documents"
496/// description: "Determine whether the document should be publicly visible"
497/// expression: "document.type != 'private' && document.type != 'internal'"
498///
499/// Example (Data Manipulation):
500///
501/// title: "Notification string"
502/// description: "Create a notification string with a timestamp."
503/// expression: "'New message received at ' + string(document.create_time)"
504///
505/// The exact variables and functions that may be referenced within an expression
506/// are determined by the service that evaluates it. See the service
507/// documentation for additional information.
508#[cfg(feature = "expr")]
509#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
510#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
511pub struct Expr {
512 /// Textual representation of an expression in Common Expression Language
513 /// syntax.
514 #[prost(string, tag = "1")]
515 pub expression: ::prost::alloc::string::String,
516 /// Optional. Title for the expression, i.e. a short string describing
517 /// its purpose. This can be used e.g. in UIs which allow to enter the
518 /// expression.
519 #[prost(string, tag = "2")]
520 pub title: ::prost::alloc::string::String,
521 /// Optional. Description of the expression. This is a longer text which
522 /// describes the expression, e.g. when hovered over it in a UI.
523 #[prost(string, tag = "3")]
524 pub description: ::prost::alloc::string::String,
525 /// Optional. String indicating the location of the expression for error
526 /// reporting, e.g. a file name and a position in the file.
527 #[prost(string, tag = "4")]
528 pub location: ::prost::alloc::string::String,
529}
530/// Represents a color in the RGBA color space. This representation is designed
531/// for simplicity of conversion to/from color representations in various
532/// languages over compactness. For example, the fields of this representation
533/// can be trivially provided to the constructor of `java.awt.Color` in Java; it
534/// can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha`
535/// method in iOS; and, with just a little work, it can be easily formatted into
536/// a CSS `rgba()` string in JavaScript.
537///
538/// This reference page doesn't carry information about the absolute color
539/// space
540/// that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB,
541/// DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color
542/// space.
543///
544/// When color equality needs to be decided, implementations, unless
545/// documented otherwise, treat two colors as equal if all their red,
546/// green, blue, and alpha values each differ by at most 1e-5.
547///
548/// Example (Java):
549///
550/// import com.google.type.Color;
551///
552/// // ...
553/// public static java.awt.Color fromProto(Color protocolor) {
554/// float alpha = protocolor.hasAlpha()
555/// ? protocolor.getAlpha().getValue()
556/// : 1.0;
557///
558/// return new java.awt.Color(
559/// protocolor.getRed(),
560/// protocolor.getGreen(),
561/// protocolor.getBlue(),
562/// alpha);
563/// }
564///
565/// public static Color toProto(java.awt.Color color) {
566/// float red = (float) color.getRed();
567/// float green = (float) color.getGreen();
568/// float blue = (float) color.getBlue();
569/// float denominator = 255.0;
570/// Color.Builder resultBuilder =
571/// Color
572/// .newBuilder()
573/// .setRed(red / denominator)
574/// .setGreen(green / denominator)
575/// .setBlue(blue / denominator);
576/// int alpha = color.getAlpha();
577/// if (alpha != 255) {
578/// result.setAlpha(
579/// FloatValue
580/// .newBuilder()
581/// .setValue(((float) alpha) / denominator)
582/// .build());
583/// }
584/// return resultBuilder.build();
585/// }
586/// // ...
587///
588/// Example (iOS / Obj-C):
589///
590/// // ...
591/// static UIColor* fromProto(Color* protocolor) {
592/// float red = \[protocolor red\];
593/// float green = \[protocolor green\];
594/// float blue = \[protocolor blue\];
595/// FloatValue* alpha_wrapper = \[protocolor alpha\];
596/// float alpha = 1.0;
597/// if (alpha_wrapper != nil) {
598/// alpha = \[alpha_wrapper value\];
599/// }
600/// return \[UIColor colorWithRed:red green:green blue:blue alpha:alpha\];
601/// }
602///
603/// static Color* toProto(UIColor* color) {
604/// CGFloat red, green, blue, alpha;
605/// if (!\[color getRed:&red green:&green blue:&blue alpha:&alpha\]) {
606/// return nil;
607/// }
608/// Color* result = \[[Color alloc\] init];
609/// \[result setRed:red\];
610/// \[result setGreen:green\];
611/// \[result setBlue:blue\];
612/// if (alpha <= 0.9999) {
613/// \[result setAlpha:floatWrapperWithValue(alpha)\];
614/// }
615/// \[result autorelease\];
616/// return result;
617/// }
618/// // ...
619///
620/// Example (JavaScript):
621///
622/// // ...
623///
624/// var protoToCssColor = function(rgb_color) {
625/// var redFrac = rgb_color.red || 0.0;
626/// var greenFrac = rgb_color.green || 0.0;
627/// var blueFrac = rgb_color.blue || 0.0;
628/// var red = Math.floor(redFrac * 255);
629/// var green = Math.floor(greenFrac * 255);
630/// var blue = Math.floor(blueFrac * 255);
631///
632/// if (!('alpha' in rgb_color)) {
633/// return rgbToCssColor(red, green, blue);
634/// }
635///
636/// var alphaFrac = rgb_color.alpha.value || 0.0;
637/// var rgbParams = \[red, green, blue\].join(',');
638/// return \['rgba(', rgbParams, ',', alphaFrac, ')'\].join('');
639/// };
640///
641/// var rgbToCssColor = function(red, green, blue) {
642/// var rgbNumber = new Number((red << 16) | (green << 8) | blue);
643/// var hexString = rgbNumber.toString(16);
644/// var missingZeros = 6 - hexString.length;
645/// var resultBuilder = \['#'\];
646/// for (var i = 0; i < missingZeros; i++) {
647/// resultBuilder.push('0');
648/// }
649/// resultBuilder.push(hexString);
650/// return resultBuilder.join('');
651/// };
652///
653/// // ...
654#[cfg(feature = "color")]
655#[derive(Clone, Copy, PartialEq, ::prost::Message)]
656#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
657pub struct Color {
658 /// The amount of red in the color as a value in the interval \[0, 1\].
659 #[prost(float, tag = "1")]
660 pub red: f32,
661 /// The amount of green in the color as a value in the interval \[0, 1\].
662 #[prost(float, tag = "2")]
663 pub green: f32,
664 /// The amount of blue in the color as a value in the interval \[0, 1\].
665 #[prost(float, tag = "3")]
666 pub blue: f32,
667 /// The fraction of this color that should be applied to the pixel. That is,
668 /// the final pixel color is defined by the equation:
669 ///
670 /// `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)`
671 ///
672 /// This means that a value of 1.0 corresponds to a solid color, whereas
673 /// a value of 0.0 corresponds to a completely transparent color. This
674 /// uses a wrapper message rather than a simple float scalar so that it is
675 /// possible to distinguish between a default value and the value being unset.
676 /// If omitted, this color object is rendered as a solid color
677 /// (as if the alpha value had been explicitly given a value of 1.0).
678 #[prost(message, optional, tag = "4")]
679 pub alpha: ::core::option::Option<crate::protobuf::FloatValue>,
680}
681
682/// Represents a fraction in terms of a numerator divided by a denominator.
683#[cfg(feature = "fraction")]
684#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
685#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
686pub struct Fraction {
687 /// The numerator in the fraction, e.g. 2 in 2/3.
688 #[prost(int64, tag = "1")]
689 pub numerator: i64,
690 /// The value by which the numerator is divided, e.g. 3 in 2/3. Must be
691 /// positive.
692 #[prost(int64, tag = "2")]
693 pub denominator: i64,
694}
695/// A representation of a decimal value, such as 2.5. Clients may convert values
696/// into language-native decimal formats, such as Java's [BigDecimal][] or
697/// Python's [decimal.Decimal][].
698///
699/// \[BigDecimal\]:
700/// <https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html>
701/// \[decimal.Decimal\]: <https://docs.python.org/3/library/decimal.html>
702#[cfg(feature = "decimal")]
703#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
704#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
705pub struct Decimal {
706 /// The decimal value, as a string.
707 ///
708 /// The string representation consists of an optional sign, `+` (`U+002B`)
709 /// or `-` (`U+002D`), followed by a sequence of zero or more decimal digits
710 /// ("the integer"), optionally followed by a fraction, optionally followed
711 /// by an exponent.
712 ///
713 /// The fraction consists of a decimal point followed by zero or more decimal
714 /// digits. The string must contain at least one digit in either the integer
715 /// or the fraction. The number formed by the sign, the integer and the
716 /// fraction is referred to as the significand.
717 ///
718 /// The exponent consists of the character `e` (`U+0065`) or `E` (`U+0045`)
719 /// followed by one or more decimal digits.
720 ///
721 /// Services **should** normalize decimal values before storing them by:
722 ///
723 /// - Removing an explicitly-provided `+` sign (`+2.5` -> `2.5`).
724 /// - Replacing a zero-length integer value with `0` (`.5` -> `0.5`).
725 /// - Coercing the exponent character to lower-case (`2.5E8` -> `2.5e8`).
726 /// - Removing an explicitly-provided zero exponent (`2.5e0` -> `2.5`).
727 ///
728 /// Services **may** perform additional normalization based on its own needs
729 /// and the internal decimal implementation selected, such as shifting the
730 /// decimal point and exponent value together (example: `2.5e-1` <-> `0.25`).
731 /// Additionally, services **may** preserve trailing zeroes in the fraction
732 /// to indicate increased precision, but are not required to do so.
733 ///
734 /// Note that only the `.` character is supported to divide the integer
735 /// and the fraction; `,` **should not** be supported regardless of locale.
736 /// Additionally, thousand separators **should not** be supported. If a
737 /// service does support them, values **must** be normalized.
738 ///
739 /// The ENBF grammar is:
740 ///
741 /// DecimalString =
742 /// \[Sign\] Significand \[Exponent\];
743 ///
744 /// Sign = '+' | '-';
745 ///
746 /// Significand =
747 /// Digits \['.'\] [Digits] | \[Digits\] '.' Digits;
748 ///
749 /// Exponent = ('e' | 'E') \[Sign\] Digits;
750 ///
751 /// Digits = { '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' };
752 ///
753 /// Services **should** clearly document the range of supported values, the
754 /// maximum supported precision (total number of digits), and, if applicable,
755 /// the scale (number of digits after the decimal point), as well as how it
756 /// behaves when receiving out-of-bounds values.
757 ///
758 /// Services **may** choose to accept values passed as input even when the
759 /// value has a higher precision or scale than the service supports, and
760 /// **should** round the value to fit the supported scale. Alternatively, the
761 /// service **may** error with `400 Bad Request` (`INVALID_ARGUMENT` in gRPC)
762 /// if precision would be lost.
763 ///
764 /// Services **should** error with `400 Bad Request` (`INVALID_ARGUMENT` in
765 /// gRPC) if the service receives a value outside of the supported range.
766 #[prost(string, tag = "1")]
767 pub value: ::prost::alloc::string::String,
768}
769/// Represents a day of the week.
770#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
771#[repr(i32)]
772pub enum DayOfWeek {
773 /// The day of the week is unspecified.
774 Unspecified = 0,
775 /// Monday
776 Monday = 1,
777 /// Tuesday
778 Tuesday = 2,
779 /// Wednesday
780 Wednesday = 3,
781 /// Thursday
782 Thursday = 4,
783 /// Friday
784 Friday = 5,
785 /// Saturday
786 Saturday = 6,
787 /// Sunday
788 Sunday = 7,
789}
790impl DayOfWeek {
791 /// String value of the enum field names used in the ProtoBuf definition.
792 ///
793 /// The values are not transformed in any way and thus are considered stable
794 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
795 pub fn as_str_name(&self) -> &'static str {
796 match self {
797 Self::Unspecified => "DAY_OF_WEEK_UNSPECIFIED",
798 Self::Monday => "MONDAY",
799 Self::Tuesday => "TUESDAY",
800 Self::Wednesday => "WEDNESDAY",
801 Self::Thursday => "THURSDAY",
802 Self::Friday => "FRIDAY",
803 Self::Saturday => "SATURDAY",
804 Self::Sunday => "SUNDAY",
805 }
806 }
807 /// Creates an enum from field names used in the ProtoBuf definition.
808 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
809 match value {
810 "DAY_OF_WEEK_UNSPECIFIED" => Some(Self::Unspecified),
811 "MONDAY" => Some(Self::Monday),
812 "TUESDAY" => Some(Self::Tuesday),
813 "WEDNESDAY" => Some(Self::Wednesday),
814 "THURSDAY" => Some(Self::Thursday),
815 "FRIDAY" => Some(Self::Friday),
816 "SATURDAY" => Some(Self::Saturday),
817 "SUNDAY" => Some(Self::Sunday),
818 _ => None,
819 }
820 }
821}
822/// An object representing a phone number, suitable as an API wire format.
823///
824/// This representation:
825///
826/// - should not be used for locale-specific formatting of a phone number, such
827/// as "+1 (650) 253-0000 ext. 123"
828///
829/// - is not designed for efficient storage
830/// - may not be suitable for dialing - specialized libraries (see references)
831/// should be used to parse the number for that purpose
832///
833/// To do something meaningful with this number, such as format it for various
834/// use-cases, convert it to an `i18n.phonenumbers.PhoneNumber` object first.
835///
836/// For instance, in Java this would be:
837///
838/// com.google.type.PhoneNumber wireProto =
839/// com.google.type.PhoneNumber.newBuilder().build();
840/// com.google.i18n.phonenumbers.Phonenumber.PhoneNumber phoneNumber =
841/// PhoneNumberUtil.getInstance().parse(wireProto.getE164Number(), "ZZ");
842/// if (!wireProto.getExtension().isEmpty()) {
843/// phoneNumber.setExtension(wireProto.getExtension());
844/// }
845///
846/// Reference(s):
847/// - <https://github.com/google/libphonenumber>
848#[cfg(feature = "phone_number")]
849#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
850#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
851pub struct PhoneNumber {
852 /// The phone number's extension. The extension is not standardized in ITU
853 /// recommendations, except for being defined as a series of numbers with a
854 /// maximum length of 40 digits. Other than digits, some other dialing
855 /// characters such as ',' (indicating a wait) or '#' may be stored here.
856 ///
857 /// Note that no regions currently use extensions with short codes, so this
858 /// field is normally only set in conjunction with an E.164 number. It is held
859 /// separately from the E.164 number to allow for short code extensions in the
860 /// future.
861 #[prost(string, tag = "3")]
862 pub extension: ::prost::alloc::string::String,
863 /// Required. Either a regular number, or a short code. New fields may be
864 /// added to the oneof below in the future, so clients should ignore phone
865 /// numbers for which none of the fields they coded against are set.
866 #[prost(oneof = "phone_number::Kind", tags = "1, 2")]
867 pub kind: ::core::option::Option<phone_number::Kind>,
868}
869/// Nested message and enum types in `PhoneNumber`.
870#[cfg(feature = "phone_number")]
871pub mod phone_number {
872 /// An object representing a short code, which is a phone number that is
873 /// typically much shorter than regular phone numbers and can be used to
874 /// address messages in MMS and SMS systems, as well as for abbreviated dialing
875 /// (e.g. "Text 611 to see how many minutes you have remaining on your plan.").
876 ///
877 /// Short codes are restricted to a region and are not internationally
878 /// dialable, which means the same short code can exist in different regions,
879 /// with different usage and pricing, even if those regions share the same
880 /// country calling code (e.g. US and CA).
881 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
882 #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
883 #[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
884 pub struct ShortCode {
885 /// Required. The BCP-47 region code of the location where calls to this
886 /// short code can be made, such as "US" and "BB".
887 ///
888 /// Reference(s):
889 /// - <http://www.unicode.org/reports/tr35/#unicode_region_subtag>
890 #[prost(string, tag = "1")]
891 pub region_code: ::prost::alloc::string::String,
892 /// Required. The short code digits, without a leading plus ('+') or country
893 /// calling code, e.g. "611".
894 #[prost(string, tag = "2")]
895 pub number: ::prost::alloc::string::String,
896 }
897 /// Required. Either a regular number, or a short code. New fields may be
898 /// added to the oneof below in the future, so clients should ignore phone
899 /// numbers for which none of the fields they coded against are set.
900 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
901 #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
902 #[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
903 pub enum Kind {
904 /// The phone number, represented as a leading plus sign ('+'), followed by a
905 /// phone number that uses a relaxed ITU E.164 format consisting of the
906 /// country calling code (1 to 3 digits) and the subscriber number, with no
907 /// additional spaces or formatting, e.g.:
908 /// - correct: "+15552220123"
909 /// - incorrect: "+1 (555) 222-01234 x123".
910 ///
911 /// The ITU E.164 format limits the latter to 12 digits, but in practice not
912 /// all countries respect that, so we relax that restriction here.
913 /// National-only numbers are not allowed.
914 ///
915 /// References:
916 /// - <https://www.itu.int/rec/T-REC-E.164-201011-I>
917 /// - <https://en.wikipedia.org/wiki/E.164.>
918 /// - <https://en.wikipedia.org/wiki/List_of_country_calling_codes>
919 #[prost(string, tag = "1")]
920 E164Number(::prost::alloc::string::String),
921 /// A short code.
922 ///
923 /// Reference(s):
924 /// - <https://en.wikipedia.org/wiki/Short_code>
925 #[prost(message, tag = "2")]
926 ShortCode(ShortCode),
927 }
928}
929/// Represents a month in the Gregorian calendar.
930#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
931#[repr(i32)]
932pub enum Month {
933 /// The unspecified month.
934 Unspecified = 0,
935 /// The month of January.
936 January = 1,
937 /// The month of February.
938 February = 2,
939 /// The month of March.
940 March = 3,
941 /// The month of April.
942 April = 4,
943 /// The month of May.
944 May = 5,
945 /// The month of June.
946 June = 6,
947 /// The month of July.
948 July = 7,
949 /// The month of August.
950 August = 8,
951 /// The month of September.
952 September = 9,
953 /// The month of October.
954 October = 10,
955 /// The month of November.
956 November = 11,
957 /// The month of December.
958 December = 12,
959}
960impl Month {
961 /// String value of the enum field names used in the ProtoBuf definition.
962 ///
963 /// The values are not transformed in any way and thus are considered stable
964 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
965 pub fn as_str_name(&self) -> &'static str {
966 match self {
967 Self::Unspecified => "MONTH_UNSPECIFIED",
968 Self::January => "JANUARY",
969 Self::February => "FEBRUARY",
970 Self::March => "MARCH",
971 Self::April => "APRIL",
972 Self::May => "MAY",
973 Self::June => "JUNE",
974 Self::July => "JULY",
975 Self::August => "AUGUST",
976 Self::September => "SEPTEMBER",
977 Self::October => "OCTOBER",
978 Self::November => "NOVEMBER",
979 Self::December => "DECEMBER",
980 }
981 }
982 /// Creates an enum from field names used in the ProtoBuf definition.
983 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
984 match value {
985 "MONTH_UNSPECIFIED" => Some(Self::Unspecified),
986 "JANUARY" => Some(Self::January),
987 "FEBRUARY" => Some(Self::February),
988 "MARCH" => Some(Self::March),
989 "APRIL" => Some(Self::April),
990 "MAY" => Some(Self::May),
991 "JUNE" => Some(Self::June),
992 "JULY" => Some(Self::July),
993 "AUGUST" => Some(Self::August),
994 "SEPTEMBER" => Some(Self::September),
995 "OCTOBER" => Some(Self::October),
996 "NOVEMBER" => Some(Self::November),
997 "DECEMBER" => Some(Self::December),
998 _ => None,
999 }
1000 }
1001}