(phoneNumbers())
- create - Create a phone number
- get - Retrieve a phone number
- delete - Delete a phone number
- update - Update a phone number
Create a new phone number
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;
}
}
}
Parameter | Type | Required | Description |
---|---|---|---|
request |
com.clerk.backend_api.models.operations.CreatePhoneNumberRequestBody | ✔️ | The request object to use for the request. |
Optional<? extends com.clerk.backend_api.models.operations.CreatePhoneNumberResponse>
Error Object | Status Code | Content Type |
---|---|---|
models/errors/ClerkErrors | 400,401,403,404,422 | application/json |
models/errors/SDKError | 4xx-5xx | / |
Returns the details of a phone number
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;
}
}
}
Parameter | Type | Required | Description |
---|---|---|---|
phoneNumberId |
String | ✔️ | The ID of the phone number to retrieve |
Optional<? extends com.clerk.backend_api.models.operations.GetPhoneNumberResponse>
Error Object | Status Code | Content Type |
---|---|---|
models/errors/ClerkErrors | 400,401,403,404 | application/json |
models/errors/SDKError | 4xx-5xx | / |
Delete the phone number with the given ID
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;
}
}
}
Parameter | Type | Required | Description |
---|---|---|---|
phoneNumberId |
String | ✔️ | The ID of the phone number to delete |
Optional<? extends com.clerk.backend_api.models.operations.DeletePhoneNumberResponse>
Error Object | Status Code | Content Type |
---|---|---|
models/errors/ClerkErrors | 400,401,403,404 | application/json |
models/errors/SDKError | 4xx-5xx | / |
Updates a phone number
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;
}
}
}
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 |
Optional<? extends com.clerk.backend_api.models.operations.UpdatePhoneNumberResponse>
Error Object | Status Code | Content Type |
---|---|---|
models/errors/ClerkErrors | 400,401,403,404 | application/json |
models/errors/SDKError | 4xx-5xx | / |