pmj-static-data
Advanced tools
Comparing version 1.0.8 to 1.1.0
@@ -101,5 +101,8 @@ interface CountryCode { | ||
export declare function GetAllCountriesPhoneCodes(): CountryPhoneCodes[]; | ||
export declare function GetCountryDetails(options: CountryCode): CountryDetails | { | ||
status: string; | ||
message: string; | ||
export declare function GetCountryDetails(options: CountryCode): { | ||
data: CountryDetails; | ||
response: { | ||
status: string; | ||
message: string; | ||
}; | ||
}; | ||
@@ -110,9 +113,15 @@ export declare function SearchAirports(options: AirportsSearch): { | ||
}; | ||
export declare function GetAirportDetails(options: AirportLookup): AirportDetails | { | ||
status: string; | ||
message: string; | ||
export declare function GetAirportDetails(options: AirportLookup): { | ||
airport: AirportDetails; | ||
response: { | ||
status: string; | ||
message: string; | ||
}; | ||
} | undefined; | ||
export declare function GetCityDetails(options: CityLookup): CityDetails | { | ||
status: string; | ||
message: string; | ||
export declare function GetCityDetails(options: CityLookup): { | ||
city: CityDetails; | ||
response: { | ||
status: string; | ||
message: string; | ||
}; | ||
} | undefined; | ||
@@ -119,0 +128,0 @@ export declare function SearchCity(options: CitySearch): CityDetails[]; |
@@ -50,5 +50,21 @@ "use strict"; | ||
data.country_phone_code = phone_code; | ||
return data; | ||
return { data, response: { status: "SUCCESS", message: "OK" } }; | ||
} | ||
return { status: "Error", message: "Required parameter missing. (Country code)" }; | ||
return { response: { status: "Error", message: "Required parameter missing. (Country code)" }, data: { | ||
pmj_country_id: '', | ||
country_name: '', | ||
country_iso2: '', | ||
country_iso3: '', | ||
country_phone_code: '', | ||
country_capital_city: '', | ||
country_currency_symbol: '', | ||
country_currency: '', | ||
country_tld: '', | ||
country_native: '', | ||
country_region: '', | ||
country_subregion: '', | ||
country_lat: '', | ||
country_lon: '', | ||
country_flag_emoji: '', | ||
} }; | ||
} | ||
@@ -131,3 +147,24 @@ exports.GetCountryDetails = GetCountryDetails; | ||
if (iata_code?.length < 3 || iata_code?.length > 3) { | ||
return { status: "ERROR", message: "IATA CODE must be exactly 3 letters. E.X. (BLR)" }; | ||
return { response: { status: "ERROR", message: "IATA CODE must be exactly 3 letters. E.X. (BLR)" }, airport: { | ||
pmj_airport_id: undefined, | ||
name: undefined, | ||
type: undefined, | ||
iata_code: undefined, | ||
icao_code: undefined, | ||
altitude: undefined, | ||
country_code: undefined, | ||
country_name: undefined, | ||
lat: undefined, | ||
lon: undefined, | ||
airline_routes_count: undefined, | ||
destinations_count: undefined, | ||
website: undefined, | ||
wiki_link: undefined, | ||
city_name: undefined, | ||
state: undefined, | ||
pmj_city_id: undefined, | ||
pmj_country_id: undefined, | ||
pmj_state_id: undefined, | ||
top_location_in_country: undefined | ||
} }; | ||
} | ||
@@ -140,9 +177,51 @@ airports_1.AIRPORTS.find((i) => { | ||
if (airport?.pmj_airport_id !== '') { | ||
return airport; | ||
return { airport, response: { status: "SUCCESS", message: "OK" } }; | ||
} | ||
return { status: "ERROR", message: `Could not find airport with that IATA CODE. Try GetCityDetails({iata_code: ${iata_code}}).` }; | ||
return { response: { status: "ERROR", message: `Could not find airport with that IATA CODE. Try GetCityDetails({iata_code: ${iata_code}}).` }, airport: { | ||
pmj_airport_id: undefined, | ||
name: undefined, | ||
type: undefined, | ||
iata_code: undefined, | ||
icao_code: undefined, | ||
altitude: undefined, | ||
country_code: undefined, | ||
country_name: undefined, | ||
lat: undefined, | ||
lon: undefined, | ||
airline_routes_count: undefined, | ||
destinations_count: undefined, | ||
website: undefined, | ||
wiki_link: undefined, | ||
city_name: undefined, | ||
state: undefined, | ||
pmj_city_id: undefined, | ||
pmj_country_id: undefined, | ||
pmj_state_id: undefined, | ||
top_location_in_country: undefined | ||
} }; | ||
} | ||
if (pmj_airport_id) { | ||
if (pmj_airport_id?.length < 8) { | ||
return { status: "ERROR", message: "Invalid Airport ID. Airport ID should be minimum of 8 charaters." }; | ||
return { response: { status: "ERROR", message: "Invalid Airport ID. Airport ID should be minimum of 8 charaters." }, airport: { | ||
pmj_airport_id: undefined, | ||
name: undefined, | ||
type: undefined, | ||
iata_code: undefined, | ||
icao_code: undefined, | ||
altitude: undefined, | ||
country_code: undefined, | ||
country_name: undefined, | ||
lat: undefined, | ||
lon: undefined, | ||
airline_routes_count: undefined, | ||
destinations_count: undefined, | ||
website: undefined, | ||
wiki_link: undefined, | ||
city_name: undefined, | ||
state: undefined, | ||
pmj_city_id: undefined, | ||
pmj_country_id: undefined, | ||
pmj_state_id: undefined, | ||
top_location_in_country: undefined | ||
} }; | ||
} | ||
@@ -162,5 +241,26 @@ if (pmj_airport_id.startsWith('APT_')) { | ||
if (airport?.pmj_airport_id !== '') { | ||
return airport; | ||
return { airport, response: { status: "SUCCESS", message: "OK" } }; | ||
} | ||
return { status: "ERROR", message: `Invalid Airport ID or Not found` }; | ||
return { response: { status: "ERROR", message: `Invalid Airport ID or Not found` }, airport: { | ||
pmj_airport_id: undefined, | ||
name: undefined, | ||
type: undefined, | ||
iata_code: undefined, | ||
icao_code: undefined, | ||
altitude: undefined, | ||
country_code: undefined, | ||
country_name: undefined, | ||
lat: undefined, | ||
lon: undefined, | ||
airline_routes_count: undefined, | ||
destinations_count: undefined, | ||
website: undefined, | ||
wiki_link: undefined, | ||
city_name: undefined, | ||
state: undefined, | ||
pmj_city_id: undefined, | ||
pmj_country_id: undefined, | ||
pmj_state_id: undefined, | ||
top_location_in_country: undefined | ||
} }; | ||
} | ||
@@ -188,9 +288,9 @@ } | ||
if (city?.pmj_city_id !== '') { | ||
return city; | ||
return { city, response: { status: "SUCCESS", message: "OK" } }; | ||
} | ||
return { status: "ERROR", message: `Could not find city with ${city_name}` }; | ||
return { response: { status: "ERROR", message: `Could not find city with ${city_name}` }, city }; | ||
} | ||
if (iata_code) { | ||
if (iata_code?.length < 3 || iata_code?.length > 3) { | ||
return { status: "ERROR", message: "IATA CODE must be exactly 3 letters. E.X. (BLR)" }; | ||
return { response: { status: "ERROR", message: "IATA CODE must be exactly 3 letters. E.X. (BLR)" }, city }; | ||
} | ||
@@ -202,5 +302,5 @@ const d = cities_1.CITIES.find((i) => i?.iata_code?.toLowerCase() === iata_code?.toLowerCase()); | ||
if (city?.pmj_city_id !== '') { | ||
return city; | ||
return { city, response: { status: "SUCCESS", message: "OK" } }; | ||
} | ||
return { status: "ERROR", message: `Could not find airport with that IATA CODE. Try GetAirportDetails({iata_code: ${iata_code}}).` }; | ||
return { response: { status: "ERROR", message: `Could not find airport with that IATA CODE. Try GetAirportDetails({iata_code: ${iata_code}}).` }, city }; | ||
} | ||
@@ -207,0 +307,0 @@ } |
{ | ||
"name": "pmj-static-data", | ||
"version": "1.0.8", | ||
"version": "1.1.0", | ||
"description": "Search Airports, Cities, Countries and many other data in Plan My Journey DATABASE.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
19085596
266349