export type DeleteApiCatalogsArgs = {Authorization: string, 'User-Agent': string, 'Brand-Id'?: string | undefined, 'Branch-Id': string}; export type DeleteApiCatalogsOptions = {baseUrl?: string | undefined, CareemIDPClientCredentials?: string | undefined, fetch?: typeof fetch | undefined}; /** * Reset/delete catalog * * DELETE /catalogs */ export const deleteApiCatalogs = async (args: DeleteApiCatalogsArgs, options?: DeleteApiCatalogsOptions) => { const {baseUrl = "https://apigateway.careemdash.com/pos/api/v1", fetch: fetchFn = fetch, CareemIDPClientCredentials} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) if (args['User-Agent'] != null) headers.set("User-Agent", String(args['User-Agent'])) if (args['Brand-Id'] != null) headers.set("Brand-Id", String(args['Brand-Id'])) if (args['Branch-Id'] != null) headers.set("Branch-Id", String(args['Branch-Id'])) if (CareemIDPClientCredentials !== undefined) headers.set('authorization', `Bearer ${CareemIDPClientCredentials}`) const url = `${baseUrl.replace(/\/+$/, '')}/catalogs${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };