export type ChannelAttributeValueMapping = {productValue?: string | undefined, channelAttributeValueCode?: string | undefined}; export type SetChannelCatalogAttributeValueMappingRequest = {mapping: Array}; export type CreateApiV2UserChannelCatalogsChannelCatalogIdAttributesChannelAttributeIdMappingArgs = {channelCatalogId: unknown, channelAttributeId: unknown, body: SetChannelCatalogAttributeValueMappingRequest}; export type CreateApiV2UserChannelCatalogsChannelCatalogIdAttributesChannelAttributeIdMappingOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Set the Channel Catalog Attribute Value Mapping * * POST /v2/user/channelCatalogs/{channelCatalogId}/attributes/{channelAttributeId}/mapping */ export const createApiV2UserChannelCatalogsChannelCatalogIdAttributesChannelAttributeIdMapping = async (args: CreateApiV2UserChannelCatalogsChannelCatalogIdAttributesChannelAttributeIdMappingArgs, options?: CreateApiV2UserChannelCatalogsChannelCatalogIdAttributesChannelAttributeIdMappingOptions) => { 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/channelCatalogs/${encodeURIComponent(String(args.channelCatalogId))}/attributes/${encodeURIComponent(String(args.channelAttributeId))}/mapping${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };