export type SystemInternalCountersConfigRequest = {default_report_months?: number | undefined, enabled?: string | undefined, retention_months?: number | undefined}; export type CreateApiSysInternalCountersConfigArgs = {body: SystemInternalCountersConfigRequest}; export type CreateApiSysInternalCountersConfigOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Enable or disable collection of client count, set retention period, or set default reporting period. * * POST /sys/internal/counters/config */ export const createApiSysInternalCountersConfig = async (args: CreateApiSysInternalCountersConfigArgs, options: CreateApiSysInternalCountersConfigOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/sys/internal/counters/config${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 undefined };