Ejemplo n.º 1
0
        public async Task <EnergyResponse7A> GetEnergy(string id, string accountId, string token, EnergyPeriod period)
        {
            var result = await BaseUrl
                         .AppendPathSegments("/v1/device/", id, "/energy/", period.ToString())
                         .AddDefaultHeaders(accountId, token)
                         .GetAsync()
                         .ReceiveString()
                         .ConfigureAwait(false);

            return(JsonConvert.DeserializeObject <EnergyResponse7A>(result));
        }
Ejemplo n.º 2
0
        public async Task <EnergyResponse15A> GetEnergy(string id, string accountId, string token, EnergyPeriod period)
        {
            var body = new RequestBody()
            {
                Uuid      = id,
                Token     = token,
                AccountId = accountId
            };

            var result = await BaseUrl
                         .AppendPathSegments($"15a/v1/device/energy{period.ToString()}")
                         .PostJsonAsync(body)
                         .ReceiveString()
                         .ConfigureAwait(false);

            return(JsonConvert.DeserializeObject <EnergyResponse15A>(result));
        }