Ejemplo n.º 1
0
        public Statement(JObject jobj) : base(jobj) {
            if (jobj["id"] != null)
            {
                id = new Guid(jobj.Value<String>("id"));
            }
            if (jobj["stored"] != null)
            {
                stored = jobj.Value<DateTime>("stored");
            }
            if (jobj["authority"] != null)
            {
                authority = (Agent)jobj.Value<JObject>("authority");
            }
            if (jobj["version"] != null)
            {
                version = (TCAPIVersion)jobj.Value<String>("version");
            }

            //
            // handle SubStatement as target which isn't provided by StatementBase
            // because SubStatements are not allowed to nest
            //
            if (jobj["object"] != null && (String)jobj["object"]["objectType"] == SubStatement.OBJECT_TYPE)
            {
                target = (SubStatement)jobj.Value<JObject>("object");
            }
        }
Ejemplo n.º 2
0
        public override JObject ToJObject(TCAPIVersion version) {
            var result = base.ToJObject(version);

            result.Add("objectType", ObjectType);

            return result;
        }
Ejemplo n.º 3
0
        public override JObject ToJObject(TCAPIVersion version)
        {
            JObject result = new JObject();

            if (type != null)
            {
                result.Add("type", type.ToString());
            }
            if (moreInfo != null)
            {
                result.Add("moreInfo", moreInfo.ToString());
            }
            if (name != null && !name.isEmpty())
            {
                result.Add("name", name.ToJObject(version));
            }
            if (description != null && !description.isEmpty())
            {
                result.Add("description", description.ToJObject(version));
            }
            if (extensions != null && !extensions.isEmpty())
            {
                result.Add("extensions", extensions.ToJObject(version));
            }

            return(result);
        }
Ejemplo n.º 4
0
        public override JObject ToJObject(TCAPIVersion version)
        {
            JObject result = new JObject();
            result.Add("objectType", ObjectType);

            if (name != null)
            {
                result.Add("name", name);
            }

            if (account != null)
            {
                result.Add("account", account.ToJObject(version));
            }
            else if (mbox != null)
            {
                result.Add("mbox", mbox);
            }
            else if (mbox_sha1sum != null)
            {
                result.Add("mbox_sha1sum", mbox_sha1sum);
            }
            else if (openid != null)
            {
                result.Add("openid", openid);
            }

            return result;
        }
Ejemplo n.º 5
0
        public override JObject ToJObject(TCAPIVersion version)
        {
            var result = base.ToJObject(version);

            if (id != null)
            {
                result.Add("id", id.ToString());
            }
            if (stored != null)
            {
                result.Add("stored", stored.Value.ToString(ISODateTimeFormat));
            }
            if (authority != null)
            {
                result.Add("authority", authority.ToJObject(version));
            }
            if (version != null)
            {
                result.Add("version", version.ToString());
            }

            // CAW 3/32/2021
            if (attachments != null && attachments.Count > 0)
            {
                var jattachments = new JArray();
                result.Add("attachments", jattachments);
                foreach (var attachment in attachments)
                {
                    jattachments.Add(attachment.ToJObject(version));
                }
            }

            return(result);
        }
Ejemplo n.º 6
0
        public override JObject ToJObject(TCAPIVersion version)
        {
            var result = new JObject();

            if (completion != null)
            {
                result.Add("completion", completion);
            }
            if (success != null)
            {
                result.Add("success", success);
            }
            if (response != null)
            {
                result.Add("response", response);
            }
            if (duration != null)
            {
                result.Add("duration", XmlConvert.ToString((TimeSpan)duration));
            }
            if (score != null)
            {
                result.Add("score", score.ToJObject(version));
            }
            if (extensions != null)
            {
                result.Add("extensions", extensions.ToJObject(version));
            }

            return(result);
        }
Ejemplo n.º 7
0
        public override JObject ToJObject(TCAPIVersion version)
        {
            var result_ = new JObject();

            if (actor != null)
            {
                result_.Add("actor", actor.ToJObject(version));
            }

            if (verb != null)
            {
                result_.Add("verb", verb.ToJObject(version));
            }

            if (target != null)
            {
                result_.Add("object", target.ToJObject(version));
            }
            if (this.result != null)
            {
                result_.Add("result", this.result.ToJObject(version));
            }
            if (this.context != null)
            {
                result_.Add("context", context.ToJObject(version));
            }
            if (timestamp != null)
            {
                result_.Add("timestamp", timestamp.Value.ToString(ISODateTimeFormat));
            }

            return(result_);
        }
Ejemplo n.º 8
0
        public override JObject ToJObject(TCAPIVersion version)
        {
            var result = new JObject();

            if (Actor != null)
            {
                result.Add("actor", Actor.ToJObject(version));
            }

            if (Verb != null)
            {
                result.Add("verb", Verb.ToJObject(version));
            }

            if (Target != null)
            {
                result.Add("object", Target.ToJObject(version));
            }
            if (Result != null)
            {
                result.Add("result", Result.ToJObject(version));
            }
            if (Context != null)
            {
                result.Add("context", Context.ToJObject(version));
            }
            if (Timestamp != null)
            {
                result.Add("timestamp", Timestamp.Value.ToString(IsoDateTimeFormat));
            }

            return(result);
        }
Ejemplo n.º 9
0
        public override JObject ToJObject(TCAPIVersion version) {
            JObject result = new JObject();

            if (type != null)
            {
                result.Add("type", type.ToString());
            }
            if (moreInfo != null)
            {
                result.Add("moreInfo", moreInfo.ToString());
            }
            if (name != null && ! name.isEmpty())
            {
                result.Add("name", name.ToJObject(version));
            }
            if (description != null && ! description.isEmpty())
            {
                result.Add("description", description.ToJObject(version));
            }
            if (extensions != null && ! extensions.isEmpty())
            {
                result.Add("extensions", extensions.ToJObject(version));
            }

            return result;
        }
Ejemplo n.º 10
0
        /// <summary>
        /// To the j object.
        /// </summary>
        /// <param name="version">The version.</param>
        /// <returns>JObject.</returns>
        public override JObject ToJObject(TCAPIVersion version)
        {
            var result = new JObject();

            if (Completion != null)
            {
                result.Add("completion", Completion);
            }
            if (Success != null)
            {
                result.Add("success", Success);
            }
            if (Response != null)
            {
                result.Add("response", Response);
            }
            if (Duration != null)
            {
                result.Add("duration", ((TimeSpan)Duration).ToString());
            }
            if (Score != null)
            {
                result.Add("score", Score.ToJObject(version));
            }
            if (Extensions != null)
            {
                result.Add("extensions", Extensions.ToJObject(version));
            }

            return(result);
        }
Ejemplo n.º 11
0
        public override JObject ToJObject(TCAPIVersion version) {
            JObject result = new JObject();

            if (completion != null)
            {
                result.Add("completion", completion);
            }
            if (success != null)
            {
                result.Add("success", success);
            }
            if (response != null)
            {
                result.Add("response", response);
            }
            if (duration != null)
            {
                result.Add("duration", XmlConvert.ToString(duration));
            }
            if (score != null)
            {
                result.Add("score", score.ToJObject(version));
            }
            if (extensions != null)
            {
                result.Add("extensions", extensions.ToJObject(version));
            }

            return result;
        }
Ejemplo n.º 12
0
        public Statement(JObject jobj) : base(jobj)
        {
            if (jobj["id"] != null)
            {
                id = new Guid(jobj.Value <String>("id"));
            }
            if (jobj["stored"] != null)
            {
                stored = jobj.Value <DateTime>("stored");
            }
            if (jobj["authority"] != null)
            {
                authority = (Agent)jobj.Value <JObject>("authority");
            }
            if (jobj["version"] != null)
            {
                version = (TCAPIVersion)jobj.Value <String>("version");
            }

            //
            // handle SubStatement as target which isn't provided by StatementBase
            // because SubStatements are not allowed to nest
            //
            if (jobj["object"] != null && (String)jobj["object"]["objectType"] == SubStatement.OBJECT_TYPE)
            {
                target = (SubStatement)jobj.Value <JObject>("object");
            }
        }
Ejemplo n.º 13
0
        public override JObject ToJObject(TCAPIVersion version)
        {
            var result = new JObject();

            result.Add("objectType", ObjectType);

            if (name != null)
            {
                result.Add("name", name);
            }

            if (account != null)
            {
                result.Add("account", account.ToJObject(version));
            }
            else if (mbox != null)
            {
                result.Add("mbox", mbox);
            }
            else if (mbox_sha1sum != null)
            {
                result.Add("mbox_sha1sum", mbox_sha1sum);
            }
            else if (openid != null)
            {
                result.Add("openid", openid);
            }

            return(result);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// To the j object.
        /// </summary>
        /// <param name="version">The version.</param>
        /// <returns>JObject.</returns>
        public override JObject ToJObject(TCAPIVersion version)
        {
            var result = new JObject {
                { "objectType", ObjectType }
            };

            if (Name != null)
            {
                result.Add("name", Name);
            }

            if (Account != null)
            {
                result.Add("account", Account.ToJObject(version));
            }
            else if (Mbox != null)
            {
                result.Add("mbox", Mbox);
            }
            else if (Mbox_Sha1Sum != null)
            {
                result.Add("Mbox_Sha1Sum", Mbox_Sha1Sum);
            }
            else if (Openid != null)
            {
                result.Add("openid", Openid);
            }

            return(result);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// To the j object.
        /// </summary>
        /// <param name="version">The version.</param>
        /// <returns>JObject.</returns>
        public override JObject ToJObject(TCAPIVersion version)
        {
            var result = new JObject();

            if (Type != null)
            {
                result.Add("type", Type.ToString());
            }
            if (MoreInfo != null)
            {
                result.Add("moreInfo", MoreInfo.ToString());
            }
            if (Name != null && !Name.IsEmpty())
            {
                result.Add("name", Name.ToJObject(version));
            }
            if (Description != null && !Description.IsEmpty())
            {
                result.Add("description", Description.ToJObject(version));
            }
            if (Extensions != null && !Extensions.IsEmpty())
            {
                result.Add("extensions", Extensions.ToJObject(version));
            }

            return(result);
        }
Ejemplo n.º 16
0
        public override JObject ToJObject(TCAPIVersion version)
        {
            JObject result = new JObject();

            if (completion != null)
            {
                result.Add("completion", completion);
            }
            if (success != null)
            {
                result.Add("success", success);
            }
            if (response != null)
            {
                result.Add("response", response);
            }
            if (duration != null)
            {
                // NOTE: GBLxAPI is only supporting PT###.##S (the .## included if not .00) format and not expanded ISO8601 durations e.g. XmlConvert.ToString((TimeSpan)duration));
                result.Add("duration", "PT" + ((TimeSpan)duration).TotalSeconds.ToString("0.##") + "S");
            }
            if (score != null)
            {
                result.Add("score", score.ToJObject(version));
            }
            if (extensions != null)
            {
                result.Add("extensions", extensions.ToJObject(version));
            }

            return(result);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// To the j object.
        /// </summary>
        /// <param name="version">The version.</param>
        /// <returns>JObject.</returns>
        public override JObject ToJObject(TCAPIVersion version)
        {
            var result = base.ToJObject(version);

            result.Add("objectType", ObjectType);

            return(result);
        }
Ejemplo n.º 18
0
        public Dictionary <string, string> ToParameterMap(TCAPIVersion version)
        {
            var result = new Dictionary <string, string>();

            if (agent != null)
            {
                result.Add("agent", agent.ToJSON(version));
            }
            if (verbId != null)
            {
                result.Add("verb", verbId.ToString());
            }
            if (activityId != null)
            {
                result.Add("activity", activityId);
            }
            if (registration != null)
            {
                result.Add("registration", registration.Value.ToString());
            }
            if (relatedActivities != null)
            {
                result.Add("related_activities", relatedActivities.Value.ToString());
            }
            if (relatedAgents != null)
            {
                result.Add("related_agents", relatedAgents.Value.ToString());
            }
            if (since != null)
            {
                result.Add("since", since.Value.ToString(ISODateTimeFormat));
            }
            if (until != null)
            {
                result.Add("until", until.Value.ToString(ISODateTimeFormat));
            }
            if (limit != null)
            {
                result.Add("limit", limit.ToString());
            }
            if (format != null)
            {
                result.Add("format", format.ToString());
            }
            if (ascending != null)
            {
                result.Add("ascending", ascending.Value.ToString());
            }

            // CAW 3/26/2021
            if (!string.IsNullOrWhiteSpace(statementId))
            {
                result.Add("statementId", statementId);
            }

            return(result);
        }
Ejemplo n.º 19
0
        public override JObject ToJObject(TCAPIVersion version)
        {
            JObject result = new JObject();
            foreach (KeyValuePair<String, String> entry in this.map)
            {
                result.Add(entry.Key, entry.Value);
            }

            return result;
        }
Ejemplo n.º 20
0
        public override JObject ToJObject(TCAPIVersion version)
        {
            JObject result = new JObject();
            foreach (KeyValuePair<Uri, JToken> entry in map)
            {
                result.Add(entry.Key.ToString(), entry.Value);
            }

            return result;
        }
Ejemplo n.º 21
0
        public override JObject ToJObject(TCAPIVersion version)
        {
            var result = new JObject();

            foreach (var entry in map)
            {
                result.Add(entry.Key.ToString(), entry.Value);
            }

            return(result);
        }
Ejemplo n.º 22
0
        public override JObject ToJObject(TCAPIVersion version)
        {
            JObject result = new JObject();

            foreach (KeyValuePair <Uri, JToken> entry in map)
            {
                result.Add(entry.Key.ToString(), entry.Value);
            }

            return(result);
        }
Ejemplo n.º 23
0
        public override JObject ToJObject(TCAPIVersion version) {
            JObject result = new JObject();
            result.Add("objectType", ObjectType);

            if (id != null)
            {
                result.Add("id", id.ToString());
            }

            return result;
        }
Ejemplo n.º 24
0
        public override JObject ToJObject(TCAPIVersion version)
        {
            JObject result = new JObject();

            foreach (KeyValuePair <String, String> entry in this.map)
            {
                result.Add(entry.Key, entry.Value);
            }

            return(result);
        }
Ejemplo n.º 25
0
        // ------------------------------------------------------------------------
        // ------------------------------------------------------------------------
        public void initLRS(String endpoint, String username, String password)
        {
            this.endpoint = endpoint;
            // endpoint should have trailing /
            if (this.endpoint[this.endpoint.Length - 1] != '/')
            {
                this.endpoint += "/";
            }
            this.version = TCAPIVersion.latest();
            this.auth    = "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(username + ":" + password));

            this.initState();
        }
Ejemplo n.º 26
0
        /// <summary>
        /// To the j object.
        /// </summary>
        /// <param name="version">The version.</param>
        /// <returns>JObject.</returns>
        public override JObject ToJObject(TCAPIVersion version)
        {
            var result = new JObject {
                { "objectType", ObjectType }
            };

            if (ID != null)
            {
                result.Add("id", ID.ToString());
            }

            return(result);
        }
Ejemplo n.º 27
0
        public override JObject ToJObject(TCAPIVersion version)
        {
            var result = new JObject();

            result.Add("objectType", ObjectType);

            if (id != null)
            {
                result.Add("id", id.ToString());
            }

            return(result);
        }
Ejemplo n.º 28
0
        public Dictionary<String, String> ToParameterMap (TCAPIVersion version)
        {
            var result = new Dictionary<String, String>();

            if (agent != null)
            {
                result.Add("agent", agent.ToJSON(version));
            }
            if (verbId != null)
            {
                result.Add("verb", verbId.ToString());
            }
            if (activityId != null)
            {
                result.Add("activity", activityId);
            }
            if (registration != null)
            {
                result.Add("registration", registration.Value.ToString());
            }
            if (relatedActivities != null)
            {
                result.Add("related_activities", relatedActivities.Value.ToString());
            }
            if (relatedAgents != null)
            {
                result.Add("related_agents", relatedAgents.Value.ToString());
            }
            if (since != null)
            {
                result.Add("since", since.Value.ToString(ISODateTimeFormat));
            }
            if (until != null)
            {
                result.Add("until", until.Value.ToString(ISODateTimeFormat));
            }
            if (limit != null)
            {
                result.Add("limit", limit.ToString());
            }
            if (format != null)
            {
                result.Add("format", format.ToString());
            }
            if (ascending != null)
            {
                result.Add("ascending", ascending.Value.ToString());
            }

            return result;
        }
Ejemplo n.º 29
0
        /// <summary>
        /// To the parameter map.
        /// </summary>
        /// <param name="version">The version.</param>
        /// <returns>Dictionary&lt;System.String, System.String&gt;.</returns>
        public Dictionary <string, string> ToParameterMap(TCAPIVersion version)
        {
            var result = new Dictionary <string, string>();

            if (Agent != null)
            {
                result.Add("agent", Agent.ToJSON(version));
            }
            if (VerbId != null)
            {
                result.Add("verb", VerbId.ToString());
            }
            if (ActivityId != null)
            {
                result.Add("activity", ActivityId);
            }
            if (Registration != null)
            {
                result.Add("registration", Registration.Value.ToString());
            }
            if (RelatedActivities != null)
            {
                result.Add("related_activities", RelatedActivities.Value.ToString());
            }
            if (RelatedAgents != null)
            {
                result.Add("related_agents", RelatedAgents.Value.ToString());
            }
            if (Since != null)
            {
                result.Add("since", Since.Value.ToString(ISO_DATE_TIME_FORMAT));
            }
            if (Until != null)
            {
                result.Add("until", Until.Value.ToString(ISO_DATE_TIME_FORMAT));
            }
            if (Limit != null)
            {
                result.Add("limit", Limit.ToString());
            }
            if (Format != null)
            {
                result.Add("format", Format.ToString());
            }
            if (Ascending != null)
            {
                result.Add("ascending", Ascending.Value.ToString());
            }

            return(result);
        }
Ejemplo n.º 30
0
        public override JObject ToJObject(TCAPIVersion version) {
            JObject result = new JObject();
            if (id != null)
            {
                result.Add("id", id.ToString());
            }

            if (display != null && ! display.isEmpty())
            {
                result.Add("display", display.ToJObject(version));
            }

            return result;
        }
Ejemplo n.º 31
0
        public override JObject ToJObject(TCAPIVersion version)
        {
            JObject result = new JObject();
            if (homePage != null)
            {
                result.Add("homePage", homePage.ToString());
            }
            if (name != null)
            {
                result.Add("name", name);
            }

            return result;
        }
        public override JObject ToJObject(TCAPIVersion version) {
            JObject result = new JObject();

            if (id != null)
            {
                result.Add("id", id);
            }
            if (description != null && !description.isEmpty())
            {
                result.Add("description", description.ToJObject(version));
            }

            return result;
        }
Ejemplo n.º 33
0
        public override JObject ToJObject(TCAPIVersion version)
        {
            var result = new JObject();

            if (Id != null)
            {
                result.Add("id", Id);
            }
            if (Description != null && !Description.IsEmpty())
            {
                result.Add("description", Description.ToJObject(version));
            }

            return(result);
        }
Ejemplo n.º 34
0
        public override JObject ToJObject(TCAPIVersion version)
        {
            JObject result = new JObject();

            if (id != null)
            {
                result.Add("id", id);
            }
            if (description != null && !description.isEmpty())
            {
                result.Add("description", description.ToJObject(version));
            }

            return(result);
        }
Ejemplo n.º 35
0
        public override JObject ToJObject(TCAPIVersion version)
        {
            var result = new JObject();

            if (homePage != null)
            {
                result.Add("homePage", homePage.ToString());
            }
            if (name != null)
            {
                result.Add("name", name);
            }

            return(result);
        }
Ejemplo n.º 36
0
        public override JObject ToJObject(TCAPIVersion version)
        {
            JObject result = new JObject();

            if (this.id != null)
            {
                result.Add("id", this.id);
            }
            if (this.description != null && !this.description.isEmpty())
            {
                result.Add("description", this.description.ToJObject(version));                 // should be a language map
            }

            return(result);
        }
Ejemplo n.º 37
0
        public override JObject ToJObject(TCAPIVersion version)
        {
            var result = new JObject();

            if (Id != null)
            {
                result.Add("id", Id.ToString());
            }

            if (Display != null && !Display.IsEmpty())
            {
                result.Add("display", Display.ToJObject(version));
            }

            return(result);
        }
Ejemplo n.º 38
0
        public override JObject ToJObject(TCAPIVersion version)
        {
            JObject result = new JObject();

            if (id != null)
            {
                result.Add("id", id.ToString());
            }

            if (display != null && !display.isEmpty())
            {
                result.Add("display", display.ToJObject(version));
            }

            return(result);
        }
Ejemplo n.º 39
0
        public override JObject ToJObject(TCAPIVersion version)
        {
            JObject result = new JObject();
            result.Add("objectType", ObjectType);

            if (id != null)
            {
                result.Add("id", id);
            }
            if (definition != null)
            {
                result.Add("definition", definition.ToJObject(version));
            }

            return result;
        }
Ejemplo n.º 40
0
        public override JObject ToJObject(TCAPIVersion version)
        {
            JObject result = base.ToJObject(version);
            if (member != null && member.Count > 0)
            {
                var jmember = new JArray();
                result.Add("member", jmember);

                foreach (Agent agent in member)
                {
                    jmember.Add(agent.ToJObject(version));
                }
            }

            return result;
        }
Ejemplo n.º 41
0
        /// <summary>
        /// To the j object.
        /// </summary>
        /// <param name="version">The version.</param>
        /// <returns>JObject.</returns>
        public override JObject ToJObject(TCAPIVersion version)
        {
            var result = new JObject();

            if (Parent != null && Parent.Count > 0)
            {
                var jparent = new JArray();
                result.Add("parent", jparent);

                foreach (var activity in Parent)
                {
                    jparent.Add(activity.ToJObject(version));
                }
            }
            if (Grouping != null && Grouping.Count > 0)
            {
                var jgrouping = new JArray();
                result.Add("grouping", jgrouping);

                foreach (var activity in Grouping)
                {
                    jgrouping.Add(activity.ToJObject(version));
                }
            }
            if (Category != null && Category.Count > 0)
            {
                var jcategory = new JArray();
                result.Add("category", jcategory);

                foreach (var activity in Category)
                {
                    jcategory.Add(activity.ToJObject(version));
                }
            }
            if (Other != null && Other.Count > 0)
            {
                var jother = new JArray();
                result.Add("other", jother);

                foreach (var activity in Other)
                {
                    jother.Add(activity.ToJObject(version));
                }
            }

            return(result);
        }
Ejemplo n.º 42
0
        public override JObject ToJObject(TCAPIVersion version)
        {
            JObject result = new JObject();

            if (parent != null && parent.Count > 0)
            {
                var jparent = new JArray();
                result.Add("parent", jparent);

                foreach (Activity activity in parent)
                {
                    jparent.Add(activity.ToJObject(version));
                }
            }
            if (grouping != null && grouping.Count > 0)
            {
                var jgrouping = new JArray();
                result.Add("grouping", jgrouping);

                foreach (Activity activity in grouping)
                {
                    jgrouping.Add(activity.ToJObject(version));
                }
            }
            if (category != null && category.Count > 0)
            {
                var jcategory = new JArray();
                result.Add("category", jcategory);

                foreach (Activity activity in category)
                {
                    jcategory.Add(activity.ToJObject(version));
                }
            }
            if (other != null && other.Count > 0)
            {
                var jother = new JArray();
                result.Add("other", jother);

                foreach (Activity activity in other)
                {
                    jother.Add(activity.ToJObject(version));
                }
            }

            return(result);
        }
Ejemplo n.º 43
0
        public override JObject ToJObject(TCAPIVersion version) {
            JObject result = new JObject();

            if (parent != null && parent.Count > 0)
            {
                var jparent = new JArray();
                result.Add("parent", jparent);

                foreach (Activity activity in parent)
                {
                    jparent.Add(activity.ToJObject(version));
                }
            }
            if (grouping != null && grouping.Count > 0)
            {
                var jgrouping = new JArray();
                result.Add("grouping", jgrouping);

                foreach (Activity activity in grouping)
                {
                    jgrouping.Add(activity.ToJObject(version));
                }
            }
            if (category != null && category.Count > 0)
            {
                var jcategory = new JArray();
                result.Add("category", jcategory);

                foreach (Activity activity in category)
                {
                    jcategory.Add(activity.ToJObject(version));
                }
            }
            if (other != null && other.Count > 0)
            {
                var jother = new JArray();
                result.Add("other", jother);

                foreach (Activity activity in other)
                {
                    jother.Add(activity.ToJObject(version));
                }
            }

            return result;
        }
Ejemplo n.º 44
0
        public override JObject ToJObject(TCAPIVersion version)
        {
            JObject result = new JObject();

            result.Add("objectType", ObjectType);

            if (id != null)
            {
                result.Add("id", id.ToString());
            }
            if (definition != null)
            {
                result.Add("definition", definition.ToJObject(version));
            }

            return(result);
        }
Ejemplo n.º 45
0
        public override JObject ToJObject(TCAPIVersion version)
        {
            var result = base.ToJObject(version);

            if (Member != null && Member.Count > 0)
            {
                var jmember = new JArray();
                result.Add("member", jmember);

                foreach (var agent in Member)
                {
                    jmember.Add(agent.ToJObject(version));
                }
            }

            return(result);
        }
Ejemplo n.º 46
0
 public Statement(JObject jobj) : base(jobj) {
     if (jobj["id"] != null)
     {
         id = new Guid(jobj.Value<String>("id"));
     }
     if (jobj["stored"] != null)
     {
         stored = jobj.Value<DateTime>("stored");
     }
     if (jobj["authority"] != null)
     {
         authority = (Agent)jobj.Value<JObject>("authority");
     }
     if (jobj["version"] != null)
     {
         version = (TCAPIVersion)jobj.Value<String>("version");
     }
 }
Ejemplo n.º 47
0
        public override JObject ToJObject(TCAPIVersion version) {
            JObject result = new JObject();
            if (this.version != null)
            {
                var versions = new JArray();
                foreach (var v in this.version) {
                    versions.Add(v.ToString());
                }
                result.Add("version", versions);
            }

            if (extensions != null && ! extensions.isEmpty())
            {
                result.Add("extensions", extensions.ToJObject(version));
            }

            return result;
        }
Ejemplo n.º 48
0
        public override JObject ToJObject(TCAPIVersion version) {
            JObject result = new JObject();

            if (registration != null)
            {
                result.Add("registration", registration.ToString());
            }
            if (instructor != null)
            {
                result.Add("instructor", instructor.ToJObject(version));
            }
            if (team != null)
            {
                result.Add("team", team.ToJObject(version));
            }
            if (contextActivities != null)
            {
                result.Add("contextActivities", contextActivities.ToJObject(version));
            }
            if (revision != null)
            {
                result.Add("revision", revision);
            }
            if (platform != null)
            {
                result.Add("platform", platform);
            }
            if (language != null)
            {
                result.Add("language", language);
            }
            if (statement != null)
            {
                result.Add("statement", statement.ToJObject(version));
            }
            if (extensions != null)
            {
                result.Add("extensions", extensions.ToJObject(version));
            }

            return result;
        }
Ejemplo n.º 49
0
        public override JObject ToJObject(TCAPIVersion version) {
            JObject result = new JObject();

            if (scaled != null)
            {
                result.Add("scaled", scaled);
            }
            if (raw != null)
            {
                result.Add("raw", raw);
            }
            if (min != null)
            {
                result.Add("min", min);
            }
            if (max != null)
            {
                result.Add("max", max);
            }

            return result;
        }
Ejemplo n.º 50
0
        public override JObject ToJObject(TCAPIVersion version)
        {
            JObject result = base.ToJObject(version);

            if (id != null)
            {
                result.Add("id", id.ToString());
            }
            if (stored != null)
            {
                result.Add("stored", stored.Value.ToString(ISODateTimeFormat));
            }
            if (authority != null)
            {
                result.Add("authority", authority.ToJObject(version));
            }
            if (version != null)
            {
                result.Add("version", version.ToString());
            }

            return result;
        }
Ejemplo n.º 51
0
        public override JObject ToJObject(TCAPIVersion version)
        {
            JObject result = new JObject();

            if (actor != null)
            {
                result.Add("actor", actor.ToJObject(version));
            }

            if (verb != null)
            {
                result.Add("verb", verb.ToJObject(version));
            }

            if (target != null)
            {
                result.Add("object", target.ToJObject(version));
            }
            if (this.result != null)
            {
                result.Add("result", this.result.ToJObject(version));
            }
            if (this.context != null)
            {
                result.Add("context", context.ToJObject(version));
            }
            if (timestamp != null)
            {
                result.Add("timestamp", timestamp.Value.ToString(ISODateTimeFormat));
            }

            return result;
        }
Ejemplo n.º 52
0
 public RemoteLRS(String endpoint, TCAPIVersion version, String username, String password) : this(new Uri(endpoint), version, username, password) { }
Ejemplo n.º 53
0
 public RemoteLRS(Uri endpoint, TCAPIVersion version, String username, String password)
 {
     this.endpoint = endpoint;
     this.version = version;
     this.SetAuth(username, password);
 }
Ejemplo n.º 54
0
        public override JObject ToJObject(TCAPIVersion version) {
            JObject result = new JObject();
           
            if (type != null)
            {
                result.Add("type", type.ToString());
            }
            if (moreInfo != null)
            {
                result.Add("moreInfo", moreInfo.ToString());
            }
            if (name != null && ! name.isEmpty())
            {
                result.Add("name", name.ToJObject(version));
            }
            if (description != null && ! description.isEmpty())
            {
                result.Add("description", description.ToJObject(version));
            }
            if (extensions != null && ! extensions.isEmpty())
            {
                result.Add("extensions", extensions.ToJObject(version));
            }
            if (interactionType != null)
            {
                result.Add("interactionType", interactionType.Value);
            }
            if (correctResponsesPattern != null && correctResponsesPattern.Count > 0)
            {
                result.Add("correctResponsesPattern", JToken.FromObject(correctResponsesPattern));
            }
            if (choices != null && choices.Count > 0)
            {
                var jchoices = new JArray();
                result.Add("choices", jchoices);

                foreach (InteractionComponent ichoice in choices)
                {
                    jchoices.Add(ichoice.ToJObject(version));
                }
            }
            if (scale != null && scale.Count > 0)
            {
                var jscale = new JArray();
                result.Add("scale", jscale);

                foreach (InteractionComponent iscale in scale)
                {
                    jscale.Add(iscale.ToJObject(version));
                }
            }
            if (source != null && source.Count > 0)
            {
                var jsource = new JArray();
                result.Add("source", jsource);

                foreach (InteractionComponent isource in source)
                {
                    jsource.Add(isource.ToJObject(version));
                }
            }
            if (target != null && target.Count > 0)
            {
                var jtarget = new JArray();
                result.Add("target", jtarget);

                foreach (InteractionComponent itarget in target)
                {
                    jtarget.Add(itarget.ToJObject(version));
                }
            }
            if (steps != null && steps.Count > 0)
            {
                var jsteps = new JArray();
                result.Add("steps", jsteps);

                foreach (InteractionComponent istep in steps)
                {
                    jsteps.Add(istep.ToJObject(version));
                }
            }

            return result;
        }