Skip to content

Commit

Permalink
Merge pull request #7 from coracle-social/5400
Browse files Browse the repository at this point in the history
Add groups to 5400
  • Loading branch information
believethehype authored Nov 8, 2023
2 parents 4482874 + d7bd5cc commit ce7aa3f
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
26 changes: 26 additions & 0 deletions _site/kinds/5400/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ <h1 id="params">Params</h1>

<ul>
<li><code class="language-plaintext highlighter-rouge">relay</code>: a relay url to include in the count (required, client MAY provide more than one relay)</li>
<li><code class="language-plaintext highlighter-rouge">group</code>: an event field or tag name to group results by, resulting in a potentially nested dictionary of results (optional, client MAY provide more than one group). Supported groups include:
<ul>
<li><code class="language-plaintext highlighter-rouge">content</code> - an event’s <code class="language-plaintext highlighter-rouge">content</code> field</li>
<li><code class="language-plaintext highlighter-rouge">pubkey</code> - an event’s <code class="language-plaintext highlighter-rouge">pubkey</code> field</li>
<li><code class="language-plaintext highlighter-rouge">reply</code> - an event’s <code class="language-plaintext highlighter-rouge">reply</code> e-tag</li>
<li><code class="language-plaintext highlighter-rouge">root</code> - an event’s <code class="language-plaintext highlighter-rouge">root</code> e-tag</li>
<li>Any other value will be assumed to be a tag name. The first matching tag’s value will be used.</li>
</ul>
</li>
</ul>

<h1 id="how-clients-can-use-this">How clients can use this</h1>
Expand Down Expand Up @@ -119,6 +128,23 @@ <h4 id="response">Response</h4>
</span><span class="nl">"kind"</span><span class="p">:</span><span class="w"> </span><span class="mi">6400</span><span class="p">,</span><span class="w">
</span><span class="nl">"content"</span><span class="p">:</span><span class="w"> </span><span class="s2">"129469"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<h4 id="request-1">Request</h4>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="nl">"content"</span><span class="p">:</span><span class="w"> </span><span class="s2">"[{</span><span class="se">\"</span><span class="s2">#kinds</span><span class="se">\"</span><span class="s2">:[7], </span><span class="se">\"</span><span class="s2">#e</span><span class="se">\"</span><span class="s2">:[</span><span class="se">\"</span><span class="s2">7b0d90f1973da1cea186c85fbd09b3e4e455ce4d438b60a3d1f9aabc1681418f</span><span class="se">\"</span><span class="s2">}]"</span><span class="p">,</span><span class="w">
</span><span class="nl">"kind"</span><span class="p">:</span><span class="w"> </span><span class="mi">5400</span><span class="p">,</span><span class="w">
</span><span class="nl">"tags"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
</span><span class="p">[</span><span class="s2">"param"</span><span class="p">,</span><span class="w"> </span><span class="s2">"group"</span><span class="p">,</span><span class="w"> </span><span class="s2">"content"</span><span class="p">]</span><span class="w">
</span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<h4 id="response-1">Response</h4>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="nl">"kind"</span><span class="p">:</span><span class="w"> </span><span class="mi">6400</span><span class="p">,</span><span class="w">
</span><span class="nl">"content"</span><span class="p">:</span><span class="w"> </span><span class="s2">"{</span><span class="se">\"</span><span class="s2">πŸ€™</span><span class="se">\"</span><span class="s2">:224,</span><span class="se">\"</span><span class="s2">+</span><span class="se">\"</span><span class="s2">:31,</span><span class="se">\"</span><span class="s2">🧑</span><span class="se">\"</span><span class="s2">:2,</span><span class="se">\"</span><span class="s2">❀️</span><span class="se">\"</span><span class="s2">:7,</span><span class="se">\"</span><span class="s2">🀣</span><span class="se">\"</span><span class="s2">:3,</span><span class="se">\"</span><span class="s2">⚑</span><span class="se">\"</span><span class="s2">:2,</span><span class="se">\"</span><span class="s2">πŸ’œ</span><span class="se">\"</span><span class="s2">:7,</span><span class="se">\"</span><span class="s2">:thinking face:</span><span class="se">\"</span><span class="s2">:1,</span><span class="se">\"</span><span class="s2">🦢</span><span class="se">\"</span><span class="s2">:1,</span><span class="se">\"</span><span class="s2">🍺</span><span class="se">\"</span><span class="s2">:1,</span><span class="se">\"</span><span class="s2">πŸ†</span><span class="se">\"</span><span class="s2">:2,</span><span class="se">\"</span><span class="s2">πŸ€™πŸΌ</span><span class="se">\"</span><span class="s2">:3,</span><span class="se">\"</span><span class="s2">πŸ”₯</span><span class="se">\"</span><span class="s2">:2,</span><span class="se">\"</span><span class="s2">πŸ‡</span><span class="se">\"</span><span class="s2">:1,</span><span class="se">\"</span><span class="s2">πŸ’š</span><span class="se">\"</span><span class="s2">:1}"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

</div><!-- /.content -->
Expand Down
25 changes: 25 additions & 0 deletions kinds/5400.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ The input MUST be a JSON-encoded list of filters as specified in NIP 01.
# Params

* `relay`: a relay url to include in the count (required, client MAY provide more than one relay)
* `group`: an event field or tag name to group results by, resulting in a potentially nested dictionary of results (optional, client MAY provide more than one group). Supported groups include:
* `content` - an event's `content` field
* `pubkey` - an event's `pubkey` field
* `reply` - an event's `reply` e-tag
* `root` - an event's `root` e-tag
* Any other value will be assumed to be a tag name. The first matching tag's value will be used.

# How clients can use this

Expand Down Expand Up @@ -42,3 +48,22 @@ Clients may want to avoid downloading large datasets from many relays simply in
"content": "129469"
}
```

#### Request
```json
{
"content": "[{\"#kinds\":[7], \"#e\":[\"7b0d90f1973da1cea186c85fbd09b3e4e455ce4d438b60a3d1f9aabc1681418f\"}]",
"kind": 5400,
"tags": [
["param", "group", "content"]
]
}
```

#### Response
```json
{
"kind": 6400,
"content": "{\"πŸ€™\":224,\"+\":31,\"🧑\":2,\"❀️\":7,\"🀣\":3,\"⚑\":2,\"πŸ’œ\":7,\":thinking face:\":1,\"🦢\":1,\"🍺\":1,\"πŸ†\":2,\"πŸ€™πŸΌ\":3,\"πŸ”₯\":2,\"πŸ‡\":1,\"πŸ’š\":1}"
}
```

0 comments on commit ce7aa3f

Please sign in to comment.