Clarify default value for `includeE164`
This commit is contained in:
parent
a7d5d51fb4
commit
8088b58b3b
|
@ -24,6 +24,7 @@ import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.ws.rs.BadRequestException;
|
import javax.ws.rs.BadRequestException;
|
||||||
|
import javax.ws.rs.DefaultValue;
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.PathParam;
|
import javax.ws.rs.PathParam;
|
||||||
|
@ -66,14 +67,13 @@ public class CertificateController {
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@Path("/delivery")
|
@Path("/delivery")
|
||||||
public DeliveryCertificate getDeliveryCertificate(@Auth AuthenticatedAccount auth,
|
public DeliveryCertificate getDeliveryCertificate(@Auth AuthenticatedAccount auth,
|
||||||
@QueryParam("includeE164") Optional<Boolean> maybeIncludeE164)
|
@QueryParam("includeE164") @DefaultValue("true") boolean includeE164)
|
||||||
throws InvalidKeyException {
|
throws InvalidKeyException {
|
||||||
|
|
||||||
if (Util.isEmpty(auth.getAccount().getIdentityKey())) {
|
if (Util.isEmpty(auth.getAccount().getIdentityKey())) {
|
||||||
throw new WebApplicationException(Response.Status.BAD_REQUEST);
|
throw new WebApplicationException(Response.Status.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean includeE164 = maybeIncludeE164.orElse(true);
|
|
||||||
|
|
||||||
Metrics.counter(GENERATE_DELIVERY_CERTIFICATE_COUNTER_NAME, INCLUDE_E164_TAG_NAME, String.valueOf(includeE164))
|
Metrics.counter(GENERATE_DELIVERY_CERTIFICATE_COUNTER_NAME, INCLUDE_E164_TAG_NAME, String.valueOf(includeE164))
|
||||||
.increment();
|
.increment();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue