(Otp)
Send OTP codes to your users using their phone numbers.
- Check - Check a code
- CreateAuthentication - Send a code
- Feedback - Send feedback
- GetAuthenticationStatus - Get authentication status
- Retry - Perform a retry
Check a code
package main
import(
dinggolang "github.com/ding-live/ding-golang"
"context"
"github.com/ding-live/ding-golang/models/components"
"log"
)
func main() {
s := dinggolang.New(
dinggolang.WithSecurity("YOUR_API_KEY"),
)
ctx := context.Background()
res, err := s.Otp.Check(ctx, &components.CreateCheckRequest{
AuthenticationUUID: "e0e7b0e9-739d-424b-922f-1c2cb48ab077",
CheckCode: "123456",
CustomerUUID: "8f1196d5-806e-4b71-9b24-5f96ec052808",
})
if err != nil {
log.Fatal(err)
}
if res.CreateCheckResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
components.CreateCheckRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CheckResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.ErrorResponse | 400 | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Send a code
package main
import(
dinggolang "github.com/ding-live/ding-golang"
"context"
"github.com/ding-live/ding-golang/models/components"
"log"
)
func main() {
s := dinggolang.New(
dinggolang.WithSecurity("YOUR_API_KEY"),
)
ctx := context.Background()
res, err := s.Otp.CreateAuthentication(ctx, &components.CreateAuthenticationRequest{
CustomerUUID: "c9f826e0-deca-41ec-871f-ecd6e8efeb46",
Locale: dinggolang.String("fr-FR"),
PhoneNumber: "+1234567890",
})
if err != nil {
log.Fatal(err)
}
if res.CreateAuthenticationResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
components.CreateAuthenticationRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CreateAuthenticationResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.ErrorResponse | 400 | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Send feedback
package main
import(
dinggolang "github.com/ding-live/ding-golang"
"context"
"github.com/ding-live/ding-golang/models/components"
"log"
)
func main() {
s := dinggolang.New(
dinggolang.WithSecurity("YOUR_API_KEY"),
)
ctx := context.Background()
res, err := s.Otp.Feedback(ctx, &components.FeedbackRequest{
CustomerUUID: "c0c405fa-6bcb-4094-9430-7d6e2428ff23",
PhoneNumber: "+1234567890",
Status: components.FeedbackRequestStatusOnboarded,
})
if err != nil {
log.Fatal(err)
}
if res.FeedbackResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
components.FeedbackRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.FeedbackResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.ErrorResponse | 400 | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Get authentication status
package main
import(
dinggolang "github.com/ding-live/ding-golang"
"context"
"log"
)
func main() {
s := dinggolang.New(
dinggolang.WithSecurity("YOUR_API_KEY"),
)
ctx := context.Background()
res, err := s.Otp.GetAuthenticationStatus(ctx, "d8446450-f2fa-4dd9-806b-df5b8c661f23")
if err != nil {
log.Fatal(err)
}
if res.AuthenticationStatusResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
authUUID |
string | ✔️ | N/A |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetAuthenticationStatusResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.ErrorResponse | 400 | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Perform a retry
package main
import(
dinggolang "github.com/ding-live/ding-golang"
"context"
"log"
)
func main() {
s := dinggolang.New(
dinggolang.WithSecurity("YOUR_API_KEY"),
)
ctx := context.Background()
res, err := s.Otp.Retry(ctx, nil)
if err != nil {
log.Fatal(err)
}
if res.RetryAuthenticationResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
components.RetryAuthenticationRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.RetryResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.ErrorResponse | 400 | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |