Added assets endpoint

This commit is contained in:
2022-01-24 10:42:28 +01:00
parent f8b16faa17
commit 661f903fb5

124
api.yaml
View File

@@ -45,7 +45,7 @@ paths:
- in: query - in: query
name: limit name: limit
schema: schema:
type: integer type: number
description: Limit of recent authors to return description: Limit of recent authors to return
responses: responses:
200: 200:
@@ -70,7 +70,7 @@ paths:
- in: query - in: query
name: limit name: limit
schema: schema:
type: integer type: number
description: Limit of recent tags to return description: Limit of recent tags to return
responses: responses:
200: 200:
@@ -90,7 +90,7 @@ paths:
- in: query - in: query
name: limit name: limit
schema: schema:
type: integer type: number
description: Limit of recent articles to return description: Limit of recent articles to return
responses: responses:
200: 200:
@@ -134,7 +134,7 @@ paths:
- in: query - in: query
name: limit name: limit
schema: schema:
type: integer type: number
description: Limit of articles to return description: Limit of articles to return
responses: responses:
200: 200:
@@ -286,6 +286,110 @@ paths:
404: 404:
description: Article was not found description: Article was not found
/api/assets:
get:
summary: Get a list of assets which a article uses
parameters:
- in: query
name: article_id
schema:
type: number
description: Id of the article to get the assets from
security:
- cookie: []
responses:
200:
description: All assets of the article
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Asset'
401:
description: Not authorized
404:
description: Article was not found
post:
summary: Adds a new asset to an article
requestBody:
content:
application/json:
schema:
type: object
properties:
article_id:
type: number
description: Id of the article to store the asset to
name:
type: string
description: Name of the asset
content:
type: string
description: The asset itself
security:
- cookie: []
responses:
201:
description: The asset was created / uploaded
content:
application/json:
schema:
$ref: '#/components/schemas/Asset'
401:
description: Not authorized
409:
description: A asset with the same name for the same article already exists
patch:
summary: Changes an asset name. This impacts its alt tag and the link to it
requestBody:
content:
application/json:
schema:
type: object
properties:
id:
type: number
description: Id of the asset
name:
type: string
description: New name of the asset
security:
- cookie: []
responses:
200:
description: The asset name was changed successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Asset'
401:
description: Not authorized
404:
description: An asset with this id does not exist
409:
description: A asset with the same name for the same article already exists
delete:
summary: Deletes assets
requestBody:
content:
application/json:
schema:
type: object
properties:
id:
type: number
description: Id of the assets to delete
security:
- cookie: []
responses:
200:
description: The asset was sucessfully deleted
401:
description: Not authorized
404:
description: An asset with this id does not exist
/api/tag: /api/tag:
post: post:
summary: Creates a new tag summary: Creates a new tag
@@ -379,6 +483,18 @@ components:
name: name:
type: string type: string
description: Name of the tag description: Name of the tag
Asset:
type: object
properties:
id:
type: number
description: Id of the asset
name:
type: string
description: Name of the asset
link:
type: string
description: Static link to the asset
securitySchemes: securitySchemes:
cookie: cookie:
type: apiKey type: apiKey