export type GetApiKeysAllKeysAscOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download Swift GPG keys. * * GET /keys/all-keys.asc */ export const getApiKeysAllKeysAsc = async (options?: GetApiKeysAllKeysAscOptions) => { const {baseUrl = "https://www.swift.org", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/plain") const url = `${baseUrl.replace(/\/+$/, '')}/keys/all-keys.asc${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.text() };