diff options
| -rw-r--r-- | 45.md | 22 |
1 files changed, 11 insertions, 11 deletions
| @@ -14,17 +14,17 @@ Some queries a client may want to execute against connected relays are prohibiti | |||
| 14 | 14 | ||
| 15 | ## Filters and return values | 15 | ## Filters and return values |
| 16 | 16 | ||
| 17 | This NIP defines the verb `COUNT`, which accepts a subscription id and filters as specified in [NIP 01](01.md) for the verb `REQ`. Multiple filters are OR'd together and aggregated into a single count result. | 17 | This NIP defines the verb `COUNT`, which accepts a query id and filters as specified in [NIP 01](01.md) for the verb `REQ`. Multiple filters are OR'd together and aggregated into a single count result. |
| 18 | 18 | ||
| 19 | ``` | 19 | ``` |
| 20 | ["COUNT", <subscription_id>, <filters JSON>...] | 20 | ["COUNT", <query_id>, <filters JSON>...] |
| 21 | ``` | 21 | ``` |
| 22 | 22 | ||
| 23 | Counts are returned using a `COUNT` response in the form `{"count": <integer>}`. Relays may use probabilistic counts to reduce compute requirements. | 23 | Counts are returned using a `COUNT` response in the form `{"count": <integer>}`. Relays may use probabilistic counts to reduce compute requirements. |
| 24 | In case a relay uses probabilistic counts, it MAY indicate it in the response with `approximate` key i.e. `{"count": <integer>, "approximate": <true|false>}`. | 24 | In case a relay uses probabilistic counts, it MAY indicate it in the response with `approximate` key i.e. `{"count": <integer>, "approximate": <true|false>}`. |
| 25 | 25 | ||
| 26 | ``` | 26 | ``` |
| 27 | ["COUNT", <subscription_id>, {"count": <integer>}] | 27 | ["COUNT", <query_id>, {"count": <integer>}] |
| 28 | ``` | 28 | ``` |
| 29 | 29 | ||
| 30 | Whenever the relay decides to refuse to fulfill the `COUNT` request, it MUST return a `CLOSED` message. | 30 | Whenever the relay decides to refuse to fulfill the `COUNT` request, it MUST return a `CLOSED` message. |
| @@ -34,27 +34,27 @@ Whenever the relay decides to refuse to fulfill the `COUNT` request, it MUST ret | |||
| 34 | ### Followers count | 34 | ### Followers count |
| 35 | 35 | ||
| 36 | ``` | 36 | ``` |
| 37 | ["COUNT", <subscription_id>, {"kinds": [3], "#p": [<pubkey>]}] | 37 | ["COUNT", <query_id>, {"kinds": [3], "#p": [<pubkey>]}] |
| 38 | ["COUNT", <subscription_id>, {"count": 238}] | 38 | ["COUNT", <query_id>, {"count": 238}] |
| 39 | ``` | 39 | ``` |
| 40 | 40 | ||
| 41 | ### Count posts and reactions | 41 | ### Count posts and reactions |
| 42 | 42 | ||
| 43 | ``` | 43 | ``` |
| 44 | ["COUNT", <subscription_id>, {"kinds": [1, 7], "authors": [<pubkey>]}] | 44 | ["COUNT", <query_id>, {"kinds": [1, 7], "authors": [<pubkey>]}] |
| 45 | ["COUNT", <subscription_id>, {"count": 5}] | 45 | ["COUNT", <query_id>, {"count": 5}] |
| 46 | ``` | 46 | ``` |
| 47 | 47 | ||
| 48 | ### Count posts approximately | 48 | ### Count posts approximately |
| 49 | 49 | ||
| 50 | ``` | 50 | ``` |
| 51 | ["COUNT", <subscription_id>, {"kinds": [1]}] | 51 | ["COUNT", <query_id>, {"kinds": [1]}] |
| 52 | ["COUNT", <subscription_id>, {"count": 93412452, "approximate": true}] | 52 | ["COUNT", <query_id>, {"count": 93412452, "approximate": true}] |
| 53 | ``` | 53 | ``` |
| 54 | 54 | ||
| 55 | ### Relay refuses to count | 55 | ### Relay refuses to count |
| 56 | 56 | ||
| 57 | ``` | 57 | ``` |
| 58 | ["COUNT", <subscription_id>, {"kinds": [4], "authors": [<pubkey>], "#p": [<pubkey>]}] | 58 | ["COUNT", <query_id>, {"kinds": [1059], "#p": [<pubkey>]}] |
| 59 | ["CLOSED", <subscription_id>, "auth-required: cannot count other people's DMs"] | 59 | ["CLOSED", <query_id>, "auth-required: cannot count other people's DMs"] |
| 60 | ``` | 60 | ``` |