Skip to content

Commit

Permalink
gql api changes (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
JR-Morgan authored Feb 12, 2025
1 parent 3072047 commit f0bafee
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
33 changes: 32 additions & 1 deletion src/Speckle.Sdk/Api/GraphQL/Models/Comment.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Speckle.Sdk.Api.GraphQL.Models;
using Speckle.Newtonsoft.Json;

namespace Speckle.Sdk.Api.GraphQL.Models;

public sealed class Comment
{
Expand All @@ -17,4 +19,33 @@ public sealed class Comment
public DateTime updatedAt { get; init; }
public DateTime? viewedAt { get; init; }
public List<ViewerResourceItem> viewerResources { get; init; }
public SerializedViewerState viewerState { get; init; }
}

/// <summary>
/// See <c>SerializedViewerState</c> in <a href="https://github.com/specklesystems/speckle-server/blob/main/packages/shared/src/viewer/helpers/state.ts">/shared/src/viewer/helpers/state.ts</a>
/// </summary>
/// <remarks>
/// Note, there are many FE/Viewer specific properties on this object that are not reflected here (hence the <see cref="MissingMemberHandling"/> override)
/// We can add them as needed, keeping in mind flexiblity for breaking changes (these classes are intentionally not documented in our schema!)
/// </remarks>
[JsonObject(MissingMemberHandling = MissingMemberHandling.Ignore)]
public sealed class SerializedViewerState
{
public ViewerStateUI ui { get; init; }
}

[JsonObject(MissingMemberHandling = MissingMemberHandling.Ignore)]
public sealed class ViewerStateUI
{
public ViewerStateCamera camera { get; init; }
}

[JsonObject(MissingMemberHandling = MissingMemberHandling.Ignore)]
public sealed class ViewerStateCamera
{
public List<double> position { get; init; }
public List<double> target { get; init; }
public bool isOrthoProjection { get; init; }
public double zoom { get; init; }
}
3 changes: 2 additions & 1 deletion src/Speckle.Sdk/Api/GraphQL/Models/SubscriptionMessages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ public sealed class ProjectVersionsUpdatedMessage : EventArgs
[JsonRequired]
public ProjectVersionsUpdatedMessageType type { get; init; }

public string? modelId { get; init; }
[JsonRequired]
public string modelId { get; init; }

public Version? version { get; init; }
}
1 change: 1 addition & 0 deletions src/Speckle.Sdk/Api/GraphQL/Resources/CommentResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ query CommentThreads($projectId: String!, $cursor: String, $limit: Int!, $filter
objectId
versionId
}
viewerState
}
}
}
Expand Down

0 comments on commit f0bafee

Please sign in to comment.