diff --git a/packages/api/src/microsoft/teams/api/clients/__init__.py b/packages/api/src/microsoft/teams/api/clients/__init__.py index 95267410..ffd8ed49 100644 --- a/packages/api/src/microsoft/teams/api/clients/__init__.py +++ b/packages/api/src/microsoft/teams/api/clients/__init__.py @@ -7,6 +7,8 @@ from .bot import __all__ as bot_all from .conversation import * # noqa: F403 from .conversation import __all__ as conversation_all +from .meeting import * # noqa: F403 +from .meeting import __all__ as meeting_all from .user import * # noqa: F403 from .user import __all__ as user_all @@ -14,4 +16,5 @@ *conversation_all, *user_all, *bot_all, + *meeting_all, ] diff --git a/packages/api/src/microsoft/teams/api/clients/meeting/__init__.py b/packages/api/src/microsoft/teams/api/clients/meeting/__init__.py new file mode 100644 index 00000000..a599b1a7 --- /dev/null +++ b/packages/api/src/microsoft/teams/api/clients/meeting/__init__.py @@ -0,0 +1,8 @@ +""" +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the MIT License. +""" + +from .client import MeetingClient + +__all__ = ["MeetingClient"] diff --git a/packages/api/src/microsoft/teams/api/clients/meeting/client.py b/packages/api/src/microsoft/teams/api/clients/meeting/client.py new file mode 100644 index 00000000..6ae337c5 --- /dev/null +++ b/packages/api/src/microsoft/teams/api/clients/meeting/client.py @@ -0,0 +1,57 @@ +""" +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the MIT License. +""" + +from typing import Optional, Union + +from microsoft.teams.common.http import Client, ClientOptions + +from ...models import MeetingInfo, MeetingParticipant +from ..base_client import BaseClient + + +class MeetingClient(BaseClient): + """Client for managing Teams meetings.""" + + def __init__( + self, + service_url: str, + options: Optional[Union[Client, ClientOptions]] = None, + ) -> None: + """ + Initialize the MeetingClient. + + Args: + service_url: The service URL for API calls. + options: Optional Client or ClientOptions instance. If not provided, a default Client will be created. + """ + super().__init__(options) + self.service_url = service_url + + async def get_by_id(self, id: str) -> MeetingInfo: + """ + Get meeting information by ID. + + Args: + id: The meeting ID. + + Returns: + The meeting information. + """ + response = await self.http.get(f"{self.service_url}/v1/meetings/{id}") + return MeetingInfo.model_validate(response.json()) + + async def get_participant(self, meeting_id: str, id: str) -> MeetingParticipant: + """ + Get meeting participant information. + + Args: + meeting_id: The meeting ID. + id: The participant ID. + + Returns: + The meeting participant information. + """ + response = await self.http.get(f"{self.service_url}/v1/meetings/{meeting_id}/participants/{id}") + return MeetingParticipant.model_validate(response.json()) diff --git a/packages/api/src/microsoft/teams/api/models/__init__.py b/packages/api/src/microsoft/teams/api/models/__init__.py index b5347246..d9de062c 100644 --- a/packages/api/src/microsoft/teams/api/models/__init__.py +++ b/packages/api/src/microsoft/teams/api/models/__init__.py @@ -3,7 +3,7 @@ Licensed under the MIT License. """ -from .account import Account, AccountRole +from .account import Account, AccountRole, ConversationAccount from .action import Action from .activity import Activity from .adaptive_card import * # noqa: F403 @@ -57,6 +57,7 @@ "Account", "Activity", "AccountRole", + "ConversationAccount", "ChannelID", *conversation_all, *sign_in_all, diff --git a/packages/api/src/microsoft/teams/api/models/account.py b/packages/api/src/microsoft/teams/api/models/account.py index 3a539009..6b77f42a 100644 --- a/packages/api/src/microsoft/teams/api/models/account.py +++ b/packages/api/src/microsoft/teams/api/models/account.py @@ -31,3 +31,30 @@ class Account(CustomBaseModel): """ Additional properties for the account. """ + + +class ConversationAccount(CustomBaseModel): + """ + Represents a Teams conversation account. + """ + + id: str + """ + The unique identifier for the conversation. + """ + tenant_id: Optional[str] = None + """ + The tenant ID for the conversation. + """ + conversation_type: str + """ + The type of conversation (personal, groupChat, etc.). + """ + name: Optional[str] = None + """ + The name of the conversation. + """ + is_group: Optional[bool] = None + """ + Whether this is a group conversation. + """ diff --git a/packages/api/src/microsoft/teams/api/models/meetings/meeting_info.py b/packages/api/src/microsoft/teams/api/models/meetings/meeting_info.py index 9f154ba1..e8d25169 100644 --- a/packages/api/src/microsoft/teams/api/models/meetings/meeting_info.py +++ b/packages/api/src/microsoft/teams/api/models/meetings/meeting_info.py @@ -5,23 +5,11 @@ from typing import Optional +from ..account import Account, ConversationAccount from ..custom_base_model import CustomBaseModel from .meeting_details import MeetingDetails -# Placeholder for external types -class Account(CustomBaseModel): - """Placeholder for Account model from ../account""" - - pass - - -class ConversationAccount(CustomBaseModel): - """Placeholder for ConversationAccount model from ../account""" - - pass - - class MeetingInfo(CustomBaseModel): """ General information about a Teams meeting. diff --git a/packages/api/src/microsoft/teams/api/models/meetings/meeting_participant.py b/packages/api/src/microsoft/teams/api/models/meetings/meeting_participant.py index 44262490..6df73c96 100644 --- a/packages/api/src/microsoft/teams/api/models/meetings/meeting_participant.py +++ b/packages/api/src/microsoft/teams/api/models/meetings/meeting_participant.py @@ -5,23 +5,11 @@ from typing import Optional +from ..account import Account, ConversationAccount from ..custom_base_model import CustomBaseModel from .meeting import Meeting -# Placeholder for external types -class Account(CustomBaseModel): - """Placeholder for Account model from ../account""" - - pass - - -class ConversationAccount(CustomBaseModel): - """Placeholder for ConversationAccount model from ../account""" - - pass - - class MeetingParticipant(CustomBaseModel): """ Teams meeting participant detailing user Azure Active Directory details.