87 lines
1.8 KiB
Java
Raw Normal View History

package de.svenkubiak.jpushover.http;
2015-01-07 13:16:55 +01:00
2015-01-08 08:12:55 +01:00
/**
2015-12-08 22:03:44 +01:00
*
2015-01-08 08:12:55 +01:00
* @author svenkubiak
*
*/
public class PushoverResponse {
2015-01-07 20:11:23 +01:00
private String pushoverResponse;
2020-07-26 12:30:52 +02:00
private long pushoverLimit;
private long pushoverRemaining;
private long pushoverReset;
2020-07-26 19:06:36 +02:00
private int pushoverHttpStatus;
private boolean pushoverSuccessful;
2020-07-26 12:30:52 +02:00
public PushoverResponse response(String response) {
2015-01-07 20:11:23 +01:00
this.pushoverResponse = response;
2015-01-07 13:16:55 +01:00
return this;
}
public PushoverResponse httpStatus(int httpStatus) {
2015-01-07 20:11:23 +01:00
this.pushoverHttpStatus = httpStatus;
2015-01-07 13:16:55 +01:00
return this;
}
public PushoverResponse isSuccessful(boolean successful) {
2015-01-07 20:11:23 +01:00
this.pushoverSuccessful = successful;
2015-01-07 13:16:55 +01:00
return this;
}
2020-07-26 12:30:52 +02:00
public PushoverResponse limit(long limit) {
this.pushoverLimit = limit;
return this;
}
public PushoverResponse remaining(long remaining) {
this.pushoverRemaining = remaining;
return this;
}
public PushoverResponse reset(long reset) {
this.pushoverReset = reset;
return this;
}
2015-01-07 13:16:55 +01:00
/**
2015-12-10 11:17:36 +01:00
* @return The pushover response
2015-01-07 13:16:55 +01:00
*/
public String getResponse() {
2015-01-07 20:11:23 +01:00
return pushoverResponse;
2015-01-07 13:16:55 +01:00
}
/**
2015-12-10 11:17:36 +01:00
* @return The HTTP status
2015-01-07 13:16:55 +01:00
*/
public int getHttpStatus() {
2015-01-07 20:11:23 +01:00
return pushoverHttpStatus;
2015-01-07 13:16:55 +01:00
}
/**
* @return true if the API returned a HTTP status code 200, false otherwise
2015-01-07 13:16:55 +01:00
*/
public boolean isSuccessful() {
2015-01-07 20:11:23 +01:00
return pushoverSuccessful;
2015-01-07 13:16:55 +01:00
}
2020-07-26 12:30:52 +02:00
/**
* @return The API rate limit
*/
public long getLimit() {
return pushoverLimit;
}
/**
* @return The remaining allowed API requests
*/
public long getRemaining() {
return pushoverRemaining;
}
/**
* @return The API rate limit reset timestamp
*/
public long getReset() {
return pushoverReset;
}
2015-01-07 13:16:55 +01:00
}