/// <summary>
        /// Send the CSDL to DataSift for compilation.
        /// </summary>
        public void compile()
        {
            // We must have some CSDL in order to compile the CSDL!
            if (m_csdl.Length == 0)
            {
                throw new InvalidDataException("Cannot compile an empty definition");
            }

            try
            {
                Dictionary <string, string> parameters = new Dictionary <string, string>();
                parameters.Add("csdl", m_csdl);
                JSONdn res = m_user.callApi("compile", parameters);

                if (!res.has("hash"))
                {
                    throw new CompileFailedException("Compiled successfully but no hash in the response");
                }
                m_hash = res.getStringVal("hash");

                if (!res.has("created_at"))
                {
                    throw new CompileFailedException("Compiled successfully but no created_at in the response");
                }
                m_created_at = res.getDateTimeVal("created_at", "yyyy-MM-dd HH:mm:ss");

                if (!res.has("dpu"))
                {
                    throw new CompileFailedException("Compiled successfully but no DPU in the response");
                }
                m_total_dpu = res.getDoubleVal("dpu");
            }
            catch (ApiException e)
            {
                clearHash();
                if (e.Code == 400)
                {
                    throw new CompileFailedException(e.Message);
                }
                throw new CompileFailedException("Unexpected API response code: " + e.Code.ToString() + " " + e.Message);
            }
        }
Exemple #2
0
 /// <summary>
 /// Get the start date.
 /// </summary>
 /// <returns>A DateTime object.</returns>
 public DateTime getStartDate()
 {
     return(m_data.getDateTimeVal("start", "ddd, dd MMM yyyy HH:mm:ss zzz"));
 }