Skip to content

Latest commit

 

History

History
303 lines (215 loc) · 11.4 KB

README.md

File metadata and controls

303 lines (215 loc) · 11.4 KB

Otp

(otp())

Overview

Send OTP codes to your users using their phone numbers.

Available Operations

check

Check a code

Example Usage

package hello.world;

import java.lang.Exception;
import live.ding.dingsdk.Ding;
import live.ding.dingsdk.models.errors.ErrorResponse;
import live.ding.dingsdk.models.operations.CheckResponse;
import live.ding.dingsdk.models.shared.CreateCheckRequest;
import live.ding.dingsdk.models.shared.Security;

public class Application {

    public static void main(String[] args) throws ErrorResponse, Exception {

        Ding sdk = Ding.builder()
                .security(Security.builder()
                    .apiKey("YOUR_API_KEY")
                    .build())
            .build();

        CreateCheckRequest req = CreateCheckRequest.builder()
                .authenticationUuid("eebe792b-2fcc-44a0-87f1-650e79259e02")
                .checkCode("123456")
                .customerUuid("64f66a7c-4b2c-4131-a8ff-d5b954cca05f")
                .build();

        CheckResponse res = sdk.otp().check()
                .request(req)
                .call();

        if (res.createCheckResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
request CreateCheckRequest ✔️ The request object to use for the request.

Response

CheckResponse

Errors

Error Type Status Code Content Type
models/errors/ErrorResponse 400 application/json
models/errors/SDKError 4XX, 5XX */*

createAuthentication

Send a code

Example Usage

package hello.world;

import java.lang.Exception;
import live.ding.dingsdk.Ding;
import live.ding.dingsdk.models.errors.ErrorResponse;
import live.ding.dingsdk.models.operations.CreateAuthenticationResponse;
import live.ding.dingsdk.models.shared.CreateAuthenticationRequest;
import live.ding.dingsdk.models.shared.Security;

public class Application {

    public static void main(String[] args) throws ErrorResponse, Exception {

        Ding sdk = Ding.builder()
                .security(Security.builder()
                    .apiKey("YOUR_API_KEY")
                    .build())
            .build();

        CreateAuthenticationRequest req = CreateAuthenticationRequest.builder()
                .customerUuid("cf2edc1c-7fc6-48fb-86da-b7508c6b7b71")
                .phoneNumber("+1234567890")
                .locale("fr-FR")
                .build();

        CreateAuthenticationResponse res = sdk.otp().createAuthentication()
                .request(req)
                .call();

        if (res.createAuthenticationResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
request CreateAuthenticationRequest ✔️ The request object to use for the request.

Response

CreateAuthenticationResponse

Errors

Error Type Status Code Content Type
models/errors/ErrorResponse 400 application/json
models/errors/SDKError 4XX, 5XX */*

feedback

Send feedback

Example Usage

package hello.world;

import java.lang.Exception;
import live.ding.dingsdk.Ding;
import live.ding.dingsdk.models.operations.FeedbackResponse;
import live.ding.dingsdk.models.shared.FeedbackRequest;
import live.ding.dingsdk.models.shared.FeedbackRequestStatus;
import live.ding.dingsdk.models.shared.Security;

public class Application {

    public static void main(String[] args) throws Exception {

        Ding sdk = Ding.builder()
                .security(Security.builder()
                    .apiKey("YOUR_API_KEY")
                    .build())
            .build();

        FeedbackRequest req = FeedbackRequest.builder()
                .customerUuid("cc0f6c04-40de-448f-8301-3cb0e6565dff")
                .phoneNumber("+1234567890")
                .status(FeedbackRequestStatus.ONBOARDED)
                .build();

        FeedbackResponse res = sdk.otp().feedback()
                .request(req)
                .call();

        if (res.feedbackResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
request FeedbackRequest ✔️ The request object to use for the request.

Response

FeedbackResponse

Errors

Error Type Status Code Content Type
models/errors/SDKError 4XX, 5XX */*

getAuthenticationStatus

Get authentication status

Example Usage

package hello.world;

import java.lang.Exception;
import live.ding.dingsdk.Ding;
import live.ding.dingsdk.models.operations.GetAuthenticationStatusResponse;
import live.ding.dingsdk.models.shared.Security;

public class Application {

    public static void main(String[] args) throws Exception {

        Ding sdk = Ding.builder()
                .security(Security.builder()
                    .apiKey("YOUR_API_KEY")
                    .build())
            .build();

        GetAuthenticationStatusResponse res = sdk.otp().getAuthenticationStatus()
                .authUuid("d8446450-f2fa-4dd9-806b-df5b8c661f23")
                .call();

        if (res.authenticationStatusResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
authUuid String ✔️ N/A

Response

GetAuthenticationStatusResponse

Errors

Error Type Status Code Content Type
models/errors/SDKError 4XX, 5XX */*

retry

Perform a retry

Example Usage

package hello.world;

import java.lang.Exception;
import live.ding.dingsdk.Ding;
import live.ding.dingsdk.models.errors.ErrorResponse1;
import live.ding.dingsdk.models.operations.RetryResponse;
import live.ding.dingsdk.models.shared.RetryAuthenticationRequest;
import live.ding.dingsdk.models.shared.Security;

public class Application {

    public static void main(String[] args) throws ErrorResponse1, Exception {

        Ding sdk = Ding.builder()
                .security(Security.builder()
                    .apiKey("YOUR_API_KEY")
                    .build())
            .build();

        RetryAuthenticationRequest req = RetryAuthenticationRequest.builder()
                .authenticationUuid("a4e4548a-1f7b-451a-81cb-a68ed5aff3b0")
                .customerUuid("28532118-1b33-420a-b57b-648c9bf85fee")
                .build();

        RetryResponse res = sdk.otp().retry()
                .request(req)
                .call();

        if (res.retryAuthenticationResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
request RetryAuthenticationRequest ✔️ The request object to use for the request.

Response

RetryResponse

Errors

Error Type Status Code Content Type
models/errors/ErrorResponse1 400 application/json
models/errors/SDKError 4XX, 5XX */*