Skip to content

Latest commit

 

History

History
291 lines (228 loc) · 12.9 KB

README.md

File metadata and controls

291 lines (228 loc) · 12.9 KB

PhoneNumbers

(phoneNumbers())

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

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.components.*;
import com.clerk.backend_api.models.components.Security;
import com.clerk.backend_api.models.operations.*;
import com.clerk.backend_api.utils.EventStream;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;

public class Application {

    public static void main(String[] args) throws Exception {
        try {
            Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
                .build();

            CreatePhoneNumberRequestBody req = CreatePhoneNumberRequestBody.builder()
                .build();

            CreatePhoneNumberResponse res = sdk.phoneNumbers().create()
                .request(req)
                .call();

            if (res.phoneNumber().isPresent()) {
                // handle response
            }
        } catch (com.clerk.backend_api.models.errors.ClerkErrors e) {
            // handle exception
            throw e;
        } catch (com.clerk.backend_api.models.errors.SDKError e) {
            // handle exception
            throw e;
        } catch (Exception e) {
            // handle exception
            throw e;
        }
    }
}

Parameters

Parameter Type Required Description
request com.clerk.backend_api.models.operations.CreatePhoneNumberRequestBody ✔️ The request object to use for the request.

Response

Optional<? extends com.clerk.backend_api.models.operations.CreatePhoneNumberResponse>

Errors

Error Object Status Code Content Type
models/errors/ClerkErrors 400,401,403,404,422 application/json
models/errors/SDKError 4xx-5xx /

get

Returns the details of a phone number

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.components.*;
import com.clerk.backend_api.models.components.Security;
import com.clerk.backend_api.models.operations.*;
import com.clerk.backend_api.utils.EventStream;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;

public class Application {

    public static void main(String[] args) throws Exception {
        try {
            Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
                .build();

            GetPhoneNumberResponse res = sdk.phoneNumbers().get()
                .phoneNumberId("<value>")
                .call();

            if (res.phoneNumber().isPresent()) {
                // handle response
            }
        } catch (com.clerk.backend_api.models.errors.ClerkErrors e) {
            // handle exception
            throw e;
        } catch (com.clerk.backend_api.models.errors.SDKError e) {
            // handle exception
            throw e;
        } catch (Exception e) {
            // handle exception
            throw e;
        }
    }
}

Parameters

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

Response

Optional<? extends com.clerk.backend_api.models.operations.GetPhoneNumberResponse>

Errors

Error Object Status Code Content Type
models/errors/ClerkErrors 400,401,403,404 application/json
models/errors/SDKError 4xx-5xx /

delete

Delete the phone number with the given ID

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.components.*;
import com.clerk.backend_api.models.components.Security;
import com.clerk.backend_api.models.operations.*;
import com.clerk.backend_api.utils.EventStream;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;

public class Application {

    public static void main(String[] args) throws Exception {
        try {
            Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
                .build();

            DeletePhoneNumberResponse res = sdk.phoneNumbers().delete()
                .phoneNumberId("<value>")
                .call();

            if (res.deletedObject().isPresent()) {
                // handle response
            }
        } catch (com.clerk.backend_api.models.errors.ClerkErrors e) {
            // handle exception
            throw e;
        } catch (com.clerk.backend_api.models.errors.SDKError e) {
            // handle exception
            throw e;
        } catch (Exception e) {
            // handle exception
            throw e;
        }
    }
}

Parameters

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

Response

Optional<? extends com.clerk.backend_api.models.operations.DeletePhoneNumberResponse>

Errors

Error Object Status Code Content Type
models/errors/ClerkErrors 400,401,403,404 application/json
models/errors/SDKError 4xx-5xx /

update

Updates a phone number

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.components.*;
import com.clerk.backend_api.models.components.Security;
import com.clerk.backend_api.models.operations.*;
import com.clerk.backend_api.utils.EventStream;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;

public class Application {

    public static void main(String[] args) throws Exception {
        try {
            Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
                .build();

            UpdatePhoneNumberResponse res = sdk.phoneNumbers().update()
                .phoneNumberId("<value>")
                .requestBody(UpdatePhoneNumberRequestBody.builder()
                    .build())
                .call();

            if (res.phoneNumber().isPresent()) {
                // handle response
            }
        } catch (com.clerk.backend_api.models.errors.ClerkErrors e) {
            // handle exception
            throw e;
        } catch (com.clerk.backend_api.models.errors.SDKError e) {
            // handle exception
            throw e;
        } catch (Exception e) {
            // handle exception
            throw e;
        }
    }
}

Parameters

Parameter Type Required Description
phoneNumberId String ✔️ The ID of the phone number to update
requestBody Optional<? extends com.clerk.backend_api.models.operations.UpdatePhoneNumberRequestBody> N/A

Response

Optional<? extends com.clerk.backend_api.models.operations.UpdatePhoneNumberResponse>

Errors

Error Object Status Code Content Type
models/errors/ClerkErrors 400,401,403,404 application/json
models/errors/SDKError 4xx-5xx /