-
Notifications
You must be signed in to change notification settings - Fork 0
/
openapi.yml
137 lines (137 loc) · 3.35 KB
/
openapi.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
openapi: 3.0.0
info:
title: PokemonTrading
version: "1.0"
description: This is a trading platform of Pokemon Trading Card Game.
servers:
- url: "http://localhost:3000"
paths:
"/api/traders/{traderId}/orders":
parameters:
- schema:
type: integer
name: traderId
in: path
required: true
get:
summary: Query orders
tags: []
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Orders"
examples:
example-1:
value:
- id: 1
card_id: 0
price: 100
side: 0
status: 1
trader_id: 2
created_at: "2022-06-29T14:49:10.153423Z"
"400":
description: "Bad Request, Invalid argument"
operationId: get-traders-traderId-orders
post:
summary: Send a new order
operationId: post-api-traders-traderId-orders
responses:
"200":
description: OK
content:
application/json:
schema:
type: string
description: OrderId
"400":
description: "Bad Request, Invalid argument"
requestBody:
content:
application/json:
schema:
type: object
x-examples:
example-1:
card_id: 0
side: sell
price: 100
properties:
card_id:
type: integer
side:
type: string
enum:
- buy
- sell
price:
type: integer
minimum: 100
format: int32
description: "Order Price, unit: cent"
maximum: 1000
"/api/cards/{id}/trades":
parameters:
- schema:
type: string
name: id
in: path
required: true
description: Card Id
get:
summary: Get latest trades
tags: []
responses:
"200":
description: OK
headers: {}
content:
application/json:
schema:
type: array
items: {}
"400":
description: "Bad Request, Invalid argument"
operationId: get-api-cards-id-trades
components:
schemas:
Orders:
title: Orders
x-stoplight:
id: cuz23kr22bpn7
type: array
items:
$ref: "#/components/schemas/Order"
Order:
title: Order
x-stoplight:
id: 46ff2p7lfv3wb
type: object
properties:
id:
type: integer
cardId:
type: integer
price:
type: integer
description: "Order Price, Unit: cent"
side:
type: integer
description: Buy(0)/Sell(1) Direction
enum:
- 0
- 1
status:
type: integer
description: "Order Status: Pending(0)/Matched(1)"
enum:
- 0
- 1
traderId:
type: integer
createdAt:
type: string
securitySchemes: {}