feat: add workhoster gateway API

This commit is contained in:
2026-04-29 15:18:14 +00:00
parent 4ea339b85a
commit a22cc1c0eb
17 changed files with 905 additions and 22 deletions
+49
View File
@@ -0,0 +1,49 @@
import * as interfaces from '../ts_interfaces/index.js';
import type { DcRouterApiClient } from './classes.dcrouterapiclient.js';
export class WorkHosterManager {
constructor(private clientRef: DcRouterApiClient) {}
public async getCapabilities(): Promise<interfaces.data.IGatewayCapabilities> {
const response = await this.clientRef.request<interfaces.requests.IReq_GetGatewayCapabilities>(
'getGatewayCapabilities',
this.clientRef.buildRequestPayload() as any,
);
return response.capabilities;
}
public async getDomains(): Promise<interfaces.data.IWorkHosterDomain[]> {
const response = await this.clientRef.request<interfaces.requests.IReq_GetWorkHosterDomains>(
'getWorkHosterDomains',
this.clientRef.buildRequestPayload() as any,
);
return response.domains;
}
public async syncRoute(options: {
ownership: interfaces.data.IWorkAppRouteOwnership;
route: interfaces.data.IDcRouterRouteConfig;
enabled?: boolean;
}): Promise<interfaces.data.IWorkAppRouteSyncResult> {
return this.clientRef.request<interfaces.requests.IReq_SyncWorkAppRoute>(
'syncWorkAppRoute',
this.clientRef.buildRequestPayload({
ownership: options.ownership,
route: options.route,
enabled: options.enabled,
}) as any,
);
}
public async deleteRoute(
ownership: interfaces.data.IWorkAppRouteOwnership,
): Promise<interfaces.data.IWorkAppRouteSyncResult> {
return this.clientRef.request<interfaces.requests.IReq_SyncWorkAppRoute>(
'syncWorkAppRoute',
this.clientRef.buildRequestPayload({
ownership,
delete: true,
}) as any,
);
}
}