diff --git a/js/libs/keycloak-admin-client/src/defs/effectiveMessageBundleRepresentation.ts b/js/libs/keycloak-admin-client/src/defs/effectiveMessageBundleRepresentation.ts new file mode 100644 index 0000000000..7e3172389b --- /dev/null +++ b/js/libs/keycloak-admin-client/src/defs/effectiveMessageBundleRepresentation.ts @@ -0,0 +1,6 @@ +export default interface EffectiveMessageBundleRepresentation { + theme?: string; + themeType?: string; + locale?: string; + source?: boolean; +} diff --git a/js/libs/keycloak-admin-client/src/resources/serverInfo.ts b/js/libs/keycloak-admin-client/src/resources/serverInfo.ts index b4b027d0ff..cbc4dee4cc 100644 --- a/js/libs/keycloak-admin-client/src/resources/serverInfo.ts +++ b/js/libs/keycloak-admin-client/src/resources/serverInfo.ts @@ -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"], }); } diff --git a/js/libs/keycloak-admin-client/test/serverInfo.spec.ts b/js/libs/keycloak-admin-client/test/serverInfo.spec.ts index 2037c311be..28aadebe33 100644 --- a/js/libs/keycloak-admin-client/test/serverInfo.spec.ts +++ b/js/libs/keycloak-admin-client/test/serverInfo.spec.ts @@ -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); + }); });