Files
eh-downloader/api.yml
2025-01-03 21:48:29 +08:00

4207 lines
132 KiB
YAML

openapi: "3.1.0"
info:
title: EH Downloader API
version: "1.0"
description: EH Downloader API
license:
name: GPL-3.0
url: https://www.gnu.org/licenses/gpl-3.0.html
servers:
- url: "{host}{base}"
variables:
host:
default: https://eh.lifegpc.com
description: Hostname
base:
default: /api
description: Base URL
description: API Server
components:
schemas:
ApiResponse:
description: Api response
type: object
required: [ok, status]
properties:
ok:
type: boolean
status:
type: integer
ApiResponseEmpty:
description: Api response with a empty data
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
type: object
example: { ok: true, status: 0, data: {} }
ApiResponseError:
description: Api response with a error
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [error]
properties:
error:
type: string
ApiResponseTrue:
description: Api response with true
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
type: boolean
enum: [true]
example: { ok: true, status: 0, data: true }
ClientConfigApiResult:
description: Api result for getClientConfig
type: object
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
oneOf:
- type: array
title: ClientConfigNameList
description: The list of configuration's name
items:
type: string
- type: string
description: The data of configuration
ConfigOptional:
description: Configuration of server
type: object
properties:
cookies:
type: string
description: Cookies
db_path:
type: string
description: The folder where the database is stored
ua:
type: string
description: User Agent
ex:
type: boolean
description: Whether to use exhentai.org
base:
type: string
description: Download location
max_task_count:
type: integer
description: Maximum number of parallel tasks
mpv:
type: boolean
description: Fetch page data from Multi-Page Viewer
max_retry_count:
type: integer
description: Maximum retry count
max_download_img_count:
type: integer
description: Maximum number of parallel downloads of images
download_original_img:
type: boolean
description: Whether to download original images
port:
type: integer
description: Listening port
export_zip_jpn_title:
type: boolean
description: Whether to use japanese title first when exporting zip
hostname:
type: string
description: Listening host
meili_host:
type: string
description: Meilisearch server host
meili_search_api_key:
type: string
description: Meilisearch API key for searching
meili_update_api_key:
type: string
description: Meilisearch API key for updating gallery metadata
ffmpeg_path:
type: string
description: The path to the ffmpeg binary
thumbnail_method:
$ref: "#/components/schemas/ThumbnailMethod"
thumbnail_dir:
type: string
description: The folder used to store thumbnails
remove_previous_gallery:
type: boolean
description: Whether to remove old galleries which replaced by new ones
img_verify_secret:
type: string
description: The secret of image verify
meili_hosts:
type: object
additionalProperties:
type: string
description: Meilisearch server hostname for specific domains
cors_credentials_hosts:
type: array
items:
type: string
description: The URL origins which are allowed to send CORS requests with credentials
flutter_frontend:
type: string
description: The path of flutter frontend
fetch_timeout:
type: integer
description: Fetch timeout in milliseconds
download_timeout:
type: integer
description: Download timeout in milliseconds
ffprobe_path:
type: string
description: The path to the ffprobe binary
redirect_to_flutter:
type: boolean
description: Whether to redirect to Flutter frontend when accessing the root URL
download_timeout_check_interval:
type: integer
description: The interval of checking download timeout in milliseconds
eh_metadata_cache_time:
type: integer
description: The time to cache the metadata of the gallery from E-Hentai in hours
random_file_secret:
type: string
description: The secret of token to access random file without login
use_path_based_img_url:
type: boolean
description: Whether to put parameters to image URL path
check_file_hash:
type: boolean
description: Whether to verify file integrity when downloading or importing
import_method:
$ref: "#/components/schemas/ImportMethod"
max_import_img_count:
type: integer
description: Maximum number of images to be imported in parallel
enable_server_timing:
type: boolean
description: Whether to enable server time tracking
thumbnail_format:
$ref: "#/components/schemas/ThumbnailFormat"
logging_stack:
type: boolean
description: Enable logging stack for all log levels
Config:
allOf:
- $ref: "#/components/schemas/ConfigOptional"
- properties:
cookies:
type: boolean
description: True if Cookies is set
required:
- cookies
- ex
- base
- max_task_count
- mpv
- max_retry_count
- max_download_img_count
- download_original_img
- port
- export_zip_jpn_title
- hostname
- ffmpeg_path
- thumbnail_method
- thumbnail_dir
- remove_previous_gallery
- cors_credentials_hosts
- fetch_timeout
- download_timeout
- ffprobe_path
- redirect_to_flutter
- download_timeout_check_interval
- eh_metadata_cache_time
- use_path_based_img_url
- check_file_hash
- import_method
- max_import_img_count
- enable_server_timing
- thumbnail_format
- logging_stack
ConfigUpdated:
description: result of updateConfig
type: object
properties:
is_unsafe:
type: boolean
description: True if some modification of configuration only works after server restart
required: [is_unsafe]
DefaultImportConfig:
description: Default configuration for import task
type: object
properties:
max_import_img_count:
type: integer
description: Maximum number of images to be imported in parallel
mpv:
type: boolean
description: Fetch page data from Multi-Page Viewer
method:
$ref: "#/components/schemas/ImportMethod"
remove_previous_gallery:
type: boolean
description: Whether to remove old galleries which replaced by new ones
DefaultImportConfigApiResult:
description: Api response for getDefaultImportConfig
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: "#/components/schemas/DefaultImportConfig"
DownloadConfig:
description: Configuration for download task
type: object
properties:
max_download_img_count:
type: integer
description: Maximum number of parallel downloads of images
mpv:
type: boolean
description: Fetch page data from Multi-Page Viewer
download_original_img:
type: boolean
description: Whether to download original images
max_retry_count:
type: integer
description: Maximum retry count
remove_previous_gallery:
type: boolean
description: Whether to remove old galleries which replaced by new ones
replaced_gallery:
description: A list of old galleries which should be replaced by new one
type: array
items:
type: object
required: [gid, token]
properties:
gid:
type: integer
format: int64
description: Gallery id
token:
type: string
description: Gallery token
DownloadConfigApiResult:
description: Api response for getDefaultDownloadConfig
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: "#/components/schemas/DownloadConfig"
EhFile:
description: Full data for File
allOf:
- $ref: '#/components/schemas/EhFileExtend'
- type: object
properties:
path:
type: string
description: Path to image file on server
required: [path]
EhFileApiResult:
description: Api response for uploadFile
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: "#/components/schemas/EhFile"
EhFileBasic:
description: Basic data for file
type: object
required: [id, width, height, is_original]
properties:
id:
type: integer
description: File ID
width:
type: integer
description: Image width
height:
type: integer
description: Image height
is_original:
type: boolean
description: True if image is original
EhFileExtend:
description: Extended data for file
allOf:
- $ref: '#/components/schemas/EhFileBasic'
- type: object
properties:
token:
type: string
description: Page token
required: [token]
EhFileExtendApiResult:
description: Api response for getFile
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: "#/components/schemas/EhFileExtend"
EhFileMeta:
description: Metadata for a image
allOf:
- $ref: '#/components/schemas/EhFileMetaOptinal'
- required: [token, is_nsfw, is_ad]
EhFileMetaApiResult:
description: Api response for getFilemeta
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: "#/components/schemas/EhFileMeta"
EhFileMetaOptinal:
description: Metadata for a image
type: object
required: [token]
properties:
token:
type: string
description: Image(page) token
is_nsfw:
type: boolean
description: True if image is NSFW
is_ad:
type: boolean
description: True if image is advertisement
EhFiles:
description: List of files for tokens
type: object
additionalProperties:
type: array
items:
$ref: "#/components/schemas/EhFileBasic"
EhFilesApiResult:
description: Api response for getFiles
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: "#/components/schemas/EhFiles"
EHImageLimit:
description: E-Hentai image limits
type: object
properties:
current:
type: integer
description: Current used
max:
type: integer
description: Maximum limit
EHImageLimitApiResult:
description: Api response for getEhImageLimit
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: "#/components/schemas/EHImageLimit"
EHMetaInfo:
description: E-Hentai metadata information map
type: object
additionalProperties:
oneOf:
- allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: "#/components/schemas/GalleryMetadataSingle"
- $ref: "#/components/schemas/ApiResponseError"
EHMetaInfoApiResult:
description: Api response for getEhMetadata
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: "#/components/schemas/EHMetaInfo"
ExportZipConfig:
description: Configuration for export as zip file task
type: object
properties:
output:
type: string
description: The path to output zip file
jpn_title:
type: boolean
description: Whether to use japanese title first
max_length:
type: integer
description: Maximum length of filenames in Zip files. 0 means disable
export_ad:
type: boolean
description: Export pages which marked as advertisements
ExportZipConfigApiResult:
description: Api response for getDefaultExportZipConfig
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: "#/components/schemas/ExportZipConfig"
ExtendedPMeta:
description: Page metadata with extended information
type: object
required: [gid, index, token, name, width, height, is_nsfw, is_ad]
properties:
gid:
type: integer
format: int64
description: Gallery id
index:
type: integer
description: Page number in gallery
token:
type: string
description: Token for image
name:
type: string
description: Page name
width:
type: integer
description: Original image width
height:
type: integer
description: Original image height
is_nsfw:
type: boolean
description: True if image is NSFW
is_ad:
type: boolean
description: True if image is advertisement
FsFile:
description: Present a file/directory
type: object
required: [name, dir]
properties:
name:
type: string
description: File name
dir:
type: boolean
description: True if is a directory
FsFileList:
description: Present the list of file in a directory
type: object
properties:
current:
type: string
description: The path of the directory
list:
type: array
items:
$ref: '#/components/schemas/FsFile'
description: File list
FsFileListApiResult:
description: Api response for getFSList
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: "#/components/schemas/FsFileList"
GalleryData:
description: Gallery data
type: object
required: [meta, tags, pages]
properties:
meta:
$ref: "#/components/schemas/GMeta"
tags:
type: array
description: Gallery tags
items:
$ref: "#/components/schemas/Tag"
pages:
type: array
description: Gallery pages
items:
$ref: "#/components/schemas/ExtendedPMeta"
GalleryDataApiResult:
description: Api response for getGallery
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: "#/components/schemas/GalleryData"
GalleryList:
description: A list of galleries
type: array
items:
anyOf:
- $ref: "#/components/schemas/GMeta"
- $ref: "#/components/schemas/GMetaOptional"
GalleryListApiResult:
description: Api response for listGalleries
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: "#/components/schemas/GalleryList"
GMeta:
description: Gallery metadata
allOf:
- $ref: "#/components/schemas/GMetaOptional"
- required:
- gid
- token
- title
- title_jpn
- category
- uploader
- posted
- filecount
- filesize
- expunged
- rating
GMetaInfos:
description: Galleries' metadata
additionalProperties:
oneOf:
- allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: "#/components/schemas/GMeta"
- $ref: "#/components/schemas/ApiResponseError"
GMetaInfosApiResult:
description: Api response for getGalleriesMeta
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: '#/components/schemas/GMetaInfos'
GMetaOptional:
description: Gallery metadata
type: object
properties:
gid:
type: integer
format: int64
description: Gallery id
token:
type: string
description: Gallery token
title:
type: string
description: Title
title_jpn:
type: string
description: Japanese title
category:
type: string
description: Category
uploader:
type: string
description: Uploader's name
posted:
type: integer
format: int64
description: Posted epoch time
filecount:
type: integer
description: File count in gallery
filesize:
type: integer
format: int64
description: Total size of files
expunged:
type: boolean
description: True if gallery is not visible
rating:
type: number
description: Rating
parent_gid:
type: integer
format: int64
description: Parent gallery id
parent_token:
type: string
description: Parent gallery token
first_gid:
type: integer
format: int64
description: First gallery id
first_token:
type: string
description: First gallery token
GalleryMetadataSingle:
description: Gallery metadata from E-Hentai api
type: object
required:
- gid
- token
- title
- title_jpn
- category
- thumb
- uploader
- posted
- filecount
- filesize
- expunged
- rating
- torrentcount
- torrents
- tags
properties:
gid:
type: integer
format: int64
description: Gallery id
token:
type: string
description: Gallery token
archiver_key:
type: string
title:
type: string
description: HTML Escaped title
title_jpn:
type: string
description: HTML Escaped japanese title
category:
type: string
description: Category
thumb:
type: string
description: Thumbnail URL
uploader:
type: string
description: HTML Escaped uploader name
posted:
type: string
description: Posted epoch time
filecount:
type: string
description: File count in gallery
filesize:
type: integer
format: int64
description: Total size of files
expunged:
type: boolean
description: True if gallery is not visible
rating:
type: number
description: Rating
torrentcount:
type: integer
description: Torrent count
torrents:
type: array
items:
$ref: "#/components/schemas/GalleryMetadataTorrentInfo"
description: Torrents
tags:
type: array
items:
type: string
description: List of tags
parent_gid:
type: integer
format: int64
description: Parent gallery id
parent_token:
type: string
description: Parent gallery token
first_gid:
type: integer
format: int64
description: First gallery id
first_token:
type: string
description: First gallery token
GalleryMetadataTorrentInfo:
description: Torrent information
type: object
required: [hash, added, name, tsize, fsize]
properties:
hash:
type: string
added:
type: string
name:
type: string
tsize:
type: string
fsize:
type: string
GallerySharedTokenInfo:
description: Shared token extra information for gallery
type: object
required: [gid]
properties:
gid:
type: integer
format: int64
description: Gallery id
ImportMethod:
description: import method
type: integer
oneOf:
- title: Copy
const: 0
- title: CopyThenDelete
const: 1
- title: Move
const: 2
- title: Keep
const: 3
LogEntry:
description: Log entry
type: object
required: [id, time, message, level, type]
properties:
id:
type: integer
format: int64
description: Log entry ID
time:
type: string
format: date-time
description: Time of the log entry
example: '2025-01-01T00:00:00.000Z'
message:
type: string
description: Log message
level:
$ref: "#/components/schemas/LogLevel"
type:
type: string
description: Log type
stack:
type: string
description: Stack trace
LogEntryApiResult:
description: Api response for getLog
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: "#/components/schemas/LogEntry"
LogEntries:
description: Log entries
type: object
required: [datas]
properties:
datas:
type: array
description: Log entries
items:
$ref: "#/components/schemas/LogEntry"
count:
type: integer
format: int64
description: Total counts of log entries. Only available when pagination is requested.
LogEntriesApiResult:
description: Api response for queryLog
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: "#/components/schemas/LogEntries"
LogLevel:
description: Log level
type: integer
oneOf:
- title: Trace
const: 1
- title: Debug
const: 2
- title: Log
const: 3
- title: Info
const: 4
- title: Warn
const: 5
- title: Error
const: 6
SharedToken:
description: Shared token
type: object
required: [id, token, type, info]
properties:
id:
type: integer
description: Shared token id
token:
type: string
description: Token
expired:
type: string
format: date-time
type:
$ref: "#/components/schemas/SharedTokenType"
info:
description: Extra informations
oneOf:
- $ref: "#/components/schemas/GallerySharedTokenInfo"
SharedTokenApiResult:
description: Api response for getSharedToken
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: '#/components/schemas/SharedToken'
SharedTokenList:
description: A list of shared token
items:
oneOf:
- $ref: "#/components/schemas/SharedTokenWithUrl"
SharedTokenListApiResult:
description: Api response for listSharedToken
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: '#/components/schemas/SharedTokenList'
SharedTokenType:
description: Shared token type
type: integer
oneOf:
- title: Gallery
const: 0
SharedTokenWithUrl:
description: Shared token with shareable URL
type: object
required: [url, token]
properties:
url:
type: string
description: Shareable URL
token:
$ref: "#/components/schemas/SharedToken"
SharedTokenWithUrlApiResult:
description: Api response for updateSharedToken/createSharedToken
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: '#/components/schemas/SharedTokenWithUrl'
StatusData:
description: Server's status
type: object
required:
- ffmpeg_api_enabled
- ffmpeg_binary_enabled
- ffprobe_binary_enabled
- meilisearch_enabled
- no_user
- is_docker
- libzip_enabled
properties:
ffmpeg_api_enabled:
type: boolean
description: FFMPEG Api thumbnail generate method is available.
ffmpeg_binary_enabled:
type: boolean
description: ffmpeg binary was found. FFMPEG Binary thumbnail generate method is available.
ffprobe_binary_enabled:
type: boolean
description: ffprobe binary was found.
meilisearch_enabled:
type: boolean
description: Meilisearch server is enabled.
meilisearch:
type: object
description: Meilisearch server's configuration. Authorization is required to get this configuration.
required: [host, key]
properties:
host:
type: string
description: Meilisearch server's host
key:
type: string
description: Meilisearch api key which used to search
no_user:
type: boolean
description: True if no any users on server
is_docker:
type: boolean
description: True if server is running in docker
libzip_enabled:
type: boolean
description: True if libzip extension was enabled
StatusDataApiResult:
description: Api response for getStatus
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: '#/components/schemas/StatusData'
Tag:
description: Gallery Tag
type: object
required: [id, tag]
properties:
id:
type: integer
description: Tag id in database
tag:
type: string
description: Original tag name on E-Hentai
translated:
type: string
description: Chinese translation of tag
intro:
type: string
description: Chinese introduction of tag
TagList:
description: A list of gallery tags
type: array
items:
$ref: "#/components/schemas/Tag"
TagListApiResult:
description: Api response for getRowTags
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: '#/components/schemas/TagList'
Tags:
description: Gallery tags
type: object
additionalProperties:
oneOf:
- allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: '#/components/schemas/Tag'
- $ref: "#/components/schemas/ApiResponseError"
TagsApiResult:
description: Api response for getTags
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: '#/components/schemas/Tags'
Task:
description: Task
type: object
required: [id, type, gid, token, pid]
properties:
id:
type: integer
description: Task id
type:
$ref: '#/components/schemas/TaskType'
gid:
type: integer
format: int64
description: Gallery id
token:
type: string
description: Gallery token
pid:
type: integer
format: int64
description: Procress id
details:
type: string
description: Task configuration in JSON format
TaskApiResult:
description: Api response for createTask
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: '#/components/schemas/Task'
TaskType:
description: Task type
type: integer
oneOf:
- title: Download
const: 0
- title: ExportZip
const: 1
- title: UpdateMeiliSearchData
const: 2
- title: FixGalleryPage
const: 3
- title: Import
const: 4
- title: UpdateTagTranslation
const: 5
ThumbnailFormat:
description: Thumbnail format
type: integer
oneOf:
- title: JPEG
const: 0
description: MJPEG
- title: WEBP
const: 1
description: WEBP
ThumbnailMethod:
description: Thumbnail method
type: integer
oneOf:
- title: FFMPEG_API
const: 0
description: ffmpeg API
- title: FFMPEG_BINARY
const: 1
description: ffmpeg BINARY
Token:
description: Token information
allOf:
- $ref: "#/components/schemas/TokenWithoutToken"
- type: object
required: [token]
properties:
token:
type: string
description: Token
TokenApiResult:
description: Api response for createToken
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: '#/components/schemas/Token'
TokenWithoutToken:
description: Token information
type: object
required: [id, uid, expired, http_only, secure, last_used]
properties:
id:
type: integer
description: Token id
uid:
type: integer
description: User id
expired:
type: string
format: date-time
description: Expired time
http_only:
type: boolean
description: HttpOnly flag in cookie
secure:
type: boolean
description: secure flag in cookie
last_used:
type: string
format: date-time
description: Last used time
client:
type: string
description: Client name
device:
type: string
description: Device name
client_version:
type: string
description: Client version
client_platform:
type: string
description: Client platform
TokenWithoutTokenList:
description: A list of tokens
type: array
items:
$ref: "#/components/schemas/TokenWithoutToken"
TokenWithoutTokenListApiResult:
description: Api response for listTokens
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: '#/components/schemas/TokenWithoutTokenList'
TokenWithUserInfo:
description: Token information with user information
type: object
required: [token, name, is_admin, permissions]
properties:
token:
$ref: "#/components/schemas/Token"
name:
type: string
description: User name
is_admin:
type: boolean
description: True if user is administrator
permissions:
type: integer
description: User permissions
TokenWithUserInfoApiResult:
description: Api response for getToken/createToken
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: '#/components/schemas/TokenWithUserInfo'
User:
description: User information
type: object
required: [id, name, is_admin, permissions]
properties:
id:
type: integer
description: User id
name:
type: string
description: User name
is_admin:
type: boolean
description: True if user is administrator
permissions:
type: integer
description: User permissions
UserApiResult:
description: Api response for getUser/updateUser/changeUserName
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: '#/components/schemas/User'
UserIdApiResult:
description: Api response for createUser
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
type: integer
description: User id
UserList:
description: A list of users
type: array
items:
$ref: "#/components/schemas/User"
UserListApiResult:
description: Api response for getUsers
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: "#/components/schemas/UserList"
securitySchemes:
TokenAuth:
type: apiKey
name: X-TOKEN
in: header
TokenAuth2:
type: apiKey
name: token
in: cookie
SharedToken:
type: apiKey
name: share
in: query
OtherToken:
type: apiKey
name: token
in: query
security:
- TokenAuth: []
- TokenAuth2: []
paths:
/client/config:
delete:
operationId: deleteClientConfig
summary: Delete client configuration
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
client:
type: string
description: Client's name
name:
type: string
description: Configuration's name
required: [client, name]
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseEmpty"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 2, "error": "client is needed." }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Token from users is needed.
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
get:
operationId: getClientConfig
summary: Get client configuration
parameters:
- name: client
in: query
schema:
type: string
required: true
description: Client's name
- name: name
in: query
schema:
type: string
description: Configuration's name
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/ClientConfigApiResult"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 2, "error": "client is needed." }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Token from users is needed.
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
"404":
description: Configuration not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 404, "error": "Not found" }
put:
operationId: putClientConfig
summary: Create/Update client configuration
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
client:
type: string
description: Client's name
name:
type: string
description: Configuration's name
data:
type: string
description: Configuration's data
required: [client, name, data]
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseEmpty"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 2, "error": "client is needed." }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Token from users is needed.
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
/config:
get:
operationId: getConfig
summary: Get server's configuration
parameters:
- name: current
in: query
schema:
type: boolean
description: Whether to return current server's configuration
- name: type
in: query
schema:
enum: ["ws"]
description: Connection protocol
responses:
"101":
description: Switching Protocols to websocket
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Config"
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
text/plain:
example: Permission denied
post:
operationId: updateConfig
summary: Update server's configuration
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/ConfigOptional"
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/ConfigUpdated"
"400":
description: Bad Request
content:
text/plain:
example: Bad Request
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
text/plain:
example: Permission denied
/deploy_id:
get:
operationId: getDeployId
summary: Get deployment id
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
properties:
id:
type: string
description: Deployment id
required: [id]
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
/eh/image_limit:
get:
operationId: getEhImageLimit
summary: Get E-Hentai image limits
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/EHImageLimitApiResult"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 1, "error": "Not logged in." }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
/eh/metadata:
get:
operationId: getEhMetadata
summary: Get gallery metadata from E-Hentai api
parameters:
- name: gid
in: query
schema:
type: array
items:
type: integer
format: int64
required: true
description: List of gallery ids
- name: token
in: query
schema:
type: array
items:
type: string
required: true
description: List of gallery tokens
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/EHMetaInfoApiResult"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 3, "error": "Length of gids and tokens do not match." }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
/exit:
post:
operationId: closeServer
summary: Close Server
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
force:
type: boolean
description: Force close server
default: false
responses:
"200":
description: OK
content:
text/plain:
example: Aborted
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
text/plain:
example: Permission denied
/export/gallery/zip/{gid}:
parameters:
- name: gid
in: path
description: Gallery id
required: true
schema:
type: integer
format: int64
get:
operationId: exportGalleryZip
summary: Export gallery as Zip file
security:
- TokenAuth: []
- TokenAuth2: []
- SharedToken: []
parameters:
- name: jpn_title
in: query
description: Use japanese title
schema:
type: boolean
default: false
- name: max_length
in: query
description: Maximum length of filenames in Zip files. 0 means disable
schema:
type: integer
default: 0
- name: export_ad
in: query
description: Export pages which marked as advertisements
schema:
type: boolean
default: false
responses:
"200":
description: OK
content:
application/zip: {}
"400":
description: Bad Request
content:
text/plain:
example: Bad Request
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
text/plain:
example: Permission denied
/file/{id}:
parameters:
- name: id
in: path
description: File id
required: true
schema:
type: integer
get:
operationId: getFile
summary: Get file data/information
security:
- TokenAuth: []
- TokenAuth2: []
- SharedToken: []
- OtherToken: []
parameters:
- name: data
in: query
description: Get file information
schema:
type: boolean
default: false
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/EhFileExtendApiResult"
image/jpeg: {}
image/png: {}
image/gif: {}
"206":
description: Partial Content
content:
image/jpeg: {}
image/png: {}
image/gif: {}
"302":
description: Redirect to image URL which don't need authorization
"400":
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 400, "error": "Bad Request" }
text/plain:
example: Bad Request
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
text/plain:
example: Permission denied
"404":
description: Not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 404, "error": "File not found." }
text/plain:
example: File not found.
/file/random:
get:
operationId: getRandomFile
summary: Get random file
security:
- TokenAuth: []
- TokenAuth2: []
- OtherToken: []
parameters:
- name: action
in: query
description: Action. gentoken will generate a link which don't need extra authorization.
schema:
type: string
enum: ['gentoken']
default: null
- name: is_nsfw
in: query
description: Whether to return image which is NSFW
schema:
type: boolean
default: null
- name: is_ad
in: query
description: Whether to return image which is advertisement
schema:
type: boolean
default: null
- name: thumb
in: query
description: Whether to return image as thumbnail
schema:
type: boolean
default: false
- name: svg
in: query
description: Whether to return image as a SVG file
schema:
type: boolean
default: false
- name: jpn_title
in: query
description: Use japanese title in SVG file
schema:
type: boolean
default: false
- name: gids
in: query
description: Additional gallery added to search result.
schema:
type: array
items:
type: integer
format: int64
default: null
explode: false
- name: meili_query
in: query
description: Query used to search via meilisearch.
schema:
type: string
default: null
- name: meili_filter
in: query
description: Filter used to search via meilisearch.
schema:
type: string
default: null
responses:
"200":
description: OK
content:
application/json:
schema:
description: Api response with a empty data
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
type: string
description: Authorizated URL
image/svg+xml: {}
"302":
description: Redirect to image URL.
"400":
description: Bad Request
content:
text/plain:
example: Meilisearch is not enabled.
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
text/plain:
example: Permission denied
"404":
description: Not found
content:
text/plain:
example: File not found.
/file/upload:
post:
operationId: uploadFile
summary: Upload image file
requestBody:
content:
multipart/form-data:
schema:
type: object
required: [file, token]
properties:
file:
type: string
format: binary
description: Image file to upload
filename:
type: string
description: File name of image
default: ''
dir:
type: string
description: The directory to store image
default: ''
is_original:
type: boolean
description: True if the image is original
default: false
token:
type: string
description: Image Token
default: ''
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/EhFileApiResult"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 4, "error": "Failed to get file size." }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
"500":
description: Internal Server Error
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 500, "error": "Internal Server Error." }
/filemeta:
get:
operationId: getFilemeta
summary: Get metadata for a image
parameters:
- name: token
in: query
description: Image(page) token
required: true
schema:
type: string
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/EhFileMetaApiResult"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 400, "error": "token is needed." }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
"404":
description: Not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 404, "error": "file not found." }
post:
operationId: updateFilemeta
summary: Update metadata for images
requestBody:
content:
application/json:
schema:
oneOf:
- type: object
title: updateFilemetaWithToken
required: [token]
properties:
token:
type: string
description: Image(page) token
is_nsfw:
type: boolean
description: True if image is NSFW
is_ad:
type: boolean
description: True if image is advertisement
- type: object
title: updateFilemetaWithGid
required: [gid]
properties:
gid:
type: integer
format: int64
description: Gallery id
excludes:
type: array
items:
type: string
description: List of excluded image(page) token
is_nsfw:
type: boolean
description: True if image is NSFW
is_ad:
type: boolean
description: True if image is advertisement
- type: object
title: updateFilemetaWithTokens
required: [tokens]
properties:
tokens:
type: array
items:
type: string
description: List of image(page) token
is_nsfw:
type: boolean
description: True if image is NSFW
is_ad:
type: boolean
description: True if image is advertisement
- type: array
title: updateFilemetaWithList
items:
$ref: '#/components/schemas/EhFileMetaOptinal'
description: List of images
application/x-www-form-urlencoded:
schema:
type: object
properties:
token:
type: string
description: Image(page) token
default: ''
is_nsfw:
type: boolean
description: True if image is NSFW
default: null
is_ad:
type: boolean
description: True if image is advertisement
default: null
gid:
type: integer
format: int64
description: Gallery id, only works when token is empty.
default: ''
excludes:
type: array
items:
type: string
description: List of excluded image(page) token, only works when gid is not empty.
default: []
tokens:
type: array
items:
type: string
description: List of image(page) tokens, only works when token and gid is empty.
default: []
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseEmpty"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 2, "error": "Invaild JSON file." }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
put:
operationId: setFilemeta
summary: Set metadata for images
requestBody:
content:
application/json:
schema:
oneOf:
- type: object
title: setFilemetaWithToken
required: [token, is_nsfw, is_ad]
properties:
token:
type: string
description: Image(page) token
is_nsfw:
type: boolean
description: True if image is NSFW
is_ad:
type: boolean
description: True if image is advertisement
- type: object
title: setFilemetaWithGid
required: [gid, is_nsfw, is_ad]
properties:
gid:
type: integer
format: int64
description: Gallery id
excludes:
type: array
items:
type: string
description: List of excluded image(page) token
is_nsfw:
type: boolean
description: True if image is NSFW
is_ad:
type: boolean
description: True if image is advertisement
- type: object
title: setFilemetaWithTokens
required: [tokens, is_nsfw, is_ad]
properties:
tokens:
type: array
items:
type: string
description: List of image(page) token
is_nsfw:
type: boolean
description: True if image is NSFW
is_ad:
type: boolean
description: True if image is advertisement
- type: array
title: setFilemetaWithList
items:
$ref: '#/components/schemas/EhFileMeta'
description: List of images
application/x-www-form-urlencoded:
schema:
type: object
required: [is_nsfw, is_ad]
properties:
token:
type: string
description: Image(page) token
default: ''
is_nsfw:
type: boolean
description: True if image is NSFW
default: null
is_ad:
type: boolean
description: True if image is advertisement
default: null
gid:
type: integer
format: int64
description: Gallery id, only works when token is empty.
default: ''
excludes:
type: array
items:
type: string
description: List of excluded image(page) token, only works when gid is not empty.
default: []
tokens:
type: array
items:
type: string
description: List of image(page) tokens, only works when token and gid is empty.
default: []
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseEmpty"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 2, "error": "Invaild JSON file." }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
/filemeta/{token}:
parameters:
- name: token
in: path
description: Image(page) token
required: true
schema:
type: string
get:
operationId: getFilemeta2
summary: Get metedata for a image
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/EhFileMetaApiResult"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 400, "error": "token is needed." }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
"404":
description: Not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 404, "error": "file not found." }
/files/{token}:
parameters:
- name: token
in: path
description: List of image tokens.
required: true
schema:
type: array
items:
type: string
get:
operationId: getFiles
summary: Get files from tokens
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/EhFilesApiResult"
example:
{
"ok": true,
"status": 0,
"data":
{
"e6681787c3":
[
{
"id": 27401,
"width": 1280,
"height": 720,
"is_original": true,
},
],
},
}
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
/fs/list:
get:
operationId: getFSList
summary: Get file list of a directory on server
parameters:
- name: path
in: query
schema:
type: string
description: Path to directory. If empty, download directory will used.
- name: dir
in: query
schema:
type: boolean
default: true
description: Pass true to include directory
- name: file
in: query
schema:
type: boolean
default: True
description: Pass true to include file
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/FsFileListApiResult"
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
/gallery/{gid}:
parameters:
- name: gid
in: path
description: Gallery id
required: true
schema:
type: integer
format: int64
get:
operationId: getGallery
summary: Get gallery information
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/GalleryDataApiResult"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 400, "error": "Failed to parse gid." }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
"404":
description: Gallery not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 404, "error": "Gallery not found." }
/gallery/list:
get:
operationId: listGalleries
summary: Get a list of galleries
parameters:
- name: all
in: query
schema:
type: boolean
default: false
description: Whether to list all galleries on server
- name: offset
in: query
schema:
type: integer
format: int64
default: 0
description: Page offset
- name: limit
in: query
schema:
type: integer
default: 20
description: Page size
- name: fields
in: query
schema:
type: array
items:
type: string
enum:
- gid
- token
- title
- title_jpn
- category
- uploader
- posted
- filecount
- filesize
- expunged
- rating
- parent_gid
- parent_key
- first_gid
- first_key
explode: false
description: Filelds of gallery metadata.
- name: sort_by_gid
in: query
schema:
type: boolean
description: Whether to sort galleries by gallery id
- name: uploader
in: query
schema:
type: string
description: Filter galleries by uploader
- name: tag
in: query
schema:
type: string
description: Filter galleries by tag
- name: category
in: query
schema:
type: string
description: Filter galleries by category
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/GalleryListApiResult"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 1, "error": "Some fields not allowed." }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
/gallery/meta/{gids}:
parameters:
- name: gids
in: path
schema:
type: array
items:
type: integer
format: int64
required: true
description: List of gallery ids
get:
operationId: getGalleriesMeta
summary: Get galleries' metadata
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/GMetaInfosApiResult"
example: {
"ok": true,
"status": 0,
"data": {
"1": {
"ok": false,
"status": 404,
"error": "Not found"
},
"1467583": {
"ok": true,
"status": 0,
"data": {
"gid": 1467583,
"token": "fb8be3ee60",
"title": "(C96) [CANVAS+GARDEN (Miyasaka Miyu, Miyasaka Naco)] Bouquet vol.28",
"title_jpn": "(C96) [CANVAS+GARDEN (宮坂みゆ、宮坂なこ)] Bouquet vol.28",
"category": "Non-H",
"uploader": "RICO740",
"posted": 1566228248,
"filecount": 15,
"filesize": 99875154,
"expunged": false,
"rating": 4.73,
"parent_gid": null,
"parent_key": null,
"first_gid": null,
"first_key": null
}
}
}
}
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
/health_check:
get:
operationId: checkHealth
security: []
summary: Check server's health
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseTrue"
/log:
delete:
operationId: clearLog
summary: Clear log
parameters:
- name: type
in: query
schema:
type: string
description: Log type filter
- name: min_level
in: query
schema:
$ref: "#/components/schemas/LogLevel"
description: Minimum log level filter
- name: max_level
in: query
schema:
$ref: "#/components/schemas/LogLevel"
description: Maximum log level filter
- name: deleted_level
in: query
schema:
type: array
items:
type: integer
description: List of log levels to delete
- name: end_time
in: query
schema:
type: string
format: date-time
description: End time for log deletion
- name: optimize
in: query
schema:
type: boolean
default: true
description: Whether to optimize the log after clearing
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseTrue"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 1, "error": "Failed to parse end_time." }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
get:
operationId: queryLog
summary: Query log
parameters:
- name: page
in: query
schema:
type: integer
description: Page number
- name: limit
in: query
schema:
type: integer
description: Number of entries per page
- name: offset
in: query
schema:
type: integer
description: Offset for pagination
- name: type
in: query
schema:
type: string
description: Log type filter
- name: min_level
in: query
schema:
$ref: "#/components/schemas/LogLevel"
description: Minimum log level filter
- name: allowed_level
in: query
schema:
type: array
items:
type: integer
description: List of allowed log levels
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/LogEntriesApiResult"
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
/log/{id}:
parameters:
- name: id
in: path
schema:
type: integer
format: int64
default: ''
required: true
description: Log entry ID
delete:
operationId: deleteLog
summary: Delete a log entry
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseTrue"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 1, "error": "id is required." }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
get:
operationId: getLog
summary: Get a log entry
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/LogEntryApiResult"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 1, "error": "id is required." }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
"404":
description: Not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 404, "error": "log not found." }
/shared_token:
delete:
operationId: deleteSharedToken
summary: Delete shared token
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
type:
type: string
enum: [gallery]
description: Shared token type
token:
type: string
description: Token to identify the shared token to delete.
default: ''
required: [token, type]
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseTrue"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 1, "error": "token not specfied." }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
get:
operationId: getSharedToken
summary: Get information for shared token
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/SharedTokenApiResult"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 1, "error": "No token." }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
patch:
operationId: updateSharedToken
summary: Update shared token
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
required: [type, token]
properties:
type:
type: string
enum: [gallery]
description: Shared token type
expired:
type: integer
format: int64
description: New expired time in unix epoch (miliseconds)
default: ''
token:
type: string
description: Token
default: ''
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/SharedTokenWithUrlApiResult"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 1, "error": "Unknown type" }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
"404":
description: Not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 404, "error": "Not found" }
put:
operationId: createSharedToken
summary: Create shared token
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
required: [type]
properties:
type:
type: string
enum: [gallery]
description: Shared token type
expired:
type: integer
format: int64
description: Expired time in unix epoch (miliseconds)
default: ''
gid:
type: integer
format: int64
description: Id of shared gallery
default: ''
responses:
"201":
description: Created
content:
application/json:
schema:
$ref: "#/components/schemas/SharedTokenWithUrlApiResult"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 1, "error": "Unknown type" }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
/shared_token/list:
get:
operationId: listSharedToken
summary: Get a list of shared token
parameters:
- name: type
in: query
schema:
type: string
enum: [gallery]
description: Shared token type
required: true
- name: gid
in: query
schema:
type: integer
format: int64
default: null
description: Filter shared token by id of shared gallery.
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/SharedTokenListApiResult"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 1, "error": "Unknown type" }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
/status:
get:
operationId: getStatus
summary: Get server's status
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/StatusDataApiResult"
/tag/{id}:
parameters:
- name: id
in: path
schema:
type: array
items:
oneOf:
- type: string
description: Tag name
- type: integer
description: Tag id
required: true
description: List of tag ids/names
get:
operationId: getTags
summary: Get information of tags
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/TagsApiResult"
example: {
"ok": true,
"status": 0,
"data": {
"21509": {
"ok": true,
"status": 0,
"data": {
"id": 21509,
"tag": "artist:korie riko",
"translated": "梱枝莉子",
"intro": "梱枝りこ,梱枝,梱妈,梱枝Riko,画风颇具特色。"
}
},
"88888": {
"ok": false,
"status": 404,
"error": "tag not found."
},
"artist:miyasaka miyu": {
"ok": true,
"status": 0,
"data": {
"id": 18948,
"tag": "artist:miyasaka miyu",
"translated": "宫坂みゆ",
"intro": "宫坂なこ(miyasaka naco)的姐姐\n最喜欢吃东西和玩游戏的姐姐"
}
},
"test": {
"ok": false,
"status": 404,
"error": "tag not found."
}
}
}
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
/tag/rows:
get:
operationId: getRowTags
summary: Get a list of tags which namespace is row
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/TagListApiResult"
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
/task:
get:
operationId: createTaskConnection
summary: Create a websocket connection to receive task event
responses:
"101":
description: Switching Protocols to websocket
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
put:
operationId: createTask
summary: Create a new task
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
required: [type]
properties:
type:
type: string
enum:
- download
- export_zip
- update_meili_search_data
- import
- update_tag_translation
description: Task type
gid:
type: integer
format: int64
description: Gallery id
default: ''
token:
type: string
description: Gallery token
default: ''
cfg:
type: string
description: Task configuration in JSON format
default: ''
responses:
"201":
description: Created
content:
application/json:
schema:
$ref: "#/components/schemas/TaskApiResult"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 1, "error": "unknown type" }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
"500":
description: Internal Server Error
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 500, "error": "Internal Server Error." }
/task/download_cfg:
get:
operationId: getDefaultDownloadConfig
summary: Get default configuration for download task
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/DownloadConfigApiResult"
example: {
"ok": true,
"status": 0,
"data": {
"download_original_img": false,
"max_download_img_count": 3,
"max_retry_count": 3,
"mpv": false,
"remove_previous_gallery": true
}
}
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
/task/export_zip_cfg:
get:
operationId: getDefaultExportZipConfig
summary: Get default configuration for export as zip file task
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/ExportZipConfigApiResult"
example: {
"ok": true,
"status": 0,
"data": {
"jpn_title": false
}
}
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
/task/import_cfg:
get:
operationId: getDefaultImportConfig
summary: Get default configuration for import task
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/DefaultImportConfigApiResult"
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
/thumbnail/{id}:
parameters:
- name: id
in: path
schema:
type: integer
required: true
description: File id
get:
operationId: getThumbnail
summary: Get thumbnail of file
parameters:
- name: max
in: query
schema:
type: integer
default: 400
description: Pixels size of largest side of thumbnail. Ignored when width or height is provided.
- name: width
in: query
schema:
type: integer
description: Width of thumbnail
- name: height
in: query
schema:
type: integer
description: Height of thumbnail
- name: quality
in: query
schema:
type: integer
default: 1
description: Quality of thumbnail
- name: force
in: query
schema:
type: boolean
default: false
description: Pass true force to generate thumbnail when original image size is smaller than thumbnail size, otherwise will redirect to original image.
- name: method
in: query
schema:
type: string
enum: [cover, contain, fill]
description: 'Scale method. cover: Touch container from outside. contain: Touch container from inside. fill: Stretch to container. Only works when both width and height are provided.'
- name: align
in: query
schema:
type: string
enum: [left, top, center, right, bottom]
description: Alignment. Only works when scale method is cover or contain.
responses:
"200":
description: OK
content:
image/jpeg: {}
"302":
description: Redirect to original image URL or image URL which don't need authorization
"400":
description: Bad Request
content:
text/plain:
example: Bad Request
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
text/plain:
example: Permission denied
"404":
description: Not found
content:
text/plain:
example: File not found.
"500":
description: Internal Server Error
content:
text/plain:
example: Failed to generate thumbnail.
/token:
delete:
operationId: deleteToken
summary: Delete token (logout)
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
token:
type: string
description: Token. If empty, current authorization token will be used.
default: ''
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseTrue"
"400":
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 1, "error": "token not specified." }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 403, "error": "Permission denied." }
"404":
description: Not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 404, "error": "token not found." }
get:
operationId: getToken
summary: Get token information
parameters:
- name: token
in: query
schema:
type: string
description: Token. If empty, current authorization token will be used.
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/TokenWithUserInfoApiResult"
"400":
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 1, "error": "token not specified." }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"404":
description: Not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
examples:
token:
value: { "ok": false, "status": 404, "error": "token not found." }
user:
value: { "ok": false, "status": 404, "error": "user not found." }
patch:
operationId: updateToken
summary: Update token information
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
token:
type: string
description: Token. If empty, current authorization token will be used.
default: ''
client:
type: string
description: Client name
default: ''
device:
type: string
description: Device name
default: ''
client_version:
type: string
description: Client version
default: ''
client_platform:
type: string
description: Client platform
default: ''
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/TokenApiResult"
"400":
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 1, "error": "token not specified." }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"404":
description: Not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 404, "error": "token not found." }
"500":
description: Internal Server Error
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 500, "error": "Internal Server Error." }
put:
operationId: createToken
summary: Create token (login)
security: []
externalDocs:
url: https://github.com/lifegpc/eh-downloader/wiki/API-‐-用户&鉴权相关API#如何生成经过处理的密码
description: How to generate password
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
required: [username, password, t]
properties:
username:
type: string
description: User name
default: ''
password:
type: string
format: byte
description: Base64-encoded of processed password
default: ''
t:
type: integer
format: int64
description: Current unix timestamp in milliseconds
default: ''
set_cookie:
type: boolean
default: false
description: Add set-cookie header in response
http_only:
type: boolean
default: true
description: Add HttpOnly flag in set-cookie
secure:
type: boolean
default: false
description: Add secure flag in set-cookie
client:
type: string
description: Client name
default: ''
device:
type: string
description: Device name
default: ''
client_version:
type: string
description: Client version
default: ''
client_platform:
type: string
description: Client platform
default: ''
responses:
"201":
description: Created
content:
application/json:
schema:
$ref: "#/components/schemas/TokenApiResult"
"400":
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example:
{ "ok": false, "status": 2, "error": "Failed to decode password with base64." }
/token/manage:
delete:
operationId: deleteTokenById
summary: Delete a token by token id
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
required: [id]
properties:
id:
type: integer
format: int64
description: Token id
default: ''
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseTrue"
"400":
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 2, "error": "token id not specified." }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
examples:
admin:
description: Requires administrator privileges.
value: { "ok": false, "status": 403, "error": "Permission denied." }
root:
description: Requires root user.
value: { "ok": false, "status": 3, "error": "Only root user can delete admin user's token." }
"404":
description: Not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
examples:
user:
value: { "ok": false, "status": 404, "error": "User not found." }
token:
value: { "ok": false, "status": 404, "error": "Token not found." }
get:
operationId: listTokens
summary: List user's tokens
parameters:
- name: uid
in: query
description: User id
schema:
type: integer
- name: offset
in: query
schema:
type: integer
format: int64
description: Page offset
- name: limit
in: query
schema:
type: integer
description: Page size
- name: all_user
in: query
schema:
type: boolean
default: false
description: Return all users' tokens
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/TokenWithoutTokenListApiResult"
"400":
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 2, "error": "User id not specified." }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
examples:
admin:
description: Requires administrator privileges.
value: { "ok": false, "status": 403, "error": "Permission denied." }
root:
description: Requires root user.
value: { "ok": false, "status": 3, "error": "Only root user can delete admin user's token." }
all_user:
description: Requires root user.
value: { "ok": false, "status": 4, "error": "Only root user can get all user's tokens." }
"404":
description: Not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 404, "error": "User not found." }
/user:
delete:
operationId: deleteUser
summary: Delete a user
description: If both user id and user name are provided, user id will be used
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
id:
type: integer
description: User id
default: ''
username:
type: string
description: User name
default: ''
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseTrue"
"400":
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
examples:
user:
value: { "ok": false, "status": 1, "error": "user not specified." }
root_user:
value: { "ok": false, "status": 6, "error": "root user can not be deleted." }
delete_self:
value: { "ok": false, "status": 8, "error": "User can not delete himself." }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
examples:
admin:
description: Requires administrator privileges.
value: { "ok": false, "status": 403, "error": "Permission denied." }
root:
description: Requires root user.
value: { "ok": false, "status": 7, "error": "Only root user can delete admin user." }
"404":
description: Not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 404, "error": "User not found." }
get:
operationId: getUser
summary: Get a user's information
description: If both user id and user name are provided, user id will be used. If both user id and user name are empty, current authorizated user will be used.
parameters:
- name: id
in: query
schema:
type: integer
description: User Id
- name: username
in: query
schema:
type: integer
description: User name
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/UserApiResult"
"400":
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 1, "error": "user not specified." }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 403, "error": "Permission denied." }
"404":
description: Not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 404, "error": "User not found." }
patch:
operationId: updateUser
summary: Update a user's information
description: If both user id and user name are provided, user id will be used and provided user name will become user's new user name. If both user id and user name are empty, current authorizated user will be used.
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
id:
type: integer
description: User id
default: ''
username:
type: string
description: User name
default: ''
password:
type: string
format: password
description: New password
default: ''
is_admin:
type: boolean
description: Pass true to change a normal user to administrator user otherwise change an administrator user to a normal user. Not works for root user.
default: ''
revoke_token:
type: boolean
description: Pass true to revoke user's all token. Current used token will not be revoked.
default: false
permissions:
type: integer
description: New permissions for user
default: ''
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/UserApiResult"
"400":
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 1, "error": "user not specified." }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
examples:
admin:
description: Requires administrator privileges.
value: { "ok": false, "status": 403, "error": "Permission denied." }
change_admin:
description: Requires root user.
value: { "ok": false, "status": 4, "error": "Only root user can change other admin user's inforamtion." }
prompt_admin:
description: Requires root user.
value: { "ok": false, "status": 5, "error": "Only root user can prompt non-admin user to admin user." }
"404":
description: Not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 404, "error": "User not found." }
put:
operationId: createUser
summary: Create user
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
required: [name, password]
properties:
name:
type: string
description: User name
default: ''
password:
type: string
format: password
description: Password
default: ''
is_admin:
type: boolean
description: True if user is administrator
default: false
permissions:
type: integer
description: User's permissions
default: ''
responses:
"201":
description: Created
content:
application/json:
schema:
$ref: "#/components/schemas/UserIdApiResult"
"400":
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 1, "error": "name not specified." }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
examples:
admin:
description: Requires administrator privileges.
value: { "ok": false, "status": 403, "error": "Permission denied." }
root:
description: Requires root user.
value: { "ok": false, "status": 8, "error": "Only root user can add admin user." }
/user/change_name:
post:
operationId: changeUserName
summary: Change current user's name
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
required: [username]
properties:
username:
type: string
description: User name
default: ''
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/UserApiResult"
"400":
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 3, "error": "Name not changed." }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 403, "error": "Permission denied." }
/user/change_password:
post:
operationId: changeUserPassword
summary: Change current user's password
externalDocs:
url: https://github.com/lifegpc/eh-downloader/wiki/API-‐-用户&鉴权相关API#如何生成经过处理的密码
description: How to generate password
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
required: [old, t, new]
properties:
old:
type: string
format: byte
description: Base64-encoded of processed old password
default: ''
t:
type: integer
format: int64
description: Current unix timestamp in milliseconds
default: ''
new:
type: string
format: password
description: New password
default: ''
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseTrue"
"400":
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 5, "error": "Incorrect password" }
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 403, "error": "Permission denied." }
/user/list:
get:
operationId: getUsers
summary: Get a list of users
parameters:
- name: all
in: query
schema:
type: boolean
default: false
description: List all users
- name: offset
in: query
schema:
type: integer
format: int64
default: 0
description: Page offset
- name: limit
in: query
schema:
type: integer
default: 20
description: Page size
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/UserListApiResult"
"401":
description: Authorization information is missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 401, "error": "Unauthorized" }
"403":
description: Permission denied
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseError"
example: { "ok": false, "status": 403, "error": "Permission denied." }