ClientStub

jsonrpclib.smithy4sinterop.ClientStub
object ClientStub

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
ClientStub.type

Members list

Value members

Concrete methods

def apply[Alg[_[_, _, _, _, _]], F[_] : Monadic](service: Service[Alg], channel: Channel[F]): Either[UnsupportedProtocolError, service.Impl[F]]

Creates a JSON-RPC client implementation for a Smithy service.

Creates a JSON-RPC client implementation for a Smithy service.

Given a Smithy Service[Alg] and a JSON-RPC communication Channel[F], this constructs a fully functional client that translates method calls into JSON-RPC messages sent over the channel.

Before constructing the client, this method checks whether the given Smithy service supports the JSON-RPC protocol. If not, it returns a Left(UnsupportedProtocolError).

Supports both standard request-response and fire-and-forget notification endpoints.

Usage:

 val stubOrError: Either[UnsupportedProtocolError, MyService[IO]] =
   ClientStub(myService, myChannel)

 val result: IO[Unit] = stubOrError match {
   case Right(stub) => stub.hello("world").void
   case Left(error) => IO.raiseError(new RuntimeException(error.toString))
 }

Value parameters

channel

JSON-RPC communication channel

service

Smithy service definition

Attributes

Returns

Either an error if the protocol is unsupported or a compiled client implementation