示例#1
0
        public dynamic EditVideo(string baseHostname, long id, Stream data = null, string caption = null, TumblrPostOptions options = null)
        {
            if (options == null)
            {
                options = new TumblrPostOptions();
            }

            FormParameters form = GetPostParameters(options);

            form.Add("caption", caption);
            if (data != null)
            {
                form.Add("data", TumblrClient.ReadBytes(data));
            }
            return(EditPost(baseHostname, id, form));
        }
示例#2
0
        public dynamic EditPhoto(string baseHostname, long id, Stream[] data = null, string caption = null, string link = null, TumblrPostOptions options = null)
        {
            if (options == null)
            {
                options = new TumblrPostOptions();
            }
            FormParameters form = GetPostParameters(options);

            if (data != null)
            {
                for (int i = 0; i < data.Length; i++)
                {
                    form.Add(String.Format("data[{0}]", i), TumblrClient.ReadBytes(data[i]));
                }
            }
            form.Add("caption", caption);
            form.Add("link", link);
            return(EditPost(baseHostname, id, form));
        }
示例#3
0
        public dynamic PostVideo(string baseHostname, Stream data, string caption = null, TumblrPostOptions options = null)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }
            if (options == null)
            {
                options = new TumblrPostOptions();
            }

            FormParameters form = GetPostParameters(options);

            form.Add("type", "video");
            form.Add("caption", caption);
            form.Add("data", TumblrClient.ReadBytes(data));
            string url = String.Format("http://api.tumblr.com/v2/blog/{0}/post", baseHostname);

            return(_tumblr.POST(new Uri(url), form));
        }
示例#4
0
        public dynamic PostPhoto(string baseHostname, Stream[] data, string caption = null, string link = null, TumblrPostOptions options = null)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }
            if (options == null)
            {
                options = new TumblrPostOptions();
            }

            FormParameters form = GetPostParameters(options);

            for (int i = 0; i < data.Length; i++)
            {
                form.Add(String.Format("data[{0}]", i), TumblrClient.ReadBytes(data[i]));
            }
            form.Add("type", "photo");
            form.Add("caption", caption);
            form.Add("link", link);
            string url = String.Format("http://api.tumblr.com/v2/blog/{0}/post", baseHostname);

            return(_tumblr.POST(new Uri(url), form));
        }