/// <summary>
        /// lets logged-in user report spam
        /// </summary>
        /// <param name="userID">user id of alleged spammer</param>
        /// <param name="screenName">screen name of alleged spammer</param>
        /// <param name="callback">Async Callback used in Silverlight queries</param>
        /// <returns>Alleged spammer user info</returns>
        public static User ReportSpam(this TwitterContext ctx, string userID, string screenName, Action<TwitterAsyncResponse<User>> callback)
        {
            if (string.IsNullOrEmpty(userID) &&
                string.IsNullOrEmpty(screenName))
            {
                throw new ArgumentException("Either userID or screenName is a required parameter.");
            }

            string reportSpamUrl = ctx.BaseUrl + "users/report_spam.json";

            var createParams = new Dictionary<string, string>
                {
                    { "user_id", userID },
                    { "screen_name", screenName }
                };

            var reqProc = new UserRequestProcessor<User>();

            ITwitterExecute exec = ctx.TwitterExecutor;
            exec.AsyncCallback = callback;
            var resultsJson =
                exec.PostToTwitter(
                    reportSpamUrl,
                    createParams,
                    response => reqProc.ProcessActionResult(response, UserAction.SingleUser));

            User user = reqProc.ProcessActionResult(resultsJson, UserAction.SingleUser);
            return user;
        }
        /// <summary>
        /// Update Twitter colors
        /// </summary>
        /// <remarks>
        /// The # character prefix is optional.  At least one color argument must be provided.
        /// </remarks>
        /// <param name="background">background color</param>
        /// <param name="text">text color</param>
        /// <param name="link">link color</param>
        /// <param name="sidebarFill">sidebar color</param>
        /// <param name="sidebarBorder">sidebar border color</param>
        /// <param name="includeEntities">Set to false to not include entities. (default: true)</param>
        /// <param name="skipStatus">Don't include status with response.</param>
        /// <returns>User info with new colors</returns>
        public async Task<User> UpdateAccountColorsAsync(string background, string text, string link, string sidebarFill, string sidebarBorder, bool includeEntities, bool skipStatus, CancellationToken cancelToken = default(CancellationToken))
        {
            var accountUrl = BaseUrl + "account/update_profile_colors.json";

            if (string.IsNullOrWhiteSpace(background) &&
                string.IsNullOrWhiteSpace(text) &&
                string.IsNullOrWhiteSpace(link) &&
                string.IsNullOrWhiteSpace(sidebarFill) &&
                string.IsNullOrWhiteSpace(sidebarBorder))
                throw new ArgumentException("At least one of the colors (background, text, link, sidebarFill, or sidebarBorder) must be provided as arguments, but none are specified.", NoInputParam);

            var reqProc = new UserRequestProcessor<User>();

            RawResult =
                await TwitterExecutor.PostToTwitterAsync<User>(
                    accountUrl,
                    new Dictionary<string, string>
                    {
                        { "profile_background_color", string.IsNullOrWhiteSpace(background) ? null : background.TrimStart('#') },
                        { "profile_text_color", string.IsNullOrWhiteSpace(text) ? null : text.TrimStart('#') },
                        { "profile_link_color", string.IsNullOrWhiteSpace(link) ? null : link.TrimStart('#') },
                        { "profile_sidebar_fill_color", string.IsNullOrWhiteSpace(sidebarFill) ? null : sidebarFill.TrimStart('#') },
                        { "profile_sidebar_border_color", string.IsNullOrWhiteSpace(sidebarBorder) ? null : sidebarBorder.TrimStart('#') },
                        { "include_entities", includeEntities.ToString().ToLower() },
                        { "skip_status", skipStatus.ToString().ToLower() }
                    },
                    cancelToken)
                    .ConfigureAwait(false);

            return reqProc.ProcessActionResult(RawResult, UserAction.SingleUser);
        }
Пример #3
0
        /// <summary>
        /// Removes banner from authenticated user's profile.
        /// </summary>
        /// <param name="callback">Async Callback.</param>
        /// <returns>Empty User instance.</returns>
        public static User RemoveProfileBanner(this TwitterContext ctx, Action<TwitterAsyncResponse<User>> callback)
        {
            var accountUrl = ctx.BaseUrl + "account/remove_profile_banner.json";

            var reqProc = new UserRequestProcessor<User>();

            ITwitterExecute exec = ctx.TwitterExecutor;
            exec.AsyncCallback = callback;
            var resultsJson =
                exec.PostToTwitter(
                    accountUrl,
                    new Dictionary<string, string>(),
                    response => reqProc.ProcessActionResult(response, UserAction.SingleUser));

            User user = reqProc.ProcessActionResult(resultsJson, UserAction.SingleUser);
            return user;
        }
        public void ProcessActionResult_Parses_SingleUser_Response()
        {
            var reqProc = new UserRequestProcessor <User>();

            User user = reqProc.ProcessActionResult(SingleUserResponse, UserAction.SingleUser);

            VerifySingleUserResponse(user);
        }
        async Task<User> MuteAsync(IDictionary<string, string> muteParams, CancellationToken cancelToken = default(CancellationToken))
        {
            var muteUrl = BaseUrl + "mutes/users/create.json";

            var reqProc = new UserRequestProcessor<User>();

            RawResult =
                await TwitterExecutor
                    .PostToTwitterAsync<User>(muteUrl, muteParams, cancelToken)
                    .ConfigureAwait(false);

            return reqProc.ProcessActionResult(RawResult, UserAction.SingleUser);
        }
        public void ProcessActionResult_Parses_SingleUser_Response()
        {
            var reqProc = new UserRequestProcessor<User>();

            User user = reqProc.ProcessActionResult(SingleUserResponse, UserAction.SingleUser);

            VerifySingleUserResponse(user);
        }
Пример #7
0
        /// <summary>
        /// Sends an image to Twitter to be placed as the user's profile banner.
        /// </summary>
        /// <param name="banner">byte[] containing image data.</param>
        /// <param name="width">Pixel width to clip image.</param>
        /// <param name="height">Pixel height to clip image.</param>
        /// <param name="offsetLeft">Pixels to offset start of image from the left.</param>
        /// <param name="offsetTop">Pixels to offset start of image from the top.</param>
        /// <param name="callback">Async callback routine.</param>
        /// <returns>
        /// Account of authenticated user who's profile banner will be updated.
        /// Url of new banner will appear in ProfileBannerUrl property.
        /// </returns>
        public static User UpdateProfileBanner(this TwitterContext ctx, byte[] banner, string fileName, string imageType, int width, int height, int offsetLeft, int offsetTop, Action<TwitterAsyncResponse<User>> callback)
        {
            var accountUrl = ctx.BaseUrl + "account/update_profile_banner.json";

            if (banner == null || banner.Length == 0)
            {
                throw new ArgumentException("banner is required.", "banner");
            }

            if (string.IsNullOrEmpty(fileName))
            {
                throw new ArgumentException("fileName is required.", "fileName");
            }

            if (string.IsNullOrEmpty(imageType))
            {
                throw new ArgumentException("imageType is required.", "imageType");
            }

            var parameters = new Dictionary<string, string>
            {
                { "width", width.ToString() },
                { "height", height.ToString() },
                { "offset_left", offsetLeft.ToString() },
                { "offset_top", offsetTop.ToString() },
                { "banner", "IMAGE_DATA" }
            };

            var reqProc = new UserRequestProcessor<User>();

            ITwitterExecute exec = ctx.TwitterExecutor;
            exec.AsyncCallback = callback;
            var resultsJson =
                exec.PostTwitterImage(accountUrl, parameters, banner, fileName, imageType, reqProc);

            User user = reqProc.ProcessActionResult(resultsJson, UserAction.SingleUser);
            return user;
        }
        /// <summary>
        /// Sends an image file to Twitter to replace user image.
        /// </summary>
        /// <param name="image">byte array of image to upload</param>
        /// <param name="fileName">name to pass to Twitter for the file</param>
        /// <param name="imageType">type of image: must be one of jpg, gif, or png</param>
        /// <param name="includeEntities">Set to false to not include entities. (default: true)</param>
        /// <param name="skipStatus">Don't include status with response.</param>
        /// <returns>User with new image info</returns>
        public async Task<User> UpdateAccountImageAsync(byte[] image, string fileName, string imageType, bool includeEntities, bool skipStatus, CancellationToken cancelToken = default(CancellationToken))
        {
            var accountUrl = BaseUrl + "account/update_profile_image.json";

            if (image == null || image.Length == 0)
                throw new ArgumentException("image is required.", "image");

            if (string.IsNullOrWhiteSpace(fileName))
                throw new ArgumentException("fileName is required.", "fileName");

            if (string.IsNullOrWhiteSpace(imageType))
                throw new ArgumentException("imageType is required.", "imageType");

            var reqProc = new UserRequestProcessor<User>();
            var parameters = new Dictionary<string, string>
                    {
                        { "include_entities", includeEntities.ToString().ToLower() },
                        { "skip_status", skipStatus.ToString().ToLower() }
                    };

            string name = "image";
            string imageMimeType = "image/" + imageType;

            RawResult = await TwitterExecutor.PostMediaAsync(accountUrl, parameters, image, name, fileName, imageMimeType, cancelToken).ConfigureAwait(false);

            return reqProc.ProcessActionResult(RawResult, UserAction.SingleUser);
        }
Пример #9
0
        /// <summary>
        /// Update account profile info
        /// </summary>
        /// <param name="name">User Name</param>
        /// <param name="url">Web Address</param>
        /// <param name="location">Geographic Location</param>
        /// <param name="description">Personal Description</param>
        /// <param name="includeEntities">Set to false to not include entities. (default: true)</param>
        /// <param name="skipStatus">Don't include status with response.</param>
        /// <param name="callback">Async Callback used in Silverlight queries</param>
        /// <returns>User with new info</returns>
        public static User UpdateAccountProfile(this TwitterContext ctx, string name, string url, string location, string description, bool includeEntities, bool skipStatus, Action<TwitterAsyncResponse<User>> callback)
        {
            var accountUrl = ctx.BaseUrl + "account/update_profile.json";

            if (string.IsNullOrEmpty(name) &&
                string.IsNullOrEmpty(url) &&
                string.IsNullOrEmpty(location) &&
                string.IsNullOrEmpty(description))
            {
                throw new ArgumentException("At least one of the text fields (name, email, url, location, or description) must be provided as arguments, but none are specified.", NoInputParam);
            }

            if (!string.IsNullOrEmpty(name) && name.Length > 20)
            {
                throw new ArgumentException("name must be no longer than 20 characters", "name");
            }

            if (!string.IsNullOrEmpty(url) && url.Length > 100)
            {
                throw new ArgumentException("url must be no longer than 100 characters", "url");
            }

            if (!string.IsNullOrEmpty(location) && location.Length > 30)
            {
                throw new ArgumentException("location must be no longer than 30 characters", "location");
            }

            if (!string.IsNullOrEmpty(description) && description.Length > 160)
            {
                throw new ArgumentException("description must be no longer than 160 characters", "description");
            }

            var reqProc = new UserRequestProcessor<User>();

            ITwitterExecute exec = ctx.TwitterExecutor;
            exec.AsyncCallback = callback;
            var resultsJson =
                exec.PostToTwitter(
                    accountUrl,
                    new Dictionary<string, string>
                    {
                        { "name", name },
                        { "url", url },
                        { "location", location },
                        { "description", description },
                        { "include_entities", includeEntities.ToString().ToLower() },
                        { "skip_status", skipStatus.ToString().ToLower() }
                    },
                    response => reqProc.ProcessActionResult(response, UserAction.SingleUser));

            User user = reqProc.ProcessActionResult(resultsJson, UserAction.SingleUser);
            return user;
        }
Пример #10
0
        /// <summary>
        /// Update Twitter colors
        /// </summary>
        /// <remarks>
        /// The # character prefix is optional.  At least one color argument must be provided.
        /// </remarks>
        /// <param name="background">background color</param>
        /// <param name="text">text color</param>
        /// <param name="link">link color</param>
        /// <param name="sidebarFill">sidebar color</param>
        /// <param name="sidebarBorder">sidebar border color</param>
        /// <param name="includeEntities">Set to false to not include entities. (default: true)</param>
        /// <param name="skipStatus">Don't include status with response.</param>
        /// <param name="callback">Async Callback used in Silverlight queries</param>
        /// <returns>User info with new colors</returns>
        public static User UpdateAccountColors(this TwitterContext ctx, string background, string text, string link, string sidebarFill, string sidebarBorder, bool includeEntities, bool skipStatus, Action<TwitterAsyncResponse<User>> callback)
        {
            var accountUrl = ctx.BaseUrl + "account/update_profile_colors.json";

            if (string.IsNullOrEmpty(background) &&
                string.IsNullOrEmpty(text) &&
                string.IsNullOrEmpty(link) &&
                string.IsNullOrEmpty(sidebarFill) &&
                string.IsNullOrEmpty(sidebarBorder))
            {
                throw new ArgumentException("At least one of the colors (background, text, link, sidebarFill, or sidebarBorder) must be provided as arguments, but none are specified.", NoInputParam);
            }

            var reqProc = new UserRequestProcessor<User>();

            ITwitterExecute exec = ctx.TwitterExecutor;
            exec.AsyncCallback = callback;
            var resultsJson =
                exec.PostToTwitter(
                    accountUrl,
                    new Dictionary<string, string>
                    {
                        { "profile_background_color", string.IsNullOrEmpty(background) ? (string)null : background.TrimStart('#') },
                        { "profile_text_color", string.IsNullOrEmpty(text) ? (string)null : text.TrimStart('#') },
                        { "profile_link_color", string.IsNullOrEmpty(link) ? (string)null : link.TrimStart('#') },
                        { "profile_sidebar_fill_color", string.IsNullOrEmpty(sidebarFill) ? (string)null : sidebarFill.TrimStart('#') },
                        { "profile_sidebar_border_color", string.IsNullOrEmpty(sidebarBorder) ? (string)null : sidebarBorder.TrimStart('#') },
                        { "include_entities", includeEntities.ToString().ToLower() },
                        { "skip_status", skipStatus.ToString().ToLower() }
                    },
                    response => reqProc.ProcessActionResult(response, UserAction.SingleUser));

            User user = reqProc.ProcessActionResult(resultsJson, UserAction.SingleUser);
            return user;
        }
Пример #11
0
        /// <summary>
        /// sends an image file to Twitter to replace background image
        /// </summary>
        /// <param name="image">full path to file, including file name</param>
        /// <param name="fileName">name to pass to Twitter for the file</param>
        /// <param name="imageType">type of image: must be one of jpg, gif, or png</param>
        /// <param name="tile">Tile image across background.</param>
        /// <param name="use">Whether to use uploaded background image or not</param>
        /// <param name="callback">Async Callback used in Silverlight queries</param>
        /// <param name="includeEntities">Set to false to not include entities. (default: true)</param>
        /// <param name="skipStatus">Don't include status with response.</param>
        /// <returns>User with new image info</returns>
        public static User UpdateAccountBackgroundImage(this TwitterContext ctx, byte[] image, string fileName, string imageType, bool tile, bool use, bool includeEntities, bool skipStatus, Action<TwitterAsyncResponse<User>> callback)
        {
            var accountUrl = ctx.BaseUrl + "account/update_profile_background_image.json";

            if (image == null || image.Length == 0)
            {
                throw new ArgumentException("image is required.", "image");
            }

            if (string.IsNullOrEmpty(fileName))
            {
                throw new ArgumentException("fileName is required.", "fileName");
            }

            if (string.IsNullOrEmpty(imageType))
            {
                throw new ArgumentException("imageType is required.", "imageType");
            }

            var parameters = new Dictionary<string, string>
            {
                { "include_entities", includeEntities.ToString().ToLower() },
                { "skip_status", skipStatus.ToString().ToLower() }
            };

            if (tile)
            {
                parameters.Add("tile", true.ToString().ToLower());
                parameters.Add("use", use.ToString().ToLower());
            }

            var reqProc = new UserRequestProcessor<User>();

            ITwitterExecute exec = ctx.TwitterExecutor;
            exec.AsyncCallback = callback;
            var resultsJson =
                exec.PostTwitterImage(accountUrl, parameters, image, fileName, imageType, reqProc);

            User user = reqProc.ProcessActionResult(resultsJson, UserAction.SingleUser);
            return user;
        }
Пример #12
0
        /// <summary>
        /// Allows removal of background image by setting back to the default background.  Once the background image is removed
        /// it can not be turned back on.
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="skipStatus">Don't include status with response.</param>
        /// <returns></returns>
        public static User RemoveBackgroundImage(this TwitterContext ctx, bool skipStatus, Action<TwitterAsyncResponse<User>> callback)
        {
            var accountUrl = ctx.BaseUrl + "account/update_profile_background_image.json";
            var reqProc = new UserRequestProcessor<User>();

            ITwitterExecute exec = ctx.TwitterExecutor;
            exec.AsyncCallback = callback;
            var resultsJson =
                exec.PostToTwitter(
                    accountUrl,
                    new Dictionary<string, string>
                    {
                        { "use", "false" },
                        { "skip_status", skipStatus.ToString()}
                    },
                    response => reqProc.ProcessActionResult(response, UserAction.SingleUser));

            User user = reqProc.ProcessActionResult(resultsJson, UserAction.SingleUser);
            return user;
        }
Пример #13
0
        /// <summary>
        /// sends an image file to Twitter to replace user image
        /// </summary>
        /// <remarks>
        /// You can only run this method with a period of time between executions; 
        /// otherwise you get WebException errors from Twitter
        /// </remarks>
        /// <param name="imageFilePath">full path to file, including file name</param>
        /// <param name="skipStatus">Don't include status with response.</param>
        /// <param name="callback">Async Callback used in Silverlight queries</param>
        /// <returns>User with new image info</returns>
        public static User UpdateAccountImage(this TwitterContext ctx, string imageFilePath, bool skipStatus, Action<TwitterAsyncResponse<User>> callback)
        {
            var accountUrl = ctx.BaseUrl + "account/update_profile_image.json";

            if (string.IsNullOrEmpty(imageFilePath))
            {
                throw new ArgumentException("imageFilePath is required.", "imageFilePath");
            }

            var reqProc = new UserRequestProcessor<User>();
            var parameters = new Dictionary<string, string>
                    {
                        { "skip_status", skipStatus.ToString().ToLower() }
                    };

            ITwitterExecute exec = ctx.TwitterExecutor;
            exec.AsyncCallback = callback;
            var resultsJson =
                exec.PostTwitterFile(accountUrl, parameters, imageFilePath, reqProc);

            User user = reqProc.ProcessActionResult(resultsJson, UserAction.SingleUser);
            return user;
        } 
        /// <summary>
        /// Sends an image file to Twitter to replace background image.
        /// </summary>
        /// <param name="image">full path to file, including file name</param>
        /// <param name="mediaID">ID of media to use (posted via UploadMediaAsync)</param>
        /// <param name="fileName">name to pass to Twitter for the file</param>
        /// <param name="imageType">type of image: must be one of jpg, gif, or png</param>
        /// <param name="tile">Tile image across background.</param>
        /// <param name="includeEntities">Set to false to not include entities. (default: true)</param>
        /// <param name="skipStatus">Don't include status with response.</param>
        /// <returns>User with new image info</returns>
        public async Task<User> UpdateAccountBackgroundImageAsync(byte[] image, ulong mediaID, string fileName, string imageType, bool tile, bool includeEntities, bool skipStatus, CancellationToken cancelToken = default(CancellationToken))
        {
            var accountUrl = BaseUrl + "account/update_profile_background_image.json";

            if (mediaID == NoMediaID && image == NoImage)
                throw new ArgumentException("Either image or mediaID must be provided, but you haven't specified one.", nameof(image) + "Or" + nameof(mediaID));

            if (mediaID == NoMediaID && image.Length == 0)
                throw new ArgumentException("Invalid image", nameof(image));

            if (image != NoImage && mediaID != NoMediaID)
                throw new ArgumentException("Either image or mediaID must be provided, but not both", nameof(image) + "Or" + nameof(mediaID));

            if (string.IsNullOrWhiteSpace(fileName))
                throw new ArgumentException("fileName is required.", nameof(fileName));

            if (string.IsNullOrWhiteSpace(imageType))
                throw new ArgumentException("imageType is required.", nameof(imageType));

            var parameters = new Dictionary<string, string>
            {
                { "include_entities", includeEntities.ToString().ToLower() },
                { "skip_status", skipStatus.ToString().ToLower() }
            };

            if (tile)
                parameters.Add("tile", true.ToString().ToLower());

            if (mediaID != NoMediaID)
                parameters.Add("media_id", mediaID.ToString());

            var reqProc = new UserRequestProcessor<User>();

            string name = "image";
            string imageMimeType = "image/" + imageType;

            if (image != NoImage)
                RawResult = await TwitterExecutor.PostMediaAsync(accountUrl, parameters, image, name, fileName, imageMimeType, cancelToken).ConfigureAwait(false);
            else
                RawResult = await TwitterExecutor.PostToTwitterAsync<User>(accountUrl, parameters, cancelToken).ConfigureAwait(false);

            return reqProc.ProcessActionResult(RawResult, UserAction.SingleUser);
        }
        /// <summary>
        /// Update account profile info
        /// </summary>
        /// <param name="name">User Name</param>
        /// <param name="url">Web Address</param>
        /// <param name="location">Geographic Location</param>
        /// <param name="description">Personal Description</param>
        /// <param name="includeEntities">Set to false to not include entities. (default: true)</param>
        /// <param name="skipStatus">Don't include status with response.</param>
        /// <returns>User with new info</returns>
        public async Task<User> UpdateAccountProfileAsync(string name, string url, string location, string description, bool includeEntities, bool skipStatus, CancellationToken cancelToken = default(CancellationToken))
        {
            var accountUrl = BaseUrl + "account/update_profile.json";

            if (string.IsNullOrWhiteSpace(name) &&
                string.IsNullOrWhiteSpace(url) &&
                string.IsNullOrWhiteSpace(location) &&
                string.IsNullOrWhiteSpace(description))
                throw new ArgumentException("At least one of the text fields (name, email, url, location, or description) must be provided as arguments, but none are specified.", NoInputParam);

            if (!string.IsNullOrWhiteSpace(name) && name.Length > 20)
                throw new ArgumentException("name must be no longer than 20 characters", "name");

            if (!string.IsNullOrWhiteSpace(url) && url.Length > 100)
                throw new ArgumentException("url must be no longer than 100 characters", "url");

            if (!string.IsNullOrWhiteSpace(location) && location.Length > 30)
                throw new ArgumentException("location must be no longer than 30 characters", "location");

            if (!string.IsNullOrWhiteSpace(description) && description.Length > 160)
                throw new ArgumentException("description must be no longer than 160 characters", "description");

            var reqProc = new UserRequestProcessor<User>();

            RawResult =
                await TwitterExecutor.PostToTwitterAsync<User>(
                    accountUrl,
                    new Dictionary<string, string>
                    {
                        { "name", name },
                        { "url", url },
                        { "location", location },
                        { "description", description },
                        { "include_entities", includeEntities.ToString().ToLower() },
                        { "skip_status", skipStatus.ToString().ToLower() }
                    },
                    cancelToken)
                    .ConfigureAwait(false);

            return reqProc.ProcessActionResult(RawResult, UserAction.SingleUser);
        }
        /// <summary>
        /// Removes banner from authenticated user's profile.
        /// </summary>
        /// <returns>Empty User instance.</returns>
        public async Task<User> RemoveProfileBannerAsync(CancellationToken cancelToken = default(CancellationToken))
        {
            var accountUrl = BaseUrl + "account/remove_profile_banner.json";

            var reqProc = new UserRequestProcessor<User>();

            RawResult =
                await TwitterExecutor.PostToTwitterAsync<User>(
                    accountUrl,
                    new Dictionary<string, string>(),
                    cancelToken)
                    .ConfigureAwait(false);

            return reqProc.ProcessActionResult(RawResult, UserAction.SingleUser);
        }
        /// <summary>
        /// Sends an image to Twitter to be placed as the user's profile banner.
        /// </summary>
        /// <param name="banner">byte[] containing image data.</param>
        /// <param name="fileName">Name of file.</param>
        /// <param name="imageType">Type of file (e.g. png or jpg)</param>
        /// <param name="width">Pixel width to clip image.</param>
        /// <param name="height">Pixel height to clip image.</param>
        /// <param name="offsetLeft">Pixels to offset start of image from the left.</param>
        /// <param name="offsetTop">Pixels to offset start of image from the top.</param>
        /// <returns>
        /// Account of authenticated user who's profile banner will be updated.
        /// Url of new banner will appear in ProfileBannerUrl property.
        /// </returns>
        public async Task<User> UpdateProfileBannerAsync(byte[] banner, string fileName, string imageType, int width, int height, int offsetLeft, int offsetTop, CancellationToken cancelToken = default(CancellationToken))
        {
            var accountUrl = BaseUrl + "account/update_profile_banner.json";

            if (banner == null || banner.Length == 0)
                throw new ArgumentException("banner is required.", "banner");

            if (string.IsNullOrWhiteSpace(fileName))
                throw new ArgumentException("fileName is required.", "fileName");

            if (string.IsNullOrWhiteSpace(imageType))
                throw new ArgumentException("imageType is required.", "imageType");

            var parameters = new Dictionary<string, string>
            {
                { "width", width.ToString() },
                { "height", height.ToString() },
                { "offset_left", offsetLeft.ToString() },
                { "offset_top", offsetTop.ToString() },
                //{ "banner", "FILE_DATA" }
            };

            var reqProc = new UserRequestProcessor<User>();

            string name = "banner";
            string imageMimeType = "image/" + imageType;

            RawResult = await TwitterExecutor.PostMediaAsync(accountUrl, parameters, banner, name, fileName, imageMimeType, cancelToken).ConfigureAwait(false);

            return reqProc.ProcessActionResult(RawResult, UserAction.SingleUser);
        }