Пример #1
0
        /// <summary>
        /// Return the endpoint to caller method
        /// <param name="type">v2.0 Mailchimp EndPoint targetType, example: campaign, lists etc</param>
        /// <param name="subType" optional></param>
        /// </summary>
        public static string LegacyEndPoint(TargetTypes type, SubTargetType subType)
        {
            string targetType = EnumMapper.MapTarget(type);

            string subCategory = EnumMapper.Map(subType);

            var dataCenter = GetDatacenterPrefix();

            return(String.Format("https://{0}.api.mailchimp.com/2.0/{1}/{2}", dataCenter, targetType, subCategory));
        }
Пример #2
0
        public static string Map(SubTargetType subType)
        {
            string subTypeValue = ActionMapper(subType);

            if (subTypeValue == SubTargetType.not_applicable.ToString())
            {
                return("");
            }

            string map = subTypeValue.Replace("_", "-");

            return(map);
        }
Пример #3
0
        private static string ActionMapper(SubTargetType actionType)
        {
            string mapValue;
            Dictionary <SubTargetType, string> actionMapper = new Dictionary <SubTargetType, string>()
            {
                { SubTargetType.action1, "actions/start" },
                { SubTargetType.action2, "actions/pause" },
                { SubTargetType.action3, "actions/cancel-send" },
                { SubTargetType.action4, "actions/start-all-emails" },
                { SubTargetType.action5, "actions/pause-all-emails" }
            };

            return(actionMapper.TryGetValue(actionType, out mapValue) ? mapValue : actionType.ToString());
        }
Пример #4
0
        public static string Map(SubTargetType subType)
        {
            string subTypeValue = ActionMapper(subType);

            if (subTypeValue == SubTargetType.not_applicable.ToString())
            {
                return "";
            }
            else
            {
                string map = subTypeValue.Replace("_", "-");
                return map; 
            }  
        }
Пример #5
0
        private static string ActionMapper(SubTargetType actionType)
        {
            string mapValue;
            Dictionary<SubTargetType, string> actionMapper = new Dictionary<SubTargetType, string>()
            {
                {SubTargetType.action1, "actions/start"},
                {SubTargetType.action2, "actions/pause"},
                {SubTargetType.action3, "actions/cancel-send"},
                {SubTargetType.action4, "actions/start-all-emails"},
                {SubTargetType.action5, "actions/pause-all-emails"}
            };

            return actionMapper.TryGetValue(actionType, out mapValue) ? mapValue : actionType.ToString(); 
        }
Пример #6
0
        private static string ActionMapper(SubTargetType actionType)
        {
            string mapValue;
            Dictionary <SubTargetType, string> actionMapper = new Dictionary <SubTargetType, string>
            {
                { SubTargetType.actionStart, "actions/start" },
                { SubTargetType.actionPause, "actions/pause" },
                { SubTargetType.actionCancelSend, "actions/cancel-send" },
                { SubTargetType.actionStartAllEmails, "actions/start-all-emails" },
                { SubTargetType.actionPauseAllEmails, "actions/pause-all-emails" },
                { SubTargetType.actionSend, "actions/send" },
                { SubTargetType.actionTest, "actions/test" }
            };

            return(actionMapper.TryGetValue(actionType, out mapValue) ? mapValue : actionType.ToString());
        }
Пример #7
0
        public static string EndPoint(TargetTypes type, SubTargetType subType, string param)
        {
            string targetType = EnumMapper.MapTarget(type);
            string subTarget  = EnumMapper.Map(subType);

            if (targetType != null)
            {
                if (subType != SubTargetType.not_applicable)
                {
                    return(string.Format("https://api-nba-v1.p.rapidapi.com/{0}/{1}/{2}", targetType, subTarget, param));
                }

                return(string.Format("https://api-nba-v1.p.rapidapi.com/{0}/", targetType));
            }

            return(string.Empty);
        }
Пример #8
0
            public void Parse(Stream s, long startPos)
            {
                var  br         = new BinaryReader(s);
                uint dataOffset = br.ReadUInt32();

                target = br.ReadUInt32();
                offset = br.ReadSingle();
                scale  = br.ReadSingle();
                ushort numFrames = br.ReadUInt16();

                channelType      = (ChannelType)br.ReadByte();
                channelSubTarget = (SubTargetType)br.ReadByte();
                long currentPos = s.Position;
                uint width      = GetWidthForChannelType(channelType);
                uint count      = GetCountForChannelType(channelType);

                s.Position = startPos + dataOffset;
                frames     = new FrameList(handler, s, numFrames, this);
                s.Position = currentPos;
            }
Пример #9
0
        /// <summary>
        /// Return the endpoint to caller method
        /// <param name="type">v3.0 Mailchimp EndPoint targetType, example: reports, lists etc</param>
        /// <param name="subType" optional>Expects id for particular list/campaign etc</param>
        /// <param name="id" optional>Expects id for particular list/campaign etc</param>
        /// <param name="linkId" optional>NOT IMPLEMENTED YET</param>
        /// </summary>
        public static string EndPoint(TargetTypes type, SubTargetType subType, SubTargetType childSubType, string id = "", string param2 = "")
        {
            string targetType       = EnumMapper.MapTarget(type);
            string subCategory      = EnumMapper.Map(subType);
            string subChildCategory = EnumMapper.Map(childSubType);

            var dataCenter = GetDatacenterPrefix();

            if (id != "")
            {
                if (subCategory != "")
                {
                    if (param2 != "")
                    {
                        if (subChildCategory != "")
                        {
                            return(String.Format("https://{0}.api.mailchimp.com/3.0/{1}/{2}/{3}/{4}/{5}", dataCenter, targetType, id, subCategory, param2, childSubType));
                        }
                        else
                        {
                            return(String.Format("https://{0}.api.mailchimp.com/3.0/{1}/{2}/{3}/{4}", dataCenter, targetType, id, subCategory, param2));
                        }
                    }
                    else
                    {
                        return(String.Format("https://{0}.api.mailchimp.com/3.0/{1}/{2}/{3}", dataCenter, targetType, id, subCategory));
                    }
                }
                else
                {
                    return(String.Format("https://{0}.api.mailchimp.com/3.0/{1}/{2}", dataCenter, targetType, id));
                }
            }
            else
            {
                return(String.Format("https://{0}.api.mailchimp.com/3.0/{1}", dataCenter, targetType));
            }
        }
Пример #10
0
        /// <summary>
        /// Return the endpoint to caller method
        /// <param name="type">v3.0 Mailchimp EndPoint targetType, example: reports, lists etc</param>
        /// <param name="subType" optional>Expects id for particular list/campaign etc</param>
        /// <param name="id" optional>Expects id for particular list/campaign etc</param>
        /// <param name="linkId" optional>NOT IMPLEMENTED YET</param>
        /// </summary>
        public static string EndPoint(TargetTypes type, SubTargetType subType, SubTargetType childSubType, string id = "", string param2 = "")
        {
            string targetType = EnumMapper.MapTarget(type);
            string subCategory = EnumMapper.Map(subType);
            string subChildCategory = EnumMapper.Map(childSubType);

            var dataCenter = GetDatacenterPrefix();
            if (id != "")
            {
                if (subCategory != "")
                {
                    if (param2 != "")
                    {
                        if (subChildCategory != "")
                        {
                            return String.Format("https://{0}.api.mailchimp.com/3.0/{1}/{2}/{3}/{4}/{5}", dataCenter, targetType, id, subCategory, param2, childSubType);
                        }
                        else
                        {
                            return String.Format("https://{0}.api.mailchimp.com/3.0/{1}/{2}/{3}/{4}", dataCenter, targetType, id, subCategory, param2);
                        }
                    }
                    else
                    {
                        return String.Format("https://{0}.api.mailchimp.com/3.0/{1}/{2}/{3}", dataCenter, targetType, id, subCategory);
                    }

                }
                else
                {
                    return String.Format("https://{0}.api.mailchimp.com/3.0/{1}/{2}", dataCenter, targetType, id);
                }
            }
            else
            {
                return String.Format("https://{0}.api.mailchimp.com/3.0/{1}", dataCenter, targetType);
            }
        }
Пример #11
0
 protected S3Channel(int APIversion, EventHandler handler, uint target, float offset, float scale, ChannelType channelType, SubTargetType channelSubTarget, FrameList frames)
     : base(APIversion, handler)
 {
     this.target           = target;
     this.offset           = offset;
     this.scale            = scale;
     this.channelType      = channelType;
     this.channelSubTarget = channelSubTarget;
     this.frames           = frames;
 }
Пример #12
0
 /// <summary>
 /// Return the endpoint to caller method
 /// <param name="type">v2.0 Mailchimp EndPoint targetType, example: campaign, lists etc</param>
 /// <param name="subType" optional></param>
 /// </summary>
 public static string LegacyEndPoint(TargetTypes type, SubTargetType subType)
 {
     return(APIAuthenticator.LegacyEndPoint(type, subType));
 }
Пример #13
0
 /// <summary>
 /// Return the endpoint to caller method
 /// <param name="type">v3.0 Mailchimp EndPoint targetType, example: reports, lists etc</param>
 /// <param name="subType" optional>Expects id for particular list/campaign etc</param>
 /// <param name="id" optional>Expects id for particular list/campaign etc</param>
 /// <param name="linkId" optional>NOT IMPLEMENTED YET</param>
 /// </summary>
 public static string EndPoint(TargetTypes type, SubTargetType subType, SubTargetType childSubType, string id = "", string param2 = "")
 {
     return(APIAuthenticator.EndPoint(type, subType, childSubType, id, param2));
 }
Пример #14
0
        /// <summary>
        /// Return the endpoint to caller method
        /// <param name="type">v2.0 Mailchimp EndPoint targetType, example: campaign, lists etc</param>
        /// <param name="subType" optional></param>
        /// </summary>
        public static string LegacyEndPoint(TargetTypes type, SubTargetType subType)
        {
            string targetType = EnumMapper.MapTarget(type);
            
            string subCategory = EnumMapper.Map(subType);
            
            var dataCenter = GetDatacenterPrefix();

            return String.Format("https://{0}.api.mailchimp.com/2.0/{1}/{2}", dataCenter, targetType, subCategory);
        }