Building a .js client for our speckle server. When making a GQL request, it seems that commits are always returned sorted by the latest. Can I confirm if its the case that the first index is always the latest commit?
Apologies if this is documented somewhere, if so, Id be grateful for some links!
This is correct unless you apply the
cursor parameter, in which case the first object will match that or the next in the list after that cursor.
The only time you may run into any issues relying on this is if you have a super active singular Project Stream that there would be a race condition. This is where organising data into Model Branches is useful for this purpose, such that the first commit to a Model Branch is most likely to be what you are looking for they represent that “latest” version of that Model, whatever the rotational selected for its content.
Where does the screenshot come from?
Well spotted. Normally we point you to Speckle GraphQL API for the API documentation, but that screenshot is from https://speckle.xyz/graphql which is the programmatic query endpoint, which happens to include a frontend to the Apollo GraphQL server.
Not all the Apollo features are supported, but it is an alternative means of parsing the API. Unfortunately URL links don’t work directly to topics.
Nice! Great to know! Thanks.
Never tried the endpoint directly in the browser, just for requests.