antfu-collective/sponsorkit

Patreon Support

ghostdevv opened this issue · 10 comments

Is it possible for this to have patreon support or is it out of scope?

antfu commented

I don't use Patreon myself so I would need some help. Ideally, I think it would be great for Sponsorkit to support multiple platforms including Patreon, Open Collective, Kofi, etc. So PR welcome :)

Yea I can make a pr, in terms of the api for the developer how would you imagine this looking? From what I can tell all services would need to provide the persons name, avatar, and tier. So maybe there could be some sort of "provider" api

antfu commented

Yeah, providers sound good. And normalize their result into a unified format would be great.

So I have read the codebase and doing this is definitely possible, it would just take a bit of refactoring. The main things I see that would need doing are the following:

  • Creating a providers api, a user would need to be able to provide options to this (for authentication details etc). Would be curious if you have any thought about how that could look in the config.

  • The provider would need to be able fetch the data from a source, and then put that in a unified source - from what I can tell this is the easy part as mostly things are typed generically. There are quite a lot of github specific loc in the codebase though so that would need to be moved to it's provider

I can definitely submit a pr for this it's just a lot of refactoring so wanna get your opinions and ideas on how it should be done when you have some time!

antfu commented

I have refactor the code to have the provider interface, hope that would make it easier for you
https://github.com/antfu/sponsorkit/releases/tag/v0.2.0

Awesome thank you!! I did some work on it today but patreon's api is the worst, spent 4 hours figuring it out to have a issue with downloading images :/ Should be able to finish it up this weekend

bluwy commented

FWIW I have a similar project using the Patreon API too, requiring two fetches. I could submit a PR too when I find some time.

Awesome @bluwy , I got quite far with my pr for this project but had a blocker with the downloading of images I haven't found time to look at yet :/

bluwy commented

Submitted #15 I didn't have issues with downloading images though

Thank you! I glad you done this as I really couldn't figure out the image issues 😅