export type FeatureLabel = {id?: string | undefined, name?: string | undefined, color?: string | undefined}; export type Feature = {id: string, name: string, type: 'FEATURE' | 'MODULE', parentFeatureId?: string | undefined, propertyKey: string, status?: ('ACTIVATED' | 'DELETED') | undefined, featureLabels?: Array | undefined}; export type UpdateApiV1FeatureFeatureIdArgs = {featureId: string, body: Feature}; export type UpdateApiV1FeatureFeatureIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update feature * * PUT /v1/feature/{featureId} */ export const updateApiV1FeatureFeatureId = async (args: UpdateApiV1FeatureFeatureIdArgs, options?: UpdateApiV1FeatureFeatureIdOptions) => { const {baseUrl = "https://app.aptrinsic.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") const url = `${baseUrl.replace(/\/+$/, '')}/v1/feature/${encodeURIComponent(String(args.featureId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };