OutcomeGroup
extends AbstractBaseApi
in package
OutcomeGroup API class for managing hierarchical outcome groups in Canvas LMS.
Outcome groups organize learning outcomes in a hierarchical structure, allowing for categorization and management of related outcomes.
Tags
Table of Contents
Properties
- $canEdit : bool|null
- $contextId : int|null
- $contextType : string|null
- $description : string|null
- $id : int|null
- $importsUrl : string|null
- $outcomesCount : int|null
- $outcomesUrl : string|null
- $parentOutcomeGroupId : int|null
- $subgroupsCount : int|null
- $subgroupsUrl : string|null
- $title : string|null
- $url : string|null
- $vendorGuid : string|null
- $apiClient : HttpClientInterface
- $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
- canEdit() : bool
- Check if this group can be edited.
- create() : self
- Create a new outcome group (defaults to Account context).
- createGlobal() : self
- Create a new global outcome group.
- createInContext() : self
- Create a new outcome group in a specific context.
- createOutcome() : OutcomeLink
- Create a new outcome in this group.
- createSubgroup() : self
- Create a subgroup within this group.
- delete() : self
- Delete an outcome group.
- fetchAllLinks() : array<int, OutcomeLink>
- Fetch all outcome links for a context (defaults to Account).
- fetchAllLinksByContext() : array<int, OutcomeLink>
- Fetch all outcome links for a specific context.
- fetchAllLinksPaginated() : PaginationResult
- Fetch paginated outcome links (defaults to Account context).
- fetchByContext() : array<int, OutcomeGroup>
- Fetch outcome groups by specific context.
- fetchByContextPaginated() : PaginationResult
- Fetch paginated outcome groups by specific context.
- fetchGlobal() : array<int, OutcomeGroup>
- Fetch global outcome groups.
- find() : self
- Find a specific outcome group by ID (defaults to Account context).
- findByContext() : self
- Find a specific outcome group by ID within a context.
- findGlobal() : self
- Find a specific global outcome group by ID.
- get() : array<int, OutcomeGroup>
- Get first page of outcome groups (defaults to Account context).
- getGlobalRootGroup() : self
- Get the global root outcome group.
- getHierarchyPath() : array<int, OutcomeGroup>
- Get the full hierarchy path from root to this group.
- getRootGroup() : self
- Get the global/root outcome group for a context.
- importOutcomes() : array<string, mixed>
- Import outcomes from external source.
- linkOutcome() : OutcomeLink
- Link an existing outcome to this group.
- outcomes() : array<int, OutcomeLink>
- Get outcomes in this outcome group.
- paginate() : PaginationResult
- Get paginated outcome groups (defaults to Account context).
- setApiClient() : void
- Set the API client
- subgroups() : array<int, OutcomeGroup>
- Get subgroups of this outcome group.
- unlinkOutcome() : bool
- Unlink an outcome from this group.
- update() : self
- Update an existing outcome group.
- 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
- toDtoArray() : array<string|int, mixed>
- Convert the object to an array
- fetchAllLinksByContextPaginated() : PaginatedResponse
- Fetch paginated outcome links for a specific context.
Properties
$canEdit
public
bool|null
$canEdit
= null
$contextId
public
int|null
$contextId
= null
$contextType
public
string|null
$contextType
= null
$description
public
string|null
$description
= null
$id
public
int|null
$id
= null
$importsUrl
public
string|null
$importsUrl
= null
$outcomesCount
public
int|null
$outcomesCount
= null
$outcomesUrl
public
string|null
$outcomesUrl
= null
$parentOutcomeGroupId
public
int|null
$parentOutcomeGroupId
= null
$subgroupsCount
public
int|null
$subgroupsCount
= null
$subgroupsUrl
public
string|null
$subgroupsUrl
= null
$title
public
string|null
$title
= null
$url
public
string|null
$url
= null
$vendorGuid
public
string|null
$vendorGuid
= null
$apiClient
protected
static HttpClientInterface
$apiClient
= 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>canEdit()
Check if this group can be edited.
public
canEdit() : bool
Return values
boolcreate()
Create a new outcome group (defaults to Account context).
public
static create(array<string, mixed>|CreateOutcomeGroupDTO $data[, int|null $parentGroupId = null ]) : self
Parameters
- $data : array<string, mixed>|CreateOutcomeGroupDTO
-
Outcome group data
- $parentGroupId : int|null = null
-
Parent group ID (null for root level)
Tags
Return values
selfcreateGlobal()
Create a new global outcome group.
public
static createGlobal(array<string, mixed>|CreateOutcomeGroupDTO $data[, int|null $parentGroupId = null ]) : self
Parameters
- $data : array<string, mixed>|CreateOutcomeGroupDTO
-
Outcome group data
- $parentGroupId : int|null = null
-
Parent group ID (null for root level)
Tags
Return values
selfcreateInContext()
Create a new outcome group in a specific context.
public
static createInContext(string $contextType, int $contextId, array<string, mixed>|CreateOutcomeGroupDTO $data[, int|null $parentGroupId = null ]) : self
Parameters
- $contextType : string
-
Context type (accounts, courses)
- $contextId : int
-
Context ID
- $data : array<string, mixed>|CreateOutcomeGroupDTO
-
Outcome group data
- $parentGroupId : int|null = null
-
Parent group ID (null for root level)
Tags
Return values
selfcreateOutcome()
Create a new outcome in this group.
public
createOutcome(array<string, mixed>|CreateOutcomeDTO $data) : OutcomeLink
Parameters
- $data : array<string, mixed>|CreateOutcomeDTO
-
Outcome data
Tags
Return values
OutcomeLinkcreateSubgroup()
Create a subgroup within this group.
public
createSubgroup(array<string, mixed>|CreateOutcomeGroupDTO $data) : self
Parameters
- $data : array<string, mixed>|CreateOutcomeGroupDTO
-
Subgroup data
Tags
Return values
selfdelete()
Delete an outcome group.
public
delete() : self
Tags
Return values
selffetchAllLinks()
Fetch all outcome links for a context (defaults to Account).
public
static fetchAllLinks([array<string, mixed> $params = [] ]) : array<int, OutcomeLink>
Returns ALL outcome links across ALL groups in the context.
Parameters
- $params : array<string, mixed> = []
-
Optional query parameters
Tags
Return values
array<int, OutcomeLink> —Array of OutcomeLink objects
fetchAllLinksByContext()
Fetch all outcome links for a specific context.
public
static fetchAllLinksByContext(string $contextType, int $contextId[, array<string, mixed> $params = [] ]) : array<int, OutcomeLink>
Returns ALL outcome links across ALL groups in the context.
Parameters
- $contextType : string
-
Context type (accounts, courses)
- $contextId : int
-
Context ID
- $params : array<string, mixed> = []
-
Optional query parameters
Tags
Return values
array<int, OutcomeLink> —Array of OutcomeLink objects
fetchAllLinksPaginated()
Fetch paginated outcome links (defaults to Account context).
public
static fetchAllLinksPaginated([array<string, mixed> $params = [] ]) : PaginationResult
Parameters
- $params : array<string, mixed> = []
-
Optional query parameters
Tags
Return values
PaginationResultfetchByContext()
Fetch outcome groups by specific context.
public
static fetchByContext(string $contextType, int $contextId[, array<string, mixed> $params = [] ]) : array<int, OutcomeGroup>
Parameters
- $contextType : string
-
Context type (accounts, courses)
- $contextId : int
-
Context ID
- $params : array<string, mixed> = []
-
Optional query parameters
Tags
Return values
array<int, OutcomeGroup> —Array of OutcomeGroup objects
fetchByContextPaginated()
Fetch paginated outcome groups by specific context.
public
static fetchByContextPaginated(string $contextType, int $contextId[, array<string, mixed> $params = [] ]) : PaginationResult
Parameters
- $contextType : string
-
Context type (accounts, courses)
- $contextId : int
-
Context ID
- $params : array<string, mixed> = []
-
Optional query parameters
Tags
Return values
PaginationResultfetchGlobal()
Fetch global outcome groups.
public
static fetchGlobal([array<string, mixed> $params = [] ]) : array<int, OutcomeGroup>
Parameters
- $params : array<string, mixed> = []
-
Optional query parameters
Tags
Return values
array<int, OutcomeGroup> —Array of OutcomeGroup objects
find()
Find a specific outcome group by ID (defaults to Account context).
public
static find(int $id[, array<string|int, mixed> $params = [] ]) : self
Parameters
- $id : int
-
Outcome group ID
- $params : array<string|int, mixed> = []
-
Optional query parameters
Tags
Return values
selffindByContext()
Find a specific outcome group by ID within a context.
public
static findByContext(string|null $contextType, int|null $contextId, int $id) : self
Parameters
- $contextType : string|null
-
Context type (accounts, courses) or null for global
- $contextId : int|null
-
Context ID or null for global
- $id : int
-
Outcome group ID
Tags
Return values
selffindGlobal()
Find a specific global outcome group by ID.
public
static findGlobal(int $id) : self
Parameters
- $id : int
-
Outcome group ID
Tags
Return values
selfget()
Get first page of outcome groups (defaults to Account context).
public
static get([array<string, mixed> $params = [] ]) : array<int, OutcomeGroup>
Parameters
- $params : array<string, mixed> = []
-
Optional query parameters
Tags
Return values
array<int, OutcomeGroup> —Array of OutcomeGroup objects
getGlobalRootGroup()
Get the global root outcome group.
public
static getGlobalRootGroup() : self
Tags
Return values
selfgetHierarchyPath()
Get the full hierarchy path from root to this group.
public
getHierarchyPath() : array<int, OutcomeGroup>
Tags
Return values
array<int, OutcomeGroup> —Array of parent groups
getRootGroup()
Get the global/root outcome group for a context.
public
static getRootGroup(string $contextType, int $contextId) : self
Parameters
- $contextType : string
-
Context type (accounts, courses)
- $contextId : int
-
Context ID
Tags
Return values
selfimportOutcomes()
Import outcomes from external source.
public
importOutcomes(array<string, mixed> $importData) : array<string, mixed>
Parameters
- $importData : array<string, mixed>
-
Import configuration
Tags
Return values
array<string, mixed> —Import status
linkOutcome()
Link an existing outcome to this group.
public
linkOutcome(int $outcomeId[, int|null $moveFrom = null ]) : OutcomeLink
Parameters
- $outcomeId : int
-
Outcome ID to link
- $moveFrom : int|null = null
-
Optional group ID to move the outcome from
Tags
Return values
OutcomeLinkoutcomes()
Get outcomes in this outcome group.
public
outcomes([array<string, mixed> $params = [] ]) : array<int, OutcomeLink>
Parameters
- $params : array<string, mixed> = []
-
Optional query parameters
Tags
Return values
array<int, OutcomeLink> —Array of OutcomeLink objects
paginate()
Get paginated outcome groups (defaults to Account context).
public
static paginate([array<string, mixed> $params = [] ]) : PaginationResult
Parameters
- $params : array<string, mixed> = []
-
Optional query parameters
Tags
Return values
PaginationResult —Paginated result with metadata
setApiClient()
Set the API client
public
static setApiClient(HttpClientInterface $apiClient) : void
Parameters
- $apiClient : HttpClientInterface
subgroups()
Get subgroups of this outcome group.
public
subgroups([array<string, mixed> $params = [] ]) : array<int, OutcomeGroup>
Parameters
- $params : array<string, mixed> = []
-
Optional query parameters
Tags
Return values
array<int, OutcomeGroup> —Array of OutcomeGroup objects
unlinkOutcome()
Unlink an outcome from this group.
public
unlinkOutcome(int $outcomeId) : bool
Parameters
- $outcomeId : int
-
Outcome ID to unlink
Tags
Return values
boolupdate()
Update an existing outcome group.
public
update(array<string, mixed>|UpdateOutcomeGroupDTO $data) : self
Parameters
- $data : array<string, mixed>|UpdateOutcomeGroupDTO
-
Update data
Tags
Return values
selfcastValue()
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
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>
Tags
toDtoArray()
Convert the object to an array
protected
toDtoArray() : array<string|int, mixed>
Return values
array<string|int, mixed>fetchAllLinksByContextPaginated()
Fetch paginated outcome links for a specific context.
private
static fetchAllLinksByContextPaginated(string $contextType, int $contextId[, array<string, mixed> $params = [] ]) : PaginatedResponse
Parameters
- $contextType : string
-
Context type (accounts, courses)
- $contextId : int
-
Context ID
- $params : array<string, mixed> = []
-
Optional query parameters