Exemplo n.º 1
0
        public string Post(string message, JodelPost.PostColor color = JodelPost.PostColor.Random, bool home = false)
        {
            string postId = MyJodel.Post(message, color: color, home: home);

            JodelPosts = MyJodel.GetPostLocationCombo();
            return(postId);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Posts a Jodel and returns the PostId
        /// </summary>
        /// <param name="message">Text to post to Jodel</param>
        /// <param name="parentPostId">Comment to this post</param>
        /// <param name="color">Color of Jodel</param>
        /// <param name="image">Image to be sent</param>
        /// <param name="home">Post at home</param>
        /// <param name="proxy">The proxy to use</param>
        /// <returns>PostId</returns>
        public string Post(string message, string parentPostId = null, JodelPost.PostColor color = JodelPost.PostColor.Random, byte[] image = null, bool home = false, WebProxy proxy = null)
        {
            JsonRequestPostJodel payload = new JsonRequestPostJodel
            {
                location =
                {
                    city            = Account.CityName,
                    name            = Account.CityName,
                    country         = Account.CountryCode,
                    loc_coordinates =
                    {
                        lat = Account.Place.Latitude,
                        lng = Account.Place.Longitude
                    }
                },
                color    = color.ToString(),
                message  = message,
                ancestor = parentPostId,
                to_home  = home,
                image    = image == null ? null : Convert.ToBase64String(image)
            };
            string jsonString = Links.SendPost.ExecuteRequest(Account, payload: payload, proxy: proxy);

            JsonPostJodel.RootObject data = JsonConvert.DeserializeObject <JsonPostJodel.RootObject>(jsonString);
            return(data.post_id);
        }