docs(openapi): annotate federation actors handlers and add doc module
This commit is contained in:
@@ -45,6 +45,14 @@ impl FromAppState for FederationActorsDeps {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[utoipa::path(
|
||||||
|
get, path = "/federation/actors/{handle}/posts",
|
||||||
|
params(
|
||||||
|
("handle" = String, Path, description = "Fediverse handle (@user@instance.tld)"),
|
||||||
|
PaginationQuery,
|
||||||
|
),
|
||||||
|
responses((status = 200, description = "Posts by this remote actor"))
|
||||||
|
)]
|
||||||
pub async fn remote_actor_posts_handler(
|
pub async fn remote_actor_posts_handler(
|
||||||
Deps(d): Deps<FederationActorsDeps>,
|
Deps(d): Deps<FederationActorsDeps>,
|
||||||
Path(handle): Path<String>,
|
Path(handle): Path<String>,
|
||||||
@@ -73,6 +81,14 @@ pub async fn remote_actor_posts_handler(
|
|||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[utoipa::path(
|
||||||
|
get, path = "/federation/actors/{handle}/followers-list",
|
||||||
|
params(
|
||||||
|
("handle" = String, Path, description = "Fediverse handle (@user@instance.tld)"),
|
||||||
|
PaginationQuery,
|
||||||
|
),
|
||||||
|
responses((status = 200, description = "Followers of this remote actor", body = ActorConnectionPageResponse)),
|
||||||
|
)]
|
||||||
pub async fn actor_followers_handler(
|
pub async fn actor_followers_handler(
|
||||||
Deps(d): Deps<FederationActorsDeps>,
|
Deps(d): Deps<FederationActorsDeps>,
|
||||||
Path(handle): Path<String>,
|
Path(handle): Path<String>,
|
||||||
@@ -81,6 +97,14 @@ pub async fn actor_followers_handler(
|
|||||||
actor_connections_handler(d, handle, "followers", q.page() as u32).await
|
actor_connections_handler(d, handle, "followers", q.page() as u32).await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[utoipa::path(
|
||||||
|
get, path = "/federation/actors/{handle}/following-list",
|
||||||
|
params(
|
||||||
|
("handle" = String, Path, description = "Fediverse handle (@user@instance.tld)"),
|
||||||
|
PaginationQuery,
|
||||||
|
),
|
||||||
|
responses((status = 200, description = "Accounts this remote actor follows", body = ActorConnectionPageResponse)),
|
||||||
|
)]
|
||||||
pub async fn actor_following_handler(
|
pub async fn actor_following_handler(
|
||||||
Deps(d): Deps<FederationActorsDeps>,
|
Deps(d): Deps<FederationActorsDeps>,
|
||||||
Path(handle): Path<String>,
|
Path(handle): Path<String>,
|
||||||
|
|||||||
15
crates/presentation/src/openapi/federation_actors.rs
Normal file
15
crates/presentation/src/openapi/federation_actors.rs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
use utoipa::OpenApi;
|
||||||
|
|
||||||
|
#[derive(OpenApi)]
|
||||||
|
#[openapi(
|
||||||
|
paths(
|
||||||
|
crate::handlers::federation_actors::remote_actor_posts_handler,
|
||||||
|
crate::handlers::federation_actors::actor_followers_handler,
|
||||||
|
crate::handlers::federation_actors::actor_following_handler,
|
||||||
|
),
|
||||||
|
components(schemas(
|
||||||
|
api_types::responses::ActorConnectionPageResponse,
|
||||||
|
api_types::responses::ActorConnectionResponse,
|
||||||
|
)),
|
||||||
|
)]
|
||||||
|
pub struct FederationActorsDoc;
|
||||||
Reference in New Issue
Block a user