export type GetApiSubscriberListStatuspageIdArgs = {statuspage_id: string, 'x-api-id': string, 'x-api-key': string}; export type GetApiSubscriberListStatuspageIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * List Subscribers * * GET /subscriber/list/{statuspage_id} */ export const getApiSubscriberListStatuspageId = async (args: GetApiSubscriberListStatuspageIdArgs, options?: GetApiSubscriberListStatuspageIdOptions) => { const {baseUrl = "https://api.status.io/v2", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['x-api-id'] != null) headers.set("x-api-id", String(args['x-api-id'])) if (args['x-api-key'] != null) headers.set("x-api-key", String(args['x-api-key'])) const url = `${baseUrl.replace(/\/+$/, '')}/subscriber/list/${encodeURIComponent(String(args.statuspage_id))}${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 undefined };