export type DeleteApiSecretsNameArgs = {name: string}; export type DeleteApiSecretsNameOptions = {baseUrl?: string | undefined, OAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete secret * * DELETE /secrets/{name} * * Also accepts auth: ApiSecretKey */ export const deleteApiSecretsName = async (args: DeleteApiSecretsNameArgs, options?: DeleteApiSecretsNameOptions) => { const {baseUrl = "https://forward.checkout.com", fetch: fetchFn = fetch, OAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (OAuth !== undefined) headers.set('authorization', `Bearer ${OAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/secrets/${encodeURIComponent(String(args.name))}${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 };