-
Notifications
You must be signed in to change notification settings - Fork 22
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
feat: Add Client for Asset Management (Asset) API #86
base: master
Are you sure you want to change the base?
feat: Add Client for Asset Management (Asset) API #86
Conversation
from nisystemlink.clients.core._http_configuration import HttpConfiguration | ||
|
||
|
||
def create_an_asset(): |
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.
Lets break the examples up into multiple files. If you just want to know how to query or export you should need to work through all the create and update code
|
||
# Update the created asset. | ||
updateAssets = [ | ||
AssetUpdate( |
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.
Once you've updated the update request model so more fields are optional lets revisit this example. We don't need to show every field you can update
... | ||
|
||
@post("query-assets") | ||
def query_assets(self, query: models.QueryAssetRequest) -> models.AssetsResponse: |
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.
query_assets and query_location both have CSV options that change the response format to a file download. We should make separate functions for these two -- query_assets and query_assets_as_csv; query_location_history and query_location_history_as_csv
You will need file download handling for the CSV cases similar to what we do for file download
... | ||
|
||
@post("export-assets") | ||
def export_assets( |
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.
Same as for query, for export we should have two separate functions -- export_assets_report and download_assets_report
|
||
@post("assets/{asset_id}/history/query-location") | ||
def query_location( | ||
self, query: models.QueryLocationHistoryRequest, asset_id: str |
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.
Put the asset_id parameter first
class QueryLocationHistoryRequest(JsonModel): | ||
"""Model for object containing options for querying history.""" | ||
|
||
take: Optional[int] = 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.
Missing doc comment
|
||
start_time: Optional[str] = None | ||
|
||
end_time: Optional[str] = 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.
Missing doc comments for start and end time
|
||
take: Optional[int] = None | ||
|
||
continuation_token: Optional[str] = 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.
Instead of adding the continuation_token field you should change the base class to WithPaging to get this field. That will enable use to build some common paging functions.
end_time: Optional[str] = None | ||
|
||
|
||
class ConnectionHistoryResponse(JsonModel): |
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.
This will match what we're doing in the other clients
class ConnectionHistoryResponse(JsonModel): | |
class PagedConnectionHistory(WithPaging): |
And remove the continuation_token field now that you're getting it from the base class
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.
Do not delete these tests. I'm guessing this was just a bad merge
What does this Pull Request accomplish?
This PR adds API Client Module for
Asset
microservice in theAsset Management
service.Why should this Pull Request be merged?
The
AssetManagementClient
makes it easier for users to interact with the endpoints ofAsset Management
service by just creating an instance of it.What testing has been done?
Automated integration tests are included.
API Link: Swagger Link