-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from anthonyroux/flight_choice_prediction
ADD Flight Choice Prediction + fix POST
- Loading branch information
Showing
13 changed files
with
280 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
src/main/java/com/amadeus/shopping/flightOffers/Prediction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package com.amadeus.shopping.flightOffers; | ||
|
||
import com.amadeus.Amadeus; | ||
import com.amadeus.Response; | ||
import com.amadeus.exceptions.ResponseException; | ||
import com.amadeus.resources.FlightOffer; | ||
import com.amadeus.resources.Resource; | ||
|
||
import com.google.gson.JsonObject; | ||
|
||
|
||
|
||
|
||
|
||
/** | ||
* <p> | ||
* A namespaced client for the | ||
* <code>/v1/shopping/flight-offers/prediction</code> endpoints. | ||
* </p> | ||
* | ||
* <p> | ||
* Access via the Amadeus client object. | ||
* </p> | ||
* | ||
* <pre> | ||
* Amadeus amadeus = Amadeus.builder(API_KEY, API_SECRET).build(); | ||
* amadeus.shopping.flightOffers.prediction;</pre> | ||
*/ | ||
public class Prediction { | ||
|
||
private Amadeus client; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @hide | ||
*/ | ||
public Prediction(Amadeus client) { | ||
this.client = client; | ||
} | ||
|
||
/** | ||
* <p> | ||
* This machine learning API is based on a prediction model that takes the response of a flight | ||
* search as input (Flight Low-fare Search) and predict, for each itinerary, the probably for a | ||
* travel to select it. | ||
* </p> | ||
* | ||
* <pre> | ||
* amadeus.shopping.flightOffers.prediction.post(body);</pre> | ||
* | ||
* @param body the parameters to send to the API as a JSonObject | ||
* @return an API resource | ||
* @throws ResponseException when an exception occurs | ||
*/ | ||
public FlightOffer[] post(JsonObject body) throws ResponseException { | ||
Response response = client.post("/v1/shopping/flight-offers/prediction", body); | ||
return (FlightOffer[]) Resource.fromArray(response, FlightOffer[].class); | ||
} | ||
|
||
/** | ||
* <p> | ||
* This machine learning API is based on a prediction model that takes the response of a flight | ||
* search as input (Flight Low-fare Search) and predict, for each itinerary, the probably for a | ||
* travel to select it. | ||
* </p> | ||
* | ||
* <pre> | ||
* amadeus.shopping.flightOffers.prediction.post(body);</pre> | ||
* | ||
* @param body the parameters to send to the API as a String | ||
* @return an API resource | ||
* @throws ResponseException when an exception occurs | ||
*/ | ||
public FlightOffer[] post(String body) throws ResponseException { | ||
Response response = client.post("/v1/shopping/flight-offers/prediction", body); | ||
return (FlightOffer[]) Resource.fromArray(response, FlightOffer[].class); | ||
} | ||
|
||
/** | ||
* Convenience method for calling <code>post</code> without any parameters. | ||
* | ||
* @see Prediction#post() | ||
*/ | ||
public FlightOffer[] post() throws ResponseException { | ||
return post((String) null); | ||
} | ||
} |
Oops, something went wrong.