ligo/lib_rpc-base/RPC_service.ml

28 lines
1.0 KiB
OCaml
Raw Normal View History

2016-09-08 21:13:10 +04:00
(**************************************************************************)
(* *)
2017-11-14 03:36:14 +04:00
(* Copyright (c) 2014 - 2017. *)
2016-09-08 21:13:10 +04:00
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *)
(* All rights reserved. No warranty, explicit or implicit, provided. *)
(* *)
(**************************************************************************)
2017-12-09 06:51:58 +04:00
type meth = [ `GET | `POST | `DELETE | `PUT | `PATCH ]
2016-09-08 21:13:10 +04:00
2017-12-09 06:51:58 +04:00
let string_of_meth = Resto.string_of_meth
let meth_of_string = Resto.meth_of_string
2016-09-08 21:13:10 +04:00
2017-12-09 06:51:58 +04:00
let meth_encoding =
let open Data_encoding in
conv
string_of_meth
(fun m ->
match meth_of_string m with
| None -> Pervasives.failwith "Cannot parse methods"
| Some s -> s)
string
2016-09-08 21:13:10 +04:00
2017-12-09 06:51:58 +04:00
module MethMap = Resto.MethMap
include Resto.MakeService(RPC_encoding)