Example #1
0
        private static JsonSerializerSettings SerializerSettings(ISlackTypeResolver slackTypeResolver)
        {
            var namingStrategy = new SnakeCaseNamingStrategy();

            return(new JsonSerializerSettings
            {
                NullValueHandling = NullValueHandling.Ignore,
                ContractResolver = new DefaultContractResolver
                {
                    NamingStrategy = namingStrategy,
                },
                Converters =
                {
                    new EnumNameConverter(namingStrategy),
                    new SlackTypeConverter(slackTypeResolver)
                }
            });
        }
Example #2
0
        private static JsonSerializerSettings SerializerSettings(ISlackTypeResolver slackTypeResolver)
        {
            var namingStrategy = new SnakeCaseNamingStrategy();

            return(new JsonSerializerSettings
            {
                NullValueHandling = NullValueHandling.Ignore,
                DateFormatString = "yyyy-MM-dd",
                ContractResolver = new SlackNetContractResolver
                {
                    NamingStrategy = namingStrategy,
                },
                Converters =
                {
                    new EnumNameConverter(namingStrategy),
                    new TimeSpanConverter(),
                    new SlackTypeConverter(slackTypeResolver)
                }
            });
        }
Example #3
0
        private static JsonSerializerSettings SerializerSettings(ISlackTypeResolver slackTypeResolver)
        {
            var namingStrategy = new SnakeCaseNamingStrategy();

            return(new JsonSerializerSettings
            {
                NullValueHandling = NullValueHandling.Ignore,
                ContractResolver = new SlackNetContractResolver
                {
                    NamingStrategy = namingStrategy,
                },
                Converters =
                {
                    new EnumNameConverter(namingStrategy),
                    new SlackTypeConverter(slackTypeResolver),
                    new IsoDateTimeConverter {
                        DateTimeFormat = "YYYY-MM-DD"
                    }
                }
            });
        }
Example #4
0
 public SlackTypeConverter(ISlackTypeResolver slackTypeResolver)
 {
     _slackTypeResolver = slackTypeResolver;
 }
Example #5
0
 public static SlackJsonSettings JsonSettings(ISlackTypeResolver slackTypeResolver = null) => new SlackJsonSettings(SerializerSettings(slackTypeResolver ?? SlackTypeResolver()));
Example #6
0
 public static SlackJsonSettings JsonSettings(ISlackTypeResolver slackTypeResolver) => new SlackJsonSettings(SerializerSettings(slackTypeResolver));