Skip to content

Instantly share code, notes, and snippets.

@kostysh
Last active August 12, 2022 13:21
Show Gist options
  • Save kostysh/4145565254410fba1dd91d675e7cf790 to your computer and use it in GitHub Desktop.
Save kostysh/4145565254410fba1dd91d675e7cf790 to your computer and use it in GitHub Desktop.
Derbysoft Proxy swagger doc
openapi: 3.0.1
info:
title: The Derbysoft Proxy
description: "This is the interface documentation for the REST api interface with the Winding Tree Aggregator"
contact:
email: dev@windingtree.com
license:
name: Apache License
url: http://www.apache.org/licenses/LICENSE-2.0.html
version: 1.0.0
servers:
- url: /api/v1
description: Current server
tags:
- name: offers
description: Operations with Offers
- name: orders
description: Operations with Orders
paths:
/offers/search:
post:
tags:
- offers
summary: Search for offers matching search criteria
operationId: offersWithSearchCriteria
requestBody:
description: Search for offers matching input criteria
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/SearchCriteria"
examples:
hotelSearchByRectangle:
summary: A search for hotels by rectangle coordinates
value:
{
"accommodation":
{
"location":
{
"rectangle":
{
"south": "50.0929802",
"west": "14.4012451",
"north": "50.0812615",
"east": "14.4394467",
}
},
"arrival": "2020-07-02T00:00:00Z",
"departure": "2020-07-03T00:00:00Z",
"roomCount":1
},
"passengers":
[
{ "type": "ADT", "count": 2 },
{ "type": "CHD", "count": 1, "childrenAges":[13]},
],
}
hotelSearchByCircle:
summary: A search for hotels by circle
value:
{
"accommodation":
{
"location":
{
"circle":
{
"long": 18.05437602,
"lat": 59.33309777,
"radius": 50
}
},
"arrival": "2020-07-02T00:00:00Z",
"departure": "2020-07-03T00:00:00Z",
"roomCount":1
},
"passengers":
[
{ "type": "ADT", "count": 2 },
{ "type": "CHD", "count": 1, "childrenAges":[13]},
],
}
responses:
200:
description: Offers Retrieved
content:
application/json:
schema:
$ref: "#/components/schemas/SearchResponse"
401:
description: Authorization required
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
403:
description: Not authorized
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
405:
description: Validation exception
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
415:
description: Content should be application/json
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
429:
description: Too many requests
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
500:
description: Internal Server error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
security:
- orgid_auth:
- read:orders
- orgid_token: []
x-codegen-request-body-name: body
/offers/{offerId}/price:
post:
tags:
- offers
summary: Get the final price for a selected Offer
description: Providing an offer information with confirmed price
operationId: priceOffer
parameters:
- name: offerId
in: path
description: ID of a selected offer
required: true
schema:
$ref: "#/components/schemas/UUID"
responses:
200:
description: Offer with confirmed price
content:
application/json:
schema:
$ref: "#/components/schemas/PricedOfferResponse"
400:
description: Invalid ID supplied
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
401:
description: Authorization required
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
403:
description: Not authorized to retrieve this order
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
404:
description: Order not found
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
415:
description: Content should be application/json
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
429:
description: Too many requests, rate limit has been reached
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
security:
- orgid_auth:
- read:offers
- orgid_token: []
/orders/createWithOffer:
post:
tags:
- orders
summary: Place an order using a given offer
operationId: orderCreateWithOffer
requestBody:
description: Reference of the offers and details of the passengers
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreateOfferRequest"
responses:
200:
description: Order Created
content:
application/json:
schema:
$ref: "#/components/schemas/CreateWithOfferResponse"
401:
description: Authorization required
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
403:
description: Not authorized
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
405:
description: Validation exception
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
415:
description: Content should be application/json
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
429:
description: Too many requests
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
500:
description: Internal Server error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
security:
- orgid_auth:
- write:orders
- orgid_token: []
x-codegen-request-body-name: body
/orders/cancel:
post:
tags:
- orders
summary: Cancel an existing order
operationId: cancelOrder
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/OrderCancellationRequest"
responses:
200:
description: Order cancelled successfully
content:
application/json:
schema:
$ref: "#/components/schemas/OrderCancellationResponse"
401:
description: Authorization required
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
403:
description: Not authorized
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
405:
description: Validation exception
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
415:
description: Content should be application/json
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
429:
description: Too many requests
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
500:
description: Internal Server error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
security:
- orgid_auth:
- write:orders
- orgid_token: []
x-codegen-request-body-name: body
components:
schemas:
Error:
description: Objet describing an error
type: object
required: ["message"]
properties:
message:
description: Error message
type: string
example: "Something went wrong"
code:
description: Error code
type: string
pattern: "^[0-9A-Z]+$"
example: "E01"
UUID:
description: Unique identifier for Offers and Orders
type: string
format: uuid
minLength: 36
maxLength: 36
pattern: "^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$"
example: "11111111-2222-3333-4444-000000000001"
Amount:
description: An amount
type: string
pattern: '^[0-9]+(\.[0-9]+){0,1}$'
minLength: 1
maxLength: 99
example: "40.00"
Currency:
description: The ISO4217 currency code
type: string
pattern: "^[A-Z]{3}$"
minLength: 3
maxLength: 3
example: "EUR"
Price:
description: Price of the service
type: object
required: ["currency", "public"]
properties:
currency:
$ref: "#/components/schemas/Currency"
private:
description: The private price in currency decimals for this service that the distributor owes to the supplier
$ref: "#/components/schemas/Amount"
public:
description: The public price for this service. The distributor should sell the product at this price.
$ref: "#/components/schemas/Amount"
commission:
description: The distributor commission for selling this service
$ref: "#/components/schemas/Amount"
taxes:
description: The taxes to be collected when selling this service.
$ref: "#/components/schemas/Amount"
isAmountBeforeTax:
type: boolean
decimalPlaces:
type: integer
ServiceRestrictions:
description: Service restrictions
type: object
required: ["refundable", "exchangeable"]
properties:
refundable:
description: Is the service refundable?
type: boolean
example: false
exchangeable:
description: Is the service exchangeable?
type: boolean
example: false
refundFee:
# The fee charged in case a refund is requested
$ref: "#/components/schemas/Amount"
exchangeFee:
# The fee charged in case an exchange is requested
$ref: "#/components/schemas/Amount"
Email:
description: An email
type: string
pattern: '^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-_0-9]+\.)+[a-zA-Z]{2,}))$'
example: contact@org.co.uk
PhoneNumber:
description: A phone number
type: string
pattern: '^([+]{0,1})([0-9- ()/]+)$'
example: "+32123456789"
Name:
description: First, middle or last name
type: string
minLength: 1
maxLength: 42
example: "Bob"
PassengerType:
description: Type of a passenger
type: string
minLength: 3
maxLength: 3
enum:
- ADT # Adult (12+y)
- CHD # Child (2-11y)
- INF # Infant without a seat (<2y)
example: ADT
Expiration:
description: The offer expiration time
type: string
format: date-time
example: "2021-04-12T23:20:50.52Z"
RoomAmenities:
description: The list of amenities available with this room type
type: object
required: ["name", "description", "otaCode"]
properties:
name:
description: The name of this amenity
type: string
description:
description: Description of the amenity
type: string
otaCode:
description: The OTA code for this amenity
type: string
RoomOccupancy:
description: Maximum occupancy for this room type
type: object
required: ["adults", "children"]
properties:
adults:
type: integer
children:
type: integer
RoomSize:
description: the size of the room
type: object
properties:
value:
description: The size value of this room
type: number
example: 15
unit:
description: The unit for this room size
type: string
enum:
- metric
- imperial
example: metric
default: metric
RoomPolicies:
type: object
additionalProperties:
type: string
Address:
description: Address of a hotel
type: object
required: ["country", "streetAddress", "locality"]
properties:
streetAddress:
description: address line
type: string
example: Maskingatan 11
premise:
type: string
example: Gota Alv River
locality:
description: city name
type: string
example: Gothenburg
postalCode:
description: postal code
type: string
example: 417 64
country:
description: country
type: string
example: "China"
PassengerSearch:
description: A representation of a passenger
type: object
required: ["type", "count"]
properties:
type:
$ref: "#/components/schemas/PassengerType"
count:
description: Number of associated passengers of the same type
type: integer
example: 2
default: 1
childrenAges:
description: Array containing the ages of the children. Mandatory if PTC is INF or CHD.
type: array
items:
type: number
example:
{
"type": "ADT",
"count": 1
}
PassengerBooking:
description: A representation of a passenger
type: object
required: ["type", "lastnames", "firstnames"]
properties:
type:
$ref: "#/components/schemas/PassengerType"
count:
description: Number of associated passengers of the same type
type: integer
example: 2
default: 1
civility:
description: The civility of the passenger
type: string
enum:
- MR
- MRS
example: "MR"
lastnames:
description: The list of last names of this passenger
type: array
minItems: 1
maxItems: 5
items:
$ref: "#/components/schemas/Name"
firstnames:
description: The list of first names of this passenger
type: array
minItems: 1
maxItems: 5
items:
$ref: "#/components/schemas/Name"
middlenames:
description: The list of middle names of this passenger
type: array
minItems: 1
maxItems: 5
items:
$ref: "#/components/schemas/Name"
gender:
description: The gender of the passenger
type: string
enum:
- Male
- Female
example: Male
birthdate:
description: The birthdate of the passenger
type: string
format: date
example: "1980-03-21"
contactInformation:
description: The contact information of the passenger
type: array
minItems: 1
items:
oneOf:
- $ref: "#/components/schemas/PhoneNumber"
- $ref: "#/components/schemas/Email"
example:
{
"type": "ADT",
"lastnames": ["Marley"],
"firstnames": ["Bob"],
"gender": "Male",
"birthdate" : "1980-03-21",
"contactInformation": ["+32123456789", "contact@org.co.uk"]
}
LocationSearch:
description: The location of a specific place
type: object
properties:
rectangle:
$ref: "#/components/schemas/LocationRectangle"
circle:
$ref: "#/components/schemas/LocationCircle"
LocationRectangle:
description: The coordinates of a rectangle area
type: object
required: ["south", "west", "east", "north"]
properties:
south:
type: number
west:
type: number
north:
type: number
east:
type: number
example:
{
"south": 50.0929802,
"west": 14.4012451,
"north": 50.0812615,
"east": 14.4394467,
}
LocationCircle:
description: The coordinates of a circle
type: object
required: ["lat", "long", "radius"]
properties:
lat:
type: number
long:
type: number
radius:
type: number
example:
{
"lat": 50.0929802,
"long": 14.4012451,
"radius": 100
}
Photo:
description: Photo image file
type: object
required: ["type", "width", "height", "url"]
properties:
type:
type: string
enum:
- photo
- video
width:
type: integer
height:
type: integer
url:
type: string
format: url
example:
{
"type": "photo",
"width": 1024,
"height": 683,
"url": "https://media.hosting.com/1234.jpg",
}
Media:
type: array
items:
oneOf:
- $ref: "#/components/schemas/Photo"
example:
[
{
"type": "photo",
"width": 1024,
"height": 683,
"url": "https://media.hosting.com/1234.jpg",
}
]
Disclosure:
description: DIsclosure information
type: array
items:
type: string
example: "The seat charge is applicable to each one-way flight..."
# @todo Review this definition is it still required
PricePlan:
description: Describes the attributes of the price plan
type: object
properties:
name:
description: The marketing name of this price plan
type: string
maxLength: 24
example: "Premium Economy"
amenities:
description: The amenities for this price plan
type: array
maxItems: 99
items:
type: string
example: meal
checkedBaggages:
description: the list of checked checkedBaggages
type: object
properties:
quantity:
type: integer
example: 2
AccommodationType:
description: Type of accommodation service
type: string
maxLength: 24
enum:
- hotel
example: "hotel"
Accommodation:
description: An accommodation object
type: object
required: ["hotelId", "name", "type", "description", "location", "rating", "contactInformation", "checkinoutPolicy", "otherPolicies", "media", "roomTypes"]
properties:
hotelId:
description: Id of the hotel
type: string
example: "GOH202"
name:
description: The name of the property or accommodation
type: string
example: Comfort Hotel Xpress Stockholm Central
type:
$ref: "#/components/schemas/AccommodationType"
description:
description: The description of the property
type: string
location:
$ref: "#/components/schemas/AccommodationLocation"
rating:
description: The award rating as per country rules
type: integer
example: 3
contactInformation:
$ref: "#/components/schemas/ContactInformation"
checkinoutPolicy:
$ref: "#/components/schemas/CheckInOutPolicy"
otherPolicies:
type: array
items:
type: string
media:
$ref: "#/components/schemas/Media"
roomTypes:
description: Type of rooms available for this accommodation
type: object
additionalProperties:
$ref: "#/components/schemas/RoomTypes"
AccommodationLocation:
description: Location of the Accommodation
type: object
required: ["lat", "long"]
properties:
lat:
type: number
long:
type: number
example:
{
"lat": 52.520008,
"long": 13.524954
}
RoomTypes:
description: A room type object
type: object
required: ["name", "description", "amenities", "size", "maximumOccupancy", "media", "policies"]
properties:
name:
description: The name of this room type
type: string
example: Twin beds
description:
description: A description of the room type
type: string
example: Standard twin rooms with two single beds
amenities:
$ref: "#/components/schemas/RoomAmenities"
size:
$ref: "#/components/schemas/RoomSize"
nullable: true
maximumOccupancy:
$ref: "#/components/schemas/RoomOccupancy"
media:
$ref: "#/components/schemas/Media"
nullable: true
policies:
$ref: "#/components/schemas/RoomPolicies"
ContactInformation:
description: Contact information of a hotel
type: object
required: ["address", "phoneNumbers", "emails"]
properties:
address:
$ref: "#/components/schemas/Address"
phoneNumbers:
type: array
items:
$ref: "#/components/schemas/PhoneNumber"
emails:
type: array
items:
$ref: "#/components/schemas/Email"
CheckInOutPolicy:
description: The check-in and check-out time policy, format HH:MM
type: object
required: ["checkinTime", "checkoutTime"]
properties:
checkinTime:
type: string
pattern: "^[0-9]{2}:[0-9]{2}$"
example: "15:00"
checkoutTime:
type: string
pattern: "^[0-9]{2}:[0-9]{2}$"
example: "11:00"
TaxItem:
description: A tax item
type: object
required: ["description", "amount", "code"]
properties:
description:
type: string
example: Air Travelers Security Charge (ATSC)
amount:
$ref: "#/components/schemas/Amount"
code:
type: string
pattern: "^[A-Z0-9]{2}$"
example: CA
Offer:
description: An offer object
type: object
required: ["expiration", "price", "pricePlansReferences"]
properties:
expiration:
$ref: "#/components/schemas/Expiration"
price:
$ref: "#/components/schemas/Price"
pricePlansReferences:
$ref: "#/components/schemas/PricePlanReferences"
OfferPriced:
type: object
required: ["expiration", "price", "pricedItems", "disclosures"]
properties:
expiration:
$ref: "#/components/schemas/Expiration"
price:
$ref: "#/components/schemas/Price"
pricedItems:
description: Breakdown of items priced
type: array
items:
$ref: "#/components/schemas/PriceItem"
disclosures:
description: List of disclosures
type: array
items:
$ref: "#/components/schemas/Disclosure"
PriceItem:
description: Detail of a priced item
type: object
required: ["fare", "taxes"]
properties:
fare:
description: Breakdown of the fare
type: array
items:
$ref: "#/components/schemas/FareItem"
taxes:
description: Taxes included in the price
type: array
items:
$ref: "#/components/schemas/TaxItem"
FareItem:
description: A fare item
type: object
required: ["description", "amount", "usage"]
properties:
description:
type: string
example: Navigation Surcharge
amount:
$ref: "#/components/schemas/Amount"
usage:
description: The usage of the fare item
type: string
enum:
- base # Base Fare
- surcharge # Surcharge
default: base
code:
description: The optional code of the fare item
type: string
pattern: "^[A-Z0-9]{2}$"
example: S1
components:
description: A fare component
type: array
items:
$ref: "#/components/schemas/FareComponentItem"
FareComponentItem:
type: object
required: ["name", "basisCode", "designator", "conditions"]
properties:
name:
description: The name of the fare component
type: string
example: Basic
basisCode:
description: The Fare Basis code of the fare component
type: string
pattern: "^[A-Z0-9]+$"
example: A30ZABA
designator:
description: The Reservation Booking Designator (RBD)
type: string
pattern: "^[A-Z]{1}$"
example: A
conditions:
description: The fare conditions associated with the fare component
type: string
example: "No flight changes are permitted."
PricePlanReferences:
description: Maps a price plan with the associated elements
type: object
additionalProperties:
$ref: "#/components/schemas/AdditionalPricePlanProperties"
example:
{
"7b7b18e2-7357-4e98-9be6-aa182e0b090a": {
"accommodation": "prov.1234",
"roomType": "ND"
}
}
AdditionalPricePlanProperties:
type: object
required: ["accommodation", "roomType"]
properties:
accommodation:
description: reference of the accommodation
type: string
example: "prov.1234"
roomType:
description: reference of the room type in the accommodation
type: string
example: "ND"
roomTypePlan:
$ref: "#/components/schemas/RoomTypePlan"
RoomTypePlan:
type: object
required: ["roomTypeId"]
properties:
mealPlan:
type: string
ratePlan:
type: string
roomTypeId:
type: string
example:
{
"mealPlan": "BB",
"ratePlan": "BAR",
"roomTypeId": "FM4"
}
Order:
description: An Order object
required: ["price", "status", "passengers"]
type: object
properties:
price:
$ref: "#/components/schemas/Price"
restrictions:
$ref: "#/components/schemas/ServiceRestrictions"
passengers:
description: The passengers involved in the order
type: array
minItems: 1
maxItems: 99
items:
$ref: "#/components/schemas/PassengerBooking"
status:
description: Status of an order
type: string
SearchCriteria:
description: An object to provide search criteria
type: object
required: ["accommodation", "passengers"]
properties:
accommodation:
$ref: "#/components/schemas/AccommodationCriteria"
passengers:
description: The passengers involved in the search. Allows personalization and custom offers.
type: array
minItems: 1
maxItems: 99
items:
$ref: "#/components/schemas/PassengerSearch"
AccommodationCriteria:
description: Criteria for the accommodation search
type: object
required: ["location", "arrival", "departure"]
properties:
location:
$ref: "#/components/schemas/LocationSearch"
arrival:
type: string
description: arrival day in the accommodation
format: date-time
departure:
type: string
description: departure day from the accommodation
format: date-time
roomCount:
type: number
description: number of rooms searched
CreateOfferRequest:
description: An object to provide order details
type: object
required: ["offerId", "passengers", "guaranteeId"]
properties:
offerId:
$ref: "#/components/schemas/UUID"
passengers:
description: Indexed dictionary of the passengers
type: object
additionalProperties:
$ref: "#/components/schemas/PassengerBooking"
guaranteeId:
$ref: "#/components/schemas/UUID"
OrderCancellationRequest:
description: Cancellation of the order
type: object
required: ["orderId"]
properties:
orderId:
$ref: "#/components/schemas/UUID"
SearchResponse:
description: An object to return search results
type: object
required: ["offers", "accommodations"]
properties:
offers:
description: The indexed list of offers
type: object
additionalProperties:
$ref: "#/components/schemas/Offer"
accommodations:
description: The accommodations matching an search request
type: object
additionalProperties:
$ref: "#/components/schemas/Accommodation"
pricePlans:
description: The indexed list of price plans
type: object
additionalProperties:
$ref: "#/components/schemas/PricePlan"
passengers:
description: The mapping of the passenger references
type: object
additionalProperties:
$ref: "#/components/schemas/PassengerSearch"
PricedOfferResponse:
description: An offer with confirmed price
type: object
required: ["offerId", "offer"]
properties:
offerId:
$ref: "#/components/schemas/UUID"
offer:
$ref: "#/components/schemas/OfferPriced"
example:
{
"offerId": "0cf08a8c-9f88-42c5-9bb1-b2ad0f329d87",
"offer": {
"expiration": "2022-08-11T00:09:41.374Z",
"price": {
"currency": "JPY",
"public": 21000,
"taxes": 0
},
"pricedItems": [
{
"fare": [
{
"usage": "base",
"amount": 21000,
"description": "Base amount"
}
],
"taxes": []
}
],
"disclosures": [
[
"Exclusive of Occupancy Tax 5 JPY per person per night",
"Exclusive of City Tax 15% per room per night"
]
]
}
}
CreateWithOfferResponse:
description: An order
type: object
required: ["orderId", "order"]
properties:
orderId:
description: The ID of the order Created
anyOf:
- $ref: "#/components/schemas/UUID"
order:
description: The created order
anyOf:
- $ref: "#/components/schemas/Order"
OrderCancellationResponse:
description: Confirmation of an order cancellation
type: object
required: ["orderId", "status"]
properties:
orderId:
description: Order ID
allOf:
- $ref: "#/components/schemas/UUID"
status:
description: Result of cancellation
type: string
example:
{
"orderId": "11111111-2222-3333-4444-000000000001",
"status": "CANCELLED"
}
securitySchemes:
orgid_auth:
type: oauth2
flows:
implicit:
authorizationUrl: https://staging.api.simard.io/oauth/authorize
scopes:
write:orders: modify orders in your account
read:orders: read your orders
write:offers: modify offers in your account
read:offers: read your offers
orgid_token:
type: apiKey
name: orgid_token
in: header
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment