Пример #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));
        }
        public SavedXrmRecordConfiguration GetSavedXrmRecordConfiguration()
        {
            var xrmConfig   = GetSavedTestEncryptedXrmConfiguration();
            var enumMapper  = new EnumMapper <XrmRecordAuthenticationProviderType, AuthenticationProviderType>();
            var savedConfig = new SavedXrmRecordConfiguration()
            {
                Active = true,
                AuthenticationProviderType = enumMapper.Map(xrmConfig.AuthenticationProviderType),
                DiscoveryServiceAddress    = xrmConfig.DiscoveryServiceAddress,
                Domain = xrmConfig.Domain,
                OrganizationUniqueName = OverrideOrganisation ?? xrmConfig.OrganizationUniqueName,
                Password = xrmConfig.Password,
                Username = xrmConfig.Username
            };

            return(savedConfig);
        }
Пример #3
0
        public SavedXrmRecordConfiguration GetSavedXrmRecordConfiguration()
        {
            var xrmConfig   = XrmConfiguration;
            var enumMapper  = new EnumMapper <XrmRecordAuthenticationProviderType, AuthenticationProviderType>();
            var savedConfig = new SavedXrmRecordConfiguration()
            {
                Active = true,
                AuthenticationProviderType = enumMapper.Map(xrmConfig.AuthenticationProviderType),
                DiscoveryServiceAddress    = xrmConfig.DiscoveryServiceAddress,
                Domain = xrmConfig.Domain,
                OrganizationUniqueName = OverrideOrganisation ?? xrmConfig.OrganizationUniqueName,
                Password = new Password(xrmConfig.Password, false, true),
                Username = xrmConfig.Username,
                Name     = "TESTSCRIPTCONNECTION"
            };

            return(savedConfig);
        }
Пример #4
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));
            }
        }