| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8ed52c6 commit 9e6cf0e
9 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -350,6 +350,10 @@ SeatMap[] seatmap = amadeus.shopping.seatMaps.get(Params | |||
| 350 | 350 | // What is the the seat map of a given flight? | |
| 351 | 351 | // The body can be a String version of your JSON or a JsonObject | |
| 352 | 352 | SeatMap[] seatmap = amadeus.shopping.seatMaps.post(body); | |
| 353 | + | ||
| 354 | + // AI-Generated Photos | ||
| 355 | + GeneratedPhoto photo = amadeus.media.files.generatedPhotos.get(Params | ||
| 356 | + .with("category", "BEACH")); | ||
| 353 | 357 | ``` | |
| 354 | 358 | ||
| 355 | 359 | ## Development & Contributing | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -69,6 +69,13 @@ public class Amadeus extends HTTPClient { | |||
| 69 | 69 | */ | |
| 70 | 70 | public Booking booking; | |
| 71 | 71 | ||
| 72 | + /** | ||
| 73 | + * <p> | ||
| 74 | + * A namespaced client for the <code>/v2/media</code> endpoints. | ||
| 75 | + * </p> | ||
| 76 | + */ | ||
| 77 | + public Media media; | ||
| 78 | + | ||
| 72 | 79 | protected Amadeus(Configuration configuration) { | |
| 73 | 80 | super(configuration); | |
| 74 | 81 | this.referenceData = new ReferenceData(this); | |
@@ -77,6 +84,8 @@ protected Amadeus(Configuration configuration) { | |||
| 77 | 84 | this.ereputation = new EReputation(this); | |
| 78 | 85 | this.airport = new Airport(this); | |
| 79 | 86 | this.booking = new Booking(this); | |
| 87 | + this.media = new Media(this); | ||
| 88 | + | ||
| 80 | 89 | } | |
| 81 | 90 | ||
| 82 | 91 | /** | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,37 @@ | |||
| 1 | + package com.amadeus; | ||
| 2 | + | ||
| 3 | + import com.amadeus.media.Files; | ||
| 4 | + | ||
| 5 | + /** | ||
| 6 | + * <p> | ||
| 7 | + * A namespaced client for the | ||
| 8 | + * <code>/v2/media</code> endpoints. | ||
| 9 | + * </p> | ||
| 10 | + * | ||
| 11 | + * <p> | ||
| 12 | + * Access via the Amadeus client object. | ||
| 13 | + * </p> | ||
| 14 | + * | ||
| 15 | + * <pre> | ||
| 16 | + * Amadeus amadeus = Amadeus.builder("clientId", "secret").build(); | ||
| 17 | + * amadeus.media;</pre> | ||
| 18 | + * | ||
| 19 | + * @hide | ||
| 20 | + */ | ||
| 21 | + public class Media { | ||
| 22 | + /** | ||
| 23 | + * <p> | ||
| 24 | + * A namespaced client for the | ||
| 25 | + * <code>/v2/media/files</code> endpoints. | ||
| 26 | + * </p> | ||
| 27 | + */ | ||
| 28 | + public Files files; | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * Constructor. | ||
| 32 | + * @hide | ||
| 33 | + */ | ||
| 34 | + public Media(Amadeus client) { | ||
| 35 | + this.files = new Files(client); | ||
| 36 | + } | ||
| 37 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,39 @@ | |||
| 1 | + package com.amadeus.media; | ||
| 2 | + | ||
| 3 | + import com.amadeus.Amadeus; | ||
| 4 | + import com.amadeus.media.files.GeneratedPhotos; | ||
| 5 | + | ||
| 6 | + /** | ||
| 7 | + * <p> | ||
| 8 | + * A namespaced client for the | ||
| 9 | + * <code>/v2/media/files</code> endpoints. | ||
| 10 | + * </p> | ||
| 11 | + * | ||
| 12 | + * <p> | ||
| 13 | + * Access via the Amadeus client object. | ||
| 14 | + * </p> | ||
| 15 | + * | ||
| 16 | + * <pre> | ||
| 17 | + * Amadeus amadeus = Amadeus.builder("clientId", "secret").build(); | ||
| 18 | + * amadeus.media.files;</pre> | ||
| 19 | + * | ||
| 20 | + * @hide | ||
| 21 | + */ | ||
| 22 | + public class Files { | ||
| 23 | + /** | ||
| 24 | + * <p> | ||
| 25 | + * A namespaced client for the | ||
| 26 | + * <code>/v2/media/files/generated-photos</code> endpoints. | ||
| 27 | + * </p> | ||
| 28 | + */ | ||
| 29 | + public GeneratedPhotos generatedPhotos; | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * Constructor. | ||
| 33 | + * | ||
| 34 | + * @hide | ||
| 35 | + */ | ||
| 36 | + public Files(Amadeus client) { | ||
| 37 | + this.generatedPhotos = new GeneratedPhotos(client); | ||
| 38 | + } | ||
| 39 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,60 @@ | |||
| 1 | + package com.amadeus.media.files; | ||
| 2 | + | ||
| 3 | + import com.amadeus.Amadeus; | ||
| 4 | + import com.amadeus.Params; | ||
| 5 | + import com.amadeus.Response; | ||
| 6 | + import com.amadeus.exceptions.ResponseException; | ||
| 7 | + import com.amadeus.resources.GeneratedPhoto; | ||
| 8 | + import com.amadeus.resources.Resource; | ||
| 9 | + | ||
| 10 | + /** | ||
| 11 | + * <p> | ||
| 12 | + * A namespaced client for the | ||
| 13 | + * <code>/v2/media/files/generated-photos</code> endpoints. | ||
| 14 | + * </p> | ||
| 15 | + * | ||
| 16 | + * <p> | ||
| 17 | + * Access via the Amadeus client object. | ||
| 18 | + * </p> | ||
| 19 | + * | ||
| 20 | + * <pre> | ||
| 21 | + * Amadeus amadeus = Amadeus.builder("clientId", "secret").build(); | ||
| 22 | + * amadeus.media.files.generatedPhotos;</pre> | ||
| 23 | + */ | ||
| 24 | + public class GeneratedPhotos { | ||
| 25 | + private Amadeus client; | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * Constructor. | ||
| 29 | + * @hide | ||
| 30 | + */ | ||
| 31 | + public GeneratedPhotos(Amadeus client) { | ||
| 32 | + this.client = client; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * <p> | ||
| 37 | + * Returns a link to download a rendered image of a landscape. | ||
| 38 | + * </p> | ||
| 39 | + * | ||
| 40 | + * <pre> | ||
| 41 | + * amadeus.media.files.generatedPhotos.get(Params | ||
| 42 | + * .with("category", "BEACH"));</pre> | ||
| 43 | + * | ||
| 44 | + * @param params the parameters to send to the API | ||
| 45 | + * @return an API response object | ||
| 46 | + * @throws ResponseException when an exception occurs | ||
| 47 | + */ | ||
| 48 | + public GeneratedPhoto get(Params params) throws ResponseException { | ||
| 49 | + Response response = client.get("/v2/media/files/generated-photos", params); | ||
| 50 | + return (GeneratedPhoto) Resource.fromObject(response, GeneratedPhoto.class); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * Convenience method for calling <code>get</code> without any parameters. | ||
| 55 | + * @see GeneratedPhotos#get() | ||
| 56 | + */ | ||
| 57 | + public GeneratedPhoto get() throws ResponseException { | ||
| 58 | + return get(null); | ||
| 59 | + } | ||
| 60 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,45 @@ | |||
| 1 | + package com.amadeus.resources; | ||
| 2 | + | ||
| 3 | + import lombok.Getter; | ||
| 4 | + import lombok.ToString; | ||
| 5 | + | ||
| 6 | + /** | ||
| 7 | + * An GeneratedPhoto object as returned by the AI-Generated Photos API. | ||
| 8 | + * @see Traveled#get() | ||
| 9 | + */ | ||
| 10 | + @ToString | ||
| 11 | + public class GeneratedPhoto extends Resource { | ||
| 12 | + protected GeneratedPhoto() {} | ||
| 13 | + | ||
| 14 | + private @Getter String type; | ||
| 15 | + private @Getter String owner; | ||
| 16 | + private @Getter String attachmentUri; | ||
| 17 | + private @Getter String description; | ||
| 18 | + private @Getter String fileKbSize; | ||
| 19 | + private @Getter String expirationDateTime; | ||
| 20 | + private @Getter MediaMetadata mediaMetadata; | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * A MediaMetadata-related object as returned by the AI-Generated Photos API. | ||
| 24 | + * @see GeneratedPhotos#get() | ||
| 25 | + */ | ||
| 26 | + @ToString | ||
| 27 | + public class MediaMetadata { | ||
| 28 | + protected MediaMetadata() {} | ||
| 29 | + | ||
| 30 | + private @Getter Dimension dimensions; | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * A MediaMetadata-related object as returned by the AI-Generated Photos API. | ||
| 34 | + * @see GeneratedPhotos#get() | ||
| 35 | + */ | ||
| 36 | + @ToString | ||
| 37 | + public class Dimension { | ||
| 38 | + protected Dimension() {} | ||
| 39 | + | ||
| 40 | + private @Getter String height; | ||
| 41 | + private @Getter String width; | ||
| 42 | + | ||
| 43 | + } | ||
| 44 | + } | ||
| 45 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,7 +4,7 @@ | |||
| 4 | 4 | import lombok.ToString; | |
| 5 | 5 | ||
| 6 | 6 | /** | |
| 7 | - * An PointOfInterest object as returned by the Locaion API. | ||
| 7 | + * An PointOfInterest object as returned by the Location API. | ||
| 8 | 8 | * @see com.amadeus.referenceData.locations.PointOfInterest#get() | |
| 9 | 9 | */ | |
| 10 | 10 | @ToString | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,34 @@ | |||
| 1 | + package examples.media.files; | ||
| 2 | + | ||
| 3 | + import com.amadeus.Amadeus; | ||
| 4 | + import com.amadeus.Params; | ||
| 5 | + import com.amadeus.exceptions.ResponseException; | ||
| 6 | + import com.amadeus.resources.GeneratedPhoto; | ||
| 7 | + | ||
| 8 | + public class AIGeneratedPhotos { | ||
| 9 | + /** | ||
| 10 | + * <p> | ||
| 11 | + * An example to call the AI-Generated Photos API | ||
| 12 | + * <code>/v2/media/files/generated-photos</code> endpoints. | ||
| 13 | + * </p> | ||
| 14 | + * | ||
| 15 | + * <p> | ||
| 16 | + * Access via the Amadeus client object. | ||
| 17 | + * </p> | ||
| 18 | + * | ||
| 19 | + * <pre> | ||
| 20 | + * Amadeus amadeus = Amadeus.builder("clientId", "secret").build(); | ||
| 21 | + * amadeus.media.files.generatedPhotos;</pre> | ||
| 22 | + */ | ||
| 23 | + public static void main(String[] args) throws ResponseException { | ||
| 24 | + | ||
| 25 | + | ||
| 26 | + Amadeus amadeus = Amadeus | ||
| 27 | + .builder("YOUR_API_ID","YOUR_API_SECRET") | ||
| 28 | + .build(); | ||
| 29 | + | ||
| 30 | + GeneratedPhoto photo = amadeus.media.files.generatedPhotos.get(Params | ||
| 31 | + .with("category", "BEACH")); | ||
| 32 | + System.out.println(photo); | ||
| 33 | + } | ||
| 34 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,6 +5,7 @@ | |||
| 5 | 5 | import com.amadeus.booking.FlightOrders; | |
| 6 | 6 | import com.amadeus.ereputation.HotelSentiments; | |
| 7 | 7 | import com.amadeus.exceptions.ResponseException; | |
| 8 | + import com.amadeus.media.files.GeneratedPhotos; | ||
| 8 | 9 | import com.amadeus.referenceData.Airlines; | |
| 9 | 10 | import com.amadeus.referenceData.Location; | |
| 10 | 11 | import com.amadeus.referenceData.Locations; | |
@@ -64,6 +65,7 @@ public void testAllNamespacesExist() { | |||
| 64 | 65 | TestCase.assertNotNull(client.shopping.hotelOffer("XXX")); | |
| 65 | 66 | TestCase.assertNotNull(client.airport.predictions.onTime); | |
| 66 | 67 | TestCase.assertNotNull(client.booking.flightOrder("XXX")); | |
| 68 | + TestCase.assertNotNull(client.media.files.generatedPhotos); | ||
| 67 | 69 | } | |
| 68 | 70 | ||
| 69 | 71 | @Before | |
@@ -298,6 +300,15 @@ public void testGetMethods() throws ResponseException { | |||
| 298 | 300 | FlightOrder flightOrder = new FlightOrder(client, "XXX"); | |
| 299 | 301 | TestCase.assertNotNull(flightOrder.get()); | |
| 300 | 302 | TestCase.assertNotNull(flightOrder.get(params)); | |
| 303 | + | ||
| 304 | + // Testing AI-generated photos | ||
| 305 | + Mockito.when(client.get("/v2/media/files/generated-photos", null)) | ||
| 306 | + .thenReturn(singleResponse); | ||
| 307 | + Mockito.when(client.get("/v2/media/files/generated-photos", params)) | ||
| 308 | + .thenReturn(singleResponse); | ||
| 309 | + GeneratedPhotos photo = new GeneratedPhotos(client); | ||
| 310 | + TestCase.assertNotNull(photo.get()); | ||
| 311 | + TestCase.assertNotNull(photo.get(params)); | ||
| 301 | 312 | } | |
| 302 | 313 | ||
| 303 | 314 | @Test | |
| Back | FazBrowse Home | New Git URL |
0 commit comments