With this package Uac groups can be requested and edited. The package works in the frontend as well as in the node backend. In the background, the package uses protobuf for communication with the uac-service.
- Install package
npm install @chayns/uac-service
- Create instance of UacServiceClient (could be in separate js/ts file in your project)
import { getAccessToken, getLanguage, getSite, getUser } from 'chayns-api';
export const client = new UacServiceClient({
getToken: async () => ((await getAccessToken()).accessToken || ""),
getDefaultSiteId: () => getSite().id,
logger: logger, // your chayns logger instance
getDefaultPersonId: () => getUser()?.personId || "",
getLanguage: () => getLanguage().active
});
- Install package
npm install @chayns/uac-service
- Create instance of UacServiceClient (could be in separate js/ts file in your project)
export const client = new UacServiceClient({
getApiToken: async () => accessToken,
logger: logger, // your chayns logger instance
});
These are just a few examples, there are many more functions.
const { id } = await client.createUserGroup({ showName: 'test name', users:['GER-TDNKN'], description: 'Beschreibung'});
const result = await client.getUserGroups({ countUsers: true });
const members = await client.getGroupMembers({ groupId: 1 });
await client.addUsersToGroup({ groupId: 1, members: [{personId: 'F69-1LT41'}] })