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