Initial library endpoints (#3012)

* Fix: extra type in `Author.yaml`

* Fix: formatting

* Initial library schema

* Additional debugging

* Fix: spec relative paths

* Add: ebook file spec

* Fix: response type should be string

* Linting updates

* Add: missing librarySettings

* Temporary fix: Library cron can be null or false

* Author controller updates

* Add: `/api/libraries/{id}` endpoint

* Update library responses

* Add: descriptions

* Fix: queries should be in body

* Fix: `body` should be `requestBody`

* Move: `libraryController` paths, clean up `requestBody`

* Clean up libraryController parameters

* Move: author endpoints to controller

* Add `get` for author images

* Simplify author schema with items

* Remove: unused response type

* Update: formatting

* Update json

* Update requestBody on LibraryController

* LibrarySettings update

* Replace: generic parameter with path specific parameter

* Fix: requestBody descriptions

* Fix: match post operation

* Temporary: nullable Author schemas

* LibraryController items endpoint

* Add: delete library items with issues

* Massive cleanup and violation fixing

* Update bundled spec

* Add: remove library items with issues

* Add: library items endpoint

* Fix: errors

* Fix: base schemas

* Add: series schemas

* Add: library series endpoint

* Fix: oneOf and array issues

* Add: author search region for matching

* Add: series endpoints

* Fix: series issues

* Add library series endpoint and update deprecation

* Fix: series endpoint deprecation

* Fix: `name` in `sortDesc` schema

* Add: workflow for linting spec

* Update OpenAPI readme
This commit is contained in:
Nicholas W 2024-06-13 15:09:02 -07:00 committed by GitHub
parent e6a2555f05
commit baf5f7fbc3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 1135 additions and 325 deletions

View file

@ -7,151 +7,40 @@ servers:
- url: http://localhost:3000
description: Development server
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
responses:
ok200:
description: OK
securitySchemes:
BearerAuth:
description: Bearer authentication
type: http
scheme: bearer
security:
- BearerAuth: []
- BearerAuth: []
paths:
/api/authors/{id}:
get:
operationId: getAuthorById
summary: Get a single author by ID on server
tags:
- Authors
parameters:
- $ref: './controllers/AuthorController.yaml#/components/parameters/authorId'
- $ref: './controllers/AuthorController.yaml#/components/parameters/authorInclude'
- $ref: './controllers/AuthorController.yaml#/components/parameters/authorLibraryId'
responses:
200:
description: getAuthorById OK
content:
application/json:
schema:
oneOf:
- $ref: './objects/entities/Author.yaml#/components/schemas/author'
- $ref: './objects/entities/Author.yaml#/components/schemas/authorWithItems'
- $ref: './objects/entities/Author.yaml#/components/schemas/authorWithSeries'
404:
$ref: './controllers/AuthorController.yaml#/components/responses/author404'
patch:
operationId: updateAuthorById
summary: Update a single author by ID on server. This endpoint will merge two authors if the new author name matches another author in the database.
tags:
- Authors
parameters:
- $ref: './controllers/AuthorController.yaml#/components/parameters/authorId'
- $ref: './controllers/AuthorController.yaml#/components/parameters/asin'
- $ref: './controllers/AuthorController.yaml#/components/parameters/authorName'
- $ref: './controllers/AuthorController.yaml#/components/parameters/authorDescription'
- $ref: './controllers/AuthorController.yaml#/components/parameters/authorImagePath'
responses:
200:
description: updateAuthorById OK
content:
application/json:
schema:
allOf:
- $ref: './objects/entities/Author.yaml#/components/schemas/author'
- $ref: './controllers/AuthorController.yaml#/components/schemas/authorUpdated'
- type: object
properties:
merged:
description: Will only exist and be `true` if the author was merged with another author
type: boolean
nullable: true
404:
$ref: './controllers/AuthorController.yaml#/components/responses/author404'
delete:
operationId: deleteAuthorById
summary: Delete a single author by ID on server and remove author from all books.
tags:
- Authors
parameters:
- $ref: './controllers/AuthorController.yaml#/components/parameters/authorId'
responses:
200:
$ref: '#/components/responses/ok200'
404:
$ref: './controllers/AuthorController.yaml#/components/responses/author404'
$ref: './controllers/AuthorController.yaml#/paths/~1api~1authors~1{id}'
/api/authors/{id}/image:
post:
operationId: setAuthorImageById
summary: Set an author image using a provided URL.
tags:
- Authors
parameters:
- $ref: './controllers/AuthorController.yaml#/components/parameters/authorId'
- $ref: './controllers/AuthorController.yaml#/components/parameters/imageUrl'
responses:
200:
description: setAuthorImageById OK
content:
application/json:
schema:
oneOf:
- $ref: './objects/entities/Author.yaml#/components/schemas/author'
404:
$ref: './controllers/AuthorController.yaml#/components/responses/author404'
delete:
operationId: deleteAuthorImageById
summary: Delete an author image from the server and remove the image from the database.
tags:
- Authors
parameters:
- $ref: './controllers/AuthorController.yaml#/components/parameters/authorId'
responses:
200:
$ref: '#/components/responses/ok200'
404:
$ref: './controllers/AuthorController.yaml#/components/responses/author404'
patch:
operationId: getAuthorImageById
summary: Return the author image by author ID.
tags:
- Authors
parameters:
- $ref: './controllers/AuthorController.yaml#/components/parameters/authorId'
- $ref: './controllers/AuthorController.yaml#/components/parameters/imageWidth'
- $ref: './controllers/AuthorController.yaml#/components/parameters/imageHeight'
- $ref: './controllers/AuthorController.yaml#/components/parameters/imageFormat'
- $ref: './controllers/AuthorController.yaml#/components/parameters/imageRaw'
responses:
200:
description: getAuthorImageById OK
content:
image/*:
schema:
type: string
format: binary
404:
$ref: './controllers/AuthorController.yaml#/components/responses/author404'
$ref: './controllers/AuthorController.yaml#/paths/~1api~1authors~1{id}~1image'
/api/authors/{id}/match:
post:
operationId: matchAuthorById
summary: Match the author against Audible using quick match. Quick match updates the author's description and image (if no image already existed) with information from audible. Either `asin` or `q` must be provided, with `asin` taking priority if both are provided.
tags:
- Authors
parameters:
- $ref: './controllers/AuthorController.yaml#/components/parameters/authorId'
- $ref: './controllers/AuthorController.yaml#/components/parameters/asin'
- $ref: './controllers/AuthorController.yaml#/components/parameters/authorSearchName'
responses:
200:
description: matchAuthorById OK
content:
application/json:
schema:
allOf:
- $ref: './objects/entities/Author.yaml#/components/schemas/author'
- $ref: './controllers/AuthorController.yaml#/components/schemas/authorUpdated'
404:
$ref: './controllers/AuthorController.yaml#/components/responses/author404'
$ref: './controllers/AuthorController.yaml#/paths/~1api~1authors~1{id}~1match'
/api/libraries:
$ref: './controllers/LibraryController.yaml#/paths/~1api~1libraries'
/api/libraries/{id}:
$ref: './controllers/LibraryController.yaml#/paths/~1api~1libraries~1{id}'
/api/libraries/{id}/authors:
$ref: './controllers/LibraryController.yaml#/paths/~1api~1libraries~1{id}~1authors'
/api/libraries/{id}/items:
$ref: './controllers/LibraryController.yaml#/paths/~1api~1libraries~1{id}~1items'
/api/libraries/{id}/issues:
$ref: './controllers/LibraryController.yaml#/paths/~1api~1libraries~1{id}~1issues'
/api/libraries/{id}/series:
$ref: './controllers/LibraryController.yaml#/paths/~1api~1libraries~1{id}~1series'
/api/libraries/{id}/series/{seriesId}:
$ref: './controllers/LibraryController.yaml#/paths/~1api~1libraries~1{id}~1series~1{seriesId}'
/api/series/{id}:
$ref: './controllers/SeriesController.yaml#/paths/~1api~1series~1{id}'
tags:
- name: Authors
description: Author endpoints
- name: Libraries
description: Library endpoints
- name: Series
description: Series endpoints