gleamrpc

Types

pub type GleamRPCError(error) {
  GleamRPCError(error: error)
}

Constructors

  • GleamRPCError(error: error)
pub type Procedure(params, return) {
  Procedure(
    name: String,
    router: option.Option(Router),
    type_: ProcedureType,
    params_type: convert.Converter(params),
    return_type: convert.Converter(return),
  )
}

Constructors

  • Procedure(
      name: String,
      router: option.Option(Router),
      type_: ProcedureType,
      params_type: convert.Converter(params),
      return_type: convert.Converter(return),
    )
pub type ProcedureCall(params, return, error) {
  ProcedureCall(
    procedure: Procedure(params, return),
    server: ProcedureClient(params, return, error),
  )
}

Constructors

  • ProcedureCall(
      procedure: Procedure(params, return),
      server: ProcedureClient(params, return, error),
    )
pub type ProcedureClient(params, return, error) {
  ProcedureClient(
    call: fn(Procedure(params, return), params) ->
      Result(return, GleamRPCError(error)),
  )
}

Constructors

  • ProcedureClient(
      call: fn(Procedure(params, return), params) ->
        Result(return, GleamRPCError(error)),
    )
pub type ProcedureType {
  Query
  Mutation
}

Constructors

  • Query
  • Mutation
pub type Router {
  Router(name: String, parent: option.Option(Router))
}

Constructors

  • Router(name: String, parent: option.Option(Router))

Functions

pub fn call(
  procedure_call: ProcedureCall(a, b, c),
  params: a,
) -> Result(b, GleamRPCError(c))
pub fn mutation(
  name: String,
  router: Option(Router),
) -> Procedure(Nil, Nil)
pub fn params(
  procedure: Procedure(a, b),
  params_converter: Converter(a),
) -> Procedure(a, b)
pub fn query(
  name: String,
  router: Option(Router),
) -> Procedure(Nil, Nil)
pub fn returns(
  procedure: Procedure(a, b),
  return_converter: Converter(b),
) -> Procedure(a, b)
pub fn with_client(
  procedure: Procedure(a, b),
  server: ProcedureClient(a, b, c),
) -> ProcedureCall(a, b, c)
Search Document