What’s the best way to list object ids currently in a stream? Or, more specifically, the object ids expected by the speckle viewer’s loadObject()
method?
From a dotnet server, I’ve managed to create an object with some displayValue
geometry, commit it to a stream, and then view it on my locally running server’s frontend. In C#, the class is defined as:
public class TestModel : Base
{
[DetachProperty]
public List<Polyline> displayValue { get; private set; }
public Box bbox { get; private set; }
public int random { get; private set; }
}
After a commit with Helpers.Send()
, if I use the Helpers.Receive("{streamDomain}/streams/{streamId}/branches/main")
method, I get the following:
{
"totalChildrenCount": 0,
"applicationId": null,
"speckle_type": "Base",
"displayValue": [
{
"value": [
0.0,
0.0,
0.0,
1.0,
2.0,
3.0
],
"closed": false,
"domain": null,
"bbox": null,
"area": 0.0,
"length": 0.0,
"units": "m",
"totalChildrenCount": 0,
"applicationId": null,
"speckle_type": "Objects.Geometry.Polyline",
"id": "cff3f3652f1b01c06a600974b84ed354"
}
],
"bbox": null,
"random": 1450717906,
"id": "8352492e5ae6083d3d33453d9de336da"
}
These results are more or less expected. Please do not judge my line quality. He’s doing his best.
The problem I’m facing is, if I use either one of those listed ids (the top-level object or its displayValue
) with the javascript viewer.loadObject(
${streamDomain}/streams/${streamId}/objects/${objectId})
method, it says it can’t find an object with that id. The id changes if the object changes, which is understandable, but I can’t get any ids from Helpers.Receive()
to work.
If I visit the server frontend, the data view will present me with almost the same values as Helpers.Receive()
:
Importantly, the id
from this latest commit is different from the value in Helpers.Receive()
. If I use this id in viewer.loadObject()
, everything works as expected.
What I’d like to do is commit a change and then have a way to (re)load that model after the change has completed. Is there a way to programmatically find the same id being presented to me in the viewer?