ContributorMural::GitHubApi
Inherits ContributorMural::GitHubSource < Reference < Object
Fetches users from the GitHub REST and GraphQL APIs. Contribution counts and sponsor tier amounts become user weights.
Constants
MAX_ATTEMPTS = 3
MAX_RETRY_AFTER = 30.seconds
A secondary rate limit names its own delay; anything longer than this is better spent failing with a message someone can act on.
PAGE_WINDOW = 4
How many pages of one collection may be in flight together. Enough that a thousand stargazers stop being ten round trips in a row, low enough to stay clear of the secondary rate limit that punishes bursts.
PER_PAGE = 100
SPONSORS_QUERY = "query($login: String!, $first: Int!, $after: String) {\n repositoryOwner(login: $login) {\n ... on User {\n sponsorshipsAsMaintainer(first: $first, after: $after, activeOnly: true) {\n pageInfo { hasNextPage endCursor }\n nodes {\n tier { monthlyPriceInDollars }\n sponsorEntity {\n ... on User { login name avatarUrl url }\n ... on Organization { login name avatarUrl url }\n }\n }\n }\n }\n ... on Organization {\n sponsorshipsAsMaintainer(first: $first, after: $after, activeOnly: true) {\n pageInfo { hasNextPage endCursor }\n nodes {\n tier { monthlyPriceInDollars }\n sponsorEntity {\n ... on User { login name avatarUrl url }\n ... on Organization { login name avatarUrl url }\n }\n }\n }\n }\n }\n}"
Constructors
new(token : String | Nil = nil, config : Config = Config.empty, api_base : String = "https://api.github.com", backoff_base : Time::Span = 1.second, pool : HTTPPool | Nil = nil)
SourceInstance methods
close
Hands back the connections this client opened. A no-op when the pool was handed in, since closing it would hang up on its other users.
contributors(repo : String) : Array(ResolvedUser)
Sourcemembers(org : String) : Array(ResolvedUser)
Sourcesponsors(login : String) : Array(ResolvedUser)
Sourcestargazers(repo : String) : Array(ResolvedUser)
Source