Skip to content

Commit

Permalink
types: exported necessary types
Browse files Browse the repository at this point in the history
  • Loading branch information
darseen committed Aug 20, 2024
1 parent 44575d2 commit cb783de
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 4 deletions.
131 changes: 130 additions & 1 deletion src/amadeus/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import { ReturnedResponseSuccess } from "../types/amadeus/client/response";
import { ResponseError } from "./client/errors";

// Client And Namespaces
import Client from "./client";
import ReferenceData from "./namespaces/reference-data";
import Shopping from "./namespaces/shopping";
Expand All @@ -24,6 +25,93 @@ import Analytics from "./namespaces/analytics";
import Airline from "./namespaces/airline";
import Location from "./namespaces/location";

// Shared Types
import type {
TravelClass,
DocumentType,
CurrencyCode,
TravelerType,
DiscountType,
DiscountTravelerType,
Traveler,
Contact,
Address,
Phone,
CreditCardBrand,
OtherPaymentMethod,
PaymentBrand,
} from "../types/amadeus/namespaces/shared";

// Namespaces Types

// flight-offers-search
import type {
FlightOffersSearchPostParams,
FlightOffersSearchGetParams,
FlightOffersSearchPostResult,
FlightOffersSearchGetResult,
} from "../types/amadeus/namespaces/shopping/flight-offers-search";

// flight-offers-pricing
import type {
FlightOffersPricingAdditionalParams,
FlightOffersPricingParams,
FlightOffersPricingResult,
} from "../types/amadeus/namespaces/shopping/flight-offers/pricing";

// flight-offers-prediction
import type {
FlightOffersPredictionParams,
FlightOffersPredictionResult,
} from "../types/amadeus/namespaces/shopping/flight-offers/flight-choice-prediction";

// flight-offers-upselling
import type {
FlightOffersUpsellingParams,
FlightOffersUpsellingResult,
} from "../types/amadeus/namespaces/shopping/flight-offers/upselling";

// flight-dates
import type {
FlightDatesParams,
FlightDatesResult,
} from "../types/amadeus/namespaces/shopping/flight-dates";

// flight-destinations
import type {
FlightDestinationsParams,
FlightDestinationsResult,
} from "../types/amadeus/namespaces/shopping/flight-destinations";

// seatmaps
import type {
SeatmapsGetParams,
SeatmapsGetResult,
SeatmapsPostParams,
SeatmapsPostResult,
} from "../types/amadeus/namespaces/shopping/seatmaps";

// flight-availabilities
import type {
FlightAvailabilitiesParams,
FlightAvailabilitiesResult,
} from "../types/amadeus/namespaces/shopping/availability/flight-availabilities";

// itinerary-price-metrics
import type {
ItineraryPriceMetricsParams,
ItineraryPriceMetricsResult,
} from "../types/amadeus/namespaces/analytics/itinerary-price-metrics";

// flight-order
import type { FlightOrderGetResult } from "../types/amadeus/namespaces/booking/flight-order";

// flight-orders
import type {
FlightOrdersParams,
FlightOrdersResult,
} from "../types/amadeus/namespaces/booking/flight-orders";

/**
* The Amadeus client library for accessing the travel APIs.
*
Expand Down Expand Up @@ -235,4 +323,45 @@ export default class Amadeus implements IAmadeus {
}
}

export { ResponseError };
export type {
ResponseError,
TravelClass,
DocumentType,
CurrencyCode,
TravelerType,
DiscountType,
DiscountTravelerType,
Traveler,
Contact,
Address,
Phone,
CreditCardBrand,
OtherPaymentMethod,
PaymentBrand,
FlightOffersSearchGetParams,
FlightOffersSearchPostParams,
FlightOffersSearchGetResult,
FlightOffersSearchPostResult,
FlightOffersPricingParams,
FlightOffersPricingResult,
FlightOffersPricingAdditionalParams,
FlightOffersPredictionParams,
FlightOffersPredictionResult,
FlightOffersUpsellingParams,
FlightOffersUpsellingResult,
FlightDatesParams,
FlightDatesResult,
FlightDestinationsParams,
FlightDestinationsResult,
SeatmapsGetParams,
SeatmapsGetResult,
SeatmapsPostParams,
SeatmapsPostResult,
FlightAvailabilitiesParams,
FlightAvailabilitiesResult,
ItineraryPriceMetricsParams,
ItineraryPriceMetricsResult,
FlightOrderGetResult,
FlightOrdersParams,
FlightOrdersResult,
};
6 changes: 4 additions & 2 deletions src/amadeus/namespaces/booking/flight-orders.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
FlightOrdersParams,
FlightOrdersResult,
FlightOrdersReturnType,
FlightOrdersReturnedResponse,
} from "../../../types/amadeus/namespaces/booking/flight-orders";
import Client from "../../client";

Expand Down Expand Up @@ -41,7 +41,9 @@ export default class FlightOrders {
* });
* ```
*/
public post(params: FlightOrdersParams): Promise<FlightOrdersReturnType> {
public post(
params: FlightOrdersParams
): Promise<FlightOrdersReturnedResponse> {
return this.client.post<FlightOrdersResult, FlightOrdersResult["data"]>(
"/v1/booking/flight-orders",
JSON.stringify(params)
Expand Down
2 changes: 1 addition & 1 deletion src/types/amadeus/namespaces/booking/flight-orders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type FlightOrdersResult = {
dictionaries: Dictionaries;
};

export type FlightOrdersReturnType = ReturnedResponseSuccess<
export type FlightOrdersReturnedResponse = ReturnedResponseSuccess<
FlightOrdersResult,
FlightOrdersResult["data"]
>;

0 comments on commit cb783de

Please sign in to comment.