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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
open Ocaml_protoc_plugin.Runtime [@@warning "-33"]
(**/**)
module Imported'modules = struct
module Source_context = Source_context
module Type = Type
end
(**/**)
module rec Google : sig
module rec Protobuf : sig
module rec Api : sig
val name': unit -> string
type t = { name: string; methods: Method.t list; options: Imported'modules.Type.Google.Protobuf.Option.t list; version: string; source_context: Imported'modules.Source_context.Google.Protobuf.SourceContext.t option; mixins: Mixin.t list; syntax: Imported'modules.Type.Google.Protobuf.Syntax.t }
val make: ?name:string -> ?methods:Method.t list -> ?options:Imported'modules.Type.Google.Protobuf.Option.t list -> ?version:string -> ?source_context:Imported'modules.Source_context.Google.Protobuf.SourceContext.t -> ?mixins:Mixin.t list -> ?syntax:Imported'modules.Type.Google.Protobuf.Syntax.t -> unit -> t
val merge: t -> t -> t
val to_proto': Runtime'.Writer.t -> t -> Runtime'.Writer.t
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
val from_proto_exn: Runtime'.Reader.t -> t
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: Imported'modules.Type.Google.Protobuf.Option.t list; syntax: Imported'modules.Type.Google.Protobuf.Syntax.t }
val make: ?name:string -> ?request_type_url:string -> ?request_streaming:bool -> ?response_type_url:string -> ?response_streaming:bool -> ?options:Imported'modules.Type.Google.Protobuf.Option.t list -> ?syntax:Imported'modules.Type.Google.Protobuf.Syntax.t -> unit -> t
val merge: t -> t -> t
val to_proto': Runtime'.Writer.t -> t -> Runtime'.Writer.t
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
val from_proto_exn: Runtime'.Reader.t -> t
end
and Mixin : sig
val name': unit -> string
type t = { name: string; root: string }
val make: ?name:string -> ?root:string -> unit -> t
val merge: t -> t -> t
val to_proto': Runtime'.Writer.t -> t -> Runtime'.Writer.t
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
val from_proto_exn: Runtime'.Reader.t -> t
end
end
end = struct
module rec Protobuf : sig
module rec Api : sig
val name': unit -> string
type t = { name: string; methods: Method.t list; options: Imported'modules.Type.Google.Protobuf.Option.t list; version: string; source_context: Imported'modules.Source_context.Google.Protobuf.SourceContext.t option; mixins: Mixin.t list; syntax: Imported'modules.Type.Google.Protobuf.Syntax.t }
val make: ?name:string -> ?methods:Method.t list -> ?options:Imported'modules.Type.Google.Protobuf.Option.t list -> ?version:string -> ?source_context:Imported'modules.Source_context.Google.Protobuf.SourceContext.t -> ?mixins:Mixin.t list -> ?syntax:Imported'modules.Type.Google.Protobuf.Syntax.t -> unit -> t
val merge: t -> t -> t
val to_proto': Runtime'.Writer.t -> t -> Runtime'.Writer.t
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
val from_proto_exn: Runtime'.Reader.t -> t
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: Imported'modules.Type.Google.Protobuf.Option.t list; syntax: Imported'modules.Type.Google.Protobuf.Syntax.t }
val make: ?name:string -> ?request_type_url:string -> ?request_streaming:bool -> ?response_type_url:string -> ?response_streaming:bool -> ?options:Imported'modules.Type.Google.Protobuf.Option.t list -> ?syntax:Imported'modules.Type.Google.Protobuf.Syntax.t -> unit -> t
val merge: t -> t -> t
val to_proto': Runtime'.Writer.t -> t -> Runtime'.Writer.t
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
val from_proto_exn: Runtime'.Reader.t -> t
end
and Mixin : sig
val name': unit -> string
type t = { name: string; root: string }
val make: ?name:string -> ?root:string -> unit -> t
val merge: t -> t -> t
val to_proto': Runtime'.Writer.t -> t -> Runtime'.Writer.t
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
val from_proto_exn: Runtime'.Reader.t -> t
end
end = struct
module rec Api : sig
val name': unit -> string
type t = { name: string; methods: Method.t list; options: Imported'modules.Type.Google.Protobuf.Option.t list; version: string; source_context: Imported'modules.Source_context.Google.Protobuf.SourceContext.t option; mixins: Mixin.t list; syntax: Imported'modules.Type.Google.Protobuf.Syntax.t }
val make: ?name:string -> ?methods:Method.t list -> ?options:Imported'modules.Type.Google.Protobuf.Option.t list -> ?version:string -> ?source_context:Imported'modules.Source_context.Google.Protobuf.SourceContext.t -> ?mixins:Mixin.t list -> ?syntax:Imported'modules.Type.Google.Protobuf.Syntax.t -> unit -> t
val merge: t -> t -> t
val to_proto': Runtime'.Writer.t -> t -> Runtime'.Writer.t
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
val from_proto_exn: Runtime'.Reader.t -> t
end = struct
let name' () = "api.google.protobuf.Api"
type t = { name: string; methods: Method.t list; options: Imported'modules.Type.Google.Protobuf.Option.t list; version: string; source_context: Imported'modules.Source_context.Google.Protobuf.SourceContext.t option; mixins: Mixin.t list; syntax: Imported'modules.Type.Google.Protobuf.Syntax.t }
let make ?(name = {||}) ?(methods = []) ?(options = []) ?(version = {||}) ?source_context ?(mixins = []) ?(syntax = Imported'modules.Type.Google.Protobuf.Syntax.SYNTAX_PROTO2) () = { name; methods; options; version; source_context; mixins; syntax }
let merge = (fun t1 t2 -> {
name = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic (1, string, ({||})) ) t1.name t2.name);
methods = (Runtime'.Merge.merge Runtime'.Deserialize.C.( repeated (2, (message ((fun writer -> Method.from_proto_exn writer), Method.merge)), not_packed) ) t1.methods t2.methods);
options = (Runtime'.Merge.merge Runtime'.Deserialize.C.( repeated (3, (message ((fun writer -> Imported'modules.Type.Google.Protobuf.Option.from_proto_exn writer), Imported'modules.Type.Google.Protobuf.Option.merge)), not_packed) ) t1.options t2.options);
version = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic (4, string, ({||})) ) t1.version t2.version);
source_context = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic_opt (5, (message ((fun writer -> Imported'modules.Source_context.Google.Protobuf.SourceContext.from_proto_exn writer), Imported'modules.Source_context.Google.Protobuf.SourceContext.merge))) ) t1.source_context t2.source_context);
mixins = (Runtime'.Merge.merge Runtime'.Deserialize.C.( repeated (6, (message ((fun writer -> Mixin.from_proto_exn writer), Mixin.merge)), not_packed) ) t1.mixins t2.mixins);
syntax = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic (7, (enum Imported'modules.Type.Google.Protobuf.Syntax.from_int_exn), (Imported'modules.Type.Google.Protobuf.Syntax.SYNTAX_PROTO2)) ) t1.syntax t2.syntax);
})
let to_proto' =
let spec = Runtime'.Serialize.C.( basic (1, string, ({||})) ^:: repeated (2, (message Method.to_proto'), not_packed) ^:: repeated (3, (message Imported'modules.Type.Google.Protobuf.Option.to_proto'), not_packed) ^:: basic (4, string, ({||})) ^:: basic_opt (5, (message Imported'modules.Source_context.Google.Protobuf.SourceContext.to_proto')) ^:: repeated (6, (message Mixin.to_proto'), not_packed) ^:: basic (7, (enum Imported'modules.Type.Google.Protobuf.Syntax.to_int), (Imported'modules.Type.Google.Protobuf.Syntax.SYNTAX_PROTO2)) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize spec in
fun writer { name; methods; options; version; source_context; mixins; syntax } -> serialize writer name methods options version source_context mixins syntax
let to_proto t = to_proto' (Runtime'.Writer.init ()) t
let from_proto_exn =
let constructor = fun name methods options version source_context mixins syntax -> { name; methods; options; version; source_context; mixins; syntax } in
let spec = Runtime'.Deserialize.C.( basic (1, string, ({||})) ^:: repeated (2, (message ((fun writer -> Method.from_proto_exn writer), Method.merge)), not_packed) ^:: repeated (3, (message ((fun writer -> Imported'modules.Type.Google.Protobuf.Option.from_proto_exn writer), Imported'modules.Type.Google.Protobuf.Option.merge)), not_packed) ^:: basic (4, string, ({||})) ^:: basic_opt (5, (message ((fun writer -> Imported'modules.Source_context.Google.Protobuf.SourceContext.from_proto_exn writer), Imported'modules.Source_context.Google.Protobuf.SourceContext.merge))) ^:: repeated (6, (message ((fun writer -> Mixin.from_proto_exn writer), Mixin.merge)), not_packed) ^:: basic (7, (enum Imported'modules.Type.Google.Protobuf.Syntax.from_int_exn), (Imported'modules.Type.Google.Protobuf.Syntax.SYNTAX_PROTO2)) ^:: nil ) in
Runtime'.Deserialize.deserialize spec constructor
let from_proto writer = Runtime'.Result.catch (fun () -> from_proto_exn 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: Imported'modules.Type.Google.Protobuf.Option.t list; syntax: Imported'modules.Type.Google.Protobuf.Syntax.t }
val make: ?name:string -> ?request_type_url:string -> ?request_streaming:bool -> ?response_type_url:string -> ?response_streaming:bool -> ?options:Imported'modules.Type.Google.Protobuf.Option.t list -> ?syntax:Imported'modules.Type.Google.Protobuf.Syntax.t -> unit -> t
val merge: t -> t -> t
val to_proto': Runtime'.Writer.t -> t -> Runtime'.Writer.t
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
val from_proto_exn: Runtime'.Reader.t -> 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: Imported'modules.Type.Google.Protobuf.Option.t list; syntax: Imported'modules.Type.Google.Protobuf.Syntax.t }
let make ?(name = {||}) ?(request_type_url = {||}) ?(request_streaming = false) ?(response_type_url = {||}) ?(response_streaming = false) ?(options = []) ?(syntax = Imported'modules.Type.Google.Protobuf.Syntax.SYNTAX_PROTO2) () = { name; request_type_url; request_streaming; response_type_url; response_streaming; options; syntax }
let merge = (fun t1 t2 -> {
name = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic (1, string, ({||})) ) t1.name t2.name);
request_type_url = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic (2, string, ({||})) ) t1.request_type_url t2.request_type_url);
request_streaming = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic (3, bool, (false)) ) t1.request_streaming t2.request_streaming);
response_type_url = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic (4, string, ({||})) ) t1.response_type_url t2.response_type_url);
response_streaming = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic (5, bool, (false)) ) t1.response_streaming t2.response_streaming);
options = (Runtime'.Merge.merge Runtime'.Deserialize.C.( repeated (6, (message ((fun writer -> Imported'modules.Type.Google.Protobuf.Option.from_proto_exn writer), Imported'modules.Type.Google.Protobuf.Option.merge)), not_packed) ) t1.options t2.options);
syntax = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic (7, (enum Imported'modules.Type.Google.Protobuf.Syntax.from_int_exn), (Imported'modules.Type.Google.Protobuf.Syntax.SYNTAX_PROTO2)) ) t1.syntax t2.syntax);
})
let to_proto' =
let spec = Runtime'.Serialize.C.( basic (1, string, ({||})) ^:: basic (2, string, ({||})) ^:: basic (3, bool, (false)) ^:: basic (4, string, ({||})) ^:: basic (5, bool, (false)) ^:: repeated (6, (message Imported'modules.Type.Google.Protobuf.Option.to_proto'), not_packed) ^:: basic (7, (enum Imported'modules.Type.Google.Protobuf.Syntax.to_int), (Imported'modules.Type.Google.Protobuf.Syntax.SYNTAX_PROTO2)) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize spec in
fun writer { name; request_type_url; request_streaming; response_type_url; response_streaming; options; syntax } -> serialize writer name request_type_url request_streaming response_type_url response_streaming options syntax
let to_proto t = to_proto' (Runtime'.Writer.init ()) t
let from_proto_exn =
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 = Runtime'.Deserialize.C.( basic (1, string, ({||})) ^:: basic (2, string, ({||})) ^:: basic (3, bool, (false)) ^:: basic (4, string, ({||})) ^:: basic (5, bool, (false)) ^:: repeated (6, (message ((fun writer -> Imported'modules.Type.Google.Protobuf.Option.from_proto_exn writer), Imported'modules.Type.Google.Protobuf.Option.merge)), not_packed) ^:: basic (7, (enum Imported'modules.Type.Google.Protobuf.Syntax.from_int_exn), (Imported'modules.Type.Google.Protobuf.Syntax.SYNTAX_PROTO2)) ^:: nil ) in
Runtime'.Deserialize.deserialize spec constructor
let from_proto writer = Runtime'.Result.catch (fun () -> from_proto_exn writer)
end
and Mixin : sig
val name': unit -> string
type t = { name: string; root: string }
val make: ?name:string -> ?root:string -> unit -> t
val merge: t -> t -> t
val to_proto': Runtime'.Writer.t -> t -> Runtime'.Writer.t
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
val from_proto_exn: Runtime'.Reader.t -> t
end = struct
let name' () = "api.google.protobuf.Mixin"
type t = { name: string; root: string }
let make ?(name = {||}) ?(root = {||}) () = { name; root }
let merge = (fun t1 t2 -> {
name = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic (1, string, ({||})) ) t1.name t2.name);
root = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic (2, string, ({||})) ) t1.root t2.root);
})
let to_proto' =
let spec = Runtime'.Serialize.C.( basic (1, string, ({||})) ^:: basic (2, string, ({||})) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize spec in
fun writer { name; root } -> serialize writer name root
let to_proto t = to_proto' (Runtime'.Writer.init ()) t
let from_proto_exn =
let constructor = fun name root -> { name; root } in
let spec = Runtime'.Deserialize.C.( basic (1, string, ({||})) ^:: basic (2, string, ({||})) ^:: nil ) in
Runtime'.Deserialize.deserialize spec constructor
let from_proto writer = Runtime'.Result.catch (fun () -> from_proto_exn writer)
end
end
end