Skip to content
This repository has been archived by the owner on Apr 4, 2022. It is now read-only.

Retrieve sponsorships #2

Closed
driesvints opened this issue Aug 21, 2021 · 0 comments · Fixed by #17
Closed

Retrieve sponsorships #2

driesvints opened this issue Aug 21, 2021 · 0 comments · Fixed by #17
Assignees
Labels
enhancement New feature or request

Comments

@driesvints
Copy link
Owner

driesvints commented Aug 21, 2021

Retrieving a list of sponsorships should be a core feature of this library. With this, people can display the sponsorships on their app/website as well as do additional syncing in their app. The sponsorships on a GitHub account can be retrieved with the sponsorshipsAsMaintainer field. Ideally, you we'd hydrate a new GitHubSponsor object with the data from the GitHub account.

The api could like like this:

// Retrieve all sponsors of driesvints...
$sponsors = $client->sponsors('driesvints');

// With the Sponsorable trait...
$sponsors = $user->sponsors();

// Check if a user has sponsors...
$sponsors = $user->hasSponsors();

Which would return a lazy collection. I'd also opt to implement a cursor based paginator approach as well:

// Retrieve all sponsors of driesvints...
$sponsors = $client->paginateSponsors('driesvints');

Which would return an instance of Illuminate\Pagination\CursorPaginator. I'd also make use of BuildsWithQueries to resolve the cursor from the request for a Laravel implementation. See PaginationState.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants