<commit_before>﻿using System;
using System.Threading.Tasks;

using sensorthings.Core;

using SensorThings.Core;

using sensorthings.Extensions;
using sensorthings.ODATA;

namespace SensorThings.Client
{
    public class SensorThingsClient : ISensorThingsClient {
        private HomeDocument _homedoc;

        public string Server { get; set; }

        public SensorThingsClient(string server) {
            Server = server;
            Task.Run(async () => {
                    var response = await Http.GetJson<HomeDocument>(Server);
                    if (!response.Success) {
                        throw new Exception("Unable to get home document");
                    }

                    return _homedoc = response.Result;
                })
                .Wait();
        }

        public async Task<Response<Thing>> GetThing(string id, OdataQuery odata = null) {
            return await Get<Thing>(typeof(Thing), null, id, odata);
        }

        public async Task<Response<Thing>> GetThingByDatastream(string id, OdataQuery odata = null) {
            return await Get<Thing>(typeof(Thing), typeof(Datastream), id, odata);
        }

        public async Task<Response<Thing>> GetThingByHistoricalLocation(string id, OdataQuery odata = null) {<commit_msg>Cleanup code: Removed unused Porperty.<commit_after>﻿using System;
using System.Threading.Tasks;

using sensorthings.Core;

using SensorThings.Core;

using sensorthings.Extensions;
using sensorthings.ODATA;

namespace SensorThings.Client
{
    public class SensorThingsClient : ISensorThingsClient {
        private HomeDocument _homedoc;

        public SensorThingsClient(string server) {
            Task.Run(async () => {
                    var response = await Http.GetJson<HomeDocument>(server);
                    if (!response.Success) {
                        throw new Exception("Unable to get home document");
                    }

                    return _homedoc = response.Result;
                })
                .Wait();
        }

        public async Task<Response<Thing>> GetThing(string id, OdataQuery odata = null) {
            return await Get<Thing>(typeof(Thing), null, id, odata);
        }

        public async Task<Response<Thing>> GetThingByDatastream(string id, OdataQuery odata = null) {
            return await Get<Thing>(typeof(Thing), typeof(Datastream), id, odata);
        }

        public async Task<Response<Thing>> GetThingByHistoricalLocation(string id, OdataQuery odata = null) {
{'fraction_non_alphanumeric': 0.09076433121019108, 'fraction_numerical': 0.0, 'mean_word_length': 2.328476821192053, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5007750', 'n_tokens_mistral': 695, 'n_tokens_neox': 659, 'n_words': 167}