Any.php 10 KB

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