export type DeleteApiBedrockFilesBucketKeyArgs = {bucket: string, key: string, 'x-model-provider'?: string | undefined}; export type DeleteApiBedrockFilesBucketKeyOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * S3-compatible DeleteObject * * DELETE /bedrock/files/{bucket}/{key} * * Also accepts auth: BasicAuth, VirtualKeyAuth, ApiKeyAuth */ export const deleteApiBedrockFilesBucketKey = async (args: DeleteApiBedrockFilesBucketKeyArgs, options?: DeleteApiBedrockFilesBucketKeyOptions) => { const {baseUrl = "http://localhost:8080", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['x-model-provider'] != null) headers.set("x-model-provider", String(args['x-model-provider'])) if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/bedrock/files/${encodeURIComponent(String(args.bucket))}/${encodeURIComponent(String(args.key))}${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 };