diff options
| author | Leo Wandersleb <leo@leowandersleb.de> | 2023-05-06 12:29:09 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-06 12:29:09 -0400 |
| commit | 535cfcc7e5820798d027be923858fa787a50bc08 (patch) | |
| tree | 0e89f00116bc7a06f3b62112ae4252b9183ce21a | |
| parent | bc9d469c203a25a706727219fa7d37dacaf6040d (diff) | |
Document multiple queries in a COUNT request
| -rw-r--r-- | 45.md | 8 |
1 files changed, 6 insertions, 2 deletions
| @@ -14,13 +14,13 @@ 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 a verb called `COUNT`, which accepts a subscription id and filters as specified in [NIP 01](01.md). | 17 | This NIP defines the verb `COUNT`, which accepts a subscription id and filters as specified in [NIP 01](01.md). |
| 18 | 18 | ||
| 19 | ``` | 19 | ``` |
| 20 | ["COUNT", <subscription_id>, <filters JSON>...] | 20 | ["COUNT", <subscription_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 with positional "count" objects in the form `{"count": <integer>}`. Relays may use probabilistic counts to reduce compute requirements. |
| 24 | 24 | ||
| 25 | ``` | 25 | ``` |
| 26 | ["COUNT", <subscription_id>, {"count": <integer>}] | 26 | ["COUNT", <subscription_id>, {"count": <integer>}] |
| @@ -36,4 +36,8 @@ Examples: | |||
| 36 | # Count posts and reactions | 36 | # Count posts and reactions |
| 37 | ["COUNT", <subscription_id>, {"kinds": [1, 7], "authors": [<pubkey>]}] | 37 | ["COUNT", <subscription_id>, {"kinds": [1, 7], "authors": [<pubkey>]}] |
| 38 | ["COUNT", <subscription_id>, {"count": 5}] | 38 | ["COUNT", <subscription_id>, {"count": 5}] |
| 39 | |||
| 40 | # Both of the above in one `COUNT` | ||
| 41 | ["COUNT", <subscription_id>, {"kinds": [3], "#p": [<pubkey>]}, {"kinds": [1, 7], "authors": [<pubkey>]}] | ||
| 42 | ["COUNT", <subscription_id>, {"count": 238}, {"count": 5}] | ||
| 39 | ``` | 43 | ``` |