From f9b30ab7a76bcc024247e7f31beaa16d63a1a23b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20Jedlicska?= Date: Mon, 17 Jun 2024 12:11:05 +0200 Subject: [PATCH] feat(core): add objects api v2 --- All.sln | 19 ++++++ Core/Core/Transports/ServerUtils/ServerAPI.cs | 11 +++- Core/Tests/SendReceive/Program.cs | 64 +++++++++++++++++++ Core/Tests/SendReceive/SendReceive.csproj | 15 +++++ SDK.slnf | 3 +- 5 files changed, 108 insertions(+), 4 deletions(-) create mode 100644 Core/Tests/SendReceive/Program.cs create mode 100644 Core/Tests/SendReceive/SendReceive.csproj diff --git a/All.sln b/All.sln index df383c2f22..abe62fd76d 100644 --- a/All.sln +++ b/All.sln @@ -469,6 +469,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConnectorCivil2025", "Conne EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConverterCivil2025", "Objects\Converters\ConverterAutocadCivil\ConverterCivil2025\ConverterCivil2025.csproj", "{F06E4C37-4076-4272-9CA6-FB505E02CD31}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SendReceive", "Core\Tests\SendReceive\SendReceive.csproj", "{F164E83B-C177-4BC7-9774-0AF7F239C4DC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug Mac|Any CPU = Debug Mac|Any CPU @@ -2399,6 +2401,22 @@ Global {F06E4C37-4076-4272-9CA6-FB505E02CD31}.Release|Any CPU.Build.0 = Release|Any CPU {F06E4C37-4076-4272-9CA6-FB505E02CD31}.Release|x64.ActiveCfg = Release|Any CPU {F06E4C37-4076-4272-9CA6-FB505E02CD31}.Release|x64.Build.0 = Release|Any CPU + {F164E83B-C177-4BC7-9774-0AF7F239C4DC}.Debug Mac|Any CPU.ActiveCfg = Debug|Any CPU + {F164E83B-C177-4BC7-9774-0AF7F239C4DC}.Debug Mac|Any CPU.Build.0 = Debug|Any CPU + {F164E83B-C177-4BC7-9774-0AF7F239C4DC}.Debug Mac|x64.ActiveCfg = Debug|Any CPU + {F164E83B-C177-4BC7-9774-0AF7F239C4DC}.Debug Mac|x64.Build.0 = Debug|Any CPU + {F164E83B-C177-4BC7-9774-0AF7F239C4DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F164E83B-C177-4BC7-9774-0AF7F239C4DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F164E83B-C177-4BC7-9774-0AF7F239C4DC}.Debug|x64.ActiveCfg = Debug|Any CPU + {F164E83B-C177-4BC7-9774-0AF7F239C4DC}.Debug|x64.Build.0 = Debug|Any CPU + {F164E83B-C177-4BC7-9774-0AF7F239C4DC}.Release Mac|Any CPU.ActiveCfg = Debug|Any CPU + {F164E83B-C177-4BC7-9774-0AF7F239C4DC}.Release Mac|Any CPU.Build.0 = Debug|Any CPU + {F164E83B-C177-4BC7-9774-0AF7F239C4DC}.Release Mac|x64.ActiveCfg = Debug|Any CPU + {F164E83B-C177-4BC7-9774-0AF7F239C4DC}.Release Mac|x64.Build.0 = Debug|Any CPU + {F164E83B-C177-4BC7-9774-0AF7F239C4DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F164E83B-C177-4BC7-9774-0AF7F239C4DC}.Release|Any CPU.Build.0 = Release|Any CPU + {F164E83B-C177-4BC7-9774-0AF7F239C4DC}.Release|x64.ActiveCfg = Release|Any CPU + {F164E83B-C177-4BC7-9774-0AF7F239C4DC}.Release|x64.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2575,6 +2593,7 @@ Global {829688CD-CECE-4F6C-A5A0-032BB39CD9E0} = {BE521908-7944-46F3-98BF-B47D34509934} {70DEAA13-6DC8-44A0-B287-9E806A8054F1} = {890F3257-FCC2-4ED8-9180-22B3641B494C} {F06E4C37-4076-4272-9CA6-FB505E02CD31} = {BE521908-7944-46F3-98BF-B47D34509934} + {F164E83B-C177-4BC7-9774-0AF7F239C4DC} = {5009BB59-0F77-4202-8FD2-DECC07E93146} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {1D43D91B-4F01-4A78-8250-CC6F9BD93A14} diff --git a/Core/Core/Transports/ServerUtils/ServerAPI.cs b/Core/Core/Transports/ServerUtils/ServerAPI.cs index d6a32a5412..d004400f93 100644 --- a/Core/Core/Transports/ServerUtils/ServerAPI.cs +++ b/Core/Core/Transports/ServerUtils/ServerAPI.cs @@ -366,9 +366,11 @@ private async Task> HasObjectsImpl(string streamId, IRe // Stopwatch sw = new Stopwatch(); sw.Start(); string objectsPostParameter = JsonConvert.SerializeObject(objectIds); - var payload = new Dictionary { { "objects", objectsPostParameter } }; + // var payload = new Dictionary { { "objects", objectsPostParameter } }; + var payload = new Dictionary> { { "objects", objectIds } }; string serializedPayload = JsonConvert.SerializeObject(payload); - var uri = new Uri($"/api/diff/{streamId}", UriKind.Relative); + // var uri = new Uri($"/api/diff/{streamId}", UriKind.Relative); + var uri = new Uri($"/api/v2/projects/{streamId}/objects/diff/", UriKind.Relative); HttpResponseMessage response; using StringContent stringContent = new(serializedPayload, Encoding.UTF8, "application/json"); @@ -399,8 +401,11 @@ private async Task UploadObjectsImpl(string streamId, List + + + Exe + net8.0 + enable + enable + + + + + + + + diff --git a/SDK.slnf b/SDK.slnf index 6e1d487fed..a69d3672f6 100644 --- a/SDK.slnf +++ b/SDK.slnf @@ -5,6 +5,7 @@ "Automate\\Speckle.Automate.Sdk\\Speckle.Automate.Sdk.csproj", "Automate\\Tests\\Speckle.Automate.Sdk.Tests.Integration\\Speckle.Automate.Sdk.Tests.Integration.csproj", "Core\\Core\\Core.csproj", + "Core\\Tests\\SendReceive\\SendReceive.csproj", "Core\\Tests\\Speckle.Core.Tests.Integration\\Speckle.Core.Tests.Integration.csproj", "Core\\Tests\\Speckle.Core.Tests.Performance\\Speckle.Core.Tests.Performance.csproj", "Core\\Tests\\Speckle.Core.Tests.Unit\\Speckle.Core.Tests.Unit.csproj", @@ -15,4 +16,4 @@ "Objects\\Tests\\Objects.Tests.Unit\\Objects.Tests.Unit.csproj" ] } -} +} \ No newline at end of file