Update generated code using latest protoc_plugin. (#30)

Preparation for updating the call generation logic.
This commit is contained in:
Jakob Andersen 2017-08-23 12:47:48 +02:00 committed by GitHub
parent 83ee9c2edb
commit 05bb6a5d08
7 changed files with 84 additions and 92 deletions

View File

@ -12,7 +12,7 @@ import 'package:protobuf/protobuf.dart';
class Record extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('Record')
..a/*<String>*/(1, 'value', PbFieldType.OS)
..a<String>(1, 'value', PbFieldType.OS)
..hasRequiredFields = false;
Record() : super();
@ -48,7 +48,7 @@ class _ReadonlyRecord extends Record with ReadonlyMessageMixin {}
class Number extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('Number')
..a/*<int>*/(1, 'value', PbFieldType.O3)
..a<int>(1, 'value', PbFieldType.O3)
..hasRequiredFields = false;
Number() : super();

View File

@ -29,7 +29,7 @@ $ dart bin/client.dart
If you have made changes to the message or service definition in
`protos/route_guide.proto` and need to regenerate the corresponding Dart files,
you will need to have protoc version 3.0.0 or higher and the Dart protoc plugin
version 0.7.3 or higher on your PATH.
version 0.7.6 or higher on your PATH.
To install protoc, see the instructions on
[the Protocol Buffers website](https://developers.google.com/protocol-buffers/).

View File

@ -12,8 +12,8 @@ import 'package:protobuf/protobuf.dart';
class Point extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('Point')
..a/*<int>*/(1, 'latitude', PbFieldType.O3)
..a/*<int>*/(2, 'longitude', PbFieldType.O3)
..a<int>(1, 'latitude', PbFieldType.O3)
..a<int>(2, 'longitude', PbFieldType.O3)
..hasRequiredFields = false;
Point() : super();
@ -56,8 +56,8 @@ class _ReadonlyPoint extends Point with ReadonlyMessageMixin {}
class Rectangle extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('Rectangle')
..a/*<Point>*/(1, 'lo', PbFieldType.OM, Point.getDefault, Point.create)
..a/*<Point>*/(2, 'hi', PbFieldType.OM, Point.getDefault, Point.create)
..a<Point>(1, 'lo', PbFieldType.OM, Point.getDefault, Point.create)
..a<Point>(2, 'hi', PbFieldType.OM, Point.getDefault, Point.create)
..hasRequiredFields = false;
Rectangle() : super();
@ -101,9 +101,8 @@ class _ReadonlyRectangle extends Rectangle with ReadonlyMessageMixin {}
class Feature extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('Feature')
..a/*<String>*/(1, 'name', PbFieldType.OS)
..a/*<Point>*/(
2, 'location', PbFieldType.OM, Point.getDefault, Point.create)
..a<String>(1, 'name', PbFieldType.OS)
..a<Point>(2, 'location', PbFieldType.OM, Point.getDefault, Point.create)
..hasRequiredFields = false;
Feature() : super();
@ -147,9 +146,8 @@ class _ReadonlyFeature extends Feature with ReadonlyMessageMixin {}
class RouteNote extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('RouteNote')
..a/*<Point>*/(
1, 'location', PbFieldType.OM, Point.getDefault, Point.create)
..a/*<String>*/(2, 'message', PbFieldType.OS)
..a<Point>(1, 'location', PbFieldType.OM, Point.getDefault, Point.create)
..a<String>(2, 'message', PbFieldType.OS)
..hasRequiredFields = false;
RouteNote() : super();
@ -193,10 +191,10 @@ class _ReadonlyRouteNote extends RouteNote with ReadonlyMessageMixin {}
class RouteSummary extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('RouteSummary')
..a/*<int>*/(1, 'pointCount', PbFieldType.O3)
..a/*<int>*/(2, 'featureCount', PbFieldType.O3)
..a/*<int>*/(3, 'distance', PbFieldType.O3)
..a/*<int>*/(4, 'elapsedTime', PbFieldType.O3)
..a<int>(1, 'pointCount', PbFieldType.O3)
..a<int>(2, 'featureCount', PbFieldType.O3)
..a<int>(3, 'distance', PbFieldType.O3)
..a<int>(4, 'elapsedTime', PbFieldType.O3)
..hasRequiredFields = false;
RouteSummary() : super();

View File

@ -12,9 +12,7 @@ import 'package:grpc/grpc.dart';
import 'route_guide.pb.dart';
export 'route_guide.pb.dart';
class RouteGuideClient {
final ClientChannel _channel;
class RouteGuideClient extends Client {
static final _$getFeature = new ClientMethod<Point, Feature>(
'/routeguide.RouteGuide/GetFeature',
(Point value) => value.writeToBuffer(),
@ -32,32 +30,36 @@ class RouteGuideClient {
(RouteNote value) => value.writeToBuffer(),
(List<int> value) => new RouteNote.fromBuffer(value));
RouteGuideClient(this._channel);
RouteGuideClient(ClientChannel channel, {CallOptions options})
: super(channel, options: options);
ResponseFuture<Feature> getFeature(Point request) {
final call = new ClientCall(_channel, _$getFeature);
ResponseFuture<Feature> getFeature(Point request, {CallOptions options}) {
final call = $createCall(_$getFeature, options: options);
call.request
..add(request)
..close();
return new ResponseFuture(call);
}
ResponseStream<Feature> listFeatures(Rectangle request) {
final call = new ClientCall(_channel, _$listFeatures);
ResponseStream<Feature> listFeatures(Rectangle request,
{CallOptions options}) {
final call = $createCall(_$listFeatures, options: options);
call.request
..add(request)
..close();
return new ResponseStream(call);
}
ResponseFuture<RouteSummary> recordRoute(Stream<Point> request) {
final call = new ClientCall(_channel, _$recordRoute);
ResponseFuture<RouteSummary> recordRoute(Stream<Point> request,
{CallOptions options}) {
final call = $createCall(_$recordRoute, options: options);
request.pipe(call.request);
return new ResponseFuture(call);
}
ResponseStream<RouteNote> routeChat(Stream<RouteNote> request) {
final call = new ClientCall(_channel, _$routeChat);
ResponseStream<RouteNote> routeChat(Stream<RouteNote> request,
{CallOptions options}) {
final call = $createCall(_$routeChat, options: options);
request.pipe(call.request);
return new ResponseStream(call);
}

View File

@ -16,7 +16,7 @@ export 'messages.pbenum.dart';
class BoolValue extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('BoolValue')
..a/*<bool>*/(1, 'value', PbFieldType.OB)
..a<bool>(1, 'value', PbFieldType.OB)
..hasRequiredFields = false;
BoolValue() : super();
@ -52,9 +52,9 @@ class _ReadonlyBoolValue extends BoolValue with ReadonlyMessageMixin {}
class Payload extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('Payload')
..e/*<PayloadType>*/(1, 'type', PbFieldType.OE, PayloadType.COMPRESSABLE,
..e<PayloadType>(1, 'type', PbFieldType.OE, PayloadType.COMPRESSABLE,
PayloadType.valueOf)
..a/*<List<int>>*/(2, 'body', PbFieldType.OY)
..a<List<int>>(2, 'body', PbFieldType.OY)
..hasRequiredFields = false;
Payload() : super();
@ -98,8 +98,8 @@ class _ReadonlyPayload extends Payload with ReadonlyMessageMixin {}
class EchoStatus extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('EchoStatus')
..a/*<int>*/(1, 'code', PbFieldType.O3)
..a/*<String>*/(2, 'message', PbFieldType.OS)
..a<int>(1, 'code', PbFieldType.O3)
..a<String>(2, 'message', PbFieldType.OS)
..hasRequiredFields = false;
EchoStatus() : super();
@ -143,19 +143,19 @@ class _ReadonlyEchoStatus extends EchoStatus with ReadonlyMessageMixin {}
class SimpleRequest extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('SimpleRequest')
..e/*<PayloadType>*/(1, 'responseType', PbFieldType.OE,
..e<PayloadType>(1, 'responseType', PbFieldType.OE,
PayloadType.COMPRESSABLE, PayloadType.valueOf)
..a/*<int>*/(2, 'responseSize', PbFieldType.O3)
..a/*<Payload>*/(
..a<int>(2, 'responseSize', PbFieldType.O3)
..a<Payload>(
3, 'payload', PbFieldType.OM, Payload.getDefault, Payload.create)
..a/*<bool>*/(4, 'fillUsername', PbFieldType.OB)
..a/*<bool>*/(5, 'fillOauthScope', PbFieldType.OB)
..a/*<BoolValue>*/(6, 'responseCompressed', PbFieldType.OM,
BoolValue.getDefault, BoolValue.create)
..a/*<EchoStatus>*/(7, 'responseStatus', PbFieldType.OM,
EchoStatus.getDefault, EchoStatus.create)
..a/*<BoolValue>*/(8, 'expectCompressed', PbFieldType.OM,
..a<bool>(4, 'fillUsername', PbFieldType.OB)
..a<bool>(5, 'fillOauthScope', PbFieldType.OB)
..a<BoolValue>(6, 'responseCompressed', PbFieldType.OM,
BoolValue.getDefault, BoolValue.create)
..a<EchoStatus>(7, 'responseStatus', PbFieldType.OM, EchoStatus.getDefault,
EchoStatus.create)
..a<BoolValue>(8, 'expectCompressed', PbFieldType.OM, BoolValue.getDefault,
BoolValue.create)
..hasRequiredFields = false;
SimpleRequest() : super();
@ -249,10 +249,10 @@ class _ReadonlySimpleRequest extends SimpleRequest with ReadonlyMessageMixin {}
class SimpleResponse extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('SimpleResponse')
..a/*<Payload>*/(
..a<Payload>(
1, 'payload', PbFieldType.OM, Payload.getDefault, Payload.create)
..a/*<String>*/(2, 'username', PbFieldType.OS)
..a/*<String>*/(3, 'oauthScope', PbFieldType.OS)
..a<String>(2, 'username', PbFieldType.OS)
..a<String>(3, 'oauthScope', PbFieldType.OS)
..hasRequiredFields = false;
SimpleResponse() : super();
@ -308,10 +308,10 @@ class _ReadonlySimpleResponse extends SimpleResponse with ReadonlyMessageMixin {
class StreamingInputCallRequest extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('StreamingInputCallRequest')
..a/*<Payload>*/(
..a<Payload>(
1, 'payload', PbFieldType.OM, Payload.getDefault, Payload.create)
..a/*<BoolValue>*/(2, 'expectCompressed', PbFieldType.OM,
BoolValue.getDefault, BoolValue.create)
..a<BoolValue>(2, 'expectCompressed', PbFieldType.OM, BoolValue.getDefault,
BoolValue.create)
..hasRequiredFields = false;
StreamingInputCallRequest() : super();
@ -361,7 +361,7 @@ class _ReadonlyStreamingInputCallRequest extends StreamingInputCallRequest
class StreamingInputCallResponse extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('StreamingInputCallResponse')
..a/*<int>*/(1, 'aggregatedPayloadSize', PbFieldType.O3)
..a<int>(1, 'aggregatedPayloadSize', PbFieldType.O3)
..hasRequiredFields = false;
StreamingInputCallResponse() : super();
@ -404,9 +404,9 @@ class _ReadonlyStreamingInputCallResponse extends StreamingInputCallResponse
class ResponseParameters extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('ResponseParameters')
..a/*<int>*/(1, 'size', PbFieldType.O3)
..a/*<int>*/(2, 'intervalUs', PbFieldType.O3)
..a/*<BoolValue>*/(
..a<int>(1, 'size', PbFieldType.O3)
..a<int>(2, 'intervalUs', PbFieldType.O3)
..a<BoolValue>(
3, 'compressed', PbFieldType.OM, BoolValue.getDefault, BoolValue.create)
..hasRequiredFields = false;
@ -464,14 +464,14 @@ class _ReadonlyResponseParameters extends ResponseParameters
class StreamingOutputCallRequest extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('StreamingOutputCallRequest')
..e/*<PayloadType>*/(1, 'responseType', PbFieldType.OE,
..e<PayloadType>(1, 'responseType', PbFieldType.OE,
PayloadType.COMPRESSABLE, PayloadType.valueOf)
..pp/*<ResponseParameters>*/(2, 'responseParameters', PbFieldType.PM,
..pp<ResponseParameters>(2, 'responseParameters', PbFieldType.PM,
ResponseParameters.$checkItem, ResponseParameters.create)
..a/*<Payload>*/(
..a<Payload>(
3, 'payload', PbFieldType.OM, Payload.getDefault, Payload.create)
..a/*<EchoStatus>*/(7, 'responseStatus', PbFieldType.OM,
EchoStatus.getDefault, EchoStatus.create)
..a<EchoStatus>(7, 'responseStatus', PbFieldType.OM, EchoStatus.getDefault,
EchoStatus.create)
..hasRequiredFields = false;
StreamingOutputCallRequest() : super();
@ -532,7 +532,7 @@ class _ReadonlyStreamingOutputCallRequest extends StreamingOutputCallRequest
class StreamingOutputCallResponse extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('StreamingOutputCallResponse')
..a/*<Payload>*/(
..a<Payload>(
1, 'payload', PbFieldType.OM, Payload.getDefault, Payload.create)
..hasRequiredFields = false;
@ -576,7 +576,7 @@ class _ReadonlyStreamingOutputCallResponse extends StreamingOutputCallResponse
class ReconnectParams extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('ReconnectParams')
..a/*<int>*/(1, 'maxReconnectBackoffMs', PbFieldType.O3)
..a<int>(1, 'maxReconnectBackoffMs', PbFieldType.O3)
..hasRequiredFields = false;
ReconnectParams() : super();
@ -616,8 +616,8 @@ class _ReadonlyReconnectParams extends ReconnectParams
class ReconnectInfo extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('ReconnectInfo')
..a/*<bool>*/(1, 'passed', PbFieldType.OB)
..p/*<int>*/(2, 'backoffMs', PbFieldType.P3)
..a<bool>(1, 'passed', PbFieldType.OB)
..p<int>(2, 'backoffMs', PbFieldType.P3)
..hasRequiredFields = false;
ReconnectInfo() : super();

View File

@ -13,9 +13,7 @@ import 'empty.pb.dart';
import 'messages.pb.dart';
export 'test.pb.dart';
class TestServiceClient {
final ClientChannel _channel;
class TestServiceClient extends Client {
static final _$emptyCall = new ClientMethod<Empty, Empty>(
'/grpc.testing.TestService/EmptyCall',
(Empty value) => value.writeToBuffer(),
@ -58,10 +56,11 @@ class TestServiceClient {
(Empty value) => value.writeToBuffer(),
(List<int> value) => new Empty.fromBuffer(value));
TestServiceClient(this._channel);
TestServiceClient(ClientChannel channel, {CallOptions options})
: super(channel, options: options);
ResponseFuture<Empty> emptyCall(Empty request, {CallOptions options}) {
final call = new ClientCall(_channel, _$emptyCall, options: options);
final call = $createCall(_$emptyCall, options: options);
call.request
..add(request)
..close();
@ -70,7 +69,7 @@ class TestServiceClient {
ResponseFuture<SimpleResponse> unaryCall(SimpleRequest request,
{CallOptions options}) {
final call = new ClientCall(_channel, _$unaryCall, options: options);
final call = $createCall(_$unaryCall, options: options);
call.request
..add(request)
..close();
@ -79,8 +78,7 @@ class TestServiceClient {
ResponseFuture<SimpleResponse> cacheableUnaryCall(SimpleRequest request,
{CallOptions options}) {
final call =
new ClientCall(_channel, _$cacheableUnaryCall, options: options);
final call = $createCall(_$cacheableUnaryCall, options: options);
call.request
..add(request)
..close();
@ -90,8 +88,7 @@ class TestServiceClient {
ResponseStream<StreamingOutputCallResponse> streamingOutputCall(
StreamingOutputCallRequest request,
{CallOptions options}) {
final call =
new ClientCall(_channel, _$streamingOutputCall, options: options);
final call = $createCall(_$streamingOutputCall, options: options);
call.request
..add(request)
..close();
@ -101,8 +98,7 @@ class TestServiceClient {
ResponseFuture<StreamingInputCallResponse> streamingInputCall(
Stream<StreamingInputCallRequest> request,
{CallOptions options}) {
final call =
new ClientCall(_channel, _$streamingInputCall, options: options);
final call = $createCall(_$streamingInputCall, options: options);
request.pipe(call.request);
return new ResponseFuture(call);
}
@ -110,7 +106,7 @@ class TestServiceClient {
ResponseStream<StreamingOutputCallResponse> fullDuplexCall(
Stream<StreamingOutputCallRequest> request,
{CallOptions options}) {
final call = new ClientCall(_channel, _$fullDuplexCall, options: options);
final call = $createCall(_$fullDuplexCall, options: options);
request.pipe(call.request);
return new ResponseStream(call);
}
@ -118,15 +114,14 @@ class TestServiceClient {
ResponseStream<StreamingOutputCallResponse> halfDuplexCall(
Stream<StreamingOutputCallRequest> request,
{CallOptions options}) {
final call = new ClientCall(_channel, _$halfDuplexCall, options: options);
final call = $createCall(_$halfDuplexCall, options: options);
request.pipe(call.request);
return new ResponseStream(call);
}
ResponseFuture<Empty> unimplementedCall(Empty request,
{CallOptions options}) {
final call =
new ClientCall(_channel, _$unimplementedCall, options: options);
final call = $createCall(_$unimplementedCall, options: options);
call.request
..add(request)
..close();
@ -222,20 +217,18 @@ abstract class TestServiceBase extends Service {
ServiceCall call, Stream<StreamingOutputCallRequest> request);
}
class UnimplementedServiceClient {
final ClientChannel _channel;
class UnimplementedServiceClient extends Client {
static final _$unimplementedCall = new ClientMethod<Empty, Empty>(
'/grpc.testing.UnimplementedService/UnimplementedCall',
(Empty value) => value.writeToBuffer(),
(List<int> value) => new Empty.fromBuffer(value));
UnimplementedServiceClient(this._channel);
UnimplementedServiceClient(ClientChannel channel, {CallOptions options})
: super(channel, options: options);
ResponseFuture<Empty> unimplementedCall(Empty request,
{CallOptions options}) {
final call =
new ClientCall(_channel, _$unimplementedCall, options: options);
final call = $createCall(_$unimplementedCall, options: options);
call.request
..add(request)
..close();
@ -264,9 +257,7 @@ abstract class UnimplementedServiceBase extends Service {
Future<Empty> unimplementedCall(ServiceCall call, Empty request);
}
class ReconnectServiceClient {
final ClientChannel _channel;
class ReconnectServiceClient extends Client {
static final _$start = new ClientMethod<ReconnectParams, Empty>(
'/grpc.testing.ReconnectService/Start',
(ReconnectParams value) => value.writeToBuffer(),
@ -276,10 +267,11 @@ class ReconnectServiceClient {
(Empty value) => value.writeToBuffer(),
(List<int> value) => new ReconnectInfo.fromBuffer(value));
ReconnectServiceClient(this._channel);
ReconnectServiceClient(ClientChannel channel, {CallOptions options})
: super(channel, options: options);
ResponseFuture<Empty> start(ReconnectParams request, {CallOptions options}) {
final call = new ClientCall(_channel, _$start, options: options);
final call = $createCall(_$start, options: options);
call.request
..add(request)
..close();
@ -287,7 +279,7 @@ class ReconnectServiceClient {
}
ResponseFuture<ReconnectInfo> stop(Empty request, {CallOptions options}) {
final call = new ClientCall(_channel, _$stop, options: options);
final call = $createCall(_$stop, options: options);
call.request
..add(request)
..close();

View File

@ -64,7 +64,7 @@ class ClientChannel {
{this.port = 443, this.options = const ChannelOptions()});
/// Returns a connection to this [Channel]'s RPC endpoint. The connection may
/// be shared between multiple RPC calls.
/// be shared between multiple RPCs.
Future<ClientTransportConnection> connect() async {
final securityContext = options.securityContext;