this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feature: Add describeFeedGenerator endpoint (#1)

authored by

Tom Sherman and committed by
GitHub
8f2ab965 eacede6b

+23 -2
+15
src/http/handle_describe_feed_generator.rs
··· 1 + use anyhow::Result; 2 + use axum::{extract::State, response::IntoResponse, Json}; 3 + use serde_json::json; 4 + 5 + use crate::errors::SupercellError; 6 + 7 + use super::context::WebContext; 8 + 9 + pub async fn handle_describe_feed_generator( 10 + State(web_context): State<WebContext>, 11 + ) -> Result<impl IntoResponse, SupercellError> { 12 + Ok(Json(json!({ 13 + "feeds": web_context.feeds.keys().map(|k| json!({"uri": k})).collect::<Vec<_>>(), 14 + }))) 15 + }
+1
src/http/mod.rs
··· 1 1 pub mod context; 2 + pub mod handle_describe_feed_generator; 2 3 pub mod handle_get_feed_skeleton; 3 4 pub mod handle_index; 4 5 pub mod handle_well_known;
+7 -2
src/http/server.rs
··· 1 1 use super::{ 2 - context::WebContext, handle_get_feed_skeleton::handle_get_feed_skeleton, 3 - handle_index::handle_index, handle_well_known::handle_well_known, 2 + context::WebContext, handle_describe_feed_generator::handle_describe_feed_generator, 3 + handle_get_feed_skeleton::handle_get_feed_skeleton, handle_index::handle_index, 4 + handle_well_known::handle_well_known, 4 5 }; 5 6 use axum::{http::HeaderValue, routing::get, Router}; 6 7 use http::{ ··· 19 20 .route( 20 21 "/xrpc/app.bsky.feed.getFeedSkeleton", 21 22 get(handle_get_feed_skeleton), 23 + ) 24 + .route( 25 + "/xrpc/app.bsky.feed.describeFeedGenerator", 26 + get(handle_describe_feed_generator), 22 27 ) 23 28 .layer(( 24 29 TraceLayer::new_for_http(),