maticzav / sponsorsme

A lightweight utility to check whether a user sponsors you.
MIT License
14 stars 1 forks source link

Support OpenCollective sponsors #3

Open maticzav opened 3 years ago

maticzav commented 3 years ago

We should add methods that support querying https://opencollective.com sponsors of an account.

https://github.com/opencollective/opencollective-bot/blob/master/src/collective.ts

maticzav commented 3 years ago

https://graphql-docs-v2.opencollective.com

We want to query account https://graphql-docs-v2.opencollective.com/account.doc and make an inline fragment for collective and then check transactions that were made by an account with a certain name https://graphql-docs-v2.opencollective.com/transaction.doc.

const sponsors = Sponsors({
  token: 'bearer <token>',
  collective: '<name>'
})

const sponsor = await sponsors.getInfo('maticzav')

I am not entirely sure who to consider an active backer. It seems like we could rely on information in collective members and see if there's an account with a given name that's a backer, but I'd also want to see how much do they sponsor. We could get that data from the last monthly transaction.