export type CreateApiProductsV1ResourcesImageUploadAndLinkArgs = {body: BodyInit}; export type CreateApiProductsV1ResourcesImageUploadAndLinkOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Upload and link image to product * * POST /products/v1/resources/image/uploadAndLink */ export const createApiProductsV1ResourcesImageUploadAndLink = async (args: CreateApiProductsV1ResourcesImageUploadAndLinkArgs, options?: CreateApiProductsV1ResourcesImageUploadAndLinkOptions) => { const {baseUrl = "https://marketplace.appdirect.com/api", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/products/v1/resources/image/uploadAndLink${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: args.body}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };