forked from DebaucheryLibrarian/traxxx
Added rudimentary API documentation to README.
This commit is contained in:
parent
e6c52002f0
commit
ca22aedaaa
16
README.md
16
README.md
|
@ -87,6 +87,22 @@ To generate thumbnails for new logos and tag photos, install ImageMagick and run
|
|||
* `--no-save`: Do not store retrieved information in local database, forcing re-fetch.
|
||||
* `--level`: Change log level to `silly`, `verbose`, `info`, `warn` or `error`.
|
||||
|
||||
### API
|
||||
A GraphQL API is available at `/graphql`, and a REST API is available at the following endpoints:
|
||||
|
||||
* `/api/scenes`: Fetch the latest releases. Supports search with `query` or `q` parameter;
|
||||
* `/api/scenes/{ID}`: Fetch scene by ID.
|
||||
* `/api/actors`: Fetch actors. Search `query` or `q` parameter required.
|
||||
* `/api/actors/{ID|slug}`: Fetch detailed actor by ID or slug.
|
||||
* `/api/entities`: Fetch networks and channels. Use the `type` parameter to filter for either `channel`s or `network`s.
|
||||
* `/api/entities/{ID|slug}`: Fetch detailed network or channel by ID. To fetch by slug, the `type` parameter must specify either `channel` or `network`.
|
||||
* `/api/channels`: Fetch channel entities. Supports the `q` or `query` parameter for searching.
|
||||
* `/api/channels/{ID|slug}`: Fetch detailed channel by ID or slug.
|
||||
* `/api/networks`: Fetch networks. Supports a `q` or `query` parameter for searching.
|
||||
* `/api/networks/{ID|slug}`: Fetch detailed network by ID or slug.
|
||||
* `/api/tags`: Fetch tags.
|
||||
* `/api/tags/{ID|slug|name}`: Fetch detailed tag by ID, slug or name.
|
||||
|
||||
## Supported networks & sites
|
||||
896 channels on 64 networks, continuously expanding!
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ async function fetchEntities(type, limit) {
|
|||
}
|
||||
|
||||
async function searchEntities(query, type, limit) {
|
||||
const entities = await knex
|
||||
const entities = knex
|
||||
.select(knex.raw(`
|
||||
entities.*,
|
||||
COALESCE(json_agg(tags) FILTER (WHERE tags.id IS NOT NULL), '[]') as tags,
|
||||
|
@ -184,9 +184,10 @@ async function searchEntities(query, type, limit) {
|
|||
.groupBy('entities.id', 'parents.id')
|
||||
.limit(limit || 100);
|
||||
|
||||
return curateEntities(entities);
|
||||
}
|
||||
console.log(entities.toString());
|
||||
|
||||
return curateEntities(await entities);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
curateEntity,
|
||||
|
|
|
@ -19,7 +19,6 @@ async function fetchTagsApi(req, res) {
|
|||
res.send({ tags });
|
||||
}
|
||||
|
||||
|
||||
module.exports = {
|
||||
fetchTag: fetchTagApi,
|
||||
fetchTags: fetchTagsApi,
|
||||
|
|
Loading…
Reference in New Issue