//Constructor to make different Url and Collect Data via different Functions
        public ResponseStructure(string apiUrl, StatusStructure statusStructure)
        {
            m_statusStructure = statusStructure;
            m_repoName        = apiUrl;
            //Total Open Issues
            m_openIssueCountUrl = String.Format(m_searchApiUrl, apiUrl.TrimEnd('/'));
            TotalOpenIssues();

            //Last 24Hrs Issues
            DateTime timeE = DateTime.Now;

            timeE = timeE.AddHours(-24);
            string time = timeE.ToString("yyyy-MM-ddTHH:mm:ss") + "Z";

            //Last 24hrs open issues count
            m_last24HrsCountUrl     = m_baseUrl + apiUrl + "issues?since=" + time + "&state=open";
            m_opeIssuesCountIn24Hrs = IssueCountUrl(m_last24HrsCountUrl);

            //more than 24hrs less than 7 days
            timeE = DateTime.Now;
            timeE = timeE.AddHours(-168);
            time  = timeE.ToString("yyyy-MM-ddTHH:mm:ss") + "Z";
            m_24To7DaysCountUrl = m_baseUrl + apiUrl + "issues?since=" + time + "&state=open";
            m_openIssuesCountInLast24HrsTo7Days = IssueCountUrl(m_24To7DaysCountUrl) - m_opeIssuesCountIn24Hrs;


            m_openIssuesCountOlderThan7Days = m_openIssuesCountTotal - (m_opeIssuesCountIn24Hrs + m_openIssuesCountInLast24HrsTo7Days);
        }
        // Get the Overall Issues count for the Repo and assign to m_openIssuesCount
        private void TotalOpenIssues()
        {
            StatusStructure statusStructure = m_statusStructure;
            JObject         jsonResponse    = GetReponseAsync(m_openIssueCountUrl, ref statusStructure);

            if (jsonResponse["total_count"] != null)
            {
                m_openIssuesCountTotal = long.Parse(jsonResponse["total_count"].ToString());
            }
            else
            {
                m_openIssuesCountTotal = 0;
            }
        }
        //Make the Count of the Issue according to the Url specified
        private long IssueCountUrl(string issueUrl)
        {
            long            issueCount      = 0;
            StatusStructure statusStructure = m_statusStructure;
            HttpWebResponse response        = Response(issueUrl, ref statusStructure);
            JArray          jsonResponse    = GetReponseAsyncArray(issueUrl, ref statusStructure);

            issueCount += jsonResponse.Count;
            while (ContainsLinkHeaderRelNext(response))
            {
                string link = GetLink(response);
                if (link != null)
                {
                    response     = Response(link, ref statusStructure);
                    jsonResponse = GetReponseAsyncArray(link, ref statusStructure);
                    issueCount  += jsonResponse.Count;
                }
            }
            return(issueCount);
        }
 public ResponseStructure(StatusStructure statusStructure)
 {
     m_statusStructure = statusStructure;
 }