export type CreateApiApiPkiRestapiExportSSHKeyArgs = {orgName?: string | undefined, body: {keyName?: string | undefined, keyExportType?: ('private' | 'public') | undefined}}; export type CreateApiApiPkiRestapiExportSSHKeyOptions = {baseUrl?: string | undefined, AuthToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export an SSH key * * POST /api/pki/restapi/exportSSHKey */ export const createApiApiPkiRestapiExportSSHKey = async (args: CreateApiApiPkiRestapiExportSSHKeyArgs, options?: CreateApiApiPkiRestapiExportSSHKeyOptions) => { const {baseUrl = "https://Hostname:Port", fetch: fetchFn = fetch, AuthToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/x-www-form-urlencoded") headers.set('accept', "application/octet-stream") if (args.orgName != null) headers.set("orgName", String(args.orgName)) if (AuthToken !== undefined) headers.set("AUTHTOKEN", AuthToken) const url = `${baseUrl.replace(/\/+$/, '')}/api/pki/restapi/exportSSHKey${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: new URLSearchParams(Object.entries(args.body).flatMap(([key, value]) => (value == null ? [] : [[key, String(value)]])))}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };