Skip to content

Commit 8a88eab

Browse files
committed
bump
1 parent 40af564 commit 8a88eab

34 files changed

+1409
-54
lines changed

go/protopace/compatibility.go

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ func Check(schema schema.Schema, previousSchema schema.Schema) error {
3131
"FIELD_SAME_NAME",
3232
"FIELD_SAME_JSON_NAME",
3333
"FILE_NO_DELETE",
34+
"ENUM_NO_DELETE",
3435
},
3536
nil,
3637
nil,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## Google Common Types
2+
3+
This package contains definitions of common types for Google APIs.
4+
All types defined in this package are suitable for different APIs to
5+
exchange data, and will never break binary compatibility. They should
6+
have design quality comparable to major programming languages like
7+
Java and C#.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// Copyright 2024 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/calendarperiod;calendarperiod";
20+
option java_multiple_files = true;
21+
option java_outer_classname = "CalendarPeriodProto";
22+
option java_package = "com.google.type";
23+
option objc_class_prefix = "GTP";
24+
25+
// A `CalendarPeriod` represents the abstract concept of a time period that has
26+
// a canonical start. Grammatically, "the start of the current
27+
// `CalendarPeriod`." All calendar times begin at midnight UTC.
28+
enum CalendarPeriod {
29+
// Undefined period, raises an error.
30+
CALENDAR_PERIOD_UNSPECIFIED = 0;
31+
32+
// A day.
33+
DAY = 1;
34+
35+
// A week. Weeks begin on Monday, following
36+
// [ISO 8601](https://en.wikipedia.org/wiki/ISO_week_date).
37+
WEEK = 2;
38+
39+
// A fortnight. The first calendar fortnight of the year begins at the start
40+
// of week 1 according to
41+
// [ISO 8601](https://en.wikipedia.org/wiki/ISO_week_date).
42+
FORTNIGHT = 3;
43+
44+
// A month.
45+
MONTH = 4;
46+
47+
// A quarter. Quarters start on dates 1-Jan, 1-Apr, 1-Jul, and 1-Oct of each
48+
// year.
49+
QUARTER = 5;
50+
51+
// A half-year. Half-years start on dates 1-Jan and 1-Jul.
52+
HALF = 6;
53+
54+
// A year.
55+
YEAR = 7;
56+
}
+174
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
// Copyright 2024 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+
import "google/protobuf/wrappers.proto";
20+
21+
option cc_enable_arenas = true;
22+
option go_package = "google.golang.org/genproto/googleapis/type/color;color";
23+
option java_multiple_files = true;
24+
option java_outer_classname = "ColorProto";
25+
option java_package = "com.google.type";
26+
option objc_class_prefix = "GTP";
27+
28+
// Represents a color in the RGBA color space. This representation is designed
29+
// for simplicity of conversion to/from color representations in various
30+
// languages over compactness. For example, the fields of this representation
31+
// can be trivially provided to the constructor of `java.awt.Color` in Java; it
32+
// can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha`
33+
// method in iOS; and, with just a little work, it can be easily formatted into
34+
// a CSS `rgba()` string in JavaScript.
35+
//
36+
// This reference page doesn't carry information about the absolute color
37+
// space
38+
// that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB,
39+
// DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color
40+
// space.
41+
//
42+
// When color equality needs to be decided, implementations, unless
43+
// documented otherwise, treat two colors as equal if all their red,
44+
// green, blue, and alpha values each differ by at most 1e-5.
45+
//
46+
// Example (Java):
47+
//
48+
// import com.google.type.Color;
49+
//
50+
// // ...
51+
// public static java.awt.Color fromProto(Color protocolor) {
52+
// float alpha = protocolor.hasAlpha()
53+
// ? protocolor.getAlpha().getValue()
54+
// : 1.0;
55+
//
56+
// return new java.awt.Color(
57+
// protocolor.getRed(),
58+
// protocolor.getGreen(),
59+
// protocolor.getBlue(),
60+
// alpha);
61+
// }
62+
//
63+
// public static Color toProto(java.awt.Color color) {
64+
// float red = (float) color.getRed();
65+
// float green = (float) color.getGreen();
66+
// float blue = (float) color.getBlue();
67+
// float denominator = 255.0;
68+
// Color.Builder resultBuilder =
69+
// Color
70+
// .newBuilder()
71+
// .setRed(red / denominator)
72+
// .setGreen(green / denominator)
73+
// .setBlue(blue / denominator);
74+
// int alpha = color.getAlpha();
75+
// if (alpha != 255) {
76+
// result.setAlpha(
77+
// FloatValue
78+
// .newBuilder()
79+
// .setValue(((float) alpha) / denominator)
80+
// .build());
81+
// }
82+
// return resultBuilder.build();
83+
// }
84+
// // ...
85+
//
86+
// Example (iOS / Obj-C):
87+
//
88+
// // ...
89+
// static UIColor* fromProto(Color* protocolor) {
90+
// float red = [protocolor red];
91+
// float green = [protocolor green];
92+
// float blue = [protocolor blue];
93+
// FloatValue* alpha_wrapper = [protocolor alpha];
94+
// float alpha = 1.0;
95+
// if (alpha_wrapper != nil) {
96+
// alpha = [alpha_wrapper value];
97+
// }
98+
// return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
99+
// }
100+
//
101+
// static Color* toProto(UIColor* color) {
102+
// CGFloat red, green, blue, alpha;
103+
// if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) {
104+
// return nil;
105+
// }
106+
// Color* result = [[Color alloc] init];
107+
// [result setRed:red];
108+
// [result setGreen:green];
109+
// [result setBlue:blue];
110+
// if (alpha <= 0.9999) {
111+
// [result setAlpha:floatWrapperWithValue(alpha)];
112+
// }
113+
// [result autorelease];
114+
// return result;
115+
// }
116+
// // ...
117+
//
118+
// Example (JavaScript):
119+
//
120+
// // ...
121+
//
122+
// var protoToCssColor = function(rgb_color) {
123+
// var redFrac = rgb_color.red || 0.0;
124+
// var greenFrac = rgb_color.green || 0.0;
125+
// var blueFrac = rgb_color.blue || 0.0;
126+
// var red = Math.floor(redFrac * 255);
127+
// var green = Math.floor(greenFrac * 255);
128+
// var blue = Math.floor(blueFrac * 255);
129+
//
130+
// if (!('alpha' in rgb_color)) {
131+
// return rgbToCssColor(red, green, blue);
132+
// }
133+
//
134+
// var alphaFrac = rgb_color.alpha.value || 0.0;
135+
// var rgbParams = [red, green, blue].join(',');
136+
// return ['rgba(', rgbParams, ',', alphaFrac, ')'].join('');
137+
// };
138+
//
139+
// var rgbToCssColor = function(red, green, blue) {
140+
// var rgbNumber = new Number((red << 16) | (green << 8) | blue);
141+
// var hexString = rgbNumber.toString(16);
142+
// var missingZeros = 6 - hexString.length;
143+
// var resultBuilder = ['#'];
144+
// for (var i = 0; i < missingZeros; i++) {
145+
// resultBuilder.push('0');
146+
// }
147+
// resultBuilder.push(hexString);
148+
// return resultBuilder.join('');
149+
// };
150+
//
151+
// // ...
152+
message Color {
153+
// The amount of red in the color as a value in the interval [0, 1].
154+
float red = 1;
155+
156+
// The amount of green in the color as a value in the interval [0, 1].
157+
float green = 2;
158+
159+
// The amount of blue in the color as a value in the interval [0, 1].
160+
float blue = 3;
161+
162+
// The fraction of this color that should be applied to the pixel. That is,
163+
// the final pixel color is defined by the equation:
164+
//
165+
// `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)`
166+
//
167+
// This means that a value of 1.0 corresponds to a solid color, whereas
168+
// a value of 0.0 corresponds to a completely transparent color. This
169+
// uses a wrapper message rather than a simple float scalar so that it is
170+
// possible to distinguish between a default value and the value being unset.
171+
// If omitted, this color object is rendered as a solid color
172+
// (as if the alpha value had been explicitly given a value of 1.0).
173+
google.protobuf.FloatValue alpha = 4;
174+
}
+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Copyright 2024 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 cc_enable_arenas = true;
20+
option go_package = "google.golang.org/genproto/googleapis/type/date;date";
21+
option java_multiple_files = true;
22+
option java_outer_classname = "DateProto";
23+
option java_package = "com.google.type";
24+
option objc_class_prefix = "GTP";
25+
26+
// Represents a whole or partial calendar date, such as a birthday. The time of
27+
// day and time zone are either specified elsewhere or are insignificant. The
28+
// date is relative to the Gregorian Calendar. This can represent one of the
29+
// following:
30+
//
31+
// * A full date, with non-zero year, month, and day values
32+
// * A month and day value, with a zero year, such as an anniversary
33+
// * A year on its own, with zero month and day values
34+
// * A year and month value, with a zero day, such as a credit card expiration
35+
// date
36+
//
37+
// Related types are [google.type.TimeOfDay][google.type.TimeOfDay] and
38+
// `google.protobuf.Timestamp`.
39+
message Date {
40+
// Year of the date. Must be from 1 to 9999, or 0 to specify a date without
41+
// a year.
42+
int32 year = 1;
43+
44+
// Month of a year. Must be from 1 to 12, or 0 to specify a year without a
45+
// month and day.
46+
int32 month = 2;
47+
48+
// Day of a month. Must be from 1 to 31 and valid for the year and month, or 0
49+
// to specify a year by itself or a year and month where the day isn't
50+
// significant.
51+
int32 day = 3;
52+
}

0 commit comments

Comments
 (0)