public static async Task<AccountSettings> ChangeAccountSettings(this IUserSession session, string trendLocationWoeid = "1",
bool sleepTimeEnabled = false, string startSleepTime = "", string endSleepTime = "",
string timeZone = "", string language = "")
{
var parameters = new TwitterParametersCollection
{
{"sleep_time_enabled", sleepTimeEnabled.ToString()},
};
parameters.Create(include_entities: true);
if (!string.IsNullOrWhiteSpace(trendLocationWoeid))
{
parameters.Add("trend_location_woeid", trendLocationWoeid);
}
if (!string.IsNullOrWhiteSpace(startSleepTime))
{
parameters.Add("start_sleep_time", startSleepTime);
}
if (!string.IsNullOrWhiteSpace(endSleepTime))
{
parameters.Add("end_sleep_time", endSleepTime);
}
if (!string.IsNullOrWhiteSpace(timeZone))
{
parameters.Add("time_zone", timeZone);
}
if (!string.IsNullOrWhiteSpace(language))
{
parameters.Add("lang", language);
}
return await session.PostAsync(TwitterApi.Resolve("/1.1/account/settings.json"), parameters)
.ContinueWith(c => c.MapToSingle<AccountSettings>());
}