pub struct InviteService { /* private fields */ }Expand description
Service for managing collaboration invites.
Invites allow entity members to invite external collaborators via their four-word identity. The service enforces:
- Permission checks (must have Edit on Members)
- Role hierarchy (can’t grant higher role than own)
- CRDT persistence for offline-first sync
Implementations§
Source§impl InviteService
impl InviteService
Sourcepub fn new(
crdt_manager: Arc<CrdtManager>,
entity_service: Arc<EntityService>,
) -> Self
pub fn new( crdt_manager: Arc<CrdtManager>, entity_service: Arc<EntityService>, ) -> Self
Create a new invite service.
Sourcepub async fn create_invite(
&self,
creator_id: &str,
request: InviteRequest,
) -> InviteServiceResult<Invite>
pub async fn create_invite( &self, creator_id: &str, request: InviteRequest, ) -> InviteServiceResult<Invite>
Create an invite to join an entity.
§Arguments
creator_id- Four-word identity of the invite creatorrequest- The invite request containing recipient, entity, and role details
§Errors
PermissionDenied- Creator doesn’t have Edit on MembersRoleEscalation- Trying to grant higher role than ownInvalidFourWords- Invalid recipient identity formatAlreadyMember- Recipient is already a member
Sourcepub async fn accept_invite(
&self,
recipient_id: &str,
invite_id: &str,
) -> InviteServiceResult<()>
pub async fn accept_invite( &self, recipient_id: &str, invite_id: &str, ) -> InviteServiceResult<()>
Accept a pending invite.
This adds the recipient as a member with the specified role.
§Arguments
recipient_id- Four-word identity of the recipient acceptinginvite_id- ID of the invite to accept
§Errors
InviteNotFound- Invite doesn’t existPermissionDenied- Actor is not the recipientInviteExpired- Invite has expiredAlreadyResolved- Invite already accepted/rejected/revoked
Sourcepub async fn reject_invite(
&self,
recipient_id: &str,
invite_id: &str,
) -> InviteServiceResult<()>
pub async fn reject_invite( &self, recipient_id: &str, invite_id: &str, ) -> InviteServiceResult<()>
Sourcepub async fn revoke_invite(
&self,
revoker_id: &str,
invite_id: &str,
) -> InviteServiceResult<()>
pub async fn revoke_invite( &self, revoker_id: &str, invite_id: &str, ) -> InviteServiceResult<()>
Revoke a pending invite.
Can be done by the creator or anyone with Edit on Members.
§Arguments
revoker_id- Four-word identity of the person revokinginvite_id- ID of the invite to revoke
§Errors
InviteNotFound- Invite doesn’t existPermissionDenied- Actor is not creator and lacks permissionsAlreadyResolved- Invite already resolved
Sourcepub async fn list_pending_invites(
&self,
recipient_id: &str,
) -> InviteServiceResult<Vec<Invite>>
pub async fn list_pending_invites( &self, recipient_id: &str, ) -> InviteServiceResult<Vec<Invite>>
List pending invites for a recipient.
Returns all invites where the recipient matches and status is Pending.
Sourcepub async fn list_all_invites_for_recipient(
&self,
recipient_id: &str,
) -> InviteServiceResult<Vec<Invite>>
pub async fn list_all_invites_for_recipient( &self, recipient_id: &str, ) -> InviteServiceResult<Vec<Invite>>
List all invites for a recipient (including resolved).
Sourcepub async fn list_entity_invites(
&self,
requester_id: &str,
entity_type: EntityType,
entity_id: &str,
) -> InviteServiceResult<Vec<Invite>>
pub async fn list_entity_invites( &self, requester_id: &str, entity_type: EntityType, entity_id: &str, ) -> InviteServiceResult<Vec<Invite>>
Sourcepub async fn get_invite(&self, invite_id: &str) -> InviteServiceResult<Invite>
pub async fn get_invite(&self, invite_id: &str) -> InviteServiceResult<Invite>
Get a single invite by ID.
Auto Trait Implementations§
impl !Freeze for InviteService
impl RefUnwindSafe for InviteService
impl Send for InviteService
impl Sync for InviteService
impl Unpin for InviteService
impl UnwindSafe for InviteService
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more