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 -20
+8 -8
constellation/src/server/mod.rs
··· 148 148 }), 149 149 ) 150 150 .route( 151 - "/xrpc/blue.microcosm.links.getDistinct", 151 + "/xrpc/blue.microcosm.links.getBacklinkDids", 152 152 get({ 153 153 let store = store.clone(); 154 154 move |accept, query| async { 155 - spawn_blocking(|| get_distinct(accept, query, store)) 155 + spawn_blocking(|| get_backlink_dids(accept, query, store)) 156 156 .await 157 157 .map_err(to500)? 158 158 } ··· 806 806 // TODO: allow reverse (er, forward) order as well 807 807 } 808 808 #[derive(Template, Serialize)] 809 - #[template(path = "get-distinct.html.j2")] 810 - struct GetDistinctItemsResponse { 809 + #[template(path = "get-backlink-dids.html.j2")] 810 + struct GetBacklinkDidsResponse { 811 811 // what does staleness mean? 812 812 // - new links have appeared. would be nice to offer a `since` cursor to fetch these. and/or, 813 813 // - links have been deleted. hmm. ··· 815 815 linking_dids: Vec<Did>, 816 816 cursor: Option<OpaqueApiCursor>, 817 817 #[serde(skip_serializing)] 818 - query: GetDistinctItemsQuery, 818 + query: GetBacklinkDidsQuery, 819 819 } 820 - fn get_distinct( 820 + fn get_backlink_dids( 821 821 accept: ExtractAccept, 822 - query: Query<GetDistinctItemsQuery>, 822 + query: Query<GetBacklinkDidsQuery>, 823 823 store: impl LinkReader, 824 824 ) -> Result<impl IntoResponse, http::StatusCode> { 825 825 let until = query ··· 853 853 854 854 Ok(acceptable( 855 855 accept, 856 - GetDistinctItemsResponse { 856 + GetBacklinkDidsResponse { 857 857 total: paged.total, 858 858 linking_dids: paged.items, 859 859 >>>>>>> 7a3e36b (Add getDistinct XRPC equivalent to REST /links/distinct-dids)
+1 -1
constellation/templates/hello.html.j2
··· 114 114 </ul> 115 115 116 116 <p style="margin-bottom: 0"><strong>Try it:</strong></p> 117 - {% call try_it::get_distinct("at://did:plc:vc7f4oafdgxsihk4cry2xpze/app.bsky.feed.post/3lgwdn7vd722r", "app.bsky.feed.like:subject.uri") %} 117 + {% call try_it::get_backlink_dids("at://did:plc:vc7f4oafdgxsihk4cry2xpze/app.bsky.feed.post/3lgwdn7vd722r", "app.bsky.feed.like:subject.uri") %} 118 118 119 119 <h3 class="route"><code>GET /links</code></h3> 120 120
+6 -8
constellation/templates/try-it-macros.html.j2
··· 142 142 </form> 143 143 {% endmacro %} 144 144 145 - {% macro get_distinct(subject, source) %} 146 - <form method="get" action="/xrpc/blue.microcosm.links.getDistinct"> 147 - <pre class="code"><strong>GET</strong> /xrpc/blue.microcosm.links.getDistinct 148 - ?subject= <input type="text" name="subject" value="{{ subject }}" placeholder="subject" /> 149 - &source= <input type="text" name="source" value="{{ source }}" placeholder="source" /> 150 - <button type="submit">get links</button> 151 - </pre> 152 - </form> 145 + {% macro get_backlink_dids(subject, source) %} 146 + <form method="get" action="/xrpc/blue.microcosm.links.getBacklinkDids"> 147 + <pre class="code"><strong>GET</strong> /xrpc/blue.microcosm.links.getBacklinkDids 148 + ?subject= <input type="text" name="subject" value="{{ subject }}" placeholder="subject" /> 149 + &source= <input type="text" name="source" value="{{ source }}" placeholder="source" /> <button type="submit">get links</button></pre> 150 + </form> 153 151 {% endmacro %} 154 152 155 153 {% macro links_count(target, collection, path) %}
+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",