Reddit.NET icon indicating copy to clipboard operation
Reddit.NET copied to clipboard

Fixing Emoji.UploadLeaseImage, adding missing async methods

Open MingweiSamuel opened this issue 6 years ago • 1 comments

  • Fixes #3.
  • Adds some missing async Emoji methods.
  • Moves ImageUploadInput to Inputs.Emoji namespace.

If you're curious what was wrong, it turned out that the "content-type" parameter is needed, so this line got removed:

if (!s3Field.Name.Equals("content-type", StringComparison.OrdinalIgnoreCase))

And also I think AddFileBytes might have been an issue, switched to AddFile, not sure specifically what the difference is.

MingweiSamuel avatar Sep 08 '19 08:09 MingweiSamuel

Example of how to use it: https://github.com/ChampionMains/Pyrobot/blob/5a89751bb1eebedbf61f9a9c9ff526f2feae9356/ChampionMains.Pyrobot.Infrastructure/Services/Reddit/EmojiService.cs#L38-L40

I wanted to support sync vs async, and also byte[] vs inputstream, so the actual implementation has a few layers. I also ended up taking ImageUploadInput as input, which is convenient, but it would also be possible to take the mime type from the s3 lease like the old code does. Would still need to provide file name separately though

MingweiSamuel avatar Sep 08 '19 09:09 MingweiSamuel