feat(apiclient): add TypeScript API client (ts_apiclient) with resource managers and package exports
This commit is contained in:
37
ts_apiclient/classes.logs.ts
Normal file
37
ts_apiclient/classes.logs.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import * as interfaces from '../ts_interfaces/index.js';
|
||||
import type { DcRouterApiClient } from './classes.dcrouterapiclient.js';
|
||||
|
||||
export class LogManager {
|
||||
private clientRef: DcRouterApiClient;
|
||||
|
||||
constructor(clientRef: DcRouterApiClient) {
|
||||
this.clientRef = clientRef;
|
||||
}
|
||||
|
||||
public async getRecent(options?: {
|
||||
level?: 'debug' | 'info' | 'warn' | 'error';
|
||||
category?: 'smtp' | 'dns' | 'security' | 'system' | 'email';
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
search?: string;
|
||||
timeRange?: string;
|
||||
}): Promise<interfaces.requests.IReq_GetRecentLogs['response']> {
|
||||
return this.clientRef.request<interfaces.requests.IReq_GetRecentLogs>(
|
||||
'getRecentLogs',
|
||||
this.clientRef.buildRequestPayload(options || {}) as any,
|
||||
);
|
||||
}
|
||||
|
||||
public async getStream(options?: {
|
||||
follow?: boolean;
|
||||
filters?: {
|
||||
level?: string[];
|
||||
category?: string[];
|
||||
};
|
||||
}): Promise<interfaces.requests.IReq_GetLogStream['response']> {
|
||||
return this.clientRef.request<interfaces.requests.IReq_GetLogStream>(
|
||||
'getLogStream',
|
||||
this.clientRef.buildRequestPayload(options || {}) as any,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user