Skip to content

Add list_user_activity_stream() function to vvcanvas - #33

Draft
tin900 with Copilot wants to merge 5 commits into
mainfrom
copilot/fix-32
Draft

Add list_user_activity_stream() function to vvcanvas#33
tin900 with Copilot wants to merge 5 commits into
mainfrom
copilot/fix-32

Conversation

Copilot AI commented Jul 19, 2025

Copy link
Copy Markdown
Contributor

Implements a new function to fetch the recent activity feed for a user from the Canvas LMS API.

Changes Made

New Function: list_user_activity_stream(canvas, user_id = "self", per_page = 100, ...)

  • Endpoint: GET /api/v1/users/:user_id/activity_stream
  • Default Behavior: Uses "self" for the current authenticated user when user_id is not provided
  • Pagination: Supports per_page parameter with sensible default of 100
  • Extensibility: Accepts additional parameters via ... for future Canvas API features
  • Returns: List of activity stream objects (Canvas Stories) representing recent user activities

Usage Examples

# Get activity stream for the authenticated user
canvas <- canvas_authenticate()
activities <- list_user_activity_stream(canvas)

# Get activity stream for a specific user
activities <- list_user_activity_stream(canvas, user_id = "12345")

# Get activity stream with custom pagination
activities <- list_user_activity_stream(canvas, per_page = 50)

Package Integration

  • Documentation: Complete Roxygen2 documentation with usage examples and API reference
  • TODO.md: Updated to mark activity stream endpoints as completed
  • pkgdown: Added new "Users" section with the function registered for documentation site
  • Consistency: Follows existing package patterns for authentication, error handling, and parameter conventions

Technical Details

  • Uses standard httr::GET() with proper query parameter handling
  • Implements consistent error checking for HTTP status codes
  • Returns parsed JSON response using jsonlite::fromJSON(flatten = TRUE)
  • Follows the same parameter handling pattern as other functions in the package

The function integrates seamlessly with the existing vvcanvas architecture and provides users with access to Canvas activity streams for monitoring recent user interactions across courses.

Fixes #32.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits July 19, 2025 17:32
Co-authored-by: tin900 <113692500+tin900@users.noreply.github.com>
Co-authored-by: tin900 <113692500+tin900@users.noreply.github.com>
Copilot AI changed the title [WIP] [Feature] Add list_user_activity_stream() to vvcanvas Add list_user_activity_stream() function to vvcanvas Jul 19, 2025
Copilot AI requested a review from tin900 July 19, 2025 17:36

@tin900 tin900 left a comment

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.

@copilot use the new paginate function see other functions how to use it

Co-authored-by: tin900 <113692500+tin900@users.noreply.github.com>

Copilot AI commented Jul 23, 2025

Copy link
Copy Markdown
Contributor Author

@copilot use the new paginate function see other functions how to use it

Updated the list_user_activity_stream() function to use the new paginate function following the same pattern as other functions in the package. The function now:

  • Uses paginate(response, canvas$api_key) instead of manual pagination
  • Returns a data frame instead of a list for consistency
  • Automatically retrieves all pages of results
  • Follows the same pattern as get_course_enrollments, get_course_students, etc.

Commit: 1e58ba3

Copilot AI requested a review from tin900 July 23, 2025 13:54
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.

[Feature] Add list_user_activity_stream() to vvcanvas

2 participants