659 lines
15 KiB
YAML
659 lines
15 KiB
YAML
openapi: 3.1.0
|
|
info:
|
|
title: Travel Product Manager API
|
|
description: 'Synthetic API with multiple linear demo workflows.
|
|
|
|
|
|
Travel workflow:
|
|
|
|
1. `GET /users/recent`
|
|
|
|
2. `GET /hotels/top`
|
|
|
|
3. `POST /segments/hotel`
|
|
|
|
4. `POST /assignments/hotels`
|
|
|
|
5. `POST /emails/send-offers`
|
|
|
|
|
|
CRM workflow:
|
|
|
|
1. `GET /crm/leads/recent`
|
|
|
|
2. `POST /crm/leads/qualify`
|
|
|
|
3. `POST /crm/offers/prepare`
|
|
|
|
4. `POST /crm/offers/send`'
|
|
version: 1.0.0
|
|
servers:
|
|
- url: http://84.201.161.175
|
|
description: production
|
|
paths:
|
|
/users/recent:
|
|
get:
|
|
tags:
|
|
- travel-offer-workflow
|
|
summary: Get Recent Users
|
|
operationId: getRecentUsers
|
|
parameters:
|
|
- name: last_active_after
|
|
in: query
|
|
required: false
|
|
schema:
|
|
anyOf:
|
|
- type: string
|
|
format: date-time
|
|
- type: 'null'
|
|
title: Last Active After
|
|
- name: limit
|
|
in: query
|
|
required: false
|
|
schema:
|
|
type: integer
|
|
maximum: 100
|
|
minimum: 1
|
|
default: 30
|
|
title: Limit
|
|
responses:
|
|
'200':
|
|
description: Successful Response
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/RecentUsersResponse'
|
|
'422':
|
|
description: Validation Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/HTTPValidationError'
|
|
/hotels/top:
|
|
get:
|
|
tags:
|
|
- travel-offer-workflow
|
|
summary: Get Top Hotels
|
|
operationId: getTopHotels
|
|
parameters:
|
|
- name: limit
|
|
in: query
|
|
required: false
|
|
schema:
|
|
type: integer
|
|
maximum: 20
|
|
minimum: 1
|
|
default: 5
|
|
title: Limit
|
|
- name: city
|
|
in: query
|
|
required: false
|
|
schema:
|
|
anyOf:
|
|
- type: string
|
|
- type: 'null'
|
|
title: City
|
|
responses:
|
|
'200':
|
|
description: Successful Response
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/TopHotelsResponse'
|
|
'422':
|
|
description: Validation Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/HTTPValidationError'
|
|
/segments/hotel:
|
|
post:
|
|
tags:
|
|
- travel-offer-workflow
|
|
summary: Segment Users By Hotel Preferences
|
|
operationId: segmentUsersByHotelPreferences
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/HotelSegmentsRequest'
|
|
required: true
|
|
responses:
|
|
'200':
|
|
description: Successful Response
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/HotelSegmentsResponse'
|
|
'422':
|
|
description: Validation Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/HTTPValidationError'
|
|
/assignments/hotels:
|
|
post:
|
|
tags:
|
|
- travel-offer-workflow
|
|
summary: Assign Users To Hotels
|
|
operationId: assignUsersToHotels
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/AssignmentsRequest'
|
|
required: true
|
|
responses:
|
|
'200':
|
|
description: Successful Response
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/AssignmentsResponse'
|
|
'422':
|
|
description: Validation Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/HTTPValidationError'
|
|
/emails/send-offers:
|
|
post:
|
|
tags:
|
|
- travel-offer-workflow
|
|
summary: Send Hotel Offers By Email
|
|
operationId: sendHotelOffersByEmail
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/EmailOfferRequest'
|
|
required: true
|
|
responses:
|
|
'200':
|
|
description: Successful Response
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/EmailOfferResponse'
|
|
'422':
|
|
description: Validation Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/HTTPValidationError'
|
|
/crm/leads/recent:
|
|
get:
|
|
tags:
|
|
- crm-linear-workflow
|
|
summary: Get Recent Leads
|
|
operationId: getRecentLeads
|
|
parameters:
|
|
- name: limit
|
|
in: query
|
|
required: false
|
|
schema:
|
|
type: integer
|
|
maximum: 50
|
|
minimum: 1
|
|
default: 20
|
|
title: Limit
|
|
- name: source
|
|
in: query
|
|
required: false
|
|
schema:
|
|
anyOf:
|
|
- type: string
|
|
- type: 'null'
|
|
title: Source
|
|
responses:
|
|
'200':
|
|
description: Successful Response
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/RecentLeadsResponse'
|
|
'422':
|
|
description: Validation Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/HTTPValidationError'
|
|
/crm/leads/qualify:
|
|
post:
|
|
tags:
|
|
- crm-linear-workflow
|
|
summary: Qualify Leads For Offer
|
|
operationId: qualifyLeadsForOffer
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/QualifyLeadsRequest'
|
|
required: true
|
|
responses:
|
|
'200':
|
|
description: Successful Response
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/QualifyLeadsResponse'
|
|
'422':
|
|
description: Validation Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/HTTPValidationError'
|
|
/crm/offers/prepare:
|
|
post:
|
|
tags:
|
|
- crm-linear-workflow
|
|
summary: Prepare Offers For Leads
|
|
operationId: prepareOffersForLeads
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/PrepareOffersRequest'
|
|
required: true
|
|
responses:
|
|
'200':
|
|
description: Successful Response
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/PrepareOffersResponse'
|
|
'422':
|
|
description: Validation Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/HTTPValidationError'
|
|
/crm/offers/send:
|
|
post:
|
|
tags:
|
|
- crm-linear-workflow
|
|
summary: Send Prepared Offers
|
|
operationId: sendPreparedOffers
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/SendOffersRequest'
|
|
required: true
|
|
responses:
|
|
'200':
|
|
description: Successful Response
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/SendOffersResponse'
|
|
'422':
|
|
description: Validation Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/HTTPValidationError'
|
|
/health:
|
|
get:
|
|
summary: Health
|
|
operationId: health_health_get
|
|
responses:
|
|
'200':
|
|
description: Successful Response
|
|
content:
|
|
application/json:
|
|
schema:
|
|
additionalProperties:
|
|
type: string
|
|
type: object
|
|
title: Response Health Health Get
|
|
components:
|
|
schemas:
|
|
Assignment:
|
|
properties:
|
|
user_id:
|
|
type: string
|
|
title: User Id
|
|
hotel_id:
|
|
type: string
|
|
title: Hotel Id
|
|
type: object
|
|
required:
|
|
- user_id
|
|
- hotel_id
|
|
title: Assignment
|
|
AssignmentsRequest:
|
|
properties:
|
|
segments:
|
|
items:
|
|
$ref: '#/components/schemas/Segment'
|
|
type: array
|
|
title: Segments
|
|
type: object
|
|
title: AssignmentsRequest
|
|
AssignmentsResponse:
|
|
properties:
|
|
assignments:
|
|
items:
|
|
$ref: '#/components/schemas/Assignment'
|
|
type: array
|
|
title: Assignments
|
|
type: object
|
|
title: AssignmentsResponse
|
|
EmailOfferRequest:
|
|
properties:
|
|
template_id:
|
|
type: string
|
|
title: Template Id
|
|
assignments:
|
|
items:
|
|
$ref: '#/components/schemas/Assignment'
|
|
type: array
|
|
title: Assignments
|
|
type: object
|
|
required:
|
|
- template_id
|
|
title: EmailOfferRequest
|
|
EmailOfferResponse:
|
|
properties:
|
|
sent_count:
|
|
type: integer
|
|
title: Sent Count
|
|
failed_count:
|
|
type: integer
|
|
title: Failed Count
|
|
failed:
|
|
items:
|
|
$ref: '#/components/schemas/FailedDelivery'
|
|
type: array
|
|
title: Failed
|
|
type: object
|
|
required:
|
|
- sent_count
|
|
- failed_count
|
|
title: EmailOfferResponse
|
|
FailedDelivery:
|
|
properties:
|
|
user_id:
|
|
type: string
|
|
title: User Id
|
|
reason:
|
|
type: string
|
|
title: Reason
|
|
type: object
|
|
required:
|
|
- user_id
|
|
- reason
|
|
title: FailedDelivery
|
|
FailedLeadDelivery:
|
|
properties:
|
|
lead_id:
|
|
type: string
|
|
title: Lead Id
|
|
reason:
|
|
type: string
|
|
title: Reason
|
|
type: object
|
|
required:
|
|
- lead_id
|
|
- reason
|
|
title: FailedLeadDelivery
|
|
HTTPValidationError:
|
|
properties:
|
|
detail:
|
|
items:
|
|
$ref: '#/components/schemas/ValidationError'
|
|
type: array
|
|
title: Detail
|
|
type: object
|
|
title: HTTPValidationError
|
|
Hotel:
|
|
properties:
|
|
id:
|
|
type: string
|
|
title: Id
|
|
name:
|
|
type: string
|
|
title: Name
|
|
city:
|
|
type: string
|
|
title: City
|
|
type: object
|
|
required:
|
|
- id
|
|
- name
|
|
- city
|
|
title: Hotel
|
|
HotelSegmentsRequest:
|
|
properties:
|
|
users:
|
|
items:
|
|
$ref: '#/components/schemas/User'
|
|
type: array
|
|
title: Users
|
|
hotels:
|
|
items:
|
|
$ref: '#/components/schemas/Hotel'
|
|
type: array
|
|
title: Hotels
|
|
type: object
|
|
title: HotelSegmentsRequest
|
|
HotelSegmentsResponse:
|
|
properties:
|
|
segments:
|
|
items:
|
|
$ref: '#/components/schemas/Segment'
|
|
type: array
|
|
title: Segments
|
|
type: object
|
|
title: HotelSegmentsResponse
|
|
Lead:
|
|
properties:
|
|
lead_id:
|
|
type: string
|
|
title: Lead Id
|
|
email:
|
|
type: string
|
|
title: Email
|
|
source:
|
|
type: string
|
|
title: Source
|
|
type: object
|
|
required:
|
|
- lead_id
|
|
- email
|
|
- source
|
|
title: Lead
|
|
PrepareOffersRequest:
|
|
properties:
|
|
qualified_leads:
|
|
items:
|
|
$ref: '#/components/schemas/QualifiedLead'
|
|
type: array
|
|
title: Qualified Leads
|
|
type: object
|
|
title: PrepareOffersRequest
|
|
PrepareOffersResponse:
|
|
properties:
|
|
offers:
|
|
items:
|
|
$ref: '#/components/schemas/PreparedOffer'
|
|
type: array
|
|
title: Offers
|
|
type: object
|
|
title: PrepareOffersResponse
|
|
PreparedOffer:
|
|
properties:
|
|
offer_id:
|
|
type: string
|
|
title: Offer Id
|
|
lead_id:
|
|
type: string
|
|
title: Lead Id
|
|
channel:
|
|
type: string
|
|
title: Channel
|
|
message:
|
|
type: string
|
|
title: Message
|
|
type: object
|
|
required:
|
|
- offer_id
|
|
- lead_id
|
|
- channel
|
|
- message
|
|
title: PreparedOffer
|
|
QualifiedLead:
|
|
properties:
|
|
lead_id:
|
|
type: string
|
|
title: Lead Id
|
|
email:
|
|
type: string
|
|
title: Email
|
|
score:
|
|
type: integer
|
|
title: Score
|
|
tier:
|
|
type: string
|
|
title: Tier
|
|
type: object
|
|
required:
|
|
- lead_id
|
|
- email
|
|
- score
|
|
- tier
|
|
title: QualifiedLead
|
|
QualifyLeadsRequest:
|
|
properties:
|
|
leads:
|
|
items:
|
|
$ref: '#/components/schemas/Lead'
|
|
type: array
|
|
title: Leads
|
|
type: object
|
|
title: QualifyLeadsRequest
|
|
QualifyLeadsResponse:
|
|
properties:
|
|
qualified_leads:
|
|
items:
|
|
$ref: '#/components/schemas/QualifiedLead'
|
|
type: array
|
|
title: Qualified Leads
|
|
type: object
|
|
title: QualifyLeadsResponse
|
|
RecentLeadsResponse:
|
|
properties:
|
|
leads:
|
|
items:
|
|
$ref: '#/components/schemas/Lead'
|
|
type: array
|
|
title: Leads
|
|
type: object
|
|
title: RecentLeadsResponse
|
|
RecentUsersResponse:
|
|
properties:
|
|
users:
|
|
items:
|
|
$ref: '#/components/schemas/User'
|
|
type: array
|
|
title: Users
|
|
type: object
|
|
title: RecentUsersResponse
|
|
Segment:
|
|
properties:
|
|
segment_id:
|
|
type: string
|
|
title: Segment Id
|
|
hotel_id:
|
|
type: string
|
|
title: Hotel Id
|
|
user_ids:
|
|
items:
|
|
type: string
|
|
type: array
|
|
title: User Ids
|
|
type: object
|
|
required:
|
|
- segment_id
|
|
- hotel_id
|
|
title: Segment
|
|
SendOffersRequest:
|
|
properties:
|
|
offers:
|
|
items:
|
|
$ref: '#/components/schemas/PreparedOffer'
|
|
type: array
|
|
title: Offers
|
|
type: object
|
|
title: SendOffersRequest
|
|
SendOffersResponse:
|
|
properties:
|
|
sent_count:
|
|
type: integer
|
|
title: Sent Count
|
|
failed_count:
|
|
type: integer
|
|
title: Failed Count
|
|
failed:
|
|
items:
|
|
$ref: '#/components/schemas/FailedLeadDelivery'
|
|
type: array
|
|
title: Failed
|
|
type: object
|
|
required:
|
|
- sent_count
|
|
- failed_count
|
|
title: SendOffersResponse
|
|
TopHotelsResponse:
|
|
properties:
|
|
hotels:
|
|
items:
|
|
$ref: '#/components/schemas/Hotel'
|
|
type: array
|
|
title: Hotels
|
|
type: object
|
|
title: TopHotelsResponse
|
|
User:
|
|
properties:
|
|
id:
|
|
type: string
|
|
title: Id
|
|
email:
|
|
type: string
|
|
title: Email
|
|
last_active:
|
|
type: string
|
|
format: date-time
|
|
title: Last Active
|
|
type: object
|
|
required:
|
|
- id
|
|
- email
|
|
- last_active
|
|
title: User
|
|
ValidationError:
|
|
properties:
|
|
loc:
|
|
items:
|
|
anyOf:
|
|
- type: string
|
|
- type: integer
|
|
type: array
|
|
title: Location
|
|
msg:
|
|
type: string
|
|
title: Message
|
|
type:
|
|
type: string
|
|
title: Error Type
|
|
type: object
|
|
required:
|
|
- loc
|
|
- msg
|
|
- type
|
|
title: ValidationError
|
|
servers:
|
|
- url: http://demo-api:8010
|
|
- url: http://localhost:8010
|