.course. discussionTopic

Source:
Functions for interacting with discussion topics within courses

Methods

(async) create(opts, configopt) → {Promise.<CanvasDiscussionTopic>}

Source:
Author:
  • Gabe Abrams
Creates a new discussion topic
Parameters:
Name Type Attributes Description
opts object object containing all arguments
Properties
Name Type Attributes Default Description
title string title of the discussion
message string message of the discussion
courseId number <optional>
default course id Canvas course Id to query
discussionType string <optional>
"side_comment" the type of discussion. Accepted values are 'side_comment', for discussions that only allow one level of nested comments, and 'threaded' for fully threaded discussions.
published boolean <optional>
if true, topic is published. If false, discussion topic is left in draft state
delayedPostAt date <optional>
if a date is given, the topic will not be published until that time
allowRating boolean <optional>
if true, users can rate entries in this topic
lockAt date <optional>
if a date is given, the topic will be scheduled to lock at the provided timestamp. If the date is in the past, the topic will be locked
pinned boolean <optional>
if true, this topic will be listed in the “Pinned Discussion” section
groupSetId number <optional>
if included, the topic will become a group discussion assigned to the group
onlyGradersCanRate boolean <optional>
if true, only graders will be allowed to rate entries.
requireInitialPost boolean <optional>
if true, then a user may not respond to other replies until that user has made an initial reply
config APIConfig <optional>
custom configuration for this specific endpoint call (overwrites defaults that were included when api was initialized)
Returns:
Type
Promise.<CanvasDiscussionTopic>

(async) delete(opts, configopt) → {Promise.<CanvasDiscussionTopic>}

Source:
Author:
  • Gabe Abrams
Deletes a discussion topic
Parameters:
Name Type Attributes Description
opts object object containing all arguments
Properties
Name Type Attributes Default Description
topicId string the id of the Canvas discussion topic to delete
courseId number <optional>
default course id Canvas course Id to query
config APIConfig <optional>
custom configuration for this specific endpoint call (overwrites defaults that were included when api was initialized)
Returns:
Type
Promise.<CanvasDiscussionTopic>

(async) list(optsopt, configopt) → {Promise.<Array.<CanvasDiscussionTopic>>}

Source:
Author:
  • Gabe Abrams
Gets the list of discussion topics
Parameters:
Name Type Attributes Description
opts object <optional>
object containing all arguments
Properties
Name Type Attributes Default Description
courseId number <optional>
Canvas course Id to query
includeAllDates boolean <optional>
If truthy, includes all dates
includeSections boolean <optional>
If truthy, includes sections
includeSectionsUserCount boolean <optional>
If truthy, includes section user count
includeOverrides boolean <optional>
If truthy, includes overrides
searchTerm string <optional>
If included, the partial title of the discussion topics to match and return
orderBy string <optional>
"position" If included, the results are ordered as instructed. Can be "position" or "recent_activity" or "title"
config APIConfig <optional>
custom configuration for this specific endpoint call (overwrites defaults that were included when api was initialized)
Returns:
Type
Promise.<Array.<CanvasDiscussionTopic>>

(async) listEntries(opts, configopt) → {Promise.<CanvasDiscussionTopic>}

Source:
Author:
  • Gabe Abrams
Lists the entries in a discussion topic
Parameters:
Name Type Attributes Description
opts object object containing all arguments
Properties
Name Type Attributes Default Description
topicId string the id of the Canvas discussion topic to list entries in
courseId number <optional>
default course id Canvas course Id to query
config APIConfig <optional>
custom configuration for this specific endpoint call (overwrites defaults that were included when api was initialized)
Returns:
Type
Promise.<CanvasDiscussionTopic>

(async) updatePublishState(opts)

Source:
Author:
  • Gabe Abrams
Update whether a discussion topic is published or not
Parameters:
Name Type Description
opts object object containing all arguments
Properties
Name Type Attributes Default Description
topicId number the id of the Canvas discussion topic to update
courseId number <optional>
default course id Canvas course Id to modify
isPublished boolean <optional>
if true, publish the discussion topic. Otherwise, unpublish it