Callbacks
Callbacks in Design Automation for Fusion work differently than the Callbacks in the other Design Automation engines. As TypeScript is used to leverage the Fusion API we introduced methods in the “adsk” namespace to enable use of the callbacks. For more information about callbacks, check the general callback documentation.
OnProgress
To send a message to the url defined in the OnProgress property in the workitem you can use the following code:
result = adsk.OnProgress("Progress message");
The following json will be send to the url defined in the workitem:
{
"id": "taskID"
"progress": "Progress message"
}
The result of the function is an integer that represents the status of the request. If the request was successful the result will be 200.
OnDemand
To get a file downloaded that is defined in the activity as OnDemand you can use the following code:
result, message = adsk.getOnDemandFile("filename", "suffix", "headers", "responseFile")
Parameters:
Parameter | Type | Description |
---|---|---|
filename | String | Filename of the onDemand input parameter as specified in the Activity |
suffix | String | A query string - optional parameters that can be addded to the url defined in the WorkItem |
headers | String | Http call headers |
responseFile | String | Tells the system the filename under which the onDemand file is saved by the http call |
The result of the function is an integer that represents the status of the request. If the request was successful the result will be 200. If the integer ist -1 the request failed without being able to send a message to the url defined in the workitem. In any case the message will contain more information about the error.