Table of Contents

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

oauthAccount OAuthAccount

The OAuth account entity to create.

cancellationToken CancellationToken

Cancellation 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

provider OAuthProvider

The OAuth provider (e.g., Google, LinkedIn).

providerUserId string

The unique user identifier from the OAuth provider.

cancellationToken CancellationToken

Cancellation 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

userId Guid

The unique identifier of the user.

cancellationToken CancellationToken

Cancellation 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

oauthAccount OAuthAccount

The OAuth account entity with updated values.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<OAuthAccount>

The updated OAuth account entity.