diff --git a/Float.TinCan.ActivityLibrary/TinCanStatementBuilder.cs b/Float.TinCan.ActivityLibrary/TinCanStatementBuilder.cs index d31c25e..22351a0 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,34 @@ 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; + + 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 +344,14 @@ public Statement Build() statement.target = activity; } + if (timestamp != null) + { + statement.timestamp = timestamp; + } + statement.context = context; statement.verb = verb; + statement.Stamp(); return statement;