@@ -213,6 +213,122 @@ const { data, error } = await instance.ocapi.PATCH('/code_versions/{code_version
213213});
214214```
215215
216+ ## Account Manager Operations
217+
218+ The SDK provides operations for managing users and roles.
219+
220+ ### User Management
221+
222+ ``` typescript
223+ import {
224+ createAccountManagerClient ,
225+ listUsers ,
226+ getUserByLogin ,
227+ createUser ,
228+ updateUser ,
229+ deleteUser ,
230+ resetUser ,
231+ grantRole ,
232+ revokeRole ,
233+ } from ' @salesforce/b2c-tooling-sdk/operations/users' ;
234+ import { OAuthStrategy } from ' @salesforce/b2c-tooling-sdk/auth' ;
235+
236+ // Create Account Manager client
237+ const auth = new OAuthStrategy ({
238+ clientId: ' your-client-id' ,
239+ clientSecret: ' your-client-secret' ,
240+ });
241+
242+ const client = createAccountManagerClient (
243+ { accountManagerHost: ' account.demandware.com' },
244+ auth ,
245+ );
246+
247+ // List users with pagination
248+ const users = await listUsers (client , { size: 25 , page: 0 });
249+
250+ // Get user by email
251+ const user = await getUserByLogin (client , ' user@example.com' );
252+
253+ // Create a new user
254+ const newUser = await createUser (client , {
255+ user: {
256+ mail: ' newuser@example.com' ,
257+ firstName: ' John' ,
258+ lastName: ' Doe' ,
259+ organizations: [' org-id' ],
260+ primaryOrganization: ' org-id' ,
261+ },
262+ });
263+
264+ // Update a user
265+ await updateUser (client , {
266+ userId: user .id ! ,
267+ changes: { firstName: ' Jane' },
268+ });
269+
270+ // Grant a role to a user
271+ await grantRole (client , {
272+ userId: user .id ! ,
273+ role: ' bm-admin' ,
274+ scope: ' tenant1,tenant2' , // Optional tenant filter
275+ });
276+
277+ // Revoke a role from a user
278+ await revokeRole (client , {
279+ userId: user .id ! ,
280+ role: ' bm-admin' ,
281+ scope: ' tenant1' , // Optional: remove specific scope
282+ });
283+
284+ // Reset user to INITIAL state
285+ await resetUser (client , user .id ! );
286+
287+ // Delete (disable) a user
288+ await deleteUser (client , user .id ! );
289+ ```
290+
291+ ### Role Management
292+
293+ ``` typescript
294+ import {
295+ createAccountManagerRolesClient ,
296+ getRole ,
297+ listRoles ,
298+ } from ' @salesforce/b2c-tooling-sdk/operations/roles' ;
299+ import { OAuthStrategy } from ' @salesforce/b2c-tooling-sdk/auth' ;
300+
301+ // Create Account Manager Roles client
302+ const auth = new OAuthStrategy ({
303+ clientId: ' your-client-id' ,
304+ clientSecret: ' your-client-secret' ,
305+ });
306+
307+ const client = createAccountManagerRolesClient (
308+ { accountManagerHost: ' account.demandware.com' },
309+ auth ,
310+ );
311+
312+ // Get role details by ID
313+ const role = await getRole (client , ' bm-admin' );
314+
315+ // List all roles with pagination
316+ const roles = await listRoles (client , { size: 25 , page: 0 });
317+
318+ // List roles filtered by target type
319+ const userRoles = await listRoles (client , {
320+ size: 25 ,
321+ page: 0 ,
322+ roleTargetType: ' User' ,
323+ });
324+ ```
325+
326+ ### Required Permissions
327+
328+ Account Manager operations require:
329+ - OAuth client with ` sfcc.accountmanager.user.manage ` scope
330+ - Account Manager hostname configuration
331+
216332## Logging
217333
218334Configure logging for debugging HTTP requests:
0 commit comments