export type Channel = string; export type OfferId = number; export type SellerId = string; export type ChannelOfferId = string; export type OfferStockList = {offerList?: (Array<{channel: Channel, offerId: OfferId, sellerId: SellerId, channelOfferId?: ChannelOfferId | undefined, quantity: unknown}>) | undefined}; export type UpdateApiV1SellerOfferStockArgs = {body: OfferStockList}; export type UpdateApiV1SellerOfferStockOptions = {baseUrl?: string | undefined, SellerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Stock * * * PUT /v1/seller/offer/stock */ export const updateApiV1SellerOfferStock = async (args: UpdateApiV1SellerOfferStockArgs, options?: UpdateApiV1SellerOfferStockOptions) => { 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/stock${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 };