any.pb.dart 7.5 KB

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