111 lines
2.6 KiB
TypeScript
111 lines
2.6 KiB
TypeScript
import * as plugins from '../plugins.js';
|
|
import type * as authInterfaces from '../data/auth.js';
|
|
import type { IMergedRoute, IRouteWarning, IRouteMetadata } from '../data/route-management.js';
|
|
import type { IRouteConfig } from '@push.rocks/smartproxy';
|
|
import type { IDcRouterRouteConfig } from '../data/remoteingress.js';
|
|
|
|
// ============================================================================
|
|
// Route Management Endpoints
|
|
// ============================================================================
|
|
|
|
/**
|
|
* Get all routes with warnings.
|
|
*/
|
|
export interface IReq_GetMergedRoutes extends plugins.typedrequestInterfaces.implementsTR<
|
|
plugins.typedrequestInterfaces.ITypedRequest,
|
|
IReq_GetMergedRoutes
|
|
> {
|
|
method: 'getMergedRoutes';
|
|
request: {
|
|
identity?: authInterfaces.IIdentity;
|
|
apiToken?: string;
|
|
};
|
|
response: {
|
|
routes: IMergedRoute[];
|
|
warnings: IRouteWarning[];
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Create a new route.
|
|
*/
|
|
export interface IReq_CreateRoute extends plugins.typedrequestInterfaces.implementsTR<
|
|
plugins.typedrequestInterfaces.ITypedRequest,
|
|
IReq_CreateRoute
|
|
> {
|
|
method: 'createRoute';
|
|
request: {
|
|
identity?: authInterfaces.IIdentity;
|
|
apiToken?: string;
|
|
route: IDcRouterRouteConfig;
|
|
enabled?: boolean;
|
|
metadata?: IRouteMetadata;
|
|
};
|
|
response: {
|
|
success: boolean;
|
|
routeId?: string;
|
|
message?: string;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Update a route.
|
|
*/
|
|
export interface IReq_UpdateRoute extends plugins.typedrequestInterfaces.implementsTR<
|
|
plugins.typedrequestInterfaces.ITypedRequest,
|
|
IReq_UpdateRoute
|
|
> {
|
|
method: 'updateRoute';
|
|
request: {
|
|
identity?: authInterfaces.IIdentity;
|
|
apiToken?: string;
|
|
id: string;
|
|
route?: Partial<IDcRouterRouteConfig>;
|
|
enabled?: boolean;
|
|
metadata?: Partial<IRouteMetadata>;
|
|
};
|
|
response: {
|
|
success: boolean;
|
|
message?: string;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Delete a route.
|
|
*/
|
|
export interface IReq_DeleteRoute extends plugins.typedrequestInterfaces.implementsTR<
|
|
plugins.typedrequestInterfaces.ITypedRequest,
|
|
IReq_DeleteRoute
|
|
> {
|
|
method: 'deleteRoute';
|
|
request: {
|
|
identity?: authInterfaces.IIdentity;
|
|
apiToken?: string;
|
|
id: string;
|
|
};
|
|
response: {
|
|
success: boolean;
|
|
message?: string;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Toggle a route on/off by id.
|
|
*/
|
|
export interface IReq_ToggleRoute extends plugins.typedrequestInterfaces.implementsTR<
|
|
plugins.typedrequestInterfaces.ITypedRequest,
|
|
IReq_ToggleRoute
|
|
> {
|
|
method: 'toggleRoute';
|
|
request: {
|
|
identity?: authInterfaces.IIdentity;
|
|
apiToken?: string;
|
|
id: string;
|
|
enabled: boolean;
|
|
};
|
|
response: {
|
|
success: boolean;
|
|
message?: string;
|
|
};
|
|
}
|