コード例 #1
0
 /// <summary>
 /// Constructor from a JSON object.
 /// </summary>
 /// <param name="json">The JSON object.</param>
 public PushLogEntry(JSONdn json)
     : this(json.getStringVal("subscription_id"), Utils.UnixTimestampToDateTime(json.getLongVal("request_time")), json.getBoolVal("success"), json.has("message") ? json.getStringVal("message") : "")
 {
 }
コード例 #2
0
 /// <summary>
 /// Constructor from a JSON object.
 /// </summary>
 /// <param name="json">The JSON object.</param>
 public PushLogEntry(JSONdn json)
     : this(json.getStringVal("subscription_id"), Utils.UnixTimestampToDateTime(json.getLongVal("request_time")), json.getBoolVal("success"), json.has("message") ? json.getStringVal("message") : "")
 {
 }
コード例 #3
0
        /// <summary>
        /// Extract data from a JSON object.
        /// </summary>
        /// <param name="json">The JSON object.</param>
        protected void init(JSONdn json)
        {
            if (!json.has("id"))
            {
                throw new InvalidDataException("No ID found");
            }
            m_id = json.getStringVal("id");

            if (!json.has("name"))
            {
                throw new InvalidDataException("No name found");
            }
            m_name = json.getStringVal("name");

            if (!json.has("created_at"))
            {
                throw new InvalidDataException("No created at date found");
            }
            m_created_at = Utils.UnixTimestampToDateTime(json.getLongVal("created_at"));

            if (!json.has("status"))
            {
                throw new InvalidDataException("No status found");
            }
            m_status = json.getStringVal("status");

            if (!json.has("hash_type"))
            {
                throw new InvalidDataException("No hash_type found");
            }
            m_hash_type = json.getStringVal("hash_type");

            if (!json.has("hash"))
            {
                throw new InvalidDataException("No hash found");
            }
            m_hash = json.getStringVal("hash");

            if (!json.has("last_request"))
            {
                throw new InvalidDataException("No last request date found");
            }
            try
            {
                m_last_request = Utils.UnixTimestampToDateTime(json.getLongVal("last_request"));
            }
            catch (Exception)
            {
                m_last_request = DateTime.MinValue;
            }

            if (!json.has("last_success"))
            {
                throw new InvalidDataException("No last success date found");
            }
            try
            {
                m_last_success = Utils.UnixTimestampToDateTime(json.getLongVal("last_success"));
            }
            catch (Exception)
            {
                m_last_success = DateTime.MinValue;
            }

            if (!json.has("output_type"))
            {
                throw new InvalidDataException("No output type found");
            }
            m_output_type = json.getStringVal("output_type");

            if (!json.has("id"))
            {
                throw new InvalidDataException("No ID found");
            }
            m_output_params.Clear();
            m_output_params.parse(new JSONdn(json.getJVal("output_params")));
        }
コード例 #4
0
        /// <summary>
        /// Extract data from a JSON object.
        /// </summary>
        /// <param name="json">The JSON object.</param>
        protected void init(JSONdn json)
        {
            if (!json.has("id"))
            {
                throw new InvalidDataException("No ID found");
            }
            m_id = json.getStringVal("id");

            if (!json.has("name"))
            {
                throw new InvalidDataException("No name found");
            }
            m_name = json.getStringVal("name");

            if (!json.has("created_at"))
            {
                throw new InvalidDataException("No created at date found");
            }
            m_created_at = Utils.UnixTimestampToDateTime(json.getLongVal("created_at"));

            if (!json.has("status"))
            {
                throw new InvalidDataException("No status found");
            }
            m_status = json.getStringVal("status");

            if (!json.has("hash_type"))
            {
                throw new InvalidDataException("No hash_type found");
            }
            m_hash_type = json.getStringVal("hash_type");

            if (!json.has("hash"))
            {
                throw new InvalidDataException("No hash found");
            }
            m_hash = json.getStringVal("hash");

            if (!json.has("last_request"))
            {
                throw new InvalidDataException("No last request date found");
            }
            try
            {
                m_last_request = Utils.UnixTimestampToDateTime(json.getLongVal("last_request"));
            }
            catch (Exception)
            {
                m_last_request = DateTime.MinValue;
            }

            if (!json.has("last_success"))
            {
                throw new InvalidDataException("No last success date found");
            }
            try
            {
                m_last_success = Utils.UnixTimestampToDateTime(json.getLongVal("last_success"));
            }
            catch (Exception)
            {
                m_last_success = DateTime.MinValue;
            }

            if (!json.has("output_type"))
            {
                throw new InvalidDataException("No output type found");
            }
            m_output_type = json.getStringVal("output_type");

            if (!json.has("id"))
            {
                throw new InvalidDataException("No ID found");
            }
            m_output_params.Clear();
            m_output_params.parse(new JSONdn(json.getJVal("output_params")));
        }