mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-11-13 23:39:08 -05:00
Add some numeric filters
This commit is contained in:
parent
f0fa515df8
commit
1669f2d751
51
17.md
51
17.md
|
@ -24,43 +24,62 @@ New fields may be added to this NIP later.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
{
|
{
|
||||||
"kind": ..., // 1, 23, 0, ...
|
"kind": ..., // 1, 30023, 0, ...
|
||||||
..., // regular keys
|
..., // regular keys
|
||||||
"nip17": {
|
"nip17": {
|
||||||
"+": 8, // kind 7 "+" reaction count
|
|
||||||
"-": 0, // kind 7 "-" reaction count
|
|
||||||
"country": "US", // ISO 3166-1 alpha-2 code extracted from NIP-32 label (geohash/country/... l tag) or detected by IP
|
"country": "US", // ISO 3166-1 alpha-2 code extracted from NIP-32 label (geohash/country/... l tag) or detected by IP
|
||||||
"emoji": {
|
"followers": 500, // sent with kind 0 events
|
||||||
"🤙️": 10, // kind 7 specific emoji reaction count
|
|
||||||
}
|
|
||||||
"followers": 500, // sent with kind 0
|
|
||||||
"language": "en", // ISO 639-1 code of detected event.content language
|
"language": "en", // ISO 639-1 code of detected event.content language
|
||||||
|
"reactions": {
|
||||||
|
"+": 8, // kind 7 "+" reaction count (should be the sum of "+" and all emoji reactions)
|
||||||
|
"-": 0, // kind 7 "-" reaction count
|
||||||
|
"🤙️": 10 // kind 7 specific emoji reaction count
|
||||||
|
},
|
||||||
"relays": ["wss://relay.url"], // event found originally on these relays
|
"relays": ["wss://relay.url"], // event found originally on these relays
|
||||||
"replies": 10, // direct descendant kind 1 reply count
|
"replies": 10, // direct descendant kind 1 reply count
|
||||||
"reposts": 20, // NIP-18 repost count
|
"reposts": 20, // NIP-18 repost count
|
||||||
"views": 900, // request count from different IPs, device ids or pubkeys
|
"views": 900, // request count from different IPs, device ids or pubkeys
|
||||||
"zaps": 7, // kind 9735 count
|
"zaps": 7, // kind 9735 count
|
||||||
"zap_amount": 10000, // kind 9735 millisats amount sum
|
"zap_amount": 10000 // kind 9735 millisats amount sum
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Filter Extensions
|
## Filter Extensions
|
||||||
|
|
||||||
Clients can use extra filter attributes when requesting events.
|
Clients can use extra filter attributes when requesting events. They additional attributes
|
||||||
|
are limited to a subset of the NIP-17 fields and are namespaced in the `nip17` filter key.
|
||||||
|
|
||||||
Relays should use NIP-11 `supported_nip_extensions` when supporting an extension.
|
Relays should use NIP-11 `supported_nip_extensions` when supporting an extension.
|
||||||
|
|
||||||
For example: { "supported_nips": [17], "supported_nip_extensions": ["nip17language", "nip17country"] }
|
For example: { "supported_nips": [17], "supported_nip_extensions": ["nip17language", "nip17country"] }
|
||||||
|
|
||||||
### NIP-17language
|
|
||||||
|
|
||||||
Filter by language.
|
|
||||||
|
|
||||||
Example request: `["REQ", <sub_id>, { kinds: [1], ..., nip17: { language: ["en", "pt"] } }]`
|
|
||||||
|
|
||||||
### NIP-17country
|
### NIP-17country
|
||||||
|
|
||||||
Filter by country.
|
Filter by country.
|
||||||
|
|
||||||
Example request: `["REQ", <sub_id>, { kinds: [1], ..., nip17: { country: ["US", "GB"] } }]`
|
Example request: `["REQ", <sub_id>, { "kinds": [1], ..., "nip17": { "country": ["US", "GB"] } }]`
|
||||||
|
|
||||||
|
### NIP-17followers
|
||||||
|
|
||||||
|
Filter by number of followers.
|
||||||
|
|
||||||
|
Example request: `["REQ", <sub_id>, { "kinds": [0], ..., "nip17": { "followers": ">100000" } }]`
|
||||||
|
|
||||||
|
### NIP-17language
|
||||||
|
|
||||||
|
Filter by language.
|
||||||
|
|
||||||
|
Example request: `["REQ", <sub_id>, { "kinds": [1], ..., "nip17": { "language": ["en", "pt"] } }]`
|
||||||
|
|
||||||
|
### NIP-17reactions
|
||||||
|
|
||||||
|
Filter by number of reactions. Just `reactions.+` and `reactions.-` fields.
|
||||||
|
|
||||||
|
Example request: `["REQ", <sub_id>, { "kinds": [1], ..., "nip17": { "reactions.+": ">1000", "reactions.-": "<1000" } }]`
|
||||||
|
|
||||||
|
### NIP-17replies
|
||||||
|
|
||||||
|
Filter by number of replies.
|
||||||
|
|
||||||
|
Example request: `["REQ", <sub_id>, { "kinds": [1], ..., "nip17": { "replies": ">100" } }]`
|
||||||
|
|
Loading…
Reference in New Issue
Block a user