2 @generated by mypy-protobuf. Do not edit manually!
6 import google.protobuf.descriptor
7 import google.protobuf.internal.well_known_types
8 import google.protobuf.message
10 import typing_extensions
12 DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ...
14 class Any(google.protobuf.message.Message, google.protobuf.internal.well_known_types.Any):
15 """`Any` contains an arbitrary serialized protocol buffer message along with a
16 URL that describes the type of the serialized message.
18 Protobuf library provides support to pack/unpack Any values in the form
19 of utility functions or additional generated methods of the Any type.
21 Example 1: Pack and unpack a message in C++.
27 if (any.UnpackTo(&foo)) {
31 Example 2: Pack and unpack a message in Java.
34 Any any = Any.pack(foo);
36 if (any.is(Foo.class)) {
37 foo = any.unpack(Foo.class);
40 Example 3: Pack and unpack a message in Python.
46 if any.Is(Foo.DESCRIPTOR):
50 Example 4: Pack and unpack a message in Go
53 any, err := anypb.New(foo)
59 if err := any.UnmarshalTo(foo); err != nil {
63 The pack methods provided by protobuf library will by default use
64 'type.googleapis.com/full.type.name' as the type URL and the unpack
65 methods only use the fully qualified type name after the last '/'
66 in the type URL, for example "foo.bar.com/x/y.z" will yield type
72 The JSON representation of an `Any` value uses the regular
73 representation of the deserialized, embedded message, with an
74 additional field `@type` which contains the type URL. Example:
76 package google.profile;
78 string first_name = 1;
83 "@type": "type.googleapis.com/google.profile.Person",
84 "firstName": <string>,
88 If the embedded message type is well-known and has a custom JSON
89 representation, that representation will be embedded adding a field
90 `value` which holds the custom JSON in addition to the `@type`
91 field. Example (for message [google.protobuf.Duration][]):
94 "@type": "type.googleapis.com/google.protobuf.Duration",
98 DESCRIPTOR: google.protobuf.descriptor.Descriptor = ...
99 TYPE_URL_FIELD_NUMBER: builtins.int
100 VALUE_FIELD_NUMBER: builtins.int
101 type_url: typing.Text = ...
102 """A URL/resource name that uniquely identifies the type of the serialized
103 protocol buffer message. This string must contain at least
104 one "/" character. The last segment of the URL's path must represent
105 the fully qualified name of the type (as in
106 `path/google.protobuf.Duration`). The name should be in a canonical form
107 (e.g., leading "." is not accepted).
109 In practice, teams usually precompile into the binary all types that they
110 expect it to use in the context of Any. However, for URLs which use the
111 scheme `http`, `https`, or no scheme, one can optionally set up a type
112 server that maps type URLs to message definitions as follows:
114 * If no scheme is provided, `https` is assumed.
115 * An HTTP GET on the URL must yield a [google.protobuf.Type][]
116 value in binary format, or produce an error.
117 * Applications are allowed to cache lookup results based on the
118 URL, or have them precompiled into a binary to avoid any
119 lookup. Therefore, binary compatibility needs to be preserved
120 on changes to types. (Use versioned type names to manage
123 Note: this functionality is not currently available in the official
124 protobuf release, and it is not used for type URLs beginning with
127 Schemes other than `http`, `https` (or the empty scheme) might be
128 used with implementation specific semantics.
131 value: builtins.bytes = ...
132 """Must be a valid serialized protocol buffer of the above specified type."""
136 type_url : typing.Text = ...,
137 value : builtins.bytes = ...,
139 def ClearField(self, field_name: typing_extensions.Literal["type_url",b"type_url","value",b"value"]) -> None: ...