export type OfferId = number; export type ChannelOfferId = string; export type SKU = string; export type QuantityPrice = {amount: string, currency: string, quantity?: (string | null) | undefined}; export type PriceContainer = {id: string, quantityPriceList: Array}; export type ChannelAttribute = {attributeId: string, value: string, group?: (string | null) | undefined}; export type SellerInventoryItem = {offerId?: OfferId | undefined, channelOfferId?: ChannelOfferId | undefined, sku?: SKU | undefined, ean?: string | undefined, quantity?: string | undefined, priceList?: Array | undefined, title?: string | undefined, channelCategoryId?: string | undefined, channelAttributeList?: Array | undefined}; export type ReportSellerInventory = Array; export type CreateApiV1ChannelReportReportIdArgs = {reportId: string, body: ReportSellerInventory}; export type CreateApiV1ChannelReportReportIdOptions = {baseUrl?: string | undefined, ChannelAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Report * * POST /v1/channel/report/{reportId} */ export const createApiV1ChannelReportReportId = async (args: CreateApiV1ChannelReportReportIdArgs, options?: CreateApiV1ChannelReportReportIdOptions) => { const {baseUrl = "https://scx-sbx.api.jtl-software.com", fetch: fetchFn = fetch, ChannelAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (ChannelAuth !== undefined) headers.set('authorization', `Bearer ${ChannelAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/channel/report/${encodeURIComponent(String(args.reportId))}${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 };