Merge pull request #7373 from jonchang/sponsors-api
github: add sponsors GraphQL API
This commit is contained in:
commit
5f9fee4776
@ -480,6 +480,34 @@ module GitHub
|
|||||||
artifact.first["archive_download_url"]
|
artifact.first["archive_download_url"]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def sponsors_by_tier(user)
|
||||||
|
url = "https://api.github.com/graphql"
|
||||||
|
data = {
|
||||||
|
query: <<~EOS,
|
||||||
|
{
|
||||||
|
organization(login: "#{user}") {
|
||||||
|
sponsorsListing {
|
||||||
|
tiers(first: 100) {
|
||||||
|
nodes {
|
||||||
|
monthlyPriceInDollars
|
||||||
|
adminInfo {
|
||||||
|
sponsorships(first: 100) {
|
||||||
|
totalCount
|
||||||
|
nodes {
|
||||||
|
sponsor { login }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOS
|
||||||
|
}
|
||||||
|
open_api(url, scopes: ["admin:org", "user"], data: data, request_method: "POST")
|
||||||
|
end
|
||||||
|
|
||||||
def api_errors
|
def api_errors
|
||||||
[GitHub::AuthenticationFailedError, GitHub::HTTPNotFoundError,
|
[GitHub::AuthenticationFailedError, GitHub::HTTPNotFoundError,
|
||||||
GitHub::RateLimitExceededError, GitHub::Error, JSON::ParserError].freeze
|
GitHub::RateLimitExceededError, GitHub::Error, JSON::ParserError].freeze
|
||||||
|
Loading…
x
Reference in New Issue
Block a user