31 lines
1.0 KiB
Python
31 lines
1.0 KiB
Python
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
TEAMS_BASE_URL = "https://teams.microsoft.com/l"
|
||
|
|
|
||
|
|
|
||
|
|
def build_chat_link(chat_id: str) -> str:
|
||
|
|
return f"{TEAMS_BASE_URL}/chat/19:{chat_id}@thread.tacv2/0"
|
||
|
|
|
||
|
|
|
||
|
|
def build_channel_link(team_id: str, channel_id: str) -> str:
|
||
|
|
return f"{TEAMS_BASE_URL}/channel/{channel_id}/General?groupId={team_id}"
|
||
|
|
|
||
|
|
|
||
|
|
def build_message_link(team_id: str, channel_id: str, message_id: str, *, parent_message_id: str | None = None) -> str:
|
||
|
|
url = f"{TEAMS_BASE_URL}/message/{channel_id}/{message_id}?groupId={team_id}"
|
||
|
|
if parent_message_id:
|
||
|
|
url += f"&parentMessageId={parent_message_id}"
|
||
|
|
return url
|
||
|
|
|
||
|
|
|
||
|
|
def build_meeting_link(meeting_id: str) -> str:
|
||
|
|
return f"{TEAMS_BASE_URL}/meeting/{meeting_id}"
|
||
|
|
|
||
|
|
|
||
|
|
def build_app_link(app_id: str, entity_id: str = "", context: dict | None = None) -> str:
|
||
|
|
params = f"entityId={entity_id}" if entity_id else ""
|
||
|
|
if context:
|
||
|
|
for k, v in context.items():
|
||
|
|
params += f"&context={k}={v}"
|
||
|
|
return f"{TEAMS_BASE_URL}/entity/{app_id}/{entity_id}?{params}"
|