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

fix: filter connections by entity [ENG-2523] #1200

Merged
merged 2 commits into from
Jan 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion python/composio/tools/toolset.py
Original file line number Diff line number Diff line change
Expand Up @@ -1360,7 +1360,9 @@ def get_connected_account(self, id: str) -> ConnectedAccountModel:
return self.client.connected_accounts.get(connection_id=id)

def get_connected_accounts(self) -> t.List[ConnectedAccountModel]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider adding docstring to clarify the behavior of entity filtering:

def get_connected_accounts(self) -> t.List[ConnectedAccountModel]:
    """
    Retrieve connected accounts filtered by the current entity ID.
    
    Returns:
        List[ConnectedAccountModel]: List of connected accounts for the current entity.
                                   If no entity_id is set, returns all accounts.
    """

return self.client.connected_accounts.get()
return self.client.connected_accounts.get(
entity_ids=[self.entity_id] if self.entity_id else None
)
Comment on lines +1363 to +1365

Choose a reason for hiding this comment

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

The refactored code introduces a potential issue with readability due to inconsistent indentation, which may lead to confusion during maintenance.


def get_entity(self, id: t.Optional[str] = None) -> Entity:
"""Get entity object for given ID."""
Expand Down
Loading