Skip to content

Commit 0f1613e

Browse files
authored
feat: make magic link parameter classes kwargs only (#130)
1 parent 52b6859 commit 0f1613e

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

passageidentity/models/magic_link_args.py

+19
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,37 @@ class MagicLinkWithEmailArgs(MagicLinkArgsBase):
1818

1919
email: str
2020

21+
def __init__(self, *, email: str, link_type: MagicLinkType, send: bool) -> None:
22+
"""Initialize the MagicLinkWithEmailArgs with the email."""
23+
self.email = email
24+
self.type = link_type
25+
self.send = send
26+
2127

2228
class MagicLinkWithPhoneArgs(MagicLinkArgsBase):
2329
"""Arguments for creating a Magic Link with a phone number."""
2430

2531
phone: str
2632

33+
def __init__(self, *, phone: str, link_type: MagicLinkType, send: bool) -> None:
34+
"""Initialize the MagicLinkWithPhoneArgs with the phone number."""
35+
self.phone = phone
36+
self.type = link_type
37+
self.send = send
38+
2739

2840
class MagicLinkWithUserArgs(MagicLinkArgsBase):
2941
"""Arguments for creating a Magic Link with a user ID."""
3042

3143
user_id: str
3244
channel: MagicLinkChannel
3345

46+
def __init__(self, *, user_id: str, channel: MagicLinkChannel, link_type: MagicLinkType, send: bool) -> None:
47+
"""Initialize the MagicLinkWithUserArgs with the user ID."""
48+
self.user_id = user_id
49+
self.channel = channel
50+
self.type = link_type
51+
self.send = send
52+
3453

3554
MagicLinkArgs = Union[MagicLinkWithEmailArgs, MagicLinkWithPhoneArgs, MagicLinkWithUserArgs]

passageidentity/models/magic_link_options.py

+14
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,17 @@ class MagicLinkOptions:
1010
magic_link_path: str | None
1111
redirect_url: str | None
1212
ttl: int | None
13+
14+
def __init__(
15+
self,
16+
*,
17+
language: str | None = None,
18+
magic_link_path: str | None = None,
19+
redirect_url: str | None = None,
20+
ttl: int | None = None,
21+
) -> None:
22+
"""Initialize the options with the given values."""
23+
self.language = language
24+
self.magic_link_path = magic_link_path
25+
self.redirect_url = redirect_url
26+
self.ttl = ttl

0 commit comments

Comments
 (0)