/// <summary> /// Inits this instance. /// </summary> public override void Init() { this.RequestParameters.Add("image", this.imageData); this.RequestParameters.Add("include_entities", "true"); UpdateProfileBackgroundImageOptions options = this.OptionalProperties as UpdateProfileBackgroundImageOptions; if (options == null) { return; } this.RequestParameters.Add("use", options.UseImage ? "1" : "0"); if (options.Tiled.HasValue) { this.RequestParameters.Add("tiled", options.Tiled.Value ? "1" : "0"); } }
/// <summary> /// Initializes a new instance of the <see cref="UpdateProfileBackgroundImageCommand"/> class. /// </summary> /// <param name="tokens">The tokens.</param> /// <param name="image">The image.</param> /// <param name="options">The options.</param> public UpdateProfileBackgroundImageCommand(OAuthTokens tokens, byte[] image, UpdateProfileBackgroundImageOptions options) : base(HTTPVerb.POST, "", tokens, options) { if (tokens == null) { throw new ArgumentNullException("tokens"); } if ((options == null && (image == null || image.Length == 0)) || (options != null && !options.UseImage)) { throw new ArgumentException("Image data cannot be null or zero length."); } if (image != null && image.Length > 102400) { throw new ArgumentException("Image cannot exceed 800Kb in size."); } this.imageData = image; this.Multipart = true; }