diff --git a/src/main/java/com/vonage/client/verify2/TemplateFragment.java b/src/main/java/com/vonage/client/verify2/TemplateFragment.java index bea1d8e39..7045d096d 100644 --- a/src/main/java/com/vonage/client/verify2/TemplateFragment.java +++ b/src/main/java/com/vonage/client/verify2/TemplateFragment.java @@ -47,9 +47,10 @@ public final class TemplateFragment extends JsonableBaseObject { /** * Create a new template fragment. All parameters are required. * - * @param channel The channel type for the template. - * @param locale The BCP-47 locale for the template. - * @param text The text content of the template. + * @param channel Channel type for the template. + * @param locale BCP-47 locale for the template. + * @param text Text content of the template. There are 4 reserved variables available to use: + * {@code ${code}}, {@code ${brand}}, {@code ${time-limit}} and {@code ${time-limit-unit}}. */ public TemplateFragment(FragmentChannel channel, String locale, String text) { this(text); diff --git a/src/main/java/com/vonage/client/verify2/Verify2Client.java b/src/main/java/com/vonage/client/verify2/Verify2Client.java index 2f437b399..e5bd271bf 100644 --- a/src/main/java/com/vonage/client/verify2/Verify2Client.java +++ b/src/main/java/com/vonage/client/verify2/Verify2Client.java @@ -126,6 +126,7 @@ private UUID validateFragmentId(UUID fragmentId) { *
  • 409: Concurrent verifications to the same number are not allowed.
  • *
  • 422: The value of one or more parameters is invalid.
  • *
  • 429: Rate limit hit. Please wait and try again.
  • + *
  • 500: An error occurred on the Vonage platform.
  • * */ public VerificationResponse sendVerification(VerificationRequest request) { @@ -139,23 +140,24 @@ public VerificationResponse sendVerification(VerificationRequest request) { /** * Check a supplied code against an existing verification request. If the code is valid, - * this method will return normally. Otherwise, a {@link VerifyResponseException} will be - * thrown with the following status and reasons: - * - * + * this method will return normally. Otherwise, a {@link VerifyResponseException} will be thrown. * * @param requestId ID of the verify request, obtained from {@link VerificationResponse#getRequestId()}. * @param code The code supplied by the user. * * @return Details of the verification request (if the code matched). * - * @throws VerifyResponseException If the code was invalid, or any other error. + * @throws VerifyResponseException If the code could not be verified. This could be for the following reasons: + * */ public VerifyCodeResponse checkVerificationCode(UUID requestId, String code) { return verifyRequest.execute(new VerifyCodeRequestWrapper( @@ -171,7 +173,13 @@ public VerifyCodeResponse checkVerificationCode(UUID requestId, String code) { * * @param requestId ID of the verify request, obtained from {@link VerificationResponse#getRequestId()}. * - * @throws VerifyResponseException If the request ID was not found, or it has been verified already. + * @throws VerifyResponseException If the request could not be cancelled. This could be for the following reasons: + * */ public void cancelVerification(UUID requestId) { cancel.execute(validateRequestId(requestId)); @@ -179,61 +187,220 @@ public void cancelVerification(UUID requestId) { /** * Move the request onto the next workflow, if available. If successful, this method will return normally. - * Otherwise, a {@link VerifyResponseException} will be thrown with the following status and reasons: + * Otherwise, a {@link VerifyResponseException} will be thrown. + * + * @param requestId ID of the verify request, obtained from {@link VerificationResponse#getRequestId()}. * + * @throws VerifyResponseException If the workflow could not be advanced. This could be for the following reasons: * * - * @param requestId ID of the verify request, obtained from {@link VerificationResponse#getRequestId()}. - * - * @throws VerifyResponseException If the request ID was not found. * @since 8.5.0 */ public void nextWorkflow(UUID requestId) { nextWorkflow.execute(validateRequestId(requestId)); } + /** + * Create a new custom template. + * + * @param name Reference name for the template. Must not contain spaces or special characters other than _ and -. + * + * @return The created template metadata. + * + * @throws VerifyResponseException If the template could not be created. This could be for the following reasons: + * + * + * @since 8.13.0 + */ public Template createTemplate(String name) { return createTemplate.execute(new Template(Objects.requireNonNull(name, "Name is required."), null)); } + /** + * List all custom templates associated with the account. + * + * @return The list of templates. + * + * @throws VerifyResponseException If the templates could not be retrieved. This could be for the following reasons: + * + * + * @since 8.13.0 + */ public List