• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?php
2# Generated by the protocol buffer compiler.  DO NOT EDIT!
3# source: google/protobuf/any.proto
4
5namespace Google\Protobuf;
6
7use Google\Protobuf\Internal\GPBType;
8use Google\Protobuf\Internal\RepeatedField;
9use Google\Protobuf\Internal\GPBUtil;
10
11/**
12 * `Any` contains an arbitrary serialized protocol buffer message along with a
13 * URL that describes the type of the serialized message.
14 * Protobuf library provides support to pack/unpack Any values in the form
15 * of utility functions or additional generated methods of the Any type.
16 * Example 1: Pack and unpack a message in C++.
17 *     Foo foo = ...;
18 *     Any any;
19 *     any.PackFrom(foo);
20 *     ...
21 *     if (any.UnpackTo(&foo)) {
22 *       ...
23 *     }
24 * Example 2: Pack and unpack a message in Java.
25 *     Foo foo = ...;
26 *     Any any = Any.pack(foo);
27 *     ...
28 *     if (any.is(Foo.class)) {
29 *       foo = any.unpack(Foo.class);
30 *     }
31 *     // or ...
32 *     if (any.isSameTypeAs(Foo.getDefaultInstance())) {
33 *       foo = any.unpack(Foo.getDefaultInstance());
34 *     }
35 * Example 3: Pack and unpack a message in Python.
36 *     foo = Foo(...)
37 *     any = Any()
38 *     any.Pack(foo)
39 *     ...
40 *     if any.Is(Foo.DESCRIPTOR):
41 *       any.Unpack(foo)
42 *       ...
43 * Example 4: Pack and unpack a message in Go
44 *      foo := &pb.Foo{...}
45 *      any, err := anypb.New(foo)
46 *      if err != nil {
47 *        ...
48 *      }
49 *      ...
50 *      foo := &pb.Foo{}
51 *      if err := any.UnmarshalTo(foo); err != nil {
52 *        ...
53 *      }
54 * The pack methods provided by protobuf library will by default use
55 * 'type.googleapis.com/full.type.name' as the type URL and the unpack
56 * methods only use the fully qualified type name after the last '/'
57 * in the type URL, for example "foo.bar.com/x/y.z" will yield type
58 * name "y.z".
59 * JSON
60 * The JSON representation of an `Any` value uses the regular
61 * representation of the deserialized, embedded message, with an
62 * additional field `&#64;type` which contains the type URL. Example:
63 *     package google.profile;
64 *     message Person {
65 *       string first_name = 1;
66 *       string last_name = 2;
67 *     }
68 *     {
69 *       "&#64;type": "type.googleapis.com/google.profile.Person",
70 *       "firstName": <string>,
71 *       "lastName": <string>
72 *     }
73 * If the embedded message type is well-known and has a custom JSON
74 * representation, that representation will be embedded adding a field
75 * `value` which holds the custom JSON in addition to the `&#64;type`
76 * field. Example (for message [google.protobuf.Duration][]):
77 *     {
78 *       "&#64;type": "type.googleapis.com/google.protobuf.Duration",
79 *       "value": "1.212s"
80 *     }
81 *
82 * Generated from protobuf message <code>google.protobuf.Any</code>
83 */
84class Any extends \Google\Protobuf\Internal\AnyBase
85{
86    /**
87     * A URL/resource name that uniquely identifies the type of the serialized
88     * protocol buffer message. This string must contain at least
89     * one "/" character. The last segment of the URL's path must represent
90     * the fully qualified name of the type (as in
91     * `path/google.protobuf.Duration`). The name should be in a canonical form
92     * (e.g., leading "." is not accepted).
93     * In practice, teams usually precompile into the binary all types that they
94     * expect it to use in the context of Any. However, for URLs which use the
95     * scheme `http`, `https`, or no scheme, one can optionally set up a type
96     * server that maps type URLs to message definitions as follows:
97     * * If no scheme is provided, `https` is assumed.
98     * * An HTTP GET on the URL must yield a [google.protobuf.Type][]
99     *   value in binary format, or produce an error.
100     * * Applications are allowed to cache lookup results based on the
101     *   URL, or have them precompiled into a binary to avoid any
102     *   lookup. Therefore, binary compatibility needs to be preserved
103     *   on changes to types. (Use versioned type names to manage
104     *   breaking changes.)
105     * Note: this functionality is not currently available in the official
106     * protobuf release, and it is not used for type URLs beginning with
107     * type.googleapis.com.
108     * Schemes other than `http`, `https` (or the empty scheme) might be
109     * used with implementation specific semantics.
110     *
111     * Generated from protobuf field <code>string type_url = 1;</code>
112     */
113    protected $type_url = '';
114    /**
115     * Must be a valid serialized protocol buffer of the above specified type.
116     *
117     * Generated from protobuf field <code>bytes value = 2;</code>
118     */
119    protected $value = '';
120
121    /**
122     * Constructor.
123     *
124     * @param array $data {
125     *     Optional. Data for populating the Message object.
126     *
127     *     @type string $type_url
128     *           A URL/resource name that uniquely identifies the type of the serialized
129     *           protocol buffer message. This string must contain at least
130     *           one "/" character. The last segment of the URL's path must represent
131     *           the fully qualified name of the type (as in
132     *           `path/google.protobuf.Duration`). The name should be in a canonical form
133     *           (e.g., leading "." is not accepted).
134     *           In practice, teams usually precompile into the binary all types that they
135     *           expect it to use in the context of Any. However, for URLs which use the
136     *           scheme `http`, `https`, or no scheme, one can optionally set up a type
137     *           server that maps type URLs to message definitions as follows:
138     *           * If no scheme is provided, `https` is assumed.
139     *           * An HTTP GET on the URL must yield a [google.protobuf.Type][]
140     *             value in binary format, or produce an error.
141     *           * Applications are allowed to cache lookup results based on the
142     *             URL, or have them precompiled into a binary to avoid any
143     *             lookup. Therefore, binary compatibility needs to be preserved
144     *             on changes to types. (Use versioned type names to manage
145     *             breaking changes.)
146     *           Note: this functionality is not currently available in the official
147     *           protobuf release, and it is not used for type URLs beginning with
148     *           type.googleapis.com.
149     *           Schemes other than `http`, `https` (or the empty scheme) might be
150     *           used with implementation specific semantics.
151     *     @type string $value
152     *           Must be a valid serialized protocol buffer of the above specified type.
153     * }
154     */
155    public function __construct($data = NULL) {
156        \GPBMetadata\Google\Protobuf\Any::initOnce();
157        parent::__construct($data);
158    }
159
160    /**
161     * A URL/resource name that uniquely identifies the type of the serialized
162     * protocol buffer message. This string must contain at least
163     * one "/" character. The last segment of the URL's path must represent
164     * the fully qualified name of the type (as in
165     * `path/google.protobuf.Duration`). The name should be in a canonical form
166     * (e.g., leading "." is not accepted).
167     * In practice, teams usually precompile into the binary all types that they
168     * expect it to use in the context of Any. However, for URLs which use the
169     * scheme `http`, `https`, or no scheme, one can optionally set up a type
170     * server that maps type URLs to message definitions as follows:
171     * * If no scheme is provided, `https` is assumed.
172     * * An HTTP GET on the URL must yield a [google.protobuf.Type][]
173     *   value in binary format, or produce an error.
174     * * Applications are allowed to cache lookup results based on the
175     *   URL, or have them precompiled into a binary to avoid any
176     *   lookup. Therefore, binary compatibility needs to be preserved
177     *   on changes to types. (Use versioned type names to manage
178     *   breaking changes.)
179     * Note: this functionality is not currently available in the official
180     * protobuf release, and it is not used for type URLs beginning with
181     * type.googleapis.com.
182     * Schemes other than `http`, `https` (or the empty scheme) might be
183     * used with implementation specific semantics.
184     *
185     * Generated from protobuf field <code>string type_url = 1;</code>
186     * @return string
187     */
188    public function getTypeUrl()
189    {
190        return $this->type_url;
191    }
192
193    /**
194     * A URL/resource name that uniquely identifies the type of the serialized
195     * protocol buffer message. This string must contain at least
196     * one "/" character. The last segment of the URL's path must represent
197     * the fully qualified name of the type (as in
198     * `path/google.protobuf.Duration`). The name should be in a canonical form
199     * (e.g., leading "." is not accepted).
200     * In practice, teams usually precompile into the binary all types that they
201     * expect it to use in the context of Any. However, for URLs which use the
202     * scheme `http`, `https`, or no scheme, one can optionally set up a type
203     * server that maps type URLs to message definitions as follows:
204     * * If no scheme is provided, `https` is assumed.
205     * * An HTTP GET on the URL must yield a [google.protobuf.Type][]
206     *   value in binary format, or produce an error.
207     * * Applications are allowed to cache lookup results based on the
208     *   URL, or have them precompiled into a binary to avoid any
209     *   lookup. Therefore, binary compatibility needs to be preserved
210     *   on changes to types. (Use versioned type names to manage
211     *   breaking changes.)
212     * Note: this functionality is not currently available in the official
213     * protobuf release, and it is not used for type URLs beginning with
214     * type.googleapis.com.
215     * Schemes other than `http`, `https` (or the empty scheme) might be
216     * used with implementation specific semantics.
217     *
218     * Generated from protobuf field <code>string type_url = 1;</code>
219     * @param string $var
220     * @return $this
221     */
222    public function setTypeUrl($var)
223    {
224        GPBUtil::checkString($var, True);
225        $this->type_url = $var;
226
227        return $this;
228    }
229
230    /**
231     * Must be a valid serialized protocol buffer of the above specified type.
232     *
233     * Generated from protobuf field <code>bytes value = 2;</code>
234     * @return string
235     */
236    public function getValue()
237    {
238        return $this->value;
239    }
240
241    /**
242     * Must be a valid serialized protocol buffer of the above specified type.
243     *
244     * Generated from protobuf field <code>bytes value = 2;</code>
245     * @param string $var
246     * @return $this
247     */
248    public function setValue($var)
249    {
250        GPBUtil::checkString($var, False);
251        $this->value = $var;
252
253        return $this;
254    }
255
256}
257
258