"use strict";
/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.useFeedbackList = useFeedbackList;
exports.useFeedbackListSuspense = useFeedbackListSuspense;
exports.prefetchFeedbackList = prefetchFeedbackList;
exports.setFeedbackListData = setFeedbackListData;
exports.invalidateAllFeedbackList = invalidateAllFeedbackList;
exports.buildFeedbackListQuery = buildFeedbackListQuery;
exports.queryKeyFeedbackList = queryKeyFeedbackList;
const react_query_1 = require("@tanstack/react-query");
const feedbackList_js_1 = require("../funcs/feedbackList.js");
const primitives_js_1 = require("../lib/primitives.js");
const fp_js_1 = require("../types/fp.js");
const _context_js_1 = require("./_context.js");
/**
 * Get All Feedback
 */
function useFeedbackList(options) {
    const client = (0, _context_js_1.useInkeepAnalyticsContext)();
    return (0, react_query_1.useQuery)({
        ...buildFeedbackListQuery(client, options),
        ...options,
    });
}
/**
 * Get All Feedback
 */
function useFeedbackListSuspense(options) {
    const client = (0, _context_js_1.useInkeepAnalyticsContext)();
    return (0, react_query_1.useSuspenseQuery)({
        ...buildFeedbackListQuery(client, options),
        ...options,
    });
}
function prefetchFeedbackList(queryClient, client$) {
    return queryClient.prefetchQuery({
        ...buildFeedbackListQuery(client$),
    });
}
function setFeedbackListData(client, data) {
    const key = queryKeyFeedbackList();
    return client.setQueryData(key, data);
}
function invalidateAllFeedbackList(client, filters) {
    return client.invalidateQueries({
        ...filters,
        queryKey: ["@inkeep/inkeep-analytics", "feedback", "list"],
    });
}
function buildFeedbackListQuery(client$, options) {
    return {
        queryKey: queryKeyFeedbackList(),
        queryFn: async function feedbackListQueryFn(ctx) {
            const sig = (0, primitives_js_1.combineSignals)(ctx.signal, options?.fetchOptions?.signal);
            const mergedOptions = {
                ...options,
                fetchOptions: { ...options?.fetchOptions, signal: sig },
            };
            return (0, fp_js_1.unwrapAsync)((0, feedbackList_js_1.feedbackList)(client$, mergedOptions));
        },
    };
}
function queryKeyFeedbackList() {
    return ["@inkeep/inkeep-analytics", "feedback", "list"];
}
//# sourceMappingURL=feedbackList.js.map