-
Notifications
You must be signed in to change notification settings - Fork 6
Notifications in SDK #179
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
Notifications in SDK #179
Conversation
auto-generated time is wrong, but I'll update the autogenerated code in a bit
… with dev environment and make the sdk code cleaner and nicer
…cumented yet as they may be unstable
…nto feature_whoami2
|
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. |
src/groundlight/unstableapi.py
Outdated
| from groundlight import Groundlight | ||
|
|
||
|
|
||
| class UnstableApi(Groundlight): |
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.
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
…nto feature_whoami2
mjvogelsong
left a comment
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 like the approach of using an experimental client!
src/groundlight/unstableapi.py
Outdated
| snooze_time_value=snooze_time_value, | ||
| snooze_time_unit=snooze_time_unit, | ||
| ) | ||
| self.rules_api.create_rule(det_id, rule_input) |
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.
| self.rules_api.create_rule(det_id, rule_input) | |
| return self.rules_api.create_rule(det_id, rule_input) |
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.