-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathotp-link.go
29 lines (25 loc) · 1.08 KB
/
otp-link.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package otplessgo
// Struct represents the payload for sending OTP Link to a phone number.
type PhoneOTPLinkPayload struct {
RedirectURI string `json:"redirectURI"`
Expiry int `json:"expiry"`
OtpLength OtpLength `json:"otpLength"`
PhoneNumber string `json:"phoneNumber"`
Channel []Channel `json:"channel"`
}
// Struct represents the payload for sending OTP Link to an email address.
type EmailOTPLinkPayload struct {
RedirectURI string `json:"redirectURI"`
Expiry int `json:"expiry"`
OtpLength OtpLength `json:"otpLength"`
Email string `json:"Email"`
Channel []Channel `json:"channel"`
}
// Sends OTP Link to a phone number
func (o *OTPLessClient) SendPhoneOTPLink(payload *PhoneOTPLinkPayload) (*ApiResponse[ApiSuccessWithRequestID], error) {
return getRequestId(o.restyClient, "/initiate/otplink", payload)
}
// Sends OTP Link to an Email Address
func (o *OTPLessClient) SendEmailOTPLink(payload *EmailOTPLinkPayload) (*ApiResponse[ApiSuccessWithRequestID], error) {
return getRequestId(o.restyClient, "/initiate/otplink", payload)
}