All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sportdataapi.client.BookmakersClient Maven / Gradle / Ivy

The newest version!
/**
 * 
 */
package com.sportdataapi.client;

import java.util.List;

import javax.ws.rs.NotFoundException;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.GenericType;

import com.sportdataapi.data.Bookmaker;
import com.sportdataapi.util.AbstractClient;
import com.sportdataapi.util.Response;

/**
 * The bookmakers client.
 * 

Attention! You shall never create this client directly but use {@link SoccerClient#bookmakers()} instead.

* @author ralph * */ public class BookmakersClient extends AbstractClient { /** * Constructor. * @param target - the target to request */ public BookmakersClient(WebTarget target) { super(target.path("bookmakers")); } /** * Request and return the list of bookmakers. * @return list of bookmakers */ public List list() { Response> response = getRequest().get(new GenericType>>() {}); return response.getData(); } /** * Request and returns a specific bookmaker. * @param id - id of bookmaker * @return the bookmaker requested or {@code null} */ public Bookmaker get(int id) { try { Response response = registerRequest(getTarget().path(""+id)).request().get(new GenericType>() {}); return response.getData(); } catch (NotFoundException e) { return null; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy