anmolitor/elm-grpc/1.1.0

Formerly andreasewering/elm-grpc. Search finds this package by either name.

Grpc.Internal

Internals that are intended to be used from code generators.

Rpc representation

type Rpc req res
= Rpc
{ service : String
, package : String
, rpcName : String
, encoder : req -> Encoder
, decoder : Decoder res
}

Given the following proto file

"""
syntax = "proto3";


package helloworld;


service Greeter {
  rpc SayHello (HelloRequest) returns (HelloReply) {}
}


message HelloRequest {
  string name = 1;
}


message HelloReply {
  string message = 1;
}
"""

the corresponding Rpc instance would be

Rpc
    { service = "Greeter"
    , package = "helloworld"
    , rpcName = "SayHello"
    , encoder = helloRequestEncoder
    , decoder = helloReplyDecoder
    }

where helloRequestEncoder and helloReplyDecoder are Encoders/Decoders built with elm-protocol-buffers.