123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456(********************************************************)(* AUTOGENERATED FILE - DO NOT EDIT! *)(********************************************************)(* Generated by: ocaml-protoc-plugin *)(* https://github.com/andersfugmann/ocaml-protoc-plugin *)(********************************************************)(*
Source: google/protobuf/any.proto
Syntax: proto3
Parameters:
debug=false
annot=''
opens=[]
int64_as_int=true
int32_as_int=true
fixed_as_int=false
singleton_record=false
prefix_output_with_package=false
*)[@@@ocaml.alert"-protobuf"](* Disable deprecation warnings for protobuf*)(**/**)moduleRuntime'=Ocaml_protoc_plugin[@@warning"-33"]moduleImported'modules=structend(**/**)modulerecGoogle:sigmodulerecProtobuf:sig(**
{%html:
<p><code>Any</code> contains an arbitrary serialized protocol buffer message along with a
URL that describes the type of the serialized message.</p>
<p>Protobuf library provides support to pack/unpack Any values in the form
of utility functions or additional generated methods of the Any type.</p>
<p>Example 1: Pack and unpack a message in C++.</p>
<pre><code> Foo foo = ...;
Any any;
any.PackFrom(foo);
...
if (any.UnpackTo(&foo)) {
...
}
</code></pre>
<p>Example 2: Pack and unpack a message in Java.</p>
<pre><code> Foo foo = ...;
Any any = Any.pack(foo);
...
if (any.is(Foo.class)) {
foo = any.unpack(Foo.class);
}
</code></pre>
<p>or ...</p>
<pre><code> if (any.isSameTypeAs(Foo.getDefaultInstance())) {
foo = any.unpack(Foo.getDefaultInstance());
}
</code></pre>
<p>Example 3: Pack and unpack a message in Python.</p>
<pre><code> foo = Foo(...)
any = Any()
any.Pack(foo)
...
if any.Is(Foo.DESCRIPTOR):
any.Unpack(foo)
...
</code></pre>
<p>Example 4: Pack and unpack a message in Go</p>
<pre><code> foo := &pb.Foo{...}
any, err := anypb.New(foo)
if err != nil {
...
}
...
foo := &pb.Foo{}
if err := any.UnmarshalTo(foo); err != nil {
...
}
</code></pre>
<p>The pack methods provided by protobuf library will by default use
'type.googleapis.com/full.type.name' as the type URL and the unpack
methods only use the fully qualified type name after the last '/'
in the type URL, for example "foo.bar.com/x/y.z" will yield type
name "y.z".</p>
<h1 id="json">JSON</h1>
<p>The JSON representation of an <code>Any</code> value uses the regular
representation of the deserialized, embedded message, with an
additional field <code>@type</code> which contains the type URL. Example:</p>
<pre><code> package google.profile;
message Person {
string first_name = 1;
string last_name = 2;
}
{
"@type": "type.googleapis.com/google.profile.Person",
"firstName": <string>,
"lastName": <string>
}
</code></pre>
<p>If the embedded message type is well-known and has a custom JSON
representation, that representation will be embedded adding a field
<code>value</code> which holds the custom JSON in addition to the <code>@type</code>
field. Example (for message <em>google.protobuf.Duration</em>):</p>
<pre><code> {
"@type": "type.googleapis.com/google.protobuf.Duration",
"value": "1.212s"
}
</code></pre>
%}
*)modulerecAny:sigtypet={type_url:string;(**
{%html:
<p>A URL/resource name that uniquely identifies the type of the serialized
protocol buffer message. This string must contain at least
one "/" character. The last segment of the URL's path must represent
the fully qualified name of the type (as in
<code>path/google.protobuf.Duration</code>). The name should be in a canonical form
(e.g., leading "." is not accepted).</p>
<p>In practice, teams usually precompile into the binary all types that they
expect it to use in the context of Any. However, for URLs which use the
scheme <code>http</code>, <code>https</code>, or no scheme, one can optionally set up a type
server that maps type URLs to message definitions as follows:</p>
<ul>
<li>
<p>If no scheme is provided, <code>https</code> is assumed.</p>
</li>
<li>
<p>An HTTP GET on the URL must yield a <em>google.protobuf.Type</em></p>
<p>value in binary format, or produce an error.</p>
</li>
<li>
<p>Applications are allowed to cache lookup results based on the</p>
<p>URL, or have them precompiled into a binary to avoid any
lookup. Therefore, binary compatibility needs to be preserved
on changes to types. (Use versioned type names to manage
breaking changes.)</p>
</li>
</ul>
<p>Note: this functionality is not currently available in the official
protobuf release, and it is not used for type URLs beginning with
type.googleapis.com. As of May 2023, there are no widely used type server
implementations and no plans to implement one.</p>
<p>Schemes other than <code>http</code>, <code>https</code> (or the empty scheme) might be
used with implementation specific semantics.</p>
%}
*)value:bytes;(**
{%html:
<p>Must be a valid serialized protocol buffer of the above specified type.</p>
%}
*)}valmake:?type_url:string->?value:bytes->unit->t(** Helper function to generate a message using default values *)valto_proto:t->Runtime'.Writer.t(** Serialize the message to binary format *)valfrom_proto:Runtime'.Reader.t->(t,[>Runtime'.Result.error])result(** Deserialize from binary format *)valto_json:Runtime'.Json_options.t->t->Runtime'.Json.t(** Serialize to Json (compatible with Yojson.Basic.t) *)valfrom_json:Runtime'.Json.t->(t,[>Runtime'.Result.error])result(** Deserialize from Json (compatible with Yojson.Basic.t) *)valname:unit->string(** Fully qualified protobuf name of this message *)(**/**)typemake_t=?type_url:string->?value:bytes->unit->tvalmerge:t->t->tvalto_proto':Runtime'.Writer.t->t->unitvalfrom_proto_exn:Runtime'.Reader.t->tvalfrom_json_exn:Runtime'.Json.t->t(**/**)endendend=structmodulerecProtobuf:sig(**
{%html:
<p><code>Any</code> contains an arbitrary serialized protocol buffer message along with a
URL that describes the type of the serialized message.</p>
<p>Protobuf library provides support to pack/unpack Any values in the form
of utility functions or additional generated methods of the Any type.</p>
<p>Example 1: Pack and unpack a message in C++.</p>
<pre><code> Foo foo = ...;
Any any;
any.PackFrom(foo);
...
if (any.UnpackTo(&foo)) {
...
}
</code></pre>
<p>Example 2: Pack and unpack a message in Java.</p>
<pre><code> Foo foo = ...;
Any any = Any.pack(foo);
...
if (any.is(Foo.class)) {
foo = any.unpack(Foo.class);
}
</code></pre>
<p>or ...</p>
<pre><code> if (any.isSameTypeAs(Foo.getDefaultInstance())) {
foo = any.unpack(Foo.getDefaultInstance());
}
</code></pre>
<p>Example 3: Pack and unpack a message in Python.</p>
<pre><code> foo = Foo(...)
any = Any()
any.Pack(foo)
...
if any.Is(Foo.DESCRIPTOR):
any.Unpack(foo)
...
</code></pre>
<p>Example 4: Pack and unpack a message in Go</p>
<pre><code> foo := &pb.Foo{...}
any, err := anypb.New(foo)
if err != nil {
...
}
...
foo := &pb.Foo{}
if err := any.UnmarshalTo(foo); err != nil {
...
}
</code></pre>
<p>The pack methods provided by protobuf library will by default use
'type.googleapis.com/full.type.name' as the type URL and the unpack
methods only use the fully qualified type name after the last '/'
in the type URL, for example "foo.bar.com/x/y.z" will yield type
name "y.z".</p>
<h1 id="json">JSON</h1>
<p>The JSON representation of an <code>Any</code> value uses the regular
representation of the deserialized, embedded message, with an
additional field <code>@type</code> which contains the type URL. Example:</p>
<pre><code> package google.profile;
message Person {
string first_name = 1;
string last_name = 2;
}
{
"@type": "type.googleapis.com/google.profile.Person",
"firstName": <string>,
"lastName": <string>
}
</code></pre>
<p>If the embedded message type is well-known and has a custom JSON
representation, that representation will be embedded adding a field
<code>value</code> which holds the custom JSON in addition to the <code>@type</code>
field. Example (for message <em>google.protobuf.Duration</em>):</p>
<pre><code> {
"@type": "type.googleapis.com/google.protobuf.Duration",
"value": "1.212s"
}
</code></pre>
%}
*)modulerecAny:sigtypet={type_url:string;(**
{%html:
<p>A URL/resource name that uniquely identifies the type of the serialized
protocol buffer message. This string must contain at least
one "/" character. The last segment of the URL's path must represent
the fully qualified name of the type (as in
<code>path/google.protobuf.Duration</code>). The name should be in a canonical form
(e.g., leading "." is not accepted).</p>
<p>In practice, teams usually precompile into the binary all types that they
expect it to use in the context of Any. However, for URLs which use the
scheme <code>http</code>, <code>https</code>, or no scheme, one can optionally set up a type
server that maps type URLs to message definitions as follows:</p>
<ul>
<li>
<p>If no scheme is provided, <code>https</code> is assumed.</p>
</li>
<li>
<p>An HTTP GET on the URL must yield a <em>google.protobuf.Type</em></p>
<p>value in binary format, or produce an error.</p>
</li>
<li>
<p>Applications are allowed to cache lookup results based on the</p>
<p>URL, or have them precompiled into a binary to avoid any
lookup. Therefore, binary compatibility needs to be preserved
on changes to types. (Use versioned type names to manage
breaking changes.)</p>
</li>
</ul>
<p>Note: this functionality is not currently available in the official
protobuf release, and it is not used for type URLs beginning with
type.googleapis.com. As of May 2023, there are no widely used type server
implementations and no plans to implement one.</p>
<p>Schemes other than <code>http</code>, <code>https</code> (or the empty scheme) might be
used with implementation specific semantics.</p>
%}
*)value:bytes;(**
{%html:
<p>Must be a valid serialized protocol buffer of the above specified type.</p>
%}
*)}valmake:?type_url:string->?value:bytes->unit->t(** Helper function to generate a message using default values *)valto_proto:t->Runtime'.Writer.t(** Serialize the message to binary format *)valfrom_proto:Runtime'.Reader.t->(t,[>Runtime'.Result.error])result(** Deserialize from binary format *)valto_json:Runtime'.Json_options.t->t->Runtime'.Json.t(** Serialize to Json (compatible with Yojson.Basic.t) *)valfrom_json:Runtime'.Json.t->(t,[>Runtime'.Result.error])result(** Deserialize from Json (compatible with Yojson.Basic.t) *)valname:unit->string(** Fully qualified protobuf name of this message *)(**/**)typemake_t=?type_url:string->?value:bytes->unit->tvalmerge:t->t->tvalto_proto':Runtime'.Writer.t->t->unitvalfrom_proto_exn:Runtime'.Reader.t->tvalfrom_json_exn:Runtime'.Json.t->t(**/**)endend=structmodulerecAny:sigtypet={type_url:string;(**
{%html:
<p>A URL/resource name that uniquely identifies the type of the serialized
protocol buffer message. This string must contain at least
one "/" character. The last segment of the URL's path must represent
the fully qualified name of the type (as in
<code>path/google.protobuf.Duration</code>). The name should be in a canonical form
(e.g., leading "." is not accepted).</p>
<p>In practice, teams usually precompile into the binary all types that they
expect it to use in the context of Any. However, for URLs which use the
scheme <code>http</code>, <code>https</code>, or no scheme, one can optionally set up a type
server that maps type URLs to message definitions as follows:</p>
<ul>
<li>
<p>If no scheme is provided, <code>https</code> is assumed.</p>
</li>
<li>
<p>An HTTP GET on the URL must yield a <em>google.protobuf.Type</em></p>
<p>value in binary format, or produce an error.</p>
</li>
<li>
<p>Applications are allowed to cache lookup results based on the</p>
<p>URL, or have them precompiled into a binary to avoid any
lookup. Therefore, binary compatibility needs to be preserved
on changes to types. (Use versioned type names to manage
breaking changes.)</p>
</li>
</ul>
<p>Note: this functionality is not currently available in the official
protobuf release, and it is not used for type URLs beginning with
type.googleapis.com. As of May 2023, there are no widely used type server
implementations and no plans to implement one.</p>
<p>Schemes other than <code>http</code>, <code>https</code> (or the empty scheme) might be
used with implementation specific semantics.</p>
%}
*)value:bytes;(**
{%html:
<p>Must be a valid serialized protocol buffer of the above specified type.</p>
%}
*)}valmake:?type_url:string->?value:bytes->unit->t(** Helper function to generate a message using default values *)valto_proto:t->Runtime'.Writer.t(** Serialize the message to binary format *)valfrom_proto:Runtime'.Reader.t->(t,[>Runtime'.Result.error])result(** Deserialize from binary format *)valto_json:Runtime'.Json_options.t->t->Runtime'.Json.t(** Serialize to Json (compatible with Yojson.Basic.t) *)valfrom_json:Runtime'.Json.t->(t,[>Runtime'.Result.error])result(** Deserialize from Json (compatible with Yojson.Basic.t) *)valname:unit->string(** Fully qualified protobuf name of this message *)(**/**)typemake_t=?type_url:string->?value:bytes->unit->tvalmerge:t->t->tvalto_proto':Runtime'.Writer.t->t->unitvalfrom_proto_exn:Runtime'.Reader.t->tvalfrom_json_exn:Runtime'.Json.t->t(**/**)end=structmoduleThis'_=Anyletname()=".google.protobuf.Any"typet={type_url:string;value:bytes;}typemake_t=?type_url:string->?value:bytes->unit->tletmake?(type_url={||})?(value=(Bytes.of_string{||}))()={type_url;value}letmerge=letmerge_type_url=Runtime'.Merge.mergeRuntime'.Spec.(basic((1,"type_url","typeUrl"),string,({||})))inletmerge_value=Runtime'.Merge.mergeRuntime'.Spec.(basic((2,"value","value"),bytes,((Bytes.of_string{||}))))infunt1t2->{type_url=(merge_type_urlt1.type_urlt2.type_url);value=(merge_valuet1.valuet2.value);}letspec()=Runtime'.Spec.(basic((1,"type_url","typeUrl"),string,({||}))^::basic((2,"value","value"),bytes,((Bytes.of_string{||})))^::nil)letto_proto'=letserialize=Runtime'.apply_lazy(fun()->Runtime'.Serialize.serialize(spec()))infunwriter{type_url;value}->serializewritertype_urlvalueletto_protot=letwriter=Runtime'.Writer.init()into_proto'writert;writerletfrom_proto_exn=letconstructortype_urlvalue={type_url;value}inRuntime'.apply_lazy(fun()->Runtime'.Deserialize.deserialize(spec())constructor)letfrom_protowriter=Runtime'.Result.catch(fun()->from_proto_exnwriter)letto_jsonoptions=letserialize=Runtime'.Serialize_json.serialize~message_name:(name())(spec())optionsinfun{type_url;value}->serializetype_urlvalueletfrom_json_exn=letconstructortype_urlvalue={type_url;value}inRuntime'.apply_lazy(fun()->Runtime'.Deserialize_json.deserialize~message_name:(name())(spec())constructor)letfrom_jsonjson=Runtime'.Result.catch(fun()->from_json_exnjson)endendend