-
Notifications
You must be signed in to change notification settings - Fork 0
/
openapi.yaml
220 lines (220 loc) · 7.36 KB
/
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
openapi: 3.1.0
info:
title: OpenAPI Description of covers-api API
description:
This API will allow to manage covers for products.
version: 0.0.1
paths:
/{id}/cover-{size}:
get:
summary: get the cover of a product product
description:
this endpoint will fetch the data from stored files.
This request SHOULD be cached. The cache MUST be updated when the data of the database is updated.
The id of product and size of the cover MUST be specified.
If the cover does not exist, the default one will be provided for the size requested.
parameters:
- name: id
in: path
description: ID of product from which to get the cover
required: true
style: simple
explode: false
schema:
type: number
- name: size
in: path
description:
size of the cover. Valid values are "min", "small", "origin".
Wrong value will default to origin.
required: true
style: simple
explode: false
schema:
type: string
responses:
"200":
description: The data was found and returned successfully.
content:
image/webp: {}
headers:
Cache-Control:
description: Cache control header
schema:
type: string
default: max-age=300
"404":
description: The id of the cover does not exist.
headers:
Cache-Control:
description: Cache control header
schema:
type: string
default: max-age=30
"500":
description: An error happened on the server side.
headers:
Cache-Control:
description: Cache control header
schema:
type: string
default: max-age=10
/cover-default-{size}:
get:
summary: get the default cover of products
description:
this endpoint will fetch the default cover for size requested.
This request SHOULD be cached. The cache MUST be updated when the data of the database is updated.
parameters:
- name: size
in: path
description:
size of the cover. Valid values are "min", "small", "origin".
Wrong value will default to origin.
required: true
style: simple
explode: false
schema:
type: string
responses:
"200":
description: The data was found and returned successfully.
content:
image/webp: {}
headers:
Cache-Control:
description: Cache control header
schema:
type: string
default: max-age=300
"500":
description: An error happened on the server side.
headers:
Cache-Control:
description: Cache control header
schema:
type: string
default: max-age=10
/{id}/retrieve-cover:
put:
summary: retrieve from configured API the cover for the product.
description:
The server will attempt to retrieve the cover for this product id, using the tables of product and API of covers providers.
Will replace the cover if it is already present.
The task can be aborted using the task manager api with id returned.
parameters:
- name: id
in: path
description:
id present in product table
required: true
style: simple
explode: false
schema:
type: number
responses:
"202":
description: The id exist and the job is started.
headers:
Location:
description: address of long running tasks manager API
schema:
type: string
default: /api/tasks/12345
"404":
description: The id does not exist. No job started
"500":
description: An error happened on the server side. No job started
/missing-covers:
put:
summary: retrieve missing covers of all products.
description:
The server will attempt to retrieve missing covers for all products that are present in the table product.
None will be replaced.
The task can be aborted using the task manager api with id returned.
responses:
"202":
description: The id exist and the job is started.
headers:
Location:
description: address of long running tasks manager API
schema:
type: string
default: /api/tasks/12345
"500":
description: An error happened on the server side. No job started.
get:
summary: retrieve the references and id of products missing a cover
description:
The server will return a list of reference and id of products missing a cover.
Could be used after a request to /covers/retreive-missing.
The response is binary encoded with the bitcode crate version 0.6
responses:
"200":
description: A vec of products (ref,id) without cover is returned.
content:
content:
application/octet-stream: {}
"500":
description: An error happened on the server side. No job started.
/{id}:
post:
summary: add or replace cover for a product
description: use if you want to use a custom cover for a product, without using covers providers api. The cover will automaticcly converted for mini and small size. The file uploaded must be one of the following format (jpeg, png, webp, avif).
parameters:
- name: id
in: path
description:
id present in product table
required: true
style: simple
explode: false
schema:
type: number
requestBody:
description: The cover image to be uploaded
required: true
content:
image/jpeg:
schema:
type: string
format: binary
image/png:
schema:
type: string
format: binary
image/webp:
schema:
type: string
format: binary
image/avif:
schema:
type: string
format: binary
responses:
"200":
description: The new cover is now used.
"404":
description: The id does not exist.
"500":
description: An error happened on the server side.
delete:
summary: remove a cover.
description: The cover is deleted from the server, the default cover will be served instead for this product. A new cover could be added with PUT endpoints.
parameters:
- name: id
in: path
description:
id present in product table
required: true
style: simple
explode: false
schema:
type: number
responses:
"200":
description: The cover has been deleted.
"404":
description: The id does not exist.
"500":
description: An error happened on the server side.