Endpoint for getting localization/effective message bundles (#24845)
Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com>
This commit is contained in:
parent
a45934a762
commit
8115ebf2e8
3 changed files with 36 additions and 2 deletions
|
@ -0,0 +1,6 @@
|
|||
export default interface EffectiveMessageBundleRepresentation {
|
||||
theme?: string;
|
||||
themeType?: string;
|
||||
locale?: string;
|
||||
source?: boolean;
|
||||
}
|
|
@ -1,17 +1,34 @@
|
|||
import Resource from "./resource.js";
|
||||
import type { ServerInfoRepresentation } from "../defs/serverInfoRepesentation.js";
|
||||
import type KeycloakAdminClient from "../index.js";
|
||||
import type EffectiveMessageBundleRepresentation from "../defs/effectiveMessageBundleRepresentation.js";
|
||||
|
||||
export class ServerInfo extends Resource {
|
||||
constructor(client: KeycloakAdminClient) {
|
||||
super(client, {
|
||||
path: "/admin/serverinfo",
|
||||
path: "/",
|
||||
getBaseUrl: () => client.baseUrl,
|
||||
});
|
||||
}
|
||||
|
||||
public find = this.makeRequest<{}, ServerInfoRepresentation>({
|
||||
method: "GET",
|
||||
path: "/",
|
||||
path: "/admin/serverinfo",
|
||||
});
|
||||
|
||||
public findEffectiveMessageBundles = this.makeRequest<
|
||||
{
|
||||
realm: string;
|
||||
theme?: string;
|
||||
themeType?: string;
|
||||
locale?: string;
|
||||
source?: boolean;
|
||||
},
|
||||
EffectiveMessageBundleRepresentation[]
|
||||
>({
|
||||
method: "GET",
|
||||
path: "/resources/{realm}/{themeType}/{locale}",
|
||||
urlParamKeys: ["realm", "themeType", "locale"],
|
||||
queryParamKeys: ["theme", "source"],
|
||||
});
|
||||
}
|
||||
|
|
|
@ -17,4 +17,15 @@ describe("Server Info", () => {
|
|||
const serverInfo = await client.serverInfo.find();
|
||||
expect(serverInfo).to.be.ok;
|
||||
});
|
||||
|
||||
it("list effective message bundles of a realm", async () => {
|
||||
const messageBundles = await client.serverInfo.findEffectiveMessageBundles({
|
||||
realm: "master",
|
||||
themeType: "admin",
|
||||
locale: "en",
|
||||
});
|
||||
|
||||
expect(messageBundles).to.be.ok;
|
||||
expect(messageBundles.length).to.be.greaterThan(0);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue