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