forked from sendgrid/sendgrid-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- (Mostly) automatically reformatted code using IntelliJ IDEA to match the Google Style Guide (as documented in CONTRIBUTING.md). - 2 space indent, where it wasn't already. - Line wrap at 100 characters, where it wasn't already. - Wildcard imports were replaced with explicit imports. - Unused imports were removed. - Annotations were put onto their own line, and additional lines added for readability where necessary. - Braces were added to if-statements that didn't already have them. - Also made some minor edits, e.g. as suggested by IntelliJ IDEA (e.g. public --> private). This will help with getting the code into shape before style conformance is required as per issue sendgrid#472 and pull request sendgrid#496. See also: - https://github.com/google/google-java-format - https://plugins.jetbrains.com/plugin/8527-google-java-format - https://github.com/google/styleguide/blob/gh-pages/intellij-java-google-style.xml
- Loading branch information
1 parent
5b10cf9
commit e2e146b
Showing
23 changed files
with
1,040 additions
and
660 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
package com.sendgrid; | ||
|
||
/** | ||
* An interface describing a callback mechanism for the | ||
* asynchronous, rate limit aware API connection. | ||
* An interface describing a callback mechanism for the asynchronous, rate limit aware API | ||
* connection. | ||
*/ | ||
public interface APICallback { | ||
/** | ||
* Callback method in case of an error. | ||
* @param ex the error that was thrown. | ||
*/ | ||
void error(Exception ex); | ||
|
||
/** | ||
* Callback method in case of a valid response. | ||
* @param response the valid response. | ||
*/ | ||
void response(Response response); | ||
/** | ||
* Callback method in case of an error. | ||
* | ||
* @param ex the error that was thrown. | ||
*/ | ||
void error(Exception ex); | ||
|
||
/** | ||
* Callback method in case of a valid response. | ||
* | ||
* @param response the valid response. | ||
*/ | ||
void response(Response response); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,40 @@ | ||
package com.sendgrid; | ||
|
||
/** | ||
* An exception thrown when the maximum number of retries | ||
* have occurred, and the API calls are still rate limited. | ||
* An exception thrown when the maximum number of retries have occurred, and the API calls are still | ||
* rate limited. | ||
*/ | ||
public class RateLimitException extends Exception { | ||
private final Request request; | ||
private final int retryCount; | ||
|
||
/** | ||
* Construct a new exception. | ||
* @param request the originating request object. | ||
* @param retryCount the number of times a retry was attempted. | ||
*/ | ||
public RateLimitException(Request request, int retryCount) { | ||
this.request = request; | ||
this.retryCount = retryCount; | ||
} | ||
private final Request request; | ||
private final int retryCount; | ||
|
||
/** | ||
* Get the originating request object. | ||
* @return the request object. | ||
*/ | ||
public Request getRequest() { | ||
return this.request; | ||
} | ||
/** | ||
* Construct a new exception. | ||
* | ||
* @param request the originating request object. | ||
* @param retryCount the number of times a retry was attempted. | ||
*/ | ||
public RateLimitException(Request request, int retryCount) { | ||
this.request = request; | ||
this.retryCount = retryCount; | ||
} | ||
|
||
/** | ||
* Get the number of times the action was attemted. | ||
* @return the retry count. | ||
*/ | ||
public int getRetryCount() { | ||
return this.retryCount; | ||
} | ||
/** | ||
* Get the originating request object. | ||
* | ||
* @return the request object. | ||
*/ | ||
public Request getRequest() { | ||
return this.request; | ||
} | ||
|
||
/** | ||
* Get the number of times the action was attemted. | ||
* | ||
* @return the retry count. | ||
*/ | ||
public int getRetryCount() { | ||
return this.retryCount; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.