-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Automate to use FE2 API #384
Update Automate to use FE2 API #384
Conversation
In a future world, when the multi-model or non-model change triggers exist as planned, Should |
I think I may have initially misunderstood what the branch trigger checking was doing before. After checking this with Gergo, the check is there for this purpose; to prevent infinite circular loops where one automation triggers itsself. I chatted with Gergo, and this check remains, and we've exposed different functions for creating/getting models. Hopefully a bit simpler now. |
Updated automate SDK to use new FE2 API
There's only a couple changes:
create_new_version_in_project
no longer uses abranchName
insteadmodelId
.Because of this also, it will not create a branch for the user if one doesn't already exist.
To cover this usecase, I've added
create_new_model_in_project
andget_model
to create a model with the given inputs.Additional, under @gjedlicska 's suggestion, I have updated the graphql object models to use snake_casing, and using a pydantic alias config to ensure json serialization using camelCasing.
Discussed questions
should
create_new_model_in_project
try and find a model with the existing name and return that? right now it will throwSpeckleException
No we need to check, its to stop circular automationscreate_new_version_in_project
accepts amodel_id
... but we compare it against thematching_trigger.payload.model_id
, and throw if it doesn't match... To me it would make more sense to EITHER- just use this
payload.model_id
(but I'm not sure if it could when we expect it to benull
)- Not bother checking, and accept the users given
modelId
as is...create_new_version_in_project
now returns aTuple[Model, Version]
instead ofTuple[str,str]
I think this is a good change, but want to double check... Also may make more sense to simply return
Version
Yes, lets return only a
version