export type GetApiV1StaticIpsTxtArgs = {'x-checkly-account'?: string | undefined}; export type GetApiV1StaticIpsTxtOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Lists all source IPs for check runs as txt file * * GET /v1/static-ips.txt */ export const getApiV1StaticIpsTxt = async (args: GetApiV1StaticIpsTxtArgs, options?: GetApiV1StaticIpsTxtOptions) => { const {baseUrl = "https://api.checklyhq.com", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/plain") if (args['x-checkly-account'] != null) headers.set("x-checkly-account", String(args['x-checkly-account'])) if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/static-ips.txt${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() };