Ejemplo n.º 1
0
        /// <summary>
        /// Retrieve data as CSV string
        /// </summary>
        /// <param name="connection"></param>
        /// <param name="metadata"></param>
        /// <returns></returns>
        public static string TableDataRetriever(DSTConnection connection, TableMetadata metadata)
        {
            string data     = "";
            var    response = connection.RetrieveTableData(metadata);

            if (response.StatusCode == System.Net.HttpStatusCode.OK)
            {
                data = response.Content;
            }
            else
            {
                Console.WriteLine("HTTP error: " + response.StatusCode + " -> " + response.Content);
            }

            return(data);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Retrieve table metadata using the connection provided.
        /// </summary>
        /// <param name="connection"></param>
        /// <returns></returns>
        public static TableMetadata TableMetadataRetriever(DSTConnection connection)
        {
            TableMetadata tables = new TableMetadata();

            var response = connection.RetrieveMetadata();

            if (response.StatusCode == System.Net.HttpStatusCode.OK)
            {
                tables = JSONDeserializer.DeserializeMetadata(response.Content);
            }
            else
            {
                Console.WriteLine("HTTP error: " + response.StatusCode + " -> " + response.Content);
            }

            return(tables);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Retrieve tables using the connection provided.
        /// </summary>
        /// <param name="settings"></param>
        /// <returns></returns>
        public static List <Table> TablesRetriever(DSTConnection connection)
        {
            List <Table> tables = new List <Table>();

            var response = connection.RetrieveTables();

            if (response.StatusCode == System.Net.HttpStatusCode.OK)
            {
                tables = JSONDeserializer.DeserializeTables(response.Content);
            }
            else
            {
                Console.WriteLine("HTTP error: " + response.StatusCode + " -> " + response.Content);
            }

            return(tables);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Retrieve subjects using the connection provided.
        /// </summary>
        /// <param name="settings"></param>
        /// <returns></returns>
        public static List <Subject> SubjectsRetriever(DSTConnection connection)
        {
            List <Subject> subjects = new List <Subject>();

            var response = connection.RetrieveSubjects();

            if (response.StatusCode == System.Net.HttpStatusCode.OK)
            {
                subjects = JSONDeserializer.DeserializeSubjects(response.Content);
            }
            else
            {
                Console.WriteLine("HTTP error: " + response.StatusCode + " -> " + response.Content);
            }

            return(subjects);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Instantiate using specific connection
 /// </summary>
 /// <param name="connection"></param>
 public DSTRequestHandler(DSTConnection connection)
 {
     this.connection = connection;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Instantiate with default settings
 /// </summary>
 public DSTRequestHandler(bool verbose)
 {
     connection = new DSTConnection(verbose);
 }