export type DeleteApiV2ForecastsStaticRulesExternalStaticRuleIdArgs = {externalUnitId: string, externalSectionId?: string | undefined, externalStaticRuleId: string}; export type DeleteApiV2ForecastsStaticRulesExternalStaticRuleIdOptions = {baseUrl?: string | undefined, OAuth2ClientCredentials?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a static rule * * DELETE /v2/forecasts/static-rules/{externalStaticRuleId} * * Also accepts auth: OAuth2ClientCredentials */ export const deleteApiV2ForecastsStaticRulesExternalStaticRuleId = async (args: DeleteApiV2ForecastsStaticRulesExternalStaticRuleIdArgs, options?: DeleteApiV2ForecastsStaticRulesExternalStaticRuleIdOptions) => { const {baseUrl = "https://api.quinyx.com", fetch: fetchFn = fetch, OAuth2ClientCredentials} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.externalUnitId != null) query.append("externalUnitId", String(args.externalUnitId)) if (args.externalSectionId != null) query.append("externalSectionId", String(args.externalSectionId)) if (OAuth2ClientCredentials !== undefined) headers.set('authorization', `Bearer ${OAuth2ClientCredentials}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/forecasts/static-rules/${encodeURIComponent(String(args.externalStaticRuleId))}${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 res.blob() };