Skip to content

Commit a6128f4

Browse files
@W-20893693: Updating AM users client naming convention
1 parent 650aba1 commit a6128f4

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
@@ -248,7 +248,6 @@ The SDK provides operations for managing users, roles, and organizations.
248248

249249
```typescript
250250
import {
251-
createAccountManagerClient,
252251
listUsers,
253252
getUserByLogin,
254253
createUser,
@@ -258,6 +257,7 @@ import {
258257
grantRole,
259258
revokeRole,
260259
} from '@salesforce/b2c-tooling-sdk/operations/users';
260+
import {createAccountManagerUsersClient} from '@salesforce/b2c-tooling-sdk/clients';
261261
import { OAuthStrategy } from '@salesforce/b2c-tooling-sdk/auth';
262262

263263
// Create Account Manager client
@@ -266,7 +266,7 @@ const auth = new OAuthStrategy({
266266
clientSecret: 'your-client-secret',
267267
});
268268

269-
const client = createAccountManagerClient(
269+
const client = createAccountManagerUsersClient(
270270
{ accountManagerHost: 'account.demandware.com' },
271271
auth,
272272
);

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
@@ -118,7 +118,7 @@ export function stubJsonEnabled(command: any, enabled: boolean): void {
118118
/**
119119
* Stubs a client property on a command.
120120
* @param command - The command instance to stub
121-
* @param propertyName - The name of the client property (e.g., 'accountManagerClient', 'accountManagerRolesClient', 'accountManagerOrgsClient')
121+
* @param propertyName - The name of the client property (e.g., 'accountManagerUsersClient', 'accountManagerRolesClient', 'accountManagerOrgsClient')
122122
* @param client - The client instance to stub
123123
*/
124124
export function stubClient(command: any, propertyName: string, client: any): void {

0 commit comments

Comments
 (0)