export type GetApiApiV1DevSettingsAppKeyArgs = {app: string, key: string}; export type GetApiApiV1DevSettingsAppKeyOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Dev-only: read a settings value for the given app. * * GET /api/v1/dev/settings/{app}/{key} */ export const getApiApiV1DevSettingsAppKey = async (args: GetApiApiV1DevSettingsAppKeyArgs, options: GetApiApiV1DevSettingsAppKeyOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/dev/settings/${encodeURIComponent(String(args.app))}/${encodeURIComponent(String(args.key))}${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 };