export type KvMetadataRequest = {cas_required?: boolean | undefined, custom_metadata?: Record | undefined, delete_version_after?: number | undefined, max_versions?: number | undefined}; export type CreateApiSecretMetadataPathArgs = {body: KvMetadataRequest}; export type CreateApiSecretMetadataPathOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Configures settings for the KV store * * POST /secret/metadata/{path} */ export const createApiSecretMetadataPath = async (args: CreateApiSecretMetadataPathArgs, options: CreateApiSecretMetadataPathOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/secret/metadata/${encodeURIComponent(String(args.path))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };