···251 ///
252 /// deprecated: use `did`, which can be repeated multiple times
253 from_dids: Option<String>, // comma separated: gross
254- limit: Option<u64>,
0255 // TODO: allow reverse (er, forward) order as well
000256}
257#[derive(Template, Serialize)]
258#[template(path = "links.html.j2")]
···278 .transpose()?
279 .map(|c| c.next);
280281- let limit = query.limit.unwrap_or(DEFAULT_CURSOR_LIMIT);
282 if limit > DEFAULT_CURSOR_LIMIT_MAX {
283 return Err(http::StatusCode::BAD_REQUEST);
284 }
285286- let mut filter_dids: HashSet<Did> = HashSet::from_iter(query.did.iter().map(|d| Did(d.to_string())));
0000000287288 if let Some(comma_joined) = &query.from_dids {
289 if !filter_dids.is_empty() {
···251 ///
252 /// deprecated: use `did`, which can be repeated multiple times
253 from_dids: Option<String>, // comma separated: gross
254+ #[serde(default = "get_default_limit")]
255+ limit: u64,
256 // TODO: allow reverse (er, forward) order as well
257+}
258+fn get_default_limit() -> u64 {
259+ DEFAULT_CURSOR_LIMIT
260}
261#[derive(Template, Serialize)]
262#[template(path = "links.html.j2")]
···282 .transpose()?
283 .map(|c| c.next);
284285+ let limit = query.limit;
286 if limit > DEFAULT_CURSOR_LIMIT_MAX {
287 return Err(http::StatusCode::BAD_REQUEST);
288 }
289290+ let mut filter_dids: HashSet<Did> = HashSet::from_iter(
291+ query
292+ .did
293+ .iter()
294+ .map(|d| d.trim())
295+ .filter(|d| !d.is_empty())
296+ .map(|d| Did(d.to_string())),
297+ );
298299 if let Some(comma_joined) = &query.from_dids {
300 if !filter_dids.is_empty() {
+9-6
constellation/templates/hello.html.j2
···2021 <p>
22 This server has indexed <span class="stat">{{ stats.linking_records|human_number }}</span> links between <span class="stat">{{ stats.targetables|human_number }}</span> targets and sources from <span class="stat">{{ stats.dids|human_number }}</span> identities over <span class="stat">{{ days_indexed|human_number }}</span> days.<br/>
23- <small>(indexing new records in real time, backfill still TODO)</small>
24 </p>
2526- <p>The API is currently <strong>unstable</strong>. But feel free to use it! If you want to be nice, put your project name and bsky username (or email) in your user-agent header for api requests.</p>
272829 <h2>API Endpoints</h2>
···35 <h4>Query parameters:</h4>
3637 <ul>
38- <li><code>target</code>: required, must url-encode. Example: <code>at://did:plc:vc7f4oafdgxsihk4cry2xpze/app.bsky.feed.post/3lgwdn7vd722r</code></li>
39- <li><code>collection</code>: required. Example: <code>app.bsky.feed.like</code></li>
40- <li><code>path</code>: required, must url-encode. Example: <code>.subject.uri</code></li>
00041 </ul>
4243 <p style="margin-bottom: 0"><strong>Try it:</strong></p>
44- {% call try_it::links("at://did:plc:vc7f4oafdgxsihk4cry2xpze/app.bsky.feed.post/3lgwdn7vd722r", "app.bsky.feed.like", ".subject.uri") %}
454647 <h3 class="route"><code>GET /links/distinct-dids</code></h3>
···2021 <p>
22 This server has indexed <span class="stat">{{ stats.linking_records|human_number }}</span> links between <span class="stat">{{ stats.targetables|human_number }}</span> targets and sources from <span class="stat">{{ stats.dids|human_number }}</span> identities over <span class="stat">{{ days_indexed|human_number }}</span> days.<br/>
23+ <small>(indexing new records in real time, backfill coming soon!)</small>
24 </p>
2526+ <p>But feel free to use it! If you want to be nice, put your project name and bsky username (or email) in your user-agent header for api requests.</p>
272829 <h2>API Endpoints</h2>
···35 <h4>Query parameters:</h4>
3637 <ul>
38+ <li><p><code>target</code>: required, must url-encode. Example: <code>at://did:plc:vc7f4oafdgxsihk4cry2xpze/app.bsky.feed.post/3lgwdn7vd722r</code></p></li>
39+ <li><p><code>collection</code>: required. Example: <code>app.bsky.feed.like</code></p></li>
40+ <li><p><code>path</code>: required, must url-encode. Example: <code>.subject.uri</code></p></li>
41+ <li><p><code>did</code>: optional, filter links to those from specific users. Include multiple times to filter by multiple users. Example: <code>did=did:plc:vc7f4oafdgxsihk4cry2xpze&did=did:plc:vc7f4oafdgxsihk4cry2xpze</code></p></li>
42+ <li><p><code>from_dids</code> [deprecated]: optional. Use <code>did</code> instead. Example: <code>from_dids=did:plc:vc7f4oafdgxsihk4cry2xpze,did:plc:vc7f4oafdgxsihk4cry2xpze</code></p></li>
43+ <li><p><code>limit</code>: optional. Default: <code>16</code>. Maximum: <code>100</code></p></li>
44 </ul>
4546 <p style="margin-bottom: 0"><strong>Try it:</strong></p>
47+ {% call try_it::links("at://did:plc:a4pqq234yw7fqbddawjo7y35/app.bsky.feed.post/3m237ilwc372e", "app.bsky.feed.like", ".subject.uri", [""], 16) %}
484950 <h3 class="route"><code>GET /links/distinct-dids</code></h3>