add pagination / drop duplicate fields

This commit is contained in:
kieran 2024-05-20 21:38:36 +01:00
parent 8d6d588715
commit bd9c7a1b8e
No known key found for this signature in database
GPG Key ID: DE71CEB3925BE941

34
96.md
View File

@ -1,8 +1,6 @@
NIP-96 # NIP-96
======
HTTP File Storage Integration ## HTTP File Storage Integration
-----------------------------
`draft` `optional` `draft` `optional`
@ -84,8 +82,7 @@ it must use the "api_url" field instead.
See https://github.com/aljazceru/awesome-nostr#nip-96-file-storage-servers. See https://github.com/aljazceru/awesome-nostr#nip-96-file-storage-servers.
## Auth
## Auth
When indicated, `clients` must add an [NIP-98](98.md) `Authorization` header (**optionally** with the encoded `payload` tag set to the base64-encoded 256-bit SHA-256 hash of the file - not the hash of the whole request body). When indicated, `clients` must add an [NIP-98](98.md) `Authorization` header (**optionally** with the encoded `payload` tag set to the base64-encoded 256-bit SHA-256 hash of the file - not the hash of the whole request body).
@ -96,6 +93,7 @@ When indicated, `clients` must add an [NIP-98](98.md) `Authorization` header (**
**AUTH required** **AUTH required**
List of form fields: List of form fields:
- `file`: **REQUIRED** the file to upload - `file`: **REQUIRED** the file to upload
- `caption`: **RECOMMENDED** loose description; - `caption`: **RECOMMENDED** loose description;
- `expiration`: UNIX timestamp in seconds. Empty string if file should be stored forever. The server isn't required to honor this. - `expiration`: UNIX timestamp in seconds. Empty string if file should be stored forever. The server isn't required to honor this.
@ -276,22 +274,27 @@ The successful response is a 200 OK one with just basic JSON fields:
## Listing files ## Listing files
`GET $api_url` `GET $api_url?page=x&count=y`
**AUTH required** **AUTH required**
Returns a list of files linked to the authenticated users pubkey. Returns a list of files linked to the authenticated users pubkey.
Example Response: Example Response:
```js ```js
[ [
{ {
"id": "<sha256-hash>", "id": "<sha256-hash>",
"nip94_event": {...}, "nip94_event": {
"expires": 1715691139, // unix timestamp "tags": [
"size": 123456, ["size", "123456"],
"alt": "a meme that makes you laugh", ["alt", "a meme that makes you laugh"],
"caption": "haha funny meme" ["expiration", "1715691139"]
// ...other metadata
]
"content": "haha funny meme" // caption
}
}, },
... ...
] ]
@ -301,7 +304,10 @@ Example Response:
`nip94_event` is the same as in the upload result. `nip94_event` is the same as in the upload result.
`alt` / `caption` are optional. ### Query args
- `page` page number (`offset=page*count`)
- `count` number of items per page
## Selecting a Server ## Selecting a Server