Interface IOAuthAccountRepository
- Namespace
- Builvero.Application.Interfaces.Repositories
- Assembly
- Builvero.Application.dll
Defines the contract for OAuth account data access operations including retrieval, creation, and updates.
public interface IOAuthAccountRepository
Remarks
This repository interface provides methods for managing OAuth account entities, which link external OAuth provider accounts (Google, LinkedIn) to user accounts in the system. This enables users to authenticate using their OAuth provider credentials.
Methods
CreateAsync(OAuthAccount, CancellationToken)
Creates a new OAuth account entity in the database.
Task<OAuthAccount> CreateAsync(OAuthAccount oauthAccount, CancellationToken cancellationToken = default)
Parameters
oauthAccountOAuthAccountThe OAuth account entity to create.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<OAuthAccount>
The created OAuth account entity with generated ID and timestamps.
GetByProviderAndProviderUserIdAsync(OAuthProvider, string, CancellationToken)
Retrieves an OAuth account by provider and provider user ID.
Task<OAuthAccount?> GetByProviderAndProviderUserIdAsync(OAuthProvider provider, string providerUserId, CancellationToken cancellationToken = default)
Parameters
providerOAuthProviderThe OAuth provider (e.g., Google, LinkedIn).
providerUserIdstringThe unique user identifier from the OAuth provider.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<OAuthAccount>
The OAuth account entity if found; otherwise, null.
GetByUserIdAsync(Guid, CancellationToken)
Retrieves all OAuth accounts linked to a specific user.
Task<List<OAuthAccount>> GetByUserIdAsync(Guid userId, CancellationToken cancellationToken = default)
Parameters
userIdGuidThe unique identifier of the user.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<List<OAuthAccount>>
A list of OAuth accounts linked to the user.
UpdateAsync(OAuthAccount, CancellationToken)
Updates an existing OAuth account entity in the database.
Task<OAuthAccount> UpdateAsync(OAuthAccount oauthAccount, CancellationToken cancellationToken = default)
Parameters
oauthAccountOAuthAccountThe OAuth account entity with updated values.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<OAuthAccount>
The updated OAuth account entity.