/** * * Autogenerated by Thrift Compiler (0.19.0) * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * */ using System; using System.Collections; using System.Collections.Generic; using System.Text; using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Logging; using Thrift; using Thrift.Collections; using Thrift.Protocol; using Thrift.Protocol.Entities; using Thrift.Protocol.Utilities; using Thrift.Transport; using Thrift.Transport.Client; using Thrift.Transport.Server; using Thrift.Processor; #pragma warning disable IDE0079 // remove unnecessary pragmas #pragma warning disable IDE0017 // object init can be simplified #pragma warning disable IDE0028 // collection init can be simplified #pragma warning disable IDE1006 // parts of the code use IDL spelling #pragma warning disable CA1822 // empty DeepCopy() methods still non-static #pragma warning disable IDE0083 // pattern matching "that is not SomeType" requires net5.0 but we still support earlier versions namespace Echo.ThriftModel { public partial class DocumentHeader : TBase { private byte[] _docId; private global::Echo.ThriftModel.DocType _type; private int _version; private long _createdAt; private long _updatedAt; private global::Echo.ThriftModel.Currency _currency; private string _notes; private Dictionary _meta; public byte[] DocId { get { return _docId; } set { __isset.docId = true; this._docId = value; } } /// /// /// /// public global::Echo.ThriftModel.DocType Type { get { return _type; } set { __isset.@type = true; this._type = value; } } public int Version { get { return _version; } set { __isset.@version = true; this._version = value; } } public long CreatedAt { get { return _createdAt; } set { __isset.createdAt = true; this._createdAt = value; } } public long UpdatedAt { get { return _updatedAt; } set { __isset.updatedAt = true; this._updatedAt = value; } } /// /// /// /// public global::Echo.ThriftModel.Currency Currency { get { return _currency; } set { __isset.@currency = true; this._currency = value; } } public string Notes { get { return _notes; } set { __isset.@notes = true; this._notes = value; } } public Dictionary Meta { get { return _meta; } set { __isset.@meta = true; this._meta = value; } } public Isset __isset; public struct Isset { public bool docId; public bool @type; public bool @version; public bool createdAt; public bool updatedAt; public bool @currency; public bool @notes; public bool @meta; } public DocumentHeader() { } public DocumentHeader DeepCopy() { var tmp25 = new DocumentHeader(); if((DocId != null) && __isset.docId) { tmp25.DocId = this.DocId.ToArray(); } tmp25.__isset.docId = this.__isset.docId; if(__isset.@type) { tmp25.Type = this.Type; } tmp25.__isset.@type = this.__isset.@type; if(__isset.@version) { tmp25.Version = this.Version; } tmp25.__isset.@version = this.__isset.@version; if(__isset.createdAt) { tmp25.CreatedAt = this.CreatedAt; } tmp25.__isset.createdAt = this.__isset.createdAt; if(__isset.updatedAt) { tmp25.UpdatedAt = this.UpdatedAt; } tmp25.__isset.updatedAt = this.__isset.updatedAt; if(__isset.@currency) { tmp25.Currency = this.Currency; } tmp25.__isset.@currency = this.__isset.@currency; if((Notes != null) && __isset.@notes) { tmp25.Notes = this.Notes; } tmp25.__isset.@notes = this.__isset.@notes; if((Meta != null) && __isset.@meta) { tmp25.Meta = this.Meta.DeepCopy(); } tmp25.__isset.@meta = this.__isset.@meta; return tmp25; } public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) { iprot.IncrementRecursionDepth(); try { TField field; await iprot.ReadStructBeginAsync(cancellationToken); while (true) { field = await iprot.ReadFieldBeginAsync(cancellationToken); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.String) { DocId = await iprot.ReadBinaryAsync(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 2: if (field.Type == TType.I32) { Type = (global::Echo.ThriftModel.DocType)await iprot.ReadI32Async(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 3: if (field.Type == TType.I32) { Version = await iprot.ReadI32Async(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 4: if (field.Type == TType.I64) { CreatedAt = await iprot.ReadI64Async(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 5: if (field.Type == TType.I64) { UpdatedAt = await iprot.ReadI64Async(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 6: if (field.Type == TType.I32) { Currency = (global::Echo.ThriftModel.Currency)await iprot.ReadI32Async(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 7: if (field.Type == TType.String) { Notes = await iprot.ReadStringAsync(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 8: if (field.Type == TType.Map) { { var _map26 = await iprot.ReadMapBeginAsync(cancellationToken); Meta = new Dictionary(_map26.Count); for(int _i27 = 0; _i27 < _map26.Count; ++_i27) { string _key28; global::Echo.ThriftModel.Variant _val29; _key28 = await iprot.ReadStringAsync(cancellationToken); _val29 = new global::Echo.ThriftModel.Variant(); await _val29.ReadAsync(iprot, cancellationToken); Meta[_key28] = _val29; } await iprot.ReadMapEndAsync(cancellationToken); } } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; default: await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); break; } await iprot.ReadFieldEndAsync(cancellationToken); } await iprot.ReadStructEndAsync(cancellationToken); } finally { iprot.DecrementRecursionDepth(); } } public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) { oprot.IncrementRecursionDepth(); try { var tmp30 = new TStruct("DocumentHeader"); await oprot.WriteStructBeginAsync(tmp30, cancellationToken); var tmp31 = new TField(); if((DocId != null) && __isset.docId) { tmp31.Name = "docId"; tmp31.Type = TType.String; tmp31.ID = 1; await oprot.WriteFieldBeginAsync(tmp31, cancellationToken); await oprot.WriteBinaryAsync(DocId, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if(__isset.@type) { tmp31.Name = "type"; tmp31.Type = TType.I32; tmp31.ID = 2; await oprot.WriteFieldBeginAsync(tmp31, cancellationToken); await oprot.WriteI32Async((int)Type, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if(__isset.@version) { tmp31.Name = "version"; tmp31.Type = TType.I32; tmp31.ID = 3; await oprot.WriteFieldBeginAsync(tmp31, cancellationToken); await oprot.WriteI32Async(Version, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if(__isset.createdAt) { tmp31.Name = "createdAt"; tmp31.Type = TType.I64; tmp31.ID = 4; await oprot.WriteFieldBeginAsync(tmp31, cancellationToken); await oprot.WriteI64Async(CreatedAt, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if(__isset.updatedAt) { tmp31.Name = "updatedAt"; tmp31.Type = TType.I64; tmp31.ID = 5; await oprot.WriteFieldBeginAsync(tmp31, cancellationToken); await oprot.WriteI64Async(UpdatedAt, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if(__isset.@currency) { tmp31.Name = "currency"; tmp31.Type = TType.I32; tmp31.ID = 6; await oprot.WriteFieldBeginAsync(tmp31, cancellationToken); await oprot.WriteI32Async((int)Currency, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if((Notes != null) && __isset.@notes) { tmp31.Name = "notes"; tmp31.Type = TType.String; tmp31.ID = 7; await oprot.WriteFieldBeginAsync(tmp31, cancellationToken); await oprot.WriteStringAsync(Notes, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if((Meta != null) && __isset.@meta) { tmp31.Name = "meta"; tmp31.Type = TType.Map; tmp31.ID = 8; await oprot.WriteFieldBeginAsync(tmp31, cancellationToken); await oprot.WriteMapBeginAsync(new TMap(TType.String, TType.Struct, Meta.Count), cancellationToken); foreach (string _iter32 in Meta.Keys) { await oprot.WriteStringAsync(_iter32, cancellationToken); await Meta[_iter32].WriteAsync(oprot, cancellationToken); } await oprot.WriteMapEndAsync(cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } await oprot.WriteFieldStopAsync(cancellationToken); await oprot.WriteStructEndAsync(cancellationToken); } finally { oprot.DecrementRecursionDepth(); } } public override bool Equals(object that) { if (!(that is DocumentHeader other)) return false; if (ReferenceEquals(this, other)) return true; return ((__isset.docId == other.__isset.docId) && ((!__isset.docId) || (TCollections.Equals(DocId, other.DocId)))) && ((__isset.@type == other.__isset.@type) && ((!__isset.@type) || (global::System.Object.Equals(Type, other.Type)))) && ((__isset.@version == other.__isset.@version) && ((!__isset.@version) || (global::System.Object.Equals(Version, other.Version)))) && ((__isset.createdAt == other.__isset.createdAt) && ((!__isset.createdAt) || (global::System.Object.Equals(CreatedAt, other.CreatedAt)))) && ((__isset.updatedAt == other.__isset.updatedAt) && ((!__isset.updatedAt) || (global::System.Object.Equals(UpdatedAt, other.UpdatedAt)))) && ((__isset.@currency == other.__isset.@currency) && ((!__isset.@currency) || (global::System.Object.Equals(Currency, other.Currency)))) && ((__isset.@notes == other.__isset.@notes) && ((!__isset.@notes) || (global::System.Object.Equals(Notes, other.Notes)))) && ((__isset.@meta == other.__isset.@meta) && ((!__isset.@meta) || (TCollections.Equals(Meta, other.Meta)))); } public override int GetHashCode() { int hashcode = 157; unchecked { if((DocId != null) && __isset.docId) { hashcode = (hashcode * 397) + DocId.GetHashCode(); } if(__isset.@type) { hashcode = (hashcode * 397) + Type.GetHashCode(); } if(__isset.@version) { hashcode = (hashcode * 397) + Version.GetHashCode(); } if(__isset.createdAt) { hashcode = (hashcode * 397) + CreatedAt.GetHashCode(); } if(__isset.updatedAt) { hashcode = (hashcode * 397) + UpdatedAt.GetHashCode(); } if(__isset.@currency) { hashcode = (hashcode * 397) + Currency.GetHashCode(); } if((Notes != null) && __isset.@notes) { hashcode = (hashcode * 397) + Notes.GetHashCode(); } if((Meta != null) && __isset.@meta) { hashcode = (hashcode * 397) + TCollections.GetHashCode(Meta); } } return hashcode; } public override string ToString() { var tmp33 = new StringBuilder("DocumentHeader("); int tmp34 = 0; if((DocId != null) && __isset.docId) { if(0 < tmp34++) { tmp33.Append(", "); } tmp33.Append("DocId: "); DocId.ToString(tmp33); } if(__isset.@type) { if(0 < tmp34++) { tmp33.Append(", "); } tmp33.Append("Type: "); Type.ToString(tmp33); } if(__isset.@version) { if(0 < tmp34++) { tmp33.Append(", "); } tmp33.Append("Version: "); Version.ToString(tmp33); } if(__isset.createdAt) { if(0 < tmp34++) { tmp33.Append(", "); } tmp33.Append("CreatedAt: "); CreatedAt.ToString(tmp33); } if(__isset.updatedAt) { if(0 < tmp34++) { tmp33.Append(", "); } tmp33.Append("UpdatedAt: "); UpdatedAt.ToString(tmp33); } if(__isset.@currency) { if(0 < tmp34++) { tmp33.Append(", "); } tmp33.Append("Currency: "); Currency.ToString(tmp33); } if((Notes != null) && __isset.@notes) { if(0 < tmp34++) { tmp33.Append(", "); } tmp33.Append("Notes: "); Notes.ToString(tmp33); } if((Meta != null) && __isset.@meta) { if(0 < tmp34++) { tmp33.Append(", "); } tmp33.Append("Meta: "); Meta.ToString(tmp33); } tmp33.Append(')'); return tmp33.ToString(); } } }