-
Notifications
You must be signed in to change notification settings - Fork 94
/
openapi-cookbook.yaml
668 lines (638 loc) · 20.6 KB
/
openapi-cookbook.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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
openapi: 3.0.1
info:
title: Nextcloud cookbook app
description: >-
This is the API definition of the [cookbook app](https://github.com/nextcloud/cookbook) for the [nextcloud server](http://nextcloud.com).
Further contact can be found on the matrix.org server in the room [#nextcloud-cookbook:matrix.org](https://matrix.to/#/#nextcloud-cookbook:matrix.org).
#contact:
#email: apiteam@swagger.io
license:
name: AGPL-3
url: 'http://www.gnu.org/licenses/agpl-3.0.de.html'
version: 0.0.4
#externalDocs:
# description: Find out more about Swagger
# url: 'http://swagger.io'
servers:
- url: 'http://localhost:8000/apps/cookbook'
- url: '{protocol}://{server}'
variables:
protocol:
enum:
- http
- https
default: https
server:
default: 'example.com'
tags:
- name: Recipes
description: Everything related to recipes and their usage
- name: Categories
description: Access to the categories of the recipes
- name: Tags
description: Access to tags/keywords of recipes
- name: Misc
description: Other API endpoints
components:
schemas:
Recipe:
type: object
description: A recipe according to [schema.org](http://schema.org/Recipe)
properties:
name:
type: string
additionalProperties: true
example:
name: Baked bananas
description: A very delightful recipe of the best baked bananas ever
image: http://example.com/path/to/image.jpg
recipeYield: 5
prepTime: PT0H15M
recipeIngredient:
- 3 ripe bananas
- 100g sugar
- 20 teaspoons of cinamon
resipeInstructions:
- Peel the bananas
- Dip the bananas in the pot of sugar
- Put the banans in the oven and let the cinamon soak in for 10 minutes
- After 5 hours of baking, they are ready
recipeCategory: Dessert
keywords: banana,cinnamon,sweet,untested recipe
RecipeList:
type: array
items:
$ref: "#/components/schemas/Recipe"
example:
- name: Baked bananas
description: A very delightful recipe of the best baked bananas ever
image: http://example.com/path/to/image.jpg
recipeYield: 5
prepTime: PT0H15M
recipeIngredient:
- 3 ripe bananas
- 100g sugar
- 20 teaspoons of cinamon
resipeInstructions:
- Peel the bananas
- Dip the bananas in the pot of sugar
- Put the banans in the oven and let the cinamon soak in for 10 minutes
- After 5 hours of baking, they are ready
recipeCategory: Dessert
keywords: banana,cinnamon,sweet,untested recipe
- name: "Homemade Apple Butter"
author:
"@type": Person
name: "Julie Clark"
description: "A simple recipe for Homemade Apple Butter that you can make in the slow cooker. Use as a spread, a syrup or in your fall recipes!"
datePublished: "2016-09-01T01:58:54+00:00"
image: "https://www.tastesoflizzyt.com/wp-content/uploads/2016/08/homemade-apple-butter-2-480x270.jpg"
recipeYield: 20
prepTime: "PT0H25M"
cookTime: "PT10H0M"
totalTime: "PT10H25M"
recipeIngredient:
- 6 1/2 pounds apples (peeled, cored and sliced)
- 1/2 cup granulated sugar
- 1/2 cup packed brown sugar
- 1 1/2 tablespoons ground cinnamon
- 1/4 teaspoon salt
- 1 tablespoon vanilla extract
recipeInstructions:
- Place the apples in a slow cooker.
- Add the sugars, cinnamon, salt and vanilla to the crockpot. Mix well.
- Cook in slow cooker on low for about 10 hours, stirring every couple hours. The apple butter should be thick and dark brown.
- If desired, use a blender to puree the apple butter until smooth.
- Cover and refrigerate for up to two weeks or freeze in small containers.
aggregateRating:
"@type": "AggregateRating"
ratingValue: "4.87"
ratingCount: "38"
recipeCategory: "Breakfast"
keywords: "apple butter recipes,apple recipes,fall recipes"
nutrition:
"@type": "NutritionInformation"
calories: "120 kcal"
carbohydrateContent: "31 g"
sodiumContent: "32 mg"
fiberContent: "3 g"
sugarContent: "25 g"
servingSize: "1 serving"
tool: []
url: "https://www.tastesoflizzyt.com/homemade-apple-butter/"
dateModified: "2021-05-23T17:10:25+0000"
dateCreated: "2021-05-23T17:10:25+0000"
Config:
type: object
description: An object describing the configuration of the web app
properties:
folder:
type: string
example: /Recipes
description: The folder in the user's files that contains the recipes
update_interval:
type: integer
example: 10
description: The interval between automatic rescans to rebuild the database cache in minutes
print_image:
type: boolean
example: true
description: True, if the user wished to print the recipe images with the rest of the recipes
required:
- folder
- update_interval
- print_image
Error:
type: object
description: An error description
properties:
msg:
type: string
description: The error message
example: Recipe could not be found
file:
type: string
description: The file in which the exception was thrown
example: /var/www/custom_apps/cookbook/Service/RecipeService.php
line:
type: integer
description: The line where the exception is thrown
example: 223
RecipeStub:
type: object
description: A stub of a recipe with some basic information present
properties:
name:
type: string
description: The name of the recipe
example: Baked bananas
recipe_id:
type: integer
description: The index of the recipe
example: 1
keywords:
type: string
description: A comma-separated list of recipe keywords
example: sweets,fruit
dateCreated:
type: string
description: The date the recipe was created in the app
example: "2022-01-02T16:12:41+0000"
dateModified:
type: string
description: The date the recipe was modified lastly in the app
example: "2022-01-10T10:02:52+0000"
imageUrl:
type: string
description: The URL of the recipe image
example: http://example.com/path/to/image.jpg
imagePlaceholderUrl:
type: string
description: The URL of the placeholder of the recipe image
example: http://example.com/path/to/image_thumb.jpg
required:
- "name"
- "recipe_id"
- "imageUrl"
- "imagePlaceholderUrl"
- "dateCreated"
StubList:
type: array
items:
$ref: "#/components/schemas/RecipeStub"
securitySchemes:
app_password:
type: http
scheme: basic
description: Use username and app password
security:
- app_password: []
paths:
/api/version:
get:
tags: [ Misc ]
summary: Get the version of the API endpoint
responses:
'200':
description: API version
content:
application/json:
schema:
type: object
properties:
cookbook_version:
type: array
items:
type: integer
minItems: 3
maxItems: 3
description: The installed version of the app
api_version:
type: object
properties:
epoch:
type: integer
description: An epoch to cope with bad API versions
major:
type: integer
description: The major number of the API
minor:
type: integer
description: The minor number of the API
/reindex:
post:
tags: [ Misc ]
summary: Trigger a rescan of all recipes into the caching database
responses:
200:
description: The reindex process was done.
content:
application/json:
schema:
type: string
example: Search index rebuilt successfully
/config:
get:
tags: [ Misc ]
summary: Get the current configuration of the app
responses:
200:
description: The config was read successfully
content:
application/json:
schema:
$ref: "#/components/schemas/Config"
post:
tags: [ Misc ]
summary: Set the configuration for the current user
responses:
200:
description: The configuration was successfully saved.
content:
application/json:
schema:
type: string
example: OK
/import:
post:
tags: [ Recipes ]
summary: Import a recipe using schema.org metadata from a website
requestBody:
content:
application/json:
schema:
type: object
properties:
url:
type: string
example: 'http://www.chefkoch.de/2345'
required:
- url
responses:
200:
description: Successfully imported recipe
content:
application/json:
schema:
$ref: "#/components/schemas/Recipe"
400:
description: The URL to be imported was not inserted in the request or any other issue was rosen.
content:
application/json:
schema:
type: string
example: Field "url" is required
409:
description: There exists a recipe with that name already. Import was aborted.
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/recipes/{id}/image:
get:
tags: [ Recipes ]
summary: Get the main image of a recipe. If no image is stored a fallback image is delivered.
parameters:
- in: path
name: id
description: The id of the recipe to obtain the image for.
required: true
schema:
type: integer
responses:
200:
description: Image was obtained and will be in response either as image/jpeg or image/svg+xml
content:
image/jpeg:
schema:
type: string
format: binary
image/svg+xml:
schema:
type: string
format: binary
406:
description: The recipe has no image whose MIME type matches the Accept header
/api/search/{query}:
parameters:
- in: path
name: query
required: true
description: The search string, urlencoded, separated with spaces and/or commas
schema:
type: string
get:
tags: [ Recipes ]
summary: Search for recipes for keywords, tags and categories with the named search string
responses:
200:
description: The recipes were obtained successfully
content:
application/json:
schema:
$ref: "#/components/schemas/RecipeList"
500:
description: An error has been thrown
content:
application/json:
schema:
type: string
description: The error message
/api/recipes:
get:
tags: [ Recipes ]
summary: Get all recipes in the database
responses:
200:
description: Successfully obtained all recipes
content:
application/json:
schema:
$ref: "#/components/schemas/StubList"
post:
tags: [ Recipes ]
summary: Create a new recipe
requestBody:
description: |
A JSON representation of the recipe to be saved.
See also the structure at https://schema.org/Recipe
content:
application/json:
schema:
type: object
properties:
name:
type: string
required: [ "name" ]
additionalProperties: true
example:
name: "Chips"
description: "A very delicious way of getting kids quiet"
ingredients:
- "1 pack of pre-fried chips"
tools: ["common oven"]
instructions:
- "Put the chips in the oven"
- "Wait until the are due"
responses:
200:
description: Successfully created new recipe
content:
application/json:
schema:
type: integer
example: 2462
description: The id of the newly created recipe
409:
description: A recipe with the name was already found on the server. No recipe is created.
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
422:
description: There was no name in the request given for the recipe. Cannot save the recipe.
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/api/recipes/{id}:
parameters:
- in: path
name: id
required: true
description: The id of the recipe
schema:
type: integer
get:
tags: [ Recipes ]
summary: Get a single recipe from the server
responses:
200:
description: Recipe was sucessfully obtained
content:
application/json:
schema:
$ref: "#/components/schemas/Recipe"
404:
description: The given recipe id was not found
content:
application/json:
schema:
type: integer
example: 2345
description: The id of the recipe that was not found
put:
tags: [ Recipes ]
summary: Update a recipe
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/Recipe"
responses:
200:
description: The recipe was sucessfully updated
content:
application/json:
schema:
type: integer
description: The id of the updated recipe
example: 2345
422:
description: There was no name in the request given for the recipe. Cannot save the recipe.
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
delete:
tags: [ Recipes ]
summary: Delete an existing recipe
responses:
200:
description: The recipe was deleted successfully
content:
application/json:
schema:
type: string
example: Recipe 2345 was deletes successfully
502:
description: An Exception was thrown
content:
application/json:
schema:
type: string
example: Recipe with id 2345 was not found.
description: Error message
/keywords:
get:
tags: [ Tags ]
summary: Get all known keywords
responses:
'200':
description: Successfully obtained all keywords
content:
application/json:
schema:
type: array
items:
type: object
properties:
name:
type: string
recipe_count:
type: integer
required:
- name
- recipe_count
example:
- name: vegetarian
recipe_count: 5
- name: sugar-free
recipe_count: 2
/api/tags/{keywords}:
get:
tags: [ Tags ]
summary: Get all recipes associated with certain keywords
parameters:
- in: path
name: keywords
required: true
description: Comma separated list of keywords, urlencoded
schema:
type: string
example: vegetarian,sweet
responses:
200:
description: Recipes were successfully obtained
content:
application/json:
schema:
$ref: "#/components/schemas/RecipeList"
500:
description: An error occured
content:
application/json:
schema:
type: string
example: "SQLException: Something went wrong."
/categories:
get:
tags: [ Categories ]
summary: Get all known categories
responses:
200:
description: >-
Sucessfully obtained all categories
Please note: A category name of `*` indicates the number of
recipes with no category associated.
content:
application/json:
schema:
type: array
items:
type: object
properties:
name:
type: string
recipe_count:
type: integer
required:
- name
- recipe_count
example:
- name: Dinner
recipe_count: 21
- name: Lunch
recipe_count: 10
- name: '*'
recipe_count: 3
/api/category/{category}:
get:
tags: [ Categories ]
summary: Get all recipes of a certain category
parameters:
- in: path
name: category
required: true
description: >-
The name of the category to be queried as urlencoded string
Put the string `_` to obtain all recipes with no category
schema:
type: string
responses:
200:
description: The filtered recipes belonging to the category
content:
application/json:
schema:
$ref: "#/components/schemas/RecipeList"
500:
description: An exception was issued.
content:
application/json:
schema:
type: string
description: The error message
example: Could not find category foo.
put:
tags: [ Categories ]
summary: Rename a category
parameters:
- in: path
name: category
required: true
description: >-
The name of the category to be queried as urlencoded string
Put the string `_` to obtain all recipes with no category
schema:
type: string
requestBody:
content:
application/json:
schema:
type: object
properties:
name:
type: string
example: Lunch
description: The new name to rename the category to
required:
- name
responses:
200:
description: The category was renamed successfully
content:
application/json:
schema:
type: string
example: Lunch
400:
description: The new category name was not included during the request.
500:
description: The renaming did not succeed.
content:
application/json:
schema:
type: string
description: The error message
example: There exists already a category of that name.