GPBAny.pbobjc.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. // Generated by the protocol buffer compiler. DO NOT EDIT!
  2. // clang-format off
  3. // source: google/protobuf/any.proto
  4. #import "GPBDescriptor.h"
  5. #import "GPBMessage.h"
  6. #import "GPBRootObject.h"
  7. #if GOOGLE_PROTOBUF_OBJC_VERSION < 30007
  8. #error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
  9. #endif
  10. #if 30007 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
  11. #error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.
  12. #endif
  13. // @@protoc_insertion_point(imports)
  14. #pragma clang diagnostic push
  15. #pragma clang diagnostic ignored "-Wdeprecated-declarations"
  16. CF_EXTERN_C_BEGIN
  17. NS_ASSUME_NONNULL_BEGIN
  18. #pragma mark - GPBAnyRoot
  19. /**
  20. * Exposes the extension registry for this file.
  21. *
  22. * The base class provides:
  23. * @code
  24. * + (GPBExtensionRegistry *)extensionRegistry;
  25. * @endcode
  26. * which is a @c GPBExtensionRegistry that includes all the extensions defined by
  27. * this file and all files that it depends on.
  28. **/
  29. GPB_FINAL @interface GPBAnyRoot : GPBRootObject
  30. @end
  31. #pragma mark - GPBAny
  32. typedef GPB_ENUM(GPBAny_FieldNumber) {
  33. GPBAny_FieldNumber_TypeURL = 1,
  34. GPBAny_FieldNumber_Value = 2,
  35. };
  36. /**
  37. * `Any` contains an arbitrary serialized protocol buffer message along with a
  38. * URL that describes the type of the serialized message.
  39. *
  40. * Protobuf library provides support to pack/unpack Any values in the form
  41. * of utility functions or additional generated methods of the Any type.
  42. *
  43. * Example 1: Pack and unpack a message in C++.
  44. *
  45. * Foo foo = ...;
  46. * Any any;
  47. * any.PackFrom(foo);
  48. * ...
  49. * if (any.UnpackTo(&foo)) {
  50. * ...
  51. * }
  52. *
  53. * Example 2: Pack and unpack a message in Java.
  54. *
  55. * Foo foo = ...;
  56. * Any any = Any.pack(foo);
  57. * ...
  58. * if (any.is(Foo.class)) {
  59. * foo = any.unpack(Foo.class);
  60. * }
  61. * // or ...
  62. * if (any.isSameTypeAs(Foo.getDefaultInstance())) {
  63. * foo = any.unpack(Foo.getDefaultInstance());
  64. * }
  65. *
  66. * Example 3: Pack and unpack a message in Python.
  67. *
  68. * foo = Foo(...)
  69. * any = Any()
  70. * any.Pack(foo)
  71. * ...
  72. * if any.Is(Foo.DESCRIPTOR):
  73. * any.Unpack(foo)
  74. * ...
  75. *
  76. * Example 4: Pack and unpack a message in Go
  77. *
  78. * foo := &pb.Foo{...}
  79. * any, err := anypb.New(foo)
  80. * if err != nil {
  81. * ...
  82. * }
  83. * ...
  84. * foo := &pb.Foo{}
  85. * if err := any.UnmarshalTo(foo); err != nil {
  86. * ...
  87. * }
  88. *
  89. * The pack methods provided by protobuf library will by default use
  90. * 'type.googleapis.com/full.type.name' as the type URL and the unpack
  91. * methods only use the fully qualified type name after the last '/'
  92. * in the type URL, for example "foo.bar.com/x/y.z" will yield type
  93. * name "y.z".
  94. *
  95. * JSON
  96. * ====
  97. * The JSON representation of an `Any` value uses the regular
  98. * representation of the deserialized, embedded message, with an
  99. * additional field `\@type` which contains the type URL. Example:
  100. *
  101. * package google.profile;
  102. * message Person {
  103. * string first_name = 1;
  104. * string last_name = 2;
  105. * }
  106. *
  107. * {
  108. * "\@type": "type.googleapis.com/google.profile.Person",
  109. * "firstName": <string>,
  110. * "lastName": <string>
  111. * }
  112. *
  113. * If the embedded message type is well-known and has a custom JSON
  114. * representation, that representation will be embedded adding a field
  115. * `value` which holds the custom JSON in addition to the `\@type`
  116. * field. Example (for message [google.protobuf.Duration][]):
  117. *
  118. * {
  119. * "\@type": "type.googleapis.com/google.protobuf.Duration",
  120. * "value": "1.212s"
  121. * }
  122. **/
  123. GPB_FINAL @interface GPBAny : GPBMessage
  124. /**
  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. *
  132. * In practice, teams usually precompile into the binary all types that they
  133. * expect it to use in the context of Any. However, for URLs which use the
  134. * scheme `http`, `https`, or no scheme, one can optionally set up a type
  135. * server that maps type URLs to message definitions as follows:
  136. *
  137. * * If no scheme is provided, `https` is assumed.
  138. * * An HTTP GET on the URL must yield a [google.protobuf.Type][]
  139. * value in binary format, or produce an error.
  140. * * Applications are allowed to cache lookup results based on the
  141. * URL, or have them precompiled into a binary to avoid any
  142. * lookup. Therefore, binary compatibility needs to be preserved
  143. * on changes to types. (Use versioned type names to manage
  144. * breaking changes.)
  145. *
  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. As of May 2023, there are no widely used type server
  149. * implementations and no plans to implement one.
  150. *
  151. * Schemes other than `http`, `https` (or the empty scheme) might be
  152. * used with implementation specific semantics.
  153. **/
  154. @property(nonatomic, readwrite, copy, null_resettable) NSString *typeURL;
  155. /** Must be a valid serialized protocol buffer of the above specified type. */
  156. @property(nonatomic, readwrite, copy, null_resettable) NSData *value;
  157. // NOTE: There are some Objective-C specific methods/properties in
  158. // GPBWellKnownTypes.h that will likey be useful.
  159. @end
  160. NS_ASSUME_NONNULL_END
  161. CF_EXTERN_C_END
  162. #pragma clang diagnostic pop
  163. // @@protoc_insertion_point(global_scope)
  164. // clang-format on