tldr; I want a juicy JSON blob hydrated with all nested child elements in C#
Api.Operations.Receive checks an object and its detached children is present in Local or Remote but deserializes the found result to Base objects (or whatever KIt is required)
Suppose I was being lazy and just wanted to use the Speckle Sharp library to traverse a commit and get the JSON as-is; what would I use?
Or should I do some damn work, gut the
Receive and just not deserialize results?
Essentially I am looking for the equivalent of ObjectLoader from SpeckleServer and wanted to shortcut handling all the Transports negotiations.
I’m happy to inform you that the release we are prepping will have 2 new extension methods in core
I guess flatten is the one you’re looking for You can check them out here. speckle-sharp/Extensions.cs at 79e43f5405f397d00c1dd8b2b7c4c17c8b248b2f · specklesystems/speckle-sharp · GitHub
They’re not in our nugets yet, but that reminds me i must make a beta release of the NuGet’s too! so maybe you can test it out?
Let me know if you’d want to check this out and i’ll be happy to push the beta today.
Although, it may not be exactly what you had in mind, it will return you a flat list of all base objects contained in the parent you passed in. If you want to keep it on the “non deserialised” side of things, you may need to do it yourself, but it’s fairly easy, as each object has a
__closure table with all the object IDs inside it. You would just need to pull the parent object from the API, and then the flat list of it’s children.
Actually don’t rush it out. I’m not sure I know which of those I want yet.
No worries! Do let me know if you need some guidance