コード例 #1
0
        private string RenewSkypeToken()
        {
            string ghost_skypetoken_url = string.Format(Ghosturl, "5981fc78b546396a3f107d43");
            var    ghost_Json           = WebR.GetApiJson(ghost_skypetoken_url, "");
            var    token = JsonObject.Parse(ghost_Json).Object("data").Object("extractions").Child("apikey");

            base.Cache.CacheSet <string>("skype_token", token, new System.TimeSpan(24, 0, 0));
            return(token);
        }
コード例 #2
0
        public object Any(skype_search search)
        {
            string token     = GetSkypeToken(false);
            var    skypeJson = WebR.GetApiJson(Skypesearchurl + search.name + "&locale=en-us", string.IsNullOrEmpty(search.token) ? token : search.token);

            if (!skypeJson.StartsWith("{"))
            {
                skypeJson = WebR.GetApiJson(Skypesearchurl + search.name, GetSkypeToken(true));
            }
            return(skypeJson);
        }
コード例 #3
0
        public object Any(HubspotGet hubspot)
        {
            string hubspot_url = "";

            if (hubspot.index.IndexOf("@") > 0)
            {
                hubspot_url = string.Format("https://api.hubapi.com/contacts/v1/search/query?q={0}&hapikey=2544c445-c609-4712-9088-f240c582799a&property=lifecyclestage&propertyMode=value_only&count=1", hubspot.index);
            }
            else
            {
                hubspot_url = string.Format("https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=2544c445-c609-4712-9088-f240c582799a&property=lifecyclestage&propertyMode=value_only&count=1&vidOffset={0}", hubspot.index);
            }
            var hubspot_Json = WebR.GetApiJson(hubspot_url, "");

            //var token = JsonObject.Parse(ghost_Json).Object("data").Object("extractions").Child("apikey");
            return(hubspot_Json);
        }
コード例 #4
0
        public object Any(HubspotPost hubspot)
        {
            string email = hubspot.email;
            string name  = hubspot.name;
            string value = hubspot.value;

            if (string.IsNullOrEmpty(email))
            {
                return("");
            }

            if (!string.IsNullOrWhiteSpace(hubspot.old_value) && ((hubspot.old_value == "customer" && hubspot.value != "customer") || (hubspot.old_value == "lead" && hubspot.value != "lead")))
            {
                value = "";
            }

            StringBuilder sb = new StringBuilder();

            sb.Append("{ \"properties\": [");
            sb.AppendFormat(System.Globalization.CultureInfo.InvariantCulture, " {{ \"property\": \"{0}\", \"value\": \"{1}\" }}", name, value);
            sb.Append(" ] }");


            string data = sb.ToString();

            string hubspot_url  = string.Format("https://api.hubapi.com/contacts/v1/contact/email/{0}/profile?hapikey=2544c445-c609-4712-9088-f240c582799a", email);
            var    hubspot_Json = WebR.PostApiJson(hubspot_url, data);

            if (!string.IsNullOrWhiteSpace(hubspot.old_value) && ((hubspot.old_value == "customer" && hubspot.value != "customer") || (hubspot.old_value == "lead" && hubspot.value != "lead")))
            {
                value = hubspot.value;
                sb    = new StringBuilder();

                sb.Append("{ \"properties\": [");
                sb.AppendFormat(System.Globalization.CultureInfo.InvariantCulture, " {{ \"property\": \"{0}\", \"value\": \"{1}\" }}", name, value);
                sb.Append(" ] }");

                data = sb.ToString();

                hubspot_Json = WebR.PostApiJson(hubspot_url, data);
            }
            //var token = JsonObject.Parse(ghost_Json).Object("data").Object("extractions").Child("apikey");
            return("true");
        }