public async Task <HttpResponseMessage> TrackAsync(string Event)
        {
            JObject joProperties = new JObject();

            joProperties.Add(MPReservedNames.TrackToken, APIToken);
            var MixPanelEvent = new MixPanelBaseRequestEvent <JObject>(Event, joProperties);

            return(await EndPointClient.SendData(MixPanelEvent, MixPanelType.track));
        }
        public async Task <HttpResponseMessage> TrackAsync(string Event, object Properties)
        {
            JObject joProperties = new JObject();

            joProperties = ReflectionPropertyAdder(joProperties, Properties);
            joProperties.Add(MPReservedNames.TrackToken, APIToken);

            joProperties.Add(MPReservedNames.TrackDistinctId, joProperties.GetValue(nameof(MPSet.DistinctId)));
            joProperties.Remove(nameof(MPSet.DistinctId));

            var MixPanelEvent = new MixPanelBaseRequestEvent <JObject>(Event, joProperties);

            return(await EndPointClient.SendData(MixPanelEvent, MixPanelType.track));
        }
        public async Task <HttpResponseMessage> TrackAsync <E, T>(E Event, T Properties) where E : class where T : class
        {
            DataInputCleaning.validateOnlyPrimitiveTypes <E>();
            DataInputCleaning.validateNoPrimitiveTypes <T>();

            JObject joProperties = JObject.FromObject(Properties);

            joProperties = ReflectionPropertyAdder(joProperties, Properties);

            joProperties.Add(MPReservedNames.TrackToken, APIToken);
            joProperties.Add(MPReservedNames.TrackDistinctId, joProperties.GetValue(nameof(MPSet.DistinctId)));
            joProperties.Remove(nameof(MPSet.DistinctId));

            var MixPanelEvent = new MixPanelBaseRequestEvent <JObject>(Event.ToString(), joProperties);

            return(await EndPointClient.SendData(MixPanelEvent, MixPanelType.track));
        }
        internal async Task <HttpResponseMessage> BaseOperation <T>(string OperationName, T Properties) where T : class
        {
            ValidatePremises <T>();
            JObject joProperties = AssignUserIdentity();

            try
            {
                joProperties.Add(OperationName, JToken.FromObject(new Dictionary <object, object>()));
                var     tmpSet       = joProperties.GetValue(OperationName);
                JObject tmpSetValues = JObject.FromObject(Properties);
                tmpSet.Replace(tmpSetValues);
            }
            catch (Exception e)
            {
                throw new Exception("Operation " + OperationName + " not defined. :" + e.Message);
            }
            return(await EndPointClient.SendData(joProperties, MixPanelType.engage));
        }
        public async Task <HttpResponseMessage> TrackAsync <T>(string Event, T Properties) where T : IBaseUserTrackingRequest
        {
            DataInputCleaning.validateNoPrimitiveTypes <T>(); //T cannot be Struct types
            HttpResponseMessage result       = new HttpResponseMessage();
            JObject             joProperties = JObject.FromObject(Properties);

            if (Properties != null)
            {
                joProperties = ReflectionPropertyAdder(joProperties, Properties);
                joProperties.Add(MPReservedNames.TrackToken, APIToken);
                joProperties.Add(MPReservedNames.TrackDistinctId, joProperties.GetValue(nameof(MPSet.DistinctId)));
                joProperties.Remove(nameof(MPSet.DistinctId));
                var MixPanelEvent = new MixPanelBaseRequestEvent <JObject>(Event, joProperties);
                result = await EndPointClient.SendData(MixPanelEvent, MixPanelType.track);
            }
            else
            {
                result = await TrackAsync(Event);
            }
            return(result);
        }