Skip to content

Commit 1a5a665

Browse files
@W-20893693: Updating AM users client naming convention
1 parent 7a01683 commit 1a5a665

21 files changed

Lines changed: 86 additions & 79 deletions

File tree

docs/api-readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ The SDK provides operations for managing users, roles, and organizations.
221221

222222
```typescript
223223
import {
224-
createAccountManagerClient,
225224
listUsers,
226225
getUserByLogin,
227226
createUser,
@@ -231,6 +230,7 @@ import {
231230
grantRole,
232231
revokeRole,
233232
} from '@salesforce/b2c-tooling-sdk/operations/users';
233+
import {createAccountManagerUsersClient} from '@salesforce/b2c-tooling-sdk/clients';
234234
import { OAuthStrategy } from '@salesforce/b2c-tooling-sdk/auth';
235235

236236
// Create Account Manager client
@@ -239,7 +239,7 @@ const auth = new OAuthStrategy({
239239
clientSecret: 'your-client-secret',
240240
});
241241

242-
const client = createAccountManagerClient(
242+
const client = createAccountManagerUsersClient(
243243
{ accountManagerHost: 'account.demandware.com' },
244244
auth,
245245
);

packages/b2c-cli/src/commands/role/grant.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default class RoleGrant extends UserCommand<typeof RoleGrant> {
4747

4848
this.log(t('commands.role.grant.fetching', 'Fetching user {{login}}...', {login}));
4949

50-
const user = await getUserByLogin(this.accountManagerClient, login);
50+
const user = await getUserByLogin(this.accountManagerUsersClient, login);
5151

5252
if (!user.id) {
5353
this.error(t('commands.role.grant.noId', 'User does not have an ID'));
@@ -60,7 +60,7 @@ export default class RoleGrant extends UserCommand<typeof RoleGrant> {
6060
}),
6161
);
6262

63-
const updatedUser = await grantRole(this.accountManagerClient, {
63+
const updatedUser = await grantRole(this.accountManagerUsersClient, {
6464
userId: user.id,
6565
role,
6666
scope,

packages/b2c-cli/src/commands/role/revoke.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default class RoleRevoke extends UserCommand<typeof RoleRevoke> {
4747

4848
this.log(t('commands.role.revoke.fetching', 'Fetching user {{login}}...', {login}));
4949

50-
const user = await getUserByLogin(this.accountManagerClient, login);
50+
const user = await getUserByLogin(this.accountManagerUsersClient, login);
5151

5252
if (!user.id) {
5353
this.error(t('commands.role.revoke.noId', 'User does not have an ID'));
@@ -60,7 +60,7 @@ export default class RoleRevoke extends UserCommand<typeof RoleRevoke> {
6060
}),
6161
);
6262

63-
const updatedUser = await revokeRole(this.accountManagerClient, {
63+
const updatedUser = await revokeRole(this.accountManagerUsersClient, {
6464
userId: user.id,
6565
role,
6666
scope,

packages/b2c-cli/src/commands/user/create.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export default class UserCreate extends UserCommand<typeof UserCreate> {
4848

4949
this.log(t('commands.user.create.creating', 'Creating user {{mail}} in organization {{org}}...', {mail, org}));
5050

51-
const user = await createUser(this.accountManagerClient, {
51+
const user = await createUser(this.accountManagerUsersClient, {
5252
user: {
5353
mail,
5454
firstName,

packages/b2c-cli/src/commands/user/delete.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default class UserDelete extends UserCommand<typeof UserDelete> {
4141

4242
this.log(t('commands.user.delete.fetching', 'Fetching user {{login}}...', {login}));
4343

44-
const user = await getUserByLogin(this.accountManagerClient, login);
44+
const user = await getUserByLogin(this.accountManagerUsersClient, login);
4545

4646
if (!user.id) {
4747
this.error(t('commands.user.delete.noId', 'User does not have an ID'));
@@ -53,14 +53,14 @@ export default class UserDelete extends UserCommand<typeof UserDelete> {
5353
login,
5454
}),
5555
);
56-
await purgeUser(this.accountManagerClient, user.id);
56+
await purgeUser(this.accountManagerUsersClient, user.id);
5757
} else {
5858
this.log(
5959
t('commands.user.delete.deleting', 'Deleting user {{login}}...', {
6060
login,
6161
}),
6262
);
63-
await deleteUser(this.accountManagerClient, user.id);
63+
await deleteUser(this.accountManagerUsersClient, user.id);
6464
}
6565

6666
if (this.jsonEnabled()) {

packages/b2c-cli/src/commands/user/get.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default class UserGet extends UserCommand<typeof UserGet> {
3535

3636
this.log(t('commands.user.get.fetching', 'Fetching user {{login}}...', {login}));
3737

38-
const user = await getUserByLogin(this.accountManagerClient, login);
38+
const user = await getUserByLogin(this.accountManagerUsersClient, login);
3939

4040
if (this.jsonEnabled()) {
4141
return user;

packages/b2c-cli/src/commands/user/list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export default class UserList extends UserCommand<typeof UserList> {
137137

138138
this.log(t('commands.user.list.fetching', 'Fetching users...'));
139139

140-
const result = await listUsers(this.accountManagerClient, {
140+
const result = await listUsers(this.accountManagerUsersClient, {
141141
size: pageSize,
142142
page: pageNumber,
143143
});

packages/b2c-cli/src/commands/user/reset.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ export default class UserReset extends UserCommand<typeof UserReset> {
3333

3434
this.log(t('commands.user.reset.fetching', 'Fetching user {{login}}...', {login}));
3535

36-
const user = await getUserByLogin(this.accountManagerClient, login);
36+
const user = await getUserByLogin(this.accountManagerUsersClient, login);
3737

3838
if (!user.id) {
3939
this.error(t('commands.user.reset.noId', 'User does not have an ID'));
4040
}
4141

4242
this.log(t('commands.user.reset.resetting', 'Resetting password for user {{login}}...', {login}));
4343

44-
await resetUser(this.accountManagerClient, user.id);
44+
await resetUser(this.accountManagerUsersClient, user.id);
4545

4646
if (this.jsonEnabled()) {
4747
return;

packages/b2c-cli/src/commands/user/update.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default class UserUpdate extends UserCommand<typeof UserUpdate> {
4444

4545
this.log(t('commands.user.update.fetching', 'Fetching user {{login}}...', {login}));
4646

47-
const user = await getUserByLogin(this.accountManagerClient, login);
47+
const user = await getUserByLogin(this.accountManagerUsersClient, login);
4848

4949
if (!user.id) {
5050
this.error(t('commands.user.update.noId', 'User does not have an ID'));
@@ -64,7 +64,7 @@ export default class UserUpdate extends UserCommand<typeof UserUpdate> {
6464

6565
this.log(t('commands.user.update.updating', 'Updating user {{login}}...', {login}));
6666

67-
const updatedUser = await updateUser(this.accountManagerClient, {
67+
const updatedUser = await updateUser(this.accountManagerUsersClient, {
6868
userId: user.id,
6969
changes: changes as UserUpdateType,
7070
});

packages/b2c-cli/test/helpers/test-setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export function stubJsonEnabled(command: any, enabled: boolean): void {
104104
/**
105105
* Stubs a client property on a command.
106106
* @param command - The command instance to stub
107-
* @param propertyName - The name of the client property (e.g., 'accountManagerClient', 'accountManagerRolesClient', 'accountManagerOrgsClient')
107+
* @param propertyName - The name of the client property (e.g., 'accountManagerUsersClient', 'accountManagerRolesClient', 'accountManagerOrgsClient')
108108
* @param client - The client instance to stub
109109
*/
110110
export function stubClient(command: any, propertyName: string, client: any): void {

0 commit comments

Comments
 (0)