-
Notifications
You must be signed in to change notification settings - Fork 29
feat: add asset recipient support for escalations #387
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
Conversation
| if ( | ||
| recipient.type == AgentEscalationRecipientType.ASSET_USER_EMAIL | ||
| or recipient.type == AgentEscalationRecipientType.ASSET_GROUP_NAME | ||
| ): | ||
| return resolve_asset(recipient.asset_name, recipient.folder_path) | ||
|
|
||
| if hasattr(recipient, "value"): | ||
| return recipient.value | ||
|
|
||
| return None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use type narrowing here as AgentEscalationRecipient is a discriminated union and can be used specifically for such scenarios.
| if ( | |
| recipient.type == AgentEscalationRecipientType.ASSET_USER_EMAIL | |
| or recipient.type == AgentEscalationRecipientType.ASSET_GROUP_NAME | |
| ): | |
| return resolve_asset(recipient.asset_name, recipient.folder_path) | |
| if hasattr(recipient, "value"): | |
| return recipient.value | |
| return None | |
| if isinstance(recipient, AssetRecipient): | |
| return resolve_asset(recipient.asset_name, recipient.folder_path) | |
| if isinstance(recipient, StandardRecipient): | |
| return recipient.value | |
| return None |
f504536 to
30441b7
Compare
| """Retrieve asset value.""" | ||
| try: | ||
| client = UiPath() | ||
| result = client.assets.retrieve(name=asset_name, folder_path=folder_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the assets client also has an retrieve_async which we should use: https://github.com/UiPath/uipath-python/blob/main/src/uipath/platform/orchestrator/_assets_service.py#L84
Description
Add support for Asset Recipient in Escalations
Testing
Locally and added unit tests