-
Notifications
You must be signed in to change notification settings - Fork 195
Open
Description
Assume a following proto:
service MerchantService {
rpc Search(MerchantSearchRequest) returns (MerchantSearchResponse);
}
Current plugin generates following client code:
class MerchantServiceClient extends $grpc.Client {
MerchantServiceClient($grpc.ClientChannel channel,
{$grpc.CallOptions? options,
$core.Iterable<$grpc.ClientInterceptor>? interceptors})
: super(channel, options: options,
interceptors: interceptors);
$grpc.ResponseFuture<$0.MerchantSearchResponse> search($0.MerchantSearchRequest request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$search, request, options: options);
}
}
It defines a search
method that is expected to be used by the users, but it also exposes methods from $grpc.Client
that are not expected to be used by them.
How about to generate something like:
abstract class MerchantServiceClient {
$grpc.ResponseFuture<$0.MerchantSearchResponse> search($0.MerchantSearchRequest request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$search, request, options: options);
}
}
class _MerchantServiceClient extends $grpc.Client implements MerchantServiceClient {
MerchantServiceClient($grpc.ClientChannel channel,
{$grpc.CallOptions? options,
$core.Iterable<$grpc.ClientInterceptor>? interceptors})
: super(channel, options: options,
interceptors: interceptors);
$grpc.ResponseFuture<$0.MerchantSearchResponse> search($0.MerchantSearchRequest request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$search, request, options: options);
}
}
MerchantServiceClient createMerchantServiceClient($grpc.ClientChannel channel,
{$grpc.CallOptions? options,
$core.Iterable<$grpc.ClientInterceptor>? interceptors}) {
return MerchantServiceClient(channel,
options: options, interceptors: interceptors);
}
Metadata
Metadata
Assignees
Labels
No labels