export type SellerId = string; export type OfferId = number; export type OfferListingFailedError = {code: string, message: string, longMessage?: (string | null) | undefined, relatedAttributeId?: (string | null) | undefined, recommendedValue?: (string | null) | undefined}; export type OfferListingFailed = {sellerId: SellerId, offerId: OfferId, errorList: Array, failedAt: string}; export type OfferListingFailedList = {offerList: Array}; export type CreateApiV1ChannelOfferListingFailedArgs = {body: OfferListingFailedList}; export type CreateApiV1ChannelOfferListingFailedOptions = {baseUrl?: string | undefined, ChannelAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Mark Listing as failed * * * POST /v1/channel/offer/listing-failed */ export const createApiV1ChannelOfferListingFailed = async (args: CreateApiV1ChannelOfferListingFailedArgs, options?: CreateApiV1ChannelOfferListingFailedOptions) => { 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/offer/listing-failed${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 };