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. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
2016-12-01 21:27:53 +04:00
|
|
|
(** Typed RPC services: definition, binding and dispatch. *)
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-11-27 09:13:12 +04:00
|
|
|
module Data : Resto.ENCODING with type 'a t = 'a Data_encoding.t
|
|
|
|
and type schema = Data_encoding.json_schema
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-11-27 09:13:12 +04:00
|
|
|
include (module type of struct include Resto end)
|
|
|
|
include (module type of struct include RestoDirectory end)
|
|
|
|
module Directory : (module type of struct include RestoDirectory.MakeDirectory(Data) end)
|
|
|
|
module Service : (module type of struct include Directory.Service end)
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-11-27 09:13:12 +04:00
|
|
|
(** Compatibility layer, to be removed ASAP. *)
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-11-27 09:13:12 +04:00
|
|
|
type 'a directory = 'a Directory.t
|
|
|
|
type ('prefix, 'params, 'input, 'output) service =
|
|
|
|
([ `POST ], 'prefix, 'params, unit, 'input, 'output, unit) Service.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val service:
|
2016-12-11 19:34:58 +04:00
|
|
|
?description: string ->
|
|
|
|
input: 'input Data_encoding.t ->
|
|
|
|
output: 'output Data_encoding.t ->
|
2017-11-27 09:13:12 +04:00
|
|
|
('prefix, 'params) Path.t ->
|
2016-12-11 19:34:58 +04:00
|
|
|
('prefix, 'params, 'input, 'output) service
|
|
|
|
|
2017-11-27 09:13:12 +04:00
|
|
|
type directory_descr = Data_encoding.json_schema Description.directory
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-11-27 09:13:12 +04:00
|
|
|
val empty: 'a directory
|
2016-09-08 21:13:10 +04:00
|
|
|
val register:
|
|
|
|
'prefix directory ->
|
|
|
|
('prefix, 'params, 'input, 'output) service ->
|
2017-11-27 09:13:12 +04:00
|
|
|
('params -> 'input -> [< ('output, unit) RestoDirectory.Answer.t ] Lwt.t) ->
|
2016-09-08 21:13:10 +04:00
|
|
|
'prefix directory
|
|
|
|
|
|
|
|
val register0:
|
|
|
|
unit directory ->
|
|
|
|
(unit, unit, 'i, 'o) service ->
|
2017-11-27 09:13:12 +04:00
|
|
|
('i -> [< ('o, unit) Answer.t ] Lwt.t) ->
|
2016-09-08 21:13:10 +04:00
|
|
|
unit directory
|
|
|
|
|
|
|
|
val register1:
|
|
|
|
'prefix directory ->
|
|
|
|
('prefix, unit * 'a, 'i, 'o) service ->
|
2017-11-27 09:13:12 +04:00
|
|
|
('a -> 'i -> [< ('o, unit) Answer.t ] Lwt.t) ->
|
2016-09-08 21:13:10 +04:00
|
|
|
'prefix directory
|
|
|
|
|
|
|
|
val register2:
|
|
|
|
'prefix directory ->
|
|
|
|
('prefix, (unit * 'a) * 'b, 'i, 'o) service ->
|
2017-11-27 09:13:12 +04:00
|
|
|
('a -> 'b -> 'i -> [< ('o, unit) Answer.t ] Lwt.t) ->
|
2016-09-08 21:13:10 +04:00
|
|
|
'prefix directory
|
|
|
|
|
|
|
|
val register_dynamic_directory1:
|
|
|
|
?descr:string ->
|
|
|
|
'prefix directory ->
|
|
|
|
('prefix, unit * 'a) Path.path ->
|
|
|
|
('a -> (unit * 'a) directory Lwt.t) ->
|
|
|
|
'prefix directory
|
|
|
|
|
2017-11-27 09:13:12 +04:00
|
|
|
val forge_request:
|
|
|
|
(unit, 'params, 'input, _) service ->
|
|
|
|
'params -> 'input -> MethMap.key * string list * Data_encoding.json
|
2016-09-08 21:13:10 +04:00
|
|
|
|