@windingtree/wt-search-api
Version:
NodeJS app that enables quick search over data from Winding Tree platform
158 lines (157 loc) • 5.77 kB
YAML
openapi: 3.0.0
servers:
- description: Localhost
url: 'http://localhost:1918'
info:
description: API for access to filterable and sortable cached collection of inventory from Winding Tree platform
version: 'will-be-set-at-runtime'
title: WT Search API
paths:
/:
get:
summary: API info
responses:
'200':
description: Basic information about this API instance.
content:
application/json:
schema:
type: object
properties:
docs:
type: string
description: Link to the API documentation.
info:
type: string
description: Link to more information about the API.
version:
type: string
description: Deployed API version number.
config:
type: string
description: Which config is the API using.
/hotels:
get:
summary: Get a list of hotels.
parameters:
- name: location
in: query
description: Filter by distance (in kilometers) to the given location. Maximum allowed distance in the filter is 200 km. Format is "lat,long:distance" and you can specify multiple areas as multiple query parameters with this name.
required: false
schema:
type: array
items:
type: string
pattern: '^[\d.]+,[\d.]+:[\d.]+$'
example: 50.08,14.44:20
- name: sortByDistance
in: query
description: Sort by distance (in kilometers) from given point (lat, long).
required: false
schema:
type: string
pattern: '^[\d.]+,[\d.]+$'
example: 50.08,14.44
responses:
'200':
description: A list of hotels matching the input criteria.
content:
application/json:
schema:
type: object
properties:
items:
type: array
description: List of resolved hotels.
items:
$ref: https://raw.githubusercontent.com/windingtree/wt-read-api/v0.12.0/docs/swagger.yaml#/components/schemas/HotelListItem
sortingScores:
type: array
description: List of item scores used for sorting (if applicable).
items:
type: object
required:
- id
- score
properties:
id:
$ref: '@windingtree/wt-shared-schemas/swagger.yaml#/components/schemas/EthereumAddressType'
score:
type: object
required:
- name
- value
properties:
name:
description: Name of the metric that was used for sorting.
type: string
value:
description: Value of the sorting metric.
type: number
next:
description: >-
Uri to next page of records. When there's no next page,
this is not set.
$ref: '@windingtree/wt-shared-schemas/swagger.yaml#/components/schemas/UriType'
'400':
$ref: '#/components/responses/BadRequestError'
'/notifications/{subscription_token}':
parameters:
- name: subscription_token
required: true
in: path
description: An opaque subscription token.
schema:
type: string
post:
summary: Publish an update notification. Facilitates the consumer webhook endpoint for wt-update-api.
requestBody:
required: true
content:
application/json:
schema:
$ref: 'https://raw.githubusercontent.com/windingtree/wt-notification-api/v0.4.2/docs/swagger.yaml#/components/schemas/Notification'
responses:
'200':
description: Notification has been accepted.
'400':
$ref: '#/components/responses/BadRequestError'
'401':
$ref: '#/components/responses/UnauthorizedError'
components:
responses:
BadRequestError:
description: The server does not understand the request (HTTP code 400)
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
UnprocessableEntityError:
description: Request body or params validation failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
UnauthorizedError:
description: The provided subscription token and hotel address pair does not match any existing subscription.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
schemas:
Error:
title: Error
description: Default schema for errors returned by API.
properties:
status:
type: number
description: HTTP status
code:
type: string
description: Computer-readable error. Use this for comparison.
short:
type: string
description: Human-readable error with a short description of the error.
long:
type: string
description: Verbose explanation of what happened.