import { apiServiceZdesk } from "../../utils/axios";
export function getProfile({ connectionId, token }) {
    const url = `/auth/profile`;
    return apiServiceZdesk({ connectionId, token }).get(url);
}
const default_path = '/business-users';
export function getBusinessUsers({ connectionId, token, data }) {
    const params = transformApiRequestPayload(data);
    return apiServiceZdesk({ connectionId, token }).get(default_path, {
        params
    });
}
export const transformApiRequestPayload = (payload) => {
    try {
        const transformedPayload = {};
        for (const [key, value] of Object.entries(payload)) {
            if (value !== undefined && value !== null) {
                transformedPayload[key] = value;
            }
        }
        return transformedPayload;
    }
    catch (error) {
        console.error('Error transforming API request payload:', error);
        return payload;
    }
};
const default_path_group = '/business-groups';
export function getBusinessGroups({ connectionId, token, data }) {
    const params = transformApiRequestPayload(data);
    return apiServiceZdesk({ connectionId, token }).get(default_path_group, {
        params
    });
}
