-
Notifications
You must be signed in to change notification settings - Fork 69
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 #53 from amadeus4dev/seatmaps
Add support for SeatMap
- Loading branch information
Showing
5 changed files
with
223 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package com.amadeus.resources; | ||
|
||
import lombok.Getter; | ||
import lombok.ToString; | ||
|
||
/** | ||
* An SeatMap object as returned by the SeatMap API. | ||
* @see com.amadeus.booking.SeatMaps#get() | ||
* @see com.amadeus.booking.SeatMaps#post() */ | ||
@ToString | ||
public class SeatMap extends Resource { | ||
protected SeatMap() {} | ||
|
||
private @Getter String type; | ||
private @Getter String flightOfferid; | ||
private @Getter String segmentid; | ||
private @Getter String carrierCode; | ||
private @Getter String number; | ||
private @Getter Aircraft aircraft; | ||
private @Getter Departure departure; | ||
private @Getter Deck[] decks; | ||
|
||
@ToString | ||
public class Aircraft { | ||
protected Aircraft() { | ||
} | ||
|
||
private @Getter String code; | ||
} | ||
|
||
@ToString | ||
public class Departure { | ||
protected Departure() { | ||
} | ||
|
||
private @Getter String iataCode; | ||
private @Getter String at; | ||
} | ||
|
||
@ToString | ||
public class Arrival { | ||
protected Arrival() { | ||
} | ||
|
||
private @Getter String iataCode; | ||
} | ||
|
||
@ToString | ||
public class Deck { | ||
protected Deck() { | ||
} | ||
|
||
private @Getter String deckType; | ||
private @Getter DeckConfiguration deckConfiguration; | ||
|
||
} | ||
|
||
@ToString | ||
public class DeckConfiguration { | ||
protected DeckConfiguration() { | ||
} | ||
|
||
private @Getter int width; | ||
private @Getter int length; | ||
private @Getter int startseatRow; | ||
private @Getter int endSeatRow; | ||
private @Getter int startWingsRow; | ||
private @Getter int endWingsRow; | ||
private @Getter int startWingsX; | ||
private @Getter int endWingsX; | ||
|
||
} | ||
|
||
} |
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,109 @@ | ||
package com.amadeus.shopping; | ||
|
||
import com.amadeus.Amadeus; | ||
import com.amadeus.Params; | ||
import com.amadeus.Response; | ||
import com.amadeus.exceptions.ResponseException; | ||
import com.amadeus.resources.Resource; | ||
import com.amadeus.resources.SeatMap; | ||
import com.google.gson.JsonObject; | ||
|
||
/** | ||
* <p> | ||
* A namespaced client for the | ||
* <code>/v1/shopping/seatmaps</code> endpoints. | ||
* </p> | ||
* | ||
* <p> | ||
* Access via the Amadeus client object. | ||
* </p> | ||
* | ||
* <pre> | ||
* Amadeus amadeus = Amadeus.builder(API_KEY, API_SECRET).build(); | ||
* amadeus.shopping.seatMaps;</pre> | ||
*/ | ||
public class SeatMaps { | ||
private Amadeus client; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @hide | ||
*/ | ||
public SeatMaps(Amadeus client) { | ||
this.client = client; | ||
} | ||
|
||
/** | ||
* <p> | ||
* The SeatMap API allows you to retrieve the seat map of one or several | ||
* flights based on the flight-orderId returned by the Flight Create Orders API. | ||
* </p> | ||
* | ||
* <pre> | ||
* amadeus.shopping.seatMaps.get(params);</pre> | ||
* | ||
* @param params the parameters to send to the API | ||
* @return an API resource | ||
* @throws ResponseException when an exception occurs | ||
*/ | ||
public SeatMap[] get(Params params) throws ResponseException { | ||
Response response = client.get("/v1/shopping/seatmaps", params); | ||
return (SeatMap[]) Resource.fromArray(response, SeatMap[].class); | ||
} | ||
|
||
/** | ||
* Convenience method for calling <code>get</code> without any parameters. | ||
* @see SeatMaps#get() | ||
*/ | ||
public SeatMap[] get() throws ResponseException { | ||
return get(null); | ||
} | ||
|
||
/** | ||
* <p> | ||
* The SeatMap API allows you to retrieve the seat map of one or several | ||
* Take the body of a flight offer search or flight offer price and pass | ||
* it in to this method to get a seatmap. | ||
* </p> | ||
* | ||
* <pre> | ||
* amadeus.shopping.seatMaps.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 SeatMap[] post(JsonObject body) throws ResponseException { | ||
Response response = client.post("/v1/shopping/seatmaps", body); | ||
return (SeatMap[]) Resource.fromArray(response, SeatMap[].class); | ||
} | ||
|
||
/** | ||
* <p> | ||
* The SeatMap API allows you to retrieve the seat map of one or several | ||
* Take the body of a flight offer search or flight offer price and pass | ||
* it in to this method to get a seatmap. | ||
* </p> | ||
* | ||
* <pre> | ||
* amadeus.shopping.seatMaps.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 SeatMap[] post(String body) throws ResponseException { | ||
Response response = client.post("/v1/shopping/seatmaps", body); | ||
return (SeatMap[]) Resource.fromArray(response, SeatMap[].class); | ||
} | ||
|
||
/** | ||
* Convenience method for calling <code>post</code> without any parameters. | ||
* | ||
* @see SeatMaps#post() | ||
*/ | ||
public SeatMap[] post() throws ResponseException { | ||
return post((String) 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