Files
eh-downloader/api.yml
2024-10-02 21:06:04 +08:00

1698 lines
51 KiB
YAML

openapi: "3.1.0"
info:
title: EH Downloader API
version: "1.0"
description: EH Downloader API
servers:
- url: "{host}{base}"
variables:
host:
default: https://eh.lifegpc.com
description: Hostname
base:
default: /api
description: Base URL
description: Example 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
ClientConfigApiResult:
description: Api result for getClientConfig
type: object
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
oneOf:
- type: array
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
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
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]
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:
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: "#/components/schemas/GalleryMetadataSingle"
EHMetaInfoApiResult:
description: Api response for getEhMetadata
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
required: [data]
properties:
data:
$ref: "#/components/schemas/EHMetaInfo"
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
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"
GMeta:
description: Gallery metadata
type: object
required:
- gid
- token
- title
- title_jpn
- category
- uploader
- posted
- filecount
- filesize
- expunged
- rating
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
- archiver_key
- title
- title_jpn
- category
- thumb
- uploader
- posted
- filecount
- filesize
- expunged
- rating
- torrentcount
- torrents
- tags
properties:
gid:
type: number
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
ImportMethod:
description: import method
type: integer
oneOf:
- title: Copy
const: 0
- title: CopyThenDelete
const: 1
- title: Move
const: 2
- title: Keep
const: 3
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
ThumbnailMethod:
description: Thumbnail method
type: integer
oneOf:
- title: FFMPEG_API
const: 0
description: ffmpeg API
- title: FFMPEG_BINARY
const: 1
description: ffmpeg BINARY
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:
"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 images
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
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
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
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
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
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
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
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
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." }
/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." }
/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." }