export type ProductCountryMappingDto = {mappingId?: number | undefined, countryId: number, stateId?: number | undefined, price: number}; export type CreateUpdateProductDto = {productName: string, productNameForFrench?: (string | null) | undefined, productNameForSpanish?: (string | null) | undefined, productDescription?: (string | null) | undefined, productDescriptionForFrench?: (string | null) | undefined, productDescriptionForSpanish?: (string | null) | undefined, productDescriptionForGerman?: (string | null) | undefined, upSellDescription?: (string | null) | undefined, upSellDescriptionForFrench?: (string | null) | undefined, upSellDescriptionForSpanish?: (string | null) | undefined, upSellDescriptionForGerman?: (string | null) | undefined, productSortOrder: number, isPhysical: boolean, isFastTrack?: boolean | undefined, isPaperCopy?: boolean | undefined, productCountryPrices: Array}; export type PatchApiProductsIdArgs = {id: number, body: CreateUpdateProductDto}; export type PatchApiProductsIdOptions = {baseUrl?: string | undefined, accessToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update product * * PATCH /products/{id} */ export const patchApiProductsId = async (args: PatchApiProductsIdArgs, options?: PatchApiProductsIdOptions) => { const {baseUrl = "https://api.findmydocument.net", fetch: fetchFn = fetch, accessToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (accessToken !== undefined) headers.set('authorization', `Bearer ${accessToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/products/${encodeURIComponent(String(args.id))}${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 };