legacy/docs/swagger.yml

297 lines
7.9 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

openapi: 3.0.3
info:
title: Pairent main backend
description: |-
This is basic Pairent API specs
termsOfService: http://swagger.io/terms/
contact:
email: devs@pairent.io
license:
name: MIT
url: http://www.apache.org/licenses/LICENSE-2.0.html
version: INDEV
servers:
- url: https://pairent.io/api/v3
- url: https://pairent-api-dev-unstable.blek.codes/api/v3
tags:
- name: Offers
description: Offers interaction
- name: Users
description: User profile interaction
- name: Account
description: Personal account interaction
- name: Auth
description: Authentication API
paths:
/offer/fetch_offer_data:
post:
tags:
- Offers
summary: Get offer data according to access permissions
description: Get offer data according to access permissions
operationId: fetchOffer
requestBody:
description: Authentication data
content:
application/json:
schema:
$ref: '#/components/schemas/FetchRequest'
application/xml:
schema:
$ref: '#/components/schemas/FetchRequest'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/FetchRequest'
required: true
parameters:
- name: id
in: query
description: ID of offer to get data
required: true
schema:
type: integer
format: int64
default: 1
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Offer'
application/xml:
schema:
$ref: '#/components/schemas/Offer'
'400':
description: Invalid ID supplied
'404':
description: Pet not found
'405':
description: Validation exception
security:
- user_auth:
- read:offer
/offer/edit_offer:
post:
tags:
- Offers
requestBody:
description: |-
Not all fields are required.
content:
application/json:
schema:
$ref: '#/components/schemas/EditRequest'
application/xml:
schema:
$ref: '#/components/schemas/EditRequest'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/EditRequest'
responses:
'200':
description: 'Old offer data'
content:
application/json:
schema:
$ref: '#/components/schemas/Offer'
application/xml:
schema:
$ref: '#/components/schemas/Offer'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/Offer'
/users/get_profile_data:
post:
tags:
- Users
requestBody:
description: |-
A simple fetch request, gets someone's profile data according to privacy settings.
content:
application/json:
schema:
$ref: '#/components/schemas/FetchRequest'
parameters:
- name: id
in: query
description: ID of user
required: true
schema:
type: integer
format: int64
example: 42
responses:
'200':
description: 'A user object'
content:
application/json:
schema:
$ref: '#/components/schemas/User'
components:
schemas:
FetchRequest:
type: object
properties:
api_auth_token:
type: string
format: string
example: Z29ubmEgZ28ga2lsbCBteXNlbGYgVXdV
csrf:
type: string
format: string
example: DVMXSNWQmijGiExuOFYQsViJOwpBDnPodLWqGGJCnjTQHGRpxolPDKdtwiGjXDrt
meta:
type: object
format: object
example:
sent_at: 1680925159
Offer:
type: object
properties:
id:
type: integer
format: int64
example: 42
title:
type: string
format: string
example: "Уютная гостинка близко к ВВГУ"
description:
type: object
format: object
example:
allow_pets: false
allow_kids: false
furniture:
- Кровать
- Учебный стол
- Кухонный гарнитур
- Холодильник
- Духовка с плитой
- Шкаф
- Стиральная машина
is_furnished: true
is_renovated: false
price:
type: object
format: object
example:
per_month: 20000
communal: 2000
agency_comission: 12000
deposit: 15000
currency: 'RUB'
has_water:
type: boolean
format: boolean
example: true
has_electricity:
type: boolean
format: boolean
example: true
has_internet:
type: boolean
format: boolean
example: true
ceil_height:
type: number
format: number
example: 2.5
beds_count:
type: integer
format: int32
example: 1
creator: # User who created the offer
type: integer
format: int32
example: 6
house:
type: integer
format: int32
example: 32
meta:
type: object
format: object
example: {}
User:
type: object
properties:
name:
type: object
format: object
example:
properties:
firstName: 'Константин'
lastName: 'Константинов'
middleName: 'Константинович'
gender:
type: 'string'
format: 'string'
example: 'M'
personality:
$ref: '#/components/schemas/Personality'
profilePic:
type: 'string'
format: 'string'
example: 'https://cdn.pairent.io/usercontent/USER_ID_HERE/pfp'
description:
type: 'object'
format: 'object'
example:
userDescription: 'Боюсь WSL и не хочу использовать докеры'
Personality:
type: object
properties:
TODO:
type: string
format: string
example: 'Make a personality image object'
EditRequest:
type: object
properties:
api_auth_token:
type: string
format: string
example: Z29ubmEgZ28ga2lsbCBteXNlbGYgVXdV
csrf:
type: string
format: string
example: DVMXSNWQmijGiExuOFYQsViJOwpBDnPodLWqGGJCnjTQHGRpxolPDKdtwiGjXDrt
new_data:
type: object
format: object
example:
fill_this: according to obj_type
obj_type:
type: string
format: string
example: "A schema name ('Offer', for example)"
requestBodies:
FetchRequest:
description: Request to fetch some data
content:
application/json:
schema:
$ref: '#/components/schemas/FetchRequest'
application/xml:
schema:
$ref: '#/components/schemas/FetchRequest'
application/x-urlencoded:
schema:
$ref: '#/components/schemas/FetchRequest'
securitySchemes:
user_auth:
type: oauth2
flows:
implicit:
authorizationUrl: https://lk.vvsu.ru/oauth/authorize
scopes:
read:offer: Read offer data
api_key:
type: apiKey
name: api_key
in: header