Signed-off-by: Christian Wolf <github@christianwolf.email>
This commit is contained in:
Christian Wolf 2021-10-19 20:30:31 +02:00
Родитель 323b8c1425
Коммит 119a47d0c5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 9FC3120E932F73F1
1 изменённых файлов: 428 добавлений и 7 удалений

Просмотреть файл

@ -217,6 +217,7 @@ paths:
/reindex:
post:
tags: [ Misc ]
deprecated: true
summary: Trigger a rescan of all recipes into the caching database
responses:
200:
@ -227,6 +228,129 @@ paths:
type: string
example: Search index rebuilt successfully
/config:
get:
tags: [ Misc ]
deprecated: true
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 ]
deprecated: true
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 ]
deprecated: true
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 ]
deprecated: true
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 inresponse either as image/jpeg or image/svg+xml
post:
tags: [ Recipes ]
deprecated: true
summary: Upload the image for a given recipe.
parameters:
- in: path
name: id
description: The id of the recipe to alter
required: true
schema:
type: integer
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
imageFile:
type: string
format: binary
description: The image to be used as new image of the recipe
responses:
204:
description: The image was sucessfully stored
406:
description: The image could not be saved or parsed.
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/api/v1/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
/api/v1/config:
get:
tags: [ Misc ]
summary: Get the current configuration of the app
@ -249,7 +373,7 @@ paths:
type: string
example: OK
/import:
/api/v1/import:
post:
tags: [ Recipes ]
summary: Import a recipe using schema.org metadata from a website
@ -284,7 +408,7 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/Error"
/recipes/{id}/image:
/api/v1/recipes/{id}/image:
get:
tags: [ Recipes ]
summary: Get the main image of a recipe. If no image is stored a fallback image is delivered.
@ -327,7 +451,36 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/Error"
/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 ]
deprecated: true
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/v1/search/{query}:
parameters:
- in: path
name: query
@ -352,6 +505,7 @@ paths:
schema:
type: string
description: The error message
/recipes/create:
post:
tags: [ Recipes ]
@ -407,7 +561,274 @@ paths:
schema:
type: string
description: The error description
/api/recipes:
get:
tags: [ Recipes ]
deprecated: true
summary: Get all recipes in the database
responses:
200:
description: Successfully obtained all recipes
content:
application/json:
schema:
$ref: "#/components/schemas/RecipeList"
post:
tags: [ Recipes ]
deprecated: true
summary: Create a new recipe
#requestBody:
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"
/api/recipes/{id}:
parameters:
- in: path
name: id
required: true
description: The id of the recipe
schema:
type: integer
get:
tags: [ Recipes ]
deprecated: true
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 ]
deprecated: true
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
delete:
tags: [ Recipes ]
deprecated: true
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 ]
deprecated: true
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 ]
deprecated: true
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 ]
deprecated: true
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 ]
deprecated: true
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 ]
deprecated: true
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.
/api/v1/recipes:
get:
tags: [ Recipes ]
summary: Get all recipes in the database
@ -437,7 +858,7 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/Error"
/api/recipes/{id}:
/api/v1/recipes/{id}:
parameters:
- in: path
name: id
@ -500,7 +921,7 @@ paths:
example: Recipe with id 2345 was not found.
description: Error message
/keywords:
/api/v1/keywords:
get:
tags: [ Tags ]
summary: Get all known keywords
@ -526,7 +947,7 @@ paths:
recipe_count: 5
- name: sugar-free
recipe_count: 2
/api/tags/{keywords}:
/api/v1/tags/{keywords}:
get:
tags: [ Tags ]
summary: Get all recipes associated with certain keywords
@ -553,7 +974,7 @@ paths:
type: string
example: "SQLException: Something went wrong."
/categories:
/api/v1/categories:
get:
tags: [ Categories ]
summary: Get all known categories
@ -586,7 +1007,7 @@ paths:
recipe_count: 10
- name: '*'
recipe_count: 3
/api/category/{category}:
/api/v1/category/{category}:
get:
tags: [ Categories ]
summary: Get all recipes of a certain category