From a05f8c392cb5946cfb20d5f5b61467f5026734cb Mon Sep 17 00:00:00 2001 From: darseen Date: Fri, 23 Aug 2024 02:06:45 +0300 Subject: [PATCH] types: added reference data location types --- .../namespaces/reference-data/index.ts | 2 +- .../namespaces/reference-data/location.ts | 20 ++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/amadeus/namespaces/reference-data/index.ts b/src/amadeus/namespaces/reference-data/index.ts index 822d2c0..6b5053e 100644 --- a/src/amadeus/namespaces/reference-data/index.ts +++ b/src/amadeus/namespaces/reference-data/index.ts @@ -41,7 +41,7 @@ export default class ReferenceData { * @param {string} [locationId] The ID of the location to search for * @return {Location} **/ - public location(locationId: string) { + public location(locationId: string): Location { return new Location(this.client, locationId); } } diff --git a/src/amadeus/namespaces/reference-data/location.ts b/src/amadeus/namespaces/reference-data/location.ts index 26aece8..453affb 100644 --- a/src/amadeus/namespaces/reference-data/location.ts +++ b/src/amadeus/namespaces/reference-data/location.ts @@ -1,14 +1,18 @@ +import { + ReferenceDataLocationsResult, + ReferenceDataLocationsReturnedResponse, +} from "../../../types/amadeus/namespaces/reference-data/locations"; import Client from "../../client"; /** * A namespaced client for the - * `/v2/reference-data/locations/:location_id` endpoints + * `/v1/reference-data/locations/:location_id` endpoints * * Access via the {@link Amadeus} object * * ```ts * const amadeus = new Amadeus(); - * amadeus.referenceData.locations('ALHR'); + * amadeus.referenceData.location('ALHR'); * ``` * * @param {Client} client @@ -35,10 +39,12 @@ export default class Location { * amadeus.referenceData.location('ALHR').get(); * ``` */ - public get(params: Object = {}) { - return this.client.get( - `/v1/reference-data/locations/${this.locationId}`, - params - ); + public get( + params: Object = {} + ): Promise { + return this.client.get< + ReferenceDataLocationsResult, + ReferenceDataLocationsResult["data"] + >(`/v1/reference-data/locations/${this.locationId}`, params); } }