BoxKite.Twitter.UsersExtensions.ChangeAccountSettings C# (CSharp) Метод

ChangeAccountSettings() публичный статический Метод

Updates the authenticating user's settings.
ref: https://dev.twitter.com/docs/api/1.1/post/account/settings
public static ChangeAccountSettings ( this session, string trendLocationWoeid = "1", bool sleepTimeEnabled = false, string startSleepTime = "", string endSleepTime = "", string timeZone = "", string language = "" ) : Task
session this
trendLocationWoeid string The Yahoo! Where On Earth ID to use as the user's default trend location.
sleepTimeEnabled bool enable sleep time for the user. Sleep time is the time when push or SMS notifications should not be sent to the user.
startSleepTime string The hour that sleep time should begin if it is enabled. (00)
endSleepTime string The hour that sleep time should end if it is enabled. (23)
timeZone string The timezone dates and times should be displayed in for the user. http://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html
language string The language which Twitter should render in for this user https://dev.twitter.com/docs/api/1/get/help/languages
Результат Task
        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>());
        }