export type GetApiApiV1SeoSitemapsSegmentArgs = {pageType: string, segment: string}; export type GetApiApiV1SeoSitemapsSegmentOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /api/v1/seo/sitemaps/segment */ export const getApiApiV1SeoSitemapsSegment = async (args: GetApiApiV1SeoSitemapsSegmentArgs, options?: GetApiApiV1SeoSitemapsSegmentOptions) => { const {baseUrl = "https://api.trybrein.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.pageType != null) query.append("pageType", String(args.pageType)) if (args.segment != null) query.append("segment", String(args.segment)) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/seo/sitemaps/segment${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 };