inviteMember method
Invite a member to an organization
email The email of the member to invite
role The role of the member to invite
organizationId The ID of the organization to invite the member to, optional.
resend Whether to resend the invitation, optional.
teamId The ID of the team to invite the member to, optional.
Implementation
Future<Invitation> inviteMember({
  required String email,
  required String role,
  String? organizationId,
  bool? resend,
  String? teamId,
}) async {
  try {
    final response = await dio.post(
      "/organization/invite-member",
      data: {
        "email": email,
        "role": role,
        "organizationId": organizationId,
        "resend": resend,
        "teamId": teamId,
      }..removeWhere((key, value) => value == null),
      options: await getOptions(isTokenRequired: true),
    );
    return Invitation.fromJson(response.data);
  } catch (e) {
    final message = getErrorMessage(e);
    if (message == null) rethrow;
    throw message;
  }
}