export type UpdateCatalogGroupReference = {CatalogGroupId: string, CatalogItemId?: string | undefined, GroupType: 'ModifierGroup'}; export type Metafield = {Key: string, Value: string}; export type UpdateCatalogItem = {Sku?: string | undefined, Name?: string | undefined, Description?: string | undefined, Price?: (number | null) | undefined, ImageFileName?: string | undefined, Alcohol?: (boolean | null) | undefined, Groups?: Array | undefined, Metafields?: Array | undefined}; export type CreateApiApiV10AppIdCatalogItemsCatalogItemIdArgs = {appId: string, catalogItemId: string, body: UpdateCatalogItem}; export type CreateApiApiV10AppIdCatalogItemsCatalogItemIdOptions = {baseUrl?: string | undefined, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Catalog Item * * POST /api/v1.0/{appId}/catalog/items/{catalogItemId} */ export const createApiApiV10AppIdCatalogItemsCatalogItemId = async (args: CreateApiApiV10AppIdCatalogItemsCatalogItemIdArgs, options?: CreateApiApiV10AppIdCatalogItemsCatalogItemIdOptions) => { const {baseUrl = "https://api.flipdish.co", fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1.0/${encodeURIComponent(String(args.appId))}/catalog/items/${encodeURIComponent(String(args.catalogItemId))}${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 };