feat(route-management): add programmatic route management API with API tokens and admin UI
This commit is contained in:
83
ts_interfaces/requests/api-tokens.ts
Normal file
83
ts_interfaces/requests/api-tokens.ts
Normal file
@@ -0,0 +1,83 @@
|
||||
import * as plugins from '../plugins.js';
|
||||
import type * as authInterfaces from '../data/auth.js';
|
||||
import type { IApiTokenInfo, TApiTokenScope } from '../data/route-management.js';
|
||||
|
||||
// ============================================================================
|
||||
// API Token Management Endpoints
|
||||
// ============================================================================
|
||||
|
||||
/**
|
||||
* Create a new API token. Returns the raw token value once (never shown again).
|
||||
* Admin JWT only — tokens cannot create tokens.
|
||||
*/
|
||||
export interface IReq_CreateApiToken extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IReq_CreateApiToken
|
||||
> {
|
||||
method: 'createApiToken';
|
||||
request: {
|
||||
identity?: authInterfaces.IIdentity;
|
||||
name: string;
|
||||
scopes: TApiTokenScope[];
|
||||
expiresInDays?: number | null;
|
||||
};
|
||||
response: {
|
||||
success: boolean;
|
||||
tokenId?: string;
|
||||
tokenValue?: string;
|
||||
message?: string;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* List all API tokens (without hashes).
|
||||
*/
|
||||
export interface IReq_ListApiTokens extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IReq_ListApiTokens
|
||||
> {
|
||||
method: 'listApiTokens';
|
||||
request: {
|
||||
identity?: authInterfaces.IIdentity;
|
||||
};
|
||||
response: {
|
||||
tokens: IApiTokenInfo[];
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Revoke (delete) an API token.
|
||||
*/
|
||||
export interface IReq_RevokeApiToken extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IReq_RevokeApiToken
|
||||
> {
|
||||
method: 'revokeApiToken';
|
||||
request: {
|
||||
identity?: authInterfaces.IIdentity;
|
||||
id: string;
|
||||
};
|
||||
response: {
|
||||
success: boolean;
|
||||
message?: string;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable or disable an API token.
|
||||
*/
|
||||
export interface IReq_ToggleApiToken extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IReq_ToggleApiToken
|
||||
> {
|
||||
method: 'toggleApiToken';
|
||||
request: {
|
||||
identity?: authInterfaces.IIdentity;
|
||||
id: string;
|
||||
enabled: boolean;
|
||||
};
|
||||
response: {
|
||||
success: boolean;
|
||||
message?: string;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user