pub trait UserRegistrationTokenRepository: Send + Sync {
type Error;
// Required methods
fn lookup<'life0, 'async_trait>(
&'life0 mut self,
id: Ulid,
) -> Pin<Box<dyn Future<Output = Result<Option<UserRegistrationToken>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn find_by_token<'life0, 'life1, 'async_trait>(
&'life0 mut self,
token: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<UserRegistrationToken>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn add<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
token: String,
usage_limit: Option<u32>,
expires_at: Option<DateTime<Utc>>,
) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn use_token<'life0, 'life1, 'async_trait>(
&'life0 mut self,
clock: &'life1 dyn Clock,
token: UserRegistrationToken,
) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn revoke<'life0, 'life1, 'async_trait>(
&'life0 mut self,
clock: &'life1 dyn Clock,
token: UserRegistrationToken,
) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn unrevoke<'life0, 'async_trait>(
&'life0 mut self,
token: UserRegistrationToken,
) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn set_expiry<'life0, 'async_trait>(
&'life0 mut self,
token: UserRegistrationToken,
expires_at: Option<DateTime<Utc>>,
) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn set_usage_limit<'life0, 'async_trait>(
&'life0 mut self,
token: UserRegistrationToken,
usage_limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn list<'life0, 'async_trait>(
&'life0 mut self,
filter: UserRegistrationTokenFilter,
pagination: Pagination,
) -> Pin<Box<dyn Future<Output = Result<Page<UserRegistrationToken>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn count<'life0, 'async_trait>(
&'life0 mut self,
filter: UserRegistrationTokenFilter,
) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
A UserRegistrationTokenRepository
helps interacting with
UserRegistrationToken
saved in the storage backend
Required Associated Types§
Required Methods§
Sourcefn lookup<'life0, 'async_trait>(
&'life0 mut self,
id: Ulid,
) -> Pin<Box<dyn Future<Output = Result<Option<UserRegistrationToken>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn lookup<'life0, 'async_trait>(
&'life0 mut self,
id: Ulid,
) -> Pin<Box<dyn Future<Output = Result<Option<UserRegistrationToken>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Lookup a UserRegistrationToken
by its ID
Returns None
if no UserRegistrationToken
was found
§Parameters
id
: The ID of theUserRegistrationToken
to lookup
§Errors
Returns Self::Error
if the underlying repository fails
Sourcefn find_by_token<'life0, 'life1, 'async_trait>(
&'life0 mut self,
token: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<UserRegistrationToken>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn find_by_token<'life0, 'life1, 'async_trait>(
&'life0 mut self,
token: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<UserRegistrationToken>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Lookup a UserRegistrationToken
by its token string
Returns None
if no UserRegistrationToken
was found
§Parameters
token
: The token string to lookup
§Errors
Returns Self::Error
if the underlying repository fails
Sourcefn add<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
token: String,
usage_limit: Option<u32>,
expires_at: Option<DateTime<Utc>>,
) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn add<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
token: String,
usage_limit: Option<u32>,
expires_at: Option<DateTime<Utc>>,
) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Create a new UserRegistrationToken
Returns the newly created UserRegistrationToken
§Parameters
rng
: The random number generator to useclock
: The clock used to generate timestampstoken
: The token stringusage_limit
: Optional limit on how many times the token can be usedexpires_at
: Optional expiration time for the token
§Errors
Returns Self::Error
if the underlying repository fails
Sourcefn use_token<'life0, 'life1, 'async_trait>(
&'life0 mut self,
clock: &'life1 dyn Clock,
token: UserRegistrationToken,
) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn use_token<'life0, 'life1, 'async_trait>(
&'life0 mut self,
clock: &'life1 dyn Clock,
token: UserRegistrationToken,
) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Increment the usage count of a UserRegistrationToken
Returns the updated UserRegistrationToken
§Parameters
clock
: The clock used to generate timestampstoken
: TheUserRegistrationToken
to update
§Errors
Returns Self::Error
if the underlying repository fails
Sourcefn revoke<'life0, 'life1, 'async_trait>(
&'life0 mut self,
clock: &'life1 dyn Clock,
token: UserRegistrationToken,
) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn revoke<'life0, 'life1, 'async_trait>(
&'life0 mut self,
clock: &'life1 dyn Clock,
token: UserRegistrationToken,
) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Revoke a UserRegistrationToken
§Parameters
clock
: The clock used to generate timestampstoken
: TheUserRegistrationToken
to delete
§Errors
Returns Self::Error
if the underlying repository fails
Sourcefn unrevoke<'life0, 'async_trait>(
&'life0 mut self,
token: UserRegistrationToken,
) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn unrevoke<'life0, 'async_trait>(
&'life0 mut self,
token: UserRegistrationToken,
) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Unrevoke a previously revoked UserRegistrationToken
§Parameters
token
: TheUserRegistrationToken
to unrevoke
§Errors
Returns Self::Error
if the underlying repository fails
Sourcefn set_expiry<'life0, 'async_trait>(
&'life0 mut self,
token: UserRegistrationToken,
expires_at: Option<DateTime<Utc>>,
) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_expiry<'life0, 'async_trait>(
&'life0 mut self,
token: UserRegistrationToken,
expires_at: Option<DateTime<Utc>>,
) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Set the expiration time of a UserRegistrationToken
§Parameters
token
: TheUserRegistrationToken
to updateexpires_at
: The new expiration time, orNone
to remove the expiration
§Errors
Returns Self::Error
if the underlying repository fails
Sourcefn set_usage_limit<'life0, 'async_trait>(
&'life0 mut self,
token: UserRegistrationToken,
usage_limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_usage_limit<'life0, 'async_trait>(
&'life0 mut self,
token: UserRegistrationToken,
usage_limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Set the usage limit of a UserRegistrationToken
§Parameters
token
: TheUserRegistrationToken
to updateusage_limit
: The new usage limit, orNone
to remove the limit
§Errors
Returns Self::Error
if the underlying repository fails
Sourcefn list<'life0, 'async_trait>(
&'life0 mut self,
filter: UserRegistrationTokenFilter,
pagination: Pagination,
) -> Pin<Box<dyn Future<Output = Result<Page<UserRegistrationToken>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list<'life0, 'async_trait>(
&'life0 mut self,
filter: UserRegistrationTokenFilter,
pagination: Pagination,
) -> Pin<Box<dyn Future<Output = Result<Page<UserRegistrationToken>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List UserRegistrationToken
s based on the provided filter
Returns a list of matching UserRegistrationToken
s
§Parameters
filter
: The filter to applypagination
: The pagination parameters
§Errors
Returns Self::Error
if the underlying repository fails
Sourcefn count<'life0, 'async_trait>(
&'life0 mut self,
filter: UserRegistrationTokenFilter,
) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn count<'life0, 'async_trait>(
&'life0 mut self,
filter: UserRegistrationTokenFilter,
) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Count UserRegistrationToken
s based on the provided filter
Returns the number of matching UserRegistrationToken
s
§Parameters
filter
: The filter to apply
§Errors
Returns Self::Error
if the underlying repository fails