Functions in Hype xAPI
HypeXAPI

HypeXAPI.sendStatementByDictonary

2min



This function sends a statement based on a configuration object. The object must at least contain a verb and object, but can also contain an agent, result, context, parent activity, grouping activity, and context activity. This function will resolve all the keys in the config object and send the statement. To use this function, you must first create a config object and populate it with the necessary values. The config object must at least contain a verb and object. You can also optionally include an agent, result, context, parent activity, grouping activity, and context activity. Once the config object has been populated, you can call the function and pass it the config object. The function will resolve all the keys in the object and send the statement.

The function will search for keys in the lookup, and resolve them if they are found. If not, the function will check if the variables necessary to create an actor have been provided. If they have, the function will create an xAPI actor object. If not, the function will use the default actor.

The function will then check if an xAPI statement has already been created. If it has, the function will send the statement. If not, the function will check if the necessary values to build an xAPI statement have been provided. If they have, the function will construct and send the statement. If not, the function will return an error.

The config object can contain the following keys:

Object key

Description

element

This is the element that will be used to get the xapi config from the attributes.

agent

This is the agent that will be used in the statement.

verb

This is the verb that will be used in the statement.

result

This is the object that will be used in the statement.

context

This is the context that will be used in the statement.

parent-activity

This is the parent activity that will be used in the statement.

grouping-activity

This is the grouping activity that will be used in the statement.

context-activity

This is the context activity that will be used in the statement.

verb-id

This is the verb id that will be used in the statement.

verb-name

This is the verb name that will be used in the statement.

object-id

This is the object id that will be used in the statement.

object-name

This is the object name that will be used in the statement.

object-desc

This is the object description that will be used in the statement.

debug

This is a flag to indicate if the statement should be sent in debug mode.