export type SystemQuotasRateLimitRequest = {block_interval?: number | undefined, interval?: number | undefined, path?: string | undefined, rate?: number | undefined, role?: string | undefined, type?: string | undefined}; export type CreateApiSysQuotasRateLimitNameArgs = {body: SystemQuotasRateLimitRequest}; export type CreateApiSysQuotasRateLimitNameOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * POST /sys/quotas/rate-limit/{name} */ export const createApiSysQuotasRateLimitName = async (args: CreateApiSysQuotasRateLimitNameArgs, options: CreateApiSysQuotasRateLimitNameOptions) => { 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/quotas/rate-limit/${encodeURIComponent(String(args.name))}${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 };