pub trait UpstreamOAuthLinkRepository: Send + Sync {
type Error;
// Required methods
fn lookup<'life0, 'async_trait>(
&'life0 mut self,
id: Ulid,
) -> Pin<Box<dyn Future<Output = Result<Option<UpstreamOAuthLink>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn find_by_subject<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
upstream_oauth_provider: &'life1 UpstreamOAuthProvider,
subject: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<UpstreamOAuthLink>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn add<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
upstream_oauth_provider: &'life3 UpstreamOAuthProvider,
subject: String,
) -> Pin<Box<dyn Future<Output = Result<UpstreamOAuthLink, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn associate_to_user<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
upstream_oauth_link: &'life1 UpstreamOAuthLink,
user: &'life2 User,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn list<'life0, 'life1, 'async_trait>(
&'life0 mut self,
filter: UpstreamOAuthLinkFilter<'life1>,
pagination: Pagination,
) -> Pin<Box<dyn Future<Output = Result<Page<UpstreamOAuthLink>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn count<'life0, 'life1, 'async_trait>(
&'life0 mut self,
filter: UpstreamOAuthLinkFilter<'life1>,
) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}
Expand description
An UpstreamOAuthLinkRepository
helps interacting with
UpstreamOAuthLink
with 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<UpstreamOAuthLink>, 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<UpstreamOAuthLink>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Lookup an upstream OAuth link by its ID
Returns None
if the link does not exist
§Parameters
id
: The ID of the upstream OAuth link to lookup
§Errors
Returns Self::Error
if the underlying repository fails
sourcefn find_by_subject<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
upstream_oauth_provider: &'life1 UpstreamOAuthProvider,
subject: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<UpstreamOAuthLink>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn find_by_subject<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
upstream_oauth_provider: &'life1 UpstreamOAuthProvider,
subject: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<UpstreamOAuthLink>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Find an upstream OAuth link for a provider by its subject
Returns None
if no matching upstream OAuth link was found
§Parameters
upstream_oauth_provider
: The upstream OAuth provider on which to find the linksubject
: The subject of the upstream OAuth link to find
§Errors
Returns Self::Error
if the underlying repository fails
sourcefn add<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
upstream_oauth_provider: &'life3 UpstreamOAuthProvider,
subject: String,
) -> Pin<Box<dyn Future<Output = Result<UpstreamOAuthLink, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn add<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
upstream_oauth_provider: &'life3 UpstreamOAuthProvider,
subject: String,
) -> Pin<Box<dyn Future<Output = Result<UpstreamOAuthLink, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Add a new upstream OAuth link
Returns the newly created upstream OAuth link
§Parameters
rng
: The random number generator to useclock
: The clock used to generate timestampsupsream_oauth_provider
: The upstream OAuth provider for which to create the linksubject
: The subject of the upstream OAuth link to create
§Errors
Returns Self::Error
if the underlying repository fails
sourcefn associate_to_user<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
upstream_oauth_link: &'life1 UpstreamOAuthLink,
user: &'life2 User,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn associate_to_user<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
upstream_oauth_link: &'life1 UpstreamOAuthLink,
user: &'life2 User,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Associate an upstream OAuth link to a user
Returns the updated upstream OAuth link
§Parameters
upstream_oauth_link
: The upstream OAuth link to updateuser
: The user to associate to the upstream OAuth link
§Errors
Returns Self::Error
if the underlying repository fails
sourcefn list<'life0, 'life1, 'async_trait>(
&'life0 mut self,
filter: UpstreamOAuthLinkFilter<'life1>,
pagination: Pagination,
) -> Pin<Box<dyn Future<Output = Result<Page<UpstreamOAuthLink>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list<'life0, 'life1, 'async_trait>(
&'life0 mut self,
filter: UpstreamOAuthLinkFilter<'life1>,
pagination: Pagination,
) -> Pin<Box<dyn Future<Output = Result<Page<UpstreamOAuthLink>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List UpstreamOAuthLink
with the given filter and pagination
§Parameters
filter
: The filter to applypagination
: The pagination parameters
§Errors
Returns Self::Error
if the underlying repository fails
sourcefn count<'life0, 'life1, 'async_trait>(
&'life0 mut self,
filter: UpstreamOAuthLinkFilter<'life1>,
) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn count<'life0, 'life1, 'async_trait>(
&'life0 mut self,
filter: UpstreamOAuthLinkFilter<'life1>,
) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Count the number of UpstreamOAuthLink
with the given filter
§Parameters
filter
: The filter to apply
§Errors
Returns Self::Error
if the underlying repository fails