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

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

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

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

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

/**
 * The odds client.
 * 

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

* @author ralph * */ public class OddsClient extends AbstractClient { /** * Constructor. * @param target - the target to request */ public OddsClient(WebTarget target) { super(target.path("odds")); } /** * Request and return the prematch odds for a match. * @param matchId - ID of match * @return list of prematch odds */ public Odds getPrematch(int matchId) { Response response = registerRequest(getTarget().path(""+matchId).queryParam("type", "prematch")).request().get(new GenericType>() {}); try { return response.getData(); } catch (NotFoundException e) { return null; } } /** * Request and return the inplay odds for a match. * @param matchId - ID of match * @return list of inplay odds */ public Odds getInplay(int matchId) { try { Response response = registerRequest(getTarget().path(""+matchId).queryParam("type", "inplay")).request().get(new GenericType>() {}); return response.getData(); } catch (NotFoundException e) { return null; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy