summaryrefslogtreecommitdiff
path: root/src/io/Response.java
blob: b2681a8b47fee2c2443ac099acbd1715cf225057 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package io;

import com.google.gson.JsonElement;

/**
 * A response object with the Jsonelement and rate limit values.
 *
 * @author Maurice Laveaux
 */
public class Response {

    private final JsonElement element;

    private final long rateLimitReset;
    
    private final long timeRemaining;

    private final int rateLimitRemaining;

    private final int rateLimit;

    public Response(JsonElement resp, int rateLimit, int rateLimitRemaining, long rateLimitReset, long timeRemaining) {
        this.element = resp;
        this.rateLimit = rateLimit;
        this.rateLimitRemaining = rateLimitRemaining;
        this.rateLimitReset = rateLimitReset;
        this.timeRemaining = timeRemaining;
    }

    public JsonElement getJson() {
        return element;
    }

    public int getRateLimit() {
        return this.rateLimit;
    }

    public int getRateLimitRemaining() {
        return this.rateLimitRemaining;
    }

    public long getRateLimitReset() {
        return this.rateLimitReset;
    }

    /**
     * @return Time in milliseconds that should be waited for before a new
     * similar request can be executed.
     */
    public long getRateLimitRemainingTime() {
        return this.timeRemaining;
    }
}