Closed GDay closed 11 months ago
In general, adding an optional polling object to the execute/request object is the right approach. I'm not sure whether you ever need to have other conditions than an exact match for a value in the response. At least in the case of the PandaDoc API you only need to verify the document status before continuing, so you don't need other conditions which allows you to avoid usage of eval
.
@cscheng I have removed the eval and just assumed that it needs to be equal. I wanted to make this a bit more universal, but for now, this is fine. I can still extend it if necessary later on.
Feel free to review.
@cscheng All good comments. Thanks!
This will allow an integration to be set up to wait for a specific thing to change (or a background task to be finished).
Usecase: Say we are triggering a bulk call from a third party API. We need to wait until it's done before we can continue with the next steps in the integration. In this case, it makes sense to check a different endpoint for the status of that bulk operation. When we get back what we expected (meaning the operation has finished), we can move on.
Questions:
eval
here as it can lead code injection. The integration manifest should be safe as those can only be entered/changed by admins, but I would rather avoid it. I would also rather not use a case/switch if/else, but it might be the safest approach. Any ideas?This is code that I wrote off the top of my head, no testing has been done, so don't worry about the details just yet.