export type GetApiV1FeatureArgs = {pageNumber?: number | undefined, pageSize?: number | undefined, propertyKey?: string | undefined}; export type GetApiV1FeatureOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get features * * GET /v1/feature */ export const getApiV1Feature = async (args: GetApiV1FeatureArgs, options?: GetApiV1FeatureOptions) => { const {baseUrl = "https://app.aptrinsic.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.pageNumber != null) query.append("pageNumber", String(args.pageNumber)) if (args.pageSize != null) query.append("pageSize", String(args.pageSize)) if (args.propertyKey != null) query.append("propertyKey", String(args.propertyKey)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/feature${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() };