Table of Contents

Interface IProjectInvitationService

Namespace
Builvero.Application.Services
Assembly
Builvero.Application.dll

Defines the contract for project invitation operations including creation, response, cancellation, and retrieval.

public interface IProjectInvitationService

Remarks

This interface provides methods for managing project invitations:

  • Creating invitations to invite users to join projects
  • Responding to invitations (accept/decline) by invitees
  • Responding to invitations via secure token (email links)
  • Canceling pending invitations
  • Retrieving incoming invitations (for invitees)
  • Retrieving outgoing invitations (for inviters)
Invitations include secure tokens for email-based acceptance/decline without requiring login. Invitations expire after 30 days if not responded to. Only project owners and active members can invite users.

Methods

CancelInvitationAsync(Guid, Guid, CancellationToken)

Cancels a pending invitation (inviter only).

Task<ProjectInvitationDto> CancelInvitationAsync(Guid invitationId, Guid cancellerUserId, CancellationToken cancellationToken = default)

Parameters

invitationId Guid

The unique identifier of the invitation to cancel.

cancellerUserId Guid

The unique identifier of the user canceling the invitation (must be the inviter).

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<ProjectInvitationDto>

The canceled invitation DTO.

GetIncomingInvitationsAsync(Guid, CancellationToken)

Retrieves all incoming invitations for the specified user (invitations sent to them).

Task<List<ProjectInvitationDto>> GetIncomingInvitationsAsync(Guid userId, CancellationToken cancellationToken = default)

Parameters

userId Guid

The unique identifier of the user (invitee).

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<List<ProjectInvitationDto>>

A list of incoming invitation DTOs.

GetOutgoingInvitationsAsync(Guid, CancellationToken)

Retrieves all outgoing invitations created by the specified user (invitations they sent).

Task<List<ProjectInvitationDto>> GetOutgoingInvitationsAsync(Guid userId, CancellationToken cancellationToken = default)

Parameters

userId Guid

The unique identifier of the user (inviter).

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<List<ProjectInvitationDto>>

A list of outgoing invitation DTOs.

InviteUserAsync(Guid, Guid, Guid, string?, CancellationToken)

Creates a new invitation to invite a user to join a project.

Task<ProjectInvitationDto> InviteUserAsync(Guid projectId, Guid fromUserId, Guid toUserId, string? message, CancellationToken cancellationToken = default)

Parameters

projectId Guid

The unique identifier of the project to invite the user to.

fromUserId Guid

The unique identifier of the user sending the invitation (must be project owner or active member).

toUserId Guid

The unique identifier of the user being invited.

message string

Optional message to include with the invitation.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<ProjectInvitationDto>

The created invitation DTO.

RespondToInvitationAsync(Guid, Guid, bool, string?, CancellationToken)

Responds to an invitation (accept or decline) by the invitee.

Task<ProjectInvitationDto> RespondToInvitationAsync(Guid invitationId, Guid responderUserId, bool accept, string? reason, CancellationToken cancellationToken = default)

Parameters

invitationId Guid

The unique identifier of the invitation to respond to.

responderUserId Guid

The unique identifier of the user responding (must be the invitee).

accept bool

True to accept the invitation; false to decline.

reason string

Optional reason for accepting or declining.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<ProjectInvitationDto>

The updated invitation DTO.

RespondToInvitationByTokenAsync(string, bool, string?, CancellationToken)

Responds to an invitation via secure token (public endpoint, no authentication required).

Task<ProjectInvitationDto> RespondToInvitationByTokenAsync(string token, bool accept, string? reason, CancellationToken cancellationToken = default)

Parameters

token string

The secure token from the invitation email.

accept bool

True to accept the invitation; false to decline.

reason string

Optional reason for accepting or declining.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<ProjectInvitationDto>

The updated invitation DTO.