export type Channel = string; export type OfferId = number; export type SellerId = string; export type ChannelOfferId = string; export type QuantityPrice = {amount: string, currency: string, quantity?: (string | null) | undefined}; export type PriceContainer = {id: string, quantityPriceList: Array}; export type OfferPriceChangeList = {offerList?: (Array<{channel: Channel, offerId: OfferId, sellerId: SellerId, channelOfferId?: ChannelOfferId | undefined, priceList: Array}>) | undefined}; export type UpdateApiV1SellerOfferPriceArgs = {body: OfferPriceChangeList}; export type UpdateApiV1SellerOfferPriceOptions = {baseUrl?: string | undefined, SellerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Price * * PUT /v1/seller/offer/price */ export const updateApiV1SellerOfferPrice = async (args: UpdateApiV1SellerOfferPriceArgs, options?: UpdateApiV1SellerOfferPriceOptions) => { const {baseUrl = "https://scx-sbx.api.jtl-software.com", fetch: fetchFn = fetch, SellerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (SellerAuth !== undefined) headers.set('authorization', `Bearer ${SellerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/seller/offer/price${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 };