export type FileDeleteWS = {productRefId: string, identifier: string}; export type DeleteApiProductsV1ResourcesFileDeleteArgs = {body: FileDeleteWS}; export type DeleteApiProductsV1ResourcesFileDeleteOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete file from product * * DELETE /products/v1/resources/file/delete */ export const deleteApiProductsV1ResourcesFileDelete = async (args: DeleteApiProductsV1ResourcesFileDeleteArgs, options?: DeleteApiProductsV1ResourcesFileDeleteOptions) => { const {baseUrl = "https://marketplace.appdirect.com/api", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/products/v1/resources/file/delete${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", 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 };