Skip to content

Commit

Permalink
Make email param optional in cal tool (#1970)
Browse files Browse the repository at this point in the history
## Description

Made changes to the `get_upcoming_bookings` function in cal-tool by
making the email parameter optional so that user doesn't have to pass
the attendee's email id to get their upcoming bookings.

## Type of change

Please check the options that are relevant:

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] Model update
- [ ] Infrastructure change

## Checklist

- [x] My code follows Phidata's style guidelines and best practices
- [x] I have performed a self-review of my code
- [x] I have added docstrings and comments for complex logic
- [x] My changes generate no new warnings or errors
- [x] I have added cookbook examples for my new addition (if needed)
- [x] I have updated requirements.txt/pyproject.toml (if needed)
- [x] I have verified my changes in a clean environment
  • Loading branch information
srexrg authored Feb 7, 2025
1 parent 1135746 commit 0d56dc2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions libs/agno/agno/tools/calcom.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,21 @@ def create_booking(
logger.error(f"Error creating booking: {e}")
return f"Error: {str(e)}"

def get_upcoming_bookings(self, email: str) -> str:
def get_upcoming_bookings(self, email: Optional[str] = None) -> str:
"""Get all upcoming bookings for an attendee.
Args:
email: Attendee's email
email (str): Attendee's email [Optional]
Returns:
str: List of upcoming bookings or error message
"""
try:
url = "https://api.cal.com/v2/bookings"
querystring = {"status": "upcoming", "attendeeEmail": email}
querystring = {"status": "upcoming"}
if email:
querystring["attendeeEmail"] = email


response = requests.get(url, headers=self._get_headers(), params=querystring)
if response.status_code == 200:
Expand Down

0 comments on commit 0d56dc2

Please sign in to comment.