From 06f1d78e1a541b50fa71429e2979e639c03c9dfb Mon Sep 17 00:00:00 2001 From: "makarov.d" Date: Thu, 10 Jul 2025 17:50:22 +0500 Subject: [PATCH 1/2] ddcore-10433: add new method GetPartnerEvents --- proto/PartnerEvents/PartnerEventsApi.proto | 30 +++++ src/ComDocflowApi.cs | 6 + src/DiadocHttpApi.Docflow.cs | 7 + src/DiadocHttpApi.DocflowAsync.cs | 7 + src/DocflowApi.Async.cs | 6 + src/DocflowApi.cs | 6 + src/IComDocflowApi.cs | 2 + src/IDocflowApi.cs | 3 + .../PartnerEvents/PartnerEventsApi.proto.cs | 121 ++++++++++++++++++ 9 files changed, 188 insertions(+) create mode 100644 proto/PartnerEvents/PartnerEventsApi.proto create mode 100644 src/Proto/PartnerEvents/PartnerEventsApi.proto.cs diff --git a/proto/PartnerEvents/PartnerEventsApi.proto b/proto/PartnerEvents/PartnerEventsApi.proto new file mode 100644 index 00000000..9297757e --- /dev/null +++ b/proto/PartnerEvents/PartnerEventsApi.proto @@ -0,0 +1,30 @@ +//partner events api + +import "Timestamp.proto"; +import "DocumentId.proto"; +import "TotalCountType.proto"; +import "Docflow/DocumentWithDocflowV4.proto"; + +package Diadoc.Api.Proto.PartnerEvents; + +message GetPartnerEventsRequest +{ + required string Cursor = 1; + repeated string Directions = 2; + repeated string MessageTypes = 3; + optional int32 Limit = 4 [default = 100]; +} + +message GetPartnerEventsResponse +{ + repeated PartnerEvent Events = 1; + required string LastCursor = 2; +} + +message PartnerEvent +{ + required string EventId = 1; + required Timestamp Timestamp = 2; + required DocumentId DocumentId = 3; + optional Docflow.DocumentWithDocflowV4 Document = 4; +} \ No newline at end of file diff --git a/src/ComDocflowApi.cs b/src/ComDocflowApi.cs index fa035cd6..dcf28ff7 100644 --- a/src/ComDocflowApi.cs +++ b/src/ComDocflowApi.cs @@ -1,5 +1,6 @@ using System.Runtime.InteropServices; using Diadoc.Api.Proto.Docflow; +using Diadoc.Api.Proto.PartnerEvents; namespace Diadoc.Api { @@ -56,5 +57,10 @@ public GetDocflowsByPacketIdResponseV4 GetDocflowsByPacketIdV4(string authToken, { return docflowApi.GetDocflowsByPacketIdV4(authToken, boxId, (GetDocflowsByPacketIdRequest) request); } + + public GetPartnerEventsResponse GetPartnerEvents(string authToken, object request) + { + return docflowApi.GetPartnerEventsV4(authToken, (GetPartnerEventsRequest) request); + } } } diff --git a/src/DiadocHttpApi.Docflow.cs b/src/DiadocHttpApi.Docflow.cs index 9459c8c5..8dac29fd 100644 --- a/src/DiadocHttpApi.Docflow.cs +++ b/src/DiadocHttpApi.Docflow.cs @@ -1,4 +1,5 @@ using Diadoc.Api.Proto.Docflow; +using Diadoc.Api.Proto.PartnerEvents; using JetBrains.Annotations; namespace Diadoc.Api @@ -97,6 +98,12 @@ public GetDocflowsByPacketIdResponseV4 GetDocflowsByPacketIdV4([NotNull] string var queryString = BuildQueryStringWithBoxId("/V4/GetDocflowsByPacketId", boxId); return diadocHttpApi.PerformHttpRequest(authToken, queryString, request); } + + [NotNull] + public GetPartnerEventsResponse GetPartnerEventsV4([NotNull] string authToken, [NotNull] GetPartnerEventsRequest request) + { + return diadocHttpApi.PerformHttpRequest(authToken, "/GetPartnerEvents", request); + } } } } diff --git a/src/DiadocHttpApi.DocflowAsync.cs b/src/DiadocHttpApi.DocflowAsync.cs index 30681fb3..a9059fa9 100644 --- a/src/DiadocHttpApi.DocflowAsync.cs +++ b/src/DiadocHttpApi.DocflowAsync.cs @@ -1,5 +1,6 @@ using System.Threading.Tasks; using Diadoc.Api.Proto.Docflow; +using Diadoc.Api.Proto.PartnerEvents; using JetBrains.Annotations; namespace Diadoc.Api @@ -91,6 +92,12 @@ public Task GetDocflowsByPacketIdV4Async([NotNu var queryString = BuildQueryStringWithBoxId("/V4/GetDocflowsByPacketId", boxId); return diadocHttpApi.PerformHttpRequestAsync(authToken, queryString, request); } + + [ItemNotNull] + public Task GetPartnerEventsV4Async([NotNull] string authToken, [NotNull]GetPartnerEventsRequest request) + { + return diadocHttpApi.PerformHttpRequestAsync(authToken, "/GetPartnerEvents", request); + } } } } diff --git a/src/DocflowApi.Async.cs b/src/DocflowApi.Async.cs index 375848f0..3a34fb91 100644 --- a/src/DocflowApi.Async.cs +++ b/src/DocflowApi.Async.cs @@ -1,6 +1,7 @@ using System; using System.Threading.Tasks; using Diadoc.Api.Proto.Docflow; +using Diadoc.Api.Proto.PartnerEvents; namespace Diadoc.Api { @@ -53,5 +54,10 @@ public Task GetDocflowsByPacketIdV4Async(string if (string.IsNullOrEmpty(boxId)) throw new ArgumentNullException("boxId"); return docflowHttpApi.GetDocflowsByPacketIdV4Async(authToken, boxId, request); } + + public Task GetPartnerEventsV4Async(string authToken, GetPartnerEventsRequest request) + { + return docflowHttpApi.GetPartnerEventsV4Async(authToken, request); + } } } diff --git a/src/DocflowApi.cs b/src/DocflowApi.cs index acbdb530..b0fbff1e 100644 --- a/src/DocflowApi.cs +++ b/src/DocflowApi.cs @@ -1,5 +1,6 @@ using System; using Diadoc.Api.Proto.Docflow; +using Diadoc.Api.Proto.PartnerEvents; namespace Diadoc.Api { @@ -60,5 +61,10 @@ public GetDocflowsByPacketIdResponseV4 GetDocflowsByPacketIdV4(string authToken, if (string.IsNullOrEmpty(boxId)) throw new ArgumentNullException("boxId"); return docflowHttpApi.GetDocflowsByPacketIdV4(authToken, boxId, request); } + + public GetPartnerEventsResponse GetPartnerEventsV4(string authToken, GetPartnerEventsRequest request) + { + return docflowHttpApi.GetPartnerEventsV4(authToken, request); + } } } diff --git a/src/IComDocflowApi.cs b/src/IComDocflowApi.cs index 1dbe6d68..fb0b28a9 100644 --- a/src/IComDocflowApi.cs +++ b/src/IComDocflowApi.cs @@ -1,5 +1,6 @@ using System.Runtime.InteropServices; using Diadoc.Api.Proto.Docflow; +using Diadoc.Api.Proto.PartnerEvents; namespace Diadoc.Api { @@ -15,5 +16,6 @@ public interface IComDocflowApi GetDocflowEventsResponseV4 GetDocflowEventsV4(string authToken, string boxId, [MarshalAs(UnmanagedType.IDispatch)] object request); SearchDocflowsResponseV4 SearchDocflowsV4(string authToken, string boxId, [MarshalAs(UnmanagedType.IDispatch)] object request); GetDocflowsByPacketIdResponseV4 GetDocflowsByPacketIdV4(string authToken, string boxId, [MarshalAs(UnmanagedType.IDispatch)] object request); + GetPartnerEventsResponse GetPartnerEvents(string authToken, [MarshalAs(UnmanagedType.IDispatch)] object request); } } diff --git a/src/IDocflowApi.cs b/src/IDocflowApi.cs index 202b60b6..ce03e700 100644 --- a/src/IDocflowApi.cs +++ b/src/IDocflowApi.cs @@ -1,5 +1,6 @@ using System; using Diadoc.Api.Proto.Docflow; +using Diadoc.Api.Proto.PartnerEvents; #if !NET35 using System.Threading.Tasks; @@ -21,6 +22,7 @@ public interface IDocflowApi GetDocflowEventsResponseV4 GetDocflowEventsV4(string authToken, string boxId, GetDocflowEventsRequest request); SearchDocflowsResponseV4 SearchDocflowsV4(string authToken, string boxId, SearchDocflowsRequest request); GetDocflowsByPacketIdResponseV4 GetDocflowsByPacketIdV4(string authToken, string boxId, GetDocflowsByPacketIdRequest request); + GetPartnerEventsResponse GetPartnerEventsV4(string authToken, GetPartnerEventsRequest request); #if !NET35 [Obsolete("Use GetDocflowsV4Async()")] @@ -35,6 +37,7 @@ public interface IDocflowApi Task GetDocflowEventsV4Async(string authToken, string boxId, GetDocflowEventsRequest request); Task SearchDocflowsV4Async(string authToken, string boxId, SearchDocflowsRequest request); Task GetDocflowsByPacketIdV4Async(string authToken, string boxId, GetDocflowsByPacketIdRequest request); + Task GetPartnerEventsV4Async(string authToken, GetPartnerEventsRequest request); #endif } } diff --git a/src/Proto/PartnerEvents/PartnerEventsApi.proto.cs b/src/Proto/PartnerEvents/PartnerEventsApi.proto.cs new file mode 100644 index 00000000..fda696da --- /dev/null +++ b/src/Proto/PartnerEvents/PartnerEventsApi.proto.cs @@ -0,0 +1,121 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +// Generated from: PartnerEvents/PartnerEventsApi.proto +// Note: requires additional types generated from: Timestamp.proto +// Note: requires additional types generated from: DocumentId.proto +// Note: requires additional types generated from: TotalCountType.proto +// Note: requires additional types generated from: Docflow/DocumentWithDocflowV4.proto +namespace Diadoc.Api.Proto.PartnerEvents +{ + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"GetPartnerEventsRequest")] + public partial class GetPartnerEventsRequest : global::ProtoBuf.IExtensible + { + public GetPartnerEventsRequest() {} + + private string _Cursor; + [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"Cursor", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string Cursor + { + get { return _Cursor; } + set { _Cursor = value; } + } + private readonly global::System.Collections.Generic.List _Directions = new global::System.Collections.Generic.List(); + [global::ProtoBuf.ProtoMember(2, Name=@"Directions", DataFormat = global::ProtoBuf.DataFormat.Default)] + public global::System.Collections.Generic.List Directions + { + get { return _Directions; } + } + + private readonly global::System.Collections.Generic.List _MessageTypes = new global::System.Collections.Generic.List(); + [global::ProtoBuf.ProtoMember(3, Name=@"MessageTypes", DataFormat = global::ProtoBuf.DataFormat.Default)] + public global::System.Collections.Generic.List MessageTypes + { + get { return _MessageTypes; } + } + + + private int _Limit = (int)100; + [global::ProtoBuf.ProtoMember(4, IsRequired = false, Name=@"Limit", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)] + [global::System.ComponentModel.DefaultValue((int)100)] + public int Limit + { + get { return _Limit; } + set { _Limit = value; } + } + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"GetPartnerEventsResponse")] + public partial class GetPartnerEventsResponse : global::ProtoBuf.IExtensible + { + public GetPartnerEventsResponse() {} + + private readonly global::System.Collections.Generic.List _Events = new global::System.Collections.Generic.List(); + [global::ProtoBuf.ProtoMember(1, Name=@"Events", DataFormat = global::ProtoBuf.DataFormat.Default)] + public global::System.Collections.Generic.List Events + { + get { return _Events; } + } + + private string _LastCursor; + [global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"LastCursor", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string LastCursor + { + get { return _LastCursor; } + set { _LastCursor = value; } + } + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"PartnerEvent")] + public partial class PartnerEvent : global::ProtoBuf.IExtensible + { + public PartnerEvent() {} + + private string _EventId; + [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"EventId", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string EventId + { + get { return _EventId; } + set { _EventId = value; } + } + private Diadoc.Api.Proto.Timestamp _Timestamp; + [global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"Timestamp", DataFormat = global::ProtoBuf.DataFormat.Default)] + public Diadoc.Api.Proto.Timestamp Timestamp + { + get { return _Timestamp; } + set { _Timestamp = value; } + } + private Diadoc.Api.Proto.DocumentId _DocumentId; + [global::ProtoBuf.ProtoMember(3, IsRequired = true, Name=@"DocumentId", DataFormat = global::ProtoBuf.DataFormat.Default)] + public Diadoc.Api.Proto.DocumentId DocumentId + { + get { return _DocumentId; } + set { _DocumentId = value; } + } + + private Diadoc.Api.Proto.Docflow.DocumentWithDocflowV4 _Document = null; + [global::ProtoBuf.ProtoMember(4, IsRequired = false, Name=@"Document", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(null)] + public Diadoc.Api.Proto.Docflow.DocumentWithDocflowV4 Document + { + get { return _Document; } + set { _Document = value; } + } + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + +} From cd7096ac0fa28dff5ad050a1dcff8af1e5124751 Mon Sep 17 00:00:00 2001 From: "makarov.d" Date: Wed, 16 Jul 2025 19:57:53 +0500 Subject: [PATCH 2/2] =?UTF-8?q?=D0=B2=20GetPartnerEventsRequest=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BB=D0=B5=20Directions=20=D0=B7=D0=B0=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=B5=D0=BD=D0=BE=20=D0=BD=D0=B0=20DocumentDirections=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20=D0=BE=D0=B4=D0=BD=D0=BE=D1=80=D0=BE=D0=B4?= =?UTF-8?q?=D0=BD=D0=BE=D1=81=D1=82=D0=B8=20=D1=81=20GetDocflowEventsReque?= =?UTF-8?q?st?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proto/PartnerEvents/PartnerEventsApi.proto | 2 +- src/Proto/PartnerEvents/PartnerEventsApi.proto.cs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/proto/PartnerEvents/PartnerEventsApi.proto b/proto/PartnerEvents/PartnerEventsApi.proto index 9297757e..8bb8b6fc 100644 --- a/proto/PartnerEvents/PartnerEventsApi.proto +++ b/proto/PartnerEvents/PartnerEventsApi.proto @@ -10,7 +10,7 @@ package Diadoc.Api.Proto.PartnerEvents; message GetPartnerEventsRequest { required string Cursor = 1; - repeated string Directions = 2; + repeated string DocumentDirections = 2; repeated string MessageTypes = 3; optional int32 Limit = 4 [default = 100]; } diff --git a/src/Proto/PartnerEvents/PartnerEventsApi.proto.cs b/src/Proto/PartnerEvents/PartnerEventsApi.proto.cs index fda696da..0fc35948 100644 --- a/src/Proto/PartnerEvents/PartnerEventsApi.proto.cs +++ b/src/Proto/PartnerEvents/PartnerEventsApi.proto.cs @@ -26,11 +26,11 @@ public string Cursor get { return _Cursor; } set { _Cursor = value; } } - private readonly global::System.Collections.Generic.List _Directions = new global::System.Collections.Generic.List(); - [global::ProtoBuf.ProtoMember(2, Name=@"Directions", DataFormat = global::ProtoBuf.DataFormat.Default)] - public global::System.Collections.Generic.List Directions + private readonly global::System.Collections.Generic.List _DocumentDirections = new global::System.Collections.Generic.List(); + [global::ProtoBuf.ProtoMember(2, Name=@"DocumentDirections", DataFormat = global::ProtoBuf.DataFormat.Default)] + public global::System.Collections.Generic.List DocumentDirections { - get { return _Directions; } + get { return _DocumentDirections; } } private readonly global::System.Collections.Generic.List _MessageTypes = new global::System.Collections.Generic.List(); @@ -118,4 +118,4 @@ public Diadoc.Api.Proto.Docflow.DocumentWithDocflowV4 Document { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } } -} +} \ No newline at end of file