-
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.
add ApiError model and TooManyRequestsException
- Loading branch information
Showing
13 changed files
with
154 additions
and
21 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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package de.saibotk.jmaw; | ||
|
||
import com.google.gson.annotations.Expose; | ||
import com.google.gson.annotations.SerializedName; | ||
|
||
/** | ||
* Simple error model. This is sometimes returned by the API for requests that are invalid or eg. when the rate limit | ||
* was exceeded. | ||
* | ||
* @author saibotk | ||
* @since 1.0 | ||
*/ | ||
public class ApiError { | ||
|
||
@SerializedName("error") | ||
@Expose | ||
private String error; | ||
|
||
@SerializedName("errorMessage") | ||
@Expose | ||
private String errorMessage; | ||
|
||
/** | ||
* Returns the error name. | ||
* | ||
* @return name of the error. | ||
* @since 1.0 | ||
*/ | ||
public String getError() { | ||
return error; | ||
} | ||
|
||
/** | ||
* Sets the error name. | ||
* This will not modify anything on the Mojang account / API. | ||
* | ||
* @param error the error name. | ||
* @since 1.0 | ||
*/ | ||
void setError(String error) { | ||
this.error = error; | ||
} | ||
|
||
/** | ||
* Returns the error message. | ||
* | ||
* @return error message. | ||
* @since 1.0 | ||
*/ | ||
public String getErrorMessage() { | ||
return errorMessage; | ||
} | ||
|
||
/** | ||
* Sets the error message. | ||
* This will not modify anything on the Mojang account / API. | ||
* @param errorMessage error message. | ||
* @since 1.0 | ||
*/ | ||
void setErrorMessage(String errorMessage) { | ||
this.errorMessage = errorMessage; | ||
} | ||
} |
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
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
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
3 changes: 2 additions & 1 deletion
3
src/main/java/de/saibotk/jmaw/PlayerTexturesPropertyDeserializer.java
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
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
22 changes: 22 additions & 0 deletions
22
src/main/java/de/saibotk/jmaw/TooManyRequestsException.java
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package de.saibotk.jmaw; | ||
|
||
import retrofit2.Response; | ||
|
||
/** | ||
* This represents the TooManyRequestsException returned by the API. | ||
* | ||
* @author saibotk | ||
* @since 1.0 | ||
*/ | ||
public class TooManyRequestsException extends ApiResponseException { | ||
|
||
/** | ||
* The TooManyRequestsException constructor will set the error message and the response associated with the exception. | ||
* | ||
* @param response the response associated to the exception. | ||
* @since 1.0 | ||
*/ | ||
TooManyRequestsException(Response response) { | ||
super(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
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
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
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
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
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