export type UpdateApiV3SearchByImageUploadsFileNameArgs = {'file-name': string, body: BodyInit}; export type UpdateApiV3SearchByImageUploadsFileNameOptions = {baseUrl: string, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Upload image for use by the search creative images/videos operations * * PUT /v3/search/by-image/uploads/{file-name} * * Also accepts auth: OAuth2 */ export const updateApiV3SearchByImageUploadsFileName = async (args: UpdateApiV3SearchByImageUploadsFileNameArgs, options: UpdateApiV3SearchByImageUploadsFileNameOptions) => { const {baseUrl, fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "image/jpeg") if (ApiKey !== undefined) headers.set("Api-Key", ApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v3/search/by-image/uploads/${encodeURIComponent(String(args['file-name']))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };