audiobookshelf/docs/controllers/LibraryController.yaml
2024-05-17 05:10:59 +00:00

326 lines
11 KiB
YAML

components:
schemas:
sortBy:
type: string
description: The field to sort by from the request.
example: 'media.metadata.title'
sortDesc:
name: sortDesc
description: Whether to sort in descending order.
type: boolean
example: true
filterBy:
type: string
description: The field to filter by from the request. TODO
example: 'media.metadata.title'
collapseSeries:
type: boolean
description: Whether collapse series was set in the request.
example: true
libraryInclude:
type: string
description: The fields from the response.
example: 'rssfeed'
requestBody:
libraryName:
name: name
in: requestBody
description: The name of the library.
content:
application/json:
schema:
type: string
example: My Audiobooks
libraryFolders:
name: folders
in: requestBody
summary: The folders of the library.
description: The folders of the library. Only specify the fullPath.
content:
application/json:
schema:
type: array
items:
$ref: '../objects/Folder.yaml#/components/schemas/folder'
libraryDisplayOrder:
name: displayOrder
in: requestBody
description: The display order of the library. Must be >= 1.
schema:
type: integer
minimum: 1
example: 1
libraryIcon:
name: icon
in: requestBody
summary: The icon of library.
description: The icon of the library. See Library Icons for a list of possible icons.
schema:
type: string
example: 'audiobookshelf'
libraryMediaType:
name: mediaType
in: requestBody
summary: The type of media the library contains.
description: The type of media that the library contains. Must be `book` or `podcast`.
schema:
type: string
example: 'book'
libraryProvider:
name: provider
in: requestBody
summary: Preferred metadata provider for the library.
description: Preferred metadata provider for the library. See Metadata Providers for a list of possible providers.
schema:
type: string
example: 'audible'
librarySettings:
name: settings
in: requestBody
summary: The settings for the library.
description: The settings for the library.
schema:
$ref: '../objects/Library.yaml#/components/schemas/librarySettings'
librarySort:
name: sort
in: requestBody
summary: The sort order of the library.
description: The sort order of the library. For example, to sort by title use 'sort=media.metadata.title'.
schema:
type: string
example: 'media.metadata.title'
libraryFilter:
name: filter
in: requestBody
summary: The filter for the library. TODO
description: The filter for the library.
schema:
type: string
example: 'media.metadata.title'
libraryCollapseSeries:
name: collapseSeries
in: requestBody
description: Whether to collapse series.
schema:
type: boolean
example: true
default: false
libraryInclude:
name: include
in: requestBody
description: The fields to include in the response. The only current option is `rssfeed`.
schema:
type: string
example: 'rssfeed'
responses:
library200:
description: Library found.
content:
application/json:
schema:
$ref: '../objects/Library.yaml#/components/schemas/library'
library404:
description: Library not found.
content:
text/html:
schema:
type: string
example: Library not found.
paths:
/api/libraries:
get:
operationId: getLibraries
summary: Get all libraries on server
description: Get all libraries on server.
tags:
- Libraries
responses:
'200':
description: getLibraries OK
content:
application/json:
schema:
type: array
items:
$ref: '../objects/Library.yaml#/components/schemas/library'
post:
operationId: createLibrary
summary: Create a new library on server
description: Create a new library on server.
required: [name, folders]
tags:
- Libraries
requestBody:
required: true
description: The library object to create.
content:
application/json:
schema:
type: object
properties:
name:
$ref: '#/components/requestBody/libraryName'
folders:
$ref: '#/components/requestBody/libraryFolders'
displayOrder:
$ref: '#/components/requestBody/libraryDisplayOrder'
icon:
$ref: '#/components/requestBody/libraryIcon'
mediaType:
$ref: '#/components/requestBody/libraryMediaType'
provider:
$ref: '#/components/requestBody/libraryProvider'
settings:
$ref: '#/components/requestBody/librarySettings'
responses:
'200':
$ref: '#/components/responses/library200'
'404':
$ref: '#/components/responses/library404'
/api/libraries/{id}:
parameters:
- name: id
in: path
description: The ID of the library.
required: true
schema:
$ref: '../objects/Library.yaml#/components/schemas/libraryId'
get:
operationId: getLibraryById
summary: Get a single library by ID on server
description: Get a single library by ID on server.
tags:
- Libraries
responses:
'200':
$ref: '#/components/responses/library200'
'404':
$ref: '#/components/responses/library404'
patch:
operationId: updateLibraryById
summary: Update a single library by ID on server
description: Update a single library by ID on server.
tags:
- Libraries
requestBody:
required: true
description: The library object to update.
content:
application/json:
schema:
type: object
properties:
name:
$ref: '#/components/requestBody/libraryName'
folders:
$ref: '#/components/requestBody/libraryFolders'
displayOrder:
$ref: '#/components/requestBody/libraryDisplayOrder'
icon:
$ref: '#/components/requestBody/libraryIcon'
mediaType:
$ref: '#/components/requestBody/libraryMediaType'
provider:
$ref: '#/components/requestBody/libraryProvider'
settings:
$ref: '#/components/requestBody/librarySettings'
responses:
'200':
$ref: '#/components/responses/library200'
'404':
$ref: '#/components/responses/library404'
delete:
operationId: deleteLibraryById
summary: Delete a single library by ID on server
description: Delete a single library by ID on server and return the deleted object.
tags:
- Libraries
responses:
'200':
$ref: '#/components/responses/library200'
'404':
$ref: '#/components/responses/library404'
/api/libraries/{id}/items:
parameters:
- name: id
in: path
description: The ID of the library.
required: true
schema:
$ref: '../objects/Library.yaml#/components/schemas/libraryId'
get:
operationId: getLibraryItems
summary: Get all items in a library by ID on server
description: Get all items in a library by ID on server.
tags:
- Libraries
requestBody:
required: false
description: The filters to apply to the requested library items.
content:
application/json:
schema:
type: object
properties:
limit:
$ref: '../schemas.yaml#/components/requestBody/limit'
page:
$ref: '../schemas.yaml#/components/requestBody/page'
sort:
$ref: '#/components/requestBody/librarySort'
desc:
$ref: '../schemas.yaml#/components/requestBody/sortDesc'
filter:
$ref: '#/components/requestBody/libraryFilter'
minified:
$ref: '../schemas.yaml#/components/requestBody/minified'
collapseSeries:
$ref: '#/components/requestBody/libraryCollapseSeries'
include:
$ref: '#/components/requestBody/libraryInclude'
responses:
'200':
description: getLibraryItems OK
content:
application/json:
schema:
oneOf:
- type: array
items:
$ref: '../objects/LibraryItem.yaml#/components/schemas/libraryItem'
- $ref: '../schemas.yaml#/components/schemas/total'
- $ref: '../schemas.yaml#/components/schemas/limit'
- $ref: '../schemas.yaml#/components/schemas/page'
- $ref: '#/components/schemas/sortBy'
- $ref: '#/components/schemas/sortDesc'
- $ref: '#/components/schemas/filterBy'
- $ref: '../objects/mediaTypes/media.yaml#/components/schemas/mediaType'
- $ref: '../schemas.yaml#/components/schemas/minified'
- $ref: '#/components/schemas/collapseSeries'
- $ref: '#/components/schemas/libraryInclude'
'404':
$ref: '#/components/responses/library404'
/api/libraries/{id}/issues:
parameters:
- name: id
in: path
description: The ID of the library.
required: true
schema:
$ref: '../objects/Library.yaml#/components/schemas/libraryId'
delete:
operationId: deleteLibraryIssues
summary: Delete items with issues in a library.
description: Delete all items with issues in a library by library ID on the server. This only removes the items from the ABS database and does not delete media files.
tags:
- Libraries
responses:
'200':
description: deleteLibraryIssues OK
content:
application/json:
schema:
type: string
example: 'Issues deleted.'
'404':
$ref: '#/components/responses/library404'