2017-11-27 09:13:12 +04:00
|
|
|
(**************************************************************************)
|
|
|
|
(* ocplib-resto *)
|
|
|
|
(* Copyright (C) 2016, OCamlPro. *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. This file is distributed under the terms *)
|
|
|
|
(* of the GNU Lesser General Public License version 2.1, with the *)
|
|
|
|
(* special exception on linking described in the file LICENSE. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
|
|
|
open Resto
|
2017-12-07 20:43:21 +04:00
|
|
|
module Service = MakeService(Resto_json.Encoding)
|
2017-11-27 09:13:12 +04:00
|
|
|
open Service
|
|
|
|
|
|
|
|
(** Shared part *)
|
|
|
|
|
|
|
|
let repeat_service =
|
|
|
|
post_service
|
|
|
|
~query:Query.empty
|
|
|
|
~input:Json_encoding.any_ezjson_value
|
|
|
|
~output:Json_encoding.any_ezjson_value
|
|
|
|
~error:Json_encoding.empty
|
|
|
|
Path.(root / "foo" /: Arg.int / "repeat")
|
|
|
|
|
|
|
|
let add_service =
|
|
|
|
post_service
|
|
|
|
~query:Query.empty
|
|
|
|
~input:Json_encoding.int
|
|
|
|
~output:Json_encoding.int
|
|
|
|
~error:Json_encoding.empty
|
|
|
|
Path.(root / "foo" /: Arg.int / "add")
|
|
|
|
|
|
|
|
let alternate_add_service =
|
|
|
|
get_service
|
|
|
|
~query:Query.empty
|
|
|
|
~output:Json_encoding.float
|
|
|
|
~error:Json_encoding.empty
|
|
|
|
Path.(root / "bar" /: Arg.int /: Arg.float / "add")
|
|
|
|
|
|
|
|
let alternate_add_service' =
|
|
|
|
post_service
|
|
|
|
~query:Query.empty
|
|
|
|
~input:Json_encoding.null
|
|
|
|
~output:Json_encoding.int
|
|
|
|
~error:Json_encoding.empty
|
2018-02-11 22:28:51 +04:00
|
|
|
Path.(root / "bar" /: Arg.int /: Arg.float / "add")
|
2017-11-27 09:13:12 +04:00
|
|
|
|
|
|
|
let minus_service =
|
|
|
|
post_service
|
|
|
|
~query:Query.empty
|
|
|
|
~input:Json_encoding.null
|
|
|
|
~output:Json_encoding.float
|
|
|
|
~error:Json_encoding.empty
|
|
|
|
Path.(open_root /: Arg.int / "minus")
|
|
|
|
|
|
|
|
let describe_service =
|
2018-02-11 22:17:39 +04:00
|
|
|
description_service Json_encoding.empty Path.(root / "describe")
|
2017-11-27 09:13:12 +04:00
|
|
|
|
|
|
|
let dummy_service =
|
|
|
|
post_service
|
|
|
|
~query:Query.empty
|
|
|
|
~input:Json_encoding.null
|
|
|
|
~output:Json_encoding.null
|
|
|
|
~error:Json_encoding.empty
|
|
|
|
Path.(root / "a" / "path" / "long" / "enough" /
|
|
|
|
"for" / "<hov>" / "to" / "trigger"
|
|
|
|
/: Arg.float /: Arg.float /: Arg.float /: Arg.float
|
|
|
|
/: Arg.float /: Arg.float /: Arg.float)
|
|
|
|
|
|
|
|
let prefix_dir1 = Path.(root / "tartine" /: Arg.float / "chaussure")
|
|
|
|
|
|
|
|
|
|
|
|
(** Client only *)
|
|
|
|
|
|
|
|
let real_minus_service1 = Service.prefix prefix_dir1 minus_service
|