Source file api.ml
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
module Google = struct
module Protobuf = struct
module rec Api : sig
val name': unit -> string
type t = { name: string; methods: Method.t list; options: Type.Google.Protobuf.Option.t list; version: string; source_context: Source_context.Google.Protobuf.SourceContext.t option; mixins: Mixin.t list; syntax: Type.Google.Protobuf.Syntax.t }
val to_proto: t -> Ocaml_protoc_plugin.Writer.t
val from_proto: Ocaml_protoc_plugin.Reader.t -> t Ocaml_protoc_plugin.Result.t
end = struct
let name' () = "Api.google.protobuf.Api"
type t = { name: string; methods: Method.t list; options: Type.Google.Protobuf.Option.t list; version: string; source_context: Source_context.Google.Protobuf.SourceContext.t option; mixins: Mixin.t list; syntax: Type.Google.Protobuf.Syntax.t }
let to_proto =
let apply = fun ~f:f' { name; methods; options; version; source_context; mixins; syntax } -> f' name methods options version source_context mixins syntax in
let spec = Ocaml_protoc_plugin.Serialize.C.( basic (1, string, proto3) ^:: repeated (2, (message Method.to_proto), not_packed) ^:: repeated (3, (message Type.Google.Protobuf.Option.to_proto), not_packed) ^:: basic (4, string, proto3) ^:: basic_opt (5, (message Source_context.Google.Protobuf.SourceContext.to_proto)) ^:: repeated (6, (message Mixin.to_proto), not_packed) ^:: basic (7, (enum Type.Google.Protobuf.Syntax.to_int), proto3) ^:: nil ) in
let serialize = Ocaml_protoc_plugin.Serialize.serialize (spec) in
fun t -> apply ~f:(serialize ()) t
let from_proto =
let constructor = fun name methods options version source_context mixins syntax -> { name; methods; options; version; source_context; mixins; syntax } in
let spec = Ocaml_protoc_plugin.Deserialize.C.( basic (1, string, proto3) ^:: repeated (2, (message Method.from_proto), not_packed) ^:: repeated (3, (message Type.Google.Protobuf.Option.from_proto), not_packed) ^:: basic (4, string, proto3) ^:: basic_opt (5, (message Source_context.Google.Protobuf.SourceContext.from_proto)) ^:: repeated (6, (message Mixin.from_proto), not_packed) ^:: basic (7, (enum Type.Google.Protobuf.Syntax.from_int), proto3) ^:: nil ) in
let deserialize = Ocaml_protoc_plugin.Deserialize.deserialize (spec) constructor in
fun writer -> deserialize writer
end
and Method : sig
val name': unit -> string
type t = { name: string; request_type_url: string; request_streaming: bool; response_type_url: string; response_streaming: bool; options: Type.Google.Protobuf.Option.t list; syntax: Type.Google.Protobuf.Syntax.t }
val to_proto: t -> Ocaml_protoc_plugin.Writer.t
val from_proto: Ocaml_protoc_plugin.Reader.t -> t Ocaml_protoc_plugin.Result.t
end = struct
let name' () = "Api.google.protobuf.Method"
type t = { name: string; request_type_url: string; request_streaming: bool; response_type_url: string; response_streaming: bool; options: Type.Google.Protobuf.Option.t list; syntax: Type.Google.Protobuf.Syntax.t }
let to_proto =
let apply = fun ~f:f' { name; request_type_url; request_streaming; response_type_url; response_streaming; options; syntax } -> f' name request_type_url request_streaming response_type_url response_streaming options syntax in
let spec = Ocaml_protoc_plugin.Serialize.C.( basic (1, string, proto3) ^:: basic (2, string, proto3) ^:: basic (3, bool, proto3) ^:: basic (4, string, proto3) ^:: basic (5, bool, proto3) ^:: repeated (6, (message Type.Google.Protobuf.Option.to_proto), not_packed) ^:: basic (7, (enum Type.Google.Protobuf.Syntax.to_int), proto3) ^:: nil ) in
let serialize = Ocaml_protoc_plugin.Serialize.serialize (spec) in
fun t -> apply ~f:(serialize ()) t
let from_proto =
let constructor = fun name request_type_url request_streaming response_type_url response_streaming options syntax -> { name; request_type_url; request_streaming; response_type_url; response_streaming; options; syntax } in
let spec = Ocaml_protoc_plugin.Deserialize.C.( basic (1, string, proto3) ^:: basic (2, string, proto3) ^:: basic (3, bool, proto3) ^:: basic (4, string, proto3) ^:: basic (5, bool, proto3) ^:: repeated (6, (message Type.Google.Protobuf.Option.from_proto), not_packed) ^:: basic (7, (enum Type.Google.Protobuf.Syntax.from_int), proto3) ^:: nil ) in
let deserialize = Ocaml_protoc_plugin.Deserialize.deserialize (spec) constructor in
fun writer -> deserialize writer
end
and Mixin : sig
val name': unit -> string
type t = { name: string; root: string }
val to_proto: t -> Ocaml_protoc_plugin.Writer.t
val from_proto: Ocaml_protoc_plugin.Reader.t -> t Ocaml_protoc_plugin.Result.t
end = struct
let name' () = "Api.google.protobuf.Mixin"
type t = { name: string; root: string }
let to_proto =
let apply = fun ~f:f' { name; root } -> f' name root in
let spec = Ocaml_protoc_plugin.Serialize.C.( basic (1, string, proto3) ^:: basic (2, string, proto3) ^:: nil ) in
let serialize = Ocaml_protoc_plugin.Serialize.serialize (spec) in
fun t -> apply ~f:(serialize ()) t
let from_proto =
let constructor = fun name root -> { name; root } in
let spec = Ocaml_protoc_plugin.Deserialize.C.( basic (1, string, proto3) ^:: basic (2, string, proto3) ^:: nil ) in
let deserialize = Ocaml_protoc_plugin.Deserialize.deserialize (spec) constructor in
fun writer -> deserialize writer
end
end
end