@Override public QueueInformation retrieveOfflineQueue() throws IOException, ApiException { return get("/queue/offline-commands", CacheControl.FORCE_NETWORK, QueueInformation.class); }
@Override public ServerInformation getServerInformation() throws IOException, ApiException { return get("/information", CacheControl.FORCE_NETWORK, ServerInformation.class); }
@Override public DueQueueInformation retrieveDueQueue() throws IOException, ApiException { return get("/queue", CacheControl.FORCE_NETWORK, DueQueueInformation.class); }
@Override public QueueInformation getPlayerQueue(int id) throws IOException, ApiException { return get("/queue/online-commands/" + id, CacheControl.FORCE_NETWORK, QueueInformation.class); }
private <T> T get(String endpoint, Type type) throws IOException, ApiException { return get(endpoint, null, type); }
@Override public List<Coupon> getAllCoupons() throws IOException, ApiException { CouponListing listing = get("/coupons", CouponListing.class); if(listing == null){ return null; } return listing.getData(); }
@Override public Listing retrieveListing() throws IOException, ApiException { Listing listing = get("/listing", CacheControl.FORCE_NETWORK, Listing.class); if(listing != null) listing.order(); return listing; }
@Override public List<RecentPayment> getRecentPayments(int limit) throws IOException, ApiException { return get("/payments?limit=" + limit, CacheControl.FORCE_NETWORK, new TypeToken<List<RecentPayment>>() { }.getType()); }
@Override public Coupon getCoupon(int id) throws IOException, ApiException { CouponSingleListing listing = get("/coupons/" + id, CouponSingleListing.class); return listing.getData(); }