Documentation ¶
Overview ¶
Package connector provides LTI Advantage services built upon a successful Launch. The package provides for a "base" Connector that can be upgraded to provide either or both Assignment & Grades Services and Names & Roles Provisioning Services.
Index ¶
- Constants
- Variables
- type AGS
- func (a *AGS) CreateLineItem(lineItem LineItem) (LineItem, error)
- func (a *AGS) DeleteLineItem(lineItemToDeleteEndpoint string) error
- func (a *AGS) GetLineItem() (LineItem, error)
- func (a *AGS) GetLineItems() ([]LineItem, error)
- func (a *AGS) GetPagedResults(limit int, userID string) ([]Result, bool, error)
- func (a *AGS) GetResults() ([]Result, error)
- func (a *AGS) GetUserResults(userID string) ([]Result, error)
- func (a *AGS) PutScore(s Score, useLaunchUserID bool) error
- func (a *AGS) UpdateLineItem(lineItem LineItem, notLaunchedLineItemEndpoint string) (LineItem, error)
- type Connector
- func (c *Connector) ClientID() string
- func (c *Connector) GetAccessToken(scopes []string) error
- func (c *Connector) PlatformKey() (jwk.Set, error)
- func (c *Connector) SetSigningKey(pemPrivateKey string) error
- func (c *Connector) UpgradeAGS() (*AGS, error)
- func (c *Connector) UpgradeNRPS() (*NRPS, error)
- type LTIContext
- type LineItem
- type Member
- type Membership
- type NRPS
- type Result
- type Score
- type ServiceRequest
Constants ¶
const ( ActivityInitialized = "Initialized" ActivityStarted = "Started" ActivityInProgress = "InProgress" ActivitySubmitted = "Submitted" ActivityCompleted = "Completed" )
AGS activityProgress constants.
const ( GradingFullyGraded = "FullyGraded" GradingPending = "Pending" GradingPendingManual = "PendingManual" GradingFailed = "Failed" GradeNotReady = "NotReady" )
AGS gradingProgress constants.
const ( // AccessTokenTimeoutSeconds determines the JWT Expiration validity period in seconds. AccessTokenTimeoutSeconds = 3600 // ClockSkewAllowanceMinutes determines the JWT IssuedAt clock skew allowance in minutes. ClockSkewAllowanceMinutes = 2 )
Variables ¶
var ( // ErrUnsupportedService is returned when the connector cannot be upgraded to either NRPS // or AGS because the platform does not appear to support the service. ErrUnsupportedService = errors.New("platform/LMS does not support the requested service") )
Functions ¶
This section is empty.
Types ¶
type AGS ¶
type AGS struct { LineItem *url.URL LineItems *url.URL Scopes []string NextPage *url.URL Target *Connector }
AGS implements Assignment & Grades Services functions.
func (*AGS) CreateLineItem ¶
CreateLineItem creates a new gradebook column in the launched context's lineitems container.
func (*AGS) DeleteLineItem ¶
DeleteLineItem removes a lineitem specified by the argument from the context's gradebook.
func (*AGS) GetLineItem ¶
GetLineItem gets the currently launched AGS lineitem.
func (*AGS) GetLineItems ¶
GetLineItems gets all the lineitems for the launched context, i.e. all columns in the course gradebook.
func (*AGS) GetPagedResults ¶
GetPagedResults fetches the platform-assigned grades for a lineitem. Note: Platforms are not required to support a Results service 'limit' parameter, see: https://www.imsglobal.org/spec/lti-ags/v2p0/#container-request-filters-0 It checks for next page links, fetching and appending them to the output.
func (*AGS) GetResults ¶
GetResults gets the launched limeitem's Results for all users enrolled in that lineitem's context (i.e. course).
func (*AGS) GetUserResults ¶
GetUserResults is the same as GetResults with the addition of a user ID to filter the Results service responses.
func (*AGS) PutScore ¶
PutScore posts a grade (LTI spec uses term 'score') for the launched resource to the platform's gradebook. The useLaunchUserID argument specifies if the launching user's ID is used; supply false to send the user ID embedded in the score argument.
func (*AGS) UpdateLineItem ¶
func (a *AGS) UpdateLineItem(lineItem LineItem, notLaunchedLineItemEndpoint string) (LineItem, error)
UpdateLineItem sends an encoded LineItem used by the platform to update its definition of the launched lineitem, or the lineitem at the optional notLaunchedLineItemEndpoint parameter if updating the launched lineitem is not desired.
type Connector ¶
type Connector struct { LaunchID string LaunchToken jwt.Token SigningKey *rsa.PrivateKey AccessToken datastore.AccessToken // contains filtered or unexported fields }
A Connector implements the base that underpins LTI 1.3 Advantage, i.e. AGS or NRPS.
func (*Connector) GetAccessToken ¶
GetAccessToken gets a scoped bearer token for use by a connector.
func (*Connector) PlatformKey ¶
PlatformKey gets the Platform's public key from the Registration Keyset URI.
func (*Connector) SetSigningKey ¶
SetSigningKey takes a PEM encoded private key and sets the signing key to the corresponding RSA private key.
func (*Connector) UpgradeAGS ¶
UpgradeAGS provides a Connector upgraded for AGS calls.
func (*Connector) UpgradeNRPS ¶
UpgradeNRPS provides a Connector upgraded for NRPS calls.
type LTIContext ¶
A LTIContext represents a brief course description used in Names & Roles.
type LineItem ¶
type LineItem struct { ID string `json:"id,omitempty"` StartDateTime string `json:"startDateTime,omitempty"` EndDateTime string `json:"endDateTime,omitempty"` ScoreMaximum float64 `json:"scoreMaximum,omitempty"` Label string `json:"label,omitempty"` Tag string `json:"tag,omitempty"` ResourceID string `json:"resourceId,omitempty"` ResourceLinkID string `json:"resourceLinkId,omitempty"` }
A LineItem represents the specific resource associated with a LTI launch.
type Member ¶
type Member struct { Status string Name string Picture string GivenName string `json:"given_name"` FamilyName string `json:"family_name"` MiddleName string `json:"middle_name"` Email string UserID string `json:"user_id"` LisPersonSourceDid string `json:"lis_person_sourcedid"` Roles []string }
A Member represents a participant in a LTI-enabled process.
type Membership ¶
type Membership struct { ID string Context LTIContext Members []Member }
A Membership represents a course membership with a brief class description.
type NRPS ¶
NRPS implements Names & Roles Provisioning Services functions.
func (*NRPS) GetLaunchingMember ¶
GetLaunchingMember returns a Member struct representing the user that performed the launch. Status is not included in the launch message.
func (*NRPS) GetMembership ¶
func (n *NRPS) GetMembership() (Membership, error)
GetMembership gets the launched course (referred to as a Context in LTI) membership from the platform. Using GetPagedMemberships as a helper, it checks for next page links, fetching and appending them to the output.
func (*NRPS) GetPagedMembership ¶
func (n *NRPS) GetPagedMembership(limit int) (Membership, bool, error)
GetPagedMembership gets paged Memberships for the launched course.
type Result ¶
type Result struct { ID string ScoreOf string UserID string ResultScore float64 ResultMaximum float64 Comment string }
A Result represents a grade assigned by the platform and retrieved by the tool.
type Score ¶
type Score struct { Timestamp string `json:"timestamp"` ScoreGiven float64 `json:"scoreGiven"` ScoreMaximum float64 `json:"scoreMaximum"` Comment string `json:"comment"` ActivityProgress string `json:"activityProgress"` GradingProgress string `json:"gradingProgress"` UserID string `json:"userId"` }
A Score represents a grade assigned by the tool and sent to the platform.