Skip to content
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: adds usage #166

Merged
merged 5 commits into from
Apr 12, 2024
Merged

feat: adds usage #166

merged 5 commits into from
Apr 12, 2024

Conversation

tdstein
Copy link
Collaborator

@tdstein tdstein commented Apr 11, 2024

This is more or less a copy of the visits implementation.

I am considering the best way to facade these resources behind a single interface. See #167

Copy link

github-actions bot commented Apr 11, 2024

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
855 819 96% 80% 🟢

New Files

File Coverage Status
src/posit/connect/usage.py 100% 🟢
TOTAL 100% 🟢

Modified Files

File Coverage Status
src/posit/connect/client.py 100% 🟢
TOTAL 100% 🟢

updated for commit: 15adb63 by action🐍

def find(
self,
content_guid: str = ...,
min_data_version: int = ...,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you have a test for something other than the default for min_data_version? Something that is a bit funny is that though the parameter is the same, for shiny the default (and max) is 1, for not-shiny content the default (and max) is 3

Copy link
Collaborator Author

@tdstein tdstein Apr 12, 2024

Choose a reason for hiding this comment

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

These arguments are passed through as query parameters to the server, which performs all validation. If the server responds with a failure, then a ClientError is raised.

>>> from posit import connect
>>> c = connect.Client()
>>> event = c.usage.find_one(min_data_version=-1)
Traceback (most recent call last):
...
posit.connect.errors.ClientError: The parameter min_data_version=-1 is less than the allowed minimum 0 (Error Code: 25, HTTP Status: 400 Bad Request)

@tdstein tdstein merged commit 073c01d into main Apr 12, 2024
7 checks passed
@tdstein tdstein deleted the tdstein/158 branch April 12, 2024 17:07
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.

2 participants