export type GetApiApiBadgeScoutUsernameSvgArgs = {username: string}; export type GetApiApiBadgeScoutUsernameSvgOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Scout-Score SVG badge for a GitHub user * * GET /api/badge/scout/{username}/svg */ export const getApiApiBadgeScoutUsernameSvg = async (args: GetApiApiBadgeScoutUsernameSvgArgs, options?: GetApiApiBadgeScoutUsernameSvgOptions) => { const {baseUrl = "https://signals.gitdealflow.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "image/svg+xml") const url = `${baseUrl.replace(/\/+$/, '')}/api/badge/scout/${encodeURIComponent(String(args.username))}/svg${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.blob() };