diff --git a/src/Speckle.Sdk/Api/GraphQL/Inputs/ProjectInputs.cs b/src/Speckle.Sdk/Api/GraphQL/Inputs/ProjectInputs.cs index e80d3b58..7a660be0 100644 --- a/src/Speckle.Sdk/Api/GraphQL/Inputs/ProjectInputs.cs +++ b/src/Speckle.Sdk/Api/GraphQL/Inputs/ProjectInputs.cs @@ -11,18 +11,12 @@ public sealed record ProjectInviteCreateInput(string? email, string? role, strin public sealed record ProjectInviteUseInput(bool accept, string projectId, string token); public sealed record ProjectModelsFilter( - IReadOnlyList? contributors, - IReadOnlyList? excludeIds, - IReadOnlyList? ids, - bool? onlyWithVersions, - string? search, - IReadOnlyList? sourceApps -); - -public sealed record ProjectModelsTreeFilter( - IReadOnlyList? contributors, - string? search, - IReadOnlyList? sourceApps + IReadOnlyList? contributors = null, + IReadOnlyList? excludeIds = null, + IReadOnlyList? ids = null, + bool? onlyWithVersions = null, + string? search = null, + IReadOnlyList? sourceApps = null ); public sealed record ProjectUpdateInput( diff --git a/src/Speckle.Sdk/Api/GraphQL/Resources/VersionResource.cs b/src/Speckle.Sdk/Api/GraphQL/Resources/VersionResource.cs index b06743bb..76f499bb 100644 --- a/src/Speckle.Sdk/Api/GraphQL/Resources/VersionResource.cs +++ b/src/Speckle.Sdk/Api/GraphQL/Resources/VersionResource.cs @@ -127,14 +127,28 @@ public sealed class VersionResource /// /// id of the created /// - public async Task Create(CreateVersionInput input, CancellationToken cancellationToken = default) + public async Task Create(CreateVersionInput input, CancellationToken cancellationToken = default) { //language=graphql const string QUERY = """ mutation Create($input: CreateVersionInput!) { data:versionMutations { data:create(input: $input) { - data:id + id + referencedObject + message + sourceApplication + createdAt + previewUrl + authorUser { + id + name + bio + company + verified + role + avatar + } } } } @@ -143,9 +157,9 @@ public sealed class VersionResource GraphQLRequest request = new() { Query = QUERY, Variables = new { input } }; var response = await _client - .ExecuteGraphQLRequest>>>(request, cancellationToken) + .ExecuteGraphQLRequest>>(request, cancellationToken) .ConfigureAwait(false); - return response.data.data.data; + return response.data.data; } /// diff --git a/tests/Speckle.Sdk.Tests.Integration/Api/GraphQL/Resources/CommentResourceTests.cs b/tests/Speckle.Sdk.Tests.Integration/Api/GraphQL/Resources/CommentResourceTests.cs index 83373aad..b7071c27 100644 --- a/tests/Speckle.Sdk.Tests.Integration/Api/GraphQL/Resources/CommentResourceTests.cs +++ b/tests/Speckle.Sdk.Tests.Integration/Api/GraphQL/Resources/CommentResourceTests.cs @@ -5,6 +5,7 @@ using Speckle.Sdk.Api.GraphQL.Models; using Speckle.Sdk.Api.GraphQL.Resources; using Speckle.Sdk.Common; using Xunit; +using Version = Speckle.Sdk.Api.GraphQL.Models.Version; namespace Speckle.Sdk.Tests.Integration.API.GraphQL.Resources; @@ -14,17 +15,17 @@ public class CommentResourceTests private readonly CommentResource Sut; private readonly Project _project; private readonly Model _model; - private readonly string _versionId; + private readonly Version _version; private readonly Comment _comment; // Constructor for setup public CommentResourceTests() { // Synchronous operations converted to async Task.Run for constructor - _testUser = Task.Run(async () => await Fixtures.SeedUserWithClient()).Result!; - _project = Task.Run(async () => await _testUser.Project.Create(new("Test project", "", null))).Result!; - _model = Task.Run(async () => await _testUser.Model.Create(new("Test Model 1", "", _project.id))).Result!; - _versionId = Task.Run(async () => await Fixtures.CreateVersion(_testUser, _project.id, _model.id)).Result!; + _testUser = Task.Run(async () => await Fixtures.SeedUserWithClient()).Result; + _project = Task.Run(async () => await _testUser.Project.Create(new("Test project", "", null))).Result; + _model = Task.Run(async () => await _testUser.Model.Create(new("Test Model 1", "", _project.id))).Result; + _version = Task.Run(async () => await Fixtures.CreateVersion(_testUser, _project.id, _model.id)).Result; _comment = Task.Run(CreateComment).Result!; Sut = _testUser.Comment; } @@ -110,6 +111,6 @@ public class CommentResourceTests private async Task CreateComment() { - return await Fixtures.CreateComment(_testUser, _project.id, _model.id, _versionId); + return await Fixtures.CreateComment(_testUser, _project.id, _model.id, _version.id); } } diff --git a/tests/Speckle.Sdk.Tests.Integration/Api/GraphQL/Resources/SubscriptionResourceTests.cs b/tests/Speckle.Sdk.Tests.Integration/Api/GraphQL/Resources/SubscriptionResourceTests.cs index 596a9cac..9abe9cce 100644 --- a/tests/Speckle.Sdk.Tests.Integration/Api/GraphQL/Resources/SubscriptionResourceTests.cs +++ b/tests/Speckle.Sdk.Tests.Integration/Api/GraphQL/Resources/SubscriptionResourceTests.cs @@ -5,6 +5,7 @@ using Speckle.Sdk.Api.GraphQL.Inputs; using Speckle.Sdk.Api.GraphQL.Models; using Speckle.Sdk.Api.GraphQL.Resources; using Xunit; +using Version = Speckle.Sdk.Api.GraphQL.Models.Version; namespace Speckle.Sdk.Tests.Integration.API.GraphQL.Resources; @@ -14,7 +15,7 @@ public class SubscriptionResourceTests : IAsyncLifetime private Client _testUser; private Project _testProject; private Model _testModel; - private string _testVersion; + private Version _testVersion; private SubscriptionResource Sut => _testUser.Subscription; @@ -109,7 +110,7 @@ public class SubscriptionResourceTests : IAsyncLifetime await Task.Delay(WAIT_PERIOD); // Give time for subscription to be triggered subscriptionMessage.Should().NotBeNull(); - subscriptionMessage!.id.Should().Be(created); + subscriptionMessage!.id.Should().Be(created.id); subscriptionMessage.type.Should().Be(ProjectVersionsUpdatedMessageType.CREATED); subscriptionMessage.version.Should().NotBeNull(); } @@ -125,7 +126,7 @@ public class SubscriptionResourceTests : IAsyncLifetime await Task.Delay(WAIT_PERIOD); // Give time to subscription to be setup - var created = await Fixtures.CreateComment(_testUser, _testProject.id, _testModel.id, _testVersion); + var created = await Fixtures.CreateComment(_testUser, _testProject.id, _testModel.id, _testVersion.id); await Task.Delay(WAIT_PERIOD); // Give time for subscription to be triggered diff --git a/tests/Speckle.Sdk.Tests.Integration/Api/GraphQL/Resources/VersionResourceTests.cs b/tests/Speckle.Sdk.Tests.Integration/Api/GraphQL/Resources/VersionResourceTests.cs index 717d8a13..321fdd2a 100644 --- a/tests/Speckle.Sdk.Tests.Integration/Api/GraphQL/Resources/VersionResourceTests.cs +++ b/tests/Speckle.Sdk.Tests.Integration/Api/GraphQL/Resources/VersionResourceTests.cs @@ -26,9 +26,7 @@ public class VersionResourceTests : IAsyncLifetime _model1 = await _testUser.Model.Create(new("Test Model 1", "", _project.id)); _model2 = await _testUser.Model.Create(new("Test Model 2", "", _project.id)); - string versionId = await Fixtures.CreateVersion(_testUser, _project.id, _model1.id); - - _version = await Sut.Get(versionId, _project.id); + _version = await Fixtures.CreateVersion(_testUser, _project.id, _model1.id); } [Fact] diff --git a/tests/Speckle.Sdk.Tests.Integration/Fixtures.cs b/tests/Speckle.Sdk.Tests.Integration/Fixtures.cs index 58241347..bef9259f 100644 --- a/tests/Speckle.Sdk.Tests.Integration/Fixtures.cs +++ b/tests/Speckle.Sdk.Tests.Integration/Fixtures.cs @@ -13,6 +13,7 @@ using Speckle.Sdk.Host; using Speckle.Sdk.Models; using Speckle.Sdk.Tests.Unit.Serialisation; using Speckle.Sdk.Transports; +using Version = Speckle.Sdk.Api.GraphQL.Models.Version; namespace Speckle.Sdk.Tests.Integration; @@ -39,7 +40,7 @@ public static class Fixtures return ServiceProvider.GetRequiredService().Create(await SeedUser()); } - public static async Task CreateVersion(Client client, string projectId, string modelId) + public static async Task CreateVersion(Client client, string projectId, string modelId) { using var remote = ServiceProvider.GetRequiredService().Create(client.Account, projectId); var (objectId, _) = await ServiceProvider diff --git a/tests/Speckle.Sdk.Tests.Performance/Benchmarks/GeneralSendTest.cs b/tests/Speckle.Sdk.Tests.Performance/Benchmarks/GeneralSendTest.cs index 46747dca..994ea723 100644 --- a/tests/Speckle.Sdk.Tests.Performance/Benchmarks/GeneralSendTest.cs +++ b/tests/Speckle.Sdk.Tests.Performance/Benchmarks/GeneralSendTest.cs @@ -11,6 +11,7 @@ using Speckle.Sdk.Host; using Speckle.Sdk.Models; using Speckle.Sdk.Serialisation; using Speckle.Sdk.Transports; +using Version = Speckle.Sdk.Api.GraphQL.Models.Version; namespace Speckle.Sdk.Tests.Performance.Benchmarks; @@ -62,7 +63,7 @@ public class GeneralSendTest } [Benchmark(Baseline = true)] - public async Task Send_old() + public async Task Send_old() { using SQLiteTransport local = new(); var res = await _operations.Send(_testData, [_remote, local]); @@ -70,13 +71,13 @@ public class GeneralSendTest } [Benchmark] - public async Task Send_new() + public async Task Send_new() { var res = await _operations.Send2(new(acc.serverInfo.url), _project.id, acc.token, _testData, null, default); return await TagVersion($"Send_new {Guid.NewGuid()}", res.RootId); } - private async Task TagVersion(string name, string objectId) + private async Task TagVersion(string name, string objectId) { var model = await client.Model.Create(new(name, null, _project.id)); return await client.Version.Create(new(objectId, model.id, _project.id));