xAPI 샘플코드
http://rusticisoftware.github.io/TinCan.NET/
using System;
using TinCan;
using TinCan.LRSResponses;
var lrs = new RemoteLRS(
"https://cloud.scorm.com/tc/public/",
"username",
"password"
);
var actor = new Agent();
actor.mbox = "mailto:[email protected]";
var verb = new Verb();
verb.id = new Uri ("http://adlnet.gov/expapi/verbs/experienced");
verb.display = new LanguageMap();
verb.display.Add("en-US", "experienced");
var activity = new Activity();
activity.id = new Uri ("http://rusticisoftware.github.io/TinCan.NET");
var statement = new Statement();
statement.actor = actor;
statement.verb = verb;
statement.target = activity;
StatementLRSResponse lrsResponse = lrs.SaveStatement(statement);
if (lrsResponse.success)
{
// Updated 'statement' here, now with id
Console.WriteLine("Save statement: " + lrsResponse.content.id);
}
else
{
// Do something with failure
}
특정 시간 이후로 10 개의 명령문을 가져 오는 쿼리
using System;
using TinCan;
using TinCan.LRSResponses;
var lrs = new RemoteLRS(
"https://cloud.scorm.com/tc/public/",
"username",
"password"
);
var query = new StatementsQuery();
query.since = DateTime.ParseExact("2013-08-29 07:42:10Z", "u", System.Globalization.CultureInfo.InvariantCulture);
query.limit = 10;
StatementsResultLRSResponse lrsResponse = lrs.QueryStatements(query);
if (lrsResponse.success)
{
// List of statements available
Console.WriteLine("Count of statements: " + lrsResponse.content.statements.Count);
}
else
{
// Do something with failure
}