export type PatchProductRequest = {price_amount?: string | undefined, discount_price?: string | undefined, auto_send_offer_price?: string | undefined, auto_negotiate_offer_price?: string | undefined, quantity?: number | undefined}; export type PatchApiApiV1ProductsByProductIdProductIdArgs = {productId: number, body: PatchProductRequest}; export type PatchApiApiV1ProductsByProductIdProductIdOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Patch an existing product by product ID * * PATCH /api/v1/products/by-product-id/{productId}/ */ export const patchApiApiV1ProductsByProductIdProductId = async (args: PatchApiApiV1ProductsByProductIdProductIdArgs, options?: PatchApiApiV1ProductsByProductIdProductIdOptions) => { const {baseUrl = "https://partnerapi-staging.depop.com", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/products/by-product-id/${encodeURIComponent(String(args.productId))}/${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 };