Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

this adds the remove user call from the accounts api, and a wrapper o… #65

Merged
merged 2 commits into from
Feb 26, 2024

Conversation

sebastianchristopher
Copy link

…bject to get the user

Copy link
Member

@buckett buckett left a comment

Choose a reason for hiding this comment

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

Just a few small things that should probably be tidied up.

@@ -99,4 +102,15 @@ public Boolean deleteAccount(String parentAccountId, String accountId) throws IO
Optional<Delete> responseParsed = responseParser.parseToObject(Delete.class, response);
return responseParsed.map(r -> r.getDelete()).orElse(false);
}

public User deleteUser(Integer userId) throws IOException {
Copy link
Member

Choose a reason for hiding this comment

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

Rather than passing in a Integer here, I'd pass in a String as that way the same API can be used with both user ID numbers and prefixed identifiers (eg SIS IDs).


public User deleteUser(Integer userId) throws IOException {
Map<String, List<String>> postParams = new HashMap<>();
String deleteUrl = buildCanvasUrl("accounts/" + CanvasConstants.ACCOUNT_ID + "/users/" + userId, Collections.emptyMap());
Copy link
Member

Choose a reason for hiding this comment

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

Although i our instance our root account is 1 it's not always the case and passing in the account ID is the more portable solution. Again it should be a String so we can use SIS IDs.

Copy link
Member

@buckett buckett left a comment

Choose a reason for hiding this comment

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

LGTM.

@sebastianchristopher sebastianchristopher merged commit 5b46da2 into master Feb 26, 2024
1 check passed
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