export type CreateApiV2UserAnalyticsStoreIdOptimisationsBychannelChannelIdActionNameArgs = {storeId: unknown, channelId: unknown, actionName: 'reenable' | 'disable'}; export type CreateApiV2UserAnalyticsStoreIdOptimisationsBychannelChannelIdActionNameOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Optimise products by channel * * POST /v2/user/analytics/{storeId}/optimisations/bychannel/{channelId}/{actionName} */ export const createApiV2UserAnalyticsStoreIdOptimisationsBychannelChannelIdActionName = async (args: CreateApiV2UserAnalyticsStoreIdOptimisationsBychannelChannelIdActionNameArgs, options?: CreateApiV2UserAnalyticsStoreIdOptimisationsBychannelChannelIdActionNameOptions) => { const {baseUrl = "https://api.beezup.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/v2/user/analytics/${encodeURIComponent(String(args.storeId))}/optimisations/bychannel/${encodeURIComponent(String(args.channelId))}/${encodeURIComponent(String(args.actionName))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };