getActiveParticipationInvitations method

  1. @override
Future<List<ActiveParticipationInvitation>> getActiveParticipationInvitations([
  1. String? accountId
])
override

Get the list of active participation invitations for an accountId. This will return all deployments that this account (user) is invited to.

Note that the accountId is the unique CARP account id (and not the username). If accountId is not specified, then the account id of the currently authenticated CarpUser is used.

Implementation

@override
Future<List<ActiveParticipationInvitation>> getActiveParticipationInvitations(
    [String? accountId]) async {
  accountId ??= CarpAuthService().currentUser.id;

  Map<String, dynamic> responseJson =
      await _rpc(GetActiveParticipationInvitations(accountId));

  // we expect a list of 'items' which maps to the invitations
  List<dynamic> items = responseJson['items'] as List<dynamic>;
  return items
      .map((item) => ActiveParticipationInvitation.fromJson(
          item as Map<String, dynamic>))
      .toList();
}