2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2026-06-13 14:38:43 +00:00
This commit is contained in:
2026-06-08 16:15:57 +03:00
parent 8143da2eee
commit 340798a5fa
111 changed files with 20647 additions and 27 deletions
@@ -0,0 +1,10 @@
using System;
namespace Esiur
{
public static class Generated
{
public static Type[] Resources { get; } = new Type[] { typeof(RPC.EsiurTest.Service), typeof(RPC.EsiurTest.TestObject) };
public static Type[] Records { get; } = new Type[] { typeof(RPC.EsiurTest.BusinessDocument), typeof(RPC.EsiurTest.Attachment), typeof(RPC.EsiurTest.Party), typeof(RPC.EsiurTest.Address), typeof(RPC.EsiurTest.DocumentHeader), typeof(RPC.EsiurTest.LineItem), typeof(RPC.EsiurTest.Variant), typeof(RPC.EsiurTest.Payment) };
public static Type[] Enums { get; } = new Type[] { typeof(RPC.EsiurTest.Currency), typeof(RPC.EsiurTest.DocType), typeof(RPC.EsiurTest.Kind), typeof(RPC.EsiurTest.LineType), typeof(RPC.EsiurTest.PaymentMethod) };
}
}
@@ -0,0 +1,84 @@
using System;
using Esiur.Resource;
using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
namespace RPC.EsiurTest
{
[TypeId("0f8f447ee993847189b2c1ad6f83931a")]
[Export]
public class Address : IRecord
{
[Annotation("String")]
public string City { get; set; }
[Annotation("String")]
public string Country { get; set; }
[Annotation("String")]
public string Line1 { get; set; }
[Annotation("String")]
public string? Line2 { get; set; }
[Annotation("String")]
public string? PostalCode { get; set; }
[Annotation("String")]
public string Region { get; set; }
public override bool Equals(object? obj)
{
var other = obj as Address;
if (other == null) return false;
if (other.Line1 != Line1) return false;
if (other.Line2 != Line2) return false;
if (other.PostalCode != PostalCode) return false;
if (other.City != City) return false;
if (other.Country != Country) return false;
if (other.Region != Region) return false;
return true;
}
public SharedModel.Address ToShared()
{
return new SharedModel.Address()
{
City = City,
Country = Country,
Line1 = Line1,
Line2 = Line2,
PostalCode = PostalCode,
Region = Region,
};
}
public Echo.Model.Grpc.Address ToGrpc()
{
return new Echo.Model.Grpc.Address()
{
City = City,
Country = Country,
Line1 = Line1,
Line2 = Line2 ?? "",
PostalCode = PostalCode ?? "",
Region = Region,
};
}
public Echo.ThriftModel.Address ToThrift()
{
return new Echo.ThriftModel.Address()
{
City = City,
Country = Country,
Line1 = Line1,
Line2 = Line2,
PostalCode = PostalCode,
Region = Region,
};
}
}
}
@@ -0,0 +1,62 @@
using System;
using Esiur.Resource;
using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
using Google.Protobuf;
namespace RPC.EsiurTest
{
[TypeId("4befaa686f038a2885268fca4cbf3c2c")]
[Export]
public class Attachment : IRecord
{
[Annotation("Byte[]")]
public byte[] Data { get; set; }
[Annotation("String")]
public string MimeType { get; set; }
[Annotation("String")]
public string Name { get; set; }
public override bool Equals(object? obj)
{
var other = obj as Attachment;
if (Name != other.Name) return false;
if (MimeType != other.MimeType) return false;
if (!(Data.SequenceEqual(other.Data))) return false;
return true;
}
public SharedModel.Attachment ToShared()
{
return new SharedModel.Attachment()
{
Data = Data,
MimeType = MimeType,
Name = Name,
};
}
public Echo.Model.Grpc.Attachment ToGrpc()
{
return new Echo.Model.Grpc.Attachment()
{
Data = ByteString.CopyFrom(Data),
MimeType = MimeType,
Name = Name,
};
}
public Echo.ThriftModel.Attachment ToThrift()
{
return new Echo.ThriftModel.Attachment()
{
Data = Data,
MimeType = MimeType,
Name = Name,
};
}
}
}
@@ -0,0 +1,145 @@
using System;
using Esiur.Resource;
using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
using Google.Protobuf;
using Google.Protobuf.Collections;
namespace RPC.EsiurTest
{
[TypeId("9a34d22890e787b48133a2a61ac84ad8")]
[Export]
public class BusinessDocument : IRecord
{
[Annotation("Attachment[]")]
public RPC.EsiurTest.Attachment[] Attachments { get; set; }
[Annotation("Party")]
public RPC.EsiurTest.Party Buyer { get; set; }
[Annotation("DocumentHeader")]
public RPC.EsiurTest.DocumentHeader Header { get; set; }
[Annotation("LineItem[]")]
public RPC.EsiurTest.LineItem[] Items { get; set; }
[Annotation("Payment[]")]
public RPC.EsiurTest.Payment[] Payments { get; set; }
[Annotation("Int32[]")]
public int[] RiskScores { get; set; }
[Annotation("Party")]
public RPC.EsiurTest.Party Seller { get; set; }
public override bool Equals(object? obj)
{
var other = obj as BusinessDocument;
if (other == null)
return false;
if (!Header.Equals(other.Header))
return false;
if (!Seller.Equals(other.Seller))
return false;
if (!Buyer.Equals(other.Buyer))
return false;
if (Items != null)
for (var i = 0; i < Items.Length; i++)
if (!Items[i].Equals(other.Items[i]))
return false;
if (Payments != null)
for (var i = 0; i < Payments.Length; i++)
if (!Payments[i].Equals(other.Payments[i]))
return false;
if (Attachments != null)
for (var i = 0; i < Attachments.Length; i++)
if (!Attachments[i].Equals(other.Attachments[i]))
return false;
if (!RiskScores.SequenceEqual(other.RiskScores))
return false;
return true;
}
public SharedModel.BusinessDocument ToShared()
{
return new SharedModel.BusinessDocument()
{
Attachments = Attachments?.Select(x=>x.ToShared()).ToArray() ?? null,
Buyer = Buyer.ToShared(),
Header = Header.ToShared(),
Items = Items.Select(x=>x.ToShared()).ToArray(),
Payments = Payments.Select(x=>x.ToShared()).ToArray(),
RiskScores = RiskScores,
Seller = Seller.ToShared(),
};
}
public Echo.ThriftModel.BusinessDocument ToThrift()
{
var rt = new Echo.ThriftModel.BusinessDocument();
if (Header != null)
rt.Header = Header.ToThrift();
if (Buyer != null)
rt.Buyer = Buyer.ToThrift();
if (Seller != null)
rt.Seller = Seller.ToThrift();
if (Attachments != null)
rt.Attachments = Attachments.Select(x=>x.ToThrift()).ToList();
if (RiskScores != null)
rt.RiskScores = RiskScores.ToList();
if (Items != null)
rt.Items = Items.Select(x => x.ToThrift()).ToList();
if (Payments != null)
rt.Payments = Payments.Select(x => x.ToThrift()).ToList();
return rt;
}
public Echo.Model.Grpc.BusinessDocument ToGrpc()
{
var rt = new Echo.Model.Grpc.BusinessDocument()
{
Header = Header.ToGrpc(),
Buyer = Buyer.ToGrpc(),
Seller = Seller.ToGrpc(),
};
if (Payments != null)
foreach (var p in Payments)
rt.Payments.Add(p.ToGrpc());
if (Attachments != null)
foreach (var p in Attachments)
rt.Attachments.Add(p.ToGrpc());
if (Items != null)
foreach (var p in Items)
rt.Items.Add(p.ToGrpc());
if (RiskScores != null)
foreach (var p in RiskScores)
rt.RiskScores.Add(p);
return rt;
}
}
}
@@ -0,0 +1,20 @@
using System;
using Esiur.Resource;
using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
namespace RPC.EsiurTest
{
[TypeId("c44e42333dfd8d3485bb2a79fd7a9f6f")]
[Export]
public enum Currency
{
CNH = 1,
EUR = 3,
GBP = 5,
IQD = 0,
JPY = 4,
USD = 2
}
}
@@ -0,0 +1,18 @@
using System;
using Esiur.Resource;
using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
namespace RPC.EsiurTest
{
[TypeId("6ded4eca74c8886a85a74e082770be4b")]
[Export]
public enum DocType
{
CreditNote = 3,
Invoice = 2,
Order = 1,
Quote = 0
}
}
@@ -0,0 +1,114 @@
using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
using Esiur.Resource;
using Google.Protobuf;
using System;
namespace RPC.EsiurTest
{
[TypeId("4631164f62d489e68ffab70e20b421f2")]
[Export]
public class DocumentHeader : IRecord
{
[Annotation("DateTime")]
public DateTime CreatedAt { get; set; }
[Annotation("Currency")]
public RPC.EsiurTest.Currency Currency { get; set; }
[Annotation("Byte[]")]
public byte[] DocId { get; set; }
[Annotation("Dictionary`2")]
public Map<string, RPC.EsiurTest.Variant> Meta { get; set; }
[Annotation("String")]
public string? Notes { get; set; }
[Annotation("DocType")]
public RPC.EsiurTest.DocType Type { get; set; }
[Annotation("Nullable`1?")]
public DateTime? UpdatedAt { get; set; }
[Annotation("Int32")]
public int Version { get; set; }
public SharedModel.DocumentHeader ToShared()
{
return new SharedModel.DocumentHeader()
{
CreatedAt = CreatedAt,
DocId = DocId,
Meta = Meta.ToDictionary(x=>x.Key, v=>v.Value.ToShared()),
Notes = Notes,
Currency = Enum.Parse<SharedModel.Currency>(Currency.ToString(), true),
UpdatedAt = UpdatedAt,
Version = Version,
Type = Enum.Parse<SharedModel.DocType>(Type.ToString(), true)
};
}
public Echo.ThriftModel.DocumentHeader ToThrift()
{
var rt = new Echo.ThriftModel.DocumentHeader()
{
DocId = DocId,
CreatedAt = CreatedAt.Ticks,
Currency = Enum.Parse< Echo.ThriftModel.Currency>(Currency.ToString(), true),
Type = Enum.Parse< Echo.ThriftModel.DocType>(Type.ToString(), true),
Version = Version,
Meta = Meta.ToDictionary(x=>x.Key, x=>x.Value.ToThrift())
};
if (UpdatedAt != null)
rt.UpdatedAt = UpdatedAt.Value.Ticks;
if (Notes != null)
rt.Notes = Notes;
return rt;
}
public Echo.Model.Grpc.DocumentHeader ToGrpc()
{
var hdr = new Echo.Model.Grpc.DocumentHeader();
hdr.DocId = ByteString.CopyFrom(DocId);
hdr.CreatedAt = CreatedAt.Ticks;
hdr.Currency = Enum.Parse<Echo.Model.Grpc.Currency>(Currency.ToString(), true);
hdr.Version = Version;
hdr.Notes = Notes;
foreach (var mt in Meta)
hdr.Meta.Add(mt.Key, mt.Value.ToGrpc());
return hdr;
}
public override bool Equals(object? obj)
{
var other = obj as DocumentHeader;
if (other == null) return false;
if (!DocId.SequenceEqual(other.DocId)) return false;
if (Type != other.Type) return false;
if (Version != other.Version) return false;
if (CreatedAt != other.CreatedAt) return false;
if (UpdatedAt != other.UpdatedAt) return false;
if (Currency != other.Currency) return false;
if (Notes != other.Notes) return false;
if (Meta != null)
foreach (var kv in Meta)
if (!other.Meta[kv.Key].Equals(kv.Value))
return false;
return true;
}
}
}
@@ -0,0 +1,24 @@
using System;
using Esiur.Resource;
using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
namespace RPC.EsiurTest
{
[TypeId("32ae8265068382608399b7e427be37db")]
[Export]
public enum Kind
{
Bool = 1,
Bytes = 7,
DateTime = 8,
Decimal = 5,
Double = 4,
Guid = 9,
Int64 = 2,
Null = 0,
String = 6,
UInt64 = 3
}
}
@@ -0,0 +1,132 @@
using System;
using Esiur.Resource;
using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
namespace RPC.EsiurTest
{
[TypeId("142f42b0e1a78c098f35fa935cde22c1")]
[Export]
public class LineItem : IRecord
{
[Annotation("String")]
public string Description { get; set; }
[Annotation("Nullable`1?")]
public double? Discount { get; set; }
[Annotation("Map`2")]
public Map<string, RPC.EsiurTest.Variant> Ext { get; set; }
[Annotation("Int32")]
public int LineNo { get; set; }
[Annotation("Double")]
public double Qty { get; set; }
[Annotation("String")]
public string QtyUnit { get; set; }
[Annotation("String")]
public string SKU { get; set; }
[Annotation("LineType")]
public RPC.EsiurTest.LineType Type { get; set; }
[Annotation("Double")]
public double UnitPrice { get; set; }
[Annotation("Nullable`1?")]
public double? VatRate { get; set; }
public SharedModel.LineItem ToShared()
{
return new SharedModel.LineItem()
{
Description = Description,
Discount = Discount,
Ext = Ext.ToDictionary(k => k.Key, v => v.Value.ToShared()),
LineNo = LineNo,
Qty = Qty,
QtyUnit = QtyUnit,
SKU = SKU,
Type = Enum.Parse<SharedModel.LineType>(Type.ToString(), true),
UnitPrice = UnitPrice,
VatRate = VatRate
};
}
public Echo.ThriftModel.LineItem ToThrift()
{
var rt = new Echo.ThriftModel.LineItem()
{
Description = Description,
LineNo = LineNo,
Qty = Qty,
UnitPrice = UnitPrice,
QtyUnit = QtyUnit,
Sku = SKU,
Type = Enum.Parse<Echo.ThriftModel.LineType>(Type.ToString(), true),
};
if (Discount != null)
rt.Discount = Discount.Value;
if (VatRate != null)
rt.VatRate = VatRate.Value;
if (Ext != null)
rt.Ext = Ext.ToDictionary(x => x.Key, v => v.Value.ToThrift());
return rt;
}
public Echo.Model.Grpc.LineItem ToGrpc()
{
var rt = new Echo.Model.Grpc.LineItem()
{
Description = Description,
Discount = Discount ?? 0,
LineNo = LineNo,
Qty = Qty,
UnitPrice = UnitPrice,
QtyUnit = QtyUnit,
Sku = SKU,
Type = Enum.Parse<Echo.Model.Grpc.LineType>(Type.ToString(), true),
VatRate = VatRate ?? 0,
};
if (Ext != null)
{
foreach (var kv in Ext)
rt.Ext.Add(kv.Key, kv.Value.ToGrpc());
}
return rt;
}
public override bool Equals(object? obj)
{
var other = obj as LineItem;
if (other == null) return false;
if (other.LineNo != LineNo) return false;
if (other.SKU != SKU) return false;
if (other.Description != Description) return false;
if (other.Discount != Discount) return false;
if (other.QtyUnit != QtyUnit) return false;
if (other.Type != Type) return false;
if (other.VatRate != VatRate) return false;
if (other.UnitPrice != UnitPrice) return false;
if (Ext != null)
{
foreach (var kv in Ext)
if (!other.Ext[kv.Key].Equals(kv.Value))
return false;
}
return true;
}
}
}
@@ -0,0 +1,18 @@
using System;
using Esiur.Resource;
using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
namespace RPC.EsiurTest
{
[TypeId("7e474e8826e288f28bddddf69782c580")]
[Export]
public enum LineType
{
Discount = 2,
Product = 0,
Service = 1,
Shipping = 3
}
}
@@ -0,0 +1,93 @@
using System;
using Esiur.Resource;
using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
namespace RPC.EsiurTest
{
[TypeId("44fff9c7bd9b86f580bf479a64cb84af")]
[Export]
public class Party : IRecord
{
[Annotation("Address")]
public RPC.EsiurTest.Address Address { get; set; }
[Annotation("String")]
public string Email { get; set; }
[Annotation("UInt64")]
public ulong Id { get; set; }
[Annotation("String")]
public string Name { get; set; }
[Annotation("String")]
public string Phone { get; set; }
[Annotation("String")]
public string PreferredLanguage { get; set; }
[Annotation("String")]
public string TaxId { get; set; }
public SharedModel.Party ToShared()
{
return new SharedModel.Party()
{
Address = Address.ToShared(),
Email = Email,
Id = Id,
Name = Name,
Phone = Phone,
PreferredLanguage = PreferredLanguage,
TaxId = TaxId,
};
}
public Echo.ThriftModel.Party ToThrift()
{
return new Echo.ThriftModel.Party()
{
Address = Address.ToThrift(),
Email = Email,
Id = (long)Id,
Name = Name,
Phone = Phone,
PreferredLanguage = PreferredLanguage,
TaxId = TaxId
};
}
public Echo.Model.Grpc.Party ToGrpc()
{
return new Echo.Model.Grpc.Party()
{
Address = Address.ToGrpc(),
Email = Email,
Id = Id,
Name = Name,
Phone = Phone,
PreferredLanguage = PreferredLanguage ?? "",
TaxId = TaxId ?? "",
};
}
public override bool Equals(object? obj)
{
var other = obj as Party;
if (other == null) return false;
if (other.Id != Id) return false;
if (other.TaxId != TaxId) return false;
if (!other.Address.Equals(Address)) return false;
if (other.Email != Email) return false;
if (other.Name != Name) return false;
if (other.Phone != Phone) return false;
if (other.PreferredLanguage != PreferredLanguage) return false;
return true;
}
}
}
@@ -0,0 +1,87 @@
using System;
using Esiur.Resource;
using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
namespace RPC.EsiurTest
{
[TypeId("f172196340298b8586fed434c72bc158")]
[Export]
public class Payment : IRecord
{
[Annotation("Double")]
public double Amount { get; set; }
[Annotation("Currency")]
public RPC.EsiurTest.Currency Currency { get; set; }
[Annotation("Nullable`1?")]
public double? Fee { get; set; }
[Annotation("PaymentMethod")]
public RPC.EsiurTest.PaymentMethod Method { get; set; }
[Annotation("String")]
public string Reference { get; set; }
[Annotation("DateTime")]
public DateTime Timestamp { get; set; }
public SharedModel.Payment ToShared()
{
return new SharedModel.Payment()
{
Amount = Amount,
Currency = Enum.Parse<SharedModel.Currency>(Currency.ToString(), true),
Method = Enum.Parse<SharedModel.PaymentMethod>(Method.ToString(), true),
Reference = Reference,
Timestamp = Timestamp,
Fee = Fee,
};
}
public Echo.ThriftModel.Payment ToThrift()
{
var rt= new Echo.ThriftModel.Payment()
{
Amount = Amount,
Currency = Enum.Parse<Echo.ThriftModel.Currency>(Currency.ToString(), true),
Method = Enum.Parse<Echo.ThriftModel.PaymentMethod>(Method.ToString(), true),
Reference = Reference,
Timestamp = Timestamp.Ticks,
};
if (Fee != null)
rt.Fee = Fee.Value;
return rt;
}
public Echo.Model.Grpc.Payment ToGrpc()
{
return new Echo.Model.Grpc.Payment()
{
Amount = Amount,
Currency = Enum.Parse<Echo.Model.Grpc.Currency>(Currency.ToString(), true),
Fee = Fee ?? 0,
Method = Enum.Parse<Echo.Model.Grpc.PaymentMethod>(Method.ToString(), true),
Reference = Reference,
Timestamp = Timestamp.Ticks,
};
}
public override bool Equals(object? obj)
{
var other = obj as Payment;
if (other == null) return false;
if (Method != other.Method) return false;
if (Amount != other.Amount) return false;
if (Reference != other.Reference) return false;
if (Fee != other.Fee) return false;
return true;
}
}
}
@@ -0,0 +1,19 @@
using System;
using Esiur.Resource;
using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
namespace RPC.EsiurTest
{
[TypeId("fadfe3764f808d7e839fef5275490dd7")]
[Export]
public enum PaymentMethod
{
Card = 1,
Cash = 0,
Crypto = 3,
Other = 4,
Wire = 2
}
}
@@ -0,0 +1,196 @@
using System;
using Esiur.Resource;
using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
#nullable enable
namespace RPC.EsiurTest
{
//{ab8e681b-61d9-8fb7-8c63-bbded15457e1}
[TypeId("f7e00be8881d88d68a8a2dc2d3a4b3d1")]
public class Service : EpResource
{
public Service(EpConnection connection, uint instanceId, ulong age, string link) : base(connection, instanceId, age, link) { }
public Service() { }
[Annotation("([Int32] count,[Int32] size,[Int32] delay) -> AsyncReply`1")]
[Export]
public AsyncReply<byte[]> ChunkTest(int count, int size, int delay)
{
var args = new Map<byte, object>() { [0] = count, [1] = size, [2] = delay };
var rt = new AsyncReply<byte[]>();
_Invoke(0, args)
.Then(x => rt.Trigger((byte[])x))
.Error(x => rt.TriggerError(x))
.Chunk(x => rt.TriggerChunk(x));
return rt;
}
[Annotation("([Byte[]] payload) -> Byte[]")]
[Export]
public AsyncReply<byte[]> EchoBytes(byte[] payload)
{
var args = new Map<byte, object>() { [0] = payload };
var rt = new AsyncReply<byte[]>();
_Invoke(1, args)
.Then(x => rt.Trigger((byte[])x))
.Error(x => rt.TriggerError(x))
.Chunk(x => rt.TriggerChunk(x));
return rt;
}
[Annotation("([BusinessDocument[]] payload) -> BusinessDocument[]")]
[Export]
public AsyncReply<RPC.EsiurTest.BusinessDocument[]> EchoDocuments(RPC.EsiurTest.BusinessDocument[] payload)
{
var args = new Map<byte, object>() { [0] = payload };
var rt = new AsyncReply<RPC.EsiurTest.BusinessDocument[]>();
_Invoke(2, args)
.Then(x => rt.Trigger((RPC.EsiurTest.BusinessDocument[])x))
.Error(x => rt.TriggerError(x))
.Chunk(x => rt.TriggerChunk(x));
return rt;
}
[Annotation("([DocType[]] payload) -> DocType[]")]
[Export]
public AsyncReply<RPC.EsiurTest.DocType[]> EchoEnumArray(RPC.EsiurTest.DocType[] payload)
{
var args = new Map<byte, object>() { [0] = payload };
var rt = new AsyncReply<RPC.EsiurTest.DocType[]>();
_Invoke(3, args)
.Then(x => rt.Trigger((RPC.EsiurTest.DocType[])x))
.Error(x => rt.TriggerError(x))
.Chunk(x => rt.TriggerChunk(x));
return rt;
}
[Annotation("([Int32[]] payload) -> Int32[]")]
[Export]
public AsyncReply<int[]> EchoIntArray(int[] payload)
{
var args = new Map<byte, object>() { [0] = payload };
var rt = new AsyncReply<int[]>();
_Invoke(4, args)
.Then(x => rt.Trigger((int[])x))
.Error(x => rt.TriggerError(x))
.Chunk(x => rt.TriggerChunk(x));
return rt;
}
[Annotation("([Map`2] payload) -> Map`2")]
[Export]
public AsyncReply<Map<string, RPC.EsiurTest.BusinessDocument>> EchoMap(Map<string, RPC.EsiurTest.BusinessDocument> payload)
{
var args = new Map<byte, object>() { [0] = payload };
var rt = new AsyncReply<Map<string, RPC.EsiurTest.BusinessDocument>>();
_Invoke(5, args)
.Then(x => rt.Trigger((Map<string, RPC.EsiurTest.BusinessDocument>)x))
.Error(x => rt.TriggerError(x))
.Chunk(x => rt.TriggerChunk(x));
return rt;
}
[Annotation("([String[]] payload) -> String[]")]
[Export]
public AsyncReply<string[]> EchoStringArray(string[] payload)
{
var args = new Map<byte, object>() { [0] = payload };
var rt = new AsyncReply<string[]>();
_Invoke(6, args)
.Then(x => rt.Trigger((string[])x))
.Error(x => rt.TriggerError(x))
.Chunk(x => rt.TriggerChunk(x));
return rt;
}
[Annotation("([Int32] count,[Int32] size,[Int32] delay) -> Void")]
[Export]
public AsyncReply<object> EventTest(int count, int size, int delay)
{
var args = new Map<byte, object>() { [0] = count, [1] = size, [2] = delay };
var rt = new AsyncReply<object>();
_Invoke(7, args)
.Then(x => rt.Trigger((object)x))
.Error(x => rt.TriggerError(x))
.Chunk(x => rt.TriggerChunk(x));
return rt;
}
[Annotation("([Int32] count,[Int32] size,[Int32] delay) -> Void")]
[Export]
public AsyncReply<object> PropertyChangeTest(int count, int size, int delay)
{
var args = new Map<byte, object>() { [0] = count, [1] = size, [2] = delay };
var rt = new AsyncReply<object>();
_Invoke(8, args)
.Then(x => rt.Trigger((object)x))
.Error(x => rt.TriggerError(x))
.Chunk(x => rt.TriggerChunk(x));
return rt;
}
[Annotation("([Int32] interval,[Int32] count,[Double] localProbability,[Double] remoteProbability,[String] remoteHostLink) -> AsyncReply`1")]
[Export]
public AsyncReply<RPC.EsiurTest.TestObject> StartUpdates(int interval, int count, double localProbability, double remoteProbability, string remoteHostLink)
{
var args = new Map<byte, object>() { [0] = interval, [1] = count, [2] = localProbability, [3] = remoteProbability, [4] = remoteHostLink };
var rt = new AsyncReply<RPC.EsiurTest.TestObject>();
_Invoke(9, args)
.Then(x => rt.Trigger((RPC.EsiurTest.TestObject)x))
.Error(x => rt.TriggerError(x))
.Chunk(x => rt.TriggerChunk(x));
return rt;
}
[Annotation("([Int32] interval,[Int32] count,[Double] localProbability) -> AsyncReply`1")]
[Export]
public AsyncReply<RPC.EsiurTest.TestObject> StartUpdatesLocal(int interval, int count, double localProbability)
{
var args = new Map<byte, object>() { [0] = interval, [1] = count, [2] = localProbability };
var rt = new AsyncReply<RPC.EsiurTest.TestObject>();
_Invoke(10, args)
.Then(x => rt.Trigger((RPC.EsiurTest.TestObject)x))
.Error(x => rt.TriggerError(x))
.Chunk(x => rt.TriggerChunk(x));
return rt;
}
[Annotation("([Int32] interval,[Int32] count,[Double] remoteProbability,[String] remoteNode,[String] remoteLink) -> AsyncReply`1")]
[Export]
public AsyncReply<RPC.EsiurTest.TestObject> StartUpdatesMirror(int interval, int count, double remoteProbability, string remoteNode, string remoteLink)
{
var args = new Map<byte, object>() { [0] = interval, [1] = count, [2] = remoteProbability, [3] = remoteNode, [4] = remoteLink };
var rt = new AsyncReply<RPC.EsiurTest.TestObject>();
_Invoke(11, args)
.Then(x => rt.Trigger((RPC.EsiurTest.TestObject)x))
.Error(x => rt.TriggerError(x))
.Chunk(x => rt.TriggerChunk(x));
return rt;
}
[Annotation("([Int32] interval,[Int32] count,[Double] remoteProbability,[String] remoteLink) -> AsyncReply`1")]
[Export]
public AsyncReply<RPC.EsiurTest.TestObject> StartUpdatesRemote(int interval, int count, double remoteProbability, string remoteLink)
{
var args = new Map<byte, object>() { [0] = interval, [1] = count, [2] = remoteProbability, [3] = remoteLink };
var rt = new AsyncReply<RPC.EsiurTest.TestObject>();
_Invoke(12, args)
.Then(x => rt.Trigger((RPC.EsiurTest.TestObject)x))
.Error(x => rt.TriggerError(x))
.Chunk(x => rt.TriggerChunk(x));
return rt;
}
[Annotation("Byte[]")]
[Export]
public byte[] MessageToChange
{
get => (byte[])_properties[0];
set => SetResourceProperty(0, value);
}
[Annotation("Object")]
[Export]
public object TestProperty
{
get => (object)_properties[1];
set => SetResourceProperty(1, value);
}
protected override void _EmitEventByIndex(byte index, object args)
{
switch (index)
{
case 0: MessageUpdated?.Invoke((byte[])args); break;
}
}
[Export] public event ResourceEventHandler<byte[]> MessageUpdated;
}
}
@@ -0,0 +1,121 @@
using System;
using Esiur.Resource;
using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
using Google.Protobuf;
namespace RPC.EsiurTest
{
[TypeId("91ed22c5c53e846181f799dc76ddd93c")]
[Export]
public class Variant : IRecord
{
[Annotation("Nullable`1?")]
public bool? Bool { get; set; }
[Annotation("Byte[]")]
public byte[] Bytes { get; set; }
[Annotation("Nullable`1?")]
public DateTime? Dt { get; set; }
[Annotation("Nullable`1?")]
public double? F64 { get; set; }
[Annotation("Byte[]")]
public byte[] Guid { get; set; }
[Annotation("Nullable`1?")]
public long? I64 { get; set; }
[Annotation("String")]
public string Str { get; set; }
[Annotation("Kind")]
public RPC.EsiurTest.Kind Tag { get; set; }
[Annotation("Nullable`1?")]
public ulong? U64 { get; set; }
public RPC.SharedModel.Variant ToShared()
{
return new SharedModel.Variant()
{
Bool = Bool,
Bytes = Bytes,
Dt = Dt,
F64 = F64,
Guid = Guid,
I64 = I64,
Str = Str,
Tag = Enum.Parse<SharedModel.Kind>(Tag.ToString(), true),
U64 = U64
};
}
public Echo.Model.Grpc.Variant ToGrpc()
{
return new Echo.Model.Grpc.Variant()
{
BoolVal = Bool ?? false,
BytesVal = ByteString.CopyFrom(Bytes ?? new byte[0]),
DtVal = Dt?.Ticks ?? 0,
F64Val = F64 ?? 0,
GuidVal = ByteString.CopyFrom(Guid ?? new byte[0]),
I64Val = I64 ?? 0,
StrVal = Str,
Tag = Enum.Parse<Echo.Model.Grpc.Kind>(Tag.ToString(), true),
U64Val = U64 ?? 0,
};
}
public Echo.ThriftModel.Variant ToThrift()
{
var rt = new Echo.ThriftModel.Variant()
{
Tag = Enum.Parse<Echo.ThriftModel.Kind>(Tag.ToString(), true),
};
if (Bool != null)
rt.BoolVal = Bool.Value;
if (Bytes != null)
rt.BytesVal = Bytes;
if (Dt != null)
rt.DtVal = Dt.Value.Ticks;
if (F64 != null)
rt.F64Val = F64.Value;
if (Guid != null)
rt.GuidVal = Guid;
if (I64 != null)
rt.I64Val = I64.Value;
return rt;
}
public override bool Equals(object? obj)
{
var other = obj as Variant;
if (other == null) return false;
if (other.I64 != I64) return false;
if (other.U64 != U64) return false;
if (other.Bool != Bool) return false;
//if (other.Dec != Dec) return false;
if (other.Str != Str) return false;
if (Guid != null)
if (!other.Guid.SequenceEqual(Guid)) return false;
if (other.F64 != F64) return false;
if (other.Tag != Tag) return false;
if (Bytes != null)
if (!other.Bytes.SequenceEqual(Bytes)) return false;
if (other.Dt != Dt)
return false;
return true;
}
}
}
@@ -0,0 +1,37 @@
using System;
using Esiur.Resource;
using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
#nullable enable
namespace RPC.EsiurTest
{
[TypeId("d90d3558e2b18d9a8f45707372ddf2c3")]
public class TestObject : EpResource
{
public TestObject(EpConnection connection, uint instanceId, ulong age, string link) : base(connection, instanceId, age, link) { }
public TestObject() { }
[Annotation("String")]
[Export]
public string Name
{
get => (string)properties[0];
set => SetResourceProperty(0, value);
}
[Annotation("Int32")]
[Export]
public int Size
{
get => (int)properties[1];
set => SetResourceProperty(1, value);
}
[Annotation("Object")]
[Export]
public object Value
{
get => (object)properties[2];
set => SetResourceProperty(2, value);
}
}
}
+194
View File
@@ -0,0 +1,194 @@
#nullable enable
using System;
using System.Collections.Generic;
namespace RPC.SharedModel
{
// ====================== Enums ======================
public enum Currency
{
IQD,
CNH,
USD,
EUR,
JPY,
GBP
}
public enum DocType
{
Quote,
Order,
Invoice,
CreditNote
}
public enum PaymentMethod
{
Cash,
Card,
Wire,
Crypto,
Other
}
public enum LineType
{
Product,
Service,
Discount,
Shipping
}
// Variant.Kind
public enum Kind
{
Null,
Bool,
Int64,
UInt64,
Double,
Decimal,
String,
Bytes,
DateTime,
Guid
}
// ====================== Variant & Entry helpers ======================
public sealed class Variant
{
public Kind Tag { get; set; }
public bool? Bool { get; set; }
public long? I64 { get; set; }
public ulong? U64 { get; set; }
public double? F64 { get; set; }
public string? Str { get; set; }
public byte[]? Bytes { get; set; }
public DateTime? Dt { get; set; }
public byte[]? Guid { get; set; }
}
public sealed class MetaEntry
{
public string Key { get; set; } = string.Empty;
public Variant Value { get; set; } = new Variant();
}
public sealed class ExtEntry
{
public string Key { get; set; } = string.Empty;
public Variant Value { get; set; } = new Variant();
}
// ====================== Party & Address ======================
public sealed class Address
{
public string Line1 { get; set; } = string.Empty;
public string? Line2 { get; set; }
public string City { get; set; } = string.Empty;
public string Region { get; set; } = string.Empty;
public string Country { get; set; } = string.Empty;
public string? PostalCode { get; set; }
}
public sealed class Party
{
public ulong Id { get; set; }
public string Name { get; set; } = string.Empty;
public string? TaxId { get; set; }
public string? Email { get; set; }
public string? Phone { get; set; }
public Address? Address { get; set; }
public string? PreferredLanguage { get; set; }
}
// ====================== DocumentHeader ======================
public sealed class DocumentHeader
{
// Guid serialized as bytes
public byte[] DocId { get; set; } = Array.Empty<byte>();
public DocType Type { get; set; }
public int Version { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime? UpdatedAt { get; set; }
public Currency Currency { get; set; }
public string? Notes { get; set; }
// corresponds to Dictionary<string, Variant>
public Dictionary<string, Variant> Meta { get; set; } = new();
}
// ====================== LineItem, Payment, Attachment ======================
public sealed class LineItem
{
public int LineNo { get; set; }
public LineType Type { get; set; }
public string SKU { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public double Qty { get; set; }
public string QtyUnit { get; set; } = string.Empty;
public double UnitPrice { get; set; }
public double? VatRate { get; set; }
public double? Discount { get; set; }
// Dictionary<string, Variant>
public Dictionary<string, Variant> Ext { get; set; } = new();
}
public sealed class Payment
{
public PaymentMethod Method { get; set; }
public double Amount { get; set; }
public string? Reference { get; set; }
public DateTime Timestamp { get; set; }
public double? Fee { get; set; }
public Currency Currency { get; set; }
}
public sealed class Attachment
{
public string Name { get; set; } = string.Empty;
public string MimeType { get; set; } = string.Empty;
public byte[] Data { get; set; } = Array.Empty<byte>();
}
// ====================== Top-level BusinessDocument ======================
public sealed class BusinessDocument
{
public DocumentHeader Header { get; set; } = new DocumentHeader();
public Party Seller { get; set; } = new Party();
public Party Buyer { get; set; } = new Party();
public LineItem[] Items { get; set; } = Array.Empty<LineItem>();
public Payment[] Payments { get; set; } = Array.Empty<Payment>();
public Attachment[] Attachments { get; set; } = Array.Empty<Attachment>();
public int[] RiskScores { get; set; } = Array.Empty<int>();
}
}
+428
View File
@@ -0,0 +1,428 @@
/**
* <auto-generated>
* Autogenerated by Thrift Compiler (0.19.0)
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* </auto-generated>
*/
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 Address : TBase
{
private string _line1;
private string _line2;
private string _city;
private string _region;
private string _country;
private string _postalCode;
public string Line1
{
get
{
return _line1;
}
set
{
__isset.line1 = true;
this._line1 = value;
}
}
public string Line2
{
get
{
return _line2;
}
set
{
__isset.line2 = true;
this._line2 = value;
}
}
public string City
{
get
{
return _city;
}
set
{
__isset.@city = true;
this._city = value;
}
}
public string Region
{
get
{
return _region;
}
set
{
__isset.@region = true;
this._region = value;
}
}
public string Country
{
get
{
return _country;
}
set
{
__isset.@country = true;
this._country = value;
}
}
public string PostalCode
{
get
{
return _postalCode;
}
set
{
__isset.postalCode = true;
this._postalCode = value;
}
}
public Isset __isset;
public struct Isset
{
public bool line1;
public bool line2;
public bool @city;
public bool @region;
public bool @country;
public bool postalCode;
}
public Address()
{
}
public Address DeepCopy()
{
var tmp15 = new Address();
if((Line1 != null) && __isset.line1)
{
tmp15.Line1 = this.Line1;
}
tmp15.__isset.line1 = this.__isset.line1;
if((Line2 != null) && __isset.line2)
{
tmp15.Line2 = this.Line2;
}
tmp15.__isset.line2 = this.__isset.line2;
if((City != null) && __isset.@city)
{
tmp15.City = this.City;
}
tmp15.__isset.@city = this.__isset.@city;
if((Region != null) && __isset.@region)
{
tmp15.Region = this.Region;
}
tmp15.__isset.@region = this.__isset.@region;
if((Country != null) && __isset.@country)
{
tmp15.Country = this.Country;
}
tmp15.__isset.@country = this.__isset.@country;
if((PostalCode != null) && __isset.postalCode)
{
tmp15.PostalCode = this.PostalCode;
}
tmp15.__isset.postalCode = this.__isset.postalCode;
return tmp15;
}
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)
{
Line1 = await iprot.ReadStringAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 2:
if (field.Type == TType.String)
{
Line2 = await iprot.ReadStringAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 3:
if (field.Type == TType.String)
{
City = await iprot.ReadStringAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 4:
if (field.Type == TType.String)
{
Region = await iprot.ReadStringAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 5:
if (field.Type == TType.String)
{
Country = await iprot.ReadStringAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 6:
if (field.Type == TType.String)
{
PostalCode = await iprot.ReadStringAsync(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 tmp16 = new TStruct("Address");
await oprot.WriteStructBeginAsync(tmp16, cancellationToken);
var tmp17 = new TField();
if((Line1 != null) && __isset.line1)
{
tmp17.Name = "line1";
tmp17.Type = TType.String;
tmp17.ID = 1;
await oprot.WriteFieldBeginAsync(tmp17, cancellationToken);
await oprot.WriteStringAsync(Line1, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((Line2 != null) && __isset.line2)
{
tmp17.Name = "line2";
tmp17.Type = TType.String;
tmp17.ID = 2;
await oprot.WriteFieldBeginAsync(tmp17, cancellationToken);
await oprot.WriteStringAsync(Line2, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((City != null) && __isset.@city)
{
tmp17.Name = "city";
tmp17.Type = TType.String;
tmp17.ID = 3;
await oprot.WriteFieldBeginAsync(tmp17, cancellationToken);
await oprot.WriteStringAsync(City, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((Region != null) && __isset.@region)
{
tmp17.Name = "region";
tmp17.Type = TType.String;
tmp17.ID = 4;
await oprot.WriteFieldBeginAsync(tmp17, cancellationToken);
await oprot.WriteStringAsync(Region, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((Country != null) && __isset.@country)
{
tmp17.Name = "country";
tmp17.Type = TType.String;
tmp17.ID = 5;
await oprot.WriteFieldBeginAsync(tmp17, cancellationToken);
await oprot.WriteStringAsync(Country, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((PostalCode != null) && __isset.postalCode)
{
tmp17.Name = "postalCode";
tmp17.Type = TType.String;
tmp17.ID = 6;
await oprot.WriteFieldBeginAsync(tmp17, cancellationToken);
await oprot.WriteStringAsync(PostalCode, 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 Address other)) return false;
if (ReferenceEquals(this, other)) return true;
return ((__isset.line1 == other.__isset.line1) && ((!__isset.line1) || (global::System.Object.Equals(Line1, other.Line1))))
&& ((__isset.line2 == other.__isset.line2) && ((!__isset.line2) || (global::System.Object.Equals(Line2, other.Line2))))
&& ((__isset.@city == other.__isset.@city) && ((!__isset.@city) || (global::System.Object.Equals(City, other.City))))
&& ((__isset.@region == other.__isset.@region) && ((!__isset.@region) || (global::System.Object.Equals(Region, other.Region))))
&& ((__isset.@country == other.__isset.@country) && ((!__isset.@country) || (global::System.Object.Equals(Country, other.Country))))
&& ((__isset.postalCode == other.__isset.postalCode) && ((!__isset.postalCode) || (global::System.Object.Equals(PostalCode, other.PostalCode))));
}
public override int GetHashCode() {
int hashcode = 157;
unchecked {
if((Line1 != null) && __isset.line1)
{
hashcode = (hashcode * 397) + Line1.GetHashCode();
}
if((Line2 != null) && __isset.line2)
{
hashcode = (hashcode * 397) + Line2.GetHashCode();
}
if((City != null) && __isset.@city)
{
hashcode = (hashcode * 397) + City.GetHashCode();
}
if((Region != null) && __isset.@region)
{
hashcode = (hashcode * 397) + Region.GetHashCode();
}
if((Country != null) && __isset.@country)
{
hashcode = (hashcode * 397) + Country.GetHashCode();
}
if((PostalCode != null) && __isset.postalCode)
{
hashcode = (hashcode * 397) + PostalCode.GetHashCode();
}
}
return hashcode;
}
public override string ToString()
{
var tmp18 = new StringBuilder("Address(");
int tmp19 = 0;
if((Line1 != null) && __isset.line1)
{
if(0 < tmp19++) { tmp18.Append(", "); }
tmp18.Append("Line1: ");
Line1.ToString(tmp18);
}
if((Line2 != null) && __isset.line2)
{
if(0 < tmp19++) { tmp18.Append(", "); }
tmp18.Append("Line2: ");
Line2.ToString(tmp18);
}
if((City != null) && __isset.@city)
{
if(0 < tmp19++) { tmp18.Append(", "); }
tmp18.Append("City: ");
City.ToString(tmp18);
}
if((Region != null) && __isset.@region)
{
if(0 < tmp19++) { tmp18.Append(", "); }
tmp18.Append("Region: ");
Region.ToString(tmp18);
}
if((Country != null) && __isset.@country)
{
if(0 < tmp19++) { tmp18.Append(", "); }
tmp18.Append("Country: ");
Country.ToString(tmp18);
}
if((PostalCode != null) && __isset.postalCode)
{
if(0 < tmp19++) { tmp18.Append(", "); }
tmp18.Append("PostalCode: ");
PostalCode.ToString(tmp18);
}
tmp18.Append(')');
return tmp18.ToString();
}
}
}
+278
View File
@@ -0,0 +1,278 @@
/**
* <auto-generated>
* Autogenerated by Thrift Compiler (0.19.0)
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* </auto-generated>
*/
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 Attachment : TBase
{
private string _name;
private string _mimeType;
private byte[] _data;
public string Name
{
get
{
return _name;
}
set
{
__isset.@name = true;
this._name = value;
}
}
public string MimeType
{
get
{
return _mimeType;
}
set
{
__isset.mimeType = true;
this._mimeType = value;
}
}
public byte[] Data
{
get
{
return _data;
}
set
{
__isset.@data = true;
this._data = value;
}
}
public Isset __isset;
public struct Isset
{
public bool @name;
public bool mimeType;
public bool @data;
}
public Attachment()
{
}
public Attachment DeepCopy()
{
var tmp50 = new Attachment();
if((Name != null) && __isset.@name)
{
tmp50.Name = this.Name;
}
tmp50.__isset.@name = this.__isset.@name;
if((MimeType != null) && __isset.mimeType)
{
tmp50.MimeType = this.MimeType;
}
tmp50.__isset.mimeType = this.__isset.mimeType;
if((Data != null) && __isset.@data)
{
tmp50.Data = this.Data.ToArray();
}
tmp50.__isset.@data = this.__isset.@data;
return tmp50;
}
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)
{
Name = await iprot.ReadStringAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 2:
if (field.Type == TType.String)
{
MimeType = await iprot.ReadStringAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 3:
if (field.Type == TType.String)
{
Data = await iprot.ReadBinaryAsync(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 tmp51 = new TStruct("Attachment");
await oprot.WriteStructBeginAsync(tmp51, cancellationToken);
var tmp52 = new TField();
if((Name != null) && __isset.@name)
{
tmp52.Name = "name";
tmp52.Type = TType.String;
tmp52.ID = 1;
await oprot.WriteFieldBeginAsync(tmp52, cancellationToken);
await oprot.WriteStringAsync(Name, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((MimeType != null) && __isset.mimeType)
{
tmp52.Name = "mimeType";
tmp52.Type = TType.String;
tmp52.ID = 2;
await oprot.WriteFieldBeginAsync(tmp52, cancellationToken);
await oprot.WriteStringAsync(MimeType, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((Data != null) && __isset.@data)
{
tmp52.Name = "data";
tmp52.Type = TType.String;
tmp52.ID = 3;
await oprot.WriteFieldBeginAsync(tmp52, cancellationToken);
await oprot.WriteBinaryAsync(Data, 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 Attachment other)) return false;
if (ReferenceEquals(this, other)) return true;
return ((__isset.@name == other.__isset.@name) && ((!__isset.@name) || (global::System.Object.Equals(Name, other.Name))))
&& ((__isset.mimeType == other.__isset.mimeType) && ((!__isset.mimeType) || (global::System.Object.Equals(MimeType, other.MimeType))))
&& ((__isset.@data == other.__isset.@data) && ((!__isset.@data) || (TCollections.Equals(Data, other.Data))));
}
public override int GetHashCode() {
int hashcode = 157;
unchecked {
if((Name != null) && __isset.@name)
{
hashcode = (hashcode * 397) + Name.GetHashCode();
}
if((MimeType != null) && __isset.mimeType)
{
hashcode = (hashcode * 397) + MimeType.GetHashCode();
}
if((Data != null) && __isset.@data)
{
hashcode = (hashcode * 397) + Data.GetHashCode();
}
}
return hashcode;
}
public override string ToString()
{
var tmp53 = new StringBuilder("Attachment(");
int tmp54 = 0;
if((Name != null) && __isset.@name)
{
if(0 < tmp54++) { tmp53.Append(", "); }
tmp53.Append("Name: ");
Name.ToString(tmp53);
}
if((MimeType != null) && __isset.mimeType)
{
if(0 < tmp54++) { tmp53.Append(", "); }
tmp53.Append("MimeType: ");
MimeType.ToString(tmp53);
}
if((Data != null) && __isset.@data)
{
if(0 < tmp54++) { tmp53.Append(", "); }
tmp53.Append("Data: ");
Data.ToString(tmp53);
}
tmp53.Append(')');
return tmp53.ToString();
}
}
}
@@ -0,0 +1,544 @@
/**
* <auto-generated>
* Autogenerated by Thrift Compiler (0.19.0)
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* </auto-generated>
*/
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 BusinessDocument : TBase
{
private global::Echo.ThriftModel.DocumentHeader _header;
private global::Echo.ThriftModel.Party _seller;
private global::Echo.ThriftModel.Party _buyer;
private List<global::Echo.ThriftModel.LineItem> _items;
private List<global::Echo.ThriftModel.Payment> _payments;
private List<global::Echo.ThriftModel.Attachment> _attachments;
private List<int> _riskScores;
public global::Echo.ThriftModel.DocumentHeader Header
{
get
{
return _header;
}
set
{
__isset.@header = true;
this._header = value;
}
}
public global::Echo.ThriftModel.Party Seller
{
get
{
return _seller;
}
set
{
__isset.@seller = true;
this._seller = value;
}
}
public global::Echo.ThriftModel.Party Buyer
{
get
{
return _buyer;
}
set
{
__isset.@buyer = true;
this._buyer = value;
}
}
public List<global::Echo.ThriftModel.LineItem> Items
{
get
{
return _items;
}
set
{
__isset.@items = true;
this._items = value;
}
}
public List<global::Echo.ThriftModel.Payment> Payments
{
get
{
return _payments;
}
set
{
__isset.@payments = true;
this._payments = value;
}
}
public List<global::Echo.ThriftModel.Attachment> Attachments
{
get
{
return _attachments;
}
set
{
__isset.@attachments = true;
this._attachments = value;
}
}
public List<int> RiskScores
{
get
{
return _riskScores;
}
set
{
__isset.riskScores = true;
this._riskScores = value;
}
}
public Isset __isset;
public struct Isset
{
public bool @header;
public bool @seller;
public bool @buyer;
public bool @items;
public bool @payments;
public bool @attachments;
public bool riskScores;
}
public BusinessDocument()
{
}
public BusinessDocument DeepCopy()
{
var tmp55 = new BusinessDocument();
if((Header != null) && __isset.@header)
{
tmp55.Header = (global::Echo.ThriftModel.DocumentHeader)this.Header.DeepCopy();
}
tmp55.__isset.@header = this.__isset.@header;
if((Seller != null) && __isset.@seller)
{
tmp55.Seller = (global::Echo.ThriftModel.Party)this.Seller.DeepCopy();
}
tmp55.__isset.@seller = this.__isset.@seller;
if((Buyer != null) && __isset.@buyer)
{
tmp55.Buyer = (global::Echo.ThriftModel.Party)this.Buyer.DeepCopy();
}
tmp55.__isset.@buyer = this.__isset.@buyer;
if((Items != null) && __isset.@items)
{
tmp55.Items = this.Items.DeepCopy();
}
tmp55.__isset.@items = this.__isset.@items;
if((Payments != null) && __isset.@payments)
{
tmp55.Payments = this.Payments.DeepCopy();
}
tmp55.__isset.@payments = this.__isset.@payments;
if((Attachments != null) && __isset.@attachments)
{
tmp55.Attachments = this.Attachments.DeepCopy();
}
tmp55.__isset.@attachments = this.__isset.@attachments;
if((RiskScores != null) && __isset.riskScores)
{
tmp55.RiskScores = this.RiskScores.DeepCopy();
}
tmp55.__isset.riskScores = this.__isset.riskScores;
return tmp55;
}
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.Struct)
{
Header = new global::Echo.ThriftModel.DocumentHeader();
await Header.ReadAsync(iprot, cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 2:
if (field.Type == TType.Struct)
{
Seller = new global::Echo.ThriftModel.Party();
await Seller.ReadAsync(iprot, cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 3:
if (field.Type == TType.Struct)
{
Buyer = new global::Echo.ThriftModel.Party();
await Buyer.ReadAsync(iprot, cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 4:
if (field.Type == TType.List)
{
{
var _list56 = await iprot.ReadListBeginAsync(cancellationToken);
Items = new List<global::Echo.ThriftModel.LineItem>(_list56.Count);
for(int _i57 = 0; _i57 < _list56.Count; ++_i57)
{
global::Echo.ThriftModel.LineItem _elem58;
_elem58 = new global::Echo.ThriftModel.LineItem();
await _elem58.ReadAsync(iprot, cancellationToken);
Items.Add(_elem58);
}
await iprot.ReadListEndAsync(cancellationToken);
}
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 5:
if (field.Type == TType.List)
{
{
var _list59 = await iprot.ReadListBeginAsync(cancellationToken);
Payments = new List<global::Echo.ThriftModel.Payment>(_list59.Count);
for(int _i60 = 0; _i60 < _list59.Count; ++_i60)
{
global::Echo.ThriftModel.Payment _elem61;
_elem61 = new global::Echo.ThriftModel.Payment();
await _elem61.ReadAsync(iprot, cancellationToken);
Payments.Add(_elem61);
}
await iprot.ReadListEndAsync(cancellationToken);
}
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 6:
if (field.Type == TType.List)
{
{
var _list62 = await iprot.ReadListBeginAsync(cancellationToken);
Attachments = new List<global::Echo.ThriftModel.Attachment>(_list62.Count);
for(int _i63 = 0; _i63 < _list62.Count; ++_i63)
{
global::Echo.ThriftModel.Attachment _elem64;
_elem64 = new global::Echo.ThriftModel.Attachment();
await _elem64.ReadAsync(iprot, cancellationToken);
Attachments.Add(_elem64);
}
await iprot.ReadListEndAsync(cancellationToken);
}
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 7:
if (field.Type == TType.List)
{
{
var _list65 = await iprot.ReadListBeginAsync(cancellationToken);
RiskScores = new List<int>(_list65.Count);
for(int _i66 = 0; _i66 < _list65.Count; ++_i66)
{
int _elem67;
_elem67 = await iprot.ReadI32Async(cancellationToken);
RiskScores.Add(_elem67);
}
await iprot.ReadListEndAsync(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 tmp68 = new TStruct("BusinessDocument");
await oprot.WriteStructBeginAsync(tmp68, cancellationToken);
var tmp69 = new TField();
if((Header != null) && __isset.@header)
{
tmp69.Name = "header";
tmp69.Type = TType.Struct;
tmp69.ID = 1;
await oprot.WriteFieldBeginAsync(tmp69, cancellationToken);
await Header.WriteAsync(oprot, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((Seller != null) && __isset.@seller)
{
tmp69.Name = "seller";
tmp69.Type = TType.Struct;
tmp69.ID = 2;
await oprot.WriteFieldBeginAsync(tmp69, cancellationToken);
await Seller.WriteAsync(oprot, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((Buyer != null) && __isset.@buyer)
{
tmp69.Name = "buyer";
tmp69.Type = TType.Struct;
tmp69.ID = 3;
await oprot.WriteFieldBeginAsync(tmp69, cancellationToken);
await Buyer.WriteAsync(oprot, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((Items != null) && __isset.@items)
{
tmp69.Name = "items";
tmp69.Type = TType.List;
tmp69.ID = 4;
await oprot.WriteFieldBeginAsync(tmp69, cancellationToken);
await oprot.WriteListBeginAsync(new TList(TType.Struct, Items.Count), cancellationToken);
foreach (global::Echo.ThriftModel.LineItem _iter70 in Items)
{
await _iter70.WriteAsync(oprot, cancellationToken);
}
await oprot.WriteListEndAsync(cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((Payments != null) && __isset.@payments)
{
tmp69.Name = "payments";
tmp69.Type = TType.List;
tmp69.ID = 5;
await oprot.WriteFieldBeginAsync(tmp69, cancellationToken);
await oprot.WriteListBeginAsync(new TList(TType.Struct, Payments.Count), cancellationToken);
foreach (global::Echo.ThriftModel.Payment _iter71 in Payments)
{
await _iter71.WriteAsync(oprot, cancellationToken);
}
await oprot.WriteListEndAsync(cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((Attachments != null) && __isset.@attachments)
{
tmp69.Name = "attachments";
tmp69.Type = TType.List;
tmp69.ID = 6;
await oprot.WriteFieldBeginAsync(tmp69, cancellationToken);
await oprot.WriteListBeginAsync(new TList(TType.Struct, Attachments.Count), cancellationToken);
foreach (global::Echo.ThriftModel.Attachment _iter72 in Attachments)
{
await _iter72.WriteAsync(oprot, cancellationToken);
}
await oprot.WriteListEndAsync(cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((RiskScores != null) && __isset.riskScores)
{
tmp69.Name = "riskScores";
tmp69.Type = TType.List;
tmp69.ID = 7;
await oprot.WriteFieldBeginAsync(tmp69, cancellationToken);
await oprot.WriteListBeginAsync(new TList(TType.I32, RiskScores.Count), cancellationToken);
foreach (int _iter73 in RiskScores)
{
await oprot.WriteI32Async(_iter73, cancellationToken);
}
await oprot.WriteListEndAsync(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 BusinessDocument other)) return false;
if (ReferenceEquals(this, other)) return true;
return ((__isset.@header == other.__isset.@header) && ((!__isset.@header) || (global::System.Object.Equals(Header, other.Header))))
&& ((__isset.@seller == other.__isset.@seller) && ((!__isset.@seller) || (global::System.Object.Equals(Seller, other.Seller))))
&& ((__isset.@buyer == other.__isset.@buyer) && ((!__isset.@buyer) || (global::System.Object.Equals(Buyer, other.Buyer))))
&& ((__isset.@items == other.__isset.@items) && ((!__isset.@items) || (TCollections.Equals(Items, other.Items))))
&& ((__isset.@payments == other.__isset.@payments) && ((!__isset.@payments) || (TCollections.Equals(Payments, other.Payments))))
&& ((__isset.@attachments == other.__isset.@attachments) && ((!__isset.@attachments) || (TCollections.Equals(Attachments, other.Attachments))))
&& ((__isset.riskScores == other.__isset.riskScores) && ((!__isset.riskScores) || (TCollections.Equals(RiskScores, other.RiskScores))));
}
public override int GetHashCode() {
int hashcode = 157;
unchecked {
if((Header != null) && __isset.@header)
{
hashcode = (hashcode * 397) + Header.GetHashCode();
}
if((Seller != null) && __isset.@seller)
{
hashcode = (hashcode * 397) + Seller.GetHashCode();
}
if((Buyer != null) && __isset.@buyer)
{
hashcode = (hashcode * 397) + Buyer.GetHashCode();
}
if((Items != null) && __isset.@items)
{
hashcode = (hashcode * 397) + TCollections.GetHashCode(Items);
}
if((Payments != null) && __isset.@payments)
{
hashcode = (hashcode * 397) + TCollections.GetHashCode(Payments);
}
if((Attachments != null) && __isset.@attachments)
{
hashcode = (hashcode * 397) + TCollections.GetHashCode(Attachments);
}
if((RiskScores != null) && __isset.riskScores)
{
hashcode = (hashcode * 397) + TCollections.GetHashCode(RiskScores);
}
}
return hashcode;
}
public override string ToString()
{
var tmp74 = new StringBuilder("BusinessDocument(");
int tmp75 = 0;
if((Header != null) && __isset.@header)
{
if(0 < tmp75++) { tmp74.Append(", "); }
tmp74.Append("Header: ");
Header.ToString(tmp74);
}
if((Seller != null) && __isset.@seller)
{
if(0 < tmp75++) { tmp74.Append(", "); }
tmp74.Append("Seller: ");
Seller.ToString(tmp74);
}
if((Buyer != null) && __isset.@buyer)
{
if(0 < tmp75++) { tmp74.Append(", "); }
tmp74.Append("Buyer: ");
Buyer.ToString(tmp74);
}
if((Items != null) && __isset.@items)
{
if(0 < tmp75++) { tmp74.Append(", "); }
tmp74.Append("Items: ");
Items.ToString(tmp74);
}
if((Payments != null) && __isset.@payments)
{
if(0 < tmp75++) { tmp74.Append(", "); }
tmp74.Append("Payments: ");
Payments.ToString(tmp74);
}
if((Attachments != null) && __isset.@attachments)
{
if(0 < tmp75++) { tmp74.Append(", "); }
tmp74.Append("Attachments: ");
Attachments.ToString(tmp74);
}
if((RiskScores != null) && __isset.riskScores)
{
if(0 < tmp75++) { tmp74.Append(", "); }
tmp74.Append("RiskScores: ");
RiskScores.ToString(tmp74);
}
tmp74.Append(')');
return tmp74.ToString();
}
}
}
+26
View File
@@ -0,0 +1,26 @@
/**
* <auto-generated>
* Autogenerated by Thrift Compiler (0.19.0)
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* </auto-generated>
*/
#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 enum Currency
{
IQD = 0,
CNH = 1,
USD = 2,
EUR = 3,
JPY = 4,
GBP = 5,
}
}
+24
View File
@@ -0,0 +1,24 @@
/**
* <auto-generated>
* Autogenerated by Thrift Compiler (0.19.0)
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* </auto-generated>
*/
#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 enum DocType
{
Quote = 0,
Order = 1,
Invoice = 2,
CreditNote = 3,
}
}
@@ -0,0 +1,555 @@
/**
* <auto-generated>
* Autogenerated by Thrift Compiler (0.19.0)
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* </auto-generated>
*/
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<string, global::Echo.ThriftModel.Variant> _meta;
public byte[] DocId
{
get
{
return _docId;
}
set
{
__isset.docId = true;
this._docId = value;
}
}
/// <summary>
///
/// <seealso cref="global::Echo.ThriftModel.DocType"/>
/// </summary>
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;
}
}
/// <summary>
///
/// <seealso cref="global::Echo.ThriftModel.Currency"/>
/// </summary>
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<string, global::Echo.ThriftModel.Variant> 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<string, global::Echo.ThriftModel.Variant>(_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();
}
}
}
File diff suppressed because it is too large Load Diff
+229
View File
@@ -0,0 +1,229 @@
/**
* <auto-generated>
* Autogenerated by Thrift Compiler (0.19.0)
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* </auto-generated>
*/
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 ExtEntry : TBase
{
private string _key;
private global::Echo.ThriftModel.Variant _value;
public string Key
{
get
{
return _key;
}
set
{
__isset.@key = true;
this._key = value;
}
}
public global::Echo.ThriftModel.Variant Value
{
get
{
return _value;
}
set
{
__isset.@value = true;
this._value = value;
}
}
public Isset __isset;
public struct Isset
{
public bool @key;
public bool @value;
}
public ExtEntry()
{
}
public ExtEntry DeepCopy()
{
var tmp10 = new ExtEntry();
if((Key != null) && __isset.@key)
{
tmp10.Key = this.Key;
}
tmp10.__isset.@key = this.__isset.@key;
if((Value != null) && __isset.@value)
{
tmp10.Value = (global::Echo.ThriftModel.Variant)this.Value.DeepCopy();
}
tmp10.__isset.@value = this.__isset.@value;
return tmp10;
}
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)
{
Key = await iprot.ReadStringAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 2:
if (field.Type == TType.Struct)
{
Value = new global::Echo.ThriftModel.Variant();
await Value.ReadAsync(iprot, 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 tmp11 = new TStruct("ExtEntry");
await oprot.WriteStructBeginAsync(tmp11, cancellationToken);
var tmp12 = new TField();
if((Key != null) && __isset.@key)
{
tmp12.Name = "key";
tmp12.Type = TType.String;
tmp12.ID = 1;
await oprot.WriteFieldBeginAsync(tmp12, cancellationToken);
await oprot.WriteStringAsync(Key, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((Value != null) && __isset.@value)
{
tmp12.Name = "value";
tmp12.Type = TType.Struct;
tmp12.ID = 2;
await oprot.WriteFieldBeginAsync(tmp12, cancellationToken);
await Value.WriteAsync(oprot, 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 ExtEntry other)) return false;
if (ReferenceEquals(this, other)) return true;
return ((__isset.@key == other.__isset.@key) && ((!__isset.@key) || (global::System.Object.Equals(Key, other.Key))))
&& ((__isset.@value == other.__isset.@value) && ((!__isset.@value) || (global::System.Object.Equals(Value, other.Value))));
}
public override int GetHashCode() {
int hashcode = 157;
unchecked {
if((Key != null) && __isset.@key)
{
hashcode = (hashcode * 397) + Key.GetHashCode();
}
if((Value != null) && __isset.@value)
{
hashcode = (hashcode * 397) + Value.GetHashCode();
}
}
return hashcode;
}
public override string ToString()
{
var tmp13 = new StringBuilder("ExtEntry(");
int tmp14 = 0;
if((Key != null) && __isset.@key)
{
if(0 < tmp14++) { tmp13.Append(", "); }
tmp13.Append("Key: ");
Key.ToString(tmp13);
}
if((Value != null) && __isset.@value)
{
if(0 < tmp14++) { tmp13.Append(", "); }
tmp13.Append("Value: ");
Value.ToString(tmp13);
}
tmp13.Append(')');
return tmp13.ToString();
}
}
}
+30
View File
@@ -0,0 +1,30 @@
/**
* <auto-generated>
* Autogenerated by Thrift Compiler (0.19.0)
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* </auto-generated>
*/
#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 enum Kind
{
@Null = 0,
@Bool = 1,
Int64 = 2,
UInt64 = 3,
@Double = 4,
@Decimal = 5,
@String = 6,
Bytes = 7,
DateTime = 8,
Guid = 9,
}
}
+651
View File
@@ -0,0 +1,651 @@
/**
* <auto-generated>
* Autogenerated by Thrift Compiler (0.19.0)
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* </auto-generated>
*/
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 LineItem : TBase
{
private int _lineNo;
private global::Echo.ThriftModel.LineType _type;
private string _sku;
private string _description;
private double _qty;
private string _qtyUnit;
private double _unitPrice;
private double _vatRate;
private double _discount;
private Dictionary<string, global::Echo.ThriftModel.Variant> _ext;
public int LineNo
{
get
{
return _lineNo;
}
set
{
__isset.lineNo = true;
this._lineNo = value;
}
}
/// <summary>
///
/// <seealso cref="global::Echo.ThriftModel.LineType"/>
/// </summary>
public global::Echo.ThriftModel.LineType Type
{
get
{
return _type;
}
set
{
__isset.@type = true;
this._type = value;
}
}
public string Sku
{
get
{
return _sku;
}
set
{
__isset.@sku = true;
this._sku = value;
}
}
public string Description
{
get
{
return _description;
}
set
{
__isset.@description = true;
this._description = value;
}
}
public double Qty
{
get
{
return _qty;
}
set
{
__isset.@qty = true;
this._qty = value;
}
}
public string QtyUnit
{
get
{
return _qtyUnit;
}
set
{
__isset.qtyUnit = true;
this._qtyUnit = value;
}
}
public double UnitPrice
{
get
{
return _unitPrice;
}
set
{
__isset.unitPrice = true;
this._unitPrice = value;
}
}
public double VatRate
{
get
{
return _vatRate;
}
set
{
__isset.vatRate = true;
this._vatRate = value;
}
}
public double Discount
{
get
{
return _discount;
}
set
{
__isset.@discount = true;
this._discount = value;
}
}
public Dictionary<string, global::Echo.ThriftModel.Variant> Ext
{
get
{
return _ext;
}
set
{
__isset.@ext = true;
this._ext = value;
}
}
public Isset __isset;
public struct Isset
{
public bool lineNo;
public bool @type;
public bool @sku;
public bool @description;
public bool @qty;
public bool qtyUnit;
public bool unitPrice;
public bool vatRate;
public bool @discount;
public bool @ext;
}
public LineItem()
{
}
public LineItem DeepCopy()
{
var tmp35 = new LineItem();
if(__isset.lineNo)
{
tmp35.LineNo = this.LineNo;
}
tmp35.__isset.lineNo = this.__isset.lineNo;
if(__isset.@type)
{
tmp35.Type = this.Type;
}
tmp35.__isset.@type = this.__isset.@type;
if((Sku != null) && __isset.@sku)
{
tmp35.Sku = this.Sku;
}
tmp35.__isset.@sku = this.__isset.@sku;
if((Description != null) && __isset.@description)
{
tmp35.Description = this.Description;
}
tmp35.__isset.@description = this.__isset.@description;
if(__isset.@qty)
{
tmp35.Qty = this.Qty;
}
tmp35.__isset.@qty = this.__isset.@qty;
if((QtyUnit != null) && __isset.qtyUnit)
{
tmp35.QtyUnit = this.QtyUnit;
}
tmp35.__isset.qtyUnit = this.__isset.qtyUnit;
if(__isset.unitPrice)
{
tmp35.UnitPrice = this.UnitPrice;
}
tmp35.__isset.unitPrice = this.__isset.unitPrice;
if(__isset.vatRate)
{
tmp35.VatRate = this.VatRate;
}
tmp35.__isset.vatRate = this.__isset.vatRate;
if(__isset.@discount)
{
tmp35.Discount = this.Discount;
}
tmp35.__isset.@discount = this.__isset.@discount;
if((Ext != null) && __isset.@ext)
{
tmp35.Ext = this.Ext.DeepCopy();
}
tmp35.__isset.@ext = this.__isset.@ext;
return tmp35;
}
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.I32)
{
LineNo = await iprot.ReadI32Async(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 2:
if (field.Type == TType.I32)
{
Type = (global::Echo.ThriftModel.LineType)await iprot.ReadI32Async(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 3:
if (field.Type == TType.String)
{
Sku = await iprot.ReadStringAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 4:
if (field.Type == TType.String)
{
Description = await iprot.ReadStringAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 5:
if (field.Type == TType.Double)
{
Qty = await iprot.ReadDoubleAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 6:
if (field.Type == TType.String)
{
QtyUnit = await iprot.ReadStringAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 7:
if (field.Type == TType.Double)
{
UnitPrice = await iprot.ReadDoubleAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 8:
if (field.Type == TType.Double)
{
VatRate = await iprot.ReadDoubleAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 9:
if (field.Type == TType.Double)
{
Discount = await iprot.ReadDoubleAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 10:
if (field.Type == TType.Map)
{
{
var _map36 = await iprot.ReadMapBeginAsync(cancellationToken);
Ext = new Dictionary<string, global::Echo.ThriftModel.Variant>(_map36.Count);
for(int _i37 = 0; _i37 < _map36.Count; ++_i37)
{
string _key38;
global::Echo.ThriftModel.Variant _val39;
_key38 = await iprot.ReadStringAsync(cancellationToken);
_val39 = new global::Echo.ThriftModel.Variant();
await _val39.ReadAsync(iprot, cancellationToken);
Ext[_key38] = _val39;
}
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 tmp40 = new TStruct("LineItem");
await oprot.WriteStructBeginAsync(tmp40, cancellationToken);
var tmp41 = new TField();
if(__isset.lineNo)
{
tmp41.Name = "lineNo";
tmp41.Type = TType.I32;
tmp41.ID = 1;
await oprot.WriteFieldBeginAsync(tmp41, cancellationToken);
await oprot.WriteI32Async(LineNo, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if(__isset.@type)
{
tmp41.Name = "type";
tmp41.Type = TType.I32;
tmp41.ID = 2;
await oprot.WriteFieldBeginAsync(tmp41, cancellationToken);
await oprot.WriteI32Async((int)Type, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((Sku != null) && __isset.@sku)
{
tmp41.Name = "sku";
tmp41.Type = TType.String;
tmp41.ID = 3;
await oprot.WriteFieldBeginAsync(tmp41, cancellationToken);
await oprot.WriteStringAsync(Sku, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((Description != null) && __isset.@description)
{
tmp41.Name = "description";
tmp41.Type = TType.String;
tmp41.ID = 4;
await oprot.WriteFieldBeginAsync(tmp41, cancellationToken);
await oprot.WriteStringAsync(Description, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if(__isset.@qty)
{
tmp41.Name = "qty";
tmp41.Type = TType.Double;
tmp41.ID = 5;
await oprot.WriteFieldBeginAsync(tmp41, cancellationToken);
await oprot.WriteDoubleAsync(Qty, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((QtyUnit != null) && __isset.qtyUnit)
{
tmp41.Name = "qtyUnit";
tmp41.Type = TType.String;
tmp41.ID = 6;
await oprot.WriteFieldBeginAsync(tmp41, cancellationToken);
await oprot.WriteStringAsync(QtyUnit, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if(__isset.unitPrice)
{
tmp41.Name = "unitPrice";
tmp41.Type = TType.Double;
tmp41.ID = 7;
await oprot.WriteFieldBeginAsync(tmp41, cancellationToken);
await oprot.WriteDoubleAsync(UnitPrice, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if(__isset.vatRate)
{
tmp41.Name = "vatRate";
tmp41.Type = TType.Double;
tmp41.ID = 8;
await oprot.WriteFieldBeginAsync(tmp41, cancellationToken);
await oprot.WriteDoubleAsync(VatRate, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if(__isset.@discount)
{
tmp41.Name = "discount";
tmp41.Type = TType.Double;
tmp41.ID = 9;
await oprot.WriteFieldBeginAsync(tmp41, cancellationToken);
await oprot.WriteDoubleAsync(Discount, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((Ext != null) && __isset.@ext)
{
tmp41.Name = "ext";
tmp41.Type = TType.Map;
tmp41.ID = 10;
await oprot.WriteFieldBeginAsync(tmp41, cancellationToken);
await oprot.WriteMapBeginAsync(new TMap(TType.String, TType.Struct, Ext.Count), cancellationToken);
foreach (string _iter42 in Ext.Keys)
{
await oprot.WriteStringAsync(_iter42, cancellationToken);
await Ext[_iter42].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 LineItem other)) return false;
if (ReferenceEquals(this, other)) return true;
return ((__isset.lineNo == other.__isset.lineNo) && ((!__isset.lineNo) || (global::System.Object.Equals(LineNo, other.LineNo))))
&& ((__isset.@type == other.__isset.@type) && ((!__isset.@type) || (global::System.Object.Equals(Type, other.Type))))
&& ((__isset.@sku == other.__isset.@sku) && ((!__isset.@sku) || (global::System.Object.Equals(Sku, other.Sku))))
&& ((__isset.@description == other.__isset.@description) && ((!__isset.@description) || (global::System.Object.Equals(Description, other.Description))))
&& ((__isset.@qty == other.__isset.@qty) && ((!__isset.@qty) || (global::System.Object.Equals(Qty, other.Qty))))
&& ((__isset.qtyUnit == other.__isset.qtyUnit) && ((!__isset.qtyUnit) || (global::System.Object.Equals(QtyUnit, other.QtyUnit))))
&& ((__isset.unitPrice == other.__isset.unitPrice) && ((!__isset.unitPrice) || (global::System.Object.Equals(UnitPrice, other.UnitPrice))))
&& ((__isset.vatRate == other.__isset.vatRate) && ((!__isset.vatRate) || (global::System.Object.Equals(VatRate, other.VatRate))))
&& ((__isset.@discount == other.__isset.@discount) && ((!__isset.@discount) || (global::System.Object.Equals(Discount, other.Discount))))
&& ((__isset.@ext == other.__isset.@ext) && ((!__isset.@ext) || (TCollections.Equals(Ext, other.Ext))));
}
public override int GetHashCode() {
int hashcode = 157;
unchecked {
if(__isset.lineNo)
{
hashcode = (hashcode * 397) + LineNo.GetHashCode();
}
if(__isset.@type)
{
hashcode = (hashcode * 397) + Type.GetHashCode();
}
if((Sku != null) && __isset.@sku)
{
hashcode = (hashcode * 397) + Sku.GetHashCode();
}
if((Description != null) && __isset.@description)
{
hashcode = (hashcode * 397) + Description.GetHashCode();
}
if(__isset.@qty)
{
hashcode = (hashcode * 397) + Qty.GetHashCode();
}
if((QtyUnit != null) && __isset.qtyUnit)
{
hashcode = (hashcode * 397) + QtyUnit.GetHashCode();
}
if(__isset.unitPrice)
{
hashcode = (hashcode * 397) + UnitPrice.GetHashCode();
}
if(__isset.vatRate)
{
hashcode = (hashcode * 397) + VatRate.GetHashCode();
}
if(__isset.@discount)
{
hashcode = (hashcode * 397) + Discount.GetHashCode();
}
if((Ext != null) && __isset.@ext)
{
hashcode = (hashcode * 397) + TCollections.GetHashCode(Ext);
}
}
return hashcode;
}
public override string ToString()
{
var tmp43 = new StringBuilder("LineItem(");
int tmp44 = 0;
if(__isset.lineNo)
{
if(0 < tmp44++) { tmp43.Append(", "); }
tmp43.Append("LineNo: ");
LineNo.ToString(tmp43);
}
if(__isset.@type)
{
if(0 < tmp44++) { tmp43.Append(", "); }
tmp43.Append("Type: ");
Type.ToString(tmp43);
}
if((Sku != null) && __isset.@sku)
{
if(0 < tmp44++) { tmp43.Append(", "); }
tmp43.Append("Sku: ");
Sku.ToString(tmp43);
}
if((Description != null) && __isset.@description)
{
if(0 < tmp44++) { tmp43.Append(", "); }
tmp43.Append("Description: ");
Description.ToString(tmp43);
}
if(__isset.@qty)
{
if(0 < tmp44++) { tmp43.Append(", "); }
tmp43.Append("Qty: ");
Qty.ToString(tmp43);
}
if((QtyUnit != null) && __isset.qtyUnit)
{
if(0 < tmp44++) { tmp43.Append(", "); }
tmp43.Append("QtyUnit: ");
QtyUnit.ToString(tmp43);
}
if(__isset.unitPrice)
{
if(0 < tmp44++) { tmp43.Append(", "); }
tmp43.Append("UnitPrice: ");
UnitPrice.ToString(tmp43);
}
if(__isset.vatRate)
{
if(0 < tmp44++) { tmp43.Append(", "); }
tmp43.Append("VatRate: ");
VatRate.ToString(tmp43);
}
if(__isset.@discount)
{
if(0 < tmp44++) { tmp43.Append(", "); }
tmp43.Append("Discount: ");
Discount.ToString(tmp43);
}
if((Ext != null) && __isset.@ext)
{
if(0 < tmp44++) { tmp43.Append(", "); }
tmp43.Append("Ext: ");
Ext.ToString(tmp43);
}
tmp43.Append(')');
return tmp43.ToString();
}
}
}
+24
View File
@@ -0,0 +1,24 @@
/**
* <auto-generated>
* Autogenerated by Thrift Compiler (0.19.0)
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* </auto-generated>
*/
#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 enum LineType
{
Product = 0,
Service = 1,
Discount = 2,
Shipping = 3,
}
}
+229
View File
@@ -0,0 +1,229 @@
/**
* <auto-generated>
* Autogenerated by Thrift Compiler (0.19.0)
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* </auto-generated>
*/
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 MetaEntry : TBase
{
private string _key;
private global::Echo.ThriftModel.Variant _value;
public string Key
{
get
{
return _key;
}
set
{
__isset.@key = true;
this._key = value;
}
}
public global::Echo.ThriftModel.Variant Value
{
get
{
return _value;
}
set
{
__isset.@value = true;
this._value = value;
}
}
public Isset __isset;
public struct Isset
{
public bool @key;
public bool @value;
}
public MetaEntry()
{
}
public MetaEntry DeepCopy()
{
var tmp5 = new MetaEntry();
if((Key != null) && __isset.@key)
{
tmp5.Key = this.Key;
}
tmp5.__isset.@key = this.__isset.@key;
if((Value != null) && __isset.@value)
{
tmp5.Value = (global::Echo.ThriftModel.Variant)this.Value.DeepCopy();
}
tmp5.__isset.@value = this.__isset.@value;
return tmp5;
}
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)
{
Key = await iprot.ReadStringAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 2:
if (field.Type == TType.Struct)
{
Value = new global::Echo.ThriftModel.Variant();
await Value.ReadAsync(iprot, 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 tmp6 = new TStruct("MetaEntry");
await oprot.WriteStructBeginAsync(tmp6, cancellationToken);
var tmp7 = new TField();
if((Key != null) && __isset.@key)
{
tmp7.Name = "key";
tmp7.Type = TType.String;
tmp7.ID = 1;
await oprot.WriteFieldBeginAsync(tmp7, cancellationToken);
await oprot.WriteStringAsync(Key, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((Value != null) && __isset.@value)
{
tmp7.Name = "value";
tmp7.Type = TType.Struct;
tmp7.ID = 2;
await oprot.WriteFieldBeginAsync(tmp7, cancellationToken);
await Value.WriteAsync(oprot, 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 MetaEntry other)) return false;
if (ReferenceEquals(this, other)) return true;
return ((__isset.@key == other.__isset.@key) && ((!__isset.@key) || (global::System.Object.Equals(Key, other.Key))))
&& ((__isset.@value == other.__isset.@value) && ((!__isset.@value) || (global::System.Object.Equals(Value, other.Value))));
}
public override int GetHashCode() {
int hashcode = 157;
unchecked {
if((Key != null) && __isset.@key)
{
hashcode = (hashcode * 397) + Key.GetHashCode();
}
if((Value != null) && __isset.@value)
{
hashcode = (hashcode * 397) + Value.GetHashCode();
}
}
return hashcode;
}
public override string ToString()
{
var tmp8 = new StringBuilder("MetaEntry(");
int tmp9 = 0;
if((Key != null) && __isset.@key)
{
if(0 < tmp9++) { tmp8.Append(", "); }
tmp8.Append("Key: ");
Key.ToString(tmp8);
}
if((Value != null) && __isset.@value)
{
if(0 < tmp9++) { tmp8.Append(", "); }
tmp8.Append("Value: ");
Value.ToString(tmp8);
}
tmp8.Append(')');
return tmp8.ToString();
}
}
}
+479
View File
@@ -0,0 +1,479 @@
/**
* <auto-generated>
* Autogenerated by Thrift Compiler (0.19.0)
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* </auto-generated>
*/
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 Party : TBase
{
private long _id;
private string _name;
private string _taxId;
private string _email;
private string _phone;
private global::Echo.ThriftModel.Address _address;
private string _preferredLanguage;
public long Id
{
get
{
return _id;
}
set
{
__isset.@id = true;
this._id = value;
}
}
public string Name
{
get
{
return _name;
}
set
{
__isset.@name = true;
this._name = value;
}
}
public string TaxId
{
get
{
return _taxId;
}
set
{
__isset.taxId = true;
this._taxId = value;
}
}
public string Email
{
get
{
return _email;
}
set
{
__isset.@email = true;
this._email = value;
}
}
public string Phone
{
get
{
return _phone;
}
set
{
__isset.@phone = true;
this._phone = value;
}
}
public global::Echo.ThriftModel.Address Address
{
get
{
return _address;
}
set
{
__isset.@address = true;
this._address = value;
}
}
public string PreferredLanguage
{
get
{
return _preferredLanguage;
}
set
{
__isset.preferredLanguage = true;
this._preferredLanguage = value;
}
}
public Isset __isset;
public struct Isset
{
public bool @id;
public bool @name;
public bool taxId;
public bool @email;
public bool @phone;
public bool @address;
public bool preferredLanguage;
}
public Party()
{
}
public Party DeepCopy()
{
var tmp20 = new Party();
if(__isset.@id)
{
tmp20.Id = this.Id;
}
tmp20.__isset.@id = this.__isset.@id;
if((Name != null) && __isset.@name)
{
tmp20.Name = this.Name;
}
tmp20.__isset.@name = this.__isset.@name;
if((TaxId != null) && __isset.taxId)
{
tmp20.TaxId = this.TaxId;
}
tmp20.__isset.taxId = this.__isset.taxId;
if((Email != null) && __isset.@email)
{
tmp20.Email = this.Email;
}
tmp20.__isset.@email = this.__isset.@email;
if((Phone != null) && __isset.@phone)
{
tmp20.Phone = this.Phone;
}
tmp20.__isset.@phone = this.__isset.@phone;
if((Address != null) && __isset.@address)
{
tmp20.Address = (global::Echo.ThriftModel.Address)this.Address.DeepCopy();
}
tmp20.__isset.@address = this.__isset.@address;
if((PreferredLanguage != null) && __isset.preferredLanguage)
{
tmp20.PreferredLanguage = this.PreferredLanguage;
}
tmp20.__isset.preferredLanguage = this.__isset.preferredLanguage;
return tmp20;
}
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.I64)
{
Id = await iprot.ReadI64Async(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 2:
if (field.Type == TType.String)
{
Name = await iprot.ReadStringAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 3:
if (field.Type == TType.String)
{
TaxId = await iprot.ReadStringAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 4:
if (field.Type == TType.String)
{
Email = await iprot.ReadStringAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 5:
if (field.Type == TType.String)
{
Phone = await iprot.ReadStringAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 6:
if (field.Type == TType.Struct)
{
Address = new global::Echo.ThriftModel.Address();
await Address.ReadAsync(iprot, cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 7:
if (field.Type == TType.String)
{
PreferredLanguage = await iprot.ReadStringAsync(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 tmp21 = new TStruct("Party");
await oprot.WriteStructBeginAsync(tmp21, cancellationToken);
var tmp22 = new TField();
if(__isset.@id)
{
tmp22.Name = "id";
tmp22.Type = TType.I64;
tmp22.ID = 1;
await oprot.WriteFieldBeginAsync(tmp22, cancellationToken);
await oprot.WriteI64Async(Id, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((Name != null) && __isset.@name)
{
tmp22.Name = "name";
tmp22.Type = TType.String;
tmp22.ID = 2;
await oprot.WriteFieldBeginAsync(tmp22, cancellationToken);
await oprot.WriteStringAsync(Name, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((TaxId != null) && __isset.taxId)
{
tmp22.Name = "taxId";
tmp22.Type = TType.String;
tmp22.ID = 3;
await oprot.WriteFieldBeginAsync(tmp22, cancellationToken);
await oprot.WriteStringAsync(TaxId, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((Email != null) && __isset.@email)
{
tmp22.Name = "email";
tmp22.Type = TType.String;
tmp22.ID = 4;
await oprot.WriteFieldBeginAsync(tmp22, cancellationToken);
await oprot.WriteStringAsync(Email, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((Phone != null) && __isset.@phone)
{
tmp22.Name = "phone";
tmp22.Type = TType.String;
tmp22.ID = 5;
await oprot.WriteFieldBeginAsync(tmp22, cancellationToken);
await oprot.WriteStringAsync(Phone, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((Address != null) && __isset.@address)
{
tmp22.Name = "address";
tmp22.Type = TType.Struct;
tmp22.ID = 6;
await oprot.WriteFieldBeginAsync(tmp22, cancellationToken);
await Address.WriteAsync(oprot, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((PreferredLanguage != null) && __isset.preferredLanguage)
{
tmp22.Name = "preferredLanguage";
tmp22.Type = TType.String;
tmp22.ID = 7;
await oprot.WriteFieldBeginAsync(tmp22, cancellationToken);
await oprot.WriteStringAsync(PreferredLanguage, 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 Party other)) return false;
if (ReferenceEquals(this, other)) return true;
return ((__isset.@id == other.__isset.@id) && ((!__isset.@id) || (global::System.Object.Equals(Id, other.Id))))
&& ((__isset.@name == other.__isset.@name) && ((!__isset.@name) || (global::System.Object.Equals(Name, other.Name))))
&& ((__isset.taxId == other.__isset.taxId) && ((!__isset.taxId) || (global::System.Object.Equals(TaxId, other.TaxId))))
&& ((__isset.@email == other.__isset.@email) && ((!__isset.@email) || (global::System.Object.Equals(Email, other.Email))))
&& ((__isset.@phone == other.__isset.@phone) && ((!__isset.@phone) || (global::System.Object.Equals(Phone, other.Phone))))
&& ((__isset.@address == other.__isset.@address) && ((!__isset.@address) || (global::System.Object.Equals(Address, other.Address))))
&& ((__isset.preferredLanguage == other.__isset.preferredLanguage) && ((!__isset.preferredLanguage) || (global::System.Object.Equals(PreferredLanguage, other.PreferredLanguage))));
}
public override int GetHashCode() {
int hashcode = 157;
unchecked {
if(__isset.@id)
{
hashcode = (hashcode * 397) + Id.GetHashCode();
}
if((Name != null) && __isset.@name)
{
hashcode = (hashcode * 397) + Name.GetHashCode();
}
if((TaxId != null) && __isset.taxId)
{
hashcode = (hashcode * 397) + TaxId.GetHashCode();
}
if((Email != null) && __isset.@email)
{
hashcode = (hashcode * 397) + Email.GetHashCode();
}
if((Phone != null) && __isset.@phone)
{
hashcode = (hashcode * 397) + Phone.GetHashCode();
}
if((Address != null) && __isset.@address)
{
hashcode = (hashcode * 397) + Address.GetHashCode();
}
if((PreferredLanguage != null) && __isset.preferredLanguage)
{
hashcode = (hashcode * 397) + PreferredLanguage.GetHashCode();
}
}
return hashcode;
}
public override string ToString()
{
var tmp23 = new StringBuilder("Party(");
int tmp24 = 0;
if(__isset.@id)
{
if(0 < tmp24++) { tmp23.Append(", "); }
tmp23.Append("Id: ");
Id.ToString(tmp23);
}
if((Name != null) && __isset.@name)
{
if(0 < tmp24++) { tmp23.Append(", "); }
tmp23.Append("Name: ");
Name.ToString(tmp23);
}
if((TaxId != null) && __isset.taxId)
{
if(0 < tmp24++) { tmp23.Append(", "); }
tmp23.Append("TaxId: ");
TaxId.ToString(tmp23);
}
if((Email != null) && __isset.@email)
{
if(0 < tmp24++) { tmp23.Append(", "); }
tmp23.Append("Email: ");
Email.ToString(tmp23);
}
if((Phone != null) && __isset.@phone)
{
if(0 < tmp24++) { tmp23.Append(", "); }
tmp23.Append("Phone: ");
Phone.ToString(tmp23);
}
if((Address != null) && __isset.@address)
{
if(0 < tmp24++) { tmp23.Append(", "); }
tmp23.Append("Address: ");
Address.ToString(tmp23);
}
if((PreferredLanguage != null) && __isset.preferredLanguage)
{
if(0 < tmp24++) { tmp23.Append(", "); }
tmp23.Append("PreferredLanguage: ");
PreferredLanguage.ToString(tmp23);
}
tmp23.Append(')');
return tmp23.ToString();
}
}
}
+436
View File
@@ -0,0 +1,436 @@
/**
* <auto-generated>
* Autogenerated by Thrift Compiler (0.19.0)
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* </auto-generated>
*/
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 Payment : TBase
{
private global::Echo.ThriftModel.PaymentMethod _method;
private double _amount;
private string _reference;
private long _timestamp;
private double _fee;
private global::Echo.ThriftModel.Currency _currency;
/// <summary>
///
/// <seealso cref="global::Echo.ThriftModel.PaymentMethod"/>
/// </summary>
public global::Echo.ThriftModel.PaymentMethod Method
{
get
{
return _method;
}
set
{
__isset.@method = true;
this._method = value;
}
}
public double Amount
{
get
{
return _amount;
}
set
{
__isset.@amount = true;
this._amount = value;
}
}
public string Reference
{
get
{
return _reference;
}
set
{
__isset.@reference = true;
this._reference = value;
}
}
public long Timestamp
{
get
{
return _timestamp;
}
set
{
__isset.@timestamp = true;
this._timestamp = value;
}
}
public double Fee
{
get
{
return _fee;
}
set
{
__isset.@fee = true;
this._fee = value;
}
}
/// <summary>
///
/// <seealso cref="global::Echo.ThriftModel.Currency"/>
/// </summary>
public global::Echo.ThriftModel.Currency Currency
{
get
{
return _currency;
}
set
{
__isset.@currency = true;
this._currency = value;
}
}
public Isset __isset;
public struct Isset
{
public bool @method;
public bool @amount;
public bool @reference;
public bool @timestamp;
public bool @fee;
public bool @currency;
}
public Payment()
{
}
public Payment DeepCopy()
{
var tmp45 = new Payment();
if(__isset.@method)
{
tmp45.Method = this.Method;
}
tmp45.__isset.@method = this.__isset.@method;
if(__isset.@amount)
{
tmp45.Amount = this.Amount;
}
tmp45.__isset.@amount = this.__isset.@amount;
if((Reference != null) && __isset.@reference)
{
tmp45.Reference = this.Reference;
}
tmp45.__isset.@reference = this.__isset.@reference;
if(__isset.@timestamp)
{
tmp45.Timestamp = this.Timestamp;
}
tmp45.__isset.@timestamp = this.__isset.@timestamp;
if(__isset.@fee)
{
tmp45.Fee = this.Fee;
}
tmp45.__isset.@fee = this.__isset.@fee;
if(__isset.@currency)
{
tmp45.Currency = this.Currency;
}
tmp45.__isset.@currency = this.__isset.@currency;
return tmp45;
}
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.I32)
{
Method = (global::Echo.ThriftModel.PaymentMethod)await iprot.ReadI32Async(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 2:
if (field.Type == TType.Double)
{
Amount = await iprot.ReadDoubleAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 3:
if (field.Type == TType.String)
{
Reference = await iprot.ReadStringAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 4:
if (field.Type == TType.I64)
{
Timestamp = await iprot.ReadI64Async(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 5:
if (field.Type == TType.Double)
{
Fee = await iprot.ReadDoubleAsync(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;
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 tmp46 = new TStruct("Payment");
await oprot.WriteStructBeginAsync(tmp46, cancellationToken);
var tmp47 = new TField();
if(__isset.@method)
{
tmp47.Name = "method";
tmp47.Type = TType.I32;
tmp47.ID = 1;
await oprot.WriteFieldBeginAsync(tmp47, cancellationToken);
await oprot.WriteI32Async((int)Method, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if(__isset.@amount)
{
tmp47.Name = "amount";
tmp47.Type = TType.Double;
tmp47.ID = 2;
await oprot.WriteFieldBeginAsync(tmp47, cancellationToken);
await oprot.WriteDoubleAsync(Amount, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((Reference != null) && __isset.@reference)
{
tmp47.Name = "reference";
tmp47.Type = TType.String;
tmp47.ID = 3;
await oprot.WriteFieldBeginAsync(tmp47, cancellationToken);
await oprot.WriteStringAsync(Reference, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if(__isset.@timestamp)
{
tmp47.Name = "timestamp";
tmp47.Type = TType.I64;
tmp47.ID = 4;
await oprot.WriteFieldBeginAsync(tmp47, cancellationToken);
await oprot.WriteI64Async(Timestamp, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if(__isset.@fee)
{
tmp47.Name = "fee";
tmp47.Type = TType.Double;
tmp47.ID = 5;
await oprot.WriteFieldBeginAsync(tmp47, cancellationToken);
await oprot.WriteDoubleAsync(Fee, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if(__isset.@currency)
{
tmp47.Name = "currency";
tmp47.Type = TType.I32;
tmp47.ID = 6;
await oprot.WriteFieldBeginAsync(tmp47, cancellationToken);
await oprot.WriteI32Async((int)Currency, 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 Payment other)) return false;
if (ReferenceEquals(this, other)) return true;
return ((__isset.@method == other.__isset.@method) && ((!__isset.@method) || (global::System.Object.Equals(Method, other.Method))))
&& ((__isset.@amount == other.__isset.@amount) && ((!__isset.@amount) || (global::System.Object.Equals(Amount, other.Amount))))
&& ((__isset.@reference == other.__isset.@reference) && ((!__isset.@reference) || (global::System.Object.Equals(Reference, other.Reference))))
&& ((__isset.@timestamp == other.__isset.@timestamp) && ((!__isset.@timestamp) || (global::System.Object.Equals(Timestamp, other.Timestamp))))
&& ((__isset.@fee == other.__isset.@fee) && ((!__isset.@fee) || (global::System.Object.Equals(Fee, other.Fee))))
&& ((__isset.@currency == other.__isset.@currency) && ((!__isset.@currency) || (global::System.Object.Equals(Currency, other.Currency))));
}
public override int GetHashCode() {
int hashcode = 157;
unchecked {
if(__isset.@method)
{
hashcode = (hashcode * 397) + Method.GetHashCode();
}
if(__isset.@amount)
{
hashcode = (hashcode * 397) + Amount.GetHashCode();
}
if((Reference != null) && __isset.@reference)
{
hashcode = (hashcode * 397) + Reference.GetHashCode();
}
if(__isset.@timestamp)
{
hashcode = (hashcode * 397) + Timestamp.GetHashCode();
}
if(__isset.@fee)
{
hashcode = (hashcode * 397) + Fee.GetHashCode();
}
if(__isset.@currency)
{
hashcode = (hashcode * 397) + Currency.GetHashCode();
}
}
return hashcode;
}
public override string ToString()
{
var tmp48 = new StringBuilder("Payment(");
int tmp49 = 0;
if(__isset.@method)
{
if(0 < tmp49++) { tmp48.Append(", "); }
tmp48.Append("Method: ");
Method.ToString(tmp48);
}
if(__isset.@amount)
{
if(0 < tmp49++) { tmp48.Append(", "); }
tmp48.Append("Amount: ");
Amount.ToString(tmp48);
}
if((Reference != null) && __isset.@reference)
{
if(0 < tmp49++) { tmp48.Append(", "); }
tmp48.Append("Reference: ");
Reference.ToString(tmp48);
}
if(__isset.@timestamp)
{
if(0 < tmp49++) { tmp48.Append(", "); }
tmp48.Append("Timestamp: ");
Timestamp.ToString(tmp48);
}
if(__isset.@fee)
{
if(0 < tmp49++) { tmp48.Append(", "); }
tmp48.Append("Fee: ");
Fee.ToString(tmp48);
}
if(__isset.@currency)
{
if(0 < tmp49++) { tmp48.Append(", "); }
tmp48.Append("Currency: ");
Currency.ToString(tmp48);
}
tmp48.Append(')');
return tmp48.ToString();
}
}
}
@@ -0,0 +1,25 @@
/**
* <auto-generated>
* Autogenerated by Thrift Compiler (0.19.0)
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* </auto-generated>
*/
#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 enum PaymentMethod
{
Cash = 0,
Card = 1,
Wire = 2,
Crypto = 3,
Other = 4,
}
}
+582
View File
@@ -0,0 +1,582 @@
/**
* <auto-generated>
* Autogenerated by Thrift Compiler (0.19.0)
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* </auto-generated>
*/
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 Variant : TBase
{
private global::Echo.ThriftModel.Kind _tag;
private bool _boolVal;
private long _i64Val;
private long _u64Val;
private double _f64Val;
private string _strVal;
private byte[] _bytesVal;
private long _dtVal;
private byte[] _guidVal;
/// <summary>
///
/// <seealso cref="global::Echo.ThriftModel.Kind"/>
/// </summary>
public global::Echo.ThriftModel.Kind Tag
{
get
{
return _tag;
}
set
{
__isset.@tag = true;
this._tag = value;
}
}
public bool BoolVal
{
get
{
return _boolVal;
}
set
{
__isset.boolVal = true;
this._boolVal = value;
}
}
public long I64Val
{
get
{
return _i64Val;
}
set
{
__isset.i64Val = true;
this._i64Val = value;
}
}
public long U64Val
{
get
{
return _u64Val;
}
set
{
__isset.u64Val = true;
this._u64Val = value;
}
}
public double F64Val
{
get
{
return _f64Val;
}
set
{
__isset.f64Val = true;
this._f64Val = value;
}
}
public string StrVal
{
get
{
return _strVal;
}
set
{
__isset.strVal = true;
this._strVal = value;
}
}
public byte[] BytesVal
{
get
{
return _bytesVal;
}
set
{
__isset.bytesVal = true;
this._bytesVal = value;
}
}
public long DtVal
{
get
{
return _dtVal;
}
set
{
__isset.dtVal = true;
this._dtVal = value;
}
}
public byte[] GuidVal
{
get
{
return _guidVal;
}
set
{
__isset.guidVal = true;
this._guidVal = value;
}
}
public Isset __isset;
public struct Isset
{
public bool @tag;
public bool boolVal;
public bool i64Val;
public bool u64Val;
public bool f64Val;
public bool strVal;
public bool bytesVal;
public bool dtVal;
public bool guidVal;
}
public Variant()
{
}
public Variant DeepCopy()
{
var tmp0 = new Variant();
if(__isset.@tag)
{
tmp0.Tag = this.Tag;
}
tmp0.__isset.@tag = this.__isset.@tag;
if(__isset.boolVal)
{
tmp0.BoolVal = this.BoolVal;
}
tmp0.__isset.boolVal = this.__isset.boolVal;
if(__isset.i64Val)
{
tmp0.I64Val = this.I64Val;
}
tmp0.__isset.i64Val = this.__isset.i64Val;
if(__isset.u64Val)
{
tmp0.U64Val = this.U64Val;
}
tmp0.__isset.u64Val = this.__isset.u64Val;
if(__isset.f64Val)
{
tmp0.F64Val = this.F64Val;
}
tmp0.__isset.f64Val = this.__isset.f64Val;
if((StrVal != null) && __isset.strVal)
{
tmp0.StrVal = this.StrVal;
}
tmp0.__isset.strVal = this.__isset.strVal;
if((BytesVal != null) && __isset.bytesVal)
{
tmp0.BytesVal = this.BytesVal.ToArray();
}
tmp0.__isset.bytesVal = this.__isset.bytesVal;
if(__isset.dtVal)
{
tmp0.DtVal = this.DtVal;
}
tmp0.__isset.dtVal = this.__isset.dtVal;
if((GuidVal != null) && __isset.guidVal)
{
tmp0.GuidVal = this.GuidVal.ToArray();
}
tmp0.__isset.guidVal = this.__isset.guidVal;
return tmp0;
}
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.I32)
{
Tag = (global::Echo.ThriftModel.Kind)await iprot.ReadI32Async(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 2:
if (field.Type == TType.Bool)
{
BoolVal = await iprot.ReadBoolAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 3:
if (field.Type == TType.I64)
{
I64Val = await iprot.ReadI64Async(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 4:
if (field.Type == TType.I64)
{
U64Val = await iprot.ReadI64Async(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 5:
if (field.Type == TType.Double)
{
F64Val = await iprot.ReadDoubleAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 6:
if (field.Type == TType.String)
{
StrVal = await iprot.ReadStringAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 7:
if (field.Type == TType.String)
{
BytesVal = await iprot.ReadBinaryAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 8:
if (field.Type == TType.I64)
{
DtVal = await iprot.ReadI64Async(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 9:
if (field.Type == TType.String)
{
GuidVal = await iprot.ReadBinaryAsync(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 tmp1 = new TStruct("Variant");
await oprot.WriteStructBeginAsync(tmp1, cancellationToken);
var tmp2 = new TField();
if(__isset.@tag)
{
tmp2.Name = "tag";
tmp2.Type = TType.I32;
tmp2.ID = 1;
await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
await oprot.WriteI32Async((int)Tag, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if(__isset.boolVal)
{
tmp2.Name = "boolVal";
tmp2.Type = TType.Bool;
tmp2.ID = 2;
await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
await oprot.WriteBoolAsync(BoolVal, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if(__isset.i64Val)
{
tmp2.Name = "i64Val";
tmp2.Type = TType.I64;
tmp2.ID = 3;
await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
await oprot.WriteI64Async(I64Val, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if(__isset.u64Val)
{
tmp2.Name = "u64Val";
tmp2.Type = TType.I64;
tmp2.ID = 4;
await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
await oprot.WriteI64Async(U64Val, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if(__isset.f64Val)
{
tmp2.Name = "f64Val";
tmp2.Type = TType.Double;
tmp2.ID = 5;
await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
await oprot.WriteDoubleAsync(F64Val, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((StrVal != null) && __isset.strVal)
{
tmp2.Name = "strVal";
tmp2.Type = TType.String;
tmp2.ID = 6;
await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
await oprot.WriteStringAsync(StrVal, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((BytesVal != null) && __isset.bytesVal)
{
tmp2.Name = "bytesVal";
tmp2.Type = TType.String;
tmp2.ID = 7;
await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
await oprot.WriteBinaryAsync(BytesVal, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if(__isset.dtVal)
{
tmp2.Name = "dtVal";
tmp2.Type = TType.I64;
tmp2.ID = 8;
await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
await oprot.WriteI64Async(DtVal, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((GuidVal != null) && __isset.guidVal)
{
tmp2.Name = "guidVal";
tmp2.Type = TType.String;
tmp2.ID = 9;
await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
await oprot.WriteBinaryAsync(GuidVal, 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 Variant other)) return false;
if (ReferenceEquals(this, other)) return true;
return ((__isset.@tag == other.__isset.@tag) && ((!__isset.@tag) || (global::System.Object.Equals(Tag, other.Tag))))
&& ((__isset.boolVal == other.__isset.boolVal) && ((!__isset.boolVal) || (global::System.Object.Equals(BoolVal, other.BoolVal))))
&& ((__isset.i64Val == other.__isset.i64Val) && ((!__isset.i64Val) || (global::System.Object.Equals(I64Val, other.I64Val))))
&& ((__isset.u64Val == other.__isset.u64Val) && ((!__isset.u64Val) || (global::System.Object.Equals(U64Val, other.U64Val))))
&& ((__isset.f64Val == other.__isset.f64Val) && ((!__isset.f64Val) || (global::System.Object.Equals(F64Val, other.F64Val))))
&& ((__isset.strVal == other.__isset.strVal) && ((!__isset.strVal) || (global::System.Object.Equals(StrVal, other.StrVal))))
&& ((__isset.bytesVal == other.__isset.bytesVal) && ((!__isset.bytesVal) || (TCollections.Equals(BytesVal, other.BytesVal))))
&& ((__isset.dtVal == other.__isset.dtVal) && ((!__isset.dtVal) || (global::System.Object.Equals(DtVal, other.DtVal))))
&& ((__isset.guidVal == other.__isset.guidVal) && ((!__isset.guidVal) || (TCollections.Equals(GuidVal, other.GuidVal))));
}
public override int GetHashCode() {
int hashcode = 157;
unchecked {
if(__isset.@tag)
{
hashcode = (hashcode * 397) + Tag.GetHashCode();
}
if(__isset.boolVal)
{
hashcode = (hashcode * 397) + BoolVal.GetHashCode();
}
if(__isset.i64Val)
{
hashcode = (hashcode * 397) + I64Val.GetHashCode();
}
if(__isset.u64Val)
{
hashcode = (hashcode * 397) + U64Val.GetHashCode();
}
if(__isset.f64Val)
{
hashcode = (hashcode * 397) + F64Val.GetHashCode();
}
if((StrVal != null) && __isset.strVal)
{
hashcode = (hashcode * 397) + StrVal.GetHashCode();
}
if((BytesVal != null) && __isset.bytesVal)
{
hashcode = (hashcode * 397) + BytesVal.GetHashCode();
}
if(__isset.dtVal)
{
hashcode = (hashcode * 397) + DtVal.GetHashCode();
}
if((GuidVal != null) && __isset.guidVal)
{
hashcode = (hashcode * 397) + GuidVal.GetHashCode();
}
}
return hashcode;
}
public override string ToString()
{
var tmp3 = new StringBuilder("Variant(");
int tmp4 = 0;
if(__isset.@tag)
{
if(0 < tmp4++) { tmp3.Append(", "); }
tmp3.Append("Tag: ");
Tag.ToString(tmp3);
}
if(__isset.boolVal)
{
if(0 < tmp4++) { tmp3.Append(", "); }
tmp3.Append("BoolVal: ");
BoolVal.ToString(tmp3);
}
if(__isset.i64Val)
{
if(0 < tmp4++) { tmp3.Append(", "); }
tmp3.Append("I64Val: ");
I64Val.ToString(tmp3);
}
if(__isset.u64Val)
{
if(0 < tmp4++) { tmp3.Append(", "); }
tmp3.Append("U64Val: ");
U64Val.ToString(tmp3);
}
if(__isset.f64Val)
{
if(0 < tmp4++) { tmp3.Append(", "); }
tmp3.Append("F64Val: ");
F64Val.ToString(tmp3);
}
if((StrVal != null) && __isset.strVal)
{
if(0 < tmp4++) { tmp3.Append(", "); }
tmp3.Append("StrVal: ");
StrVal.ToString(tmp3);
}
if((BytesVal != null) && __isset.bytesVal)
{
if(0 < tmp4++) { tmp3.Append(", "); }
tmp3.Append("BytesVal: ");
BytesVal.ToString(tmp3);
}
if(__isset.dtVal)
{
if(0 < tmp4++) { tmp3.Append(", "); }
tmp3.Append("DtVal: ");
DtVal.ToString(tmp3);
}
if((GuidVal != null) && __isset.guidVal)
{
if(0 < tmp4++) { tmp3.Append(", "); }
tmp3.Append("GuidVal: ");
GuidVal.ToString(tmp3);
}
tmp3.Append(')');
return tmp3.ToString();
}
}
}
@@ -0,0 +1,276 @@
/**
* <auto-generated>
* Autogenerated by Thrift Compiler (0.19.0)
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* </auto-generated>
*/
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;
#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 static class echoExtensions
{
public static bool Equals(this Dictionary<string, global::Echo.ThriftModel.BusinessDocument> instance, object that)
{
if (!(that is Dictionary<string, global::Echo.ThriftModel.BusinessDocument> other)) return false;
if (ReferenceEquals(instance, other)) return true;
return TCollections.Equals(instance, other);
}
public static int GetHashCode(this Dictionary<string, global::Echo.ThriftModel.BusinessDocument> instance)
{
return TCollections.GetHashCode(instance);
}
public static Dictionary<string, global::Echo.ThriftModel.BusinessDocument> DeepCopy(this Dictionary<string, global::Echo.ThriftModel.BusinessDocument> source)
{
if (source == null)
return null;
var tmp232 = new Dictionary<string, global::Echo.ThriftModel.BusinessDocument>(source.Count);
foreach (var pair in source)
tmp232.Add((pair.Key != null) ? pair.Key : null, (pair.Value != null) ? pair.Value.DeepCopy() : null);
return tmp232;
}
public static bool Equals(this Dictionary<string, global::Echo.ThriftModel.Variant> instance, object that)
{
if (!(that is Dictionary<string, global::Echo.ThriftModel.Variant> other)) return false;
if (ReferenceEquals(instance, other)) return true;
return TCollections.Equals(instance, other);
}
public static int GetHashCode(this Dictionary<string, global::Echo.ThriftModel.Variant> instance)
{
return TCollections.GetHashCode(instance);
}
public static Dictionary<string, global::Echo.ThriftModel.Variant> DeepCopy(this Dictionary<string, global::Echo.ThriftModel.Variant> source)
{
if (source == null)
return null;
var tmp233 = new Dictionary<string, global::Echo.ThriftModel.Variant>(source.Count);
foreach (var pair in source)
tmp233.Add((pair.Key != null) ? pair.Key : null, (pair.Value != null) ? pair.Value.DeepCopy() : null);
return tmp233;
}
public static bool Equals(this List<global::Echo.ThriftModel.Attachment> instance, object that)
{
if (!(that is List<global::Echo.ThriftModel.Attachment> other)) return false;
if (ReferenceEquals(instance, other)) return true;
return TCollections.Equals(instance, other);
}
public static int GetHashCode(this List<global::Echo.ThriftModel.Attachment> instance)
{
return TCollections.GetHashCode(instance);
}
public static List<global::Echo.ThriftModel.Attachment> DeepCopy(this List<global::Echo.ThriftModel.Attachment> source)
{
if (source == null)
return null;
var tmp234 = new List<global::Echo.ThriftModel.Attachment>(source.Count);
foreach (var elem in source)
tmp234.Add((elem != null) ? elem.DeepCopy() : null);
return tmp234;
}
public static bool Equals(this List<global::Echo.ThriftModel.BusinessDocument> instance, object that)
{
if (!(that is List<global::Echo.ThriftModel.BusinessDocument> other)) return false;
if (ReferenceEquals(instance, other)) return true;
return TCollections.Equals(instance, other);
}
public static int GetHashCode(this List<global::Echo.ThriftModel.BusinessDocument> instance)
{
return TCollections.GetHashCode(instance);
}
public static List<global::Echo.ThriftModel.BusinessDocument> DeepCopy(this List<global::Echo.ThriftModel.BusinessDocument> source)
{
if (source == null)
return null;
var tmp235 = new List<global::Echo.ThriftModel.BusinessDocument>(source.Count);
foreach (var elem in source)
tmp235.Add((elem != null) ? elem.DeepCopy() : null);
return tmp235;
}
public static bool Equals(this List<global::Echo.ThriftModel.DocType> instance, object that)
{
if (!(that is List<global::Echo.ThriftModel.DocType> other)) return false;
if (ReferenceEquals(instance, other)) return true;
return TCollections.Equals(instance, other);
}
public static int GetHashCode(this List<global::Echo.ThriftModel.DocType> instance)
{
return TCollections.GetHashCode(instance);
}
public static List<global::Echo.ThriftModel.DocType> DeepCopy(this List<global::Echo.ThriftModel.DocType> source)
{
if (source == null)
return null;
var tmp236 = new List<global::Echo.ThriftModel.DocType>(source.Count);
foreach (var elem in source)
tmp236.Add(elem);
return tmp236;
}
public static bool Equals(this List<global::Echo.ThriftModel.LineItem> instance, object that)
{
if (!(that is List<global::Echo.ThriftModel.LineItem> other)) return false;
if (ReferenceEquals(instance, other)) return true;
return TCollections.Equals(instance, other);
}
public static int GetHashCode(this List<global::Echo.ThriftModel.LineItem> instance)
{
return TCollections.GetHashCode(instance);
}
public static List<global::Echo.ThriftModel.LineItem> DeepCopy(this List<global::Echo.ThriftModel.LineItem> source)
{
if (source == null)
return null;
var tmp237 = new List<global::Echo.ThriftModel.LineItem>(source.Count);
foreach (var elem in source)
tmp237.Add((elem != null) ? elem.DeepCopy() : null);
return tmp237;
}
public static bool Equals(this List<global::Echo.ThriftModel.Payment> instance, object that)
{
if (!(that is List<global::Echo.ThriftModel.Payment> other)) return false;
if (ReferenceEquals(instance, other)) return true;
return TCollections.Equals(instance, other);
}
public static int GetHashCode(this List<global::Echo.ThriftModel.Payment> instance)
{
return TCollections.GetHashCode(instance);
}
public static List<global::Echo.ThriftModel.Payment> DeepCopy(this List<global::Echo.ThriftModel.Payment> source)
{
if (source == null)
return null;
var tmp238 = new List<global::Echo.ThriftModel.Payment>(source.Count);
foreach (var elem in source)
tmp238.Add((elem != null) ? elem.DeepCopy() : null);
return tmp238;
}
public static bool Equals(this List<int> instance, object that)
{
if (!(that is List<int> other)) return false;
if (ReferenceEquals(instance, other)) return true;
return TCollections.Equals(instance, other);
}
public static int GetHashCode(this List<int> instance)
{
return TCollections.GetHashCode(instance);
}
public static List<int> DeepCopy(this List<int> source)
{
if (source == null)
return null;
var tmp239 = new List<int>(source.Count);
foreach (var elem in source)
tmp239.Add(elem);
return tmp239;
}
public static bool Equals(this List<string> instance, object that)
{
if (!(that is List<string> other)) return false;
if (ReferenceEquals(instance, other)) return true;
return TCollections.Equals(instance, other);
}
public static int GetHashCode(this List<string> instance)
{
return TCollections.GetHashCode(instance);
}
public static List<string> DeepCopy(this List<string> source)
{
if (source == null)
return null;
var tmp240 = new List<string>(source.Count);
foreach (var elem in source)
tmp240.Add((elem != null) ? elem : null);
return tmp240;
}
}
}
+244
View File
@@ -0,0 +1,244 @@
syntax = "proto3";
package gpmodel;
option csharp_namespace = "Echo.Model.Grpc";
// ========================= Enums =========================
enum Currency {
CURRENCY_IQD = 0;
CURRENCY_CNH = 1;
CURRENCY_USD = 2;
CURRENCY_EUR = 3;
CURRENCY_JPY = 4;
CURRENCY_GBP = 5;
}
enum DocType {
DOC_TYPE_QUOTE = 0;
DOC_TYPE_ORDER = 1;
DOC_TYPE_INVOICE = 2;
DOC_TYPE_CREDIT_NOTE = 3;
}
enum PaymentMethod {
PAYMENT_METHOD_CASH = 0;
PAYMENT_METHOD_CARD = 1;
PAYMENT_METHOD_WIRE = 2;
PAYMENT_METHOD_CRYPTO = 3;
PAYMENT_METHOD_OTHER = 4;
}
enum LineType {
LINE_TYPE_PRODUCT = 0;
LINE_TYPE_SERVICE = 1;
LINE_TYPE_DISCOUNT = 2;
LINE_TYPE_SHIPPING = 3;
}
// Variant.Kind
enum Kind {
KIND_NULL = 0;
KIND_BOOL = 1;
KIND_INT64 = 2;
KIND_UINT64 = 3;
KIND_DOUBLE = 4;
KIND_DECIMAL = 5;
KIND_STRING = 6;
KIND_BYTES = 7;
KIND_DATETIME = 8;
KIND_GUID = 9;
}
// ========================= Variant =========================
//
// C# Variant:
// Tag: Kind
// Bool: bool?
// I64: long?
// U64: ulong?
// F64: double?
// Str: string?
// Bytes: byte[]?
// Dt: DateTime? -> int64 (ticks or epoch millis)
// Guid: byte[]?
message Variant {
Kind tag = 1;
bool bool_val = 2; // optional in C#
int64 i64_val = 3; // optional in C#
uint64 u64_val = 4; // optional in C#
double f64_val = 5; // optional in C#
string str_val = 6; // optional in C#
bytes bytes_val = 7; // optional in C#
int64 dt_val = 8; // optional in C# (DateTime)
bytes guid_val = 9; // optional in C# (Guid as 16-byte array)
}
// Optional helpers mirroring MetaEntry / ExtEntry (not required for RPC)
message MetaEntry {
string key = 1;
Variant value = 2;
}
message ExtEntry {
string key = 1;
Variant value = 2;
}
// ========================= Address & Party =========================
message Address {
string line1 = 1;
optional string line2 = 2; // optional in C#
string city = 3;
string region = 4;
string country = 5;
optional string postal_code = 6; // optional in C#
}
message Party {
uint64 id = 1;
string name = 2;
string tax_id = 3; // optional in C#
string email = 4; // optional in C#
string phone = 5; // optional in C#
Address address = 6; // optional in C#
string preferred_language = 7; // optional in C#
}
// ========================= DocumentHeader =========================
//
// DateTime/DateTime? -> int64 (ticks or epoch millis, your choice)
message DocumentHeader {
bytes doc_id = 1;
DocType type = 2;
int32 version = 3;
int64 created_at = 4; // DateTime
optional int64 updated_at = 5; // optional in C#
Currency currency = 6;
string notes = 7; // optional in C#
map<string, Variant> meta = 8;
}
// ========================= LineItem, Payment, Attachment =========================
message LineItem {
int32 line_no = 1;
LineType type = 2;
string sku = 3;
string description = 4;
double qty = 5;
string qty_unit = 6;
double unit_price = 7;
optional double vat_rate = 8; // optional in C#
optional double discount = 9; // optional in C#
map<string, Variant> ext = 10;
}
message Payment {
PaymentMethod method = 1;
double amount = 2;
string reference = 3; // optional in C#
int64 timestamp = 4; // DateTime
double fee = 5; // optional in C#
Currency currency = 6;
}
message Attachment {
string name = 1;
string mime_type = 2;
bytes data = 3;
}
// ========================= Top-level BusinessDocument =========================
message BusinessDocument {
DocumentHeader header = 1;
Party seller = 2;
Party buyer = 3;
repeated LineItem items = 4;
repeated Payment payments = 5;
repeated Attachment attachments = 6;
repeated int32 risk_scores = 7;
}
// ========================= Echo Service Messages =========================
//
// C# signatures:
//
// byte[] EchoBytes(byte[])
// BusinessDocument[] EchoDocuments(BusinessDocument[] docs)
// int[] EchoIntArray(int[] array)
// string[] EchoStringArray(string[] array)
// Map<string, BusinessDocument> EchoMap(Map<string, BusinessDocument> map)
// DocType EchoEnumArray(DocType[] docTypes);
// --- Bytes ---
message BytesRequest {
bytes data = 1;
}
// --- Bytes ---
message BytesResponse {
bytes data = 1;
}
// --- Documents ---
message DocumentsRequest {
repeated BusinessDocument docs = 1;
}
message DocumentsResponse {
repeated BusinessDocument docs = 1;
}
// --- Int array ---
message IntArrayRequest {
repeated int32 array = 1;
}
message IntArrayResponse {
repeated int32 array = 1;
}
// --- String array ---
message StringArrayRequest {
repeated string array = 1;
}
message StringArrayResponse {
repeated string array = 1;
}
// --- Map<string, BusinessDocument> ---
message DocMapRequest {
map<string, BusinessDocument> map = 1;
}
message DocMapResponse {
map<string, BusinessDocument> map = 1;
}
// --- Enum array (returns a single DocType, e.g. last element) ---
message EnumArrayRequest {
repeated DocType doc_types = 1;
}
message EnumResponse {
repeated DocType doc_types = 1;
}
// ========================= Echo Service =========================
service EchoService {
rpc EchoBytes (BytesRequest) returns (BytesResponse);
rpc EchoDocuments (DocumentsRequest) returns (DocumentsResponse);
rpc EchoIntArray (IntArrayRequest) returns (IntArrayResponse);
rpc EchoStringArray (StringArrayRequest) returns (StringArrayResponse);
rpc EchoMap (DocMapRequest) returns (DocMapResponse);
rpc EchoEnumArray (EnumArrayRequest) returns (EnumResponse);
}