turnage / graw

Golang Reddit API Wrapper
MIT License
288 stars 49 forks source link

Get post that was just created #62

Closed gastrodon closed 4 years ago

gastrodon commented 4 years ago

Looking at method reddit.Bot.PostLink that just returns an error, I don't see an obvious way to create a post and then get an instance of that created post. Looking at the Reddit api docs for submitting posts it seems like that information is returned at post time.

Is there a way to get that information with this library?

gastrodon commented 4 years ago

This is something that I'd really like to see, so I started a fork. @turnage, are there any contributing guidelines I should follow? I did not see any in this repo

turnage commented 4 years ago

If you submit a pull request for this I will review it. Since people depend on this package, this is what I think is important:

Thank you for opening an issue and considering a contribution!

I think the hard part in adding this feature is figuring out how to extend the API in a reasonable way.

On Fri, Feb 28, 2020 at 1:04 PM Zero notifications@github.com wrote:

This is something that I'd really like to see, so I started a fork https://github.com/gastrodon/graw. @turnage https://github.com/turnage, are there any contributing guidelines I should follow? I did not see any in this repo

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/turnage/graw/issues/62?email_source=notifications&email_token=AAWR64HJPONXCIIBORN6YY3RFF37TA5CNFSM4K4PMZ32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENKE3NY#issuecomment-592727479, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAWR64FLQERJ52R3UQI2NO3RFF37TANCNFSM4K4PMZ3Q .

gastrodon commented 4 years ago

I've added the functionality in what I think is a reasonable way. I made new methods account.HarvestReply, account.HarvestSendMessage, account.HarvestPostSelf, account.HarvestPostLink that behave like the ones they are based off of, but also return a new type Submission that represents a response to a submission of some kind.

These methods use the new method harvest_sow that behaves in a similar way to sow, but instead will return a response that is parsed with a new parse method parse_submitted. I created a new parse method instead of using the existing parse because it did not look like that method was compatible with this returned data.

Existing tests pass, tests for these new methods have yet to be written. I'll probably do that in the following days, but if you'd like to peek at the fork to let me know if I'm heading in the right direction or if I'm missing something please do. Because of the way that this is implemented being different than what I assumed when I started the methods Harvest* and harvest_sow will probably be renamed`

gastrodon commented 4 years ago

oops

turnage commented 4 years ago

I've looked through the commits on your fork and I think it's mostly the right approach. If you open a pull request I'll review. Thank you for working on this!

turnage commented 4 years ago

Implemented in #64