export type UpdateProductReference = {CatalogItemId: string, ProductType: 'Product' | 'Modifier', PreselectedQuantity?: number | undefined}; export type Metafield = {Key: string, Value: string}; export type UpdateGroup = {Sku?: string | undefined, Name?: string | undefined, AutogenerateDisplayText?: (boolean | null) | undefined, ImageFileName?: string | undefined, MinSelectCount?: (number | null) | undefined, MaxSelectCount?: (number | null) | undefined, Products?: Array | undefined, Metafields?: Array | undefined}; export type CreateApiApiV10AppIdCatalogGroupsCatalogItemIdArgs = {appId: string, catalogItemId: string, body: UpdateGroup}; export type CreateApiApiV10AppIdCatalogGroupsCatalogItemIdOptions = {baseUrl?: string | undefined, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Catalog Group * * POST /api/v1.0/{appId}/catalog/groups/{catalogItemId} */ export const createApiApiV10AppIdCatalogGroupsCatalogItemId = async (args: CreateApiApiV10AppIdCatalogGroupsCatalogItemIdArgs, options?: CreateApiApiV10AppIdCatalogGroupsCatalogItemIdOptions) => { 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/groups/${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 };