|
| 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 | +} |
0 commit comments