Skip to content

Commit

Permalink
Merge pull request #33 from passageidentity/psg-2286-magic-link-type
Browse files Browse the repository at this point in the history
PSG-2286: add type parameter to createMagicLink type
  • Loading branch information
duanebester authored Jul 11, 2023
2 parents 5273206 + 5d0380f commit d1efa46
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
26 changes: 17 additions & 9 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,24 @@ const (
PhoneChannel ChannelType = "phone"
)

type MagicLinkType string

const (
LoginType MagicLinkType = "login"
VerifyIdentifierType MagicLinkType = "verify_identifier"
)

type CreateMagicLinkBody struct {
UserID string `json:"user_id"`
Email string `json:"email"`
Phone string `json:"phone"`
Channel ChannelType `json:"channel"`
Send bool `json:"send"`
MagicLinkPath string `json:"magic_link_path"`
RedirectURL string `json:"redirect_url"`
TTL int `json:"ttl"`
Language string `json:"language"`
UserID string `json:"user_id"`
Email string `json:"email"`
Phone string `json:"phone"`
Channel ChannelType `json:"channel"`
Send bool `json:"send"`
MagicLinkPath string `json:"magic_link_path"`
RedirectURL string `json:"redirect_url"`
TTL int `json:"ttl"`
Language string `json:"language"`
Type MagicLinkType `json:"type,omitempty"`
}

type MagicLink struct {
Expand Down
1 change: 1 addition & 0 deletions app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func TestCreateMagicLink(t *testing.T) {
Email: "[email protected]",
Channel: passage.EmailChannel,
TTL: 12,
Type: passage.LoginType,
}

magicLink, err := psg.CreateMagicLink(createMagicLinkBody)
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.4.0
v1.5.0

0 comments on commit d1efa46

Please sign in to comment.