/* * Copyright (C) Alibaba Cloud Computing * All rights reserved. * * 版权所有 (C)阿里云计算有限公司 */ using System; using System.Collections.Generic; using System.Linq; using System.Text; using Aliyun.Api.LOG.Data; using Aliyun.Api.LOG.Utilities; using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace Aliyun.Api.LOG.Response { /// /// The response of the GetHistogram API from sls server /// public class GetHistogramsResponse : LogResponse { private String _progress; private Int64 _count; private List _histograms; /// /// constructor with http header and body from response /// /// http header from respsone /// http body (in json) from response public GetHistogramsResponse(IDictionary headers, JArray jsonBody) :base(headers) { String count; if (headers.TryGetValue(LogConsts.NAME_HEADER_X_LOG_COUNT, out count)) { _count = Int64.Parse(count); } headers.TryGetValue(LogConsts.NAME_HEADER_X_LOG_PROGRESS, out _progress); ParseResponseBody(jsonBody); } /// /// detect whether response are complete or not. /// /// true if response is complete. otherwise return false public bool IsCompleted() { return _progress == LogConsts.STATUS_COMPLETE; } /// /// The count of histograms /// public Int64 TotalCount { get { return _count; } } /// /// All of histograms /// public List Histograms { get { return _histograms; } } internal override void DeserializeFromJsonInternal(JArray json) { _histograms = Histogram.DeserializeFromJson(json); } } }