Skip to content

Commit cb991f7

Browse files
Refactor generated protobuf files and improve code formatting
- Consolidated multiple lines of code for better readability in generated protobuf files. - Updated client and server implementations to streamline method signatures and improve consistency. - Enhanced error handling and response management in various test cases. - Applied consistent formatting across Dart files to adhere to style guidelines.
1 parent f952d38 commit cb991f7

File tree

106 files changed

+1461
-3743
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+1461
-3743
lines changed

example/googleapis/bin/logging.dart

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,13 @@ Future<void> main() async {
3232
exit(-1);
3333
}
3434

35-
final scopes = [
36-
'https://www.googleapis.com/auth/cloud-platform',
37-
'https://www.googleapis.com/auth/logging.write',
38-
];
39-
40-
final authenticator = ServiceAccountAuthenticator(
41-
serviceAccountFile.readAsStringSync(),
42-
scopes,
43-
);
35+
final scopes = ['https://www.googleapis.com/auth/cloud-platform', 'https://www.googleapis.com/auth/logging.write'];
36+
37+
final authenticator = ServiceAccountAuthenticator(serviceAccountFile.readAsStringSync(), scopes);
4438
final projectId = authenticator.projectId;
4539

4640
final channel = ClientChannel('logging.googleapis.com');
47-
final logging = LoggingServiceV2Client(
48-
channel,
49-
options: authenticator.toCallOptions,
50-
);
41+
final logging = LoggingServiceV2Client(channel, options: authenticator.toCallOptions);
5142

5243
final request = WriteLogEntriesRequest()
5344
..entries.add(

example/googleapis/lib/src/generated/google/api/label.pb.dart

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,21 @@ class LabelDescriptor extends $pb.GeneratedMessage {
3939
factory LabelDescriptor.fromBuffer($core.List<$core.int> data,
4040
[$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
4141
create()..mergeFromBuffer(data, registry);
42-
factory LabelDescriptor.fromJson($core.String json,
43-
[$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
42+
factory LabelDescriptor.fromJson($core.String json, [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
4443
create()..mergeFromJson(json, registry);
4544

46-
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
47-
_omitMessageNames ? '' : 'LabelDescriptor',
48-
package: const $pb.PackageName(_omitMessageNames ? '' : 'google.api'),
49-
createEmptyInstance: create)
45+
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'LabelDescriptor',
46+
package: const $pb.PackageName(_omitMessageNames ? '' : 'google.api'), createEmptyInstance: create)
5047
..aOS(1, _omitFieldNames ? '' : 'key')
51-
..aE<LabelDescriptor_ValueType>(2, _omitFieldNames ? '' : 'valueType',
52-
enumValues: LabelDescriptor_ValueType.values)
48+
..aE<LabelDescriptor_ValueType>(2, _omitFieldNames ? '' : 'valueType', enumValues: LabelDescriptor_ValueType.values)
5349
..aOS(3, _omitFieldNames ? '' : 'description')
5450
..hasRequiredFields = false;
5551

5652
@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
5753
LabelDescriptor clone() => deepCopy();
5854
@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
5955
LabelDescriptor copyWith(void Function(LabelDescriptor) updates) =>
60-
super.copyWith((message) => updates(message as LabelDescriptor))
61-
as LabelDescriptor;
56+
super.copyWith((message) => updates(message as LabelDescriptor)) as LabelDescriptor;
6257

6358
@$core.override
6459
$pb.BuilderInfo get info_ => _i;
@@ -68,8 +63,8 @@ class LabelDescriptor extends $pb.GeneratedMessage {
6863
@$core.override
6964
LabelDescriptor createEmptyInstance() => create();
7065
@$core.pragma('dart2js:noInline')
71-
static LabelDescriptor getDefault() => _defaultInstance ??=
72-
$pb.GeneratedMessage.$_defaultFor<LabelDescriptor>(create);
66+
static LabelDescriptor getDefault() =>
67+
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<LabelDescriptor>(create);
7368
static LabelDescriptor? _defaultInstance;
7469

7570
/// The label key.
@@ -103,7 +98,5 @@ class LabelDescriptor extends $pb.GeneratedMessage {
10398
void clearDescription() => $_clearField(3);
10499
}
105100

106-
const $core.bool _omitFieldNames =
107-
$core.bool.fromEnvironment('protobuf.omit_field_names');
108-
const $core.bool _omitMessageNames =
109-
$core.bool.fromEnvironment('protobuf.omit_message_names');
101+
const $core.bool _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
102+
const $core.bool _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names');

example/googleapis/lib/src/generated/google/api/label.pbenum.dart

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,25 @@ import 'package:protobuf/protobuf.dart' as $pb;
1717
/// Value types that can be used as label values.
1818
class LabelDescriptor_ValueType extends $pb.ProtobufEnum {
1919
/// A variable-length string. This is the default.
20-
static const LabelDescriptor_ValueType STRING =
21-
LabelDescriptor_ValueType._(0, _omitEnumNames ? '' : 'STRING');
20+
static const LabelDescriptor_ValueType STRING = LabelDescriptor_ValueType._(0, _omitEnumNames ? '' : 'STRING');
2221

2322
/// Boolean; true or false.
24-
static const LabelDescriptor_ValueType BOOL =
25-
LabelDescriptor_ValueType._(1, _omitEnumNames ? '' : 'BOOL');
23+
static const LabelDescriptor_ValueType BOOL = LabelDescriptor_ValueType._(1, _omitEnumNames ? '' : 'BOOL');
2624

2725
/// A 64-bit signed integer.
28-
static const LabelDescriptor_ValueType INT64 =
29-
LabelDescriptor_ValueType._(2, _omitEnumNames ? '' : 'INT64');
26+
static const LabelDescriptor_ValueType INT64 = LabelDescriptor_ValueType._(2, _omitEnumNames ? '' : 'INT64');
3027

31-
static const $core.List<LabelDescriptor_ValueType> values =
32-
<LabelDescriptor_ValueType>[
28+
static const $core.List<LabelDescriptor_ValueType> values = <LabelDescriptor_ValueType>[
3329
STRING,
3430
BOOL,
3531
INT64,
3632
];
3733

38-
static final $core.List<LabelDescriptor_ValueType?> _byValue =
39-
$pb.ProtobufEnum.$_initByValueList(values, 2);
34+
static final $core.List<LabelDescriptor_ValueType?> _byValue = $pb.ProtobufEnum.$_initByValueList(values, 2);
4035
static LabelDescriptor_ValueType? valueOf($core.int value) =>
4136
value < 0 || value >= _byValue.length ? null : _byValue[value];
4237

4338
const LabelDescriptor_ValueType._(super.value, super.name);
4439
}
4540

46-
const $core.bool _omitEnumNames =
47-
$core.bool.fromEnvironment('protobuf.omit_enum_names');
41+
const $core.bool _omitEnumNames = $core.bool.fromEnvironment('protobuf.omit_enum_names');

example/googleapis/lib/src/generated/google/api/launch_stage.pbenum.dart

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,17 @@ class LaunchStage extends $pb.ProtobufEnum {
2222
LaunchStage._(0, _omitEnumNames ? '' : 'LAUNCH_STAGE_UNSPECIFIED');
2323

2424
/// The feature is not yet implemented. Users can not use it.
25-
static const LaunchStage UNIMPLEMENTED =
26-
LaunchStage._(6, _omitEnumNames ? '' : 'UNIMPLEMENTED');
25+
static const LaunchStage UNIMPLEMENTED = LaunchStage._(6, _omitEnumNames ? '' : 'UNIMPLEMENTED');
2726

2827
/// Prelaunch features are hidden from users and are only visible internally.
29-
static const LaunchStage PRELAUNCH =
30-
LaunchStage._(7, _omitEnumNames ? '' : 'PRELAUNCH');
28+
static const LaunchStage PRELAUNCH = LaunchStage._(7, _omitEnumNames ? '' : 'PRELAUNCH');
3129

3230
/// Early Access features are limited to a closed group of testers. To use
3331
/// these features, you must sign up in advance and sign a Trusted Tester
3432
/// agreement (which includes confidentiality provisions). These features may
3533
/// be unstable, changed in backward-incompatible ways, and are not
3634
/// guaranteed to be released.
37-
static const LaunchStage EARLY_ACCESS =
38-
LaunchStage._(1, _omitEnumNames ? '' : 'EARLY_ACCESS');
35+
static const LaunchStage EARLY_ACCESS = LaunchStage._(1, _omitEnumNames ? '' : 'EARLY_ACCESS');
3936

4037
/// Alpha is a limited availability test for releases before they are cleared
4138
/// for widespread use. By Alpha, all significant design issues are resolved
@@ -46,16 +43,14 @@ class LaunchStage extends $pb.ProtobufEnum {
4643
/// they will be far enough along that customers can actually use them in
4744
/// test environments or for limited-use tests -- just like they would in
4845
/// normal production cases.
49-
static const LaunchStage ALPHA =
50-
LaunchStage._(2, _omitEnumNames ? '' : 'ALPHA');
46+
static const LaunchStage ALPHA = LaunchStage._(2, _omitEnumNames ? '' : 'ALPHA');
5147

5248
/// Beta is the point at which we are ready to open a release for any
5349
/// customer to use. There are no SLA or technical support obligations in a
5450
/// Beta release. Products will be complete from a feature perspective, but
5551
/// may have some open outstanding issues. Beta releases are suitable for
5652
/// limited production use cases.
57-
static const LaunchStage BETA =
58-
LaunchStage._(3, _omitEnumNames ? '' : 'BETA');
53+
static const LaunchStage BETA = LaunchStage._(3, _omitEnumNames ? '' : 'BETA');
5954

6055
/// GA features are open to all developers and are considered stable and
6156
/// fully qualified for production use.
@@ -66,8 +61,7 @@ class LaunchStage extends $pb.ProtobufEnum {
6661
/// Service](https://cloud.google.com/terms/)
6762
/// and the [Google Cloud Platform Subject to the Deprecation
6863
/// Policy](https://cloud.google.com/terms/deprecation) documentation.
69-
static const LaunchStage DEPRECATED =
70-
LaunchStage._(5, _omitEnumNames ? '' : 'DEPRECATED');
64+
static const LaunchStage DEPRECATED = LaunchStage._(5, _omitEnumNames ? '' : 'DEPRECATED');
7165

7266
static const $core.List<LaunchStage> values = <LaunchStage>[
7367
LAUNCH_STAGE_UNSPECIFIED,
@@ -80,13 +74,10 @@ class LaunchStage extends $pb.ProtobufEnum {
8074
DEPRECATED,
8175
];
8276

83-
static final $core.List<LaunchStage?> _byValue =
84-
$pb.ProtobufEnum.$_initByValueList(values, 7);
85-
static LaunchStage? valueOf($core.int value) =>
86-
value < 0 || value >= _byValue.length ? null : _byValue[value];
77+
static final $core.List<LaunchStage?> _byValue = $pb.ProtobufEnum.$_initByValueList(values, 7);
78+
static LaunchStage? valueOf($core.int value) => value < 0 || value >= _byValue.length ? null : _byValue[value];
8779

8880
const LaunchStage._(super.value, super.name);
8981
}
9082

91-
const $core.bool _omitEnumNames =
92-
$core.bool.fromEnvironment('protobuf.omit_enum_names');
83+
const $core.bool _omitEnumNames = $core.bool.fromEnvironment('protobuf.omit_enum_names');

example/googleapis/lib/src/generated/google/api/monitored_resource.pb.dart

Lines changed: 23 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -58,40 +58,32 @@ class MonitoredResourceDescriptor extends $pb.GeneratedMessage {
5858
[$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
5959
create()..mergeFromJson(json, registry);
6060

61-
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
62-
_omitMessageNames ? '' : 'MonitoredResourceDescriptor',
63-
package: const $pb.PackageName(_omitMessageNames ? '' : 'google.api'),
64-
createEmptyInstance: create)
61+
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'MonitoredResourceDescriptor',
62+
package: const $pb.PackageName(_omitMessageNames ? '' : 'google.api'), createEmptyInstance: create)
6563
..aOS(1, _omitFieldNames ? '' : 'type')
6664
..aOS(2, _omitFieldNames ? '' : 'displayName')
6765
..aOS(3, _omitFieldNames ? '' : 'description')
68-
..pPM<$0.LabelDescriptor>(4, _omitFieldNames ? '' : 'labels',
69-
subBuilder: $0.LabelDescriptor.create)
66+
..pPM<$0.LabelDescriptor>(4, _omitFieldNames ? '' : 'labels', subBuilder: $0.LabelDescriptor.create)
7067
..aOS(5, _omitFieldNames ? '' : 'name')
71-
..aE<$2.LaunchStage>(7, _omitFieldNames ? '' : 'launchStage',
72-
enumValues: $2.LaunchStage.values)
68+
..aE<$2.LaunchStage>(7, _omitFieldNames ? '' : 'launchStage', enumValues: $2.LaunchStage.values)
7369
..hasRequiredFields = false;
7470

7571
@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
7672
MonitoredResourceDescriptor clone() => deepCopy();
7773
@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
78-
MonitoredResourceDescriptor copyWith(
79-
void Function(MonitoredResourceDescriptor) updates) =>
80-
super.copyWith(
81-
(message) => updates(message as MonitoredResourceDescriptor))
82-
as MonitoredResourceDescriptor;
74+
MonitoredResourceDescriptor copyWith(void Function(MonitoredResourceDescriptor) updates) =>
75+
super.copyWith((message) => updates(message as MonitoredResourceDescriptor)) as MonitoredResourceDescriptor;
8376

8477
@$core.override
8578
$pb.BuilderInfo get info_ => _i;
8679

8780
@$core.pragma('dart2js:noInline')
88-
static MonitoredResourceDescriptor create() =>
89-
MonitoredResourceDescriptor._();
81+
static MonitoredResourceDescriptor create() => MonitoredResourceDescriptor._();
9082
@$core.override
9183
MonitoredResourceDescriptor createEmptyInstance() => create();
9284
@$core.pragma('dart2js:noInline')
93-
static MonitoredResourceDescriptor getDefault() => _defaultInstance ??=
94-
$pb.GeneratedMessage.$_defaultFor<MonitoredResourceDescriptor>(create);
85+
static MonitoredResourceDescriptor getDefault() =>
86+
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<MonitoredResourceDescriptor>(create);
9587
static MonitoredResourceDescriptor? _defaultInstance;
9688

9789
/// Required. The monitored resource type. For example, the type
@@ -201,10 +193,8 @@ class MonitoredResource extends $pb.GeneratedMessage {
201193
[$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
202194
create()..mergeFromJson(json, registry);
203195

204-
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
205-
_omitMessageNames ? '' : 'MonitoredResource',
206-
package: const $pb.PackageName(_omitMessageNames ? '' : 'google.api'),
207-
createEmptyInstance: create)
196+
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'MonitoredResource',
197+
package: const $pb.PackageName(_omitMessageNames ? '' : 'google.api'), createEmptyInstance: create)
208198
..aOS(1, _omitFieldNames ? '' : 'type')
209199
..m<$core.String, $core.String>(2, _omitFieldNames ? '' : 'labels',
210200
entryClassName: 'MonitoredResource.LabelsEntry',
@@ -217,8 +207,7 @@ class MonitoredResource extends $pb.GeneratedMessage {
217207
MonitoredResource clone() => deepCopy();
218208
@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
219209
MonitoredResource copyWith(void Function(MonitoredResource) updates) =>
220-
super.copyWith((message) => updates(message as MonitoredResource))
221-
as MonitoredResource;
210+
super.copyWith((message) => updates(message as MonitoredResource)) as MonitoredResource;
222211

223212
@$core.override
224213
$pb.BuilderInfo get info_ => _i;
@@ -228,8 +217,8 @@ class MonitoredResource extends $pb.GeneratedMessage {
228217
@$core.override
229218
MonitoredResource createEmptyInstance() => create();
230219
@$core.pragma('dart2js:noInline')
231-
static MonitoredResource getDefault() => _defaultInstance ??=
232-
$pb.GeneratedMessage.$_defaultFor<MonitoredResource>(create);
220+
static MonitoredResource getDefault() =>
221+
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<MonitoredResource>(create);
233222
static MonitoredResource? _defaultInstance;
234223

235224
/// Required. The monitored resource type. This field must match
@@ -281,12 +270,9 @@ class MonitoredResourceMetadata extends $pb.GeneratedMessage {
281270
[$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
282271
create()..mergeFromJson(json, registry);
283272

284-
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
285-
_omitMessageNames ? '' : 'MonitoredResourceMetadata',
286-
package: const $pb.PackageName(_omitMessageNames ? '' : 'google.api'),
287-
createEmptyInstance: create)
288-
..aOM<$1.Struct>(1, _omitFieldNames ? '' : 'systemLabels',
289-
subBuilder: $1.Struct.create)
273+
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'MonitoredResourceMetadata',
274+
package: const $pb.PackageName(_omitMessageNames ? '' : 'google.api'), createEmptyInstance: create)
275+
..aOM<$1.Struct>(1, _omitFieldNames ? '' : 'systemLabels', subBuilder: $1.Struct.create)
290276
..m<$core.String, $core.String>(2, _omitFieldNames ? '' : 'userLabels',
291277
entryClassName: 'MonitoredResourceMetadata.UserLabelsEntry',
292278
keyFieldType: $pb.PbFieldType.OS,
@@ -297,10 +283,8 @@ class MonitoredResourceMetadata extends $pb.GeneratedMessage {
297283
@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
298284
MonitoredResourceMetadata clone() => deepCopy();
299285
@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
300-
MonitoredResourceMetadata copyWith(
301-
void Function(MonitoredResourceMetadata) updates) =>
302-
super.copyWith((message) => updates(message as MonitoredResourceMetadata))
303-
as MonitoredResourceMetadata;
286+
MonitoredResourceMetadata copyWith(void Function(MonitoredResourceMetadata) updates) =>
287+
super.copyWith((message) => updates(message as MonitoredResourceMetadata)) as MonitoredResourceMetadata;
304288

305289
@$core.override
306290
$pb.BuilderInfo get info_ => _i;
@@ -310,8 +294,8 @@ class MonitoredResourceMetadata extends $pb.GeneratedMessage {
310294
@$core.override
311295
MonitoredResourceMetadata createEmptyInstance() => create();
312296
@$core.pragma('dart2js:noInline')
313-
static MonitoredResourceMetadata getDefault() => _defaultInstance ??=
314-
$pb.GeneratedMessage.$_defaultFor<MonitoredResourceMetadata>(create);
297+
static MonitoredResourceMetadata getDefault() =>
298+
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<MonitoredResourceMetadata>(create);
315299
static MonitoredResourceMetadata? _defaultInstance;
316300

317301
/// Output only. Values for predefined system metadata labels.
@@ -340,7 +324,5 @@ class MonitoredResourceMetadata extends $pb.GeneratedMessage {
340324
$pb.PbMap<$core.String, $core.String> get userLabels => $_getMap(1);
341325
}
342326

343-
const $core.bool _omitFieldNames =
344-
$core.bool.fromEnvironment('protobuf.omit_field_names');
345-
const $core.bool _omitMessageNames =
346-
$core.bool.fromEnvironment('protobuf.omit_message_names');
327+
const $core.bool _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
328+
const $core.bool _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names');

0 commit comments

Comments
 (0)