export type PutApiProductsId = {key?: string | undefined, secret?: string | undefined, name: string, success_url?: string | undefined, cancel_url?: string | undefined, error_url?: string | undefined, webhook_endpoint_ids?: Array | undefined, webhook_url?: string | undefined, page_header?: string | undefined, page_footer?: string | undefined, free?: boolean | undefined, active?: boolean | undefined, private?: boolean | undefined, performance_period?: boolean | undefined, performance_period_type?: ('purchase_date' | 'custom_text' | 'relative_date') | undefined, performance_period_text?: string | undefined, form?: ('download' | 'course' | 'event' | 'service') | undefined, webhook_endpoint_form?: ('all_webhook_endpoints' | 'selected_webhook_endpoints' | 'no_webhook_endpoints') | undefined, forward?: ({first_name?: string | undefined, last_name?: string | undefined, email?: string | undefined, coupon?: string | undefined, campaign_id?: string | undefined}) | undefined, team_members?: (Array<{id: number, commission?: number | undefined}>) | undefined, prices_attributes?: (Array<{id?: number | undefined, position?: number | undefined, pricing_plan_id: number}>) | undefined, success_email?: ({subject_en?: string | undefined, subject_de?: string | undefined, body_en?: string | undefined, body_de?: string | undefined}) | undefined}; export type UpdateApiApiProductsIdArgs = {id: number, body: PutApiProductsId}; export type UpdateApiApiProductsIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Update product * * PUT /api/products/{id} */ export const updateApiApiProductsId = async (args: UpdateApiApiProductsIdArgs, options: UpdateApiApiProductsIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/api/products/${encodeURIComponent(String(args.id))}${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 };