/// <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)); }
/// <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)); } }