Update documentation on newly introduced status

Signed-off-by: Christian Wolf <github@christianwolf.email>
This commit is contained in:
Christian Wolf 2022-05-02 10:51:46 +02:00
Родитель 482ddbc163
Коммит 7860dc3c22
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 9FC3120E932F73F1
19 изменённых файлов: 830 добавлений и 1 удалений

Двоичные данные
docs/dev/api/0.0.3/favicon-16x16.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 665 B

Двоичные данные
docs/dev/api/0.0.3/favicon-32x32.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 628 B

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

@ -0,0 +1,60 @@
<!-- HTML for static distribution bundle build -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Swagger UI</title>
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" />
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
<style>
html
{
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
*,
*:before,
*:after
{
box-sizing: inherit;
}
body
{
margin:0;
background: #fafafa;
}
</style>
</head>
<body>
<div id="swagger-ui"></div>
<script src="./swagger-ui-bundle.js" charset="UTF-8"> </script>
<script src="./swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
<script>
window.onload = function() {
// Begin Swagger UI call region
const ui = SwaggerUIBundle({
url: "https://nextcloud.github.io/cookbook/dev/api/0.0.2/openapi-cookbook.yaml",
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
});
// End Swagger UI call region
window.ui = ui;
};
</script>
</body>
</html>

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

@ -0,0 +1,75 @@
<!doctype html>
<html lang="en-US">
<head>
<title>Swagger UI: OAuth2 Redirect</title>
</head>
<body>
<script>
'use strict';
function run () {
var oauth2 = window.opener.swaggerUIRedirectOauth2;
var sentState = oauth2.state;
var redirectUrl = oauth2.redirectUrl;
var isValid, qp, arr;
if (/code|token|error/.test(window.location.hash)) {
qp = window.location.hash.substring(1);
} else {
qp = location.search.substring(1);
}
arr = qp.split("&");
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';});
qp = qp ? JSON.parse('{' + arr.join() + '}',
function (key, value) {
return key === "" ? value : decodeURIComponent(value);
}
) : {};
isValid = qp.state === sentState;
if ((
oauth2.auth.schema.get("flow") === "accessCode" ||
oauth2.auth.schema.get("flow") === "authorizationCode" ||
oauth2.auth.schema.get("flow") === "authorization_code"
) && !oauth2.auth.code) {
if (!isValid) {
oauth2.errCb({
authId: oauth2.auth.name,
source: "auth",
level: "warning",
message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
});
}
if (qp.code) {
delete oauth2.state;
oauth2.auth.code = qp.code;
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
} else {
let oauthErrorMsg;
if (qp.error) {
oauthErrorMsg = "["+qp.error+"]: " +
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
(qp.error_uri ? "More info: "+qp.error_uri : "");
}
oauth2.errCb({
authId: oauth2.auth.name,
source: "auth",
level: "error",
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server"
});
}
} else {
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
}
window.close();
}
window.addEventListener('DOMContentLoaded', function () {
run();
});
</script>
</body>
</html>

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

@ -0,0 +1,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.3
#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
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 inresponse either as image/jpeg or image/svg+xml
/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
/recipes/create:
post:
tags: [ Recipes ]
summary: Create a new recipe
deprecated: true
responses:
200:
description: The recipe was added successfully
content:
application/json:
schema:
type: integer
description: The id of the newly created recipe
example: 2367
500:
description: Some error was triggered
content:
application/json:
schema:
type: string
description: The error description
/recipes/{id}/edit:
parameters:
- in: path
name: id
required: true
description: The id of the recipe addressed
schema:
type: integer
put:
tags: [ Recipes ]
summary: Update an existing recipe
deprecated: true
requestBody:
description: The new value of the recipe content
content:
application/json:
schema:
$ref: "#/components/schemas/Recipe"
responses:
200:
description: The recipe was updated successfully
content:
application/json:
schema:
type: integer
description: The id of the recipe
example: 2367
500:
description: Some error was triggered
content:
application/json:
schema:
type: string
description: The error description
/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/RecipeList"
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
406:
description: There was no name in the request given for the recipe. Cannot save the recipe.
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
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 ]
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
406:
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.

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

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

@ -3,3 +3,4 @@
This page provides an overview over the possible API endpoints provided by the app. In the following are the various versions of the API linked:
- [Version 0.0.2](0.0.2/index.html)
- [Version 0.0.3](0.0.3/index.html)

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

@ -86,7 +86,7 @@ class MainController extends Controller {
'api_version' => [
'epoch' => 0,
'major' => 0,
'minor' => 2
'minor' => 3
]
];
return new DataResponse($response, 200, ['Content-Type' => 'application/json']);