Skip to content

Commit

Permalink
style: apply sources format
Browse files Browse the repository at this point in the history
  • Loading branch information
JPPortier committed Dec 12, 2023
1 parent 7b128ca commit 4dd774d
Show file tree
Hide file tree
Showing 58 changed files with 270 additions and 141 deletions.
3 changes: 1 addition & 2 deletions client/src/main/com/sinch/sdk/SinchClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
public class SinchClient {

private static final String DEFAULT_PROPERTIES_FILE_NAME = "/config-default.properties";
private static final String VERSION_PROPERTIES_FILE_NAME = "/version.properties";
private static final String VERSION_PROPERTIES_FILE_NAME = "/version.properties";

private static final String OAUTH_URL_KEY = "oauth-url";
private static final String NUMBERS_SERVER_KEY = "numbers-server";
Expand Down Expand Up @@ -224,5 +224,4 @@ private String formatAuxiliaryFlag(String auxiliaryFlag) {
}
return String.join(",", values);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ public String getAccessToken() {
return accessToken;
}

/** @return Integer Token period expiration in seconds */
/**
* @return Integer Token period expiration in seconds
*/
public Integer getExpiresIn() {
return expiresIn;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public final class NumberType extends EnumDynamic<String, NumberType> {

/** Numbers that belong to a specific range. */
public static final NumberType MOBILE = new NumberType("MOBILE");

/** Numbers that are assigned to a specific geographic region. */
public static final NumberType LOCAL = new NumberType("LOCAL");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
public final class OrderBy extends EnumDynamic<String, OrderBy> {
/** Ordering by phoneNumber */
public static final OrderBy PHONE_NUMBER = new OrderBy("phoneNumber");

/** Ordering by displayName */
public static final OrderBy DISPLAY_NAME = new OrderBy("displayName");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ public final class SearchPattern extends EnumDynamic<String, SearchPattern> {
* <p>For example, to search for area code 206 in the US, you would enter, %2b1206
*/
public static final SearchPattern START = new SearchPattern("START");

/**
* The number pattern entered is contained somewhere in the number, the location being undefined.
*/
public static final SearchPattern CONTAINS = new SearchPattern("CONTAINS");

/** The number ends with the number pattern entered. */
public static final SearchPattern END = new SearchPattern("END");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ public class AvailableRegionListAllRequestParameters {

private final Collection<NumberType> types;

/** @param types Only return regions for which numbers are provided with the given types */
/**
* @param types Only return regions for which numbers are provided with the given types
*/
public AvailableRegionListAllRequestParameters(Collection<NumberType> types) {
this.types = types;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ public class CallbackConfigurationUpdateRequestParameters {
/** */
private final String hmacSecret;

/** @param hmacSecret The HMAC secret to be updated for the specified project */
/**
* @param hmacSecret The HMAC secret to be updated for the specified project
*/
public CallbackConfigurationUpdateRequestParameters(String hmacSecret) {
this.hmacSecret = hmacSecret;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,63 +19,80 @@ public class DeliveryReportErrorCode extends EnumDynamic<Integer, DeliveryReport
* account.
*/
public static final DeliveryReportErrorCode QUEUED = new DeliveryReportErrorCode(400);

/** Message has been dispatched to SMSC. */
public static final DeliveryReportErrorCode DISPATCHED = new DeliveryReportErrorCode(401);

/** SMSC rejected message. Retrying is likely to cause the same error. */
public static final DeliveryReportErrorCode MESSAGE_UNROUTABLE = new DeliveryReportErrorCode(402);

/** An unexpected error caused the message to fail. */
public static final DeliveryReportErrorCode INTERNAL_ERROR = new DeliveryReportErrorCode(403);

/** Message failed because of temporary delivery failure. Message can be retried. */
public static final DeliveryReportErrorCode TEMPORARY_DELIVERY_FAILURE =
new DeliveryReportErrorCode(404);

/**
* One or more parameters in the message body has no mapping for this recipient. See Message
* Parameterization
*/
public static final DeliveryReportErrorCode UNMATCHED_PARAMETER =
new DeliveryReportErrorCode(405);

/**
* Message was expired before reaching SMSC. This may happen if the expiry time for the message
* was very short.
*/
public static final DeliveryReportErrorCode INTERNAL_EXPIRY = new DeliveryReportErrorCode(406);

/** Message was cancelled by user before reaching SMSC. */
public static final DeliveryReportErrorCode CANCELLED = new DeliveryReportErrorCode(407);

/** SMSC rejected the message. Retrying is likely to cause the same error. */
public static final DeliveryReportErrorCode INTERNAL_REJECT = new DeliveryReportErrorCode(408);

/**
* No default originator exists/configured for this recipient when sending message without
* originator.
*/
public static final DeliveryReportErrorCode UNMATCHED_DEFAULT_ORIGINATOR =
new DeliveryReportErrorCode(410);

/**
* Message failed as the number of message parts exceeds the defined max number of message parts.
*/
public static final DeliveryReportErrorCode EXCEEDED_PARTS_LIMIT =
new DeliveryReportErrorCode(411);

/** SMSC rejected the message. The account hasn't been provisioned for this region. */
public static final DeliveryReportErrorCode UNPROVISIONED_REGION =
new DeliveryReportErrorCode(412);

/** The account is blocked. Reach out to support for help. Potentially out of credits. */
public static final DeliveryReportErrorCode BLOCKED = new DeliveryReportErrorCode(413);

/**
* MMS only, the request failed due to a bad media URL. It is possible that the URL was
* unreachable, or sent a bad response.
*/
public static final DeliveryReportErrorCode BAD_MEDIA = new DeliveryReportErrorCode(414);

/** MMS only, message reached MMSC but was rejected by MMS gateway or mobile network. */
public static final DeliveryReportErrorCode DELIVERY_REPORT_REJECTED =
new DeliveryReportErrorCode(415);

/** MMS only, message reached MMSC but it is not supported. */
public static final DeliveryReportErrorCode DELIVERY_REPORT_NOT_SUPPORTED =
new DeliveryReportErrorCode(416);

/**
* MMS only, message reached MMSC but the destination network or the mobile subscriber cannot be
* reached.
*/
public static final DeliveryReportErrorCode DELIVERY_REPORT_UNREACHABLE =
new DeliveryReportErrorCode(417);

/**
* MMS only, message reached MMSC but the handset of the mobile subscriber does not recognize the
* message content.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,37 @@ public class DeliveryReportStatus extends EnumDynamic<String, DeliveryReportStat
* account.
*/
public static final DeliveryReportStatus QUEUED = new DeliveryReportStatus("Queued");

/** Message has been dispatched and accepted for delivery by the SMSC. */
public static final DeliveryReportStatus DISPATCHED = new DeliveryReportStatus("Dispatched");

/** Message was aborted before reaching the SMSC. */
public static final DeliveryReportStatus ABORTED = new DeliveryReportStatus("Aborted");

/** Message was cancelled by user before reaching SMSC. */
public static final DeliveryReportStatus CANCELLED = new DeliveryReportStatus("Cancelled");

/** Message was rejected by the SMSC. */
public static final DeliveryReportStatus REJECTED = new DeliveryReportStatus("Rejected");

/**
* Message has been deleted. Message was deleted by a remote SMSC. This may happen if the
* destination is an invalid MSISDN or opted out subscriber.
*/
public static final DeliveryReportStatus DELETED = new DeliveryReportStatus("Deleted");

/** Message has been delivered. */
public static final DeliveryReportStatus DELIVERED = new DeliveryReportStatus("Delivered");

/** Message failed to be delivered. */
public static final DeliveryReportStatus FAILED = new DeliveryReportStatus("Failed");

/**
* Message expired before delivery to the SMSC. This may happen if the expiry time for the message
* was very short.
*/
public static final DeliveryReportStatus EXPIRED = new DeliveryReportStatus("Expired");

/**
* Message was delivered to the SMSC but no Delivery Receipt has been received or a Delivery
* Receipt that couldn't be interpreted was received.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,23 @@ public class DeliveryReportType extends EnumDynamic<String, DeliveryReportType>

/** No delivery report callback will be sent. */
public static final DeliveryReportType NONE = new DeliveryReportType("none");

/** A single delivery report callback will be sent. */
public static final DeliveryReportType SUMMARY = new DeliveryReportType("summary");

/**
* A single delivery report callback will be sent which includes a list of recipients per delivery
* status.
*/
public static final DeliveryReportType FULL = new DeliveryReportType("full");

/**
* A delivery report callback will be sent for each status change of a message. This could result
* in a lot of callbacks and should be used with caution for larger batches. These delivery
* reports also include a timestamp of when the Delivery Report originated from the SMSC.
*/
public static final DeliveryReportType PER_RECIPIENT = new DeliveryReportType("per_recipient");

/**
* A delivery report callback representing the final status of a message will be sent for each
* recipient. This will send only one callback per recipient, compared to the multiple callbacks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class SendSmsBatchBinaryRequest extends BaseBatch<String> {
private final Integer fromTon;
private final Integer fromNpi;
private final String udh;

/**
* @param to List of Phone numbers and group IDs that will receive the batch
* @param from Sender number. Must be valid phone number, short code or alphanumeric. Required if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class SendSmsBatchTextRequest extends BaseBatch<String> {
private final Integer maxNumberOfMessageParts;
private final Integer fromTon;
private final Integer fromNpi;

/**
* @param to List of Phone numbers and group IDs that will receive the batch
* @param from Sender number. Must be valid phone number, short code or alphanumeric. Required if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

public class UpdateSmsBatchBinaryRequest extends UpdateBaseBatchRequest<String> {
private final String udh;

/**
* @param toAdd List of phone numbers and group IDs to add to the batch.List of Phone numbers and
* group IDs that will receive the batch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
public class UpdateSmsBatchMediaRequest extends UpdateBaseBatchRequest<MediaBody> {
private final Parameters parameters;
private final Boolean strictValidation;

/**
* @param toAdd List of phone numbers and group IDs to add to the batch.
* @param body The message content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

public class UpdateSmsBatchTextRequest extends UpdateBaseBatchRequest<String> {
private final Parameters parameters;

/**
* @param toAdd List of phone numbers and group IDs to add to the batch.
* @param toRemove List of phone numbers and group IDs to remove from the batch.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

/**
* Webhooks service
* <p>
* Callback events are used to authorize and manage your verification requests and return
*
* <p>Callback events are used to authorize and manage your verification requests and return
* verification results.
* <p>
* see <a
*
* <p>see <a
* href="https://developers.sinch.com/docs/verification/api-reference/verification/tag/Verification-callbacks/#tag/Verification-callbacks/paths/VerificationRequestEvent/post">https://developers.sinch.com/docs/verification/api-reference/verification/tag/Verification-callbacks/#tag/Verification-callbacks/paths/VerificationRequestEvent/post</a>
*
* @since 1.0
Expand All @@ -22,16 +22,17 @@ public interface WebHooksService {
* The Sinch Platform can initiate callback requests to a URL you define (Callback URL) on request
* and result events. All callback requests are signed using your Application key and secret pair
* found on your dashboard. The signature is included in the Authorization header of the request
*
* <p>By using following function, you can ensure authentication according to received payload
* from your backend</p>
* from your backend
*
* @param method The HTTP method used ot handle the callback
* @param path The path to you backend endpoint used for callback
* @param headers Received headers
* @param method The HTTP method used ot handle the callback
* @param path The path to you backend endpoint used for callback
* @param headers Received headers
* @param jsonPayload Received payload
* @return Is authentication is validated (true) or not (false)
*
* see <a href="https://developers.sinch.com/docs/verification/api-reference/authentication/callback-signed-request">https://developers.sinch.com/docs/verification/api-reference/authentication/callback-signed-request</a>
* <p>see <a
* href="https://developers.sinch.com/docs/verification/api-reference/authentication/callback-signed-request">https://developers.sinch.com/docs/verification/api-reference/authentication/callback-signed-request</a>
* @since 1.0
*/
boolean checkAuthentication(
Expand All @@ -43,8 +44,8 @@ boolean checkAuthentication(
*
* @param jsonPayload Received payload to be deserialized
* @return The verification event instance class
*
* see <a href="https://developers.sinch.com/docs/verification/api-reference/verification/tag/Verification-callbacks/">https://developers.sinch.com/docs/verification/api-reference/verification/tag/Verification-callbacks/</a>
* <p>see <a
* href="https://developers.sinch.com/docs/verification/api-reference/verification/tag/Verification-callbacks/">https://developers.sinch.com/docs/verification/api-reference/verification/tag/Verification-callbacks/</a>
* @since 1.0
*/
VerificationEvent unserializeVerificationEvent(String jsonPayload) throws ApiMappingException;
Expand All @@ -54,9 +55,9 @@ boolean checkAuthentication(
*
* @param response The response to be serialized
* @return The JSON string to be sent
*
* see <a href="https://developers.sinch.com/docs/verification/api-reference/verification/tag/Verification-callbacks/">https://developers.sinch.com/docs/verification/api-reference/verification/tag/Verification-callbacks/</a>
* @since 1.0
* <p>see <a
* href="https://developers.sinch.com/docs/verification/api-reference/verification/tag/Verification-callbacks/">https://developers.sinch.com/docs/verification/api-reference/verification/tag/Verification-callbacks/</a>
* @since 1.0
*/
String serializeVerificationResponse(VerificationResponse response) throws ApiMappingException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,10 @@ public class StatusService implements com.sinch.sdk.domains.verification.StatusS
private final QueryVerificationsApi api;

public StatusService(
Configuration configuration,
HttpClient httpClient,
Map<String, AuthManager> authManagers) {
this.api = new QueryVerificationsApi(
httpClient,
configuration.getVerificationServer(),
authManagers,
new HttpMapper());
Configuration configuration, HttpClient httpClient, Map<String, AuthManager> authManagers) {
this.api =
new QueryVerificationsApi(
httpClient, configuration.getVerificationServer(), authManagers, new HttpMapper());
}

protected QueryVerificationsApi getApi() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@ public class VerificationService implements com.sinch.sdk.domains.verification.V

public VerificationService(Configuration configuration, HttpClient httpClient) {

// Currently, we are not supporting unified credentials: ensure application credentials are defined
// Currently, we are not supporting unified credentials: ensure application credentials are
// defined
Objects.requireNonNull(configuration.getApplicationKey(), "'applicationKey' cannot be null");
Objects.requireNonNull(configuration.getApplicationSecret(),
"'applicationSecret' cannot be null");
Objects.requireNonNull(
configuration.getApplicationSecret(), "'applicationSecret' cannot be null");

this.configuration = configuration;
this.httpClient = httpClient;
setApplicationCredentials(configuration.getApplicationKey(),configuration.getApplicationSecret() );
setApplicationCredentials(
configuration.getApplicationKey(), configuration.getApplicationSecret());
}

private void setApplicationCredentials(String key, String secret) {
Expand Down Expand Up @@ -89,8 +91,7 @@ public WebHooksService webhooks() {
checkCredentials();
if (null == this.webhooks) {
this.webhooks =
new com.sinch.sdk.domains.verification.adapters.WebHooksService(
webhooksAuthManagers);
new com.sinch.sdk.domains.verification.adapters.WebHooksService(webhooksAuthManagers);
}
return this.webhooks;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,10 @@ public class VerificationsService
private final SendingAndReportingVerificationsApi api;

public VerificationsService(
Configuration configuration,
HttpClient httpClient,
Map<String, AuthManager> authManagers) {
this.api = new SendingAndReportingVerificationsApi(
httpClient,
configuration.getVerificationServer(),
authManagers,
new HttpMapper());
Configuration configuration, HttpClient httpClient, Map<String, AuthManager> authManagers) {
this.api =
new SendingAndReportingVerificationsApi(
httpClient, configuration.getVerificationServer(), authManagers, new HttpMapper());
}

protected SendingAndReportingVerificationsApi getApi() {
Expand Down
Loading

0 comments on commit 4dd774d

Please sign in to comment.