-
Notifications
You must be signed in to change notification settings - Fork 408
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'RohanTalip-tidy' into main
- Loading branch information
Showing
19 changed files
with
887 additions
and
562 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; | ||
} | ||
} |
Oops, something went wrong.