add query args to Listing Files

This commit is contained in:
Quentin 2024-06-29 10:11:15 +02:00
parent 436f7ac2e9
commit 78ee7203af

14
96.md
View File

@ -282,9 +282,10 @@ The successful response is a 200 OK one with just basic JSON fields:
## Listing files ## Listing files
`GET $api_url?page=x&count=y&sort=z&search=w` `GET $api_url?page=x&count=y&sort=z&order=w&search=term`
AUTH **required** for pubkey file listing. AUTH **required** for pubkey file listing.
AUTH **NOT** required for public file listing. AUTH **NOT** required for public file listing.
Returns a list of files. If auth event is present, the server should return only files uploaded by the pubkey in the auth event. Returns a list of files. If auth event is present, the server should return only files uploaded by the pubkey in the auth event.
@ -304,7 +305,7 @@ Example Response:
["size", "123456"], ["size", "123456"],
["alt", "a meme that makes you laugh"], ["alt", "a meme that makes you laugh"],
["expiration", "1715691139"], ["expiration", "1715691139"],
["file_tags", "cat, meme, funny, laugh"], ["file_tags", "cat, meme, funny, laugh"],
// ...other metadata // ...other metadata
] ]
"content": "haha funny meme", // caption "content": "haha funny meme", // caption
@ -319,8 +320,13 @@ Example Response:
### Query args ### Query args
- `page` page number (`offset=page*count`) - `page` **REQUIRED** Page number (`offset=page*count`)
- `count` number of items per page - `count` **REQUIRED** Number of items per page
- `sort` **OPTIONAL** Can be 'created_at' or 'size'. Default is 'created_at'.
- `order` **OPTIONAL** Page order 'ASC' or 'DESC'. Default is 'DESC'.
- `search` **OPTIONAL** Search term. The server should search in the `alt` and `file_tags` fields.
The server can or not support optional query args.
## Selecting a Server ## Selecting a Server