26 lines
707 B
TypeScript
26 lines
707 B
TypeScript
/**
|
|
* Nested enum requires namespace
|
|
*/
|
|
export namespace endpoints {
|
|
export const enum v0 {
|
|
profile = "profile/v0/Profile",
|
|
}
|
|
export const enum v1 {
|
|
profile = "profile/v1/Profile",
|
|
creditCards = `${profile}/creditCards`,
|
|
initiateSaveCard = `${creditCards}/initiateSaveCard`,
|
|
friendTransactions = "profile/v1/Transaction/friendTransactions",
|
|
upcomingStays = "booking/v1/Stays/future",
|
|
previousStays = "booking/v1/Stays/past",
|
|
hotels = "hotel/v1/Hotels",
|
|
}
|
|
}
|
|
|
|
export const getHotelEndpoint = (hotelId: string | number) =>
|
|
`${endpoints.v1.hotels}/${hotelId}` as const
|
|
|
|
export type Endpoint =
|
|
| endpoints.v0
|
|
| endpoints.v1
|
|
| ReturnType<typeof getHotelEndpoint>
|