Skip to main content

polyester/services/
profile.rs

1//! Profile service (Go `services/profile.go` parity).
2
3use super::ServiceContext;
4use crate::errors::Result;
5use crate::models::AccountIdentity;
6
7#[derive(Clone)]
8pub struct ProfileService {
9    ctx: ServiceContext,
10}
11
12impl ProfileService {
13    pub fn new(ctx: ServiceContext) -> Self {
14        Self { ctx }
15    }
16
17    /// Subscribe to public identity updates (requires `realtime` feature).
18    pub async fn subscribe_identity(
19        &self,
20    ) -> Result<crate::realtime::TypedSubscription<AccountIdentity>> {
21        self.ctx
22            .realtime
23            .subscribe_proto(
24                "public:identity:updates:proto",
25                crate::codecs::decode::account_identity_from_bytes,
26            )
27            .await
28    }
29}