any.pb.dart 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. //
  2. // Generated code. Do not modify.
  3. // source: google/protobuf/any.proto
  4. //
  5. // @dart = 2.12
  6. // ignore_for_file: annotate_overrides, camel_case_types, comment_references
  7. // ignore_for_file: constant_identifier_names, library_prefixes
  8. // ignore_for_file: non_constant_identifier_names, prefer_final_fields
  9. // ignore_for_file: unnecessary_import, unnecessary_this, unused_import
  10. import 'dart:core' as $core;
  11. import 'package:protobuf/protobuf.dart' as $pb;
  12. import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin;
  13. /// `Any` contains an arbitrary serialized protocol buffer message along with a
  14. /// URL that describes the type of the serialized message.
  15. ///
  16. /// Protobuf library provides support to pack/unpack Any values in the form
  17. /// of utility functions or additional generated methods of the Any type.
  18. ///
  19. /// Example 1: Pack and unpack a message in C++.
  20. ///
  21. /// Foo foo = ...;
  22. /// Any any;
  23. /// any.PackFrom(foo);
  24. /// ...
  25. /// if (any.UnpackTo(&foo)) {
  26. /// ...
  27. /// }
  28. ///
  29. /// Example 2: Pack and unpack a message in Java.
  30. ///
  31. /// Foo foo = ...;
  32. /// Any any = Any.pack(foo);
  33. /// ...
  34. /// if (any.is(Foo.class)) {
  35. /// foo = any.unpack(Foo.class);
  36. /// }
  37. /// // or ...
  38. /// if (any.isSameTypeAs(Foo.getDefaultInstance())) {
  39. /// foo = any.unpack(Foo.getDefaultInstance());
  40. /// }
  41. ///
  42. /// Example 3: Pack and unpack a message in Python.
  43. ///
  44. /// foo = Foo(...)
  45. /// any = Any()
  46. /// any.Pack(foo)
  47. /// ...
  48. /// if any.Is(Foo.DESCRIPTOR):
  49. /// any.Unpack(foo)
  50. /// ...
  51. ///
  52. /// Example 4: Pack and unpack a message in Go
  53. ///
  54. /// foo := &pb.Foo{...}
  55. /// any, err := anypb.New(foo)
  56. /// if err != nil {
  57. /// ...
  58. /// }
  59. /// ...
  60. /// foo := &pb.Foo{}
  61. /// if err := any.UnmarshalTo(foo); err != nil {
  62. /// ...
  63. /// }
  64. ///
  65. /// The pack methods provided by protobuf library will by default use
  66. /// 'type.googleapis.com/full.type.name' as the type URL and the unpack
  67. /// methods only use the fully qualified type name after the last '/'
  68. /// in the type URL, for example "foo.bar.com/x/y.z" will yield type
  69. /// name "y.z".
  70. ///
  71. /// JSON
  72. /// ====
  73. /// The JSON representation of an `Any` value uses the regular
  74. /// representation of the deserialized, embedded message, with an
  75. /// additional field `@type` which contains the type URL. Example:
  76. ///
  77. /// package google.profile;
  78. /// message Person {
  79. /// string first_name = 1;
  80. /// string last_name = 2;
  81. /// }
  82. ///
  83. /// {
  84. /// "@type": "type.googleapis.com/google.profile.Person",
  85. /// "firstName": <string>,
  86. /// "lastName": <string>
  87. /// }
  88. ///
  89. /// If the embedded message type is well-known and has a custom JSON
  90. /// representation, that representation will be embedded adding a field
  91. /// `value` which holds the custom JSON in addition to the `@type`
  92. /// field. Example (for message [google.protobuf.Duration][]):
  93. ///
  94. /// {
  95. /// "@type": "type.googleapis.com/google.protobuf.Duration",
  96. /// "value": "1.212s"
  97. /// }
  98. class Any extends $pb.GeneratedMessage with $mixin.AnyMixin {
  99. factory Any({
  100. $core.String? typeUrl,
  101. $core.List<$core.int>? value,
  102. }) {
  103. final $result = create();
  104. if (typeUrl != null) {
  105. $result.typeUrl = typeUrl;
  106. }
  107. if (value != null) {
  108. $result.value = value;
  109. }
  110. return $result;
  111. }
  112. Any._() : super();
  113. factory Any.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
  114. factory Any.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
  115. static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Any', package: const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'), createEmptyInstance: create, toProto3Json: $mixin.AnyMixin.toProto3JsonHelper, fromProto3Json: $mixin.AnyMixin.fromProto3JsonHelper)
  116. ..aOS(1, _omitFieldNames ? '' : 'typeUrl')
  117. ..a<$core.List<$core.int>>(2, _omitFieldNames ? '' : 'value', $pb.PbFieldType.OY)
  118. ..hasRequiredFields = false
  119. ;
  120. @$core.Deprecated(
  121. 'Using this can add significant overhead to your binary. '
  122. 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
  123. 'Will be removed in next major version')
  124. Any clone() => Any()..mergeFromMessage(this);
  125. @$core.Deprecated(
  126. 'Using this can add significant overhead to your binary. '
  127. 'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
  128. 'Will be removed in next major version')
  129. Any copyWith(void Function(Any) updates) => super.copyWith((message) => updates(message as Any)) as Any;
  130. $pb.BuilderInfo get info_ => _i;
  131. @$core.pragma('dart2js:noInline')
  132. static Any create() => Any._();
  133. Any createEmptyInstance() => create();
  134. static $pb.PbList<Any> createRepeated() => $pb.PbList<Any>();
  135. @$core.pragma('dart2js:noInline')
  136. static Any getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Any>(create);
  137. static Any? _defaultInstance;
  138. /// A URL/resource name that uniquely identifies the type of the serialized
  139. /// protocol buffer message. This string must contain at least
  140. /// one "/" character. The last segment of the URL's path must represent
  141. /// the fully qualified name of the type (as in
  142. /// `path/google.protobuf.Duration`). The name should be in a canonical form
  143. /// (e.g., leading "." is not accepted).
  144. ///
  145. /// In practice, teams usually precompile into the binary all types that they
  146. /// expect it to use in the context of Any. However, for URLs which use the
  147. /// scheme `http`, `https`, or no scheme, one can optionally set up a type
  148. /// server that maps type URLs to message definitions as follows:
  149. ///
  150. /// * If no scheme is provided, `https` is assumed.
  151. /// * An HTTP GET on the URL must yield a [google.protobuf.Type][]
  152. /// value in binary format, or produce an error.
  153. /// * Applications are allowed to cache lookup results based on the
  154. /// URL, or have them precompiled into a binary to avoid any
  155. /// lookup. Therefore, binary compatibility needs to be preserved
  156. /// on changes to types. (Use versioned type names to manage
  157. /// breaking changes.)
  158. ///
  159. /// Note: this functionality is not currently available in the official
  160. /// protobuf release, and it is not used for type URLs beginning with
  161. /// type.googleapis.com. As of May 2023, there are no widely used type server
  162. /// implementations and no plans to implement one.
  163. ///
  164. /// Schemes other than `http`, `https` (or the empty scheme) might be
  165. /// used with implementation specific semantics.
  166. @$pb.TagNumber(1)
  167. $core.String get typeUrl => $_getSZ(0);
  168. @$pb.TagNumber(1)
  169. set typeUrl($core.String v) { $_setString(0, v); }
  170. @$pb.TagNumber(1)
  171. $core.bool hasTypeUrl() => $_has(0);
  172. @$pb.TagNumber(1)
  173. void clearTypeUrl() => clearField(1);
  174. /// Must be a valid serialized protocol buffer of the above specified type.
  175. @$pb.TagNumber(2)
  176. $core.List<$core.int> get value => $_getN(1);
  177. @$pb.TagNumber(2)
  178. set value($core.List<$core.int> v) { $_setBytes(1, v); }
  179. @$pb.TagNumber(2)
  180. $core.bool hasValue() => $_has(1);
  181. @$pb.TagNumber(2)
  182. void clearValue() => clearField(2);
  183. /// Creates a new [Any] encoding [message].
  184. ///
  185. /// The [typeUrl] will be [typeUrlPrefix]/`fullName` where `fullName` is
  186. /// the fully qualified name of the type of [message].
  187. static Any pack($pb.GeneratedMessage message,
  188. {$core.String typeUrlPrefix = 'type.googleapis.com'}) {
  189. final result = create();
  190. $mixin.AnyMixin.packIntoAny(result, message,
  191. typeUrlPrefix: typeUrlPrefix);
  192. return result;
  193. }
  194. }
  195. const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
  196. const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names');