Skip to content

Latest commit

 

History

History
196 lines (122 loc) · 7.44 KB

README.md

File metadata and controls

196 lines (122 loc) · 7.44 KB

PhoneNumbers

(phoneNumbers)

Overview

Available Operations

  • create - Create a phone number
  • get - Retrieve a phone number
  • delete - Delete a phone number
  • update - Update a phone number

create

Create a new phone number

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Clerk\Backend;
use Clerk\Backend\Models\Operations;

$security = '<YOUR_BEARER_TOKEN_HERE>';

$sdk = Backend\ClerkBackend::builder()->setSecurity($security)->build();

$request = new Operations\CreatePhoneNumberRequestBody();

$response = $sdk->phoneNumbers->create(
    request: $request
);

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

Parameters

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

Response

?Operations\CreatePhoneNumberResponse

Errors

Error Type Status Code Content Type
Errors\ClerkErrors7 400, 401, 403, 404, 422 application/json
Errors\SDKException 4XX, 5XX */*

get

Returns the details of a phone number

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Clerk\Backend;

$security = '<YOUR_BEARER_TOKEN_HERE>';

$sdk = Backend\ClerkBackend::builder()->setSecurity($security)->build();



$response = $sdk->phoneNumbers->get(
    phoneNumberId: '<id>'
);

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

Parameters

Parameter Type Required Description
phoneNumberId string ✔️ The ID of the phone number to retrieve

Response

?Operations\GetPhoneNumberResponse

Errors

Error Type Status Code Content Type
Errors\ClerkErrors8 400, 401, 403, 404 application/json
Errors\SDKException 4XX, 5XX */*

delete

Delete the phone number with the given ID

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Clerk\Backend;

$security = '<YOUR_BEARER_TOKEN_HERE>';

$sdk = Backend\ClerkBackend::builder()->setSecurity($security)->build();



$response = $sdk->phoneNumbers->delete(
    phoneNumberId: '<id>'
);

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

Parameters

Parameter Type Required Description
phoneNumberId string ✔️ The ID of the phone number to delete

Response

?Operations\DeletePhoneNumberResponse

Errors

Error Type Status Code Content Type
Errors\ClerkErrors9 400, 401, 403, 404 application/json
Errors\SDKException 4XX, 5XX */*

update

Updates a phone number

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Clerk\Backend;
use Clerk\Backend\Models\Operations;

$security = '<YOUR_BEARER_TOKEN_HERE>';

$sdk = Backend\ClerkBackend::builder()->setSecurity($security)->build();

$requestBody = new Operations\UpdatePhoneNumberRequestBody();

$response = $sdk->phoneNumbers->update(
    phoneNumberId: '<id>',
    requestBody: $requestBody

);

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

Parameters

Parameter Type Required Description
phoneNumberId string ✔️ The ID of the phone number to update
requestBody ?Operations\UpdatePhoneNumberRequestBody N/A

Response

?Operations\UpdatePhoneNumberResponse

Errors

Error Type Status Code Content Type
Errors\ClerkErrors10 400, 401, 403, 404 application/json
Errors\SDKException 4XX, 5XX */*