/// <summary> /// Gets an instance of <see cref="IHttpPostData"/> representing the POST parameters. /// </summary> /// <returns>An instance of <see cref="IHttpPostData"/>.</returns> public IHttpPostData GetPostData() { if (String.IsNullOrWhiteSpace(Name)) { throw new ArgumentNullException(nameof(Name)); } IHttpPostData data = new HttpPostData(); data.Set("name", Name); data.Set("mode", StringUtils.ToCamelCase(Mode)); if (!String.IsNullOrWhiteSpace(Description)) { data.Add("description", Description); } return(data); }
/// <summary> /// Gets an instance of <see cref="IHttpPostData"/> representing the POST parameters. /// </summary> /// <returns>An instance of <see cref="IHttpPostData"/>.</returns> public IHttpPostData GetPostData() { // Validate required properties if (String.IsNullOrWhiteSpace(Status)) { throw new PropertyNotSetException(nameof(Status)); } // Initialize a new instance with required parameters IHttpPostData data = new HttpPostData(); data.Set("status", Status); // Append optional parameters to be POST data if (ReplyTo > 0) { data.Add("in_reply_to_status_id", ReplyTo); } if (IsPossiblySensitive) { data.Add("possibly_sensitive", "true"); } if (Math.Abs(Latitude) > Double.Epsilon && Math.Abs(Longitude) > Double.Epsilon) { data.Add("lat", Latitude); data.Add("long", Longitude); } if (PlaceId != null) { data.Add("place_id", PlaceId); } if (DisplayCoordinates) { data.Add("display_coordinates", "true"); } return(data); }