diff options
Diffstat (limited to 'csharp/src/Google.Protobuf/WellKnownTypes')
-rw-r--r-- | csharp/src/Google.Protobuf/WellKnownTypes/Any.cs | 58 | ||||
-rw-r--r-- | csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs | 79 | ||||
-rw-r--r-- | csharp/src/Google.Protobuf/WellKnownTypes/Api.cs | 388 | ||||
-rw-r--r-- | csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs | 58 | ||||
-rw-r--r-- | csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs | 19 | ||||
-rw-r--r-- | csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs | 111 | ||||
-rw-r--r-- | csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs | 21 | ||||
-rw-r--r-- | csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs | 89 | ||||
-rw-r--r-- | csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs | 64 | ||||
-rw-r--r-- | csharp/src/Google.Protobuf/WellKnownTypes/Type.cs | 364 | ||||
-rw-r--r-- | csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs | 92 |
11 files changed, 1247 insertions, 96 deletions
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs index 204b37cf..4a704018 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs @@ -11,10 +11,12 @@ namespace Google.Protobuf.WellKnownTypes { namespace Proto { + /// <summary>Holder for reflection information generated from google/protobuf/any.proto</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class Any { #region Descriptor + /// <summary>File descriptor for google/protobuf/any.proto</summary> public static pbr::FileDescriptor Descriptor { get { return descriptor; } } @@ -23,9 +25,9 @@ namespace Google.Protobuf.WellKnownTypes { static Any() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "Chlnb29nbGUvcHJvdG9idWYvYW55LnByb3RvEg9nb29nbGUucHJvdG9idWYi", - "JgoDQW55EhAKCHR5cGVfdXJsGAEgASgJEg0KBXZhbHVlGAIgASgMQksKE2Nv", - "bS5nb29nbGUucHJvdG9idWZCCEFueVByb3RvUAGgAQGiAgNHUEKqAh5Hb29n", + "Chlnb29nbGUvcHJvdG9idWYvYW55LnByb3RvEg9nb29nbGUucHJvdG9idWYi", + "JgoDQW55EhAKCHR5cGVfdXJsGAEgASgJEg0KBXZhbHVlGAIgASgMQksKE2Nv", + "bS5nb29nbGUucHJvdG9idWZCCEFueVByb3RvUAGgAQGiAgNHUEKqAh5Hb29n", "bGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, new pbr::FileDescriptor[] { }, @@ -38,6 +40,33 @@ namespace Google.Protobuf.WellKnownTypes { } } #region Messages + /// <summary> + /// `Any` contains an arbitrary serialized message along with a URL + /// that describes the type of the serialized message. + /// JSON + /// ==== + /// The JSON representation of an `Any` value uses the regular + /// representation of the deserialized, embedded message, with an + /// additional field `@type` which contains the type URL. Example: + /// package google.profile; + /// message Person { + /// string first_name = 1; + /// string last_name = 2; + /// } + /// { + /// "@type": "type.googleapis.com/google.profile.Person", + /// "firstName": <string>, + /// "lastName": <string> + /// } + /// If the embedded message type is well-known and has a custom JSON + /// representation, that representation will be embedded adding a field + /// `value` which holds the custom JSON in addition to the the `@type` + /// field. Example (for message [google.protobuf.Duration][google.protobuf.Duration]): + /// { + /// "@type": "type.googleapis.com/google.protobuf.Duration", + /// "value": "1.212s" + /// } + /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Any : pb::IMessage<Any> { private static readonly pb::MessageParser<Any> _parser = new pb::MessageParser<Any>(() => new Any()); @@ -66,8 +95,27 @@ namespace Google.Protobuf.WellKnownTypes { return new Any(this); } + /// <summary>Field number for the "type_url" field.</summary> public const int TypeUrlFieldNumber = 1; private string typeUrl_ = ""; + /// <summary> + /// A URL/resource name whose content describes the type of the + /// serialized message. + /// For URLs which use the schema `http`, `https`, or no schema, the + /// following restrictions and interpretations apply: + /// * If no schema is provided, `https` is assumed. + /// * The last segment of the URL's path must represent the fully + /// qualified name of the type (as in `path/google.protobuf.Duration`). + /// * An HTTP GET on the URL must yield a [google.protobuf.Type][google.protobuf.Type] + /// value in binary format, or produce an error. + /// * Applications are allowed to cache lookup results based on the + /// URL, or have them precompiled into a binary to avoid any + /// lookup. Therefore, binary compatibility needs to be preserved + /// on changes to types. (Use versioned type names to manage + /// breaking changes.) + /// Schemas other than `http`, `https` (or the empty schema) might be + /// used with implementation specific semantics. + /// </summary> public string TypeUrl { get { return typeUrl_; } set { @@ -75,8 +123,12 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "value" field.</summary> public const int ValueFieldNumber = 2; private pb::ByteString value_ = pb::ByteString.Empty; + /// <summary> + /// Must be valid serialized data of the above specified type. + /// </summary> public pb::ByteString Value { get { return value_; } set { diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs b/csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs new file mode 100644 index 00000000..082f7432 --- /dev/null +++ b/csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs @@ -0,0 +1,79 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using Google.Protobuf.Reflection; + +namespace Google.Protobuf.WellKnownTypes +{ + public partial class Any + { + // This could be moved to MessageDescriptor if we wanted to, but keeping it here means + // all the Any-specific code is in the same place. + private static string GetTypeUrl(MessageDescriptor descriptor) + { + return "type.googleapis.com/" + descriptor.FullName; + } + + /// <summary> + /// Unpacks the content of this Any message into the target message type, + /// which must match the type URL within this Any message. + /// </summary> + /// <typeparam name="T">The type of message to unpack the content into.</typeparam> + /// <returns>The unpacked message.</returns> + /// <exception cref="InvalidProtocolBufferException">The target message type doesn't match the type URL in this message</exception> + public T Unpack<T>() where T : IMessage, new() + { + // Note: this doesn't perform as well is it might. We could take a MessageParser<T> in an alternative overload, + // which would be expected to perform slightly better... although the difference is likely to be negligible. + T target = new T(); + string targetTypeUrl = GetTypeUrl(target.Descriptor); + if (TypeUrl != targetTypeUrl) + { + throw new InvalidProtocolBufferException(string.Format("Type url for {0} is {1}; Any message's type url is {2}", + target.Descriptor.Name, targetTypeUrl, TypeUrl)); + } + target.MergeFrom(Value); + return target; + } + + /// <summary> + /// Packs the specified message into an Any message. + /// </summary> + /// <param name="message">The message to pack.</param> + /// <returns>An Any message with the content and type URL of <paramref name="message"/>.</returns> + public static Any Pack(IMessage message) + { + Preconditions.CheckNotNull(message, "message"); + return new Any { TypeUrl = GetTypeUrl(message.Descriptor), Value = message.ToByteString() }; + } + } +} diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs index a5f95093..2c64314d 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs @@ -11,10 +11,12 @@ namespace Google.Protobuf.WellKnownTypes { namespace Proto { + /// <summary>Holder for reflection information generated from google/protobuf/api.proto</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class Api { #region Descriptor + /// <summary>File descriptor for google/protobuf/api.proto</summary> public static pbr::FileDescriptor Descriptor { get { return descriptor; } } @@ -23,24 +25,28 @@ namespace Google.Protobuf.WellKnownTypes { static Api() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "Chlnb29nbGUvcHJvdG9idWYvYXBpLnByb3RvEg9nb29nbGUucHJvdG9idWYa", - "JGdvb2dsZS9wcm90b2J1Zi9zb3VyY2VfY29udGV4dC5wcm90bxoaZ29vZ2xl", - "L3Byb3RvYnVmL3R5cGUucHJvdG8isAEKA0FwaRIMCgRuYW1lGAEgASgJEigK", - "B21ldGhvZHMYAiADKAsyFy5nb29nbGUucHJvdG9idWYuTWV0aG9kEigKB29w", - "dGlvbnMYAyADKAsyFy5nb29nbGUucHJvdG9idWYuT3B0aW9uEg8KB3ZlcnNp", - "b24YBCABKAkSNgoOc291cmNlX2NvbnRleHQYBSABKAsyHi5nb29nbGUucHJv", - "dG9idWYuU291cmNlQ29udGV4dCKsAQoGTWV0aG9kEgwKBG5hbWUYASABKAkS", - "GAoQcmVxdWVzdF90eXBlX3VybBgCIAEoCRIZChFyZXF1ZXN0X3N0cmVhbWlu", - "ZxgDIAEoCBIZChFyZXNwb25zZV90eXBlX3VybBgEIAEoCRIaChJyZXNwb25z", - "ZV9zdHJlYW1pbmcYBSABKAgSKAoHb3B0aW9ucxgGIAMoCzIXLmdvb2dsZS5w", - "cm90b2J1Zi5PcHRpb25CSAoTY29tLmdvb2dsZS5wcm90b2J1ZkIIQXBpUHJv", - "dG9QAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IG", - "cHJvdG8z")); + "Chlnb29nbGUvcHJvdG9idWYvYXBpLnByb3RvEg9nb29nbGUucHJvdG9idWYa", + "JGdvb2dsZS9wcm90b2J1Zi9zb3VyY2VfY29udGV4dC5wcm90bxoaZ29vZ2xl", + "L3Byb3RvYnVmL3R5cGUucHJvdG8igQIKA0FwaRIMCgRuYW1lGAEgASgJEigK", + "B21ldGhvZHMYAiADKAsyFy5nb29nbGUucHJvdG9idWYuTWV0aG9kEigKB29w", + "dGlvbnMYAyADKAsyFy5nb29nbGUucHJvdG9idWYuT3B0aW9uEg8KB3ZlcnNp", + "b24YBCABKAkSNgoOc291cmNlX2NvbnRleHQYBSABKAsyHi5nb29nbGUucHJv", + "dG9idWYuU291cmNlQ29udGV4dBImCgZtaXhpbnMYBiADKAsyFi5nb29nbGUu", + "cHJvdG9idWYuTWl4aW4SJwoGc3ludGF4GAcgASgOMhcuZ29vZ2xlLnByb3Rv", + "YnVmLlN5bnRheCLVAQoGTWV0aG9kEgwKBG5hbWUYASABKAkSGAoQcmVxdWVz", + "dF90eXBlX3VybBgCIAEoCRIZChFyZXF1ZXN0X3N0cmVhbWluZxgDIAEoCBIZ", + "ChFyZXNwb25zZV90eXBlX3VybBgEIAEoCRIaChJyZXNwb25zZV9zdHJlYW1p", + "bmcYBSABKAgSKAoHb3B0aW9ucxgGIAMoCzIXLmdvb2dsZS5wcm90b2J1Zi5P", + "cHRpb24SJwoGc3ludGF4GAcgASgOMhcuZ29vZ2xlLnByb3RvYnVmLlN5bnRh", + "eCIjCgVNaXhpbhIMCgRuYW1lGAEgASgJEgwKBHJvb3QYAiABKAlCSwoTY29t", + "Lmdvb2dsZS5wcm90b2J1ZkIIQXBpUHJvdG9QAaABAaICA0dQQqoCHkdvb2ds", + "ZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.Proto.SourceContext.Descriptor, global::Google.Protobuf.WellKnownTypes.Proto.Type.Descriptor, }, new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] { - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Api), new[]{ "Name", "Methods", "Options", "Version", "SourceContext" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Method), new[]{ "Name", "RequestTypeUrl", "RequestStreaming", "ResponseTypeUrl", "ResponseStreaming", "Options" }, null, null, null) + new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Api), new[]{ "Name", "Methods", "Options", "Version", "SourceContext", "Mixins", "Syntax" }, null, null, null), + new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Method), new[]{ "Name", "RequestTypeUrl", "RequestStreaming", "ResponseTypeUrl", "ResponseStreaming", "Options", "Syntax" }, null, null, null), + new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Mixin), new[]{ "Name", "Root" }, null, null, null) })); } #endregion @@ -48,6 +54,9 @@ namespace Google.Protobuf.WellKnownTypes { } } #region Messages + /// <summary> + /// Api is a light-weight descriptor for a protocol buffer service. + /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Api : pb::IMessage<Api> { private static readonly pb::MessageParser<Api> _parser = new pb::MessageParser<Api>(() => new Api()); @@ -73,14 +82,21 @@ namespace Google.Protobuf.WellKnownTypes { options_ = other.options_.Clone(); version_ = other.version_; SourceContext = other.sourceContext_ != null ? other.SourceContext.Clone() : null; + mixins_ = other.mixins_.Clone(); + syntax_ = other.syntax_; } public Api Clone() { return new Api(this); } + /// <summary>Field number for the "name" field.</summary> public const int NameFieldNumber = 1; private string name_ = ""; + /// <summary> + /// The fully qualified name of this api, including package name + /// followed by the api's simple name. + /// </summary> public string Name { get { return name_; } set { @@ -88,24 +104,53 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "methods" field.</summary> public const int MethodsFieldNumber = 2; private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Method> _repeated_methods_codec = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Method.Parser); private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Method> methods_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Method>(); + /// <summary> + /// The methods of this api, in unspecified order. + /// </summary> public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Method> Methods { get { return methods_; } } + /// <summary>Field number for the "options" field.</summary> public const int OptionsFieldNumber = 3; private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Option> _repeated_options_codec = pb::FieldCodec.ForMessage(26, global::Google.Protobuf.WellKnownTypes.Option.Parser); private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> options_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option>(); + /// <summary> + /// Any metadata attached to the API. + /// </summary> public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> Options { get { return options_; } } + /// <summary>Field number for the "version" field.</summary> public const int VersionFieldNumber = 4; private string version_ = ""; + /// <summary> + /// A version string for this api. If specified, must have the form + /// `major-version.minor-version`, as in `1.10`. If the minor version + /// is omitted, it defaults to zero. If the entire version field is + /// empty, the major version is derived from the package name, as + /// outlined below. If the field is not empty, the version in the + /// package name will be verified to be consistent with what is + /// provided here. + /// The versioning schema uses [semantic + /// versioning](http://semver.org) where the major version number + /// indicates a breaking change and the minor version an additive, + /// non-breaking change. Both version numbers are signals to users + /// what to expect from different versions, and should be carefully + /// chosen based on the product plan. + /// The major version is also reflected in the package name of the + /// API, which must end in `v<major-version>`, as in + /// `google.feature.v1`. For major versions 0 and 1, the suffix can + /// be omitted. Zero major versions must only be used for + /// experimental, none-GA apis. + /// </summary> public string Version { get { return version_; } set { @@ -113,8 +158,13 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "source_context" field.</summary> public const int SourceContextFieldNumber = 5; private global::Google.Protobuf.WellKnownTypes.SourceContext sourceContext_; + /// <summary> + /// Source context for the protocol buffer service represented by this + /// message. + /// </summary> public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContext { get { return sourceContext_; } set { @@ -122,6 +172,31 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "mixins" field.</summary> + public const int MixinsFieldNumber = 6; + private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Mixin> _repeated_mixins_codec + = pb::FieldCodec.ForMessage(50, global::Google.Protobuf.WellKnownTypes.Mixin.Parser); + private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Mixin> mixins_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Mixin>(); + /// <summary> + /// Included APIs. See [Mixin][]. + /// </summary> + public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Mixin> Mixins { + get { return mixins_; } + } + + /// <summary>Field number for the "syntax" field.</summary> + public const int SyntaxFieldNumber = 7; + private global::Google.Protobuf.WellKnownTypes.Syntax syntax_ = global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2; + /// <summary> + /// The source syntax of the service. + /// </summary> + public global::Google.Protobuf.WellKnownTypes.Syntax Syntax { + get { return syntax_; } + set { + syntax_ = value; + } + } + public override bool Equals(object other) { return Equals(other as Api); } @@ -138,6 +213,8 @@ namespace Google.Protobuf.WellKnownTypes { if(!options_.Equals(other.options_)) return false; if (Version != other.Version) return false; if (!object.Equals(SourceContext, other.SourceContext)) return false; + if(!mixins_.Equals(other.mixins_)) return false; + if (Syntax != other.Syntax) return false; return true; } @@ -148,6 +225,8 @@ namespace Google.Protobuf.WellKnownTypes { hash ^= options_.GetHashCode(); if (Version.Length != 0) hash ^= Version.GetHashCode(); if (sourceContext_ != null) hash ^= SourceContext.GetHashCode(); + hash ^= mixins_.GetHashCode(); + if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) hash ^= Syntax.GetHashCode(); return hash; } @@ -170,6 +249,11 @@ namespace Google.Protobuf.WellKnownTypes { output.WriteRawTag(42); output.WriteMessage(SourceContext); } + mixins_.WriteTo(output, _repeated_mixins_codec); + if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) { + output.WriteRawTag(56); + output.WriteEnum((int) Syntax); + } } public int CalculateSize() { @@ -185,6 +269,10 @@ namespace Google.Protobuf.WellKnownTypes { if (sourceContext_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(SourceContext); } + size += mixins_.CalculateSize(_repeated_mixins_codec); + if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax); + } return size; } @@ -206,6 +294,10 @@ namespace Google.Protobuf.WellKnownTypes { } SourceContext.MergeFrom(other.SourceContext); } + mixins_.Add(other.mixins_); + if (other.Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) { + Syntax = other.Syntax; + } } public void MergeFrom(pb::CodedInputStream input) { @@ -238,12 +330,23 @@ namespace Google.Protobuf.WellKnownTypes { input.ReadMessage(sourceContext_); break; } + case 50: { + mixins_.AddEntriesFrom(input, _repeated_mixins_codec); + break; + } + case 56: { + syntax_ = (global::Google.Protobuf.WellKnownTypes.Syntax) input.ReadEnum(); + break; + } } } } } + /// <summary> + /// Method represents a method of an api. + /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Method : pb::IMessage<Method> { private static readonly pb::MessageParser<Method> _parser = new pb::MessageParser<Method>(() => new Method()); @@ -270,14 +373,19 @@ namespace Google.Protobuf.WellKnownTypes { responseTypeUrl_ = other.responseTypeUrl_; responseStreaming_ = other.responseStreaming_; options_ = other.options_.Clone(); + syntax_ = other.syntax_; } public Method Clone() { return new Method(this); } + /// <summary>Field number for the "name" field.</summary> public const int NameFieldNumber = 1; private string name_ = ""; + /// <summary> + /// The simple name of this method. + /// </summary> public string Name { get { return name_; } set { @@ -285,8 +393,12 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "request_type_url" field.</summary> public const int RequestTypeUrlFieldNumber = 2; private string requestTypeUrl_ = ""; + /// <summary> + /// A URL of the input message type. + /// </summary> public string RequestTypeUrl { get { return requestTypeUrl_; } set { @@ -294,8 +406,12 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "request_streaming" field.</summary> public const int RequestStreamingFieldNumber = 3; private bool requestStreaming_; + /// <summary> + /// If true, the request is streamed. + /// </summary> public bool RequestStreaming { get { return requestStreaming_; } set { @@ -303,8 +419,12 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "response_type_url" field.</summary> public const int ResponseTypeUrlFieldNumber = 4; private string responseTypeUrl_ = ""; + /// <summary> + /// The URL of the output message type. + /// </summary> public string ResponseTypeUrl { get { return responseTypeUrl_; } set { @@ -312,8 +432,12 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "response_streaming" field.</summary> public const int ResponseStreamingFieldNumber = 5; private bool responseStreaming_; + /// <summary> + /// If true, the response is streamed. + /// </summary> public bool ResponseStreaming { get { return responseStreaming_; } set { @@ -321,14 +445,31 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "options" field.</summary> public const int OptionsFieldNumber = 6; private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Option> _repeated_options_codec = pb::FieldCodec.ForMessage(50, global::Google.Protobuf.WellKnownTypes.Option.Parser); private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> options_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option>(); + /// <summary> + /// Any metadata attached to the method. + /// </summary> public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> Options { get { return options_; } } + /// <summary>Field number for the "syntax" field.</summary> + public const int SyntaxFieldNumber = 7; + private global::Google.Protobuf.WellKnownTypes.Syntax syntax_ = global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2; + /// <summary> + /// The source syntax of this method. + /// </summary> + public global::Google.Protobuf.WellKnownTypes.Syntax Syntax { + get { return syntax_; } + set { + syntax_ = value; + } + } + public override bool Equals(object other) { return Equals(other as Method); } @@ -346,6 +487,7 @@ namespace Google.Protobuf.WellKnownTypes { if (ResponseTypeUrl != other.ResponseTypeUrl) return false; if (ResponseStreaming != other.ResponseStreaming) return false; if(!options_.Equals(other.options_)) return false; + if (Syntax != other.Syntax) return false; return true; } @@ -357,6 +499,7 @@ namespace Google.Protobuf.WellKnownTypes { if (ResponseTypeUrl.Length != 0) hash ^= ResponseTypeUrl.GetHashCode(); if (ResponseStreaming != false) hash ^= ResponseStreaming.GetHashCode(); hash ^= options_.GetHashCode(); + if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) hash ^= Syntax.GetHashCode(); return hash; } @@ -386,6 +529,10 @@ namespace Google.Protobuf.WellKnownTypes { output.WriteBool(ResponseStreaming); } options_.WriteTo(output, _repeated_options_codec); + if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) { + output.WriteRawTag(56); + output.WriteEnum((int) Syntax); + } } public int CalculateSize() { @@ -406,6 +553,9 @@ namespace Google.Protobuf.WellKnownTypes { size += 1 + 1; } size += options_.CalculateSize(_repeated_options_codec); + if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax); + } return size; } @@ -429,6 +579,9 @@ namespace Google.Protobuf.WellKnownTypes { ResponseStreaming = other.ResponseStreaming; } options_.Add(other.options_); + if (other.Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) { + Syntax = other.Syntax; + } } public void MergeFrom(pb::CodedInputStream input) { @@ -462,6 +615,211 @@ namespace Google.Protobuf.WellKnownTypes { options_.AddEntriesFrom(input, _repeated_options_codec); break; } + case 56: { + syntax_ = (global::Google.Protobuf.WellKnownTypes.Syntax) input.ReadEnum(); + break; + } + } + } + } + + } + + /// <summary> + /// Declares an API to be included in this API. The including API must + /// redeclare all the methods from the included API, but documentation + /// and options are inherited as follows: + /// - If after comment and whitespace stripping, the documentation + /// string of the redeclared method is empty, it will be inherited + /// from the original method. + /// - Each annotation belonging to the service config (http, + /// visibility) which is not set in the redeclared method will be + /// inherited. + /// - If an http annotation is inherited, the path pattern will be + /// modified as follows. Any version prefix will be replaced by the + /// version of the including API plus the [root][] path if specified. + /// Example of a simple mixin: + /// package google.acl.v1; + /// service AccessControl { + /// // Get the underlying ACL object. + /// rpc GetAcl(GetAclRequest) returns (Acl) { + /// option (google.api.http).get = "/v1/{resource=**}:getAcl"; + /// } + /// } + /// package google.storage.v2; + /// service Storage { + /// // (-- see AccessControl.GetAcl --) + /// rpc GetAcl(GetAclRequest) returns (Acl); + /// // Get a data record. + /// rpc GetData(GetDataRequest) returns (Data) { + /// option (google.api.http).get = "/v2/{resource=**}"; + /// } + /// } + /// Example of a mixin configuration: + /// apis: + /// - name: google.storage.v2.Storage + /// mixins: + /// - name: google.acl.v1.AccessControl + /// The mixin construct implies that all methods in `AccessControl` are + /// also declared with same name and request/response types in + /// `Storage`. A documentation generator or annotation processor will + /// see the effective `Storage.GetAcl` method after inherting + /// documentation and annotations as follows: + /// service Storage { + /// // Get the underlying ACL object. + /// rpc GetAcl(GetAclRequest) returns (Acl) { + /// option (google.api.http).get = "/v2/{resource=**}:getAcl"; + /// } + /// ... + /// } + /// Note how the version in the path pattern changed from `v1` to `v2`. + /// If the `root` field in the mixin is specified, it should be a + /// relative path under which inherited HTTP paths are placed. Example: + /// apis: + /// - name: google.storage.v2.Storage + /// mixins: + /// - name: google.acl.v1.AccessControl + /// root: acls + /// This implies the following inherited HTTP annotation: + /// service Storage { + /// // Get the underlying ACL object. + /// rpc GetAcl(GetAclRequest) returns (Acl) { + /// option (google.api.http).get = "/v2/acls/{resource=**}:getAcl"; + /// } + /// ... + /// } + /// </summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Mixin : pb::IMessage<Mixin> { + private static readonly pb::MessageParser<Mixin> _parser = new pb::MessageParser<Mixin>(() => new Mixin()); + public static pb::MessageParser<Mixin> Parser { get { return _parser; } } + + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.WellKnownTypes.Proto.Api.Descriptor.MessageTypes[2]; } + } + + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + public Mixin() { + OnConstruction(); + } + + partial void OnConstruction(); + + public Mixin(Mixin other) : this() { + name_ = other.name_; + root_ = other.root_; + } + + public Mixin Clone() { + return new Mixin(this); + } + + /// <summary>Field number for the "name" field.</summary> + public const int NameFieldNumber = 1; + private string name_ = ""; + /// <summary> + /// The fully qualified name of the API which is included. + /// </summary> + public string Name { + get { return name_; } + set { + name_ = pb::Preconditions.CheckNotNull(value, "value"); + } + } + + /// <summary>Field number for the "root" field.</summary> + public const int RootFieldNumber = 2; + private string root_ = ""; + /// <summary> + /// If non-empty specifies a path under which inherited HTTP paths + /// are rooted. + /// </summary> + public string Root { + get { return root_; } + set { + root_ = pb::Preconditions.CheckNotNull(value, "value"); + } + } + + public override bool Equals(object other) { + return Equals(other as Mixin); + } + + public bool Equals(Mixin other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Name != other.Name) return false; + if (Root != other.Root) return false; + return true; + } + + public override int GetHashCode() { + int hash = 1; + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (Root.Length != 0) hash ^= Root.GetHashCode(); + return hash; + } + + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + + public void WriteTo(pb::CodedOutputStream output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (Root.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Root); + } + } + + public int CalculateSize() { + int size = 0; + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (Root.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Root); + } + return size; + } + + public void MergeFrom(Mixin other) { + if (other == null) { + return; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + if (other.Root.Length != 0) { + Root = other.Root; + } + } + + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + Root = input.ReadString(); + break; + } } } } diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs index aa34f2d8..39251e2e 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs @@ -11,10 +11,12 @@ namespace Google.Protobuf.WellKnownTypes { namespace Proto { + /// <summary>Holder for reflection information generated from google/protobuf/duration.proto</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class Duration { #region Descriptor + /// <summary>File descriptor for google/protobuf/duration.proto</summary> public static pbr::FileDescriptor Descriptor { get { return descriptor; } } @@ -23,10 +25,10 @@ namespace Google.Protobuf.WellKnownTypes { static Duration() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "Ch5nb29nbGUvcHJvdG9idWYvZHVyYXRpb24ucHJvdG8SD2dvb2dsZS5wcm90", - "b2J1ZiIqCghEdXJhdGlvbhIPCgdzZWNvbmRzGAEgASgDEg0KBW5hbm9zGAIg", - "ASgFQlAKE2NvbS5nb29nbGUucHJvdG9idWZCDUR1cmF0aW9uUHJvdG9QAaAB", - "AaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJv", + "Ch5nb29nbGUvcHJvdG9idWYvZHVyYXRpb24ucHJvdG8SD2dvb2dsZS5wcm90", + "b2J1ZiIqCghEdXJhdGlvbhIPCgdzZWNvbmRzGAEgASgDEg0KBW5hbm9zGAIg", + "ASgFQlAKE2NvbS5nb29nbGUucHJvdG9idWZCDUR1cmF0aW9uUHJvdG9QAaAB", + "AaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJv", "dG8z")); descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, new pbr::FileDescriptor[] { }, @@ -39,6 +41,40 @@ namespace Google.Protobuf.WellKnownTypes { } } #region Messages + /// <summary> + /// A Duration represents a signed, fixed-length span of time represented + /// as a count of seconds and fractions of seconds at nanosecond + /// resolution. It is independent of any calendar and concepts like "day" + /// or "month". It is related to Timestamp in that the difference between + /// two Timestamp values is a Duration and it can be added or subtracted + /// from a Timestamp. Range is approximately +-10,000 years. + /// Example 1: Compute Duration from two Timestamps in pseudo code. + /// Timestamp start = ...; + /// Timestamp end = ...; + /// Duration duration = ...; + /// duration.seconds = end.seconds - start.seconds; + /// duration.nanos = end.nanos - start.nanos; + /// if (duration.seconds < 0 && duration.nanos > 0) { + /// duration.seconds += 1; + /// duration.nanos -= 1000000000; + /// } else if (durations.seconds > 0 && duration.nanos < 0) { + /// duration.seconds -= 1; + /// duration.nanos += 1000000000; + /// } + /// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + /// Timestamp start = ...; + /// Duration duration = ...; + /// Timestamp end = ...; + /// end.seconds = start.seconds + duration.seconds; + /// end.nanos = start.nanos + duration.nanos; + /// if (end.nanos < 0) { + /// end.seconds -= 1; + /// end.nanos += 1000000000; + /// } else if (end.nanos >= 1000000000) { + /// end.seconds += 1; + /// end.nanos -= 1000000000; + /// } + /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Duration : pb::IMessage<Duration> { private static readonly pb::MessageParser<Duration> _parser = new pb::MessageParser<Duration>(() => new Duration()); @@ -67,8 +103,13 @@ namespace Google.Protobuf.WellKnownTypes { return new Duration(this); } + /// <summary>Field number for the "seconds" field.</summary> public const int SecondsFieldNumber = 1; private long seconds_; + /// <summary> + /// Signed seconds of the span of time. Must be from -315,576,000,000 + /// to +315,576,000,000 inclusive. + /// </summary> public long Seconds { get { return seconds_; } set { @@ -76,8 +117,17 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "nanos" field.</summary> public const int NanosFieldNumber = 2; private int nanos_; + /// <summary> + /// Signed fractions of a second at nanosecond resolution of the span + /// of time. Durations less than one second are represented with a 0 + /// `seconds` field and a positive or negative `nanos` field. For durations + /// of one second or more, a non-zero value for the `nanos` field must be + /// of the same sign as the `seconds` field. Must be from -999,999,999 + /// to +999,999,999 inclusive. + /// </summary> public int Nanos { get { return nanos_; } set { diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs index 7d699c1d..18223a9e 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs @@ -11,10 +11,12 @@ namespace Google.Protobuf.WellKnownTypes { namespace Proto { + /// <summary>Holder for reflection information generated from google/protobuf/empty.proto</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class Empty { #region Descriptor + /// <summary>File descriptor for google/protobuf/empty.proto</summary> public static pbr::FileDescriptor Descriptor { get { return descriptor; } } @@ -23,10 +25,10 @@ namespace Google.Protobuf.WellKnownTypes { static Empty() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "Chtnb29nbGUvcHJvdG9idWYvZW1wdHkucHJvdG8SD2dvb2dsZS5wcm90b2J1", - "ZiIHCgVFbXB0eUJKChNjb20uZ29vZ2xlLnByb3RvYnVmQgpFbXB0eVByb3Rv", - "UAGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnBy", - "b3RvMw==")); + "Chtnb29nbGUvcHJvdG9idWYvZW1wdHkucHJvdG8SD2dvb2dsZS5wcm90b2J1", + "ZiIHCgVFbXB0eUJNChNjb20uZ29vZ2xlLnByb3RvYnVmQgpFbXB0eVByb3Rv", + "UAGgAQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNi", + "BnByb3RvMw==")); descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] { @@ -38,6 +40,15 @@ namespace Google.Protobuf.WellKnownTypes { } } #region Messages + /// <summary> + /// A generic empty message that you can re-use to avoid defining duplicated + /// empty messages in your APIs. A typical example is to use it as the request + /// or the response type of an API method. For instance: + /// service Foo { + /// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + /// } + /// The JSON representation for `Empty` is empty JSON object `{}`. + /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Empty : pb::IMessage<Empty> { private static readonly pb::MessageParser<Empty> _parser = new pb::MessageParser<Empty>(() => new Empty()); diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs b/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs index 0dac4403..33c814ef 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs @@ -11,10 +11,12 @@ namespace Google.Protobuf.WellKnownTypes { namespace Proto { + /// <summary>Holder for reflection information generated from google/protobuf/field_mask.proto</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class FieldMask { #region Descriptor + /// <summary>File descriptor for google/protobuf/field_mask.proto</summary> public static pbr::FileDescriptor Descriptor { get { return descriptor; } } @@ -23,10 +25,10 @@ namespace Google.Protobuf.WellKnownTypes { static FieldMask() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "CiBnb29nbGUvcHJvdG9idWYvZmllbGRfbWFzay5wcm90bxIPZ29vZ2xlLnBy", - "b3RvYnVmIhoKCUZpZWxkTWFzaxINCgVwYXRocxgBIAMoCUJOChNjb20uZ29v", - "Z2xlLnByb3RvYnVmQg5GaWVsZE1hc2tQcm90b1ABogIDR1BCqgIeR29vZ2xl", - "LlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM=")); + "CiBnb29nbGUvcHJvdG9idWYvZmllbGRfbWFzay5wcm90bxIPZ29vZ2xlLnBy", + "b3RvYnVmIhoKCUZpZWxkTWFzaxINCgVwYXRocxgBIAMoCUJRChNjb20uZ29v", + "Z2xlLnByb3RvYnVmQg5GaWVsZE1hc2tQcm90b1ABoAEBogIDR1BCqgIeR29v", + "Z2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] { @@ -38,6 +40,103 @@ namespace Google.Protobuf.WellKnownTypes { } } #region Messages + /// <summary> + /// `FieldMask` represents a set of symbolic field paths, for example: + /// paths: "f.a" + /// paths: "f.b.d" + /// Here `f` represents a field in some root message, `a` and `b` + /// fields in the message found in `f`, and `d` a field found in the + /// message in `f.b`. + /// Field masks are used to specify a subset of fields that should be + /// returned by a get operation or modified by an update operation. + /// Field masks also have a custom JSON encoding (see below). + /// # Field Masks in Projections + /// When used in the context of a projection, a response message or + /// sub-message is filtered by the API to only contain those fields as + /// specified in the mask. For example, if the mask in the previous + /// example is applied to a response message as follows: + /// f { + /// a : 22 + /// b { + /// d : 1 + /// x : 2 + /// } + /// y : 13 + /// } + /// z: 8 + /// The result will not contain specific values for fields x,y and z + /// (there value will be set to the default, and omitted in proto text + /// output): + /// f { + /// a : 22 + /// b { + /// d : 1 + /// } + /// } + /// A repeated field is not allowed except at the last position of a + /// field mask. + /// If a FieldMask object is not present in a get operation, the + /// operation applies to all fields (as if a FieldMask of all fields + /// had been specified). + /// Note that a field mask does not necessarily applies to the + /// top-level response message. In case of a REST get operation, the + /// field mask applies directly to the response, but in case of a REST + /// list operation, the mask instead applies to each individual message + /// in the returned resource list. In case of a REST custom method, + /// other definitions may be used. Where the mask applies will be + /// clearly documented together with its declaration in the API. In + /// any case, the effect on the returned resource/resources is required + /// behavior for APIs. + /// # Field Masks in Update Operations + /// A field mask in update operations specifies which fields of the + /// targeted resource are going to be updated. The API is required + /// to only change the values of the fields as specified in the mask + /// and leave the others untouched. If a resource is passed in to + /// describe the updated values, the API ignores the values of all + /// fields not covered by the mask. + /// In order to reset a field's value to the default, the field must + /// be in the mask and set to the default value in the provided resource. + /// Hence, in order to reset all fields of a resource, provide a default + /// instance of the resource and set all fields in the mask, or do + /// not provide a mask as described below. + /// If a field mask is not present on update, the operation applies to + /// all fields (as if a field mask of all fields has been specified). + /// Note that in the presence of schema evolution, this may mean that + /// fields the client does not know and has therefore not filled into + /// the request will be reset to their default. If this is unwanted + /// behavior, a specific service may require a client to always specify + /// a field mask, producing an error if not. + /// As with get operations, the location of the resource which + /// describes the updated values in the request message depends on the + /// operation kind. In any case, the effect of the field mask is + /// required to be honored by the API. + /// ## Considerations for HTTP REST + /// The HTTP kind of an update operation which uses a field mask must + /// be set to PATCH instead of PUT in order to satisfy HTTP semantics + /// (PUT must only be used for full updates). + /// # JSON Encoding of Field Masks + /// In JSON, a field mask is encoded as a single string where paths are + /// separated by a comma. Fields name in each path are converted + /// to/from lower-camel naming conventions. + /// As an example, consider the following message declarations: + /// message Profile { + /// User user = 1; + /// Photo photo = 2; + /// } + /// message User { + /// string display_name = 1; + /// string address = 2; + /// } + /// In proto a field mask for `Profile` may look as such: + /// mask { + /// paths: "user.display_name" + /// paths: "photo" + /// } + /// In JSON, the same mask is represented as below: + /// { + /// mask: "user.displayName,photo" + /// } + /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class FieldMask : pb::IMessage<FieldMask> { private static readonly pb::MessageParser<FieldMask> _parser = new pb::MessageParser<FieldMask>(() => new FieldMask()); @@ -65,10 +164,14 @@ namespace Google.Protobuf.WellKnownTypes { return new FieldMask(this); } + /// <summary>Field number for the "paths" field.</summary> public const int PathsFieldNumber = 1; private static readonly pb::FieldCodec<string> _repeated_paths_codec = pb::FieldCodec.ForString(10); private readonly pbc::RepeatedField<string> paths_ = new pbc::RepeatedField<string>(); + /// <summary> + /// The set of field mask paths. + /// </summary> public pbc::RepeatedField<string> Paths { get { return paths_; } } diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs b/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs index 8347999d..d87c54bd 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs @@ -11,10 +11,12 @@ namespace Google.Protobuf.WellKnownTypes { namespace Proto { + /// <summary>Holder for reflection information generated from google/protobuf/source_context.proto</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class SourceContext { #region Descriptor + /// <summary>File descriptor for google/protobuf/source_context.proto</summary> public static pbr::FileDescriptor Descriptor { get { return descriptor; } } @@ -23,11 +25,11 @@ namespace Google.Protobuf.WellKnownTypes { static SourceContext() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "CiRnb29nbGUvcHJvdG9idWYvc291cmNlX2NvbnRleHQucHJvdG8SD2dvb2ds", - "ZS5wcm90b2J1ZiIiCg1Tb3VyY2VDb250ZXh0EhEKCWZpbGVfbmFtZRgBIAEo", - "CUJSChNjb20uZ29vZ2xlLnByb3RvYnVmQhJTb3VyY2VDb250ZXh0UHJvdG9Q", - "AaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJv", - "dG8z")); + "CiRnb29nbGUvcHJvdG9idWYvc291cmNlX2NvbnRleHQucHJvdG8SD2dvb2ds", + "ZS5wcm90b2J1ZiIiCg1Tb3VyY2VDb250ZXh0EhEKCWZpbGVfbmFtZRgBIAEo", + "CUJVChNjb20uZ29vZ2xlLnByb3RvYnVmQhJTb3VyY2VDb250ZXh0UHJvdG9Q", + "AaABAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IG", + "cHJvdG8z")); descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] { @@ -39,6 +41,10 @@ namespace Google.Protobuf.WellKnownTypes { } } #region Messages + /// <summary> + /// `SourceContext` represents information about the source of a + /// protobuf element, like the file in which it is defined. + /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class SourceContext : pb::IMessage<SourceContext> { private static readonly pb::MessageParser<SourceContext> _parser = new pb::MessageParser<SourceContext>(() => new SourceContext()); @@ -66,8 +72,13 @@ namespace Google.Protobuf.WellKnownTypes { return new SourceContext(this); } + /// <summary>Field number for the "file_name" field.</summary> public const int FileNameFieldNumber = 1; private string fileName_ = ""; + /// <summary> + /// The path-qualified name of the .proto file that contained the associated + /// protobuf element. For example: `"google/protobuf/source.proto"`. + /// </summary> public string FileName { get { return fileName_; } set { diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs index 1e8a8236..a9961bea 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs @@ -11,10 +11,12 @@ namespace Google.Protobuf.WellKnownTypes { namespace Proto { + /// <summary>Holder for reflection information generated from google/protobuf/struct.proto</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class Struct { #region Descriptor + /// <summary>File descriptor for google/protobuf/struct.proto</summary> public static pbr::FileDescriptor Descriptor { get { return descriptor; } } @@ -23,19 +25,19 @@ namespace Google.Protobuf.WellKnownTypes { static Struct() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "Chxnb29nbGUvcHJvdG9idWYvc3RydWN0LnByb3RvEg9nb29nbGUucHJvdG9i", - "dWYihAEKBlN0cnVjdBIzCgZmaWVsZHMYASADKAsyIy5nb29nbGUucHJvdG9i", - "dWYuU3RydWN0LkZpZWxkc0VudHJ5GkUKC0ZpZWxkc0VudHJ5EgsKA2tleRgB", - "IAEoCRIlCgV2YWx1ZRgCIAEoCzIWLmdvb2dsZS5wcm90b2J1Zi5WYWx1ZToC", - "OAEi6gEKBVZhbHVlEjAKCm51bGxfdmFsdWUYASABKA4yGi5nb29nbGUucHJv", - "dG9idWYuTnVsbFZhbHVlSAASFgoMbnVtYmVyX3ZhbHVlGAIgASgBSAASFgoM", - "c3RyaW5nX3ZhbHVlGAMgASgJSAASFAoKYm9vbF92YWx1ZRgEIAEoCEgAEi8K", - "DHN0cnVjdF92YWx1ZRgFIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RI", - "ABIwCgpsaXN0X3ZhbHVlGAYgASgLMhouZ29vZ2xlLnByb3RvYnVmLkxpc3RW", - "YWx1ZUgAQgYKBGtpbmQiMwoJTGlzdFZhbHVlEiYKBnZhbHVlcxgBIAMoCzIW", - "Lmdvb2dsZS5wcm90b2J1Zi5WYWx1ZSobCglOdWxsVmFsdWUSDgoKTlVMTF9W", - "QUxVRRAAQk4KE2NvbS5nb29nbGUucHJvdG9idWZCC1N0cnVjdFByb3RvUAGg", - "AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnBy", + "Chxnb29nbGUvcHJvdG9idWYvc3RydWN0LnByb3RvEg9nb29nbGUucHJvdG9i", + "dWYihAEKBlN0cnVjdBIzCgZmaWVsZHMYASADKAsyIy5nb29nbGUucHJvdG9i", + "dWYuU3RydWN0LkZpZWxkc0VudHJ5GkUKC0ZpZWxkc0VudHJ5EgsKA2tleRgB", + "IAEoCRIlCgV2YWx1ZRgCIAEoCzIWLmdvb2dsZS5wcm90b2J1Zi5WYWx1ZToC", + "OAEi6gEKBVZhbHVlEjAKCm51bGxfdmFsdWUYASABKA4yGi5nb29nbGUucHJv", + "dG9idWYuTnVsbFZhbHVlSAASFgoMbnVtYmVyX3ZhbHVlGAIgASgBSAASFgoM", + "c3RyaW5nX3ZhbHVlGAMgASgJSAASFAoKYm9vbF92YWx1ZRgEIAEoCEgAEi8K", + "DHN0cnVjdF92YWx1ZRgFIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RI", + "ABIwCgpsaXN0X3ZhbHVlGAYgASgLMhouZ29vZ2xlLnByb3RvYnVmLkxpc3RW", + "YWx1ZUgAQgYKBGtpbmQiMwoJTGlzdFZhbHVlEiYKBnZhbHVlcxgBIAMoCzIW", + "Lmdvb2dsZS5wcm90b2J1Zi5WYWx1ZSobCglOdWxsVmFsdWUSDgoKTlVMTF9W", + "QUxVRRAAQk4KE2NvbS5nb29nbGUucHJvdG9idWZCC1N0cnVjdFByb3RvUAGg", + "AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnBy", "b3RvMw==")); descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, new pbr::FileDescriptor[] { }, @@ -50,13 +52,30 @@ namespace Google.Protobuf.WellKnownTypes { } } #region Enums + /// <summary> + /// `NullValue` is a singleton enumeration to represent the null value for the + /// `Value` type union. + /// The JSON representation for `NullValue` is JSON `null`. + /// </summary> public enum NullValue { + /// <summary> + /// Null value. + /// </summary> NULL_VALUE = 0, } #endregion #region Messages + /// <summary> + /// `Struct` represents a structured data value, consisting of fields + /// which map to dynamically typed values. In some languages, `Struct` + /// might be supported by a native representation. For example, in + /// scripting languages like JS a struct is represented as an + /// object. The details of that representation are described together + /// with the proto support for the language. + /// The JSON representation for `Struct` is JSON object. + /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Struct : pb::IMessage<Struct> { private static readonly pb::MessageParser<Struct> _parser = new pb::MessageParser<Struct>(() => new Struct()); @@ -84,10 +103,14 @@ namespace Google.Protobuf.WellKnownTypes { return new Struct(this); } + /// <summary>Field number for the "fields" field.</summary> public const int FieldsFieldNumber = 1; private static readonly pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value>.Codec _map_fields_codec = new pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value>.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Value.Parser), 10); private readonly pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value> fields_ = new pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value>(); + /// <summary> + /// Map of dynamically typed values. + /// </summary> public pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value> Fields { get { return fields_; } } @@ -151,6 +174,13 @@ namespace Google.Protobuf.WellKnownTypes { } + /// <summary> + /// `Value` represents a dynamically typed value which can be either + /// null, a number, a string, a boolean, a recursive struct value, or a + /// list of values. A producer of value is expected to set one of that + /// variants, absence of any variant indicates an error. + /// The JSON representation for `Value` is JSON value. + /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Value : pb::IMessage<Value> { private static readonly pb::MessageParser<Value> _parser = new pb::MessageParser<Value>(() => new Value()); @@ -198,7 +228,11 @@ namespace Google.Protobuf.WellKnownTypes { return new Value(this); } + /// <summary>Field number for the "null_value" field.</summary> public const int NullValueFieldNumber = 1; + /// <summary> + /// Represents a null value. + /// </summary> public global::Google.Protobuf.WellKnownTypes.NullValue NullValue { get { return kindCase_ == KindOneofCase.NullValue ? (global::Google.Protobuf.WellKnownTypes.NullValue) kind_ : global::Google.Protobuf.WellKnownTypes.NullValue.NULL_VALUE; } set { @@ -207,7 +241,11 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "number_value" field.</summary> public const int NumberValueFieldNumber = 2; + /// <summary> + /// Represents a double value. + /// </summary> public double NumberValue { get { return kindCase_ == KindOneofCase.NumberValue ? (double) kind_ : 0D; } set { @@ -216,7 +254,11 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "string_value" field.</summary> public const int StringValueFieldNumber = 3; + /// <summary> + /// Represents a string value. + /// </summary> public string StringValue { get { return kindCase_ == KindOneofCase.StringValue ? (string) kind_ : ""; } set { @@ -225,7 +267,11 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "bool_value" field.</summary> public const int BoolValueFieldNumber = 4; + /// <summary> + /// Represents a boolean value. + /// </summary> public bool BoolValue { get { return kindCase_ == KindOneofCase.BoolValue ? (bool) kind_ : false; } set { @@ -234,7 +280,11 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "struct_value" field.</summary> public const int StructValueFieldNumber = 5; + /// <summary> + /// Represents a structured value. + /// </summary> public global::Google.Protobuf.WellKnownTypes.Struct StructValue { get { return kindCase_ == KindOneofCase.StructValue ? (global::Google.Protobuf.WellKnownTypes.Struct) kind_ : null; } set { @@ -243,7 +293,11 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "list_value" field.</summary> public const int ListValueFieldNumber = 6; + /// <summary> + /// Represents a repeated `Value`. + /// </summary> public global::Google.Protobuf.WellKnownTypes.ListValue ListValue { get { return kindCase_ == KindOneofCase.ListValue ? (global::Google.Protobuf.WellKnownTypes.ListValue) kind_ : null; } set { @@ -253,6 +307,7 @@ namespace Google.Protobuf.WellKnownTypes { } private object kind_; + /// <summary>Enum of possible cases for the "kind" oneof.</summary> public enum KindOneofCase { None = 0, NullValue = 1, @@ -432,6 +487,10 @@ namespace Google.Protobuf.WellKnownTypes { } + /// <summary> + /// `ListValue` is a wrapper around a repeated field of values. + /// The JSON representation for `ListValue` is JSON array. + /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class ListValue : pb::IMessage<ListValue> { private static readonly pb::MessageParser<ListValue> _parser = new pb::MessageParser<ListValue>(() => new ListValue()); @@ -459,10 +518,14 @@ namespace Google.Protobuf.WellKnownTypes { return new ListValue(this); } + /// <summary>Field number for the "values" field.</summary> public const int ValuesFieldNumber = 1; private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Value> _repeated_values_codec = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.WellKnownTypes.Value.Parser); private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Value> values_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Value>(); + /// <summary> + /// Repeated field of dynamically typed values. + /// </summary> public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Value> Values { get { return values_; } } diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs index d7c0954f..f372f8fd 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs @@ -11,10 +11,12 @@ namespace Google.Protobuf.WellKnownTypes { namespace Proto { + /// <summary>Holder for reflection information generated from google/protobuf/timestamp.proto</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class Timestamp { #region Descriptor + /// <summary>File descriptor for google/protobuf/timestamp.proto</summary> public static pbr::FileDescriptor Descriptor { get { return descriptor; } } @@ -23,10 +25,10 @@ namespace Google.Protobuf.WellKnownTypes { static Timestamp() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "Ch9nb29nbGUvcHJvdG9idWYvdGltZXN0YW1wLnByb3RvEg9nb29nbGUucHJv", - "dG9idWYiKwoJVGltZXN0YW1wEg8KB3NlY29uZHMYASABKAMSDQoFbmFub3MY", - "AiABKAVCUQoTY29tLmdvb2dsZS5wcm90b2J1ZkIOVGltZXN0YW1wUHJvdG9Q", - "AaABAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IG", + "Ch9nb29nbGUvcHJvdG9idWYvdGltZXN0YW1wLnByb3RvEg9nb29nbGUucHJv", + "dG9idWYiKwoJVGltZXN0YW1wEg8KB3NlY29uZHMYASABKAMSDQoFbmFub3MY", + "AiABKAVCUQoTY29tLmdvb2dsZS5wcm90b2J1ZkIOVGltZXN0YW1wUHJvdG9Q", + "AaABAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IG", "cHJvdG8z")); descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, new pbr::FileDescriptor[] { }, @@ -39,6 +41,47 @@ namespace Google.Protobuf.WellKnownTypes { } } #region Messages + /// <summary> + /// A Timestamp represents a point in time independent of any time zone + /// or calendar, represented as seconds and fractions of seconds at + /// nanosecond resolution in UTC Epoch time. It is encoded using the + /// Proleptic Gregorian Calendar which extends the Gregorian calendar + /// backwards to year one. It is encoded assuming all minutes are 60 + /// seconds long, i.e. leap seconds are "smeared" so that no leap second + /// table is needed for interpretation. Range is from + /// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. + /// By restricting to that range, we ensure that we can convert to + /// and from RFC 3339 date strings. + /// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt). + /// Example 1: Compute Timestamp from POSIX `time()`. + /// Timestamp timestamp; + /// timestamp.set_seconds(time(NULL)); + /// timestamp.set_nanos(0); + /// Example 2: Compute Timestamp from POSIX `gettimeofday()`. + /// struct timeval tv; + /// gettimeofday(&tv, NULL); + /// Timestamp timestamp; + /// timestamp.set_seconds(tv.tv_sec); + /// timestamp.set_nanos(tv.tv_usec * 1000); + /// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + /// FILETIME ft; + /// GetSystemTimeAsFileTime(&ft); + /// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + /// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + /// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + /// Timestamp timestamp; + /// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + /// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + /// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + /// long millis = System.currentTimeMillis(); + /// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + /// .setNanos((int) ((millis % 1000) * 1000000)).build(); + /// Example 5: Compute Timestamp from current time in Python. + /// now = time.time() + /// seconds = int(now) + /// nanos = int((now - seconds) * 10**9) + /// timestamp = Timestamp(seconds=seconds, nanos=nanos) + /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Timestamp : pb::IMessage<Timestamp> { private static readonly pb::MessageParser<Timestamp> _parser = new pb::MessageParser<Timestamp>(() => new Timestamp()); @@ -67,8 +110,14 @@ namespace Google.Protobuf.WellKnownTypes { return new Timestamp(this); } + /// <summary>Field number for the "seconds" field.</summary> public const int SecondsFieldNumber = 1; private long seconds_; + /// <summary> + /// Represents seconds of UTC time since Unix epoch + /// 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to + /// 9999-12-31T23:59:59Z inclusive. + /// </summary> public long Seconds { get { return seconds_; } set { @@ -76,8 +125,15 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "nanos" field.</summary> public const int NanosFieldNumber = 2; private int nanos_; + /// <summary> + /// Non-negative fractions of a second at nanosecond resolution. Negative + /// second values with fractions must still have non-negative nanos values + /// that count forward in time. Must be from 0 to 999,999,999 + /// inclusive. + /// </summary> public int Nanos { get { return nanos_; } set { diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs index ff2ecc57..3be90853 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs @@ -11,10 +11,12 @@ namespace Google.Protobuf.WellKnownTypes { namespace Proto { + /// <summary>Holder for reflection information generated from google/protobuf/type.proto</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class Type { #region Descriptor + /// <summary>File descriptor for google/protobuf/type.proto</summary> public static pbr::FileDescriptor Descriptor { get { return descriptor; } } @@ -23,43 +25,46 @@ namespace Google.Protobuf.WellKnownTypes { static Type() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "Chpnb29nbGUvcHJvdG9idWYvdHlwZS5wcm90bxIPZ29vZ2xlLnByb3RvYnVm", - "Ghlnb29nbGUvcHJvdG9idWYvYW55LnByb3RvGiRnb29nbGUvcHJvdG9idWYv", - "c291cmNlX2NvbnRleHQucHJvdG8irgEKBFR5cGUSDAoEbmFtZRgBIAEoCRIm", - "CgZmaWVsZHMYAiADKAsyFi5nb29nbGUucHJvdG9idWYuRmllbGQSDgoGb25l", - "b2ZzGAMgAygJEigKB29wdGlvbnMYBCADKAsyFy5nb29nbGUucHJvdG9idWYu", - "T3B0aW9uEjYKDnNvdXJjZV9jb250ZXh0GAUgASgLMh4uZ29vZ2xlLnByb3Rv", - "YnVmLlNvdXJjZUNvbnRleHQimwUKBUZpZWxkEikKBGtpbmQYASABKA4yGy5n", - "b29nbGUucHJvdG9idWYuRmllbGQuS2luZBI3CgtjYXJkaW5hbGl0eRgCIAEo", - "DjIiLmdvb2dsZS5wcm90b2J1Zi5GaWVsZC5DYXJkaW5hbGl0eRIOCgZudW1i", - "ZXIYAyABKAUSDAoEbmFtZRgEIAEoCRIQCgh0eXBlX3VybBgGIAEoCRITCgtv", - "bmVvZl9pbmRleBgHIAEoBRIOCgZwYWNrZWQYCCABKAgSKAoHb3B0aW9ucxgJ", - "IAMoCzIXLmdvb2dsZS5wcm90b2J1Zi5PcHRpb24iuAIKBEtpbmQSEAoMVFlQ", - "RV9VTktOT1dOEAASDwoLVFlQRV9ET1VCTEUQARIOCgpUWVBFX0ZMT0FUEAIS", - "DgoKVFlQRV9JTlQ2NBADEg8KC1RZUEVfVUlOVDY0EAQSDgoKVFlQRV9JTlQz", - "MhAFEhAKDFRZUEVfRklYRUQ2NBAGEhAKDFRZUEVfRklYRUQzMhAHEg0KCVRZ", - "UEVfQk9PTBAIEg8KC1RZUEVfU1RSSU5HEAkSEAoMVFlQRV9NRVNTQUdFEAsS", - "DgoKVFlQRV9CWVRFUxAMEg8KC1RZUEVfVUlOVDMyEA0SDQoJVFlQRV9FTlVN", - "EA4SEQoNVFlQRV9TRklYRUQzMhAPEhEKDVRZUEVfU0ZJWEVENjQQEBIPCgtU", - "WVBFX1NJTlQzMhAREg8KC1RZUEVfU0lOVDY0EBIidAoLQ2FyZGluYWxpdHkS", - "FwoTQ0FSRElOQUxJVFlfVU5LTk9XThAAEhgKFENBUkRJTkFMSVRZX09QVElP", - "TkFMEAESGAoUQ0FSRElOQUxJVFlfUkVRVUlSRUQQAhIYChRDQVJESU5BTElU", - "WV9SRVBFQVRFRBADIqUBCgRFbnVtEgwKBG5hbWUYASABKAkSLQoJZW51bXZh", - "bHVlGAIgAygLMhouZ29vZ2xlLnByb3RvYnVmLkVudW1WYWx1ZRIoCgdvcHRp", - "b25zGAMgAygLMhcuZ29vZ2xlLnByb3RvYnVmLk9wdGlvbhI2Cg5zb3VyY2Vf", - "Y29udGV4dBgEIAEoCzIeLmdvb2dsZS5wcm90b2J1Zi5Tb3VyY2VDb250ZXh0", - "IlMKCUVudW1WYWx1ZRIMCgRuYW1lGAEgASgJEg4KBm51bWJlchgCIAEoBRIo", - "CgdvcHRpb25zGAMgAygLMhcuZ29vZ2xlLnByb3RvYnVmLk9wdGlvbiI7CgZP", - "cHRpb24SDAoEbmFtZRgBIAEoCRIjCgV2YWx1ZRgCIAEoCzIULmdvb2dsZS5w", - "cm90b2J1Zi5BbnlCSQoTY29tLmdvb2dsZS5wcm90b2J1ZkIJVHlwZVByb3Rv", - "UAGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnBy", - "b3RvMw==")); + "Chpnb29nbGUvcHJvdG9idWYvdHlwZS5wcm90bxIPZ29vZ2xlLnByb3RvYnVm", + "Ghlnb29nbGUvcHJvdG9idWYvYW55LnByb3RvGiRnb29nbGUvcHJvdG9idWYv", + "c291cmNlX2NvbnRleHQucHJvdG8i1wEKBFR5cGUSDAoEbmFtZRgBIAEoCRIm", + "CgZmaWVsZHMYAiADKAsyFi5nb29nbGUucHJvdG9idWYuRmllbGQSDgoGb25l", + "b2ZzGAMgAygJEigKB29wdGlvbnMYBCADKAsyFy5nb29nbGUucHJvdG9idWYu", + "T3B0aW9uEjYKDnNvdXJjZV9jb250ZXh0GAUgASgLMh4uZ29vZ2xlLnByb3Rv", + "YnVmLlNvdXJjZUNvbnRleHQSJwoGc3ludGF4GAYgASgOMhcuZ29vZ2xlLnBy", + "b3RvYnVmLlN5bnRheCK+BQoFRmllbGQSKQoEa2luZBgBIAEoDjIbLmdvb2ds", + "ZS5wcm90b2J1Zi5GaWVsZC5LaW5kEjcKC2NhcmRpbmFsaXR5GAIgASgOMiIu", + "Z29vZ2xlLnByb3RvYnVmLkZpZWxkLkNhcmRpbmFsaXR5Eg4KBm51bWJlchgD", + "IAEoBRIMCgRuYW1lGAQgASgJEhAKCHR5cGVfdXJsGAYgASgJEhMKC29uZW9m", + "X2luZGV4GAcgASgFEg4KBnBhY2tlZBgIIAEoCBIoCgdvcHRpb25zGAkgAygL", + "MhcuZ29vZ2xlLnByb3RvYnVmLk9wdGlvbhIRCglqc29uX25hbWUYCiABKAki", + "yAIKBEtpbmQSEAoMVFlQRV9VTktOT1dOEAASDwoLVFlQRV9ET1VCTEUQARIO", + "CgpUWVBFX0ZMT0FUEAISDgoKVFlQRV9JTlQ2NBADEg8KC1RZUEVfVUlOVDY0", + "EAQSDgoKVFlQRV9JTlQzMhAFEhAKDFRZUEVfRklYRUQ2NBAGEhAKDFRZUEVf", + "RklYRUQzMhAHEg0KCVRZUEVfQk9PTBAIEg8KC1RZUEVfU1RSSU5HEAkSDgoK", + "VFlQRV9HUk9VUBAKEhAKDFRZUEVfTUVTU0FHRRALEg4KClRZUEVfQllURVMQ", + "DBIPCgtUWVBFX1VJTlQzMhANEg0KCVRZUEVfRU5VTRAOEhEKDVRZUEVfU0ZJ", + "WEVEMzIQDxIRCg1UWVBFX1NGSVhFRDY0EBASDwoLVFlQRV9TSU5UMzIQERIP", + "CgtUWVBFX1NJTlQ2NBASInQKC0NhcmRpbmFsaXR5EhcKE0NBUkRJTkFMSVRZ", + "X1VOS05PV04QABIYChRDQVJESU5BTElUWV9PUFRJT05BTBABEhgKFENBUkRJ", + "TkFMSVRZX1JFUVVJUkVEEAISGAoUQ0FSRElOQUxJVFlfUkVQRUFURUQQAyLO", + "AQoERW51bRIMCgRuYW1lGAEgASgJEi0KCWVudW12YWx1ZRgCIAMoCzIaLmdv", + "b2dsZS5wcm90b2J1Zi5FbnVtVmFsdWUSKAoHb3B0aW9ucxgDIAMoCzIXLmdv", + "b2dsZS5wcm90b2J1Zi5PcHRpb24SNgoOc291cmNlX2NvbnRleHQYBCABKAsy", + "Hi5nb29nbGUucHJvdG9idWYuU291cmNlQ29udGV4dBInCgZzeW50YXgYBSAB", + "KA4yFy5nb29nbGUucHJvdG9idWYuU3ludGF4IlMKCUVudW1WYWx1ZRIMCgRu", + "YW1lGAEgASgJEg4KBm51bWJlchgCIAEoBRIoCgdvcHRpb25zGAMgAygLMhcu", + "Z29vZ2xlLnByb3RvYnVmLk9wdGlvbiI7CgZPcHRpb24SDAoEbmFtZRgBIAEo", + "CRIjCgV2YWx1ZRgCIAEoCzIULmdvb2dsZS5wcm90b2J1Zi5BbnkqLgoGU3lu", + "dGF4EhEKDVNZTlRBWF9QUk9UTzIQABIRCg1TWU5UQVhfUFJPVE8zEAFCTAoT", + "Y29tLmdvb2dsZS5wcm90b2J1ZkIJVHlwZVByb3RvUAGgAQGiAgNHUEKqAh5H", + "b29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.Proto.Any.Descriptor, global::Google.Protobuf.WellKnownTypes.Proto.SourceContext.Descriptor, }, - new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] { - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Type), new[]{ "Name", "Fields", "Oneofs", "Options", "SourceContext" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Field), new[]{ "Kind", "Cardinality", "Number", "Name", "TypeUrl", "OneofIndex", "Packed", "Options" }, null, new[]{ typeof(global::Google.Protobuf.WellKnownTypes.Field.Types.Kind), typeof(global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality) }, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Enum), new[]{ "Name", "Enumvalue", "Options", "SourceContext" }, null, null, null), + new pbr::GeneratedCodeInfo(new[] {typeof(global::Google.Protobuf.WellKnownTypes.Syntax), }, new pbr::GeneratedCodeInfo[] { + new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Type), new[]{ "Name", "Fields", "Oneofs", "Options", "SourceContext", "Syntax" }, null, null, null), + new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Field), new[]{ "Kind", "Cardinality", "Number", "Name", "TypeUrl", "OneofIndex", "Packed", "Options", "JsonName" }, null, new[]{ typeof(global::Google.Protobuf.WellKnownTypes.Field.Types.Kind), typeof(global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality) }, null), + new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Enum), new[]{ "Name", "Enumvalue", "Options", "SourceContext", "Syntax" }, null, null, null), new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.EnumValue), new[]{ "Name", "Number", "Options" }, null, null, null), new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Option), new[]{ "Name", "Value" }, null, null, null) })); @@ -68,7 +73,27 @@ namespace Google.Protobuf.WellKnownTypes { } } + #region Enums + /// <summary> + /// Syntax specifies the syntax in which a service element was defined. + /// </summary> + public enum Syntax { + /// <summary> + /// Syntax "proto2" + /// </summary> + SYNTAX_PROTO2 = 0, + /// <summary> + /// Syntax "proto3" + /// </summary> + SYNTAX_PROTO3 = 1, + } + + #endregion + #region Messages + /// <summary> + /// A light-weight descriptor for a proto message type. + /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Type : pb::IMessage<Type> { private static readonly pb::MessageParser<Type> _parser = new pb::MessageParser<Type>(() => new Type()); @@ -94,14 +119,19 @@ namespace Google.Protobuf.WellKnownTypes { oneofs_ = other.oneofs_.Clone(); options_ = other.options_.Clone(); SourceContext = other.sourceContext_ != null ? other.SourceContext.Clone() : null; + syntax_ = other.syntax_; } public Type Clone() { return new Type(this); } + /// <summary>Field number for the "name" field.</summary> public const int NameFieldNumber = 1; private string name_ = ""; + /// <summary> + /// The fully qualified message name. + /// </summary> public string Name { get { return name_; } set { @@ -109,32 +139,48 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "fields" field.</summary> public const int FieldsFieldNumber = 2; private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Field> _repeated_fields_codec = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Field.Parser); private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Field> fields_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Field>(); + /// <summary> + /// The list of fields. + /// </summary> public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Field> Fields { get { return fields_; } } + /// <summary>Field number for the "oneofs" field.</summary> public const int OneofsFieldNumber = 3; private static readonly pb::FieldCodec<string> _repeated_oneofs_codec = pb::FieldCodec.ForString(26); private readonly pbc::RepeatedField<string> oneofs_ = new pbc::RepeatedField<string>(); + /// <summary> + /// The list of oneof definitions. + /// </summary> public pbc::RepeatedField<string> Oneofs { get { return oneofs_; } } + /// <summary>Field number for the "options" field.</summary> public const int OptionsFieldNumber = 4; private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Option> _repeated_options_codec = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.WellKnownTypes.Option.Parser); private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> options_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option>(); + /// <summary> + /// The proto options. + /// </summary> public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> Options { get { return options_; } } + /// <summary>Field number for the "source_context" field.</summary> public const int SourceContextFieldNumber = 5; private global::Google.Protobuf.WellKnownTypes.SourceContext sourceContext_; + /// <summary> + /// The source context. + /// </summary> public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContext { get { return sourceContext_; } set { @@ -142,6 +188,19 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "syntax" field.</summary> + public const int SyntaxFieldNumber = 6; + private global::Google.Protobuf.WellKnownTypes.Syntax syntax_ = global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2; + /// <summary> + /// The source syntax. + /// </summary> + public global::Google.Protobuf.WellKnownTypes.Syntax Syntax { + get { return syntax_; } + set { + syntax_ = value; + } + } + public override bool Equals(object other) { return Equals(other as Type); } @@ -158,6 +217,7 @@ namespace Google.Protobuf.WellKnownTypes { if(!oneofs_.Equals(other.oneofs_)) return false; if(!options_.Equals(other.options_)) return false; if (!object.Equals(SourceContext, other.SourceContext)) return false; + if (Syntax != other.Syntax) return false; return true; } @@ -168,6 +228,7 @@ namespace Google.Protobuf.WellKnownTypes { hash ^= oneofs_.GetHashCode(); hash ^= options_.GetHashCode(); if (sourceContext_ != null) hash ^= SourceContext.GetHashCode(); + if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) hash ^= Syntax.GetHashCode(); return hash; } @@ -187,6 +248,10 @@ namespace Google.Protobuf.WellKnownTypes { output.WriteRawTag(42); output.WriteMessage(SourceContext); } + if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) { + output.WriteRawTag(48); + output.WriteEnum((int) Syntax); + } } public int CalculateSize() { @@ -200,6 +265,9 @@ namespace Google.Protobuf.WellKnownTypes { if (sourceContext_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(SourceContext); } + if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax); + } return size; } @@ -219,6 +287,9 @@ namespace Google.Protobuf.WellKnownTypes { } SourceContext.MergeFrom(other.SourceContext); } + if (other.Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) { + Syntax = other.Syntax; + } } public void MergeFrom(pb::CodedInputStream input) { @@ -251,12 +322,19 @@ namespace Google.Protobuf.WellKnownTypes { input.ReadMessage(sourceContext_); break; } + case 48: { + syntax_ = (global::Google.Protobuf.WellKnownTypes.Syntax) input.ReadEnum(); + break; + } } } } } + /// <summary> + /// Field represents a single field of a message type. + /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Field : pb::IMessage<Field> { private static readonly pb::MessageParser<Field> _parser = new pb::MessageParser<Field>(() => new Field()); @@ -285,14 +363,19 @@ namespace Google.Protobuf.WellKnownTypes { oneofIndex_ = other.oneofIndex_; packed_ = other.packed_; options_ = other.options_.Clone(); + jsonName_ = other.jsonName_; } public Field Clone() { return new Field(this); } + /// <summary>Field number for the "kind" field.</summary> public const int KindFieldNumber = 1; private global::Google.Protobuf.WellKnownTypes.Field.Types.Kind kind_ = global::Google.Protobuf.WellKnownTypes.Field.Types.Kind.TYPE_UNKNOWN; + /// <summary> + /// The field kind. + /// </summary> public global::Google.Protobuf.WellKnownTypes.Field.Types.Kind Kind { get { return kind_; } set { @@ -300,8 +383,12 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "cardinality" field.</summary> public const int CardinalityFieldNumber = 2; private global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality cardinality_ = global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality.CARDINALITY_UNKNOWN; + /// <summary> + /// The field cardinality, i.e. optional/required/repeated. + /// </summary> public global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality Cardinality { get { return cardinality_; } set { @@ -309,8 +396,12 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "number" field.</summary> public const int NumberFieldNumber = 3; private int number_; + /// <summary> + /// The proto field number. + /// </summary> public int Number { get { return number_; } set { @@ -318,8 +409,12 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "name" field.</summary> public const int NameFieldNumber = 4; private string name_ = ""; + /// <summary> + /// The field name. + /// </summary> public string Name { get { return name_; } set { @@ -327,8 +422,13 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "type_url" field.</summary> public const int TypeUrlFieldNumber = 6; private string typeUrl_ = ""; + /// <summary> + /// The type URL (without the scheme) when the type is MESSAGE or ENUM, + /// such as `type.googleapis.com/google.protobuf.Empty`. + /// </summary> public string TypeUrl { get { return typeUrl_; } set { @@ -336,8 +436,12 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "oneof_index" field.</summary> public const int OneofIndexFieldNumber = 7; private int oneofIndex_; + /// <summary> + /// Index in Type.oneofs. Starts at 1. Zero means no oneof mapping. + /// </summary> public int OneofIndex { get { return oneofIndex_; } set { @@ -345,8 +449,12 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "packed" field.</summary> public const int PackedFieldNumber = 8; private bool packed_; + /// <summary> + /// Whether to use alternative packed wire representation. + /// </summary> public bool Packed { get { return packed_; } set { @@ -354,14 +462,31 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "options" field.</summary> public const int OptionsFieldNumber = 9; private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Option> _repeated_options_codec = pb::FieldCodec.ForMessage(74, global::Google.Protobuf.WellKnownTypes.Option.Parser); private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> options_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option>(); + /// <summary> + /// The proto options. + /// </summary> public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> Options { get { return options_; } } + /// <summary>Field number for the "json_name" field.</summary> + public const int JsonNameFieldNumber = 10; + private string jsonName_ = ""; + /// <summary> + /// The JSON name for this field. + /// </summary> + public string JsonName { + get { return jsonName_; } + set { + jsonName_ = pb::Preconditions.CheckNotNull(value, "value"); + } + } + public override bool Equals(object other) { return Equals(other as Field); } @@ -381,6 +506,7 @@ namespace Google.Protobuf.WellKnownTypes { if (OneofIndex != other.OneofIndex) return false; if (Packed != other.Packed) return false; if(!options_.Equals(other.options_)) return false; + if (JsonName != other.JsonName) return false; return true; } @@ -394,6 +520,7 @@ namespace Google.Protobuf.WellKnownTypes { if (OneofIndex != 0) hash ^= OneofIndex.GetHashCode(); if (Packed != false) hash ^= Packed.GetHashCode(); hash ^= options_.GetHashCode(); + if (JsonName.Length != 0) hash ^= JsonName.GetHashCode(); return hash; } @@ -431,6 +558,10 @@ namespace Google.Protobuf.WellKnownTypes { output.WriteBool(Packed); } options_.WriteTo(output, _repeated_options_codec); + if (JsonName.Length != 0) { + output.WriteRawTag(82); + output.WriteString(JsonName); + } } public int CalculateSize() { @@ -457,6 +588,9 @@ namespace Google.Protobuf.WellKnownTypes { size += 1 + 1; } size += options_.CalculateSize(_repeated_options_codec); + if (JsonName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(JsonName); + } return size; } @@ -486,6 +620,9 @@ namespace Google.Protobuf.WellKnownTypes { Packed = other.Packed; } options_.Add(other.options_); + if (other.JsonName.Length != 0) { + JsonName = other.JsonName; + } } public void MergeFrom(pb::CodedInputStream input) { @@ -527,38 +664,120 @@ namespace Google.Protobuf.WellKnownTypes { options_.AddEntriesFrom(input, _repeated_options_codec); break; } + case 82: { + JsonName = input.ReadString(); + break; + } } } } #region Nested types + /// <summary>Container for nested types declared in the Field message type.</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class Types { + /// <summary> + /// Kind represents a basic field type. + /// </summary> public enum Kind { + /// <summary> + /// Field type unknown. + /// </summary> TYPE_UNKNOWN = 0, + /// <summary> + /// Field type double. + /// </summary> TYPE_DOUBLE = 1, + /// <summary> + /// Field type float. + /// </summary> TYPE_FLOAT = 2, + /// <summary> + /// Field type int64. + /// </summary> TYPE_INT64 = 3, + /// <summary> + /// Field type uint64. + /// </summary> TYPE_UINT64 = 4, + /// <summary> + /// Field type int32. + /// </summary> TYPE_INT32 = 5, + /// <summary> + /// Field type fixed64. + /// </summary> TYPE_FIXED64 = 6, + /// <summary> + /// Field type fixed32. + /// </summary> TYPE_FIXED32 = 7, + /// <summary> + /// Field type bool. + /// </summary> TYPE_BOOL = 8, + /// <summary> + /// Field type string. + /// </summary> TYPE_STRING = 9, + /// <summary> + /// Field type group (deprecated proto2 type) + /// </summary> + TYPE_GROUP = 10, + /// <summary> + /// Field type message. + /// </summary> TYPE_MESSAGE = 11, + /// <summary> + /// Field type bytes. + /// </summary> TYPE_BYTES = 12, + /// <summary> + /// Field type uint32. + /// </summary> TYPE_UINT32 = 13, + /// <summary> + /// Field type enum. + /// </summary> TYPE_ENUM = 14, + /// <summary> + /// Field type sfixed32. + /// </summary> TYPE_SFIXED32 = 15, + /// <summary> + /// Field type sfixed64. + /// </summary> TYPE_SFIXED64 = 16, + /// <summary> + /// Field type sint32. + /// </summary> TYPE_SINT32 = 17, + /// <summary> + /// Field type sint64. + /// </summary> TYPE_SINT64 = 18, } + /// <summary> + /// Cardinality represents whether a field is optional, required, or + /// repeated. + /// </summary> public enum Cardinality { + /// <summary> + /// The field cardinality is unknown. Typically an error condition. + /// </summary> CARDINALITY_UNKNOWN = 0, + /// <summary> + /// For optional fields. + /// </summary> CARDINALITY_OPTIONAL = 1, + /// <summary> + /// For required fields. Not used for proto3. + /// </summary> CARDINALITY_REQUIRED = 2, + /// <summary> + /// For repeated fields. + /// </summary> CARDINALITY_REPEATED = 3, } @@ -567,6 +786,9 @@ namespace Google.Protobuf.WellKnownTypes { } + /// <summary> + /// Enum type definition. + /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Enum : pb::IMessage<Enum> { private static readonly pb::MessageParser<Enum> _parser = new pb::MessageParser<Enum>(() => new Enum()); @@ -591,14 +813,19 @@ namespace Google.Protobuf.WellKnownTypes { enumvalue_ = other.enumvalue_.Clone(); options_ = other.options_.Clone(); SourceContext = other.sourceContext_ != null ? other.SourceContext.Clone() : null; + syntax_ = other.syntax_; } public Enum Clone() { return new Enum(this); } + /// <summary>Field number for the "name" field.</summary> public const int NameFieldNumber = 1; private string name_ = ""; + /// <summary> + /// Enum type name. + /// </summary> public string Name { get { return name_; } set { @@ -606,24 +833,36 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "enumvalue" field.</summary> public const int EnumvalueFieldNumber = 2; private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.EnumValue> _repeated_enumvalue_codec = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.EnumValue.Parser); private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.EnumValue> enumvalue_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.EnumValue>(); + /// <summary> + /// Enum value definitions. + /// </summary> public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.EnumValue> Enumvalue { get { return enumvalue_; } } + /// <summary>Field number for the "options" field.</summary> public const int OptionsFieldNumber = 3; private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Option> _repeated_options_codec = pb::FieldCodec.ForMessage(26, global::Google.Protobuf.WellKnownTypes.Option.Parser); private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> options_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option>(); + /// <summary> + /// Proto options for the enum type. + /// </summary> public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> Options { get { return options_; } } + /// <summary>Field number for the "source_context" field.</summary> public const int SourceContextFieldNumber = 4; private global::Google.Protobuf.WellKnownTypes.SourceContext sourceContext_; + /// <summary> + /// The source context. + /// </summary> public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContext { get { return sourceContext_; } set { @@ -631,6 +870,19 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "syntax" field.</summary> + public const int SyntaxFieldNumber = 5; + private global::Google.Protobuf.WellKnownTypes.Syntax syntax_ = global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2; + /// <summary> + /// The source syntax. + /// </summary> + public global::Google.Protobuf.WellKnownTypes.Syntax Syntax { + get { return syntax_; } + set { + syntax_ = value; + } + } + public override bool Equals(object other) { return Equals(other as Enum); } @@ -646,6 +898,7 @@ namespace Google.Protobuf.WellKnownTypes { if(!enumvalue_.Equals(other.enumvalue_)) return false; if(!options_.Equals(other.options_)) return false; if (!object.Equals(SourceContext, other.SourceContext)) return false; + if (Syntax != other.Syntax) return false; return true; } @@ -655,6 +908,7 @@ namespace Google.Protobuf.WellKnownTypes { hash ^= enumvalue_.GetHashCode(); hash ^= options_.GetHashCode(); if (sourceContext_ != null) hash ^= SourceContext.GetHashCode(); + if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) hash ^= Syntax.GetHashCode(); return hash; } @@ -673,6 +927,10 @@ namespace Google.Protobuf.WellKnownTypes { output.WriteRawTag(34); output.WriteMessage(SourceContext); } + if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) { + output.WriteRawTag(40); + output.WriteEnum((int) Syntax); + } } public int CalculateSize() { @@ -685,6 +943,9 @@ namespace Google.Protobuf.WellKnownTypes { if (sourceContext_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(SourceContext); } + if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax); + } return size; } @@ -703,6 +964,9 @@ namespace Google.Protobuf.WellKnownTypes { } SourceContext.MergeFrom(other.SourceContext); } + if (other.Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) { + Syntax = other.Syntax; + } } public void MergeFrom(pb::CodedInputStream input) { @@ -731,12 +995,19 @@ namespace Google.Protobuf.WellKnownTypes { input.ReadMessage(sourceContext_); break; } + case 40: { + syntax_ = (global::Google.Protobuf.WellKnownTypes.Syntax) input.ReadEnum(); + break; + } } } } } + /// <summary> + /// Enum value definition. + /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class EnumValue : pb::IMessage<EnumValue> { private static readonly pb::MessageParser<EnumValue> _parser = new pb::MessageParser<EnumValue>(() => new EnumValue()); @@ -766,8 +1037,12 @@ namespace Google.Protobuf.WellKnownTypes { return new EnumValue(this); } + /// <summary>Field number for the "name" field.</summary> public const int NameFieldNumber = 1; private string name_ = ""; + /// <summary> + /// Enum value name. + /// </summary> public string Name { get { return name_; } set { @@ -775,8 +1050,12 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "number" field.</summary> public const int NumberFieldNumber = 2; private int number_; + /// <summary> + /// Enum value number. + /// </summary> public int Number { get { return number_; } set { @@ -784,10 +1063,14 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "options" field.</summary> public const int OptionsFieldNumber = 3; private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Option> _repeated_options_codec = pb::FieldCodec.ForMessage(26, global::Google.Protobuf.WellKnownTypes.Option.Parser); private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> options_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option>(); + /// <summary> + /// Proto options for the enum value. + /// </summary> public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> Options { get { return options_; } } @@ -883,6 +1166,9 @@ namespace Google.Protobuf.WellKnownTypes { } + /// <summary> + /// Proto option attached to messages/fields/enums etc. + /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Option : pb::IMessage<Option> { private static readonly pb::MessageParser<Option> _parser = new pb::MessageParser<Option>(() => new Option()); @@ -911,8 +1197,12 @@ namespace Google.Protobuf.WellKnownTypes { return new Option(this); } + /// <summary>Field number for the "name" field.</summary> public const int NameFieldNumber = 1; private string name_ = ""; + /// <summary> + /// Proto option name. + /// </summary> public string Name { get { return name_; } set { @@ -920,8 +1210,12 @@ namespace Google.Protobuf.WellKnownTypes { } } + /// <summary>Field number for the "value" field.</summary> public const int ValueFieldNumber = 2; private global::Google.Protobuf.WellKnownTypes.Any value_; + /// <summary> + /// Proto option value. + /// </summary> public global::Google.Protobuf.WellKnownTypes.Any Value { get { return value_; } set { diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs index 9ecaf47c..d26395f8 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs @@ -9,10 +9,12 @@ using pbr = global::Google.Protobuf.Reflection; using scg = global::System.Collections.Generic; namespace Google.Protobuf.WellKnownTypes { + /// <summary>Holder for reflection information generated from google/protobuf/wrappers.proto</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class Wrappers { #region Descriptor + /// <summary>File descriptor for google/protobuf/wrappers.proto</summary> public static pbr::FileDescriptor Descriptor { get { return descriptor; } } @@ -21,15 +23,15 @@ namespace Google.Protobuf.WellKnownTypes { static Wrappers() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "Ch5nb29nbGUvcHJvdG9idWYvd3JhcHBlcnMucHJvdG8SD2dvb2dsZS5wcm90", - "b2J1ZiIcCgtEb3VibGVWYWx1ZRINCgV2YWx1ZRgBIAEoASIbCgpGbG9hdFZh", - "bHVlEg0KBXZhbHVlGAEgASgCIhsKCkludDY0VmFsdWUSDQoFdmFsdWUYASAB", - "KAMiHAoLVUludDY0VmFsdWUSDQoFdmFsdWUYASABKAQiGwoKSW50MzJWYWx1", - "ZRINCgV2YWx1ZRgBIAEoBSIcCgtVSW50MzJWYWx1ZRINCgV2YWx1ZRgBIAEo", - "DSIaCglCb29sVmFsdWUSDQoFdmFsdWUYASABKAgiHAoLU3RyaW5nVmFsdWUS", - "DQoFdmFsdWUYASABKAkiGwoKQnl0ZXNWYWx1ZRINCgV2YWx1ZRgBIAEoDEJN", - "ChNjb20uZ29vZ2xlLnByb3RvYnVmQg1XcmFwcGVyc1Byb3RvUAGiAgNHUEKq", - "Ah5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw==")); + "Ch5nb29nbGUvcHJvdG9idWYvd3JhcHBlcnMucHJvdG8SD2dvb2dsZS5wcm90", + "b2J1ZiIcCgtEb3VibGVWYWx1ZRINCgV2YWx1ZRgBIAEoASIbCgpGbG9hdFZh", + "bHVlEg0KBXZhbHVlGAEgASgCIhsKCkludDY0VmFsdWUSDQoFdmFsdWUYASAB", + "KAMiHAoLVUludDY0VmFsdWUSDQoFdmFsdWUYASABKAQiGwoKSW50MzJWYWx1", + "ZRINCgV2YWx1ZRgBIAEoBSIcCgtVSW50MzJWYWx1ZRINCgV2YWx1ZRgBIAEo", + "DSIaCglCb29sVmFsdWUSDQoFdmFsdWUYASABKAgiHAoLU3RyaW5nVmFsdWUS", + "DQoFdmFsdWUYASABKAkiGwoKQnl0ZXNWYWx1ZRINCgV2YWx1ZRgBIAEoDEJQ", + "ChNjb20uZ29vZ2xlLnByb3RvYnVmQg1XcmFwcGVyc1Byb3RvUAGgAQGiAgNH", + "UEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] { @@ -48,6 +50,10 @@ namespace Google.Protobuf.WellKnownTypes { } #region Messages + /// <summary> + /// Wrapper message for `double`. + /// The JSON representation for `DoubleValue` is JSON number. + /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class DoubleValue : pb::IMessage<DoubleValue> { private static readonly pb::MessageParser<DoubleValue> _parser = new pb::MessageParser<DoubleValue>(() => new DoubleValue()); @@ -75,8 +81,12 @@ namespace Google.Protobuf.WellKnownTypes { return new DoubleValue(this); } + /// <summary>Field number for the "value" field.</summary> public const int ValueFieldNumber = 1; private double value_; + /// <summary> + /// The double value. + /// </summary> public double Value { get { return value_; } set { @@ -150,6 +160,10 @@ namespace Google.Protobuf.WellKnownTypes { } + /// <summary> + /// Wrapper message for `float`. + /// The JSON representation for `FloatValue` is JSON number. + /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class FloatValue : pb::IMessage<FloatValue> { private static readonly pb::MessageParser<FloatValue> _parser = new pb::MessageParser<FloatValue>(() => new FloatValue()); @@ -177,8 +191,12 @@ namespace Google.Protobuf.WellKnownTypes { return new FloatValue(this); } + /// <summary>Field number for the "value" field.</summary> public const int ValueFieldNumber = 1; private float value_; + /// <summary> + /// The float value. + /// </summary> public float Value { get { return value_; } set { @@ -252,6 +270,10 @@ namespace Google.Protobuf.WellKnownTypes { } + /// <summary> + /// Wrapper message for `int64`. + /// The JSON representation for `Int64Value` is JSON string. + /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Int64Value : pb::IMessage<Int64Value> { private static readonly pb::MessageParser<Int64Value> _parser = new pb::MessageParser<Int64Value>(() => new Int64Value()); @@ -279,8 +301,12 @@ namespace Google.Protobuf.WellKnownTypes { return new Int64Value(this); } + /// <summary>Field number for the "value" field.</summary> public const int ValueFieldNumber = 1; private long value_; + /// <summary> + /// The int64 value. + /// </summary> public long Value { get { return value_; } set { @@ -354,6 +380,10 @@ namespace Google.Protobuf.WellKnownTypes { } + /// <summary> + /// Wrapper message for `uint64`. + /// The JSON representation for `UInt64Value` is JSON string. + /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class UInt64Value : pb::IMessage<UInt64Value> { private static readonly pb::MessageParser<UInt64Value> _parser = new pb::MessageParser<UInt64Value>(() => new UInt64Value()); @@ -381,8 +411,12 @@ namespace Google.Protobuf.WellKnownTypes { return new UInt64Value(this); } + /// <summary>Field number for the "value" field.</summary> public const int ValueFieldNumber = 1; private ulong value_; + /// <summary> + /// The uint64 value. + /// </summary> public ulong Value { get { return value_; } set { @@ -456,6 +490,10 @@ namespace Google.Protobuf.WellKnownTypes { } + /// <summary> + /// Wrapper message for `int32`. + /// The JSON representation for `Int32Value` is JSON number. + /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Int32Value : pb::IMessage<Int32Value> { private static readonly pb::MessageParser<Int32Value> _parser = new pb::MessageParser<Int32Value>(() => new Int32Value()); @@ -483,8 +521,12 @@ namespace Google.Protobuf.WellKnownTypes { return new Int32Value(this); } + /// <summary>Field number for the "value" field.</summary> public const int ValueFieldNumber = 1; private int value_; + /// <summary> + /// The int32 value. + /// </summary> public int Value { get { return value_; } set { @@ -558,6 +600,10 @@ namespace Google.Protobuf.WellKnownTypes { } + /// <summary> + /// Wrapper message for `uint32`. + /// The JSON representation for `UInt32Value` is JSON number. + /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class UInt32Value : pb::IMessage<UInt32Value> { private static readonly pb::MessageParser<UInt32Value> _parser = new pb::MessageParser<UInt32Value>(() => new UInt32Value()); @@ -585,8 +631,12 @@ namespace Google.Protobuf.WellKnownTypes { return new UInt32Value(this); } + /// <summary>Field number for the "value" field.</summary> public const int ValueFieldNumber = 1; private uint value_; + /// <summary> + /// The uint32 value. + /// </summary> public uint Value { get { return value_; } set { @@ -660,6 +710,10 @@ namespace Google.Protobuf.WellKnownTypes { } + /// <summary> + /// Wrapper message for `bool`. + /// The JSON representation for `BoolValue` is JSON `true` and `false`. + /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class BoolValue : pb::IMessage<BoolValue> { private static readonly pb::MessageParser<BoolValue> _parser = new pb::MessageParser<BoolValue>(() => new BoolValue()); @@ -687,8 +741,12 @@ namespace Google.Protobuf.WellKnownTypes { return new BoolValue(this); } + /// <summary>Field number for the "value" field.</summary> public const int ValueFieldNumber = 1; private bool value_; + /// <summary> + /// The bool value. + /// </summary> public bool Value { get { return value_; } set { @@ -762,6 +820,10 @@ namespace Google.Protobuf.WellKnownTypes { } + /// <summary> + /// Wrapper message for `string`. + /// The JSON representation for `StringValue` is JSON string. + /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class StringValue : pb::IMessage<StringValue> { private static readonly pb::MessageParser<StringValue> _parser = new pb::MessageParser<StringValue>(() => new StringValue()); @@ -789,8 +851,12 @@ namespace Google.Protobuf.WellKnownTypes { return new StringValue(this); } + /// <summary>Field number for the "value" field.</summary> public const int ValueFieldNumber = 1; private string value_ = ""; + /// <summary> + /// The string value. + /// </summary> public string Value { get { return value_; } set { @@ -864,6 +930,10 @@ namespace Google.Protobuf.WellKnownTypes { } + /// <summary> + /// Wrapper message for `bytes`. + /// The JSON representation for `BytesValue` is JSON string. + /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class BytesValue : pb::IMessage<BytesValue> { private static readonly pb::MessageParser<BytesValue> _parser = new pb::MessageParser<BytesValue>(() => new BytesValue()); @@ -891,8 +961,12 @@ namespace Google.Protobuf.WellKnownTypes { return new BytesValue(this); } + /// <summary>Field number for the "value" field.</summary> public const int ValueFieldNumber = 1; private pb::ByteString value_ = pb::ByteString.Empty; + /// <summary> + /// The bytes value. + /// </summary> public pb::ByteString Value { get { return value_; } set { |