@@ -24,37 +24,87 @@ object TestServiceFs2Grpc extends _root_.fs2.grpc.GeneratedCompanion[TestService
2424
2525 def serviceDescriptor: _root_.io.grpc.ServiceDescriptor = hello.world.TestServiceGrpc.SERVICE
2626
27- def mkClient[F[_]: _root_.cats.effect.Async, A](dispatcher: _root_.cats.effect.std.Dispatcher[F], channel: _root_.io.grpc.Channel, mkMetadata: A => F[_root_.io.grpc.Metadata], clientOptions: _root_.fs2.grpc.client.ClientOptions): TestServiceFs2Grpc[F, A] = new TestServiceFs2Grpc[F, A] {
28- def noStreaming(request: hello.world.TestMessage, ctx: A): F[hello.world.TestMessage] = {
29- mkMetadata(ctx).flatMap { m =>
30- _root_.fs2.grpc.client.Fs2ClientCall[F](channel, hello.world.TestServiceGrpc.METHOD_NO_STREAMING, dispatcher, clientOptions).flatMap(_.unaryToUnaryCall(request, m))
31- }
32- }
33- def clientStreaming(request: _root_.fs2.Stream[F, hello.world.TestMessage], ctx: A): F[hello.world.TestMessage] = {
34- mkMetadata(ctx).flatMap { m =>
35- _root_.fs2.grpc.client.Fs2ClientCall[F](channel, hello.world.TestServiceGrpc.METHOD_CLIENT_STREAMING, dispatcher, clientOptions).flatMap(_.streamingToUnaryCall(request, m))
36- }
37- }
38- def serverStreaming(request: hello.world.TestMessage, ctx: A): _root_.fs2.Stream[F, hello.world.TestMessage] = {
39- _root_.fs2.Stream.eval(mkMetadata(ctx)).flatMap { m =>
40- _root_.fs2.Stream.eval(_root_.fs2.grpc.client.Fs2ClientCall[F](channel, hello.world.TestServiceGrpc.METHOD_SERVER_STREAMING, dispatcher, clientOptions)).flatMap(_.unaryToStreamingCall(request, m))
41- }
42- }
43- def bothStreaming(request: _root_.fs2.Stream[F, hello.world.TestMessage], ctx: A): _root_.fs2.Stream[F, hello.world.TestMessage] = {
44- _root_.fs2.Stream.eval(mkMetadata(ctx)).flatMap { m =>
45- _root_.fs2.Stream.eval(_root_.fs2.grpc.client.Fs2ClientCall[F](channel, hello.world.TestServiceGrpc.METHOD_BOTH_STREAMING, dispatcher, clientOptions)).flatMap(_.streamingToStreamingCall(request, m))
46- }
47- }
27+ def mkClientFull[F[_], G[_]: _root_.cats.effect.Async, A](
28+ dispatcher: _root_.cats.effect.std.Dispatcher[G],
29+ channel: _root_.io.grpc.Channel,
30+ clientAspect: _root_.fs2.grpc.client.ClientAspect[F, G, A],
31+ clientOptions: _root_.fs2.grpc.client.ClientOptions
32+ ): TestServiceFs2Grpc[F, A] = new TestServiceFs2Grpc[F, A] {
33+ def noStreaming(request: hello.world.TestMessage, ctx: A): F[hello.world.TestMessage] =
34+ clientAspect.visitUnaryToUnaryCall[hello.world.TestMessage, hello.world.TestMessage](
35+ _root_.fs2.grpc.client.ClientCallContext(ctx, hello.world.TestServiceGrpc.METHOD_NO_STREAMING),
36+ request,
37+ (req, m) => _root_.fs2.grpc.client.Fs2ClientCall[G](channel, hello.world.TestServiceGrpc.METHOD_NO_STREAMING, dispatcher, clientOptions).flatMap(_.unaryToUnaryCall(req, m))
38+ )
39+ def clientStreaming(request: _root_.fs2.Stream[F, hello.world.TestMessage], ctx: A): F[hello.world.TestMessage] =
40+ clientAspect.visitStreamingToUnaryCall[hello.world.TestMessage, hello.world.TestMessage](
41+ _root_.fs2.grpc.client.ClientCallContext(ctx, hello.world.TestServiceGrpc.METHOD_CLIENT_STREAMING),
42+ request,
43+ (req, m) => _root_.fs2.grpc.client.Fs2ClientCall[G](channel, hello.world.TestServiceGrpc.METHOD_CLIENT_STREAMING, dispatcher, clientOptions).flatMap(_.streamingToUnaryCall(req, m))
44+ )
45+ def serverStreaming(request: hello.world.TestMessage, ctx: A): _root_.fs2.Stream[F, hello.world.TestMessage] =
46+ clientAspect.visitUnaryToStreamingCall[hello.world.TestMessage, hello.world.TestMessage](
47+ _root_.fs2.grpc.client.ClientCallContext(ctx, hello.world.TestServiceGrpc.METHOD_SERVER_STREAMING),
48+ request,
49+ (req, m) => _root_.fs2.Stream.eval(_root_.fs2.grpc.client.Fs2ClientCall[G](channel, hello.world.TestServiceGrpc.METHOD_SERVER_STREAMING, dispatcher, clientOptions)).flatMap(_.unaryToStreamingCall(req, m))
50+ )
51+ def bothStreaming(request: _root_.fs2.Stream[F, hello.world.TestMessage], ctx: A): _root_.fs2.Stream[F, hello.world.TestMessage] =
52+ clientAspect.visitStreamingToStreamingCall[hello.world.TestMessage, hello.world.TestMessage](
53+ _root_.fs2.grpc.client.ClientCallContext(ctx, hello.world.TestServiceGrpc.METHOD_BOTH_STREAMING),
54+ request,
55+ (req, m) => _root_.fs2.Stream.eval(_root_.fs2.grpc.client.Fs2ClientCall[G](channel, hello.world.TestServiceGrpc.METHOD_BOTH_STREAMING, dispatcher, clientOptions)).flatMap(_.streamingToStreamingCall(req, m))
56+ )
4857 }
4958
50- protected def serviceBinding[F[_]: _root_.cats.effect.Async, A](dispatcher: _root_.cats.effect.std.Dispatcher[F], serviceImpl: TestServiceFs2Grpc[F, A], mkCtx: _root_.io.grpc.Metadata => F[A], serverOptions: _root_.fs2.grpc.server.ServerOptions): _root_.io.grpc.ServerServiceDefinition = {
59+ protected def serviceBindingFull[F[_], G[_]: _root_.cats.effect.Async, A](
60+ dispatcher: _root_.cats.effect.std.Dispatcher[G],
61+ serviceImpl: TestServiceFs2Grpc[F, A],
62+ serviceAspect: _root_.fs2.grpc.server.ServiceAspect[F, G, A],
63+ serverOptions: _root_.fs2.grpc.server.ServerOptions
64+ ) = {
5165 _root_.io.grpc.ServerServiceDefinition
5266 .builder(hello.world.TestServiceGrpc.SERVICE)
53- .addMethod(hello.world.TestServiceGrpc.METHOD_NO_STREAMING, _root_.fs2.grpc.server.Fs2ServerCallHandler[F](dispatcher, serverOptions).unaryToUnaryCall[hello.world.TestMessage, hello.world.TestMessage]((r, m) => mkCtx(m).flatMap(serviceImpl.noStreaming(r, _))))
54- .addMethod(hello.world.TestServiceGrpc.METHOD_CLIENT_STREAMING, _root_.fs2.grpc.server.Fs2ServerCallHandler[F](dispatcher, serverOptions).streamingToUnaryCall[hello.world.TestMessage, hello.world.TestMessage]((r, m) => mkCtx(m).flatMap(serviceImpl.clientStreaming(r, _))))
55- .addMethod(hello.world.TestServiceGrpc.METHOD_SERVER_STREAMING, _root_.fs2.grpc.server.Fs2ServerCallHandler[F](dispatcher, serverOptions).unaryToStreamingCall[hello.world.TestMessage, hello.world.TestMessage]((r, m) => _root_.fs2.Stream.eval(mkCtx(m)).flatMap(serviceImpl.serverStreaming(r, _))))
56- .addMethod(hello.world.TestServiceGrpc.METHOD_BOTH_STREAMING, _root_.fs2.grpc.server.Fs2ServerCallHandler[F](dispatcher, serverOptions).streamingToStreamingCall[hello.world.TestMessage, hello.world.TestMessage]((r, m) => _root_.fs2.Stream.eval(mkCtx(m)).flatMap(serviceImpl.bothStreaming(r, _))))
67+ .addMethod(
68+ hello.world.TestServiceGrpc.METHOD_NO_STREAMING,
69+ _root_.fs2.grpc.server.Fs2ServerCallHandler[G](dispatcher, serverOptions).unaryToUnaryCall[hello.world.TestMessage, hello.world.TestMessage]{ (r, m) =>
70+ serviceAspect.visitUnaryToUnaryCall[hello.world.TestMessage, hello.world.TestMessage](
71+ _root_.fs2.grpc.server.ServiceCallContext(m, hello.world.TestServiceGrpc.METHOD_NO_STREAMING),
72+ r,
73+ (r, m) => serviceImpl.noStreaming(r, m)
74+ )
75+ }
76+ )
77+ .addMethod(
78+ hello.world.TestServiceGrpc.METHOD_CLIENT_STREAMING,
79+ _root_.fs2.grpc.server.Fs2ServerCallHandler[G](dispatcher, serverOptions).streamingToUnaryCall[hello.world.TestMessage, hello.world.TestMessage]{ (r, m) =>
80+ serviceAspect.visitStreamingToUnaryCall[hello.world.TestMessage, hello.world.TestMessage](
81+ _root_.fs2.grpc.server.ServiceCallContext(m, hello.world.TestServiceGrpc.METHOD_CLIENT_STREAMING),
82+ r,
83+ (r, m) => serviceImpl.clientStreaming(r, m)
84+ )
85+ }
86+ )
87+ .addMethod(
88+ hello.world.TestServiceGrpc.METHOD_SERVER_STREAMING,
89+ _root_.fs2.grpc.server.Fs2ServerCallHandler[G](dispatcher, serverOptions).unaryToStreamingCall[hello.world.TestMessage, hello.world.TestMessage]{ (r, m) =>
90+ serviceAspect.visitUnaryToStreamingCall[hello.world.TestMessage, hello.world.TestMessage](
91+ _root_.fs2.grpc.server.ServiceCallContext(m, hello.world.TestServiceGrpc.METHOD_SERVER_STREAMING),
92+ r,
93+ (r, m) => serviceImpl.serverStreaming(r, m)
94+ )
95+ }
96+ )
97+ .addMethod(
98+ hello.world.TestServiceGrpc.METHOD_BOTH_STREAMING,
99+ _root_.fs2.grpc.server.Fs2ServerCallHandler[G](dispatcher, serverOptions).streamingToStreamingCall[hello.world.TestMessage, hello.world.TestMessage]{ (r, m) =>
100+ serviceAspect.visitStreamingToStreamingCall[hello.world.TestMessage, hello.world.TestMessage](
101+ _root_.fs2.grpc.server.ServiceCallContext(m, hello.world.TestServiceGrpc.METHOD_BOTH_STREAMING),
102+ r,
103+ (r, m) => serviceImpl.bothStreaming(r, m)
104+ )
105+ }
106+ )
57107 .build()
58108 }
59109
60- }
110+ }
0 commit comments