TinCan.LRS Class
Constructor
TinCan.LRS
    
        ()
    
    
    
    
    
    
    
    
    
    Item Index
Methods
- _assignAttachmentContent
- _getBoundary
- _getMultipartRequestData
- _IEModeConversion
- _initByEnvironment
- _makeRequest
- _parseHeaders
- _parseMultipart
- _queryStatementsRequestCfg
- about
- dropActivityProfile
- dropAgentProfile
- dropState
- init
- log
- moreStatements
- queryStatements
- retrieveActivity
- retrieveActivityProfile
- retrieveActivityProfileIds
- retrieveAgentProfile
- retrieveAgentProfileIds
- retrieveState
- retrieveStateIds
- retrieveStatement
- retrieveVoidedStatement
- saveActivityProfile
- saveAgentProfile
- saveState
- saveStatement
- saveStatements
- sendRequest
Methods
_assignAttachmentContent
    
        - 
                    
                        [stmts]
- 
                    
                        [attachmentMap]
Assigns attachment content to the correct attachment to create a StatementsResult object that is sent to the callback of queryStatements()
Parameters:
- 
                    
                        [stmts]Array optionalArray of TinCan.Statement JSON objects 
- 
                    
                        [attachmentMap]Object optionalMap of the content to place into its attachment 
Returns:
Array of TinCan.Statement JSON objects with correctly assigned attachment content
_getBoundary
    
        ()
    
    
    
    
        private
    
    
    
    
    
    
    Creates and returns a boundary for separating parts in requests where the statement has an attachment
_getMultipartRequestData
    
        ()
    
    
    
    
        private
    
    
    
    
    
    
    Method should be overloaded by an environment to do per environment specifics for building multipart request data
_IEModeConversion
    
        ()
    
    
    
    
        private
    
    
    
    
    
    
    Method is overloaded by the browser environment in order to test converting an HTTP request that is greater than a defined length
_initByEnvironment
    
        ()
    
    
    
    
        private
    
    
    
    
    
    
    Method should be overloaded by an environment to do per environment specifics such that the LRS can make a call to set the version if not provided
_makeRequest
    
        ()
    
    
    
    
        private
    
    
    
    
    
    
    Method should be overloaded by an environment to do per environment specifics for sending requests to the LRS
_parseHeaders
    
        - 
                    
                        [rawHeaders]
Parses the headers of a multipart/mixed response section
Parameters:
- 
                    
                        [rawHeaders]String optionalString containing all the headers 
Returns:
Map of the headers
_parseMultipart
    
        - 
                    
                        [boundary]
- 
                    
                        [response]
Parses the different sections of a multipart/mixed response
Parameters:
- 
                    
                        [boundary]String optionalBoundary used to mark off the sections of the response 
- 
                    
                        [response]ArrayBuffer optionalBody of the response 
Returns:
Array of objects containing the parsed headers and body of each part
_queryStatementsRequestCfg
    
        - 
                    
                        [cfg]
Build a request config object that can be passed to sendRequest() to make a query request
Parameters:
- 
                    
                        [cfg]Object optionalSee configuration for queryStatements 
Returns:
Request configuration object
about
    
        - 
                    
                        cfg
Method used to determine the LRS version
Parameters:
- 
                    
                        cfgObjectConfiguration object for the about request - 
                                
                                    [callback]Function optionalCallback to execute upon receiving a response 
- 
                                
                                    [params]Object optionalthis is needed, but can be empty 
 
- 
                                
                                    
Returns:
About which holds the version, or asyncrhonously calls a specified callback
dropActivityProfile
    
        - 
                    
                        key
- 
                    
                        cfg
Drop an activity profile value, when used from a browser sends to the endpoint using the RESTful interface. Full activity profile delete is not supported by the spec.
Parameters:
- 
                    
                        keyString | NullKey of activity profile to delete 
- 
                    
                        cfgObjectConfiguration options - 
                                
                                    activityTinCan.ActivityActivity in document identifier 
- 
                                
                                    [callback]Function optionalCallback to execute on completion 
- 
                                
                                    [requestHeaders]Object optionalOptional object containing additional headers to add to request 
 
- 
                                
                                    
dropAgentProfile
    
        - 
                    
                        key
- 
                    
                        cfg
Drop an agent profile value, when used from a browser sends to the endpoint using the RESTful interface. Full agent profile delete is not supported by the spec.
Parameters:
- 
                    
                        keyString | NullKey of agent profile to delete 
- 
                    
                        cfgObjectConfiguration options - 
                                
                                    agentTinCan.AgentAgent in document identifier 
- 
                                
                                    [callback]Function optionalCallback to execute on completion 
- 
                                
                                    [requestHeaders]Object optionalOptional object containing additional headers to add to request 
 
- 
                                
                                    
dropState
    
        - 
                    
                        key
- 
                    
                        cfg
Drop a state value or all of the state, when used from a browser sends to the endpoint using the RESTful interface.
Parameters:
- 
                    
                        keyString | NullKey of state to delete, or null for all 
- 
                    
                        cfgObjectConfiguration options - 
                                
                                    activityTinCan.ActivityActivity in document identifier 
- 
                                
                                    agentTinCan.AgentAgent in document identifier 
- 
                                
                                    [registration]String optionalRegistration 
- 
                                
                                    [callback]Function optionalCallback to execute on completion 
- 
                                
                                    [requestHeaders]Object optionalOptional object containing additional headers to add to request 
 
- 
                                
                                    
init
    
        ()
    
    
    
    
    
    
    
    
    
    log
    
        ()
    
    
    
    
    
    
    
    
    
    moreStatements
    
        - 
                    
                        [cfg]
Fetch more statements from a previous query, when used from a browser sends to the endpoint using the RESTful interface. Use a callback to make the call asynchronous.
Parameters:
- 
                    
                        [cfg]Object optionalConfiguration used to query - 
                                
                                    [url]String optionalMore URL 
- 
                                
                                    [callback]Function optionalCallback to execute on completion - 
                                            
                                                errString | NullError status or null if succcess
- 
                                            
                                                responseTinCan.StatementsResult | XHRReceives a StatementsResult argument
 
- 
                                            
                                                
 
- 
                                
                                    
Returns:
Request result
queryStatements
    
        - 
                    
                        [cfg]
Fetch a set of statements, when used from a browser sends to the endpoint using the RESTful interface. Use a callback to make the call asynchronous.
Parameters:
- 
                    
                        [cfg]Object optionalConfiguration used to query - 
                                
                                    [params]Object optionalQuery parameters - 
                                            
                                                [agent]TinCan.Agent | TinCan.Group optionalAgent matches 'actor' or 'object'
- 
                                            
                                                [verb]TinCan.Verb | String optionalVerb (or verb ID) to query on
- 
                                            
                                                [activity]TinCan.Activity | String optionalActivity (or activity ID) to query on
- 
                                            
                                                [registration]String optionalRegistration UUID
- 
                                            
                                                [related_activities]Boolean optionalMatch related activities
- 
                                            
                                                [related_agents]Boolean optionalMatch related agents
- 
                                            
                                                [since]String optionalMatch statements stored since specified timestamp
- 
                                            
                                                [until]String optionalMatch statements stored at or before specified timestamp
- 
                                            
                                                [limit]Integer optionalNumber of results to retrieve
- 
                                            
                                                [format]String optionalOne of "ids", "exact", "canonical" (default: "exact")
- 
                                            
                                                [ascending]Boolean optionalReturn results in ascending order of stored time
- 
                                            
                                                [actor]TinCan.Agent optional(Removed in 1.0.0, use 'agent' instead) Agent matches 'actor'
- 
                                            
                                                [target]TinCan.Activity | TinCan.Agent | TinCan.Statement optional(Removed in 1.0.0, use 'activity' or 'agent' instead) Activity, Agent, or Statement matches 'object'
- 
                                            
                                                [instructor]TinCan.Agent optional(Removed in 1.0.0, use 'agent' + 'related_agents' instead) Agent matches 'context:instructor'
- 
                                            
                                                [context]Boolean optional(Removed in 1.0.0, use 'activity' instead) When filtering on target, include statements with matching context
- 
                                            
                                                [authoritative]Boolean optional(Removed in 1.0.0) Get authoritative results
- 
                                            
                                                [sparse]Boolean optional(Removed in 1.0.0, use 'format' instead) Get sparse results
 
- 
                                            
                                                
- 
                                
                                    [callback]Function optionalCallback to execute on completion - 
                                            
                                                errString | NullError status or null if succcess
- 
                                            
                                                responseTinCan.StatementsResult | XHRReceives a StatementsResult argument
 
- 
                                            
                                                
 
- 
                                
                                    
Returns:
Request result
retrieveActivity
    
        - 
                    
                        activityId
- 
                    
                        cfg
Retrieve an activity, when used from a browser sends to the endpoint using the RESTful interface.
Parameters:
- 
                    
                        activityIdStringid of the Activity to retrieve 
- 
                    
                        cfgObjectConfiguration options - 
                                
                                    [callback]Function optionalCallback to execute on completion 
- 
                                
                                    [requestHeaders]Object optionalOptional object containing additional headers to add to request 
 
- 
                                
                                    
Returns:
Value retrieved
retrieveActivityProfile
    
        - 
                    
                        key
- 
                    
                        cfg
Retrieve an activity profile value, when used from a browser sends to the endpoint using the RESTful interface.
Parameters:
- 
                    
                        keyStringKey of activity profile to retrieve 
- 
                    
                        cfgObjectConfiguration options - 
                                
                                    activityTinCan.ActivityActivity in document identifier 
- 
                                
                                    [callback]Function optionalCallback to execute on completion 
- 
                                
                                    [requestHeaders]Object optionalOptional object containing additional headers to add to request 
 
- 
                                
                                    
Returns:
Value retrieved
retrieveActivityProfileIds
    
        - 
                    
                        cfg
Retrieve the list of IDs for an activity profile, when used from a browser sends to the endpoint using the RESTful interface.
Parameters:
- 
                    
                        cfgObjectConfiguration options - 
                                
                                    activityTinCan.ActivityActivity in document identifier 
- 
                                
                                    [callback]Function optionalCallback to execute on completion 
- 
                                
                                    [since]String optionalMatch activity profiles saved since given timestamp 
- 
                                
                                    [requestHeaders]Object optionalOptional object containing additional headers to add to request 
 
- 
                                
                                    
Returns:
List of ids for this Activity profile
retrieveAgentProfile
    
        - 
                    
                        key
- 
                    
                        cfg
Retrieve an agent profile value, when used from a browser sends to the endpoint using the RESTful interface.
Parameters:
- 
                    
                        keyStringKey of agent profile to retrieve 
- 
                    
                        cfgObjectConfiguration options - 
                                
                                    agentTinCan.AgentAgent in document identifier 
- 
                                
                                    [callback]Function optionalCallback to execute on completion 
- 
                                
                                    [requestHeaders]Object optionalOptional object containing additional headers to add to request 
 
- 
                                
                                    
Returns:
Value retrieved
retrieveAgentProfileIds
    
        - 
                    
                        cfg
Retrieve the list of profileIds for an agent profile, when used from a browser sends to the endpoint using the RESTful interface.
Parameters:
- 
                    
                        cfgObjectConfiguration options - 
                                
                                    agentTinCan.AgentAgent in document identifier 
- 
                                
                                    [callback]Function optionalCallback to execute on completion 
- 
                                
                                    [since]String optionalMatch activity profiles saved since given timestamp 
- 
                                
                                    [requestHeaders]Object optionalOptional object containing additional headers to add to request 
 
- 
                                
                                    
Returns:
List of profileIds for this Agent
retrieveState
    
        - 
                    
                        key
- 
                    
                        cfg
Retrieve a state value, when used from a browser sends to the endpoint using the RESTful interface.
Parameters:
- 
                    
                        keyStringKey of state to retrieve 
- 
                    
                        cfgObjectConfiguration options - 
                                
                                    activityTinCan.ActivityActivity in document identifier 
- 
                                
                                    agentTinCan.AgentAgent in document identifier 
- 
                                
                                    [registration]String optionalRegistration 
- 
                                
                                    [callback]Function optionalCallback to execute on completion - 
                                            
                                                errorObject | Null
- 
                                            
                                                resultTinCan.State | Nullnull if state is 404
 
- 
                                            
                                                
- 
                                
                                    [requestHeaders]Object optionalObject containing additional headers to add to request 
 
- 
                                
                                    
Returns:
TinCan.State retrieved when synchronous, or result from sendRequest
retrieveStateIds
    
        - 
                    
                        cfg
Retrieve the list of IDs for a state, when used from a browser sends to the endpoint using the RESTful interface.
Parameters:
- 
                    
                        cfgObjectConfiguration options - 
                                
                                    activityTinCan.ActivityActivity in document identifier 
- 
                                
                                    agentTinCan.AgentAgent in document identifier 
- 
                                
                                    [registration]String optionalRegistration 
- 
                                
                                    [callback]Function optionalCallback to execute on completion 
- 
                                
                                    [since]String optionalMatch activity profiles saved since given timestamp 
- 
                                
                                    [requestHeaders]Object optionalOptional object containing additional headers to add to request 
 
- 
                                
                                    
Returns:
requestResult Request result
retrieveStatement
    
        - 
                    
                        ID
- 
                    
                        [cfg]
Retrieve a statement, when used from a browser sends to the endpoint using the RESTful interface.
Parameters:
- 
                    
                        IDStringof statement to retrieve 
- 
                    
                        [cfg]Object optionalConfiguration options - 
                                
                                    [params]Object optionalQuery parameters - 
                                            
                                                [attachments]Boolean optionalInclude attachments in multipart response or don't (default: false)
 
- 
                                            
                                                
- 
                                
                                    [callback]Function optionalCallback to execute on completion 
 
- 
                                
                                    
Returns:
Statement retrieved
retrieveVoidedStatement
    
        - 
                    
                        ID
- 
                    
                        [cfg]
Retrieve a voided statement, when used from a browser sends to the endpoint using the RESTful interface.
Parameters:
- 
                    
                        IDStringof voided statement to retrieve 
- 
                    
                        [cfg]Object optionalConfiguration options - 
                                
                                    [params]Object optionalQuery parameters - 
                                            
                                                [attachments]Boolean optionalInclude attachments in multipart response or don't (default: false)
 
- 
                                            
                                                
- 
                                
                                    [callback]Function optionalCallback to execute on completion 
 
- 
                                
                                    
Returns:
Statement retrieved
saveActivityProfile
    
        - 
                    
                        key
- 
                    
                        val
- 
                    
                        cfg
Save an activity profile value, when used from a browser sends to the endpoint using the RESTful interface.
Parameters:
- 
                    
                        keyStringKey of activity profile to retrieve 
- 
                    
                        valObjectValue to be stored 
- 
                    
                        cfgObjectConfiguration options - 
                                
                                    activityTinCan.ActivityActivity in document identifier 
- 
                                
                                    [lastSHA1]String optionalSHA1 of the previously seen existing profile 
- 
                                
                                    [contentType]String optionalContent-Type to specify in headers (defaults to 'application/octet-stream') 
- 
                                
                                    [method]String optionalMethod to use. Default: PUT 
- 
                                
                                    [callback]Function optionalCallback to execute on completion 
- 
                                
                                    [requestHeaders]Object optionalOptional object containing additional headers to add to request 
 
- 
                                
                                    
saveAgentProfile
    
        - 
                    
                        key
- 
                    
                        val
- 
                    
                        cfg
Save an agent profile value, when used from a browser sends to the endpoint using the RESTful interface.
Parameters:
- 
                    
                        keyStringKey of agent profile to retrieve 
- 
                    
                        valObjectValue to be stored 
- 
                    
                        cfgObjectConfiguration options - 
                                
                                    agentTinCan.AgentAgent in document identifier 
- 
                                
                                    [lastSHA1]String optionalSHA1 of the previously seen existing profile 
- 
                                
                                    [contentType]String optionalContent-Type to specify in headers (defaults to 'application/octet-stream') 
- 
                                
                                    [method]String optionalMethod to use. Default: PUT 
- 
                                
                                    [callback]Function optionalCallback to execute on completion 
- 
                                
                                    [requestHeaders]Object optionalOptional object containing additional headers to add to request 
 
- 
                                
                                    
saveState
    
        - 
                    
                        key
- 
                    
                        val
- 
                    
                        cfg
Save a state value, when used from a browser sends to the endpoint using the RESTful interface.
Parameters:
- 
                    
                        keyStringKey of state to save 
- 
                    
                        valObjectValue to be stored 
- 
                    
                        cfgObjectConfiguration options - 
                                
                                    activityTinCan.ActivityActivity in document identifier 
- 
                                
                                    agentTinCan.AgentAgent in document identifier 
- 
                                
                                    [registration]String optionalRegistration 
- 
                                
                                    [lastSHA1]String optionalSHA1 of the previously seen existing state 
- 
                                
                                    [contentType]String optionalContent-Type to specify in headers (defaults to 'application/octet-stream') 
- 
                                
                                    [method]String optionalMethod to use. Default: PUT 
- 
                                
                                    [callback]Function optionalCallback to execute on completion 
- 
                                
                                    [requestHeaders]Object optionalOptional object containing additional headers to add to request 
 
- 
                                
                                    
saveStatement
    
        - 
                    
                        statement
- 
                    
                        [cfg]
Save a statement, when used from a browser sends to the endpoint using the RESTful interface. Use a callback to make the call asynchronous.
Parameters:
- 
                    
                        statementTinCan.Statementto send 
- 
                    
                        [cfg]Object optionalConfiguration used when saving - 
                                
                                    [callback]Function optionalCallback to execute on completion 
 
- 
                                
                                    
saveStatements
    
        - 
                    
                        Array
- 
                    
                        [cfg]
Save a set of statements, when used from a browser sends to the endpoint using the RESTful interface. Use a callback to make the call asynchronous.
Parameters:
- 
                    
                        ArrayArrayof statements or objects convertable to statements 
- 
                    
                        [cfg]Object optionalConfiguration used when saving - 
                                
                                    [callback]Function optionalCallback to execute on completion 
 
- 
                                
                                    
sendRequest
    
        - 
                    
                        cfg
Method used to send a request via browser objects to the LRS
Parameters:
- 
                    
                        cfgObjectConfiguration for request - 
                                
                                    urlStringURL portion to add to endpoint 
- 
                                
                                    [method]String optionalGET, PUT, POST, etc. 
- 
                                
                                    [params]Object optionalParameters to set on the querystring 
- 
                                
                                    [data]String | ArrayBuffer optionalBody content as a String or ArrayBuffer 
- 
                                
                                    [headers]Object optionalAdditional headers to set in the request 
- 
                                
                                    [callback]Function optionalFunction to run at completion - 
                                            
                                                errString | NullIf an error occurred, this parameter will contain the HTTP status code. If the operation succeeded, err will be null.
- 
                                            
                                                xhrObjectXHR object
 
- 
                                            
                                                
- 
                                
                                    [ignore404]Boolean optionalWhether 404 status codes should be considered an error 
- 
                                
                                    [expectMultipart]Boolean optionalWhether to expect the response to be a multipart response 
 
- 
                                
                                    
Returns:
XHR if called in a synchronous way (in other words no callback)
Properties
allowFail
    Boolean
    
    
    
    
    
    Default: true
