示例#1
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);
        }
示例#2
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);
        }
示例#3
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 (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(ISO_DATE_TIME_FORMAT));
            }

            return(result);
        }
示例#4
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);
        }
示例#5
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);
        }
示例#6
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();

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

            return(result);
        }
示例#7
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);
        }
        /// <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);
        }
示例#9
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 (HomePage != null)
            {
                result.Add("homePage", HomePage.ToString());
            }
            if (Name != null)
            {
                result.Add("name", Name);
            }

            return(result);
        }
示例#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 (ID != null)
            {
                result.Add("id", ID.ToString());
            }

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

            return(result);
        }
        /// <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);
        }
示例#12
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);

            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);
        }
示例#13
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);
            }
            if (Definition != null)
            {
                result.Add("definition", Definition.ToJObject(version));
            }

            return(result);
        }
示例#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();

            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);
        }
示例#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 (Version != null)
            {
                var versions = new JArray();
                foreach (var v in Version)
                {
                    versions.Add(v.ToString());
                }
                result.Add("version", versions);
            }

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

            return(result);
        }
示例#16
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);

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

            return(result);
        }
示例#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 = 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);
        }