pub struct NotificationService { /* private fields */ }Expand description
Push notification service with DynamoDB caching
Implementations§
Source§impl NotificationService
impl NotificationService
Sourcepub async fn new(config: NotificationConfig) -> Result<Self, NotificationError>
pub async fn new(config: NotificationConfig) -> Result<Self, NotificationError>
Create new notification service
Sourcepub async fn send(
&self,
user_pubkey: &str,
notification: &PushNotification,
) -> Result<NotificationResult, NotificationError>
pub async fn send( &self, user_pubkey: &str, notification: &PushNotification, ) -> Result<NotificationResult, NotificationError>
Send push notification to user
Flow:
- Check DynamoDB cache for push_token
- If miss, query Supabase profiles table
- Cache token in DynamoDB
- Call Supabase send-push edge function
Sourcepub async fn send_capture_notification(
&self,
user_pubkey: &str,
cred_amount: f64,
merchant_name: &str,
) -> Result<NotificationResult, NotificationError>
pub async fn send_capture_notification( &self, user_pubkey: &str, cred_amount: f64, merchant_name: &str, ) -> Result<NotificationResult, NotificationError>
Send capture notification (convenience method)
Sourcepub async fn send_stake_notification(
&self,
user_pubkey: &str,
cred_amount: f64,
duration_days: u16,
apy: f64,
) -> Result<NotificationResult, NotificationError>
pub async fn send_stake_notification( &self, user_pubkey: &str, cred_amount: f64, duration_days: u16, apy: f64, ) -> Result<NotificationResult, NotificationError>
Send auto-stake notification
Sourcepub async fn send_unlock_notification(
&self,
user_pubkey: &str,
cred_amount: f64,
yield_amount: f64,
hours_until: u16,
) -> Result<NotificationResult, NotificationError>
pub async fn send_unlock_notification( &self, user_pubkey: &str, cred_amount: f64, yield_amount: f64, hours_until: u16, ) -> Result<NotificationResult, NotificationError>
Send unlock reminder
Auto Trait Implementations§
impl Freeze for NotificationService
impl !RefUnwindSafe for NotificationService
impl Send for NotificationService
impl Sync for NotificationService
impl Unpin for NotificationService
impl UnsafeUnpin for NotificationService
impl !UnwindSafe for NotificationService
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.