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: ei-3539 - Update the SDK to handle the allow_upload flag in list connections #44

Merged

Conversation

jmayne-iotics
Copy link
Contributor

Update the SDK to handle the allow_upload flag in list connections

@jmayne-iotics jmayne-iotics force-pushed the ei-3539-update-sdk-to-recognise-allow_upload-flag branch from 5b7c858 to a182dff Compare December 4, 2024 17:18
@jmayne-iotics jmayne-iotics changed the base branch from main to ei-3413-connections December 4, 2024 17:23
@jmayne-iotics jmayne-iotics force-pushed the ei-3539-update-sdk-to-recognise-allow_upload-flag branch 2 times, most recently from 6b7ee4a to 0ec97a3 Compare December 5, 2024 10:41
Returns:
A list of `Connection` objects

Raises:
requests.HTTPError: if the API request fails.
"""
connections = self._nyx_get(NYX_CONNECTIONS_ENDPOINT)
params = dict(allow_upload=allow_upload) if allow_upload is not None else None
Copy link
Contributor

Choose a reason for hiding this comment

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

Typically (at least in this repo) we don't instantiate dictionarties using the class syntax but instead do e.g.:
{"allow_upload": allow_upload}.
(It also makes a small perf difference but that's irrelevant here.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -937,14 +937,19 @@ def delete_circle(self, circle: Circle):
"""
self.delete_circle_by_name(circle.name)

def get_connections(self) -> list[Connection]:
def get_connections(self, allow_upload: bool | None = None) -> list[Connection]:
Copy link
Contributor

Choose a reason for hiding this comment

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

If there were a test already for get_connections, I'd say to to add parametrized one to show that this option is passed through. However I see on main we don't have any yet.

@jmayne-iotics jmayne-iotics force-pushed the ei-3539-update-sdk-to-recognise-allow_upload-flag branch from 0ec97a3 to f3e0f65 Compare December 6, 2024 15:50
@jmayne-iotics jmayne-iotics changed the base branch from ei-3413-connections to main December 6, 2024 15:51
"""Lists all connections.

Args:
allow_upload: Filter the connections by allow_upload, defaults to show all.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd say the only thing is it might be clear to uses that there are three options here:

  1. None - all
  2. allow_upload=True just with upload enabled (write)
  3. allow_upload=False just with upload disabled (read-only)

But maybe it doesn't matter.

@jmayne-iotics jmayne-iotics merged commit 436968e into main Dec 9, 2024
2 checks passed
@jmayne-iotics jmayne-iotics deleted the ei-3539-update-sdk-to-recognise-allow_upload-flag branch December 9, 2024 10:09
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.

3 participants