From 3ec3db9c4766f1b5d54833c6057de5e2a31f1ea1 Mon Sep 17 00:00:00 2001 From: Eric Busch Date: Mon, 11 Apr 2022 11:46:19 -0500 Subject: [PATCH 1/2] Added Session IDs --- .../TinCanStatementBuilder.cs | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/Float.TinCan.ActivityLibrary/TinCanStatementBuilder.cs b/Float.TinCan.ActivityLibrary/TinCanStatementBuilder.cs index d31c25e..ca9f9e8 100644 --- a/Float.TinCan.ActivityLibrary/TinCanStatementBuilder.cs +++ b/Float.TinCan.ActivityLibrary/TinCanStatementBuilder.cs @@ -33,6 +33,19 @@ public class TinCanStatementBuilder /// Verb verb; + /// + /// The timestamp for the statement to be built. Optional. + /// + DateTime timestamp; + + /// + /// Gets the session ID for the statement to be build. Optional. + /// + /// + /// The session ID for the statement to be build. Optional. + /// + public Guid SessionId => context.registration.Value; + /// /// Sets the name of the agent for the generated statement. /// @@ -280,6 +293,23 @@ public TinCanStatementBuilder SetVerb(Verb verb) return this; } + + context.registration = guid; + + return this; + } + + /// + /// Sets the timestamp. + /// + /// The timestamp to use. + /// This object, useful for chaining. + public TinCanStatementBuilder SetTimestamp(DateTime timestamp) + { + this.timestamp = timestamp; + return this; + } + /// /// Build a statement using the parameters given so far. /// @@ -303,8 +333,14 @@ public Statement Build() statement.target = activity; } + if (timestamp != null) + { + statement.timestamp = timestamp; + } + statement.context = context; statement.verb = verb; + statement.Stamp(); return statement; From cd8f423493f452f7f96434be2aa8b231f4d0b06f Mon Sep 17 00:00:00 2001 From: Eric Busch Date: Mon, 11 Apr 2022 11:54:54 -0500 Subject: [PATCH 2/2] Add the SetSessionID method --- .../TinCanStatementBuilder.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Float.TinCan.ActivityLibrary/TinCanStatementBuilder.cs b/Float.TinCan.ActivityLibrary/TinCanStatementBuilder.cs index ca9f9e8..22351a0 100644 --- a/Float.TinCan.ActivityLibrary/TinCanStatementBuilder.cs +++ b/Float.TinCan.ActivityLibrary/TinCanStatementBuilder.cs @@ -293,6 +293,17 @@ public TinCanStatementBuilder SetVerb(Verb verb) return this; } + /// + /// Sets the session ID. + /// + /// This object, useful for chaining. + /// The session ID GUID. + public TinCanStatementBuilder SetSessionId(Guid guid) + { + if (context == null) + { + context = new Context(); + } context.registration = guid;