Atproto, Router, add atproto api mod with Nsid

Sets up a generic atproto module to store atproto implementation. Mainly
doing this so that I can switch between rsky/atrium as well as add my
own layers on top.

This also switches the old Xrpc/Router use of Nsid to the atproto api
implementation of it. Next up is the DB where I'll need a bunch of
these.
This commit is contained in:
Julia Lange 2025-04-25 13:52:02 -07:00
parent d4a3a71e2f
commit db33099405
Signed by: Julia
SSH key fingerprint: SHA256:50XUMcOFYPUs9/1j7p9SPnwASZ7QnxXm7THF7HkbqzQ
6 changed files with 858 additions and 32 deletions

View file

@ -1,8 +1,11 @@
use crate::router::xrpc::{
XrpcEndpoint,
XrpcHandler,
QueryInput,
ProcedureInput,
use crate::{
atproto::Nsid,
router::xrpc::{
XrpcEndpoint,
XrpcHandler,
QueryInput,
ProcedureInput,
}
};
use axum::Router as AxumRouter;
use core::net::SocketAddr;
@ -19,13 +22,13 @@ pub enum Endpoint {
Xrpc(XrpcEndpoint),
}
impl Endpoint {
pub fn new_xrpc_query<Q>(nsid: String, query: Q) -> Self
pub fn new_xrpc_query<Q>(nsid: Nsid, query: Q) -> Self
where
Q: XrpcHandler<QueryInput> + Clone
{
Endpoint::Xrpc(XrpcEndpoint::new_query(nsid,query))
}
pub fn new_xrpc_procedure<P>(nsid: String, procedure: P) -> Self
pub fn new_xrpc_procedure<P>(nsid: Nsid, procedure: P) -> Self
where
P: XrpcHandler<ProcedureInput> + Clone
{