feat(assets): add asset history API methods#79
Open
briansumma wants to merge 2 commits intoNorthShoreAutomation:mainfrom
Open
feat(assets): add asset history API methods#79briansumma wants to merge 2 commits intoNorthShoreAutomation:mainfrom
briansumma wants to merge 2 commits intoNorthShoreAutomation:mainfrom
Conversation
- Add fetch method to retrieve paginated asset list - Add fetch_asset_history_entities to get history for an asset - Add create_history_entity to record new history events - Implement comprehensive test suite for all new methods
nsa-brant
reviewed
May 20, 2025
pythonik/specs/assets.py
Outdated
| ) | ||
| return self.parse_response(response, None) | ||
|
|
||
| def fetch(self, **kwargs) -> Response: |
Member
There was a problem hiding this comment.
can rename this to list, so its more descriptive of what the intention is? Thanks!
pythonik/specs/assets.py
Outdated
| resp = self._get(self.gen_url("assets/"), **kwargs) | ||
| return self.parse_response(resp, PaginatedResponse) | ||
|
|
||
| def fetch_asset_history_entities(self, asset_id: str, **kwargs) -> Response: |
Member
There was a problem hiding this comment.
list_asset_history_entities might make sense here too :)
| Raises: | ||
| ValueError: If operation_type is not a valid operation type | ||
| """ | ||
| operation_types = [ |
Member
There was a problem hiding this comment.
This might be better as an Enum and we can set the operation_type as the Enum, so then the developer/user can use the Enum when sending, also we may not want to restrict them too much here, but just recommend passing the enum or a string, allowing any value but the Enum will help them to see what is expected (this way if the api changes they can still use it)
…t of objects. Refactor `fetch()` be `list_all()` to avoid conflict with `list` built-in.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Asset History API Implementation
Overview
This PR adds support for the asset history API endpoints to the Pythonik SDK. It includes methods to fetch assets, retrieve history entities for a specific asset, and create new history entries.
Changes
fetch()method to retrieve paginated list of assetsfetch_asset_history_entities()to get history for an assetcreate_history_entity()to record new history eventsTesting
All new functionality is covered by tests in
pythonik/tests/test_assets_history.py:Note to Maintainer
These changes extend the SDK's capabilities to work with the asset history API without breaking existing functionality. Let me know if any adjustments are needed before merging.