export type GetApiV1SegmentSegmentIdArgs = {segmentId: string}; export type GetApiV1SegmentSegmentIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get segment * * GET /v1/segment/{segmentId} */ export const getApiV1SegmentSegmentId = async (args: GetApiV1SegmentSegmentIdArgs, options?: GetApiV1SegmentSegmentIdOptions) => { const {baseUrl = "https://app.aptrinsic.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") const url = `${baseUrl.replace(/\/+$/, '')}/v1/segment/${encodeURIComponent(String(args.segmentId))}${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() };