ServerEndpoints

jsonrpclib.smithy4sinterop.ServerEndpoints

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def apply[Alg[_[_, _, _, _, _]], F[_]](impl: FunctorAlgebra[Alg, F])(implicit service: Service[Alg], F: Monadic[F]): Either[UnsupportedProtocolError, List[Endpoint[F]]]

Creates JSON-RPC server endpoints from a Smithy service implementation.

Creates JSON-RPC server endpoints from a Smithy service implementation.

Given a Smithy FunctorAlgebra[Alg, F], this extracts all operations and compiles them into JSON-RPC Endpoint[F] handlers that can be mounted on a communication channel (e.g. FS2Channel).

Before generating endpoints, this method checks whether the service is compatible with the JSON-RPC protocol. If the protocol is unsupported, it returns a Left(UnsupportedProtocolError).

Supports both standard request-response and notification-style endpoints, as well as Smithy-modeled errors.

Usage:

val endpointsOrError = ServerEndpoints(new ServerImpl)
endpointsOrError match {
 case Right(endpoints) => channel.withEndpoints(endpoints)
 case Left(error)      => sys.error(s"Incompatible protocol: $error")
}

Value parameters

impl

Smithy FunctorAlgebra implementation

Attributes

Returns

Either an error if the protocol is unsupported or a list of compiled JSON-RPC endpoints