EduTech & AI 인공지능 & IT관련 소식

xAPI 샘플코드 본문

Tech./xAPI

xAPI 샘플코드

Edu&Tech 2017. 12. 21. 13:02


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:info@tincanapi.com";

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
}


'Tech. > xAPI' 카테고리의 다른 글

xAPI - Yetanalytics 활용 사례  (0) 2018.02.12
xAPI Profiles 이란?  (0) 2018.02.02
xAPI를 지원하는 LMS  (0) 2017.12.21
xAP개발자 개요  (0) 2017.12.21
xAPI란?  (0) 2017.12.21
Comments