Skip to content

Latest commit

 

History

History
253 lines (163 loc) · 8.73 KB

README.md

File metadata and controls

253 lines (163 loc) · 8.73 KB

Otp

(otp)

Overview

Send OTP codes to your users using their phone numbers.

Available Operations

check

Check a code

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Ding\DingSDK;
use Ding\DingSDK\Models\Shared;

$security = 'YOUR_API_KEY';

$sdk = DingSDK\Ding::builder()->setSecurity($security)->build();

$request = new Shared\CreateCheckRequest(
    authenticationUuid: 'eebe792b-2fcc-44a0-87f1-650e79259e02',
    checkCode: '123456',
    customerUuid: '64f66a7c-4b2c-4131-a8ff-d5b954cca05f',
);

$response = $sdk->otp->check(
    request: $request
);

if ($response->createCheckResponse !== null) {
    // handle response
}

Parameters

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

Response

?Operations\CheckResponse

Errors

Error Type Status Code Content Type
Errors\SDKException 4XX, 5XX */*

createAuthentication

Send a code

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Ding\DingSDK;
use Ding\DingSDK\Models\Shared;

$security = 'YOUR_API_KEY';

$sdk = DingSDK\Ding::builder()->setSecurity($security)->build();

$request = new Shared\CreateAuthenticationRequest(
    customerUuid: 'cf2edc1c-7fc6-48fb-86da-b7508c6b7b71',
    phoneNumber: '+1234567890',
    locale: 'fr-FR',
);

$response = $sdk->otp->createAuthentication(
    request: $request
);

if ($response->createAuthenticationResponse !== null) {
    // handle response
}

Parameters

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

Response

?Operations\CreateAuthenticationResponse

Errors

Error Type Status Code Content Type
Errors\SDKException 4XX, 5XX */*

feedback

Send feedback

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Ding\DingSDK;
use Ding\DingSDK\Models\Shared;

$security = 'YOUR_API_KEY';

$sdk = DingSDK\Ding::builder()->setSecurity($security)->build();

$request = new Shared\FeedbackRequest(
    customerUuid: 'cc0f6c04-40de-448f-8301-3cb0e6565dff',
    phoneNumber: '+1234567890',
    status: Shared\FeedbackRequestStatus::Onboarded,
);

$response = $sdk->otp->feedback(
    request: $request
);

if ($response->feedbackResponse !== null) {
    // handle response
}

Parameters

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

Response

?Operations\FeedbackResponse

Errors

Error Type Status Code Content Type
Errors\SDKException 4XX, 5XX */*

getAuthenticationStatus

Get authentication status

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Ding\DingSDK;

$security = 'YOUR_API_KEY';

$sdk = DingSDK\Ding::builder()->setSecurity($security)->build();



$response = $sdk->otp->getAuthenticationStatus(
    authUuid: 'd8446450-f2fa-4dd9-806b-df5b8c661f23'
);

if ($response->authenticationStatusResponse !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
authUuid string ✔️ N/A

Response

?Operations\GetAuthenticationStatusResponse

Errors

Error Type Status Code Content Type
Errors\SDKException 4XX, 5XX */*

retry

Perform a retry

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Ding\DingSDK;
use Ding\DingSDK\Models\Shared;

$security = 'YOUR_API_KEY';

$sdk = DingSDK\Ding::builder()->setSecurity($security)->build();

$request = new Shared\RetryAuthenticationRequest(
    authenticationUuid: 'a4e4548a-1f7b-451a-81cb-a68ed5aff3b0',
    customerUuid: '28532118-1b33-420a-b57b-648c9bf85fee',
);

$response = $sdk->otp->retry(
    request: $request
);

if ($response->retryAuthenticationResponse !== null) {
    // handle response
}

Parameters

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

Response

?Operations\RetryResponse

Errors

Error Type Status Code Content Type
Errors\SDKException 4XX, 5XX */*