-
Notifications
You must be signed in to change notification settings - Fork 846
feat: Add work objects support #1783
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1783 +/- ##
==========================================
- Coverage 85.15% 84.29% -0.86%
==========================================
Files 115 115
Lines 13069 13547 +478
==========================================
+ Hits 11129 11420 +291
- Misses 1940 2127 +187 ☔ View full report in Codecov by Sentry. |
0aab530 to
2f3febb
Compare
2f3febb to
d7516ce
Compare
WilliamBergamin
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.
Nice thanks for working on this, it look promising 💯
Left a few comments 📝
For EntityPayload it might be a good idea to add unit tests similar to what is found in tests/slack_sdk/models/test_objects.py, let me know what you think about creating a dedicated unit test file in tests/slack_sdk/models similar to what the other "models" have 🤔
| # Store entity attributes data with a different internal name to avoid | ||
| # shadowing the class-level 'attributes' set used for JSON serialization | ||
| self._entity_attributes = attributes |
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.
Nice 💯 yup this makes sense!
| if isinstance(obj, EventAndEntityMetadata): | ||
| return obj.to_dict() | ||
| if isinstance(obj, EntityMetadata): | ||
| return obj.to_dict() |
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.
Nice 💯
616c7ad to
53b1353
Compare
| def get_object_attribute(self, key: str): | ||
| if key == "attributes": | ||
| return self._entity_attributes | ||
| else: | ||
| return getattr(self, key, 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.
Nice 💯 🚀
c091881 to
5fc9652
Compare
5fc9652 to
586dd3a
Compare
…nto feat-work-objects
…nto feat-work-objects
| edit=EntityEditSupport(enabled=True, text=EntityEditTextConfig(min_length=5, max_length=100)), | ||
| ), | ||
| due_date=EntityTypedField(value="2026-06-06", type="slack#/types/date"), | ||
| created_by=EntityTypedField( |
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.
Debating leaving this as EntityTypedField or adding a 'user' type field for the entity-specific pre-defined fields
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.
For now I would suggest keeping it simple and leaving it as EntityTypedField in the future if we see that a dedicated 'user' type field would be useful we can always add it, until then it provides us with more flexibility 🤔
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.
These changes look great 🚀
I left one comment on the test, let me know what you think
Note: you may need to update from main to get the checks to pass
| def get_object_attribute(self, key: str): | ||
| return getattr(self, key, 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.
Nice 💯
| edit=EntityEditSupport(enabled=True, text=EntityEditTextConfig(min_length=5, max_length=100)), | ||
| ), | ||
| due_date=EntityTypedField(value="2026-06-06", type="slack#/types/date"), | ||
| created_by=EntityTypedField( |
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.
For now I would suggest keeping it simple and leaving it as EntityTypedField in the future if we see that a dedicated 'user' type field would be useful we can always add it, until then it provides us with more flexibility 🤔
| class EntityMetadataTests(unittest.TestCase): | ||
| maxDiff = None | ||
|
|
||
| def test_creation(self): |
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.
What do you think about potentially creating more tests that cover more specific cases?
When the tests fail it will make it easier for maintainers to determine what area is the issue originates from
Summary
This PR adds the following support for work objects:
Testing
Category
/docs(Documents)/tutorial(PythOnBoardingBot tutorial)tests/integration_tests(Automated tests for this library)Requirements
python3 -m venv .venv && source .venv/bin/activate && ./scripts/run_validation.shafter making the changes.