Esempio n. 1
0
        public virtual IDictionary <string, object> ToDictionary(Transmission transmission)
        {
            var result = WithCommonConventions(transmission, new Dictionary <string, object>
            {
                ["recipients"] = transmission.ListId != null
                    ? (object)new Dictionary <string, object> {
                    ["list_id"] = transmission.ListId
                }
                    : transmission.Recipients.Select(ToDictionary)
            });

            CcHandling.SetAnyCCsInTheHeader(transmission, result);

            return(result);
        }
Esempio n. 2
0
        public virtual IDictionary <string, object> ToDictionary(Transmission transmission)
        {
            var data = new Dictionary <string, object>
            {
                ["substitution_data"] = AlterThisDictionaryToBePassedToSparkpost(transmission.SubstitutionData),
                ["metadata"]          = AlterThisDictionaryToBePassedToSparkpost(transmission.Metadata),
                ["recipients"]        = transmission.ListId != null
                    ? (object)new Dictionary <string, object> {
                    ["list_id"] = transmission.ListId
                }
                    : transmission.Recipients.Select(ToDictionary)
            };

            var result = WithCommonConventions(transmission, data);

            CcHandling.Process(transmission, result);

            return(result);
        }
Esempio n. 3
0
        public virtual IDictionary <string, object> ToDictionary(Transmission transmission)
        {
            var data = new Dictionary <string, object>
            {
                ["substitution_data"] =
                    transmission.SubstitutionData != null && transmission.SubstitutionData.Keys.Any()
                        ? transmission.SubstitutionData
                        : null,
                ["recipients"] = transmission.ListId != null
                    ? (object)new Dictionary <string, object> {
                    ["list_id"] = transmission.ListId
                }
                    : transmission.Recipients.Select(ToDictionary)
            };

            var result = WithCommonConventions(transmission, data);

            CcHandling.SetAnyCCsInTheHeader(transmission, result);

            return(result);
        }