Skip to content

Commit

Permalink
Api for BookMyHotel
Browse files Browse the repository at this point in the history
  • Loading branch information
ashokap99 committed Jul 18, 2022
1 parent a117168 commit d4e200c
Show file tree
Hide file tree
Showing 22 changed files with 1,051 additions and 165 deletions.
299 changes: 299 additions & 0 deletions bookmyhotelapi.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,299 @@
#%RAML 1.0
title: BookMyHotelAPI
baseUri: http://bookmyhotel.com
mediaType:
- application/json

documentation:
- !include documentation/BookMyHotelDoc.raml

types:
Error: !include datatypes/Error.raml
Hotel: !include datatypes/Hotel.raml
Registration: !include datatypes/Registration.raml
Booking: !include datatypes/Booking.raml
Status: !include datatypes/Status.raml

/registrations:
displayName: Registrations
description: All Registrations
get:
displayName: GET Registrations
description: Retrieve a list of all Registrations
headers:
Accept?:
responses:
200:
headers:
Content-Type:
body:
Registration[]
404:
headers:
Content-Type:
body:
Error

post:
displayName: POST Registration
description: Add a new Registration
headers:
Content-Type:
body:
Registration
responses:
201:
headers:
Location:
example: http://bookmyhotel.com/registrations/r1
500:
headers:
Content-Type:
body:
Error
/{registrationId}:
displayName: Registration
description: Specific Registration
get:
displayName: GET Registration
description: Retrieve a specific Registration
headers:
Accept?:
responses:
200:
headers:
Content-Type:
body:
Registration
404:
headers:
Content-Type:
body:
Error
patch:
displayName: PATCH Registration
description: Update a specific Registration
headers:
Content-Type:
body:
Registration
responses:
204:
500:
headers:
Content-Type:
body:
Error
delete:
displayName: DELETE Registration
description: Delete a specific Registration
headers:
Accept?:
responses:
200:
headers:
Content-Type:
body:
Status
404:
headers:
Content-Type:
body:
Error
/hotels:
displayName: Hotels
description: All Hotels
get:
displayName: GET Hotels
description: Retrieve a list of all Hotels
headers:
Accept?:
example: application/json
queryParameters:
city:
required: false
state:
required: false
country:
required: false
responses:
200:
headers:
Content-Type:
body:
Hotel[]
404:
headers:
Content-Type:
body:
Error
post:
displayName: POST Hotel
description: Add a new Hotel
headers:
Content-Type:
body:
Hotel
responses:
201:
headers:
Location:
example: http://bookmyhotel.com/hotels/h1
500:
headers:
Content-Type:
body:
Error
/{hotelId}:
displayName: Hotel
description: Specific Hotel
get:
displayName: GET Hotel
description: Retrieve a specific Hotel
headers:
Accept?:
responses:
200:
headers:
Content-Type:
body:
Hotel
404:
headers:
Content-Type:
body:
Error
patch:
displayName: PATCH Hotel
description: Update a specific Hotel
headers:
Content-Type:
body:
Hotel
responses:
204:
500:
headers:
Content-Type:
body:
Error
delete:
displayName: DELETE Hotel
description: Delete a specific Hotel
headers:
Accept?:
responses:
200:
headers:
Content-Type:
body:
Status
404:
headers:
Content-Type:
body:
Error
/bookings:
displayName: Bookings
description: Bookings of specific Hotel
get:
displayName: GET Bookings
description: Retrieve a list of all Bookings for specific hotel
headers:
Accept?:
responses:
200:
headers:
Content-Type:
body:
Booking[]
404:
headers:
Content-Type:
body:
Error
/bookings:
displayName: Bookings
description: All Bookings
get:
displayName: GET Bookings
description: Retrieve a list of all Bookings
headers:
Accept?:
responses:
200:
headers:
Content-Type:
body:
Booking[]
404:
headers:
Content-Type:
body:
Error
post:
displayName: POST Booking
description: Add a new Booking
headers:
Content-Type:
body:
Booking
responses:
201:
headers:
Location:
example: http://bookmyhotel.com/bookings/b1
500:
headers:
Content-Type:
body:
Error
/{bookingId}:
displayName: Booking
description: Specific Booking
get:
displayName: GET Booking
description: Retrieve a specific Booking
headers:
Accept?:
responses:
200:
headers:
Content-Type:
body:
Booking
404:
headers:
Content-Type:
body:
Error
patch:
displayName: PATCH Booking
description: Update a specific Booking
body:
Booking
responses:
204:
500:
headers:
Content-Type:
body:
Error
delete:
displayName: DELETE Booking
description: Delete a specific Booking
headers:
Accept?:
responses:
200:
headers:
Content-Type:
body:
Status
404:
headers:
Content-Type:
body:
Error


8 changes: 8 additions & 0 deletions datatypes/Address.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#%RAML 1.0 DataType
type: object
properties:
addressLine: string
city: string
state: string
country: string
pincode: string
16 changes: 16 additions & 0 deletions datatypes/Booking.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#%RAML 1.0 DataType
type: object
displayName: Booking DataType
description: Booking in Hotel
properties:
bookingId: string
bookingStartDate: date-only
bookingEndDate: date-only
amenitiesSelected: string[]
transportSelected: string[]
food: string
room: !include Room.raml
examples:
example1: !include ../examples/BookingExample1.raml
example2: !include ../examples/BookingExample2.raml

12 changes: 12 additions & 0 deletions datatypes/Error.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#%RAML 1.0 DataType
type: object
displayName: Error DataType
description: Error Responses
properties:
code: integer
reasonPhrase: string
details: string
example: !include ../examples/ErrorExample.raml



20 changes: 20 additions & 0 deletions datatypes/Hotel.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#%RAML 1.0 DataType
type: object
displayName: Hotel DataType
description: Hotel Details
properties:
hotelId: string
hotelName: string
rating: string
rooms:
type: array
items: !include Room.raml
paymentTypes: string[]
amenities: string[]
transport: string[]
food: string[]
languagesSpoken: string[]
address: !include Address.raml
examples:
example1: !include ../examples/HotelExample1.raml
example2: !include ../examples/HotelExample2.raml
14 changes: 14 additions & 0 deletions datatypes/Registration.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#%RAML 1.0 DataType
type: object
displayName: Registration DataType
description: Registration of Traveller
properties:
registrationId: string
customerName: string
title: string
address: !include Address.raml
paymentType: string
examples:
example1: !include ../examples/RegistrationExample1.raml
example2: !include ../examples/RegistrationExample2.raml

13 changes: 13 additions & 0 deletions datatypes/Room.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#%RAML 1.0 DataType
type: object
properties:
roomId: string
roomType:
type: string
enum:
- single room
- double room
- single deluxe
- double deluxe
- twin room
amount: number
6 changes: 6 additions & 0 deletions datatypes/Status.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#%RAML 1.0 DataType
type: object
displayName: Status DataType
description: Status Responses
properties:
message: string
Loading

0 comments on commit d4e200c

Please sign in to comment.