Constellation, Spacedust, Slingshot, UFOs: atproto crates and services for microcosm

Rename method name to fetch backlink DIDs

Renaming from `getDistinct` to `getBacklinkDids` to better reflect the
output type and the close relationship to the `getBacklinks` method.

+18 -34
+9 -9
constellation/src/server/mod.rs
··· 112 112 }), 113 113 ) 114 114 .route( 115 - "/xrpc/blue.microcosm.links.getDistinct", 115 + "/xrpc/blue.microcosm.links.getBacklinkDids", 116 116 get({ 117 117 let store = store.clone(); 118 118 move |accept, query| async { 119 - spawn_blocking(|| get_distinct(accept, query, store)) 119 + spawn_blocking(|| get_backlink_dids(accept, query, store)) 120 120 .await 121 121 .map_err(to500)? 122 122 } ··· 612 612 } 613 613 614 614 #[derive(Clone, Deserialize)] 615 - struct GetDistinctItemsQuery { 615 + struct GetBacklinkDidsQuery { 616 616 subject: String, 617 617 source: String, 618 618 cursor: Option<OpaqueApiCursor>, ··· 620 620 // TODO: allow reverse (er, forward) order as well 621 621 } 622 622 #[derive(Template, Serialize)] 623 - #[template(path = "get-distinct.html.j2")] 624 - struct GetDistinctItemsResponse { 623 + #[template(path = "get-backlink-dids.html.j2")] 624 + struct GetBacklinkDidsResponse { 625 625 // what does staleness mean? 626 626 // - new links have appeared. would be nice to offer a `since` cursor to fetch these. and/or, 627 627 // - links have been deleted. hmm. ··· 629 629 linking_dids: Vec<Did>, 630 630 cursor: Option<OpaqueApiCursor>, 631 631 #[serde(skip_serializing)] 632 - query: GetDistinctItemsQuery, 632 + query: GetBacklinkDidsQuery, 633 633 } 634 - fn get_distinct( 634 + fn get_backlink_dids( 635 635 accept: ExtractAccept, 636 - query: Query<GetDistinctItemsQuery>, 636 + query: Query<GetBacklinkDidsQuery>, 637 637 store: impl LinkReader, 638 638 ) -> Result<impl IntoResponse, http::StatusCode> { 639 639 let until = query ··· 667 667 668 668 Ok(acceptable( 669 669 accept, 670 - GetDistinctItemsResponse { 670 + GetBacklinkDidsResponse { 671 671 total: paged.total, 672 672 linking_dids: paged.items, 673 673 cursor,
+3 -19
constellation/templates/hello.html.j2
··· 82 82 25, 83 83 ) %} 84 84 85 - 86 - <h3 class="route"><code>GET /xrpc/blue.microcosm.links.getCounts</code></h3> 87 - 88 - <p>The total number of links pointing at a given target.</p> 89 - 90 - <h4>Query parameters:</h4> 91 - 92 - <ul> 93 - <li><code>subject</code>: required, must url-encode. The target being linked to. Example: <code>did:plc:vc7f4oafdgxsihk4cry2xpze</code> or <code>at://did:plc:vc7f4oafdgxsihk4cry2xpze/app.bsky.feed.post/3lgwdn7vd722r</code></li> 94 - <li><code>source</code>: required. Collection and path specification for the primary link. Example: <code>app.bsky.feed.like:subject.uri</code></li> 95 - </ul> 96 - 97 - <p style="margin-bottom: 0"><strong>Try it:</strong></p> 98 - {% call try_it::get_counts("did:plc:vc7f4oafdgxsihk4cry2xpze", "app.bsky.graph.block:subject.uri") %} 99 - 100 - 101 - <h3 class="route"><code>GET /xrpc/blue.microcosm.links.getDistinct</code></h3> 85 + <h3 class="route"><code>GET /xrpc/blue.microcosm.links.getBacklinkDids</code></h3> 102 86 103 87 <p>A list of distinct DIDs (identities) with links to a target.</p> 104 88 ··· 112 96 </ul> 113 97 114 98 <p style="margin-bottom: 0"><strong>Try it:</strong></p> 115 - {% call try_it::get_distinct("at://did:plc:vc7f4oafdgxsihk4cry2xpze/app.bsky.feed.post/3lgwdn7vd722r", "app.bsky.feed.like:subject.uri") %} 99 + {% call try_it::get_backlink_dids("at://did:plc:vc7f4oafdgxsihk4cry2xpze/app.bsky.feed.post/3lgwdn7vd722r", "app.bsky.feed.like:subject.uri") %} 116 100 117 101 118 102 <h3 class="route"><code>GET /links</code></h3> ··· 148 132 </ul> 149 133 150 134 <p style="margin-bottom: 0"><strong>Try it:</strong></p> 151 - {% call try_it::get_distinct("at://did:plc:vc7f4oafdgxsihk4cry2xpze/app.bsky.feed.post/3lgwdn7vd722r", "app.bsky.feed.like:.subject.uri") %} 135 + {% call try_it::get_backlink_dids("at://did:plc:vc7f4oafdgxsihk4cry2xpze/app.bsky.feed.post/3lgwdn7vd722r", "app.bsky.feed.like:.subject.uri") %} 152 136 153 137 <h3 class="route"><code>GET /links/distinct-dids</code></h3> 154 138
+3 -3
constellation/templates/try-it-macros.html.j2
··· 104 104 </form> 105 105 {% endmacro %} 106 106 107 - {% macro get_distinct(subject, source) %} 108 - <form method="get" action="/xrpc/blue.microcosm.links.getDistinct"> 109 - <pre class="code"><strong>GET</strong> /xrpc/blue.microcosm.links.getDistinct 107 + {% macro get_backlink_dids(subject, source) %} 108 + <form method="get" action="/xrpc/blue.microcosm.links.getBacklinkDids"> 109 + <pre class="code"><strong>GET</strong> /xrpc/blue.microcosm.links.getBacklinkDids 110 110 ?subject= <input type="text" name="subject" value="{{ subject }}" placeholder="subject" /> 111 111 &source= <input type="text" name="source" value="{{ source }}" placeholder="source" /> 112 112 <button type="submit">get links</button>
+1 -1
lexicons/blue.microcosm/links/getDistinct.json lexicons/blue.microcosm/links/getBacklinkDids.json
··· 1 1 { 2 2 "lexicon": 1, 3 - "id": "blue.microcosm.links.getDistinct", 3 + "id": "blue.microcosm.links.getBacklinkDids", 4 4 "defs": { 5 5 "main": { 6 6 "type": "query",