<commit_before>﻿using PodioAPI;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace PodioAspNetSample.Models
{
    public class PodioConnection
    {
        public string ClientId { get; set; }
        public string ClientSecret { get; set; }
        public string RedirectUrl { get; set; }

        public  bool IsAuthenticated
        { 
            get 
            {
                Podio podio = GetClient();

                //Check if there is a stored access token already present. By default this api client store access token in session
                return podio.IsAuthenticated();
            } 
        }

        public PodioConnection()
        {
            ClientId = ConfigurationManager.AppSettings["PodioClientId"];
            ClientSecret = ConfigurationManager.AppSettings["PodioClientSecret"];

            if (string.IsNullOrEmpty(ClientId) || string.IsNullOrEmpty(ClientSecret))
                throw new Exception("ClientId and ClientSecret not set. Please set that in Web.config");

            UrlHelper urlHelper = new UrlHelper(HttpContext.Current.Request.RequestContext);
            RedirectUrl = urlHelper.Action("HandleAuthorizationResponse", "Authorization", new object { }, "http");
        }

        /// <summary>
        /// Return an instance of Podio object
        /// </summary>
        /// <returns></returns>
        public Podio GetClient()
        {
            var podio = new Podio(ClientId, ClientSecret);
            return podio;
        }
    }
}<commit_msg>Added comment for clarification<commit_after>﻿using PodioAPI;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace PodioAspNetSample.Models
{
    public class PodioConnection
    {
        public string ClientId { get; set; }
        public string ClientSecret { get; set; }
        public string RedirectUrl { get; set; }

        public  bool IsAuthenticated
        { 
            get 
            {
                Podio podio = GetClient();

                //Check if there is a stored access token already present. By default this api client store access token in session
                return podio.IsAuthenticated();
            } 
        }

        public PodioConnection()
        {
            ClientId = ConfigurationManager.AppSettings["PodioClientId"];
            ClientSecret = ConfigurationManager.AppSettings["PodioClientSecret"];

            if (string.IsNullOrEmpty(ClientId) || string.IsNullOrEmpty(ClientSecret))
                throw new Exception("ClientId and ClientSecret not set. Please set that in Web.config");

            // Set RedirectUrl to /Authorization/HandleAuthorizationResponse action. To use in server side auth flow
            UrlHelper urlHelper = new UrlHelper(HttpContext.Current.Request.RequestContext);
            RedirectUrl = urlHelper.Action("HandleAuthorizationResponse", "Authorization", new object { }, "http");
        }

        /// <summary>
        /// Return an instance of Podio object
        /// </summary>
        /// <returns></returns>
        public Podio GetClient()
        {
            var podio = new Podio(ClientId, ClientSecret);
            return podio;
        }
    }
}
{'fraction_non_alphanumeric': 0.08499850879809126, 'fraction_numerical': 0.0, 'mean_word_length': 2.15819209039548, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '3620027', 'n_tokens_mistral': 830, 'n_tokens_neox': 813, 'n_words': 241}