export type DeleteApiFeatureFlagsSiteCodeFeatureKeyArgs = {siteCode: string, featureKey: string}; export type DeleteApiFeatureFlagsSiteCodeFeatureKeyOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a feature flag configuration * * DELETE /feature-flags/{siteCode}/{featureKey} */ export const deleteApiFeatureFlagsSiteCodeFeatureKey = async (args: DeleteApiFeatureFlagsSiteCodeFeatureKeyArgs, options?: DeleteApiFeatureFlagsSiteCodeFeatureKeyOptions) => { const {baseUrl = "https://api.kameleoon.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/feature-flags/${encodeURIComponent(String(args.siteCode))}/${encodeURIComponent(String(args.featureKey))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };