import { isTruthy } from '../../utils/isTruthy.mjs';

const fetchMembers = (client)=>async ({ cursor, limit, email, roles, statuses })=>{
        const operands = [
            email && {
                filter_name: 'member_email_fuzzy',
                filter_value: email
            },
            roles && {
                filter_name: 'member_roles',
                filter_value: roles
            },
            statuses && {
                filter_name: 'statuses',
                filter_value: statuses
            }
        ].filter(isTruthy);
        const response = await client.organization.members.search({
            cursor,
            limit,
            query: operands.length > 0 ? {
                operator: 'AND',
                operands: operands
            } : undefined
        });
        return {
            ...response,
            isFetchMemberResponse: true
        };
    };
const isFetchMembersResponse = (data)=>{
    return typeof data === 'object' && data !== null && 'isFetchMemberResponse' in data && data.isFetchMemberResponse;
};

export { fetchMembers, isFetchMembersResponse };
//# sourceMappingURL=fetchMembers.mjs.map
