1"""Signed-in member profile and officer member-list schemas."""
2
3from datetime import datetime # pydantic needs it at runtime
4
5from pydantic import BaseModel, ConfigDict
6
7
[docs]
8class Me(BaseModel):
9 """The signed-in member's profile, as returned by ``GET /api/me``.
10
11 ``display_name`` is the guild nick, else the Discord global name, else the username. Discord ids are
12 returned as strings because they're 64-bit and JSON numbers aren't safe past 2**53.
13 """
14
15 model_config = ConfigDict(from_attributes=True)
16
17 id: int
18 discord_id: str
19 username: str
20 display_name: str
21 avatar_url: str | None
22 is_guild_member: bool
23 is_officer: bool
24 is_gm: bool
25 battletag: str | None
26 roster_confirmed: bool
27
28
[docs]
29class MemberListing(BaseModel):
30 """One row of the officers' member list (``GET /api/members``): who has signed in and what they've linked.
31
32 Officers compare ``battletag`` against the in-game guild roster; it is never shown outside officer views.
33 """
34
35 id: int
36 username: str
37 display_name: str
38 avatar_url: str | None
39 is_guild_member: bool
40 is_officer: bool
41 battletag: str | None
42 roster_confirmed: bool
43 last_login_at: datetime | None
44
45
[docs]
46class CalendarLink(BaseModel):
47 """The signed-in member's private calendar feed link (``GET/POST /api/me/calendar``).
48
49 ``url`` is the full ``https://.../api/calendar/{token}.ics`` address; rotating replaces ``token`` and
50 invalidates the old link.
51 """
52
53 token: str
54 url: str