authentication authorization
This commit is contained in:
28
apps/website/lib/api/policy/PolicyApiClient.ts
Normal file
28
apps/website/lib/api/policy/PolicyApiClient.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { BaseApiClient } from '../base/BaseApiClient';
|
||||
import type { ErrorReporter } from '../../interfaces/ErrorReporter';
|
||||
import type { Logger } from '../../interfaces/Logger';
|
||||
|
||||
export type OperationalMode = 'normal' | 'maintenance' | 'test';
|
||||
export type FeatureState = 'enabled' | 'disabled' | 'coming_soon' | 'hidden';
|
||||
|
||||
export type PolicySnapshotDto = {
|
||||
policyVersion: number;
|
||||
operationalMode: OperationalMode;
|
||||
maintenanceAllowlist: {
|
||||
view: string[];
|
||||
mutate: string[];
|
||||
};
|
||||
capabilities: Record<string, FeatureState>;
|
||||
loadedFrom: 'env' | 'file' | 'defaults';
|
||||
loadedAtIso: string;
|
||||
};
|
||||
|
||||
export class PolicyApiClient extends BaseApiClient {
|
||||
constructor(baseUrl: string, errorReporter: ErrorReporter, logger: Logger) {
|
||||
super(baseUrl, errorReporter, logger);
|
||||
}
|
||||
|
||||
getSnapshot(): Promise<PolicySnapshotDto> {
|
||||
return this.get<PolicySnapshotDto>('/policy/snapshot');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user