This repository has been archived by the owner on Jul 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmessages-openapi.yaml
171 lines (164 loc) · 3.95 KB
/
messages-openapi.yaml
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
info:
title: Pipeline Challenge - Messages API
version: "1.0"
openapi: 3.0.1
servers:
- url: http://localhost:5000
paths:
/messages:
get:
description: Get a list of messages.
parameters:
- name: max_messages
in: query
required: true
schema:
minimum: 1
format: int32
nullable: false
type: integer
description: Maximum number of messages to receive.
responses:
"200":
description: An object with a list of messages inside
content:
application/json:
schema:
$ref: "#/components/schemas/Messages"
/ack:
post:
description: Acknowledge a set of message IDs.
requestBody:
content:
application/json:
schema:
items:
type: integer
type: array
responses:
"200":
description: An object with a status "OK" and list of IDs considered dead in the request
content:
application/json:
schema:
$ref: "#/components/schemas/AcknowledgeResponse"
/process:
post:
description: Process a set of messages
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/ProcessItems"
responses:
"200":
description: An object with a status "OK"
content:
application/json:
schema:
$ref: "#/components/schemas/ProcessResponse"
"500":
description: An object with a status "FAILED"
content:
application/json:
schema:
$ref: "#/components/schemas/ProcessResponse"
/metrics:
get:
description: Latency and dead message metrics
responses:
"200":
description: A set of metrics and a count of dead messages
content:
application/json:
schema:
$ref: "#/components/schemas/Metrics"
components:
schemas:
Metrics:
properties:
unit:
type: string
dead:
type: integer
latency_average:
type: number
latency_p90:
type: number
latency_p99:
type: number
latency_p50:
type: number
latency_min:
type: number
latency_max:
type: number
Messages:
properties:
messages:
description: An array of messages
items:
$ref: "#/components/schemas/Message"
type: array
type: object
Message:
properties:
title:
type: string
body:
type: string
keywords:
type: array
items:
type: string
social_share_counts:
type: array
items:
$ref: "#/components/schemas/SocialSharesCount"
AcknowledgeResponse:
properties:
status:
type: string
enum: [OK, FAILED]
dead:
type: array
items:
type: integer
SocialSharesCount:
properties:
network:
type: string
count:
type: integer
type: object
ProcessItems:
type: array
items:
$ref: "#/components/schemas/ProcessItem"
ProcessItem:
type: object
properties:
text:
type: string
words_count:
type: integer
characters_count:
type: integer
keywords:
type: array
items:
type: string
facebook_shares:
type: integer
twiter_shares:
type: integer
reddit_shares:
type: integer
sum_shares:
type: integer
ProcessResponse:
type: object
properties:
status:
type: string
enum: [OK, FAILED]