GroupCategory
extends AbstractBaseApi
in package
Canvas LMS Group Categories API
Group Categories allow organizing groups together in Canvas. They provide a way to manage collections of groups with shared settings and permissions.
Tags
Table of Contents
Properties
- $accountId : int|null
- The account ID if context_type is Account
- $autoLeader : string|null
- Auto leader configuration: 'first', 'random', or null
- $contextId : int|null
- The ID of the context (course_id or account_id)
- $contextType : string|null
- The context type (Course or Account)
- $courseId : int|null
- The course ID if context_type is Course
- $groupLimit : int|null
- Maximum number of users in each group (if self-signup enabled)
- $id : int|null
- The ID of the group category
- $name : string|null
- The display name of the group category
- $nonCollaborative : bool|null
- Indicates whether this group category is non-collaborative
- $progress : array<string, mixed>|null
- Progress object for async operations
- $role : string|null
- Special role designations: 'communities', 'student_organized', 'imported', or null
- $selfSignup : string|null
- Self signup configuration: 'enabled', 'restricted', or null
- $sisGroupCategoryId : string|null
- The SIS identifier for the group category
- $sisImportId : int|null
- The unique identifier for the SIS import
- $apiClient : HttpClientInterface
- $course : Course|null
- Course context for group categories
- $methodAliases : array<string|int, mixed>
- Define method aliases
Methods
- __callStatic() : mixed
- Magic method to handle function aliases
- __construct() : mixed
- BaseApi constructor.
- all() : array<string|int, static>
- Get all pages of results
- assignUnassignedMembers() : array<string|int, Group>|array<string|int, mixed>
- Assign unassigned members to groups
- checkCourse() : bool
- Check if course context is set
- create() : self
- Create a new group category in the current account
- delete() : self
- Delete the group category
- export() : array<string|int, mixed>
- Export groups and users in this category
- find() : self
- Get a single group category by ID
- get() : array<string|int, static>
- Get first page of results
- getAutoLeader() : string|null
- getContextId() : int|null
- getContextType() : string|null
- getGroupLimit() : int|null
- getId() : int|null
- getName() : string|null
- getNonCollaborative() : bool|null
- getProgress() : array<string, mixed>|null
- getRole() : string|null
- getSelfSignup() : string|null
- groups() : array<string|int, Group>
- List groups in this category
- groupsPaginated() : PaginatedResponse
- Get paginated groups in this category
- paginate() : PaginationResult
- Get paginated results with metadata
- save() : self
- Save the group category (create or update)
- setApiClient() : void
- Set the API client
- setAutoLeader() : void
- setContextId() : void
- setContextType() : void
- setCourse() : void
- Set the course context for group category operations
- setGroupLimit() : void
- setId() : void
- setName() : void
- setNonCollaborative() : void
- setProgress() : void
- setRole() : void
- setSelfSignup() : void
- toDtoArray() : array<string, mixed>
- Convert group category to DTO array
- update() : self
- Update group category
- users() : array<string|int, User>
- List users in this category
- usersPaginated() : PaginatedResponse
- Get paginated users in this category
- 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 endpoint for this resource.
- getPaginatedResponse() : PaginatedResponse
- Helper method to get paginated response from API endpoint
- populate() : void
- Populate the object with new data
Properties
$accountId
The account ID if context_type is Account
public
int|null
$accountId
= null
$autoLeader
Auto leader configuration: 'first', 'random', or null
public
string|null
$autoLeader
= null
$contextId
The ID of the context (course_id or account_id)
public
int|null
$contextId
= null
$contextType
The context type (Course or Account)
public
string|null
$contextType
= null
$courseId
The course ID if context_type is Course
public
int|null
$courseId
= null
$groupLimit
Maximum number of users in each group (if self-signup enabled)
public
int|null
$groupLimit
= null
$id
The ID of the group category
public
int|null
$id
= null
$name
The display name of the group category
public
string|null
$name
= null
$nonCollaborative
Indicates whether this group category is non-collaborative
public
bool|null
$nonCollaborative
= null
$progress
Progress object for async operations
public
array<string, mixed>|null
$progress
= null
$role
Special role designations: 'communities', 'student_organized', 'imported', or null
public
string|null
$role
= null
$selfSignup
Self signup configuration: 'enabled', 'restricted', or null
public
string|null
$selfSignup
= null
$sisGroupCategoryId
The SIS identifier for the group category
public
string|null
$sisGroupCategoryId
= null
$sisImportId
The unique identifier for the SIS import
public
int|null
$sisImportId
= null
$apiClient
protected
static HttpClientInterface
$apiClient
= null
$course
Course context for group categories
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()
BaseApi constructor.
public
__construct(array<string|int, mixed> $data) : mixed
Parameters
- $data : array<string|int, mixed>
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>assignUnassignedMembers()
Assign unassigned members to groups
public
assignUnassignedMembers([bool $sync = false ]) : array<string|int, Group>|array<string|int, mixed>
Parameters
- $sync : bool = false
-
Whether to perform synchronously (default: false)
Tags
Return values
array<string|int, Group>|array<string|int, mixed> —Groups if sync=true, progress object if async
checkCourse()
Check if course context is set
public
static checkCourse() : bool
Return values
boolcreate()
Create a new group category in the current account
public
static create(array<string, mixed>|CreateGroupCategoryDTO $data) : self
Parameters
- $data : array<string, mixed>|CreateGroupCategoryDTO
-
Group category data
Tags
Return values
selfdelete()
Delete the group category
public
delete() : self
Tags
Return values
selfexport()
Export groups and users in this category
public
export() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>find()
Get a single group category by ID
public
static find(int $id[, array<string|int, mixed> $params = [] ]) : self
Parameters
- $id : int
-
Group Category ID
- $params : array<string|int, mixed> = []
-
Optional query parameters
Tags
Return values
selfget()
Get first page of results
public
static get([array<string, mixed> $params = [] ]) : array<string|int, static>
Parameters
- $params : array<string, mixed> = []
-
Query parameters
Return values
array<string|int, static>getAutoLeader()
public
getAutoLeader() : string|null
Return values
string|nullgetContextId()
public
getContextId() : int|null
Return values
int|nullgetContextType()
public
getContextType() : string|null
Return values
string|nullgetGroupLimit()
public
getGroupLimit() : int|null
Return values
int|nullgetId()
public
getId() : int|null
Return values
int|nullgetName()
public
getName() : string|null
Return values
string|nullgetNonCollaborative()
public
getNonCollaborative() : bool|null
Return values
bool|nullgetProgress()
public
getProgress() : array<string, mixed>|null
Return values
array<string, mixed>|nullgetRole()
public
getRole() : string|null
Return values
string|nullgetSelfSignup()
public
getSelfSignup() : string|null
Return values
string|nullgroups()
List groups in this category
public
groups([array<string, mixed> $params = [] ]) : array<string|int, Group>
Parameters
- $params : array<string, mixed> = []
-
Query parameters
Tags
Return values
array<string|int, Group>groupsPaginated()
Get paginated groups in this category
public
groupsPaginated([array<string, mixed> $params = [] ]) : PaginatedResponse
Parameters
- $params : array<string, mixed> = []
-
Query parameters
Tags
Return values
PaginatedResponsepaginate()
Get paginated results with metadata
public
static paginate([array<string, mixed> $params = [] ]) : PaginationResult
Parameters
- $params : array<string, mixed> = []
-
Query parameters
Return values
PaginationResultsave()
Save the group category (create or update)
public
save() : self
Tags
Return values
selfsetApiClient()
Set the API client
public
static setApiClient(HttpClientInterface $apiClient) : void
Parameters
- $apiClient : HttpClientInterface
setAutoLeader()
public
setAutoLeader(string|null $autoLeader) : void
Parameters
- $autoLeader : string|null
setContextId()
public
setContextId(int|null $contextId) : void
Parameters
- $contextId : int|null
setContextType()
public
setContextType(string|null $contextType) : void
Parameters
- $contextType : string|null
setCourse()
Set the course context for group category operations
public
static setCourse(Course $course) : void
Parameters
- $course : Course
setGroupLimit()
public
setGroupLimit(int|null $groupLimit) : void
Parameters
- $groupLimit : int|null
setId()
public
setId(int|null $id) : void
Parameters
- $id : int|null
setName()
public
setName(string|null $name) : void
Parameters
- $name : string|null
setNonCollaborative()
public
setNonCollaborative(bool|null $nonCollaborative) : void
Parameters
- $nonCollaborative : bool|null
setProgress()
public
setProgress(array<string, mixed>|null $progress) : void
Parameters
- $progress : array<string, mixed>|null
setRole()
public
setRole(string|null $role) : void
Parameters
- $role : string|null
setSelfSignup()
public
setSelfSignup(string|null $selfSignup) : void
Parameters
- $selfSignup : string|null
toDtoArray()
Convert group category to DTO array
public
toDtoArray() : array<string, mixed>
Return values
array<string, mixed>update()
Update group category
public
static update(int $id, array<string, mixed>|UpdateGroupCategoryDTO $data) : self
Parameters
- $id : int
-
Group Category ID
- $data : array<string, mixed>|UpdateGroupCategoryDTO
-
Update data
Tags
Return values
selfusers()
List users in this category
public
users([array<string, mixed> $params = [] ]) : array<string|int, User>
Parameters
- $params : array<string, mixed> = []
-
Query parameters
Tags
Return values
array<string|int, User>usersPaginated()
Get paginated users in this category
public
usersPaginated([array<string, mixed> $params = [] ]) : PaginatedResponse
Parameters
- $params : array<string, mixed> = []
-
Query parameters
Tags
Return values
PaginatedResponsecastValue()
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 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>