Skip to content

Conversation

@sebastianchristopher
Copy link

We can already do this for edit, adding for delete.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds support for deleting assignments using non-numeric identifiers (such as lti_context_id:ab84f579-4442-4d4a-acd8-85c5ec6fd2b6), mirroring existing functionality that already exists for editing assignments.

Changes:

  • Added a String overload for deleteAssignment() to accept non-numeric assignment IDs alongside the existing Integer version
  • Includes enhanced error handling with CanvasException for detailed error reporting

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/main/java/edu/ksu/canvas/interfaces/AssignmentWriter.java Adds interface method signature for deleteAssignment with String assignmentId parameter
src/main/java/edu/ksu/canvas/impl/AssignmentImpl.java Implements the new deleteAssignment overload with comprehensive error handling including 200, 204, and 404 status codes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
LOG.debug("response {}", response);
int code = response.getResponseCode();

boolean errorHappened = response.getErrorHappened();
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure this is actually used in the production code.

Choose a reason for hiding this comment

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

Don't follow sorry?

Choose a reason for hiding this comment

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

Ah because it's getting intercepted by simple rest client

Copy link
Member

Choose a reason for hiding this comment

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

The setErrorHappened() doesn't look to ever be called in the production code and it's a class that's defined by the library. It's called by tests, but that's it.

@sebastianchristopher sebastianchristopher marked this pull request as draft February 4, 2026 08:54
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +71 to +74
public Optional<Assignment> deleteAssignment(String courseId, String assignmentId) throws IOException {
String url = buildCanvasUrl("courses/" + courseId + "/assignments/" + assignmentId, Collections.emptyMap());
return deleteAssignment(url);
}
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

The new String-based deleteAssignment overload lacks test coverage. While the existing Integer-based deleteAssignment method also doesn't have explicit tests, this pattern follows the editAssignment methods which similarly lack explicit tests. However, given that this codebase has comprehensive test coverage for other writer operations (as seen in CalendarWriterUTest, CourseManagerUTest, etc.), consider adding test coverage for both delete methods to maintain consistency with other tested writer methods like createAssignment.

Copilot uses AI. Check for mistakes.

Choose a reason for hiding this comment

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

@copilot open a new pull request to apply changes based on this feedback

Copy link

Copilot AI commented Feb 4, 2026

@sebastianchristopher I've opened a new pull request, #77, to work on those changes. Once the pull request is ready, I'll request review from you.

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.

3 participants