Addresses general improvements to all toolkits including changing ruff from python 3.9 to python 3.10 which is the reason for the removal of Optional[] among others. Also, turns out that our `make install` for toolkits wasn't correctly checking for whether poetry was installed (&> /dev/null syntax isn't supported by our check-toolkits GitHub action, so we were installing poetry twice. I replaced with the more portable >/dev/null 2>&1) Question: Should we also change ruff to py310 for the `arcade/` package in a later PR? ------------------- CU-86b4gzyp6
54 lines
1.5 KiB
Python
54 lines
1.5 KiB
Python
from typing import Annotated
|
|
|
|
from arcade.sdk import ToolContext, tool
|
|
from arcade.sdk.auth import Zoom
|
|
|
|
from arcade_zoom.tools.utils import _handle_zoom_api_error, _send_zoom_request
|
|
|
|
|
|
@tool(
|
|
requires_auth=Zoom(
|
|
scopes=["meeting:read:list_upcoming_meetings"],
|
|
)
|
|
)
|
|
async def list_upcoming_meetings(
|
|
context: ToolContext,
|
|
user_id: Annotated[
|
|
str | None,
|
|
"The user's user ID or email address. Defaults to 'me' for the current user.",
|
|
] = "me",
|
|
) -> Annotated[dict, "List of upcoming meetings within the next 24 hours"]:
|
|
"""List a Zoom user's upcoming meetings within the next 24 hours."""
|
|
endpoint = f"/users/{user_id}/upcoming_meetings"
|
|
|
|
response = await _send_zoom_request(context, "GET", endpoint)
|
|
|
|
if not (200 <= response.status_code < 300):
|
|
_handle_zoom_api_error(response)
|
|
|
|
response_json = response.json()
|
|
return dict(response_json)
|
|
|
|
|
|
@tool(
|
|
requires_auth=Zoom(
|
|
scopes=["meeting:read:invitation"],
|
|
)
|
|
)
|
|
async def get_meeting_invitation(
|
|
context: ToolContext,
|
|
meeting_id: Annotated[
|
|
str,
|
|
"The meeting's numeric ID (as a string).",
|
|
],
|
|
) -> Annotated[dict, "Meeting invitation string"]:
|
|
"""Retrieve the invitation note for a specific Zoom meeting."""
|
|
endpoint = f"/meetings/{meeting_id}/invitation"
|
|
|
|
response = await _send_zoom_request(context, "GET", endpoint)
|
|
|
|
if not (200 <= response.status_code < 300):
|
|
_handle_zoom_api_error(response)
|
|
|
|
response_json = response.json()
|
|
return dict(response_json)
|