Skip to content

Refactor nsf, team role + examples - #235

Open
sgaddala-ks wants to merge 2 commits into
mainfrom
refactor-nsf-team-role-release
Open

Refactor nsf, team role + examples#235
sgaddala-ks wants to merge 2 commits into
mainfrom
refactor-nsf-team-role-release

Conversation

@sgaddala-ks

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread KeeperSdk/src/teams/teamRole.ts Outdated
),
})
const path = add ? 'enterprise/role_team_add' : 'enterprise/role_team_remove'
const message = createInMessage(payload, path, Enterprise.RoleTeams)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should add these to restMessages in keeperapi instead of inlining here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

understood, I moved it.

Comment thread KeeperSdk/src/teams/teamRole.ts Outdated
): Promise<void> {
if (links.length === 0) return
const payload = Enterprise.RoleTeams.create({
roleTeam: links.map((link) =>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

roleTeam in both the add and remove API's has a 100 item limit:
https://keeper.atlassian.net/wiki/spaces/KA/pages/905543939/role_team_add
https://keeper.atlassian.net/wiki/spaces/KA/pages/905543972/role_team_remove

May want to chunk by 100 to avoid API errors, rather than leaving the caller to worry about this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

understood. Implemented this now.

Comment thread KeeperSdk/src/teams/teamRole.ts Outdated

try {
await sendRoleTeamBatch(auth, toRemove, false)
await sendRoleTeamBatch(auth, toAdd, true)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably better to split each of these into their own try-catch, since one could fail and one could succeed, and that would distort the returned statuses

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

understood. I moved them into two separate functions with their own try catch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants