Skip to content

Conversation

@brandon-wada
Copy link
Collaborator

@brandon-wada brandon-wada commented Mar 6, 2024

Part 1: Adds a couple uses of whoami that robotrapta suggested in my last PR
Part 2: Hits a new endpoint in the service to provide access to actions from the SDK. Specifically, the new function UnstableApi.create_action will be able to create new actions and configure them appropriately. I create a new API class to try and be explicit about how we anticipate this to change.

@brandon-wada
Copy link
Collaborator Author

brandon-wada commented Mar 7, 2024

I think this is worth adding at this point to allow for easy programmatic access to notifications. It's not clear where this belongs though, since it is subject to change, so I've created a new file for it. I intentionally didn't add it to internalapi.py because everything in internalapi.py is wired into client.py making it effectively public. Going forward there may be other functionality we want to add to the sdk and test out first and that can go into the new class as well.
The other alternative is to make an edge branch of the sdk, though I worry a branch like that could quickly diverge from main in difficult to resolve ways.

from groundlight import Groundlight


class UnstableApi(Groundlight):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Written like this, you can call
from groundlight import UnstableApi gl = UnstableApi
and gl will behave as if it was the Groundlight client but with this extra feature. The previous commit had this written into the Groundlight class but we want to make this readily apparent that this feature is unstable

@brandon-wada brandon-wada changed the title Feature whoami2 Notifications in SDK Mar 8, 2024
Copy link
Contributor

@mjvogelsong mjvogelsong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the approach of using an experimental client!

snooze_time_value=snooze_time_value,
snooze_time_unit=snooze_time_unit,
)
self.rules_api.create_rule(det_id, rule_input)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.rules_api.create_rule(det_id, rule_input)
return self.rules_api.create_rule(det_id, rule_input)

@brandon-wada brandon-wada merged commit 1416be9 into main Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants