export type ChannelFeatureList = {invoiceDocumentTransfer?: ('not-supported' | 'from-channel' | 'from-seller') | undefined, priceUpdatesSupported?: boolean | undefined, quantityPriceSupported?: boolean | undefined, remainingQuanitySupported?: boolean | undefined, variationsSupported?: boolean | undefined, returnTrackingRequired?: boolean | undefined, allowCombineOrders?: boolean | undefined, stockUpdateWithoutEventSupported?: boolean | undefined}; export type MinimumClientsVersionRequired = {type: string, version: string}; export type ChannelSelfUpdate = {mfaPin: string, displayName?: string | undefined, currency?: string | undefined, marketplaceList?: Array | undefined, website?: string | undefined, mfaContact?: (string | null) | undefined, vendor?: string | undefined, signUpUrl?: string | undefined, updateUrl?: string | undefined, featureList?: ChannelFeatureList | undefined, minimumClientsVersionRequired?: (Array | null) | undefined}; export type PatchApiV1ChannelArgs = {body: ChannelSelfUpdate}; export type PatchApiV1ChannelOptions = {baseUrl?: string | undefined, ChannelAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Channel * * PATCH /v1/channel */ export const patchApiV1Channel = async (args: PatchApiV1ChannelArgs, options?: PatchApiV1ChannelOptions) => { 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${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };