export type BeezUPCommonBeezUPColumnName = string; export type CatalogColumnName = string; export type BeezUPColumnMappingBatchRequestItem = {beezUPColumnName: BeezUPCommonBeezUPColumnName, catalogColumnName?: CatalogColumnName | undefined}; export type UpdateApiV2UserCatalogsStoreIdBeezUPColumnsArgs = {storeId: unknown, body: Array}; export type UpdateApiV2UserCatalogsStoreIdBeezUPColumnsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Replace the BeezUPColumns' Mapping of a Store. * * PUT /v2/user/catalogs/{storeId}/beezUPColumns */ export const updateApiV2UserCatalogsStoreIdBeezUPColumns = async (args: UpdateApiV2UserCatalogsStoreIdBeezUPColumnsArgs, options?: UpdateApiV2UserCatalogsStoreIdBeezUPColumnsOptions) => { const {baseUrl = "https://api.beezup.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v2/user/catalogs/${encodeURIComponent(String(args.storeId))}/beezUPColumns${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };