summaryrefslogtreecommitdiff
path: root/src/message.mli
blob: 306afb7024e2e27d152b3c4c69c9db9f79b2c3b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
exception Invalid_operation of string
exception Invalid_message of string

type operation =
    | Set of string list
    | Delete of string list
    | Show of (string list option) * ((string * string) list option)
    | GetValues of string list
    | Commit

type request = {
    session_id: string;
    operations: operation list
}

type response = {
    errors: string list;
    warnings: string list;
    data: string list
}

type raw_operation = {
    method_name: string;
    path: string list option;
    options: (string * string) list option
}

type raw_request = {
    raw_session_id: string;
    raw_operations: raw_operation list
}

val encode_request : request -> Yojson.Safe.json
val decode_request : Yojson.Safe.json -> request

val encode_response : response -> Yojson.Safe.json
val decode_response : Yojson.Safe.json -> response