Documentation

OutcomeGroup extends AbstractBaseApi

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
see
https://canvas.instructure.com/doc/api/outcome_groups.html

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

$parentOutcomeGroupId

public int|null $parentOutcomeGroupId = 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
throws
InvalidArgumentException

__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
bool

create()

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
throws
CanvasApiException
Return values
self

createGlobal()

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
throws
CanvasApiException
Return values
self

createInContext()

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
throws
CanvasApiException
Return values
self

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
throws
CanvasApiException
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
throws
CanvasApiException
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
throws
CanvasApiException
Return values
PaginationResult

fetchByContext()

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
throws
CanvasApiException
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
throws
CanvasApiException
Return values
PaginationResult

fetchGlobal()

Fetch global outcome groups.

public static fetchGlobal([array<string, mixed> $params = [] ]) : array<int, OutcomeGroup>
Parameters
$params : array<string, mixed> = []

Optional query parameters

Tags
throws
CanvasApiException
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
throws
CanvasApiException
Return values
self

findByContext()

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
throws
CanvasApiException
Return values
self

findGlobal()

Find a specific global outcome group by ID.

public static findGlobal(int $id) : self
Parameters
$id : int

Outcome group ID

Tags
throws
CanvasApiException
Return values
self

get()

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
throws
CanvasApiException
Return values
array<int, OutcomeGroup>

Array of OutcomeGroup objects

getGlobalRootGroup()

Get the global root outcome group.

public static getGlobalRootGroup() : self
Tags
throws
CanvasApiException
Return values
self

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
throws
CanvasApiException
Return values
self

importOutcomes()

Import outcomes from external source.

public importOutcomes(array<string, mixed> $importData) : array<string, mixed>
Parameters
$importData : array<string, mixed>

Import configuration

Tags
throws
CanvasApiException
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
throws
CanvasApiException
Return values
OutcomeLink

outcomes()

Get outcomes in this outcome group.

public outcomes([array<string, mixed> $params = [] ]) : array<int, OutcomeLink>
Parameters
$params : array<string, mixed> = []

Optional query parameters

Tags
throws
CanvasApiException
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
throws
CanvasApiException
Return values
PaginationResult

Paginated result with metadata

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
throws
CanvasApiException
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
throws
CanvasApiException
Return values
bool

castValue()

Cast a value to the correct type

protected castValue(string $key, mixed $value) : DateTime|mixed
Parameters
$key : string
$value : mixed
Tags
throws
Exception
Return values
DateTime|mixed

checkApiClient()

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>

getEndpoint()

Get the API endpoint for this resource

protected static getEndpoint() : string
Return values
string

getPaginatedResponse()

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
PaginatedResponse

populate()

Populate the object with new data

protected populate(array<string|int, mixed> $data) : void
Parameters
$data : array<string|int, mixed>
Tags
throws
Exception

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

Tags
throws
CanvasApiException
Return values
PaginatedResponse

        
On this page

Search results