import { BaseClient } from "../client/baseClient"; import { LimitsChangeRequest, LimitsContextResponse, LimitsSubjectResponse, RateLimitsResponse, } from "../types/limits"; export class LimitsClient extends BaseClient { async getContextLimits(): Promise { const token = await this.getAccessToken(); return this.http.request({ method: "GET", path: "/limits/context", authToken: token, }); } async getSubjectLimits(): Promise { const token = await this.getAccessToken(); return this.http.request({ method: "GET", path: "/limits/subject", authToken: token, }); } async getRateLimits(): Promise { const token = await this.getAccessToken(); return this.http.request({ method: "GET", path: "/rate-limits", authToken: token, }); } async changeContextSessionLimits(request: LimitsChangeRequest): Promise { const token = await this.getAccessToken(); await this.http.request({ method: "POST", path: "/testdata/limits/context/session", body: request, authToken: token, }); } async restoreContextSessionLimits(): Promise { const token = await this.getAccessToken(); await this.http.request({ method: "DELETE", path: "/testdata/limits/context/session", authToken: token, }); } async changeSubjectCertificateLimits(request: LimitsChangeRequest): Promise { const token = await this.getAccessToken(); await this.http.request({ method: "POST", path: "/testdata/limits/subject/certificate", body: request, authToken: token, }); } async restoreSubjectCertificateLimits(): Promise { const token = await this.getAccessToken(); await this.http.request({ method: "DELETE", path: "/testdata/limits/subject/certificate", authToken: token, }); } async changeRateLimits(request: LimitsChangeRequest): Promise { const token = await this.getAccessToken(); await this.http.request({ method: "POST", path: "/testdata/rate-limits", body: request, authToken: token, }); } async restoreRateLimits(): Promise { const token = await this.getAccessToken(); await this.http.request({ method: "DELETE", path: "/testdata/rate-limits", authToken: token, }); } async setRateLimitsProduction(request: LimitsChangeRequest): Promise { const token = await this.getAccessToken(); await this.http.request({ method: "POST", path: "/testdata/rate-limits/production", body: request, authToken: token, }); } }