GithubHelp home page GithubHelp logo

tumblrsharp's Introduction

Build status NuGet version (NewTumblrSharp)

TumblrSharp

This is a continuation of the excellent TumblrSharp C# Library developed by the community.

Documentation

Please refer to the Wiki to learn how to use TumblrSharp. A complete documentation can be found here.

Why?

TumblrSharp is a very nicely designed library, and perhaps the only usable C# library that currently exists. However, development for the Codeplex project stopped in 2014. While using the library, I've noticed several bugs which I'll fix and post to this repository.

What has been fixed in this new version?

If you download the old TumblrSharp version off of CodePlex or NuGet, you won't get any of the fixes this libary provides - most notably, support for Asks and Submissions.

  • Errors with getting submission posts and their new post state type
  • Allow posts to be sent with a published state, which is currently the only way to publish asks
  • New CreateAnswer method on PostData class allows for editing and publishing asks
  • Eliminated superfluous constructor overloads in PostData methods, allowing for shorter, more maintainable code
  • Eliminated unnecessary required parameters like title or body from a text post, as they are not required by the Tumblr API.
  • Opted for default values in PostData. This is important because specifying something simple like a PostCreationState on a photo post would require possibly unneeded data, like tags.
  • Move everything into a PCL for maximum compatibility.
  • Getting dashboard posts after a date rather than before
  • "Reblogged from" broken
  • Add Reblog Trail support

What needs to be implemented?

  • Better documentation
  • Examples of how to use the library

What will not be implemented?

  • Chat
  • Activity

(This is due to restrictions to the V2 API. These endpoints exist but can only be accessed with the official Tumblr app API key).

Roadmap

Version 1.1.*

  • Advanced testings
  • Advanced supported plattform

Version 1.2.0.*

  • NetStandard 2.0
  • supported HttpClientFactory
  • Example for Asp.Net, Azure Function
  • Api-Documentation

Version 2.0

  • Support Neues Post Format (npf)
  • Create / Edit / Fetch Post for npf

Which platforms are supported?

Contributing

Please feel free to contribute if you find any problems / have any features.

Things that are needed and would be super appreciated:

  • Bug Fixes of any kind
  • Unit Testing
  • Wiki contributions and examples

NuGet

  • You can find the latest NuGet package here. An automated build system will push a new NuGet package when a tagged commit is merged into the master branch.
  • Manual download from here, to install show wiki

License

TumblrSharp follows the MIT License.

tumblrsharp's People

Contributors

cataurus avatar ghayes7 avatar piedoom avatar rosalindwills avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

tumblrsharp's Issues

Reblog to Queue

Is there a way to reblog a post to the queue with ReblogAsync() like it is possible with CreatePostAsync() throught the PostCreationState.Queue?

Allow injection of HttpClient?

I run an application which makes a lot of simultaneous calls to the Tumblr API using this library and I'm running into what I think might be an issue with my hosting provider (Azure). Specifically, a percentage of the requests made are failing with the message A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

I've been doing some research and the most likely culprit I can find has to do with my application causing port exhaustion on my Azure server with all of the outbound connections (https://docs.microsoft.com/en-us/azure/app-service/troubleshoot-intermittent-outbound-connection-errors#cause). The suggested solution to this (https://docs.microsoft.com/en-us/aspnet/core/performance/performance-best-practices?view=aspnetcore-3.1#pool-http-connections-with-httpclientfactory) involves making use of HttpClientFactory to manage the generation of HttpClient instances to reduce the number of ports being used. Unfortunately since TumblrSharp wraps the initialization of the client used to contact Tumblr, I can't really manipulate this right now.

HttpClientFactory is a .NET Core class; I know TumblrSharp isn't a .NET Core project and I don't know if there are any plans to make it so, but would it be possible for there to be an option to inject an HttpClient from the calling project into TumblrSharp rather than having initialized inside the library? This way I could manipulate the initialization with the factory class on my own and then pass it in for TumblrSharp to do its thing with.

Queuing for image posts don't work

I am able to queue other forms

  • Text
  • Chat
  • Link
  • Quote

(Have not tried answers, audio, or video)

I am using this to try to queue:

await Tumblr.CreatePostAsync(
        "my blog", 
        PostData.CreatePhoto(
            new BinaryFile(
                ImageToByteArray(@"file location")
            ), 
            null, 
            new List<string> { "tag" }, 
            PostCreationState.Queue
        )
    );

The image is posted directly and not being queued (it's not being queued and automatically posted as it isn't meant to post and isn't happening to other submissions) so I don't think it's an issue with the above, I do not have any issues with text using PostCreationState.Queue and I am able to post an image to the queue so I don't see it being a tumblr issue.

How to use CallApiMethodAsync<> ?

Hi,

I want to extract few information from user post, how can i achieve that with CallApiMethodAsync?
I don't really understand about the converter argument,

await Client.CallApiMethodAsync(postMethod, CancellationToken, converters);

converters = an optional list of JSON converters that will be used while deserializing the response from the tumblr api

Can you give me an example?

Is there a way to queue reblogs?

ReblogAsync does not let me set a PostCreationState like CreatePostAsync, is there a way to queue the posts instead of instantly reblogging them?

allow optional parameters instead of overloading

many methods have overloaded constructors. It'd be easier to just add optional parameters, so users wont have to specify "tags" if they want to change the "state" when creating a photo post.

Tumblr.Client.CreatePostAsync() ignores linebreaks

string text = "This\nText" + Environment.NewLine + "Has\rLinebreaks"

string title = "Title"

Tumblr.Client.CreatePostAsync(Tumblr.BlogName, PostData.CreateText(text, title, tags, PostCreationState.Draft));

This snippet of code runs without issues, but the resulting post has no linebreaks.

Queued Posts

On trying to get Queued Posts by using Tumblr.Client.GetQueuedPostsAsync("blogname"); i get an AggregateException.

System.AggregateException: One or more errors occurred. ---> System.ArgumentException: Requested value 'queued' was not found.
   at System.Enum.EnumResult.SetFailure(ParseFailureKind failure, String failureMessageID, Object failureMessageFormatArgument)
   at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult)
   at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)
   at DontPanic.TumblrSharp.Client.EnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
   at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType)
   at Newtonsoft.Json.Linq.JToken.ToObject[T]()
   at DontPanic.TumblrSharp.Client.PostArrayConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)
   at DontPanic.TumblrSharp.TumblrClientBase.<CallApiMethodAsync>d__9`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at DontPanic.TumblrSharp.TumblrClientBase.<CallApiMethodAsync>d__7`2.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at tumblrsharp.Program.Debug() in D:\writeblr\tumblrsharp\tumblrsharp\Program.cs:line 342
---> (Inner Exception #0) System.ArgumentException: Requested value 'queued' was not found.
   at System.Enum.EnumResult.SetFailure(ParseFailureKind failure, String failureMessageID, Object failureMessageFormatArgument)
   at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult)
   at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)
   at DontPanic.TumblrSharp.Client.EnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
   at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType)
   at Newtonsoft.Json.Linq.JToken.ToObject[T]()
   at DontPanic.TumblrSharp.Client.PostArrayConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)
   at DontPanic.TumblrSharp.TumblrClientBase.<CallApiMethodAsync>d__9`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at DontPanic.TumblrSharp.TumblrClientBase.<CallApiMethodAsync>d__7`2.MoveNext()<---

I am not quite understanding the Authenticating guide

I have not done OAuth before and am a little confused with the bottom of /wiki/Authenticating

// this will look different depending on what your platform uses to open URI schemes
[SomeFlagThatTellsThisMethodWhatToOpen]

I am just trying to make a private bot which will run on a server - so first I don't want a browser window to open and second I don't need a flexible solution, I just want it to verify and skip the security.

Sync methods?

When doing non-interactive apps things are much simplified without having to think about the world of async and the task pattern.

.Result can always be used, which is what I've done before, but is there any plan to just include sync versions for consumption?

Switch to flurl

Microsoft's http library is not compatible with our PCL. Switch to Flurl.

Exception on Reblogging

Here is the exception message.
System.IO.FileLoadException: 'Could not load file or assembly 'SshNet.Security.Cryptography, Version=1.3.0.0, Culture=neutral, PublicKeyToken=2fa9220ff3eadda4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'

CreateLink

Hello.
When I use this method - thumbnail does not appear.
But when I put it manually via dashboard - it appeared.
Could you help me to make something so thumbnail appears?

Looking for contributors!

I began this project to fix a few problems I saw with the original library. While I'm very knowledgeable about the Tumblr API, I struggle with language tooling and need some help to keep this project afloat.

If you are interested in becoming a contributor, either send me mail or create a comment below with other repositories that you have created or currently maintain. Thanks!

windows 10UAP compatiblity

I've used Tumblr# the original with windows 8, as a windows store app.
Now I'm trying to fix/rebuild it for UAP10 (windows 10 store) and basically can't get it to even let me add it into my project. I get a combination of newtumblrsharp isn't compatible as well as PCL and a bunch of other ones.
Is there a workaround, am I being an idiot? Is there a new guide? with a little more direction that may enlighten me? Or is it just not compatible and it was a miracle I got it to work in 8? LOL

Tumblr.Client.FollowAsync Bad Request

After trying a while, I found out that I can get almost everything to work, except for Tumblr.Client.FollowAsync() and Tumblr.Client.ReblogAsync().
LikeAsync works, getting posts works, and posting works too, but the line await Tumblr.Client.FollowAsync("tumblrblog"); gives me the error shown below.

I have tried in an async void and a non async one, and only async voids give an exception, otherwise it just passes and does nothing at all.

DontPanic.TumblrSharp.TumblrException: Bad Request
   at DontPanic.TumblrSharp.TumblrClientBase.<CallApiMethodAsync>d__9`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at tumblrsharp.Program.<Debug>d__10.MoveNext() in D:\writeblr\tumblrsharp\tumblrsharp\Program.cs:line 341

Accessing raw response data

Thanks for the great library!

When I download posts from Tumblr, I extract what I need and store it in my database. However, I'd also like to store the response data as-is, in case I need something else from them later.

I haven't found any way to access the raw response data, so I thought I could work around it by serializing it with Newtonsoft.Json.JsonConvert.SerializeObject().
This works well when the post type is Quote, but for a Text post, I get an exception:

The method or operation is not implemented.

   at DontPanic.TumblrSharp.Client.TrailThemeConverter.WriteJson(JsonWriter writer, Object value, JsonSerializer serializer)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeConvertable(JsonWriter writer, JsonConverter converter, Object value, JsonContract contract, JsonContainerContract collectionContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
   at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)
   at Newtonsoft.Json.JsonConvert.SerializeObjectInternal(Object value, Type type, JsonSerializer jsonSerializer)
   at assembly.method() in D:\path\to\filecs:line 62

Either of those (serialization or access to response data) would be great for me. Maybe I'm just missing something?

TumblrException: Unauthorized

Upon calling Tumblr.Client.GetFollowersAsync(Tumblr.BlogName, followerNumber, 20).Result.Result; i get the error System.AggregateException: 'One or more errors occurred. Inner Exception, TumblrException: Unauthorized.
I have checked, my Keys and Tokens are up to date and correct, but the script i wrote does not post (anymore!) or interact at all with Tumblr. This is however the only error I get, and posting seems to work flawlessly - even tho no actual post gets created.

Conflict with MSCORLIB

The type 'HMACSHA1' exists in both 'bouncy_castle_hmac_sha_pcl, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' and 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' SocialMediaPoster

I cannot reference MSCORLIB in the other section of my application that relies on this. Is there a specific reason why you (or the developer) implemented bouncy_castle's System.Security.Cryptography.HMACSHA1 that causes conflicts with baked-in references?

No error message but no post

The application gives me no error message that the authentication failed or any other error message, and it worked a day ago with the exact same code, but now it doesn't post, like, or reblog anything anymore.

I didn't change any code, nor are there any errors, and I tried with several different (known to be working) keys and tokens.

What could this be? Where could i start debugging?

System.TypeLoadException: Failure has occurred while loading a type

{System.TypeLoadException: Failure has occurred while loading a type. at ShadeAdminClient.TumblrDashboardController+<GetDashBoardPost>c__async0.MoveNext () [0x0002c] in /Users/UZU/Projects/ShadeAdminClient/ShadeAdminClient/TumblrDashboardController.cs:15 ---โ€ฆ}

while following the wiki documention.

Bug: GetPostAsync

...
			return CallApiMethodAsync<Posts, BasePost>(
				new BlogMethod("dummy", "posts", null, HttpMethod.Get, parameters),
				p => p.Result.FirstOrDefault(),
				CancellationToken.None);

The function with the value "dummy" for the parameter blogname always delivers "not found".

My Change:

		/// <summary>
		/// Asynchronously retrieves a specific post by id.
		/// </summary>
		/// <param name="blogName">
		/// The name of the blog associated with the id of the post
		/// </param>
		/// <param name="id">
		/// The id of the post to retrieve.
		/// </param>
		/// <param name="includeReblogInfo">
		/// Whether or not to include reblog info with the posts.
		/// </param>
		/// <param name="includeNotesInfo">
		/// Whether or not to include notes info with the posts.
		/// </param>
		/// <returns>
		/// A <see cref="Task{T}"/> that can be used to track the operation. If the task succeeds, the <see cref="Task{T}.Result"/> will
		/// carry a <see cref="BasePost"/> instance representing the desired post. Otherwise <see cref="Task.Exception"/> will carry a 
		/// <see cref="TumblrException"/> if the post with the specified id cannot be found.
		/// </returns>
		/// <exception cref="ObjectDisposedException">
		/// The object has been disposed.
		/// </exception>
		/// <exception cref="ArgumentNullException">
		/// <paramref name="blogName"/> is null or empty
		/// </exception>
		/// <exception cref="System.ArgumentOutOfRangeException">
		///	<paramref name="id"/> is less than 0.
		/// </exception>
		public Task<BasePost> GetPostAsync(string blogName, long id, bool includeReblogInfo = false, bool includeNotesInfo = false)
		{
			if (disposed)
				throw new ObjectDisposedException("TumblrClient");

			if ((blogName == null) || (blogName == string.Empty))
				throw new ArgumentNullException("blogName", "Blog name cannot be empty or null.");

			if (id < 0)
				throw new ArgumentOutOfRangeException("id", "id must be greater or equal to zero.");

			MethodParameterSet parameters = new MethodParameterSet();
			parameters.Add("api_key", apiKey);
			parameters.Add("id", id, 0);
			parameters.Add("reblog_info", includeReblogInfo, false);
			parameters.Add("notes_info", includeNotesInfo, false);

			return CallApiMethodAsync<Posts, BasePost>(
				new BlogMethod(blogName, "posts", null, HttpMethod.Get, parameters),
				p => p.Result.FirstOrDefault(),
				CancellationToken.None);
		}

see in API - Referenz blog-identifier is required

Sorry for my bad english

Newbie - how to show Posts via GetPostsAsync?

I have the following code, but I have no idea how to actually display what is returned?
How do I get to the items returned?

Many thanks Simon

public class NewsController : Controller
    {
        public static TumblrClient oClient;

        private async Task<Posts> GetPosts()
        {
            oClient = new TumblrClientFactory().Create<TumblrClient>(Settings.GetString("Tumblr_ConsumerKey"), Settings.GetString("Tumblr_ConsumerSecret"), new DontPanic.TumblrSharp.OAuth.Token(Settings.GetString("Tumblr_Token"), Settings.GetString("Tumblr_TokenSecret")));

            var oPosts = await oClient.GetPostsAsync("http://bloodballreptiles.tumblr.com/", 0, 20);
            return oPosts;
        }

        // GET: News
        public ActionResult Index()
        {
            ViewBag.Posts = GetPosts();
            
            return View();
        }
    }`

No exception / error message when creating post

Hi,

I'm trying to create a post using below code:

_client.CreatePostAsync("myblog.tumblr.com", PostData.CreateText("adwqeqweasd"));

Here's the client set up:

CONSUMER_KEY = "xxx"; CONSUMER_SECRET = "xxx"; OAUTH_TOKEN = "xxx"; OAUTH_TOKEN_SECRET = "xxx";
_client = new TumblrClientFactory().Create<TumblrClient>(CONSUMER_KEY, CONSUMER_SECRET, new DontPanic.TumblrSharp.OAuth.Token(OAUTH_TOKEN, OAUTH_TOKEN_SECRET));

I'm not sure if the format of the blog string is correct. I tried using "myblog". "myblog.tumblr.com" and "https://myblog.tumblr.com/". There are no error messages at all and OAuthToken.IsValid inside _client is 'true'. The blog I'm targetting is the only primary blog in my account. Leaving a blank string does trigger error message "Blog name cannot be empty" but other than that, there are no error messages which might explain what could be going wrong here. I would say auth seems OK.

Should I use the email and password somewhere or is it not needed after specifying the four secret keys?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.