-
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 #83 from amadeus4dev/travel-recommendations
Add support for Travel Recommendations API
- Loading branch information
Showing
4 changed files
with
89 additions
and
0 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
62 changes: 62 additions & 0 deletions
62
src/main/java/com/amadeus/referenceData/RecommendedLocations.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,62 @@ | ||
package com.amadeus.referenceData; | ||
|
||
import com.amadeus.Amadeus; | ||
import com.amadeus.Params; | ||
import com.amadeus.Response; | ||
import com.amadeus.exceptions.ResponseException; | ||
import com.amadeus.resources.Location; | ||
import com.amadeus.resources.Resource; | ||
import com.google.gson.Gson; | ||
|
||
/** | ||
* <p> | ||
* A namespaced client for the | ||
* <code>/v1/reference-data/recommended-locations</code> endpoints. | ||
* </p> | ||
* | ||
* <p> | ||
* Access via the Amadeus client object. | ||
* </p> | ||
* | ||
* <pre> | ||
* Amadeus amadeus = Amadeus.builder("clientId", "secret").build(); | ||
* amadeus.referenceData.recommendedLocations;</pre> | ||
*/ | ||
public class RecommendedLocations { | ||
private Amadeus client; | ||
|
||
/** | ||
* Constructor. | ||
* @hide | ||
*/ | ||
public RecommendedLocations(Amadeus client) { | ||
this.client = client; | ||
} | ||
|
||
/** | ||
* <p> | ||
* Returns a list of destination recommendations. | ||
* </p> | ||
* | ||
* <pre> | ||
* amadeus.referenceData.recommendedLocations.get(Params | ||
* .with("cityCodes", "PAR") | ||
* .and("travelerCountryCode", "FR"));</pre> | ||
* | ||
* @param params the parameters to send to the API | ||
* @return an API response object | ||
* @throws ResponseException when an exception occurs | ||
*/ | ||
public Location[] get(Params params) throws ResponseException { | ||
Response response = client.get("/v1/reference-data/recommended-locations", params); | ||
return (Location[]) Resource.fromArray(response, Location[].class); | ||
} | ||
|
||
/** | ||
* Convenience method for calling <code>get</code> without any parameters. | ||
* @see Location#get() | ||
*/ | ||
public Location[] get() throws ResponseException { | ||
return get(null); | ||
} | ||
} |
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