Ejemplo n.º 1
0
        public static MessageBuildResult Build(
            string token,
            IEnumerable <ObjectProperty> superProperties,
            decimal amount,
            DateTime time,
            object distinctId,
            MixpanelConfig config)
        {
            MessageBuildResult messageBuildResult = PeopleMessageBuilderBase.CreateMessage(
                token,
                superProperties,
                null,
                distinctId,
                config,
                "$append",
                rawValue => throw new InvalidOperationException());

            if (!messageBuildResult.Success)
            {
                return(messageBuildResult);
            }

            messageBuildResult.Message["$append"] = new Dictionary <string, object>(1)
            {
                {
                    "$transactions", new Dictionary <string, object>(2)
                    {
                        { "$time", TimeParser.ParseMixpanelFormat(time).Value },
                        { "$amount", amount }
                    }
                }
            };

            return(messageBuildResult);
        }
 public static MessageBuildResult Build(
     string token,
     IEnumerable <ObjectProperty> superProperties,
     object rawProperties,
     object distinctId,
     MixpanelConfig config)
 {
     return(PeopleMessageBuilderBase.CreateMessage(
                token,
                superProperties,
                rawProperties,
                distinctId,
                config,
                "$add",
                NumberParser.Parse));
 }
 public static MessageBuildResult Build(
     string token,
     IEnumerable <ObjectProperty> superProperties,
     object rawProperties,
     object distinctId,
     MixpanelConfig config)
 {
     return(PeopleMessageBuilderBase.CreateMessage(
                token,
                superProperties,
                rawProperties,
                distinctId,
                config,
                "$union",
                rawValue => CollectionParser.Parse(rawValue, _ => GenericPropertyParser.Parse(_, allowCollections: false))));
 }
        public static MessageBuildResult Build(
            string token,
            IEnumerable <ObjectProperty> superProperties,
            object distinctId,
            MixpanelConfig config)
        {
            MessageBuildResult messageBuildResult = PeopleMessageBuilderBase.CreateMessage(
                token,
                superProperties,
                null,
                distinctId,
                config,
                "$delete",
                rawValue => throw new InvalidOperationException());

            if (!messageBuildResult.Success)
            {
                return(messageBuildResult);
            }

            messageBuildResult.Message["$delete"] = Empty;
            return(messageBuildResult);
        }