DiscussionTopic
extends AbstractBaseApi
in package
Canvas LMS Discussion Topics API
Provides functionality to manage discussion topics in Canvas LMS. This class handles creating, reading, updating, and deleting discussion topics for a specific course.
Usage Examples:
// Set course context (required for all operations)
$course = Course::find(123);
DiscussionTopic::setCourse($course);
// Create a new discussion topic
$discussionData = [
'title' => 'Weekly Discussion: Introduction',
'message' => 'Please introduce yourself to the class',
'discussion_type' => 'threaded',
'require_initial_post' => true
];
$discussion = DiscussionTopic::create($discussionData);
// Find a discussion topic by ID
$discussion = DiscussionTopic::find(456);
// List all discussion topics for the course
$discussions = DiscussionTopic::get();
// Get paginated discussion topics
$paginatedDiscussions = DiscussionTopic::paginate();
$allDiscussions = DiscussionTopic::all();
// Update a discussion topic
$updatedDiscussion = DiscussionTopic::update(456, ['title' => 'Updated Discussion Title']);
// Update using DTO
$updateDto = new UpdateDiscussionTopicDTO(['title' => 'New Title', 'pinned' => true]);
$updatedDiscussion = DiscussionTopic::update(456, $updateDto);
// Update using instance method
$discussion = DiscussionTopic::find(456);
$discussion->setTitle('Updated Title');
$success = $discussion->save();
// Delete a discussion topic
$discussion = DiscussionTopic::find(456);
$success = $discussion->delete();
// Pin/unpin a discussion
$discussion->pin();
$discussion->unpin();
// Lock/unlock a discussion
$discussion->lock();
$discussion->unlock();
Table of Contents
Properties
- $allowRating : bool|null
- Whether the discussion allows rating
- $assignmentId : int|null
- Assignment ID for graded discussions
- $attachments : array<string|int, mixed>|null
- Array of file attachments
- $author : array<string, mixed>|null
- Discussion topic author information
- $courseId : int|null
- Course ID this discussion topic belongs to
- $createdAt : string|null
- Discussion topic creation timestamp
- $delayedPostAt : string|null
- When the topic will be automatically published
- $discussionSubentryCount : int|null
- Number of replies in the topic
- $discussionType : string|null
- Discussion type (threaded, side_comment, etc.)
- $expand : bool|null
- Whether threaded replies should be expanded by default
- $expandLocked : bool|null
- Whether users can choose their preferred thread expansion setting
- $gradingType : string|null
- Grading type for graded discussions
- $groupCategoryId : int|null
- Group category ID for group discussions
- $groupTopic : bool|null
- Whether the discussion is for a group
- $groupTopicChildren : array<string|int, mixed>|null
- Group-specific child topics
- $htmlUrl : string|null
- HTML URL to the discussion topic
- $id : int|null
- Discussion topic unique identifier
- $isAnnouncement : bool|null
- Whether this is an announcement
- $lastReplyAt : string|null
- When the last reply was posted
- $locked : bool|null
- Whether the discussion is locked
- $lockedForUser : bool|null
- Whether the topic is locked for the current user
- $lockExplanation : string|null
- Explanation of why the topic is locked
- $lockInfo : array<string, mixed>|null
- Information about why the topic is locked
- $message : string|null
- Discussion topic message/description (HTML)
- $onlyGradersCanRate : bool|null
- Whether rating is only for graders
- $permissions : array<string, mixed>|null
- User permissions for the topic
- $pinned : bool|null
- Whether the discussion is pinned
- $podcastUrl : string|null
- URL for podcast feed
- $pointsPossible : float|null
- Points possible for graded discussions
- $postedAt : string|null
- When the discussion topic was posted
- $published : bool|null
- Whether the discussion topic is published
- $readOnly : bool|null
- Whether the discussion is read only
- $readState : string|null
- Read state for the current user (read, unread, partially_read)
- $requireInitialPost : bool|null
- Whether users must post before seeing replies
- $rootTopicId : int|null
- ID of the root topic (for group discussions)
- $sortByRating : bool|null
- Whether to sort entries by rating
- $sortOrder : string|null
- Default sort order of the discussion (asc or desc)
- $sortOrderLocked : bool|null
- Whether users can choose their preferred sort order
- $subscribed : bool|null
- Whether the current user is subscribed to notifications
- $subscriptionHold : string|null
- Subscription hold status
- $title : string|null
- Discussion topic title
- $topicChildren : array<string|int, mixed>|null
- Child topics (for threaded discussions)
- $unreadCount : int|null
- Number of unread entries for the current user
- $updatedAt : string|null
- Discussion topic last update timestamp
- $userCanSeePosts : bool|null
- Whether users can see posts (based on require_initial_post)
- $userId : int|null
- User ID of the discussion author
- $userName : string|null
- Name of the topic author
- $workflowState : string|null
- Discussion workflow state
- $apiClient : HttpClientInterface
- $course : Course|null
- $methodAliases : array<string|int, mixed>
- Define method aliases
Methods
- __callStatic() : mixed
- Magic method to handle function aliases
- __construct() : mixed
- Create a new DiscussionTopic instance
- all() : array<string|int, static>
- Get all pages of results
- assignment() : Assignment|null
- Get the assignment associated with this discussion (if graded)
- author() : User|null
- Get the author of this discussion topic
- checkCourse() : bool
- Check if course context is set
- course() : Course|null
- Get the course this discussion topic belongs to
- create() : self
- Create a new discussion topic
- delete() : self
- Delete the discussion topic
- find() : self
- Find a single discussion topic by ID
- get() : array<string|int, DiscussionTopic>
- Fetch all discussion topics for the course
- getAllowRating() : bool|null
- Get allow rating status
- getAssignmentId() : int|null
- Get assignment ID
- getAttachments() : array<string|int, mixed>|null
- Get attachments
- getAuthor() : array<string, mixed>|null
- Get author information
- getCourseId() : int|null
- Get course ID
- getCreatedAt() : string|null
- Get created at timestamp
- getDelayedPostAt() : string|null
- Get delayed post at timestamp
- getDiscussionSubentryCount() : int|null
- Get discussion subentry count
- getDiscussionType() : string|null
- Get discussion type
- getExpand() : bool|null
- Get expand status
- getExpandLocked() : bool|null
- Get expand locked status
- getGradingType() : string|null
- Get grading type
- getGroupCategoryId() : int|null
- Get group category ID
- getGroupTopic() : bool|null
- Get group topic status
- getGroupTopicChildren() : array<string|int, mixed>|null
- Get group topic children
- getHtmlUrl() : string|null
- Get HTML URL
- getId() : int|null
- Get discussion topic ID
- getIsAnnouncement() : bool|null
- Get is announcement status
- getLastReplyAt() : string|null
- Get last reply at timestamp
- getLocked() : bool|null
- Get locked status
- getLockedForUser() : bool|null
- Get locked for user status
- getLockExplanation() : string|null
- Get lock explanation
- getLockInfo() : array<string, mixed>|null
- Get lock info
- getMessage() : string|null
- Get discussion topic message
- getOnlyGradersCanRate() : bool|null
- Get only graders can rate status
- getPermissions() : array<string, mixed>|null
- Get permissions
- getPinned() : bool|null
- Get pinned status
- getPodcastUrl() : string|null
- Get podcast URL
- getPointsPossible() : float|null
- Get points possible
- getPostedAt() : string|null
- Get posted at timestamp
- getPublished() : bool|null
- Get published status
- getReadOnly() : bool|null
- Get read only status
- getReadState() : string|null
- Get read state
- getRequireInitialPost() : bool|null
- Get require initial post status
- getRootTopicId() : int|null
- Get root topic ID
- getSortByRating() : bool|null
- Get sort by rating status
- getSortOrder() : string|null
- Get sort order
- getSortOrderLocked() : bool|null
- Get sort order locked status
- getSubscribed() : bool|null
- Get subscribed status
- getSubscriptionHold() : string|null
- Get subscription hold status
- getTitle() : string|null
- Get discussion topic title
- getTopicChildren() : array<string|int, mixed>|null
- Get topic children
- getUnreadCount() : int|null
- Get unread count
- getUpdatedAt() : string|null
- Get updated at timestamp
- getUserCanSeePosts() : bool|null
- Get user can see posts status
- getUserId() : int|null
- Get user ID
- getUserName() : string|null
- Get user name
- getWorkflowState() : string|null
- Get workflow state
- lock() : bool
- Lock the discussion topic
- markAllAsRead() : bool
- Mark all discussion topics in course as read
- markAllAsUnread() : bool
- Mark all discussion topics in course as unread
- markAsRead() : bool
- Mark discussion topic as read
- markAsUnread() : bool
- Mark discussion topic as unread
- paginate() : PaginationResult
- Get paginated discussion topics
- pin() : bool
- Pin the discussion topic
- save() : self
- Save the current discussion topic (create or update)
- setAllowRating() : void
- Set allow rating status
- setApiClient() : void
- Set the API client
- setAssignmentId() : void
- Set assignment ID
- setAttachments() : void
- Set attachments
- setAuthor() : void
- Set author information
- setCourse() : void
- Set the course context for discussion topic operations
- setCourseId() : void
- Set course ID
- setCreatedAt() : void
- Set created at timestamp
- setDelayedPostAt() : void
- Set delayed post at timestamp
- setDiscussionSubentryCount() : void
- Set discussion subentry count
- setDiscussionType() : void
- Set discussion type
- setExpand() : void
- Set expand status
- setExpandLocked() : void
- Set expand locked status
- setGradingType() : void
- Set grading type
- setGroupCategoryId() : void
- Set group category ID
- setGroupTopic() : void
- Set group topic status
- setGroupTopicChildren() : void
- Set group topic children
- setHtmlUrl() : void
- Set HTML URL
- setId() : void
- Set discussion topic ID
- setIsAnnouncement() : void
- Set is announcement status
- setLastReplyAt() : void
- Set last reply at timestamp
- setLocked() : void
- Set locked status
- setLockedForUser() : void
- Set locked for user status
- setLockExplanation() : void
- Set lock explanation
- setLockInfo() : void
- Set lock info
- setMessage() : void
- Set discussion topic message
- setOnlyGradersCanRate() : void
- Set only graders can rate status
- setPermissions() : void
- Set permissions
- setPinned() : void
- Set pinned status
- setPodcastUrl() : void
- Set podcast URL
- setPointsPossible() : void
- Set points possible
- setPostedAt() : void
- Set posted at timestamp
- setPublished() : void
- Set published status
- setReadOnly() : void
- Set read only status
- setReadState() : void
- Set read state
- setRequireInitialPost() : void
- Set require initial post status
- setRootTopicId() : void
- Set root topic ID
- setSortByRating() : void
- Set sort by rating status
- setSortOrder() : void
- Set sort order
- setSortOrderLocked() : void
- Set sort order locked status
- setSubscribed() : void
- Set subscribed status
- setSubscriptionHold() : void
- Set subscription hold status
- setTitle() : void
- Set discussion topic title
- setTopicChildren() : void
- Set topic children
- setUnreadCount() : void
- Set unread count
- setUpdatedAt() : void
- Set updated at timestamp
- setUserCanSeePosts() : void
- Set user can see posts status
- setUserId() : void
- Set user ID
- setUserName() : void
- Set user name
- setWorkflowState() : void
- Set workflow state
- subscribe() : bool
- Subscribe to discussion topic notifications
- toArray() : array<string, mixed>
- Convert discussion topic to array
- toDtoArray() : array<string, mixed>
- Convert discussion topic to DTO array format
- unlock() : bool
- Unlock the discussion topic
- unpin() : bool
- Unpin the discussion topic
- unsubscribe() : bool
- Unsubscribe from discussion topic notifications
- update() : self
- Update a discussion topic
- castValue() : DateTime|mixed
- Cast a value to the correct type
- checkApiClient() : void
- Check if the API client is set, if not, instantiate a new one
- convertPaginatedResponseToModels() : array<string|int, static>
- Helper method to convert paginated response data to model instances
- createConfiguredHttpClient() : HttpClient
- Create an HttpClient with configured middleware
- createPaginationResult() : PaginationResult
- Helper method to create PaginationResult from paginated response
- getEndpoint() : string
- Get the API endpoint for this resource
- getPaginatedResponse() : PaginatedResponse
- Helper method to get paginated response from API endpoint
- populate() : void
- Populate the object with new data
Properties
$allowRating
Whether the discussion allows rating
public
bool|null
$allowRating
= null
$assignmentId
Assignment ID for graded discussions
public
int|null
$assignmentId
= null
$attachments
Array of file attachments
public
array<string|int, mixed>|null
$attachments
= null
$author
Discussion topic author information
public
array<string, mixed>|null
$author
= null
$courseId
Course ID this discussion topic belongs to
public
int|null
$courseId
= null
$createdAt
Discussion topic creation timestamp
public
string|null
$createdAt
= null
$delayedPostAt
When the topic will be automatically published
public
string|null
$delayedPostAt
= null
$discussionSubentryCount
Number of replies in the topic
public
int|null
$discussionSubentryCount
= null
$discussionType
Discussion type (threaded, side_comment, etc.)
public
string|null
$discussionType
= null
$expand
Whether threaded replies should be expanded by default
public
bool|null
$expand
= null
$expandLocked
Whether users can choose their preferred thread expansion setting
public
bool|null
$expandLocked
= null
$gradingType
Grading type for graded discussions
public
string|null
$gradingType
= null
$groupCategoryId
Group category ID for group discussions
public
int|null
$groupCategoryId
= null
$groupTopic
Whether the discussion is for a group
public
bool|null
$groupTopic
= null
$groupTopicChildren
Group-specific child topics
public
array<string|int, mixed>|null
$groupTopicChildren
= null
$htmlUrl
HTML URL to the discussion topic
public
string|null
$htmlUrl
= null
$id
Discussion topic unique identifier
public
int|null
$id
= null
$isAnnouncement
Whether this is an announcement
public
bool|null
$isAnnouncement
= null
$lastReplyAt
When the last reply was posted
public
string|null
$lastReplyAt
= null
$locked
Whether the discussion is locked
public
bool|null
$locked
= null
$lockedForUser
Whether the topic is locked for the current user
public
bool|null
$lockedForUser
= null
$lockExplanation
Explanation of why the topic is locked
public
string|null
$lockExplanation
= null
$lockInfo
Information about why the topic is locked
public
array<string, mixed>|null
$lockInfo
= null
$message
Discussion topic message/description (HTML)
public
string|null
$message
= null
$onlyGradersCanRate
Whether rating is only for graders
public
bool|null
$onlyGradersCanRate
= null
$permissions
User permissions for the topic
public
array<string, mixed>|null
$permissions
= null
$pinned
Whether the discussion is pinned
public
bool|null
$pinned
= null
$podcastUrl
URL for podcast feed
public
string|null
$podcastUrl
= null
$pointsPossible
Points possible for graded discussions
public
float|null
$pointsPossible
= null
$postedAt
When the discussion topic was posted
public
string|null
$postedAt
= null
$published
Whether the discussion topic is published
public
bool|null
$published
= null
$readOnly
Whether the discussion is read only
public
bool|null
$readOnly
= null
$readState
Read state for the current user (read, unread, partially_read)
public
string|null
$readState
= null
$requireInitialPost
Whether users must post before seeing replies
public
bool|null
$requireInitialPost
= null
$rootTopicId
ID of the root topic (for group discussions)
public
int|null
$rootTopicId
= null
$sortByRating
Whether to sort entries by rating
public
bool|null
$sortByRating
= null
$sortOrder
Default sort order of the discussion (asc or desc)
public
string|null
$sortOrder
= null
$sortOrderLocked
Whether users can choose their preferred sort order
public
bool|null
$sortOrderLocked
= null
$subscribed
Whether the current user is subscribed to notifications
public
bool|null
$subscribed
= null
$subscriptionHold
Subscription hold status
public
string|null
$subscriptionHold
= null
$title
Discussion topic title
public
string|null
$title
= null
$topicChildren
Child topics (for threaded discussions)
public
array<string|int, mixed>|null
$topicChildren
= null
$unreadCount
Number of unread entries for the current user
public
int|null
$unreadCount
= null
$updatedAt
Discussion topic last update timestamp
public
string|null
$updatedAt
= null
$userCanSeePosts
Whether users can see posts (based on require_initial_post)
public
bool|null
$userCanSeePosts
= null
$userId
User ID of the discussion author
public
int|null
$userId
= null
$userName
Name of the topic author
public
string|null
$userName
= null
$workflowState
Discussion workflow state
public
string|null
$workflowState
= null
$apiClient
protected
static HttpClientInterface
$apiClient
= null
$course
protected
static Course|null
$course
= null
$methodAliases
Define method aliases
protected
static array<string|int, mixed>
$methodAliases
= ['get' => ['fetch', 'list', 'fetchAll'], 'all' => ['fetchAllPages', 'getAll'], 'paginate' => ['getPaginated', 'withPagination', 'fetchPage'], 'find' => ['one', 'getOne']]
Methods
__callStatic()
Magic method to handle function aliases
public
static __callStatic(string $name, array<string|int, mixed> $arguments) : mixed
Parameters
- $name : string
- $arguments : array<string|int, mixed>
Tags
__construct()
Create a new DiscussionTopic instance
public
__construct([array<string, mixed> $data = [] ]) : mixed
Parameters
- $data : array<string, mixed> = []
-
Discussion topic data from Canvas API
all()
Get all pages of results
public
static all([array<string, mixed> $params = [] ]) : array<string|int, static>
Parameters
- $params : array<string, mixed> = []
-
Query parameters
Return values
array<string|int, static>assignment()
Get the assignment associated with this discussion (if graded)
public
assignment() : Assignment|null
Tags
Return values
Assignment|nullauthor()
Get the author of this discussion topic
public
author() : User|null
Tags
Return values
User|nullcheckCourse()
Check if course context is set
public
static checkCourse() : bool
Tags
Return values
boolcourse()
Get the course this discussion topic belongs to
public
course() : Course|null
Return values
Course|nullcreate()
Create a new discussion topic
public
static create(array<string, mixed>|CreateDiscussionTopicDTO $data) : self
Parameters
- $data : array<string, mixed>|CreateDiscussionTopicDTO
-
Discussion topic data
Tags
Return values
self —Created DiscussionTopic object
delete()
Delete the discussion topic
public
delete() : self
Tags
Return values
selffind()
Find a single discussion topic by ID
public
static find(int $id[, array<string, mixed> $params = [] ]) : self
Parameters
- $id : int
-
Discussion topic ID
- $params : array<string, mixed> = []
-
Optional query parameters
Tags
Return values
selfget()
Fetch all discussion topics for the course
public
static get([array<string, mixed> $params = [] ]) : array<string|int, DiscussionTopic>
Parameters
- $params : array<string, mixed> = []
-
Optional parameters
Tags
Return values
array<string|int, DiscussionTopic> —Array of DiscussionTopic objects
getAllowRating()
Get allow rating status
public
getAllowRating() : bool|null
Return values
bool|nullgetAssignmentId()
Get assignment ID
public
getAssignmentId() : int|null
Return values
int|nullgetAttachments()
Get attachments
public
getAttachments() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nullgetAuthor()
Get author information
public
getAuthor() : array<string, mixed>|null
Return values
array<string, mixed>|nullgetCourseId()
Get course ID
public
getCourseId() : int|null
Return values
int|nullgetCreatedAt()
Get created at timestamp
public
getCreatedAt() : string|null
Return values
string|nullgetDelayedPostAt()
Get delayed post at timestamp
public
getDelayedPostAt() : string|null
Return values
string|nullgetDiscussionSubentryCount()
Get discussion subentry count
public
getDiscussionSubentryCount() : int|null
Return values
int|nullgetDiscussionType()
Get discussion type
public
getDiscussionType() : string|null
Return values
string|nullgetExpand()
Get expand status
public
getExpand() : bool|null
Return values
bool|nullgetExpandLocked()
Get expand locked status
public
getExpandLocked() : bool|null
Return values
bool|nullgetGradingType()
Get grading type
public
getGradingType() : string|null
Return values
string|nullgetGroupCategoryId()
Get group category ID
public
getGroupCategoryId() : int|null
Return values
int|nullgetGroupTopic()
Get group topic status
public
getGroupTopic() : bool|null
Return values
bool|nullgetGroupTopicChildren()
Get group topic children
public
getGroupTopicChildren() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nullgetHtmlUrl()
Get HTML URL
public
getHtmlUrl() : string|null
Return values
string|nullgetId()
Get discussion topic ID
public
getId() : int|null
Return values
int|nullgetIsAnnouncement()
Get is announcement status
public
getIsAnnouncement() : bool|null
Return values
bool|nullgetLastReplyAt()
Get last reply at timestamp
public
getLastReplyAt() : string|null
Return values
string|nullgetLocked()
Get locked status
public
getLocked() : bool|null
Return values
bool|nullgetLockedForUser()
Get locked for user status
public
getLockedForUser() : bool|null
Return values
bool|nullgetLockExplanation()
Get lock explanation
public
getLockExplanation() : string|null
Return values
string|nullgetLockInfo()
Get lock info
public
getLockInfo() : array<string, mixed>|null
Return values
array<string, mixed>|nullgetMessage()
Get discussion topic message
public
getMessage() : string|null
Return values
string|nullgetOnlyGradersCanRate()
Get only graders can rate status
public
getOnlyGradersCanRate() : bool|null
Return values
bool|nullgetPermissions()
Get permissions
public
getPermissions() : array<string, mixed>|null
Return values
array<string, mixed>|nullgetPinned()
Get pinned status
public
getPinned() : bool|null
Return values
bool|nullgetPodcastUrl()
Get podcast URL
public
getPodcastUrl() : string|null
Return values
string|nullgetPointsPossible()
Get points possible
public
getPointsPossible() : float|null
Return values
float|nullgetPostedAt()
Get posted at timestamp
public
getPostedAt() : string|null
Return values
string|nullgetPublished()
Get published status
public
getPublished() : bool|null
Return values
bool|nullgetReadOnly()
Get read only status
public
getReadOnly() : bool|null
Return values
bool|nullgetReadState()
Get read state
public
getReadState() : string|null
Return values
string|nullgetRequireInitialPost()
Get require initial post status
public
getRequireInitialPost() : bool|null
Return values
bool|nullgetRootTopicId()
Get root topic ID
public
getRootTopicId() : int|null
Return values
int|nullgetSortByRating()
Get sort by rating status
public
getSortByRating() : bool|null
Return values
bool|nullgetSortOrder()
Get sort order
public
getSortOrder() : string|null
Return values
string|nullgetSortOrderLocked()
Get sort order locked status
public
getSortOrderLocked() : bool|null
Return values
bool|nullgetSubscribed()
Get subscribed status
public
getSubscribed() : bool|null
Return values
bool|nullgetSubscriptionHold()
Get subscription hold status
public
getSubscriptionHold() : string|null
Return values
string|nullgetTitle()
Get discussion topic title
public
getTitle() : string|null
Return values
string|nullgetTopicChildren()
Get topic children
public
getTopicChildren() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nullgetUnreadCount()
Get unread count
public
getUnreadCount() : int|null
Return values
int|nullgetUpdatedAt()
Get updated at timestamp
public
getUpdatedAt() : string|null
Return values
string|nullgetUserCanSeePosts()
Get user can see posts status
public
getUserCanSeePosts() : bool|null
Return values
bool|nullgetUserId()
Get user ID
public
getUserId() : int|null
Return values
int|nullgetUserName()
Get user name
public
getUserName() : string|null
Return values
string|nullgetWorkflowState()
Get workflow state
public
getWorkflowState() : string|null
Return values
string|nulllock()
Lock the discussion topic
public
lock() : bool
Tags
Return values
bool —True if locking was successful, false otherwise
markAllAsRead()
Mark all discussion topics in course as read
public
static markAllAsRead() : bool
Tags
Return values
bool —True if marking all as read was successful, false otherwise
markAllAsUnread()
Mark all discussion topics in course as unread
public
static markAllAsUnread() : bool
Tags
Return values
bool —True if marking all as unread was successful, false otherwise
markAsRead()
Mark discussion topic as read
public
markAsRead() : bool
Tags
Return values
bool —True if marking as read was successful, false otherwise
markAsUnread()
Mark discussion topic as unread
public
markAsUnread() : bool
Tags
Return values
bool —True if marking as unread was successful, false otherwise
paginate()
Get paginated discussion topics
public
static paginate([array<string, mixed> $params = [] ]) : PaginationResult
Parameters
- $params : array<string, mixed> = []
-
Optional parameters
Tags
Return values
PaginationResultpin()
Pin the discussion topic
public
pin() : bool
Tags
Return values
bool —True if pinning was successful, false otherwise
save()
Save the current discussion topic (create or update)
public
save() : self
Tags
Return values
selfsetAllowRating()
Set allow rating status
public
setAllowRating(bool|null $allowRating) : void
Parameters
- $allowRating : bool|null
setApiClient()
Set the API client
public
static setApiClient(HttpClientInterface $apiClient) : void
Parameters
- $apiClient : HttpClientInterface
setAssignmentId()
Set assignment ID
public
setAssignmentId(int|null $assignmentId) : void
Parameters
- $assignmentId : int|null
setAttachments()
Set attachments
public
setAttachments(array<string|int, mixed>|null $attachments) : void
Parameters
- $attachments : array<string|int, mixed>|null
setAuthor()
Set author information
public
setAuthor(array<string, mixed>|null $author) : void
Parameters
- $author : array<string, mixed>|null
setCourse()
Set the course context for discussion topic operations
public
static setCourse(Course $course) : void
Parameters
- $course : Course
-
The course to operate on
setCourseId()
Set course ID
public
setCourseId(int|null $courseId) : void
Parameters
- $courseId : int|null
setCreatedAt()
Set created at timestamp
public
setCreatedAt(string|null $createdAt) : void
Parameters
- $createdAt : string|null
setDelayedPostAt()
Set delayed post at timestamp
public
setDelayedPostAt(string|null $delayedPostAt) : void
Parameters
- $delayedPostAt : string|null
setDiscussionSubentryCount()
Set discussion subentry count
public
setDiscussionSubentryCount(int|null $discussionSubentryCount) : void
Parameters
- $discussionSubentryCount : int|null
setDiscussionType()
Set discussion type
public
setDiscussionType(string|null $discussionType) : void
Parameters
- $discussionType : string|null
setExpand()
Set expand status
public
setExpand(bool|null $expand) : void
Parameters
- $expand : bool|null
setExpandLocked()
Set expand locked status
public
setExpandLocked(bool|null $expandLocked) : void
Parameters
- $expandLocked : bool|null
setGradingType()
Set grading type
public
setGradingType(string|null $gradingType) : void
Parameters
- $gradingType : string|null
setGroupCategoryId()
Set group category ID
public
setGroupCategoryId(int|null $groupCategoryId) : void
Parameters
- $groupCategoryId : int|null
setGroupTopic()
Set group topic status
public
setGroupTopic(bool|null $groupTopic) : void
Parameters
- $groupTopic : bool|null
setGroupTopicChildren()
Set group topic children
public
setGroupTopicChildren(array<string|int, mixed>|null $groupTopicChildren) : void
Parameters
- $groupTopicChildren : array<string|int, mixed>|null
setHtmlUrl()
Set HTML URL
public
setHtmlUrl(string|null $htmlUrl) : void
Parameters
- $htmlUrl : string|null
setId()
Set discussion topic ID
public
setId(int|null $id) : void
Parameters
- $id : int|null
setIsAnnouncement()
Set is announcement status
public
setIsAnnouncement(bool|null $isAnnouncement) : void
Parameters
- $isAnnouncement : bool|null
setLastReplyAt()
Set last reply at timestamp
public
setLastReplyAt(string|null $lastReplyAt) : void
Parameters
- $lastReplyAt : string|null
setLocked()
Set locked status
public
setLocked(bool|null $locked) : void
Parameters
- $locked : bool|null
setLockedForUser()
Set locked for user status
public
setLockedForUser(bool|null $lockedForUser) : void
Parameters
- $lockedForUser : bool|null
setLockExplanation()
Set lock explanation
public
setLockExplanation(string|null $lockExplanation) : void
Parameters
- $lockExplanation : string|null
setLockInfo()
Set lock info
public
setLockInfo(array<string, mixed>|null $lockInfo) : void
Parameters
- $lockInfo : array<string, mixed>|null
setMessage()
Set discussion topic message
public
setMessage(string|null $message) : void
Parameters
- $message : string|null
setOnlyGradersCanRate()
Set only graders can rate status
public
setOnlyGradersCanRate(bool|null $onlyGradersCanRate) : void
Parameters
- $onlyGradersCanRate : bool|null
setPermissions()
Set permissions
public
setPermissions(array<string, mixed>|null $permissions) : void
Parameters
- $permissions : array<string, mixed>|null
setPinned()
Set pinned status
public
setPinned(bool|null $pinned) : void
Parameters
- $pinned : bool|null
setPodcastUrl()
Set podcast URL
public
setPodcastUrl(string|null $podcastUrl) : void
Parameters
- $podcastUrl : string|null
setPointsPossible()
Set points possible
public
setPointsPossible(float|null $pointsPossible) : void
Parameters
- $pointsPossible : float|null
setPostedAt()
Set posted at timestamp
public
setPostedAt(string|null $postedAt) : void
Parameters
- $postedAt : string|null
setPublished()
Set published status
public
setPublished(bool|null $published) : void
Parameters
- $published : bool|null
setReadOnly()
Set read only status
public
setReadOnly(bool|null $readOnly) : void
Parameters
- $readOnly : bool|null
setReadState()
Set read state
public
setReadState(string|null $readState) : void
Parameters
- $readState : string|null
setRequireInitialPost()
Set require initial post status
public
setRequireInitialPost(bool|null $requireInitialPost) : void
Parameters
- $requireInitialPost : bool|null
setRootTopicId()
Set root topic ID
public
setRootTopicId(int|null $rootTopicId) : void
Parameters
- $rootTopicId : int|null
setSortByRating()
Set sort by rating status
public
setSortByRating(bool|null $sortByRating) : void
Parameters
- $sortByRating : bool|null
setSortOrder()
Set sort order
public
setSortOrder(string|null $sortOrder) : void
Parameters
- $sortOrder : string|null
setSortOrderLocked()
Set sort order locked status
public
setSortOrderLocked(bool|null $sortOrderLocked) : void
Parameters
- $sortOrderLocked : bool|null
setSubscribed()
Set subscribed status
public
setSubscribed(bool|null $subscribed) : void
Parameters
- $subscribed : bool|null
setSubscriptionHold()
Set subscription hold status
public
setSubscriptionHold(string|null $subscriptionHold) : void
Parameters
- $subscriptionHold : string|null
setTitle()
Set discussion topic title
public
setTitle(string|null $title) : void
Parameters
- $title : string|null
setTopicChildren()
Set topic children
public
setTopicChildren(array<string|int, mixed>|null $topicChildren) : void
Parameters
- $topicChildren : array<string|int, mixed>|null
setUnreadCount()
Set unread count
public
setUnreadCount(int|null $unreadCount) : void
Parameters
- $unreadCount : int|null
setUpdatedAt()
Set updated at timestamp
public
setUpdatedAt(string|null $updatedAt) : void
Parameters
- $updatedAt : string|null
setUserCanSeePosts()
Set user can see posts status
public
setUserCanSeePosts(bool|null $userCanSeePosts) : void
Parameters
- $userCanSeePosts : bool|null
setUserId()
Set user ID
public
setUserId(int|null $userId) : void
Parameters
- $userId : int|null
setUserName()
Set user name
public
setUserName(string|null $userName) : void
Parameters
- $userName : string|null
setWorkflowState()
Set workflow state
public
setWorkflowState(string|null $workflowState) : void
Parameters
- $workflowState : string|null
subscribe()
Subscribe to discussion topic notifications
public
subscribe() : bool
Tags
Return values
bool —True if subscription was successful, false otherwise
toArray()
Convert discussion topic to array
public
toArray() : array<string, mixed>
Return values
array<string, mixed>toDtoArray()
Convert discussion topic to DTO array format
public
toDtoArray() : array<string, mixed>
Return values
array<string, mixed>unlock()
Unlock the discussion topic
public
unlock() : bool
Tags
Return values
bool —True if unlocking was successful, false otherwise
unpin()
Unpin the discussion topic
public
unpin() : bool
Tags
Return values
bool —True if unpinning was successful, false otherwise
unsubscribe()
Unsubscribe from discussion topic notifications
public
unsubscribe() : bool
Tags
Return values
bool —True if unsubscription was successful, false otherwise
update()
Update a discussion topic
public
static update(int $id, array<string, mixed>|UpdateDiscussionTopicDTO $data) : self
Parameters
- $id : int
-
Discussion topic ID
- $data : array<string, mixed>|UpdateDiscussionTopicDTO
-
Discussion topic data
Tags
Return values
self —Updated DiscussionTopic object
castValue()
Cast a value to the correct type
protected
castValue(string $key, mixed $value) : DateTime|mixed
Parameters
- $key : string
- $value : mixed
Tags
Return values
DateTime|mixedcheckApiClient()
Check if the API client is set, if not, instantiate a new one
protected
static checkApiClient() : void
convertPaginatedResponseToModels()
Helper method to convert paginated response data to model instances
protected
static convertPaginatedResponseToModels(PaginatedResponse $paginatedResponse) : array<string|int, static>
Parameters
- $paginatedResponse : PaginatedResponse
Return values
array<string|int, static>createConfiguredHttpClient()
Create an HttpClient with configured middleware
protected
static createConfiguredHttpClient() : HttpClient
Return values
HttpClientcreatePaginationResult()
Helper method to create PaginationResult from paginated response
protected
static createPaginationResult(PaginatedResponse $paginatedResponse) : PaginationResult
Parameters
- $paginatedResponse : PaginatedResponse
Return values
PaginationResultgetEndpoint()
Get the API endpoint for this resource
protected
static getEndpoint() : string
Tags
Return values
stringgetPaginatedResponse()
Helper method to get paginated response from API endpoint
protected
static getPaginatedResponse(string $endpoint[, array<string|int, mixed> $params = [] ]) : PaginatedResponse
Parameters
- $endpoint : string
-
The API endpoint path
- $params : array<string|int, mixed> = []
-
Query parameters for the request
Return values
PaginatedResponsepopulate()
Populate the object with new data
protected
populate(array<string|int, mixed> $data) : void
Parameters
- $data : array<string|int, mixed>