github 0.23 → 0.30.0.2
raw patch · 129 files changed
Files
- CHANGELOG.md +290/−76
- README.md +29/−29
- fixtures/actions/artifact.json +19/−0
- fixtures/actions/artifacts-list.json +43/−0
- fixtures/actions/cache-list.json +14/−0
- fixtures/actions/org-cache-usage.json +4/−0
- fixtures/actions/org-public-key.json +4/−0
- fixtures/actions/org-secrets-list.json +18/−0
- fixtures/actions/repo-cache-usage.json +5/−0
- fixtures/actions/selected-repositories-for-secret.json +72/−0
- fixtures/actions/workflow-job.json +113/−0
- fixtures/actions/workflow-list.json +17/−0
- fixtures/actions/workflow-runs-list.json +665/−0
- fixtures/pull-request-approved-review.json +38/−0
- fixtures/pull-request-pending-review.json +37/−0
- fixtures/pull-request-team-review-requested.json +362/−0
- github.cabal +84/−53
- spec/GitHub/Actions/ArtifactsSpec.hs +66/−0
- spec/GitHub/Actions/CacheSpec.hs +53/−0
- spec/GitHub/Actions/SecretsSpec.hs +50/−0
- spec/GitHub/Actions/WorkflowJobSpec.hs +32/−0
- spec/GitHub/Actions/WorkflowRunsSpec.hs +32/−0
- spec/GitHub/Actions/WorkflowSpec.hs +32/−0
- spec/GitHub/ActivitySpec.hs +1/−2
- spec/GitHub/CommitsSpec.hs +8/−12
- spec/GitHub/EventsSpec.hs +2/−2
- spec/GitHub/IssuesSpec.hs +32/−7
- spec/GitHub/OrganizationsSpec.hs +5/−4
- spec/GitHub/PublicSSHKeysSpec.hs +5/−6
- spec/GitHub/PullRequestReviewsSpec.hs +2/−2
- spec/GitHub/PullRequestsSpec.hs +22/−4
- spec/GitHub/ReleasesSpec.hs +0/−1
- spec/GitHub/ReposSpec.hs +17/−11
- spec/GitHub/ReviewDecodeSpec.hs +25/−0
- spec/GitHub/SearchSpec.hs +13/−4
- spec/GitHub/UsersSpec.hs +12/−12
- src/GitHub.hs +141/−27
- src/GitHub/Auth.hs +15/−7
- src/GitHub/Data.hs +20/−6
- src/GitHub/Data/Actions/Artifacts.hs +76/−0
- src/GitHub/Data/Actions/Cache.hs +78/−0
- src/GitHub/Data/Actions/Common.hs +33/−0
- src/GitHub/Data/Actions/Secrets.hs +141/−0
- src/GitHub/Data/Actions/WorkflowJobs.hs +100/−0
- src/GitHub/Data/Actions/WorkflowRuns.hs +91/−0
- src/GitHub/Data/Actions/Workflows.hs +62/−0
- src/GitHub/Data/Activities.hs +31/−27
- src/GitHub/Data/Comments.hs +20/−13
- src/GitHub/Data/Content.hs +32/−28
- src/GitHub/Data/Definitions.hs +132/−25
- src/GitHub/Data/DeployKeys.hs +2/−2
- src/GitHub/Data/Deployments.hs +12/−16
- src/GitHub/Data/Email.hs +4/−9
- src/GitHub/Data/Enterprise.hs +9/−0
- src/GitHub/Data/Enterprise/Organizations.hs +59/−0
- src/GitHub/Data/Events.hs +5/−9
- src/GitHub/Data/Gists.hs +38/−11
- src/GitHub/Data/GitData.hs +34/−39
- src/GitHub/Data/Id.hs +1/−6
- src/GitHub/Data/Invitation.hs +6/−11
- src/GitHub/Data/Issues.hs +15/−18
- src/GitHub/Data/Milestone.hs +6/−11
- src/GitHub/Data/Name.hs +1/−11
- src/GitHub/Data/Options.hs +365/−32
- src/GitHub/Data/PublicSSHKeys.hs +3/−3
- src/GitHub/Data/PullRequests.hs +22/−22
- src/GitHub/Data/RateLimit.hs +29/−11
- src/GitHub/Data/Reactions.hs +78/−0
- src/GitHub/Data/Releases.hs +4/−4
- src/GitHub/Data/Repos.hs +255/−117
- src/GitHub/Data/Request.hs +45/−14
- src/GitHub/Data/Reviews.hs +9/−16
- src/GitHub/Data/Search.hs +19/−16
- src/GitHub/Data/Statuses.hs +7/−9
- src/GitHub/Data/Teams.hs +52/−49
- src/GitHub/Data/URL.hs +2/−7
- src/GitHub/Data/Webhooks.hs +53/−34
- src/GitHub/Data/Webhooks/Validate.hs +1/−4
- src/GitHub/Endpoints/Actions/Artifacts.hs +61/−0
- src/GitHub/Endpoints/Actions/Cache.hs +66/−0
- src/GitHub/Endpoints/Actions/Secrets.hs +221/−0
- src/GitHub/Endpoints/Actions/WorkflowJobs.hs +58/−0
- src/GitHub/Endpoints/Actions/WorkflowRuns.hs +181/−0
- src/GitHub/Endpoints/Actions/Workflows.hs +68/−0
- src/GitHub/Endpoints/Activity/Events.hs +1/−4
- src/GitHub/Endpoints/Activity/Notifications.hs +5/−18
- src/GitHub/Endpoints/Activity/Starring.hs +1/−44
- src/GitHub/Endpoints/Activity/Watching.hs +8/−37
- src/GitHub/Endpoints/Enterprise/Organizations.hs +25/−0
- src/GitHub/Endpoints/Gists.hs +6/−55
- src/GitHub/Endpoints/Gists/Comments.hs +1/−21
- src/GitHub/Endpoints/GitData/Blobs.hs +1/−21
- src/GitHub/Endpoints/GitData/Commits.hs +1/−14
- src/GitHub/Endpoints/GitData/References.hs +9/−49
- src/GitHub/Endpoints/GitData/Trees.hs +1/−35
- src/GitHub/Endpoints/Issues.hs +3/−63
- src/GitHub/Endpoints/Issues/Comments.hs +1/−57
- src/GitHub/Endpoints/Issues/Events.hs +1/−50
- src/GitHub/Endpoints/Issues/Labels.hs +7/−152
- src/GitHub/Endpoints/Issues/Milestones.hs +1/−40
- src/GitHub/Endpoints/Organizations.hs +1/−34
- src/GitHub/Endpoints/Organizations/Members.hs +9/−39
- src/GitHub/Endpoints/Organizations/OutsideCollaborators.hs +18/−0
- src/GitHub/Endpoints/Organizations/Teams.hs +1/−131
- src/GitHub/Endpoints/PullRequests.hs +1/−130
- src/GitHub/Endpoints/PullRequests/Comments.hs +12/−31
- src/GitHub/Endpoints/PullRequests/Reviews.hs +4/−96
- src/GitHub/Endpoints/RateLimit.hs +1/−18
- src/GitHub/Endpoints/Reactions.hs +60/−0
- src/GitHub/Endpoints/Repos.hs +4/−201
- src/GitHub/Endpoints/Repos/Collaborators.hs +10/−42
- src/GitHub/Endpoints/Repos/Comments.hs +1/−53
- src/GitHub/Endpoints/Repos/Commits.hs +1/−68
- src/GitHub/Endpoints/Repos/Contents.hs +1/−86
- src/GitHub/Endpoints/Repos/DeployKeys.hs +0/−24
- src/GitHub/Endpoints/Repos/Deployments.hs +0/−2
- src/GitHub/Endpoints/Repos/Forks.hs +1/−21
- src/GitHub/Endpoints/Repos/Invitations.hs +1/−4
- src/GitHub/Endpoints/Repos/Releases.hs +0/−61
- src/GitHub/Endpoints/Repos/Statuses.hs +1/−33
- src/GitHub/Endpoints/Repos/Webhooks.hs +1/−42
- src/GitHub/Endpoints/Search.hs +14/−59
- src/GitHub/Endpoints/Users.hs +8/−29
- src/GitHub/Endpoints/Users/Emails.hs +1/−21
- src/GitHub/Endpoints/Users/Followers.hs +1/−21
- src/GitHub/Endpoints/Users/PublicSSHKeys.hs +0/−30
- src/GitHub/Enterprise.hs +19/−0
- src/GitHub/Internal/Prelude.hs +24/−55
- src/GitHub/Request.hs +165/−60
CHANGELOG.md view
@@ -1,113 +1,287 @@+## Changes for 0.30.0.2++_2026-03-12, Andreas Abel_++- Fixed issue [#531](https://github.com/haskell-github/github/issues/531)+ (Norfairking, PR [#532](https://github.com/haskell-github/github/pull/532)).+- Allow `http-client-tls-0.4`.++Tested with GHC 8.2 - 9.14.1.++## Changes for 0.30.0.1++_2025-08-27, Andreas Abel_++- Drop dependencies `deepseq-generics` and `transformers-compat`.+- Remove obsolete `deriving Typeable`.++Tested with GHC 8.2 - 9.14 alpha1.++## Changes for 0.30++_2025-05-09, Andreas Abel, Peace edition_++- Organization membership endpoint (Domen Kožar, PR [#487](https://github.com/haskell-github/github/pull/487)).+- Allow JWT as an authentication method (Tom Sydney Kerckhove, PR [#497](https://github.com/haskell-github/github/pull/497)).+- Support pagination (Tom McLaughlin, PR [#503](https://github.com/haskell-github/github/pull/503)).+- Initial subset of Reactions endpoints (Dan Rijks, PR [#509](https://github.com/haskell-github/github/pull/509)).+- Fix `getNotifications` (maralorn, PR [#511](https://github.com/haskell-github/github/pull/511)).+- Add missing `name` field to `WorkflowJobs` `Job` type (Hugh Davidson, PR [#518](https://github.com/haskell-github/github/pull/518)).+- Add `StateReasonDuplicate` to `IssueStateReason` (PR [#523](https://github.com/haskell-github/github/pull/523)).+- Drop support for GHC 8.0 and below.+- Drop dependency `time-compat`.++Tested with GHC 8.2 - 9.12.2.+++## Changes for 0.29++_2023-06-24, Andreas Abel, Midsommar edition_++- Support for the GitHub Actions API+ (PR [#459](https://github.com/haskell-github/github/pull/459)):+ * New endpoint modules `GitHub.EndPoints.Actions.Artifacts`, `.Cache`,+ `.Secrets`, `.Workflows`, `.WorkflowRuns`, `.WorkflowJobs`.+ * Matching data structure modules `GitHub.Data.Actions.*`.++- Add field `issueStateReason` of type `Maybe IssueStateReason` to `Issue`+ with possible values `completed`, `not_planned` and `reopened`+ (PR [#496](https://github.com/haskell-github/github/pull/496)).++Tested with GHC 7.8 - 9.6.2++## Changes for 0.28.0.1++_2022-07-23, Andreas Abel_++Tested with GHC 7.8 - 9.4.1 alpha3++- Drop unused dependency `vector-instances`.+- Allow latest: `aeson-2.1`, `mtl-2.3`, `vector-0.13`, `transformers-0.6`.++## Changes for 0.28++_2022-04-30, Andreas Abel, Valborg edition_++Tested with GHC 7.8 - 9.2.2++- Add constructors to `IssueRepoMod` that allow filtering issues by+ milestone, assignee, creator, mentioned user:+ `GitHub.Data.Options.options{Milestone,Assignee,Creator,Mentioned}`+ (PR [#470](https://github.com/haskell-github/github/pull/470))++- Add permissions field to `Repo`.+ This adds record `RepoPermissions` and field `Repo.repoPermissions`+ in module `GitHub.Data.Repos`.+ (PR [#476](https://github.com/haskell-github/github/pull/476))++- Add unwatch request `GitHub.Endpoints.Activity.Watching.unwatchRepoR`+ (PR [#473](https://github.com/haskell-github/github/pull/473))++Breaking change:++- Make searches paginated+ (PR [#474](https://github.com/haskell-github/github/pull/474)):+ * Adds record `GitHub.Data.Repos.CodeSearchRepo`.+ * Adds argument `FetchCount`+ to `GitHub.Endpoints.Search.search{Repos,Code,Issues,Users}R`.++## Changes for 0.27++_2021-10-10, Oleg Grenrus_++- Add vector of `SimpleTeam` in "requested_teams" field of `PullRequest`+ [#453](https://github.com/haskell-github/github/pull/453)+- Add endpoint to create gist+ [#455](https://github.com/haskell-github/github/pull/455)+- Update `RepoWebhookEvent`+ [#461](https://github.com/haskell-github/github/pull/461)+- `PullRequest` Reviews may not have submitted_at field+ [#450](https://github.com/haskell-github/github/pull/450)++## Changes for 0.26++_2020-05-26, Oleg Grenrus_++- Generalize `PagedQuery` to allow its reuse by preview github APIs+ [#439](https://github.com/haskell-github/github/pull/439)+- Add endpoint for listing organizations outside collaborators+ [#445](https://github.com/haskell-github/github/pull/445)+- Add endpoint for users search+ [#444](https://github.com/haskell-github/github/pull/444)+- Make `repoWebhookResponseStatus` optional+ [#436](https://github.com/haskell-github/github/pull/436)+- Teams improvements+ [#417](https://github.com/haskell-github/github/pull/417)+- Add `deleteReference` endpoint+ [#388](https://github.com/haskell-github/github/pull/388)++## Changes for 0.25++_2020-02-18, Oleg Grenrus_++- Add `executeRequestWithMgrAndRes`+ [#421](https://github.com/haskell-github/github/pull/421)+- Add `limitsFromHttpResponse`+ [#421](https://github.com/haskell-github/github/pull/421)+- Add label descriptions+ [#418](https://github.com/haskell-github/github/pull/418)+- Add "draft" option to mergeable state+ [#431](https://github.com/haskell-github/github/pull/431)+- Use `IssueNumber` in `editIssueR` and `issueR`+ [#429](https://github.com/haskell-github/github/pull/429)+- Manage orgs in GitHub Enterprise+ [#420](https://github.com/haskell-github/github/pull/420)+- Add support for collaborator permission endpoint+ [#425](https://github.com/haskell-github/github/pull/425)+- Add support for the comment reply endpoint+ [#424](https://github.com/haskell-github/github/pull/424)+- Organise exports in `GitHub`+ [#430](https://github.com/haskell-github/github/pull/430)++## Changes for 0.24++_2019-11-27, Oleg Grenrus_++**Major change**:+Introduce `github` n-ary combinator to hoist `... -> Request rw res`+into `... -> IO (Either Error res)` (i.e. n-ary `executeRequest`).+With that in place drop `.. -> IO (Either Error res)` functions.++This reduces symbol bloat in the library.+[#415](https://github.com/haskell-github/github/pull/415)++- Remove double `withOpenSSL`+ [#414](https://github.com/haskell-github/github/pull/414)+- Pull requests reviews API uses issue number+ [#409](https://github.com/haskell-github/github/pull/409)+- Update `Repo`, `NewRepo` and `EditRepo` data types+ [#407](https://github.com/haskell-github/github/pull/407)+ ## Changes for 0.23 +_2019-10-01, Oleg Grenrus_+ - Escape URI paths- [#404](https://github.com/phadej/github/pull/404)-- Add OwnerBot to OwnerType- [#399](https://github.com/phadej/github/pull/399)-- Make File.fileSha optional- [#392](https://github.com/phadej/github/pull/392)+ [#404](https://github.com/haskell-github/github/pull/404)+- Add `OwnerBot` to `OwnerType`+ [#399](https://github.com/haskell-github/github/pull/399)+- Make `File.fileSha` optional+ [#392](https://github.com/haskell-github/github/pull/392) - Update User-Agent to contain up to date version- [#403](https://github.com/phadej/github/pull/403)- [#394](https://github.com/phadej/github/pull/394)+ [#403](https://github.com/haskell-github/github/pull/403)+ [#394](https://github.com/haskell-github/github/pull/394) ## Changes for 0.22 +_2019-05-31, Oleg Grenrus_+ - Type-class for various auth methods- [#365](https://github.com/phadej/github/pull/365)+ [#365](https://github.com/haskell-github/github/pull/365) - Throw on non-200 responses- [#350](https://github.com/phadej/github/pull/350)+ [#350](https://github.com/haskell-github/github/pull/350) - Add extension point for (preview) media types- [#370](https://github.com/phadej/github/pull/370)+ [#370](https://github.com/haskell-github/github/pull/370) - Add missing webhook event types- [#359](https://github.com/phadej/github/pull/359)+ [#359](https://github.com/haskell-github/github/pull/359) - Add invitation endpoint- [#360](https://github.com/phadej/github/pull/360)+ [#360](https://github.com/haskell-github/github/pull/360) - Add notifications endpoints- [#324](https://github.com/phadej/github/pull/324)+ [#324](https://github.com/haskell-github/github/pull/324) - Add ssh keys endpoints- [#363](https://github.com/phadej/github/pull/365)+ [#363](https://github.com/haskell-github/github/pull/365) - Case insensitive enum parsing- [#373](https://github.com/phadej/github/pull/373)+ [#373](https://github.com/haskell-github/github/pull/373) - Don't try parse unitary responses- [#377](https://github.com/phadej/github/issues/377)+ [#377](https://github.com/haskell-github/github/issues/377) - Update dependencies- [#364](https://github.com/phadej/github/pull/364)- [#368](https://github.com/phadej/github/pull/368)- [#369](https://github.com/phadej/github/pull/369)+ [#364](https://github.com/haskell-github/github/pull/364)+ [#368](https://github.com/haskell-github/github/pull/368)+ [#369](https://github.com/haskell-github/github/pull/369) - Documentation improvements- [#357](https://github.com/phadej/github/pull/357)+ [#357](https://github.com/haskell-github/github/pull/357) ## Changes for 0.21 +_2019-02-18, Oleg Grenrus_+ - Refactor `Request` type.- [#349](https://github.com/phadej/github/pull/349)+ [#349](https://github.com/haskell-github/github/pull/349) - Allow `http-client-0.6`- [#344](https://github.com/phadej/github/pull/344)+ [#344](https://github.com/haskell-github/github/pull/344) - Change to use `cryptohash-sha1` (`cryptohash` was used before)-- Add Create milestone endponts- [#337](https://github.com/phadej/github/pull/337)-- Make fileBlobUrl and fileRawUrl are optional- [#339](https://github.com/phadej/github/issues/339)- [#340](https://github.com/phadej/github/pull/340)-- Add organizationsR to request user organizations- [#345](https://github.com/phadej/github/pull/345)-- Add updateMilestoneR, deleteMilestoneR- [#338](https://github.com/phadej/github/pull/338)-- Allow multiple assignees in NewIssue and EditIssue- [#336](https://github.com/phadej/github/pull/336)+- Add Create milestone endpoints+ [#337](https://github.com/haskell-github/github/pull/337)+- Make `fileBlobUrl` and `fileRawUrl` optional+ [#339](https://github.com/haskell-github/github/issues/339)+ [#340](https://github.com/haskell-github/github/pull/340)+- Add `organizationsR` to request user organizations+ [#345](https://github.com/haskell-github/github/pull/345)+- Add `updateMilestoneR`, `deleteMilestoneR`+ [#338](https://github.com/haskell-github/github/pull/338)+- Allow multiple assignees in `NewIssue` and `EditIssue`+ [#336](https://github.com/haskell-github/github/pull/336) - Add `pullRequestPatchR` and `pullRequestDiffR`- [#325](https://github.com/phadej/github/pull/325)+ [#325](https://github.com/haskell-github/github/pull/325) ## Changes for 0.20 +_2018-09-26, Oleg Grenrus_+ - Add ratelimit endpoint- [#315](https://github.com/phadej/github/pull/315)+ [#315](https://github.com/haskell-github/github/pull/315) - Add some deployment endoints- [#330](https://github.com/phadej/github/pull/330)+ [#330](https://github.com/haskell-github/github/pull/330) - Add webhook installation events- [#329](https://github.com/phadej/github/pull/330)-- Tigthen lower bounds (also remove aeson-compat dep)- [#332](https://github.com/phadej/github/pull/332)+ [#329](https://github.com/haskell-github/github/pull/330)+- Tighten lower bounds (also remove `aeson-compat` dep)+ [#332](https://github.com/haskell-github/github/pull/332) ## Changes for 0.19 +_2018-02-19, Oleg Grenrus_+ - Fix issue event type enumeration- [#301](https://github.com/phadej/github/issues/301)-- Include label info in `IssseEvent`- [#302](https://github.com/phadej/github/issues/302)+ [#301](https://github.com/haskell-github/github/issues/301)+- Include label info in `IssueEvent`+ [#302](https://github.com/haskell-github/github/issues/302) - Fix `ShowRepo` example- [#306](https://github.com/phadej/github/pull/306)+ [#306](https://github.com/haskell-github/github/pull/306) - Add "Get archive link" API- [#307](https://github.com/phadej/github/pull/307)-- Make "repo" in PullRequestCommit nullable (repository can be gone)- [#311](https://github.com/phadej/github/pull/311)-- Add read-only emails endpoint- [#313](https://github.com/phadej/github/pull/313)+ [#307](https://github.com/haskell-github/github/pull/307)+- Make "repo" in `PullRequestCommit` nullable (repository can be gone)+ [#311](https://github.com/haskell-github/github/pull/311)+- Add read-only emails endpoint+ [#313](https://github.com/haskell-github/github/pull/313) - Organisation membership API- [#312](https://github.com/phadej/github/pull/312)-- Fix isPullRequestMerged and other boolean responses- [#312](https://github.com/phadej/github/pull/312)+ [#312](https://github.com/haskell-github/github/pull/312)+- Fix `isPullRequestMerged` and other boolean responses+ [#312](https://github.com/haskell-github/github/pull/312) - Add `behind` pull request mergeable state- [#308](https://github.com/phadej/github/pull/308)+ [#308](https://github.com/haskell-github/github/pull/308) - Add list organisation invitations endpoint ## Changes for 0.18 -- Endpoints for deleting issue comments. - [#294](https://github.com/phadej/github/pull/294)+_2017-11-10, Oleg Grenrus_++- Endpoints for deleting issue comments.+ [#294](https://github.com/haskell-github/github/pull/294) - Endpoints for (un)starring gists.- [#296](https://github.com/phadej/github/pull/296)+ [#296](https://github.com/haskell-github/github/pull/296) - Add `archived` field to `Repo`.- [#298](https://github.com/phadej/github/pull/298)+ [#298](https://github.com/haskell-github/github/pull/298) - Update dependencies.- [#295](https://github.com/phadej/github/pull/295)+ [#295](https://github.com/haskell-github/github/pull/295) - Add Statuses endpoints.- [#268](https://github.com/phadej/github/pull/268)+ [#268](https://github.com/haskell-github/github/pull/268) - Add requested reviewers field to pull request records.- [#292](https://github.com/phadej/github/pull/292)+ [#292](https://github.com/haskell-github/github/pull/292) ## Changes for 0.17.0 +_2017-09-26, Oleg Grenrus_+ - Add `Ord Request` instance - Repository contents - Repository starring endpoints@@ -115,15 +289,19 @@ ## Changes for 0.16.0 +_2017-07-24, Oleg Grenrus_+ - Add support for `mergeable_state = "blocked".` - Fix HTTP status code of merge PR - Supports newest versions of dependencies - user events - release endpoints-- forkExistingRepo+- `forkExistingRepo` ## Changes for 0.15.0 +_2016-11-04, Oleg Grenrus_+ - Reworked `PullRequest` (notably `pullRequestsFor`) - Reworked PR and Issue filtering - GHC-8.0.1 support@@ -133,19 +311,21 @@ - Add `HeaderQuery` to `Request` - Add `Hashable Auth` instance - Add `mkUserId`, `mkUserName`, `fromUserId`, `fromOrganizationId`-- Add 'userIssuesR'-- Add 'organizationIssuesR'+- Add `userIssuesR`+- Add `organizationIssuesR` - Make `teamName :: Text` amnd `teamSlug :: Name Team` in both: `Team` and `SimpleTeam`-- Refactor 'Request' structure+- Refactor `Request` structure - Added multiple issue assignees - Preliminary support for repository events: `repositoryEventsR` - Support for adding repository permissions to the team-- Remove 'simpleUserType', it was always the same.+- Remove `simpleUserType`, it was always the same. -See [git commit summary](https://github.com/phadej/github/compare/v0.14.1...v0.15.0)+See [git commit summary](https://github.com/haskell-github/github/compare/v0.14.1...v0.15.0) ## Changes for 0.14.1 +_2016-02-02, Oleg Grenrus_+ - Add `membersOfWithR`, `listTeamMembersR` - Add related enums: `OrgMemberFilter`, `OrgMemberRole`, `TeamMemberRole` - Add `Enum` and `Bounded` instances to `Privacy`, `Permission`,@@ -154,6 +334,8 @@ ## Changes for 0.14.0 +_2016-01-25, Oleg Grenrus_+ Large API changes: - Use `Text` and `Vector` in place of `String` and `[]`.@@ -163,28 +345,56 @@ - Add `Binary` instances for all data - `GithubOwner` is a `newtype` of `Either User Organization`. There's still `SimpleOwner`. +## Releases without changelog++| Version | Date | Uploader |+|---|---|---|+| __0.13.2__ | _2015-04-26_ | _John Wiegley_ |+| __0.13.1__ | _2014-12-01_ | _César López-Natarén_ |+| __0.13__ | _2014-11-09_ | _César López-Natarén_ |+| __0.12__ | _2014-11-09_ | _César López-Natarén_ |+| __0.11.1__ | _2014-09-07_ | _César López-Natarén_ |+| __0.11.0__ | _2014-08-25_ | _César López-Natarén_ |+| __0.10.0__ | _2014-08-18_ | _César López-Natarén_ |+| __0.9__ | _2014-07-31_ | _John Wiegley_ |+| __0.8__ | _2014-05-02_ | _John Wiegley_ |+| __0.7.4__ | _2014-01-22_ | _John Wiegley_ |+| __0.7.3__ | _2013-12-21_ | _John Wiegley_ |+| __0.7.2__ | _2013-12-02_ | _John Wiegley_ |+| __0.7.1__ | _2013-08-08_ | _John Wiegley_ |+| __0.7.0__ | _2013-04-26_ | _John Wiegley_ |+| __0.6.0__ | _2013-04-12_ | _John Wiegley_ |+ ## Changes for 0.5.0: -* OAuth.+_2013-02-05, Mike Burns_++* `OAuth`. * New function: `Github.Repos.organizationRepo`, to get the repo for a specific organization. * Introduce a new `newRepoAutoInit` flag to `NewRepo`, for whether to initialize a repo while creating it.-* Relax the attoparsec version requirements.+* Relax the `attoparsec` version requirements. * The above by [John Wiegley](https://github.com/jwiegley). ## Changes for 0.4.1: -* Stop using the uri package.-* Use aeson version 0.6.1.0.-* Use attoparsec version 0.10.3.0.-* Use http-conduit over 1.8.-* Use unordered-containers between 0.2 and 0.3.+_2013-01-14, Mike Burns_ +* Stop using the `uri` package.+* Use `aeson` version 0.6.1.0.+* Use `attoparsec` version 0.10.3.0.+* Use `http-conduit` over 1.8.+* Use `unordered-containers` between 0.2 and 0.3.+ ## Changes for 0.4.0: -* Use http-conduit version 1.4.1.10.+_2012-06-26, Mike Burns_ +* Use `http-conduit` version 1.4.1.10.+ ## Changes for 0.3.0: +_2012-06-10, Mike Burns_+ * Re-instantiate the Blobs API. * `repoDescription1` and `repoPushedAt` are a `Maybe GithubDate`. * Add `deleteRepo`, `editRepo`, and `createRepo`.@@ -195,13 +405,17 @@ ## Changes for 0.2.1: -* Expand the unordered-containers dependency to anything in 0.1.x .+_2012-02-16, Mike Burns_ +* Expand the `unordered-containers` dependency to anything in 0.1.x .+ ## Changes for 0.2.0: +_2012-02-15, Mike Burns_+ * `milestoneDueOn` and `repoLanguage` are now `Maybe` types.-* Introduce `GithubOwner` as the sum type for a `GithubUser` or `GithubOrganization`. Everything that once produced a `GithubUser` now produces a `GithubOwner`. All record accessors have changed their names-* Similar to `GithubOwner`, introduce `DetailedOwner`, which can be a `DetailedUser` or a `DetailedOrganization`. All record accessors have changed their names+* Introduce `GithubOwner` as the sum type for a `GithubUser` or `GithubOrganization`. Everything that once produced a `GithubUser` now produces a `GithubOwner`. All record accessors have changed their names.+* Similar to `GithubOwner`, introduce `DetailedOwner`, which can be a `DetailedUser` or a `DetailedOrganization`. All record accessors have changed their names. * An `HTTPConnectionError` now composes `SomeException` instead of `IOException`. All exceptions raised by the underlying http-conduit library are encapulated there. * The `githubIssueClosedBy` function now produces a `Maybe GithubOwner`. * Remove the Blobs API, as it is broken upstream.
README.md view
@@ -1,15 +1,15 @@-Github+GitHub ------ -[](https://travis-ci.org/phadej/github)-[][hackage]-[](http://stackage.org/lts-5/package/github)-[](http://stackage.org/nightly/package/github)+[](http://hackage.haskell.org/package/github)+[](https://stackage.org/nightly/package/github)+[](https://www.stackage.org/package/github)+[](https://github.com/haskell-github/github/actions/workflows/haskell-ci.yml) -The Github API v3 for Haskell.+The GitHub API v3 for Haskell. -Some functions are missing; these are functions where the Github API did-not work as expected. The full Github API is in beta and constantly+Some functions are missing; these are functions where the GitHub API did+not work as expected. The full GitHub API is in beta and constantly improving. Installation@@ -18,31 +18,32 @@ In your project's cabal file: ```cabal--- Packages needed in order to build this package. Build-depends: github ``` Or from the command line: ```sh-cabal install github+cabal v1-install github ``` Example Usage ============= See the samples in the-[samples/](https://github.com/fpco/github/tree/master/samples) directory.+[samples/](https://github.com/haskell-github/github/tree/master/samples) directory. +Note: some samples might be outdated.+ Documentation ============= For details see the reference [documentation on Hackage][hackage]. Each module lines up with the hierarchy of-[documentation from the Github API](http://developer.github.com/v3/).+[documentation from the GitHub API](https://docs.github.com/en/rest). -Request functions (ending with `R`) construct a data type with can be executed+Request functions (ending with `R`) construct a data type which can be executed in `IO` by `executeRequest` functions. They are all listed in the root `GitHub` module. @@ -51,7 +52,7 @@ possible error message. Here's an example from the samples: Many function have samples under-[`samples/`](https://github.com/phadej/github/tree/master/samples) directory.+[`samples/`](https://github.com/haskell-github/github/tree/master/samples) directory. ```hs {-# LANGUAGE NoImplicitPrelude #-}@@ -63,11 +64,12 @@ import Data.Text.IO as T (putStrLn) import Data.Monoid ((<>)) -import qualified GitHub.Endpoints.Users.Followers as GitHub+import GitHub (github')+import qualified GitHub main :: IO () main = do- possibleUsers <- GitHub.usersFollowing "mike-burns"+ possibleUsers <- github' GitHub.usersFollowingR "phadej" T.putStrLn $ either (("Error: " <>) . pack . show) (foldMap ((<> "\n") . formatUser)) possibleUsers@@ -76,21 +78,11 @@ formatUser = GitHub.untagName . GitHub.simpleUserLogin ``` -Test setup-==========--To run integration part of tests, you'll need [github access token](https://github.com/settings/tokens/new)-Token is needed, because unauthorised access is highly limited.-It's enough to add only basic read access for public information.--With `travis encrypt --org --repo yournick/github "GITHUB_TOKEN=yourtoken"` command you get a secret,-you can use in your travis setup to run the test-suite there.- Contributions ============= Please see-[CONTRIBUTING.md](https://github.com/fpco/github/blob/master/CONTRIBUTING.md)+[CONTRIBUTING.md](https://github.com/haskell-github/github/blob/master/CONTRIBUTING.md) for details on how you can help. Copyright@@ -98,8 +90,16 @@ Copyright 2011-2012 Mike Burns. Copyright 2013-2015 John Wiegley.-Copyright 2016 Oleg Grenrus.+Copyright 2016-2019 Oleg Grenrus. Available under the BSD 3-clause license. -[hackage]: http://hackage.haskell.org/package/github "Hackage"+[hackage]: https://hackage.haskell.org/package/github "Hackage"++Alternative+===========++Library [`github-rest`](https://hackage.haskell.org/package/github-rest)+also provides an interface to the GitHub API.+It compares itself to `github` here:+https://github.com/LeapYear/github-rest#comparison-to-other-libraries
+ fixtures/actions/artifact.json view
@@ -0,0 +1,19 @@+{+ "id": 416767789,+ "node_id": "MDg6QXJ0aWZhY3Q0MTY3Njc3ODk=",+ "name": "dist-without-markdown",+ "size_in_bytes": 42718,+ "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/artifacts/416767789",+ "archive_download_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/artifacts/416767789/zip",+ "expired": false,+ "created_at": "2022-10-29T22:18:21Z",+ "updated_at": "2022-10-29T22:18:23Z",+ "expires_at": "2023-01-27T22:18:16Z",+ "workflow_run": {+ "id": 3353148947,+ "repository_id": 559365297,+ "head_repository_id": 559365297,+ "head_branch": "main",+ "head_sha": "601593ecb1d8a57a04700fdb445a28d4186b8954"+ }+}
+ fixtures/actions/artifacts-list.json view
@@ -0,0 +1,43 @@+{+ "total_count": 23809,+ "artifacts": [+ {+ "id": 416737084,+ "node_id": "MDg6QXJ0aWZhY3Q0MTY3MzcwODQ=",+ "name": "doc-html",+ "size_in_bytes": 61667543,+ "url": "https://api.github.com/repos/python/cpython/actions/artifacts/416737084",+ "archive_download_url": "https://api.github.com/repos/python/cpython/actions/artifacts/416737084/zip",+ "expired": false,+ "created_at": "2022-10-29T20:56:24Z",+ "updated_at": "2022-10-29T20:56:25Z",+ "expires_at": "2023-01-27T20:50:21Z",+ "workflow_run": {+ "id": 3352897496,+ "repository_id": 81598961,+ "head_repository_id": 101955313,+ "head_branch": "backport-bfecff5-3.11",+ "head_sha": "692cd77975413d71ff0951072df686e6f38711c8"+ }+ },+ {+ "id": 416712612,+ "node_id": "MDg6QXJ0aWZhY3Q0MTY3MTI2MTI=",+ "name": "doc-html",+ "size_in_bytes": 61217330,+ "url": "https://api.github.com/repos/python/cpython/actions/artifacts/416712612",+ "archive_download_url": "https://api.github.com/repos/python/cpython/actions/artifacts/416712612/zip",+ "expired": false,+ "created_at": "2022-10-29T19:53:19Z",+ "updated_at": "2022-10-29T19:53:20Z",+ "expires_at": "2023-01-27T19:49:12Z",+ "workflow_run": {+ "id": 3352724493,+ "repository_id": 81598961,+ "head_repository_id": 559335486,+ "head_branch": "patch-1",+ "head_sha": "62eb88a66d1d35f7701873d8b698a2f8d7e84fa5"+ }+ }+ ]+}
+ fixtures/actions/cache-list.json view
@@ -0,0 +1,14 @@+{+ "total_count": 1,+ "actions_caches": [+ {+ "id": 1,+ "ref": "refs/heads/main",+ "key": "cache_key",+ "version": "f5f850afdadd47730296d4ffa900de95f6bbafb75dc1e8475df1fa6ae79dcece",+ "last_accessed_at": "2022-10-30T00:08:14.223333300Z",+ "created_at": "2022-10-30T00:08:14.223333300Z",+ "size_in_bytes": 26586+ }+ ]+}
+ fixtures/actions/org-cache-usage.json view
@@ -0,0 +1,4 @@+{+ "total_active_caches_size_in_bytes": 26586,+ "total_active_caches_count": 1+}
+ fixtures/actions/org-public-key.json view
@@ -0,0 +1,4 @@+{+ "key_id": "568250167242549743",+ "key": "KHVvOxB765kjkShEgUu27QCzl5XxKz/L20V+KRsWf0w="+}
+ fixtures/actions/org-secrets-list.json view
@@ -0,0 +1,18 @@+{+ "total_count": 2,+ "secrets": [+ {+ "name": "TEST_SECRET",+ "created_at": "2022-10-31T00:08:12Z",+ "updated_at": "2022-10-31T00:08:12Z",+ "visibility": "all"+ },+ {+ "name": "TEST_SELECTED",+ "created_at": "2022-10-31T00:08:43Z",+ "updated_at": "2022-10-31T00:08:43Z",+ "visibility": "selected",+ "selected_repositories_url": "https://api.github.com/orgs/kote-test-org-actions/actions/secrets/TEST_SELECTED/repositories"+ }+ ]+}
+ fixtures/actions/repo-cache-usage.json view
@@ -0,0 +1,5 @@+{+ "full_name": "python/cpython",+ "active_caches_size_in_bytes": 55000268087,+ "active_caches_count": 171+}
+ fixtures/actions/selected-repositories-for-secret.json view
@@ -0,0 +1,72 @@+{+ "total_count": 1,+ "repositories": [+ {+ "id": 559365297,+ "node_id": "R_kgDOIVc8sQ",+ "name": "actions-api",+ "full_name": "kote-test-org-actions/actions-api",+ "private": true,+ "owner": {+ "login": "kote-test-org-actions",+ "id": 116976977,+ "node_id": "O_kgDOBvjtUQ",+ "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4",+ "gravatar_id": "",+ "url": "https://api.github.com/users/kote-test-org-actions",+ "html_url": "https://github.com/kote-test-org-actions",+ "followers_url": "https://api.github.com/users/kote-test-org-actions/followers",+ "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}",+ "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}",+ "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}",+ "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions",+ "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs",+ "repos_url": "https://api.github.com/users/kote-test-org-actions/repos",+ "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}",+ "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events",+ "type": "Organization",+ "site_admin": false+ },+ "html_url": "https://github.com/kote-test-org-actions/actions-api",+ "description": null,+ "fork": false,+ "url": "https://api.github.com/repos/kote-test-org-actions/actions-api",+ "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks",+ "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}",+ "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}",+ "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams",+ "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks",+ "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}",+ "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events",+ "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}",+ "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}",+ "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags",+ "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}",+ "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}",+ "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}",+ "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}",+ "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}",+ "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages",+ "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers",+ "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors",+ "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers",+ "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription",+ "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}",+ "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}",+ "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}",+ "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}",+ "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}",+ "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}",+ "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges",+ "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}",+ "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads",+ "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}",+ "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}",+ "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}",+ "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}",+ "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}",+ "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}",+ "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments"+ }+ ]+}
+ fixtures/actions/workflow-job.json view
@@ -0,0 +1,113 @@+{+ "id": 9183275828,+ "run_id": 3353449941,+ "run_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941",+ "run_attempt": 1,+ "node_id": "CR_kwDOIVc8sc8AAAACI12rNA",+ "head_sha": "3156f684232a3adec5085c920d2006aca80f2798",+ "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/jobs/9183275828",+ "html_url": "https://github.com/kote-test-org-actions/actions-api/actions/runs/3353449941/jobs/5556228789",+ "status": "completed",+ "conclusion": "success",+ "started_at": "2022-10-30T00:09:29Z",+ "completed_at": "2022-10-30T00:09:49Z",+ "name": "check-bats-version",+ "steps": [+ {+ "name": "Set up job",+ "status": "completed",+ "conclusion": "success",+ "number": 1,+ "started_at": "2022-10-29T17:09:29.000-07:00",+ "completed_at": "2022-10-29T17:09:32.000-07:00"+ },+ {+ "name": "Run actions/checkout@v3",+ "status": "completed",+ "conclusion": "success",+ "number": 2,+ "started_at": "2022-10-29T17:09:32.000-07:00",+ "completed_at": "2022-10-29T17:09:33.000-07:00"+ },+ {+ "name": "Run actions/setup-node@v3",+ "status": "completed",+ "conclusion": "success",+ "number": 3,+ "started_at": "2022-10-29T17:09:34.000-07:00",+ "completed_at": "2022-10-29T17:09:39.000-07:00"+ },+ {+ "name": "Run npm install -g bats",+ "status": "completed",+ "conclusion": "success",+ "number": 4,+ "started_at": "2022-10-29T17:09:40.000-07:00",+ "completed_at": "2022-10-29T17:09:42.000-07:00"+ },+ {+ "name": "Run bats -v",+ "status": "completed",+ "conclusion": "success",+ "number": 5,+ "started_at": "2022-10-29T17:09:42.000-07:00",+ "completed_at": "2022-10-29T17:09:42.000-07:00"+ },+ {+ "name": "Archive Test",+ "status": "completed",+ "conclusion": "success",+ "number": 6,+ "started_at": "2022-10-29T17:09:42.000-07:00",+ "completed_at": "2022-10-29T17:09:46.000-07:00"+ },+ {+ "name": "Cache",+ "status": "completed",+ "conclusion": "success",+ "number": 7,+ "started_at": "2022-10-29T17:09:46.000-07:00",+ "completed_at": "2022-10-29T17:09:47.000-07:00"+ },+ {+ "name": "Post Cache",+ "status": "completed",+ "conclusion": "success",+ "number": 12,+ "started_at": "2022-10-29T17:09:49.000-07:00",+ "completed_at": "2022-10-29T17:09:47.000-07:00"+ },+ {+ "name": "Post Run actions/setup-node@v3",+ "status": "completed",+ "conclusion": "success",+ "number": 13,+ "started_at": "2022-10-29T17:09:49.000-07:00",+ "completed_at": "2022-10-29T17:09:49.000-07:00"+ },+ {+ "name": "Post Run actions/checkout@v3",+ "status": "completed",+ "conclusion": "success",+ "number": 14,+ "started_at": "2022-10-29T17:09:49.000-07:00",+ "completed_at": "2022-10-29T17:09:49.000-07:00"+ },+ {+ "name": "Complete job",+ "status": "completed",+ "conclusion": "success",+ "number": 15,+ "started_at": "2022-10-29T17:09:47.000-07:00",+ "completed_at": "2022-10-29T17:09:47.000-07:00"+ }+ ],+ "check_run_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/check-runs/9183275828",+ "labels": [+ "ubuntu-latest"+ ],+ "runner_id": 1,+ "runner_name": "Hosted Agent",+ "runner_group_id": 2,+ "runner_group_name": "GitHub Actions"+}
+ fixtures/actions/workflow-list.json view
@@ -0,0 +1,17 @@+{+ "total_count": 1,+ "workflows": [+ {+ "id": 39065091,+ "node_id": "W_kwDOIVc8sc4CVBYD",+ "name": "learn-github-actions",+ "path": ".github/workflows/make_artifact.yaml",+ "state": "active",+ "created_at": "2022-10-29T15:17:59.000-07:00",+ "updated_at": "2022-10-29T15:17:59.000-07:00",+ "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/workflows/39065091",+ "html_url": "https://github.com/kote-test-org-actions/actions-api/blob/main/.github/workflows/make_artifact.yaml",+ "badge_url": "https://github.com/kote-test-org-actions/actions-api/workflows/learn-github-actions/badge.svg"+ }+ ]+}
+ fixtures/actions/workflow-runs-list.json view
@@ -0,0 +1,665 @@+{+ "total_count": 3,+ "workflow_runs": [+ {+ "id": 3353449941,+ "name": "K0Te is learning GitHub Actions",+ "node_id": "WFR_kwLOIVc8sc7H4ZXV",+ "head_branch": "main",+ "head_sha": "3156f684232a3adec5085c920d2006aca80f2798",+ "path": ".github/workflows/make_artifact.yaml",+ "display_title": "K0Te is learning GitHub Actions",+ "run_number": 3,+ "event": "push",+ "status": "completed",+ "conclusion": "success",+ "workflow_id": 39065091,+ "check_suite_id": 9030268154,+ "check_suite_node_id": "CS_kwDOIVc8sc8AAAACGj70-g",+ "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941",+ "html_url": "https://github.com/kote-test-org-actions/actions-api/actions/runs/3353449941",+ "pull_requests": [],+ "created_at": "2022-10-30T00:09:22Z",+ "updated_at": "2022-10-30T00:09:50Z",+ "actor": {+ "login": "K0Te",+ "id": 6162155,+ "node_id": "MDQ6VXNlcjYxNjIxNTU=",+ "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4",+ "gravatar_id": "",+ "url": "https://api.github.com/users/K0Te",+ "html_url": "https://github.com/K0Te",+ "followers_url": "https://api.github.com/users/K0Te/followers",+ "following_url": "https://api.github.com/users/K0Te/following{/other_user}",+ "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}",+ "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}",+ "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions",+ "organizations_url": "https://api.github.com/users/K0Te/orgs",+ "repos_url": "https://api.github.com/users/K0Te/repos",+ "events_url": "https://api.github.com/users/K0Te/events{/privacy}",+ "received_events_url": "https://api.github.com/users/K0Te/received_events",+ "type": "User",+ "site_admin": false+ },+ "run_attempt": 1,+ "referenced_workflows": [],+ "run_started_at": "2022-10-30T00:09:22Z",+ "triggering_actor": {+ "login": "K0Te",+ "id": 6162155,+ "node_id": "MDQ6VXNlcjYxNjIxNTU=",+ "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4",+ "gravatar_id": "",+ "url": "https://api.github.com/users/K0Te",+ "html_url": "https://github.com/K0Te",+ "followers_url": "https://api.github.com/users/K0Te/followers",+ "following_url": "https://api.github.com/users/K0Te/following{/other_user}",+ "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}",+ "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}",+ "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions",+ "organizations_url": "https://api.github.com/users/K0Te/orgs",+ "repos_url": "https://api.github.com/users/K0Te/repos",+ "events_url": "https://api.github.com/users/K0Te/events{/privacy}",+ "received_events_url": "https://api.github.com/users/K0Te/received_events",+ "type": "User",+ "site_admin": false+ },+ "jobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941/jobs",+ "logs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941/logs",+ "check_suite_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/check-suites/9030268154",+ "artifacts_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941/artifacts",+ "cancel_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941/cancel",+ "rerun_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941/rerun",+ "previous_attempt_url": null,+ "workflow_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/workflows/39065091",+ "head_commit": {+ "id": "3156f684232a3adec5085c920d2006aca80f2798",+ "tree_id": "f51ba8632086ca7af92f5e58c1dc98df1c62d7ce",+ "message": "up",+ "timestamp": "2022-10-30T00:09:16Z",+ "author": {+ "name": "Oleg Nykolyn",+ "email": "juravel2@gmail.com"+ },+ "committer": {+ "name": "Oleg Nykolyn",+ "email": "juravel2@gmail.com"+ }+ },+ "repository": {+ "id": 559365297,+ "node_id": "R_kgDOIVc8sQ",+ "name": "actions-api",+ "full_name": "kote-test-org-actions/actions-api",+ "private": true,+ "owner": {+ "login": "kote-test-org-actions",+ "id": 116976977,+ "node_id": "O_kgDOBvjtUQ",+ "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4",+ "gravatar_id": "",+ "url": "https://api.github.com/users/kote-test-org-actions",+ "html_url": "https://github.com/kote-test-org-actions",+ "followers_url": "https://api.github.com/users/kote-test-org-actions/followers",+ "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}",+ "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}",+ "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}",+ "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions",+ "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs",+ "repos_url": "https://api.github.com/users/kote-test-org-actions/repos",+ "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}",+ "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events",+ "type": "Organization",+ "site_admin": false+ },+ "html_url": "https://github.com/kote-test-org-actions/actions-api",+ "description": null,+ "fork": false,+ "url": "https://api.github.com/repos/kote-test-org-actions/actions-api",+ "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks",+ "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}",+ "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}",+ "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams",+ "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks",+ "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}",+ "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events",+ "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}",+ "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}",+ "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags",+ "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}",+ "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}",+ "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}",+ "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}",+ "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}",+ "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages",+ "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers",+ "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors",+ "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers",+ "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription",+ "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}",+ "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}",+ "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}",+ "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}",+ "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}",+ "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}",+ "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges",+ "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}",+ "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads",+ "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}",+ "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}",+ "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}",+ "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}",+ "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}",+ "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}",+ "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments"+ },+ "head_repository": {+ "id": 559365297,+ "node_id": "R_kgDOIVc8sQ",+ "name": "actions-api",+ "full_name": "kote-test-org-actions/actions-api",+ "private": true,+ "owner": {+ "login": "kote-test-org-actions",+ "id": 116976977,+ "node_id": "O_kgDOBvjtUQ",+ "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4",+ "gravatar_id": "",+ "url": "https://api.github.com/users/kote-test-org-actions",+ "html_url": "https://github.com/kote-test-org-actions",+ "followers_url": "https://api.github.com/users/kote-test-org-actions/followers",+ "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}",+ "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}",+ "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}",+ "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions",+ "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs",+ "repos_url": "https://api.github.com/users/kote-test-org-actions/repos",+ "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}",+ "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events",+ "type": "Organization",+ "site_admin": false+ },+ "html_url": "https://github.com/kote-test-org-actions/actions-api",+ "description": null,+ "fork": false,+ "url": "https://api.github.com/repos/kote-test-org-actions/actions-api",+ "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks",+ "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}",+ "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}",+ "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams",+ "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks",+ "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}",+ "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events",+ "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}",+ "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}",+ "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags",+ "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}",+ "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}",+ "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}",+ "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}",+ "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}",+ "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages",+ "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers",+ "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors",+ "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers",+ "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription",+ "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}",+ "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}",+ "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}",+ "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}",+ "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}",+ "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}",+ "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges",+ "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}",+ "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads",+ "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}",+ "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}",+ "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}",+ "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}",+ "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}",+ "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}",+ "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments"+ }+ },+ {+ "id": 3353445625,+ "name": "K0Te is learning GitHub Actions",+ "node_id": "WFR_kwLOIVc8sc7H4YT5",+ "head_branch": "main",+ "head_sha": "2d2486b9aecb80bf916717f47f7c312431d3ceb6",+ "path": ".github/workflows/make_artifact.yaml",+ "display_title": "K0Te is learning GitHub Actions",+ "run_number": 2,+ "event": "push",+ "status": "completed",+ "conclusion": "success",+ "workflow_id": 39065091,+ "check_suite_id": 9030259685,+ "check_suite_node_id": "CS_kwDOIVc8sc8AAAACGj7T5Q",+ "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625",+ "html_url": "https://github.com/kote-test-org-actions/actions-api/actions/runs/3353445625",+ "pull_requests": [],+ "created_at": "2022-10-30T00:07:49Z",+ "updated_at": "2022-10-30T00:08:19Z",+ "actor": {+ "login": "K0Te",+ "id": 6162155,+ "node_id": "MDQ6VXNlcjYxNjIxNTU=",+ "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4",+ "gravatar_id": "",+ "url": "https://api.github.com/users/K0Te",+ "html_url": "https://github.com/K0Te",+ "followers_url": "https://api.github.com/users/K0Te/followers",+ "following_url": "https://api.github.com/users/K0Te/following{/other_user}",+ "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}",+ "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}",+ "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions",+ "organizations_url": "https://api.github.com/users/K0Te/orgs",+ "repos_url": "https://api.github.com/users/K0Te/repos",+ "events_url": "https://api.github.com/users/K0Te/events{/privacy}",+ "received_events_url": "https://api.github.com/users/K0Te/received_events",+ "type": "User",+ "site_admin": false+ },+ "run_attempt": 1,+ "referenced_workflows": [],+ "run_started_at": "2022-10-30T00:07:49Z",+ "triggering_actor": {+ "login": "K0Te",+ "id": 6162155,+ "node_id": "MDQ6VXNlcjYxNjIxNTU=",+ "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4",+ "gravatar_id": "",+ "url": "https://api.github.com/users/K0Te",+ "html_url": "https://github.com/K0Te",+ "followers_url": "https://api.github.com/users/K0Te/followers",+ "following_url": "https://api.github.com/users/K0Te/following{/other_user}",+ "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}",+ "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}",+ "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions",+ "organizations_url": "https://api.github.com/users/K0Te/orgs",+ "repos_url": "https://api.github.com/users/K0Te/repos",+ "events_url": "https://api.github.com/users/K0Te/events{/privacy}",+ "received_events_url": "https://api.github.com/users/K0Te/received_events",+ "type": "User",+ "site_admin": false+ },+ "jobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625/jobs",+ "logs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625/logs",+ "check_suite_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/check-suites/9030259685",+ "artifacts_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625/artifacts",+ "cancel_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625/cancel",+ "rerun_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625/rerun",+ "previous_attempt_url": null,+ "workflow_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/workflows/39065091",+ "head_commit": {+ "id": "2d2486b9aecb80bf916717f47f7c312431d3ceb6",+ "tree_id": "21d858674ab650ea734b7efbf05442a21685d121",+ "message": "up",+ "timestamp": "2022-10-30T00:07:44Z",+ "author": {+ "name": "Oleg Nykolyn",+ "email": "juravel2@gmail.com"+ },+ "committer": {+ "name": "Oleg Nykolyn",+ "email": "juravel2@gmail.com"+ }+ },+ "repository": {+ "id": 559365297,+ "node_id": "R_kgDOIVc8sQ",+ "name": "actions-api",+ "full_name": "kote-test-org-actions/actions-api",+ "private": true,+ "owner": {+ "login": "kote-test-org-actions",+ "id": 116976977,+ "node_id": "O_kgDOBvjtUQ",+ "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4",+ "gravatar_id": "",+ "url": "https://api.github.com/users/kote-test-org-actions",+ "html_url": "https://github.com/kote-test-org-actions",+ "followers_url": "https://api.github.com/users/kote-test-org-actions/followers",+ "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}",+ "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}",+ "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}",+ "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions",+ "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs",+ "repos_url": "https://api.github.com/users/kote-test-org-actions/repos",+ "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}",+ "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events",+ "type": "Organization",+ "site_admin": false+ },+ "html_url": "https://github.com/kote-test-org-actions/actions-api",+ "description": null,+ "fork": false,+ "url": "https://api.github.com/repos/kote-test-org-actions/actions-api",+ "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks",+ "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}",+ "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}",+ "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams",+ "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks",+ "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}",+ "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events",+ "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}",+ "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}",+ "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags",+ "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}",+ "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}",+ "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}",+ "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}",+ "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}",+ "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages",+ "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers",+ "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors",+ "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers",+ "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription",+ "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}",+ "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}",+ "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}",+ "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}",+ "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}",+ "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}",+ "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges",+ "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}",+ "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads",+ "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}",+ "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}",+ "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}",+ "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}",+ "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}",+ "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}",+ "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments"+ },+ "head_repository": {+ "id": 559365297,+ "node_id": "R_kgDOIVc8sQ",+ "name": "actions-api",+ "full_name": "kote-test-org-actions/actions-api",+ "private": true,+ "owner": {+ "login": "kote-test-org-actions",+ "id": 116976977,+ "node_id": "O_kgDOBvjtUQ",+ "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4",+ "gravatar_id": "",+ "url": "https://api.github.com/users/kote-test-org-actions",+ "html_url": "https://github.com/kote-test-org-actions",+ "followers_url": "https://api.github.com/users/kote-test-org-actions/followers",+ "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}",+ "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}",+ "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}",+ "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions",+ "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs",+ "repos_url": "https://api.github.com/users/kote-test-org-actions/repos",+ "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}",+ "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events",+ "type": "Organization",+ "site_admin": false+ },+ "html_url": "https://github.com/kote-test-org-actions/actions-api",+ "description": null,+ "fork": false,+ "url": "https://api.github.com/repos/kote-test-org-actions/actions-api",+ "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks",+ "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}",+ "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}",+ "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams",+ "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks",+ "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}",+ "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events",+ "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}",+ "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}",+ "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags",+ "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}",+ "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}",+ "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}",+ "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}",+ "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}",+ "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages",+ "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers",+ "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors",+ "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers",+ "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription",+ "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}",+ "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}",+ "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}",+ "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}",+ "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}",+ "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}",+ "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges",+ "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}",+ "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads",+ "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}",+ "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}",+ "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}",+ "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}",+ "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}",+ "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}",+ "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments"+ }+ },+ {+ "id": 3353148947,+ "name": "K0Te is learning GitHub Actions",+ "node_id": "WFR_kwLOIVc8sc7H3P4T",+ "head_branch": "main",+ "head_sha": "601593ecb1d8a57a04700fdb445a28d4186b8954",+ "path": ".github/workflows/make_artifact.yaml",+ "display_title": "K0Te is learning GitHub Actions",+ "run_number": 1,+ "event": "push",+ "status": "completed",+ "conclusion": "success",+ "workflow_id": 39065091,+ "check_suite_id": 9029740591,+ "check_suite_node_id": "CS_kwDOIVc8sc8AAAACGjboLw",+ "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947",+ "html_url": "https://github.com/kote-test-org-actions/actions-api/actions/runs/3353148947",+ "pull_requests": [],+ "created_at": "2022-10-29T22:18:02Z",+ "updated_at": "2022-10-29T22:18:22Z",+ "actor": {+ "login": "K0Te",+ "id": 6162155,+ "node_id": "MDQ6VXNlcjYxNjIxNTU=",+ "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4",+ "gravatar_id": "",+ "url": "https://api.github.com/users/K0Te",+ "html_url": "https://github.com/K0Te",+ "followers_url": "https://api.github.com/users/K0Te/followers",+ "following_url": "https://api.github.com/users/K0Te/following{/other_user}",+ "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}",+ "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}",+ "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions",+ "organizations_url": "https://api.github.com/users/K0Te/orgs",+ "repos_url": "https://api.github.com/users/K0Te/repos",+ "events_url": "https://api.github.com/users/K0Te/events{/privacy}",+ "received_events_url": "https://api.github.com/users/K0Te/received_events",+ "type": "User",+ "site_admin": false+ },+ "run_attempt": 1,+ "referenced_workflows": [],+ "run_started_at": "2022-10-29T22:18:02Z",+ "triggering_actor": {+ "login": "K0Te",+ "id": 6162155,+ "node_id": "MDQ6VXNlcjYxNjIxNTU=",+ "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4",+ "gravatar_id": "",+ "url": "https://api.github.com/users/K0Te",+ "html_url": "https://github.com/K0Te",+ "followers_url": "https://api.github.com/users/K0Te/followers",+ "following_url": "https://api.github.com/users/K0Te/following{/other_user}",+ "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}",+ "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}",+ "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions",+ "organizations_url": "https://api.github.com/users/K0Te/orgs",+ "repos_url": "https://api.github.com/users/K0Te/repos",+ "events_url": "https://api.github.com/users/K0Te/events{/privacy}",+ "received_events_url": "https://api.github.com/users/K0Te/received_events",+ "type": "User",+ "site_admin": false+ },+ "jobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947/jobs",+ "logs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947/logs",+ "check_suite_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/check-suites/9029740591",+ "artifacts_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947/artifacts",+ "cancel_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947/cancel",+ "rerun_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947/rerun",+ "previous_attempt_url": null,+ "workflow_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/workflows/39065091",+ "head_commit": {+ "id": "601593ecb1d8a57a04700fdb445a28d4186b8954",+ "tree_id": "7aa2d4e6f4e0ddb277fe2f35f7615651ee01c5a2",+ "message": "test",+ "timestamp": "2022-10-29T22:17:55Z",+ "author": {+ "name": "Oleg Nykolyn",+ "email": "juravel2@gmail.com"+ },+ "committer": {+ "name": "Oleg Nykolyn",+ "email": "juravel2@gmail.com"+ }+ },+ "repository": {+ "id": 559365297,+ "node_id": "R_kgDOIVc8sQ",+ "name": "actions-api",+ "full_name": "kote-test-org-actions/actions-api",+ "private": true,+ "owner": {+ "login": "kote-test-org-actions",+ "id": 116976977,+ "node_id": "O_kgDOBvjtUQ",+ "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4",+ "gravatar_id": "",+ "url": "https://api.github.com/users/kote-test-org-actions",+ "html_url": "https://github.com/kote-test-org-actions",+ "followers_url": "https://api.github.com/users/kote-test-org-actions/followers",+ "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}",+ "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}",+ "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}",+ "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions",+ "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs",+ "repos_url": "https://api.github.com/users/kote-test-org-actions/repos",+ "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}",+ "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events",+ "type": "Organization",+ "site_admin": false+ },+ "html_url": "https://github.com/kote-test-org-actions/actions-api",+ "description": null,+ "fork": false,+ "url": "https://api.github.com/repos/kote-test-org-actions/actions-api",+ "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks",+ "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}",+ "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}",+ "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams",+ "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks",+ "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}",+ "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events",+ "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}",+ "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}",+ "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags",+ "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}",+ "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}",+ "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}",+ "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}",+ "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}",+ "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages",+ "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers",+ "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors",+ "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers",+ "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription",+ "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}",+ "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}",+ "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}",+ "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}",+ "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}",+ "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}",+ "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges",+ "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}",+ "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads",+ "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}",+ "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}",+ "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}",+ "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}",+ "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}",+ "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}",+ "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments"+ },+ "head_repository": {+ "id": 559365297,+ "node_id": "R_kgDOIVc8sQ",+ "name": "actions-api",+ "full_name": "kote-test-org-actions/actions-api",+ "private": true,+ "owner": {+ "login": "kote-test-org-actions",+ "id": 116976977,+ "node_id": "O_kgDOBvjtUQ",+ "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4",+ "gravatar_id": "",+ "url": "https://api.github.com/users/kote-test-org-actions",+ "html_url": "https://github.com/kote-test-org-actions",+ "followers_url": "https://api.github.com/users/kote-test-org-actions/followers",+ "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}",+ "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}",+ "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}",+ "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions",+ "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs",+ "repos_url": "https://api.github.com/users/kote-test-org-actions/repos",+ "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}",+ "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events",+ "type": "Organization",+ "site_admin": false+ },+ "html_url": "https://github.com/kote-test-org-actions/actions-api",+ "description": null,+ "fork": false,+ "url": "https://api.github.com/repos/kote-test-org-actions/actions-api",+ "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks",+ "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}",+ "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}",+ "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams",+ "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks",+ "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}",+ "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events",+ "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}",+ "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}",+ "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags",+ "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}",+ "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}",+ "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}",+ "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}",+ "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}",+ "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages",+ "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers",+ "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors",+ "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers",+ "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription",+ "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}",+ "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}",+ "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}",+ "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}",+ "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}",+ "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}",+ "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges",+ "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}",+ "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads",+ "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}",+ "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}",+ "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}",+ "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}",+ "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}",+ "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}",+ "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments"+ }+ }+ ]+}
+ fixtures/pull-request-approved-review.json view
@@ -0,0 +1,38 @@+{+ "id": 80,+ "node_id": "MDE3OlB1bGxSZXF1ZXN0UmV2aWV3ODA=",+ "user": {+ "login": "octocat",+ "id": 1,+ "node_id": "MDQ6VXNlcjE=",+ "avatar_url": "https://github.com/images/error/octocat_happy.gif",+ "gravatar_id": "",+ "url": "https://api.github.com/users/octocat",+ "html_url": "https://github.com/octocat",+ "followers_url": "https://api.github.com/users/octocat/followers",+ "following_url": "https://api.github.com/users/octocat/following{/other_user}",+ "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",+ "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",+ "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",+ "organizations_url": "https://api.github.com/users/octocat/orgs",+ "repos_url": "https://api.github.com/users/octocat/repos",+ "events_url": "https://api.github.com/users/octocat/events{/privacy}",+ "received_events_url": "https://api.github.com/users/octocat/received_events",+ "type": "User",+ "site_admin": false+ },+ "body": "Here is the body for the review.",+ "state": "APPROVED",+ "html_url": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80",+ "pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/12",+ "_links": {+ "html": {+ "href": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80"+ },+ "pull_request": {+ "href": "https://api.github.com/repos/octocat/Hello-World/pulls/12"+ }+ },+ "submitted_at": "2019-11-17T17:43:43Z",+ "commit_id": "ecdd80bb57125d7ba9641ffaa4d7d2c19d3f3091"+}
+ fixtures/pull-request-pending-review.json view
@@ -0,0 +1,37 @@+{+ "id": 80,+ "node_id": "MDE3OlB1bGxSZXF1ZXN0UmV2aWV3ODA=",+ "user": {+ "login": "octocat",+ "id": 1,+ "node_id": "MDQ6VXNlcjE=",+ "avatar_url": "https://github.com/images/error/octocat_happy.gif",+ "gravatar_id": "",+ "url": "https://api.github.com/users/octocat",+ "html_url": "https://github.com/octocat",+ "followers_url": "https://api.github.com/users/octocat/followers",+ "following_url": "https://api.github.com/users/octocat/following{/other_user}",+ "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",+ "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",+ "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",+ "organizations_url": "https://api.github.com/users/octocat/orgs",+ "repos_url": "https://api.github.com/users/octocat/repos",+ "events_url": "https://api.github.com/users/octocat/events{/privacy}",+ "received_events_url": "https://api.github.com/users/octocat/received_events",+ "type": "User",+ "site_admin": false+ },+ "body": "Here is the body for the review.",+ "state": "PENDING",+ "html_url": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80",+ "pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/12",+ "_links": {+ "html": {+ "href": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80"+ },+ "pull_request": {+ "href": "https://api.github.com/repos/octocat/Hello-World/pulls/12"+ }+ },+ "commit_id": "ecdd80bb57125d7ba9641ffaa4d7d2c19d3f3091"+}
+ fixtures/pull-request-team-review-requested.json view
@@ -0,0 +1,362 @@+{+ "url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls/910",+ "id": 529597962,+ "node_id": "MDExOlB1bGxSZXF1ZXN0NTI5NTk3OTYy",+ "html_url": "https://github.com/tahoe-lafs/tahoe-lafs/pull/910",+ "diff_url": "https://github.com/tahoe-lafs/tahoe-lafs/pull/910.diff",+ "patch_url": "https://github.com/tahoe-lafs/tahoe-lafs/pull/910.patch",+ "issue_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/issues/910",+ "number": 910,+ "state": "open",+ "locked": false,+ "title": "Fix NodeMaker's use of the WeakValueDictionary",+ "user": {+ "login": "exarkun",+ "id": 254565,+ "node_id": "MDQ6VXNlcjI1NDU2NQ==",+ "avatar_url": "https://avatars1.githubusercontent.com/u/254565?v=4",+ "gravatar_id": "",+ "url": "https://api.github.com/users/exarkun",+ "html_url": "https://github.com/exarkun",+ "followers_url": "https://api.github.com/users/exarkun/followers",+ "following_url": "https://api.github.com/users/exarkun/following{/other_user}",+ "gists_url": "https://api.github.com/users/exarkun/gists{/gist_id}",+ "starred_url": "https://api.github.com/users/exarkun/starred{/owner}{/repo}",+ "subscriptions_url": "https://api.github.com/users/exarkun/subscriptions",+ "organizations_url": "https://api.github.com/users/exarkun/orgs",+ "repos_url": "https://api.github.com/users/exarkun/repos",+ "events_url": "https://api.github.com/users/exarkun/events{/privacy}",+ "received_events_url": "https://api.github.com/users/exarkun/received_events",+ "type": "User",+ "site_admin": false+ },+ "body": "https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3539",+ "created_at": "2020-11-30T14:46:37Z",+ "updated_at": "2020-12-02T17:23:41Z",+ "closed_at": null,+ "merged_at": null,+ "merge_commit_sha": "3c97064ee5f71357c88f7940a91da8859641c2c6",+ "assignee": null,+ "assignees": [++ ],+ "requested_reviewers": [++ ],+ "requested_teams": [+ {+ "name": "Tahoe Committers",+ "id": 121616,+ "node_id": "MDQ6VGVhbTEyMTYxNg==",+ "slug": "tahoe-committers",+ "description": null,+ "privacy": "closed",+ "url": "https://api.github.com/organizations/1156454/team/121616",+ "html_url": "https://github.com/orgs/tahoe-lafs/teams/tahoe-committers",+ "members_url": "https://api.github.com/organizations/1156454/team/121616/members{/member}",+ "repositories_url": "https://api.github.com/organizations/1156454/team/121616/repos",+ "permission": "push",+ "parent": null+ }+ ],+ "labels": [++ ],+ "milestone": null,+ "draft": false,+ "commits_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls/910/commits",+ "review_comments_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls/910/comments",+ "review_comment_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls/comments{/number}",+ "comments_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/issues/910/comments",+ "statuses_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/statuses/ef2f7e61364c6a3187d2ab4859adfc4031213bdd",+ "head": {+ "label": "tahoe-lafs:3539.nodemaker-weakrefdict",+ "ref": "3539.nodemaker-weakrefdict",+ "sha": "ef2f7e61364c6a3187d2ab4859adfc4031213bdd",+ "user": {+ "login": "tahoe-lafs",+ "id": 1156454,+ "node_id": "MDEyOk9yZ2FuaXphdGlvbjExNTY0NTQ=",+ "avatar_url": "https://avatars1.githubusercontent.com/u/1156454?v=4",+ "gravatar_id": "",+ "url": "https://api.github.com/users/tahoe-lafs",+ "html_url": "https://github.com/tahoe-lafs",+ "followers_url": "https://api.github.com/users/tahoe-lafs/followers",+ "following_url": "https://api.github.com/users/tahoe-lafs/following{/other_user}",+ "gists_url": "https://api.github.com/users/tahoe-lafs/gists{/gist_id}",+ "starred_url": "https://api.github.com/users/tahoe-lafs/starred{/owner}{/repo}",+ "subscriptions_url": "https://api.github.com/users/tahoe-lafs/subscriptions",+ "organizations_url": "https://api.github.com/users/tahoe-lafs/orgs",+ "repos_url": "https://api.github.com/users/tahoe-lafs/repos",+ "events_url": "https://api.github.com/users/tahoe-lafs/events{/privacy}",+ "received_events_url": "https://api.github.com/users/tahoe-lafs/received_events",+ "type": "Organization",+ "site_admin": false+ },+ "repo": {+ "id": 3007569,+ "node_id": "MDEwOlJlcG9zaXRvcnkzMDA3NTY5",+ "name": "tahoe-lafs",+ "full_name": "tahoe-lafs/tahoe-lafs",+ "private": false,+ "owner": {+ "login": "tahoe-lafs",+ "id": 1156454,+ "node_id": "MDEyOk9yZ2FuaXphdGlvbjExNTY0NTQ=",+ "avatar_url": "https://avatars1.githubusercontent.com/u/1156454?v=4",+ "gravatar_id": "",+ "url": "https://api.github.com/users/tahoe-lafs",+ "html_url": "https://github.com/tahoe-lafs",+ "followers_url": "https://api.github.com/users/tahoe-lafs/followers",+ "following_url": "https://api.github.com/users/tahoe-lafs/following{/other_user}",+ "gists_url": "https://api.github.com/users/tahoe-lafs/gists{/gist_id}",+ "starred_url": "https://api.github.com/users/tahoe-lafs/starred{/owner}{/repo}",+ "subscriptions_url": "https://api.github.com/users/tahoe-lafs/subscriptions",+ "organizations_url": "https://api.github.com/users/tahoe-lafs/orgs",+ "repos_url": "https://api.github.com/users/tahoe-lafs/repos",+ "events_url": "https://api.github.com/users/tahoe-lafs/events{/privacy}",+ "received_events_url": "https://api.github.com/users/tahoe-lafs/received_events",+ "type": "Organization",+ "site_admin": false+ },+ "html_url": "https://github.com/tahoe-lafs/tahoe-lafs",+ "description": "The Tahoe-LAFS decentralized secure filesystem.",+ "fork": false,+ "url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs",+ "forks_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/forks",+ "keys_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/keys{/key_id}",+ "collaborators_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/collaborators{/collaborator}",+ "teams_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/teams",+ "hooks_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/hooks",+ "issue_events_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/issues/events{/number}",+ "events_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/events",+ "assignees_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/assignees{/user}",+ "branches_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/branches{/branch}",+ "tags_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/tags",+ "blobs_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/git/blobs{/sha}",+ "git_tags_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/git/tags{/sha}",+ "git_refs_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/git/refs{/sha}",+ "trees_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/git/trees{/sha}",+ "statuses_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/statuses/{sha}",+ "languages_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/languages",+ "stargazers_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/stargazers",+ "contributors_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/contributors",+ "subscribers_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/subscribers",+ "subscription_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/subscription",+ "commits_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/commits{/sha}",+ "git_commits_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/git/commits{/sha}",+ "comments_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/comments{/number}",+ "issue_comment_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/issues/comments{/number}",+ "contents_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/contents/{+path}",+ "compare_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/compare/{base}...{head}",+ "merges_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/merges",+ "archive_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/{archive_format}{/ref}",+ "downloads_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/downloads",+ "issues_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/issues{/number}",+ "pulls_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls{/number}",+ "milestones_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/milestones{/number}",+ "notifications_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/notifications{?since,all,participating}",+ "labels_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/labels{/name}",+ "releases_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/releases{/id}",+ "deployments_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/deployments",+ "created_at": "2011-12-18T19:33:55Z",+ "updated_at": "2020-12-02T20:24:23Z",+ "pushed_at": "2020-12-02T20:27:05Z",+ "git_url": "git://github.com/tahoe-lafs/tahoe-lafs.git",+ "ssh_url": "git@github.com:tahoe-lafs/tahoe-lafs.git",+ "clone_url": "https://github.com/tahoe-lafs/tahoe-lafs.git",+ "svn_url": "https://github.com/tahoe-lafs/tahoe-lafs",+ "homepage": "https://tahoe-lafs.org/",+ "size": 73606,+ "stargazers_count": 1018,+ "watchers_count": 1018,+ "language": "Python",+ "has_issues": false,+ "has_projects": false,+ "has_downloads": true,+ "has_wiki": false,+ "has_pages": false,+ "forks_count": 236,+ "mirror_url": null,+ "archived": false,+ "disabled": false,+ "open_issues_count": 21,+ "license": {+ "key": "other",+ "name": "Other",+ "spdx_id": "NOASSERTION",+ "url": null,+ "node_id": "MDc6TGljZW5zZTA="+ },+ "forks": 236,+ "open_issues": 21,+ "watchers": 1018,+ "default_branch": "master"+ }+ },+ "base": {+ "label": "tahoe-lafs:master",+ "ref": "master",+ "sha": "fba386cb8ee2b48a34c0d954b5c6b5b080d3234e",+ "user": {+ "login": "tahoe-lafs",+ "id": 1156454,+ "node_id": "MDEyOk9yZ2FuaXphdGlvbjExNTY0NTQ=",+ "avatar_url": "https://avatars1.githubusercontent.com/u/1156454?v=4",+ "gravatar_id": "",+ "url": "https://api.github.com/users/tahoe-lafs",+ "html_url": "https://github.com/tahoe-lafs",+ "followers_url": "https://api.github.com/users/tahoe-lafs/followers",+ "following_url": "https://api.github.com/users/tahoe-lafs/following{/other_user}",+ "gists_url": "https://api.github.com/users/tahoe-lafs/gists{/gist_id}",+ "starred_url": "https://api.github.com/users/tahoe-lafs/starred{/owner}{/repo}",+ "subscriptions_url": "https://api.github.com/users/tahoe-lafs/subscriptions",+ "organizations_url": "https://api.github.com/users/tahoe-lafs/orgs",+ "repos_url": "https://api.github.com/users/tahoe-lafs/repos",+ "events_url": "https://api.github.com/users/tahoe-lafs/events{/privacy}",+ "received_events_url": "https://api.github.com/users/tahoe-lafs/received_events",+ "type": "Organization",+ "site_admin": false+ },+ "repo": {+ "id": 3007569,+ "node_id": "MDEwOlJlcG9zaXRvcnkzMDA3NTY5",+ "name": "tahoe-lafs",+ "full_name": "tahoe-lafs/tahoe-lafs",+ "private": false,+ "owner": {+ "login": "tahoe-lafs",+ "id": 1156454,+ "node_id": "MDEyOk9yZ2FuaXphdGlvbjExNTY0NTQ=",+ "avatar_url": "https://avatars1.githubusercontent.com/u/1156454?v=4",+ "gravatar_id": "",+ "url": "https://api.github.com/users/tahoe-lafs",+ "html_url": "https://github.com/tahoe-lafs",+ "followers_url": "https://api.github.com/users/tahoe-lafs/followers",+ "following_url": "https://api.github.com/users/tahoe-lafs/following{/other_user}",+ "gists_url": "https://api.github.com/users/tahoe-lafs/gists{/gist_id}",+ "starred_url": "https://api.github.com/users/tahoe-lafs/starred{/owner}{/repo}",+ "subscriptions_url": "https://api.github.com/users/tahoe-lafs/subscriptions",+ "organizations_url": "https://api.github.com/users/tahoe-lafs/orgs",+ "repos_url": "https://api.github.com/users/tahoe-lafs/repos",+ "events_url": "https://api.github.com/users/tahoe-lafs/events{/privacy}",+ "received_events_url": "https://api.github.com/users/tahoe-lafs/received_events",+ "type": "Organization",+ "site_admin": false+ },+ "html_url": "https://github.com/tahoe-lafs/tahoe-lafs",+ "description": "The Tahoe-LAFS decentralized secure filesystem.",+ "fork": false,+ "url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs",+ "forks_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/forks",+ "keys_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/keys{/key_id}",+ "collaborators_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/collaborators{/collaborator}",+ "teams_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/teams",+ "hooks_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/hooks",+ "issue_events_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/issues/events{/number}",+ "events_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/events",+ "assignees_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/assignees{/user}",+ "branches_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/branches{/branch}",+ "tags_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/tags",+ "blobs_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/git/blobs{/sha}",+ "git_tags_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/git/tags{/sha}",+ "git_refs_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/git/refs{/sha}",+ "trees_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/git/trees{/sha}",+ "statuses_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/statuses/{sha}",+ "languages_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/languages",+ "stargazers_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/stargazers",+ "contributors_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/contributors",+ "subscribers_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/subscribers",+ "subscription_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/subscription",+ "commits_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/commits{/sha}",+ "git_commits_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/git/commits{/sha}",+ "comments_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/comments{/number}",+ "issue_comment_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/issues/comments{/number}",+ "contents_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/contents/{+path}",+ "compare_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/compare/{base}...{head}",+ "merges_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/merges",+ "archive_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/{archive_format}{/ref}",+ "downloads_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/downloads",+ "issues_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/issues{/number}",+ "pulls_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls{/number}",+ "milestones_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/milestones{/number}",+ "notifications_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/notifications{?since,all,participating}",+ "labels_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/labels{/name}",+ "releases_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/releases{/id}",+ "deployments_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/deployments",+ "created_at": "2011-12-18T19:33:55Z",+ "updated_at": "2020-12-02T20:24:23Z",+ "pushed_at": "2020-12-02T20:27:05Z",+ "git_url": "git://github.com/tahoe-lafs/tahoe-lafs.git",+ "ssh_url": "git@github.com:tahoe-lafs/tahoe-lafs.git",+ "clone_url": "https://github.com/tahoe-lafs/tahoe-lafs.git",+ "svn_url": "https://github.com/tahoe-lafs/tahoe-lafs",+ "homepage": "https://tahoe-lafs.org/",+ "size": 73606,+ "stargazers_count": 1018,+ "watchers_count": 1018,+ "language": "Python",+ "has_issues": false,+ "has_projects": false,+ "has_downloads": true,+ "has_wiki": false,+ "has_pages": false,+ "forks_count": 236,+ "mirror_url": null,+ "archived": false,+ "disabled": false,+ "open_issues_count": 21,+ "license": {+ "key": "other",+ "name": "Other",+ "spdx_id": "NOASSERTION",+ "url": null,+ "node_id": "MDc6TGljZW5zZTA="+ },+ "forks": 236,+ "open_issues": 21,+ "watchers": 1018,+ "default_branch": "master"+ }+ },+ "_links": {+ "self": {+ "href": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls/910"+ },+ "html": {+ "href": "https://github.com/tahoe-lafs/tahoe-lafs/pull/910"+ },+ "issue": {+ "href": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/issues/910"+ },+ "comments": {+ "href": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/issues/910/comments"+ },+ "review_comments": {+ "href": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls/910/comments"+ },+ "review_comment": {+ "href": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls/comments{/number}"+ },+ "commits": {+ "href": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls/910/commits"+ },+ "statuses": {+ "href": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/statuses/ef2f7e61364c6a3187d2ab4859adfc4031213bdd"+ }+ },+ "author_association": "MEMBER",+ "active_lock_reason": null,+ "merged": false,+ "mergeable": true,+ "rebaseable": true,+ "mergeable_state": "clean",+ "merged_by": null,+ "comments": 1,+ "review_comments": 0,+ "maintainer_can_modify": false,+ "commits": 5,+ "additions": 223,+ "deletions": 4,+ "changed_files": 5+}
github.cabal view
@@ -1,6 +1,6 @@-cabal-version: >=1.10+cabal-version: 2.4 name: github-version: 0.23+version: 0.30.0.2 synopsis: Access to the GitHub API, v3. category: Network description:@@ -15,44 +15,45 @@ > > main :: IO () > main = do- > possibleUser <- GH.executeRequest' $ GH.userInfoForR "phadej"+ > possibleUser <- GH.github' GH.userInfoForR "phadej" > print possibleUser .- For more of an overview please see the README: <https://github.com/phadej/github/blob/master/README.md>+ For more of an overview please see the README: <https://github.com/haskell-github/github/blob/master/README.md> -license: BSD3+license: BSD-3-Clause license-file: LICENSE author: Mike Burns, John Wiegley, Oleg Grenrus-maintainer: Oleg Grenrus <oleg.grenrus@iki.fi>-homepage: https://github.com/phadej/github+maintainer: Andreas Abel+homepage: https://github.com/haskell-github/github build-type: Simple copyright:- Copyright 2012-2013 Mike Burns, Copyright 2013-2015 John Wiegley, Copyright 2016-2019 Oleg Grenrus+ Copyright 2012-2013 Mike Burns, Copyright 2013-2015 John Wiegley, Copyright 2016-2021 Oleg Grenrus tested-with:- GHC ==7.8.4- || ==7.10.3- || ==8.0.2- || ==8.2.2- || ==8.4.4- || ==8.6.5- || ==8.8.1+ GHC == 9.14.1+ GHC == 9.12.2+ GHC == 9.10.3+ GHC == 9.8.4+ GHC == 9.6.7+ GHC == 9.4.8+ GHC == 9.2.8+ GHC == 9.0.2+ GHC == 8.10.7+ GHC == 8.8.4+ GHC == 8.6.5+ GHC == 8.4.4+ GHC == 8.2.2 -extra-source-files:+extra-doc-files: README.md CHANGELOG.md- fixtures/issue-search.json- fixtures/list-teams.json- fixtures/members-list.json- fixtures/pull-request-opened.json- fixtures/pull-request-review-requested.json- fixtures/user-organizations.json- fixtures/user.json- fixtures/user-bot.json +extra-source-files:+ fixtures/**/*.json+ source-repository head type: git- location: git://github.com/phadej/github.git+ location: https://github.com/haskell-github/github.git flag openssl description: "Use http-client-openssl"@@ -61,14 +62,20 @@ library default-language: Haskell2010- ghc-options: -Wall+ ghc-options:+ -Wall+ -Wcompat+ -Wno-star-is-type+ -- The star-is-type warning cannot be sensiblity addressed while supporting GHC 7. hs-source-dirs: src default-extensions: DataKinds DeriveDataTypeable DeriveGeneric+ LambdaCase OverloadedStrings ScopedTypeVariables+ TypeOperators other-extensions: CPP@@ -83,6 +90,13 @@ GitHub GitHub.Auth GitHub.Data+ GitHub.Data.Actions.Common+ GitHub.Data.Actions.Artifacts+ GitHub.Data.Actions.Cache+ GitHub.Data.Actions.Secrets+ GitHub.Data.Actions.Workflows+ GitHub.Data.Actions.WorkflowJobs+ GitHub.Data.Actions.WorkflowRuns GitHub.Data.Activities GitHub.Data.Comments GitHub.Data.Content@@ -90,6 +104,8 @@ GitHub.Data.DeployKeys GitHub.Data.Deployments GitHub.Data.Email+ GitHub.Data.Enterprise+ GitHub.Data.Enterprise.Organizations GitHub.Data.Events GitHub.Data.Gists GitHub.Data.GitData@@ -102,6 +118,7 @@ GitHub.Data.PublicSSHKeys GitHub.Data.PullRequests GitHub.Data.RateLimit+ GitHub.Data.Reactions GitHub.Data.Releases GitHub.Data.Repos GitHub.Data.Request@@ -112,10 +129,17 @@ GitHub.Data.URL GitHub.Data.Webhooks GitHub.Data.Webhooks.Validate+ GitHub.Endpoints.Actions.Artifacts+ GitHub.Endpoints.Actions.Cache+ GitHub.Endpoints.Actions.Secrets+ GitHub.Endpoints.Actions.Workflows+ GitHub.Endpoints.Actions.WorkflowJobs+ GitHub.Endpoints.Actions.WorkflowRuns GitHub.Endpoints.Activity.Events GitHub.Endpoints.Activity.Notifications GitHub.Endpoints.Activity.Starring GitHub.Endpoints.Activity.Watching+ GitHub.Endpoints.Enterprise.Organizations GitHub.Endpoints.Gists GitHub.Endpoints.Gists.Comments GitHub.Endpoints.GitData.Blobs@@ -129,11 +153,13 @@ GitHub.Endpoints.Issues.Milestones GitHub.Endpoints.Organizations GitHub.Endpoints.Organizations.Members+ GitHub.Endpoints.Organizations.OutsideCollaborators GitHub.Endpoints.Organizations.Teams GitHub.Endpoints.PullRequests GitHub.Endpoints.PullRequests.Comments GitHub.Endpoints.PullRequests.Reviews GitHub.Endpoints.RateLimit+ GitHub.Endpoints.Reactions GitHub.Endpoints.Repos GitHub.Endpoints.Repos.Collaborators GitHub.Endpoints.Repos.Comments@@ -151,43 +177,43 @@ GitHub.Endpoints.Users.Emails GitHub.Endpoints.Users.Followers GitHub.Endpoints.Users.PublicSSHKeys+ GitHub.Enterprise GitHub.Internal.Prelude GitHub.Request - other-modules: Paths_github+ other-modules: Paths_github+ autogen-modules: Paths_github -- Packages bundles with GHC, mtl and text are also here+ -- Lower bounds at least those of https://www.stackage.org/lts-10.0 (GHC 8.2.2) build-depends:- base >=4.7 && <4.14- , binary >=0.7.1.0 && <0.11- , bytestring >=0.10.4.0 && <0.11- , containers >=0.5.5.1 && <0.7- , deepseq >=1.3.0.2 && <1.5- , mtl >=2.1.3.1 && <2.2 || >=2.2.1 && <2.3- , text >=1.2.0.6 && <1.3- , time >=1.4 && <1.10- , transformers >=0.3.0.0 && <0.6+ base >=4.10 && <5+ , binary >=0.8.5.1 && <0.11+ , bytestring >=0.10.8.2 && <0.13+ , containers >=0.5.10.2 && <1+ , deepseq >=1.4.3.0 && <1.6+ , exceptions >=0.10.2 && <0.11+ , mtl >=2.2.1 && <2.4+ , text >=1.2.2.2 && <2.2+ , time >=1.8.0.2 && <2+ , transformers >=0.5.2.0 && <0.7 -- other packages build-depends:- aeson >=1.4.0.0 && <1.5- , base-compat >=0.10.4 && <0.12- , base16-bytestring >=0.1.1.6 && <0.2+ aeson >=1.4.0.0 && <1.6 || >=2.0.1.0 && <2.3+ , base-compat >=0.11.1 && <1+ , base16-bytestring >=0.1.1.6 && <1.1 , binary-instances >=1 && <1.1 , cryptohash-sha1 >=0.11.100.1 && <0.12- , deepseq-generics >=0.2.0.0 && <0.3- , exceptions >=0.10.2 && <0.11- , hashable >=1.2.7.0 && <1.4- , http-client >=0.5.12 && <0.7- , http-link-header >=1.0.3.1 && <1.1+ , hashable >=1.2.7.0 && <2+ , http-client >=0.5.12 && <0.8+ , http-link-header >=1.0.3.1 && <1.3 , http-types >=0.12.3 && <0.13 , iso8601-time >=0.1.5 && <0.2 , network-uri >=2.6.1.0 && <2.7 , tagged >=0.8.5 && <0.9- , transformers-compat >=0.6.5 && <0.7 , unordered-containers >=0.2.10.0 && <0.3- , vector >=0.12.0.1 && <0.13- , vector-instances >=3.4 && <3.5+ , vector >=0.12.0.1 && <0.14 if flag(openssl) build-depends:@@ -197,21 +223,24 @@ else build-depends:- http-client-tls >=0.3.5.3 && <0.4+ http-client-tls >=0.3.5.3 && <0.5 , tls >=1.4.1 - if !impl(ghc >=8.0)- build-depends: semigroups >=0.18.5 && <0.20- test-suite github-test default-language: Haskell2010 type: exitcode-stdio-1.0 hs-source-dirs: spec main-is: Spec.hs ghc-options: -Wall -threaded- build-tool-depends: hspec-discover:hspec-discover >=2.7.1 && <2.8+ build-tool-depends: hspec-discover:hspec-discover >=2.7.1 && <2.12 other-extensions: TemplateHaskell other-modules:+ GitHub.Actions.ArtifactsSpec+ GitHub.Actions.CacheSpec+ GitHub.Actions.SecretsSpec+ GitHub.Actions.WorkflowJobSpec+ GitHub.Actions.WorkflowRunsSpec+ GitHub.Actions.WorkflowSpec GitHub.ActivitySpec GitHub.CommitsSpec GitHub.EventsSpec@@ -223,6 +252,7 @@ GitHub.RateLimitSpec GitHub.ReleasesSpec GitHub.ReposSpec+ GitHub.ReviewDecodeSpec GitHub.SearchSpec GitHub.UsersSpec @@ -233,7 +263,8 @@ , bytestring , file-embed , github- , hspec >=2.6.1 && <2.8+ , hspec >=2.6.1 && <2.12+ , http-client , tagged , text , unordered-containers
+ spec/GitHub/Actions/ArtifactsSpec.hs view
@@ -0,0 +1,66 @@+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE TemplateHaskell #-}+module GitHub.Actions.ArtifactsSpec where++import qualified GitHub as GH++import Prelude ()+import Prelude.Compat++import Data.Aeson (eitherDecodeStrict)+import Data.ByteString (ByteString)+import Data.Either.Compat (isRight)+import Data.FileEmbed (embedFile)+import Data.Foldable (for_)+import Data.String (fromString)+import qualified Data.Vector as V+import System.Environment (lookupEnv)+import Test.Hspec+ (Spec, describe, it, pendingWith, shouldBe, shouldSatisfy)++fromRightS :: Show a => Either a b -> b+fromRightS (Right b) = b+fromRightS (Left a) = error $ "Expected a Right and got a Left" ++ show a++withAuth :: (GH.Auth -> IO ()) -> IO ()+withAuth action = do+ mtoken <- lookupEnv "GITHUB_TOKEN"+ case mtoken of+ Nothing -> pendingWith "no GITHUB_TOKEN"+ Just token -> action (GH.OAuth $ fromString token)++spec :: Spec+spec = do+ describe "artifactsForR" $ do+ it "works" $ withAuth $ \auth -> for_ repos $ \(owner, repo) -> do+ cs <- GH.executeRequest auth $+ GH.artifactsForR owner repo mempty GH.FetchAll+ cs `shouldSatisfy` isRight++ describe "decoding artifacts payloads" $ do+ it "decodes artifacts list payload" $ do+ GH.withTotalCountTotalCount artifactList `shouldBe` 23809+ V.length (GH.withTotalCountItems artifactList) `shouldBe` 2+ it "decodes signle artifact payload" $ do+ GH.artifactName artifact `shouldBe` "dist-without-markdown"+ GH.artifactWorkflowRunHeadSha (GH.artifactWorkflowRun artifact) `shouldBe` "601593ecb1d8a57a04700fdb445a28d4186b8954"++ where+ repos =+ [ ("thoughtbot", "paperclip")+ , ("phadej", "github")+ ]++ artifactList :: GH.WithTotalCount GH.Artifact+ artifactList =+ fromRightS (eitherDecodeStrict artifactsListPayload)++ artifact :: GH.Artifact+ artifact =+ fromRightS (eitherDecodeStrict artifactPayload)++ artifactsListPayload :: ByteString+ artifactsListPayload = $(embedFile "fixtures/actions/artifacts-list.json")++ artifactPayload :: ByteString+ artifactPayload = $(embedFile "fixtures/actions/artifact.json")
+ spec/GitHub/Actions/CacheSpec.hs view
@@ -0,0 +1,53 @@+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE TemplateHaskell #-}+module GitHub.Actions.CacheSpec where++import qualified GitHub as GH++import Prelude ()+import Prelude.Compat++import Data.Aeson (eitherDecodeStrict)+import Data.ByteString (ByteString)+import Data.FileEmbed (embedFile)+import qualified Data.Vector as V+import Test.Hspec (Spec, describe, it, shouldBe)++fromRightS :: Show a => Either a b -> b+fromRightS (Right b) = b+fromRightS (Left a) = error $ "Expected a Right and got a Left" ++ show a++spec :: Spec+spec = do+ describe "decoding cache payloads" $ do+ it "decodes cache list payload" $ do+ V.length (GH.withTotalCountItems cacheList) `shouldBe` 1+ it "decodes cache usage for repo" $ do+ GH.repositoryCacheUsageFullName repoCacheUsage `shouldBe` "python/cpython"+ GH.repositoryCacheUsageActiveCachesSizeInBytes repoCacheUsage `shouldBe` 55000268087+ GH.repositoryCacheUsageActiveCachesCount repoCacheUsage `shouldBe` 171+ it "decodes cache usage for org" $ do+ GH.organizationCacheUsageTotalActiveCachesSizeInBytes orgCacheUsage `shouldBe` 26586+ GH.organizationCacheUsageTotalActiveCachesCount orgCacheUsage `shouldBe` 1++ where+ cacheList :: GH.WithTotalCount GH.Cache+ cacheList =+ fromRightS (eitherDecodeStrict cacheListPayload)++ repoCacheUsage :: GH.RepositoryCacheUsage+ repoCacheUsage =+ fromRightS (eitherDecodeStrict repoCacheUsagePayload)++ orgCacheUsage :: GH.OrganizationCacheUsage+ orgCacheUsage =+ fromRightS (eitherDecodeStrict orgCacheUsagePayload)++ cacheListPayload :: ByteString+ cacheListPayload = $(embedFile "fixtures/actions/cache-list.json")++ repoCacheUsagePayload :: ByteString+ repoCacheUsagePayload = $(embedFile "fixtures/actions/repo-cache-usage.json")++ orgCacheUsagePayload :: ByteString+ orgCacheUsagePayload = $(embedFile "fixtures/actions/org-cache-usage.json")
+ spec/GitHub/Actions/SecretsSpec.hs view
@@ -0,0 +1,50 @@+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE TemplateHaskell #-}+module GitHub.Actions.SecretsSpec where++import qualified GitHub as GH++import Prelude ()+import Prelude.Compat++import Data.Aeson (eitherDecodeStrict)+import Data.ByteString (ByteString)+import Data.FileEmbed (embedFile)+import qualified Data.Vector as V+import Test.Hspec (Spec, describe, it, shouldBe)++fromRightS :: Show a => Either a b -> b+fromRightS (Right b) = b+fromRightS (Left a) = error $ "Expected a Right and got a Left" ++ show a++spec :: Spec+spec = do+ describe "decoding secrets payloads" $ do+ it "decodes selected repo list payload" $ do+ V.length (GH.withTotalCountItems repoList) `shouldBe` 1+ it "decodes secret list payload" $ do+ V.length (GH.withTotalCountItems orgSecretList) `shouldBe` 2+ it "decodes public key payload" $ do+ GH.publicKeyId orgPublicKey `shouldBe` "568250167242549743"++ where+ repoList :: GH.WithTotalCount GH.SelectedRepo+ repoList =+ fromRightS (eitherDecodeStrict repoListPayload)++ orgSecretList:: GH.WithTotalCount GH.OrganizationSecret+ orgSecretList=+ fromRightS (eitherDecodeStrict orgSecretListPayload)++ orgPublicKey:: GH.PublicKey+ orgPublicKey=+ fromRightS (eitherDecodeStrict orgPublicKeyPayload)++ repoListPayload :: ByteString+ repoListPayload = $(embedFile "fixtures/actions/selected-repositories-for-secret.json")++ orgSecretListPayload :: ByteString+ orgSecretListPayload = $(embedFile "fixtures/actions/org-secrets-list.json")++ orgPublicKeyPayload :: ByteString+ orgPublicKeyPayload = $(embedFile "fixtures/actions/org-public-key.json")
+ spec/GitHub/Actions/WorkflowJobSpec.hs view
@@ -0,0 +1,32 @@+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE TemplateHaskell #-}+module GitHub.Actions.WorkflowJobSpec where++import qualified GitHub as GH+import GitHub.Data.Id++import Prelude ()+import Prelude.Compat++import Data.Aeson (eitherDecodeStrict)+import Data.ByteString (ByteString)+import Data.FileEmbed (embedFile)+import Test.Hspec (Spec, describe, it, shouldBe)++fromRightS :: Show a => Either a b -> b+fromRightS (Right b) = b+fromRightS (Left a) = error $ "Expected a Right and got a Left" ++ show a++spec :: Spec+spec = do+ describe "decoding workflow jobs payloads" $ do+ it "decodes workflow job" $ do+ GH.jobId workflowJob `shouldBe` Id 9183275828++ where+ workflowJob:: GH.Job+ workflowJob=+ fromRightS (eitherDecodeStrict workflowJobPayload)++ workflowJobPayload :: ByteString+ workflowJobPayload = $(embedFile "fixtures/actions/workflow-job.json")
+ spec/GitHub/Actions/WorkflowRunsSpec.hs view
@@ -0,0 +1,32 @@+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE TemplateHaskell #-}+module GitHub.Actions.WorkflowRunsSpec where++import qualified GitHub as GH++import Prelude ()+import Prelude.Compat++import Data.Aeson (eitherDecodeStrict)+import Data.ByteString (ByteString)+import Data.FileEmbed (embedFile)+import qualified Data.Vector as V+import Test.Hspec (Spec, describe, it, shouldBe)++fromRightS :: Show a => Either a b -> b+fromRightS (Right b) = b+fromRightS (Left a) = error $ "Expected a Right and got a Left" ++ show a++spec :: Spec+spec = do+ describe "decoding workflow runs payloads" $ do+ it "decodes workflow runs list" $ do+ V.length (GH.withTotalCountItems workflowRunsList) `shouldBe` 3++ where+ workflowRunsList:: GH.WithTotalCount GH.WorkflowRun+ workflowRunsList =+ fromRightS (eitherDecodeStrict workflowRunsPayload)++ workflowRunsPayload :: ByteString+ workflowRunsPayload = $(embedFile "fixtures/actions/workflow-runs-list.json")
+ spec/GitHub/Actions/WorkflowSpec.hs view
@@ -0,0 +1,32 @@+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE TemplateHaskell #-}+module GitHub.Actions.WorkflowSpec where++import qualified GitHub as GH++import Prelude ()+import Prelude.Compat++import Data.Aeson (eitherDecodeStrict)+import Data.ByteString (ByteString)+import Data.FileEmbed (embedFile)+import qualified Data.Vector as V+import Test.Hspec (Spec, describe, it, shouldBe)++fromRightS :: Show a => Either a b -> b+fromRightS (Right b) = b+fromRightS (Left a) = error $ "Expected a Right and got a Left" ++ show a++spec :: Spec+spec = do+ describe "decoding workflow payloads" $ do+ it "decodes workflow list" $ do+ V.length (GH.withTotalCountItems workflowList) `shouldBe` 1++ where+ workflowList:: GH.WithTotalCount GH.Workflow+ workflowList =+ fromRightS (eitherDecodeStrict workflowPayload)++ workflowPayload :: ByteString+ workflowPayload = $(embedFile "fixtures/actions/workflow-list.json")
spec/GitHub/ActivitySpec.hs view
@@ -1,5 +1,4 @@ {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TemplateHaskell #-} module GitHub.ActivitySpec where import qualified GitHub@@ -31,7 +30,7 @@ spec = do describe "watchersForR" $ do it "works" $ withAuth $ \auth -> do- cs <- executeRequest auth $ watchersForR "phadej" "github" GitHub.FetchAll + cs <- executeRequest auth $ watchersForR "haskell-github" "github" GitHub.FetchAll cs `shouldSatisfy` isRight V.length (fromRightS cs) `shouldSatisfy` (> 10) describe "myStarredR" $ do
spec/GitHub/CommitsSpec.hs view
@@ -1,13 +1,9 @@ {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TemplateHaskell #-} module GitHub.CommitsSpec where -import qualified GitHub- import GitHub.Auth (Auth (..))-import GitHub.Endpoints.Repos.Commits (commitSha, commitsFor',- commitsForR, diffR, mkCommitName)-import GitHub.Request (executeRequest)+import GitHub.Endpoints.Repos.Commits (commitSha, commitsForR, diffR, mkCommitName, FetchCount (..))+import GitHub.Request (github) import Control.Monad (forM_) import Data.Either.Compat (isRight)@@ -34,13 +30,13 @@ spec = do describe "commitsFor" $ do it "works" $ withAuth $ \auth -> do- cs <- commitsFor' (Just auth) "phadej" "github"+ cs <- github auth commitsForR "haskell-github" "github" FetchAll cs `shouldSatisfy` isRight V.length (fromRightS cs) `shouldSatisfy` (> 300) -- Page size is 30, so we get 60 commits it "limits the response" $ withAuth $ \auth -> do- cs <- executeRequest auth $ commitsForR "phadej" "github" (GitHub.FetchAtLeast 40)+ cs <- github auth commitsForR "haskell-github" "github" (FetchAtLeast 40) cs `shouldSatisfy` isRight let cs' = fromRightS cs V.length cs' `shouldSatisfy` (< 70)@@ -49,19 +45,19 @@ describe "diff" $ do it "works" $ withAuth $ \auth -> do- cs <- executeRequest auth $ commitsForR "phadej" "github" (GitHub.FetchAtLeast 30)+ cs <- github auth commitsForR "haskell-github" "github" (FetchAtLeast 30) cs `shouldSatisfy` isRight let commits = take 10 . V.toList . fromRightS $ cs let pairs = zip commits $ drop 1 commits forM_ pairs $ \(a, b) -> do- d <- executeRequest auth $ diffR "phadej" "github" (commitSha a) (commitSha b)+ d <- github auth diffR "haskell-github" "github" (commitSha a) (commitSha b) d `shouldSatisfy` isRight it "issue #155" $ withAuth $ \auth -> do- d <- executeRequest auth $ diffR "nomeata" "codespeed" (mkCommitName "ghc") (mkCommitName "tobami:master")+ d <- github auth diffR "nomeata" "codespeed" (mkCommitName "ghc") (mkCommitName "tobami:master") d `shouldSatisfy` isRight -- diff that includes a commit where a submodule is removed it "issue #339" $ withAuth $ \auth -> do- d <- executeRequest auth $ diffR "scott-fleischman" "repo-remove-submodule" "d03c152482169d809be9b1eab71dcf64d7405f76" "42cfd732b20cd093534f246e630b309186eb485d"+ d <- github auth diffR "scott-fleischman" "repo-remove-submodule" "d03c152482169d809be9b1eab71dcf64d7405f76" "42cfd732b20cd093534f246e630b309186eb485d" d `shouldSatisfy` isRight
spec/GitHub/EventsSpec.hs view
@@ -27,9 +27,9 @@ spec = do describe "repositoryEventsR" $ do it "returns non empty list of events" $ shouldSucceed $- GitHub.repositoryEventsR "phadej" "github" 1+ GitHub.repositoryEventsR "haskell-github" "github" 1 describe "userEventsR" $ do- it "returns non empty list of events" $ shouldSucceed $ GitHub.userEventsR "phadej" 1 + it "returns non empty list of events" $ shouldSucceed $ GitHub.userEventsR "phadej" 1 where shouldSucceed f = withAuth $ \auth -> do cs <- GitHub.executeRequest auth $ f cs `shouldSatisfy` isRight
spec/GitHub/IssuesSpec.hs view
@@ -6,13 +6,14 @@ import Prelude () import Prelude.Compat -import Data.Either.Compat (isRight)-import Data.Foldable (for_)-import Data.String (fromString)-import System.Environment (lookupEnv)-import Test.Hspec- (Spec, describe, expectationFailure, it, pendingWith, shouldSatisfy)+import Data.Either.Compat (isRight)+import Data.Foldable (for_)+import Data.String (fromString)+import Network.HTTP.Client (newManager, responseBody)+import System.Environment (lookupEnv)+import Test.Hspec (Spec, describe, expectationFailure, it, pendingWith, shouldSatisfy) + fromRightS :: Show a => Either a b -> b fromRightS (Right b) = b fromRightS (Left a) = error $ "Expected a Right and got a Left" ++ show a@@ -38,8 +39,32 @@ cms <- GitHub.executeRequest auth $ GitHub.commentsR owner repo (GitHub.issueNumber i) 1 cms `shouldSatisfy` isRight++ describe "issuesForRepoR paged" $ do+ it "works" $ withAuth $ \auth -> for_ repos $ \(owner, repo) -> do+ mgr <- newManager GitHub.tlsManagerSettings+ ret <- GitHub.executeRequestWithMgrAndRes mgr auth $+ GitHub.issuesForRepoR owner repo mempty (GitHub.FetchPage (GitHub.PageParams (Just 2) (Just 1)))++ case ret of+ Left e ->+ expectationFailure . show $ e+ Right res -> do+ let issues = responseBody res+ length issues `shouldSatisfy` (<= 2)++ for_ issues $ \i -> do+ cms <- GitHub.executeRequest auth $+ GitHub.commentsR owner repo (GitHub.issueNumber i) 1+ cms `shouldSatisfy` isRight++ describe "issueR" $ do+ it "fetches issue #428" $ withAuth $ \auth -> do+ resIss <- GitHub.executeRequest auth $+ GitHub.issueR "haskell-github" "github" (GitHub.IssueNumber 428)+ resIss `shouldSatisfy` isRight where repos = [ ("thoughtbot", "paperclip")- , ("phadej", "github")+ , ("haskell-github", "github") ]
spec/GitHub/OrganizationsSpec.hs view
@@ -2,11 +2,12 @@ {-# LANGUAGE TemplateHaskell #-} module GitHub.OrganizationsSpec where +import GitHub (FetchCount (..), github) import GitHub.Auth (Auth (..)) import GitHub.Data (SimpleOrganization (..), SimpleOwner (..), SimpleTeam (..))-import GitHub.Endpoints.Organizations (publicOrganizationsFor')-import GitHub.Endpoints.Organizations.Members (membersOf')+import GitHub.Endpoints.Organizations (publicOrganizationsForR)+import GitHub.Endpoints.Organizations.Members (membersOfR) import Data.Aeson (eitherDecodeStrict) import Data.Either.Compat (isRight)@@ -35,7 +36,7 @@ simpleOrganizationLogin (head $ fromRightS orgs) `shouldBe` "github" it "returns information about the user's organizations" $ withAuth $ \auth -> do- orgs <- publicOrganizationsFor' (Just auth) "mike-burns"+ orgs <- github auth publicOrganizationsForR "mike-burns" FetchAll orgs `shouldSatisfy` isRight describe "teamsOf" $ do@@ -49,5 +50,5 @@ simpleOwnerLogin (head $ fromRightS ms) `shouldBe` "octocat" it "works" $ withAuth $ \auth -> do- ms <- membersOf' (Just auth) "haskell"+ ms <- github auth membersOfR "haskell" FetchAll ms `shouldSatisfy` isRight
spec/GitHub/PublicSSHKeysSpec.hs view
@@ -1,11 +1,10 @@ {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TemplateHaskell #-} module GitHub.PublicSSHKeysSpec where import GitHub- (Auth (..), FetchCount (..), PublicSSHKey (..), executeRequest)+ (Auth (..), FetchCount (..), PublicSSHKey (..),github) import GitHub.Endpoints.Users.PublicSSHKeys- (publicSSHKey', publicSSHKeys', publicSSHKeysForR)+ (publicSSHKeyR, publicSSHKeysR, publicSSHKeysForR) import Data.Either.Compat (isRight) import Data.String (fromString)@@ -29,13 +28,13 @@ spec = do describe "publicSSHKeysFor'" $ do it "works" $ withAuth $ \auth -> do- keys <- executeRequest auth $ publicSSHKeysForR "phadej" FetchAll+ keys <- github auth publicSSHKeysForR "phadej" FetchAll V.length (fromRightS keys) `shouldSatisfy` (> 1) describe "publicSSHKeys' and publicSSHKey'" $ do it "works" $ withAuth $ \auth -> do- keys <- publicSSHKeys' auth+ keys <- github auth publicSSHKeysR V.length (fromRightS keys) `shouldSatisfy` (> 1) - key <- publicSSHKey' auth (publicSSHKeyId $ V.head (fromRightS keys))+ key <- github auth publicSSHKeyR (publicSSHKeyId $ V.head (fromRightS keys)) key `shouldSatisfy` isRight
spec/GitHub/PullRequestReviewsSpec.hs view
@@ -2,7 +2,7 @@ module GitHub.PullRequestReviewsSpec where import qualified GitHub-import GitHub.Data.Id (Id (Id))+import GitHub.Data (IssueNumber (IssueNumber)) import Prelude () import Prelude.Compat@@ -29,4 +29,4 @@ cs `shouldSatisfy` isRight where prs =- [("phadej", "github", Id 268)]+ [("haskell-github", "github", IssueNumber 268)]
spec/GitHub/PullRequestsSpec.hs view
@@ -47,7 +47,7 @@ describe "pullRequestPatchR" $ it "works" $ withAuth $ \auth -> do Right patch <- GH.executeRequest auth $- GH.pullRequestPatchR "phadej" "github" (GH.IssueNumber 349)+ GH.pullRequestPatchR "haskell-github" "github" (GH.IssueNumber 349) head (LBS8.lines patch) `shouldBe` "From c0e4ad33811be82e1f72ee76116345c681703103 Mon Sep 17 00:00:00 2001" describe "decoding pull request payloads" $ do@@ -65,23 +65,30 @@ V.length (GH.pullRequestRequestedReviewers pullRequestReviewRequested) `shouldBe` 1 + it "decodes a pull request 'team_requested' payload" $ do+ V.length (GH.simplePullRequestRequestedTeamReviewers simplePullRequestTeamReviewRequested)+ `shouldBe` 1++ V.length (GH.pullRequestRequestedTeamReviewers pullRequestTeamReviewRequested)+ `shouldBe` 1+ describe "checking if a pull request is merged" $ do it "works" $ withAuth $ \auth -> do- b <- GH.executeRequest auth $ GH.isPullRequestMergedR "phadej" "github" (GH.IssueNumber 14)+ b <- GH.executeRequest auth $ GH.isPullRequestMergedR "haskell-github" "github" (GH.IssueNumber 14) b `shouldSatisfy` isRight fromRightS b `shouldBe` True describe "Draft Pull Request" $ do it "works" $ withAuth $ \auth -> do cs <- GH.executeRequest auth $- draftPullRequestsForR "phadej" "github" opts GH.FetchAll+ draftPullRequestsForR "haskell-github" "github" opts GH.FetchAll cs `shouldSatisfy` isRight where repos = [ ("thoughtbot", "paperclip")- , ("phadej", "github")+ , ("haskell-github", "github") ] opts = GH.stateClosed @@ -97,15 +104,26 @@ simplePullRequestReviewRequested = fromRightS (eitherDecodeStrict prReviewRequestedPayload) + simplePullRequestTeamReviewRequested :: GH.SimplePullRequest+ simplePullRequestTeamReviewRequested =+ fromRightS (eitherDecodeStrict prTeamReviewRequestedPayload)+ pullRequestReviewRequested :: GH.PullRequest pullRequestReviewRequested = fromRightS (eitherDecodeStrict prReviewRequestedPayload) + pullRequestTeamReviewRequested :: GH.PullRequest+ pullRequestTeamReviewRequested =+ fromRightS (eitherDecodeStrict prTeamReviewRequestedPayload)+ prOpenedPayload :: ByteString prOpenedPayload = $(embedFile "fixtures/pull-request-opened.json") prReviewRequestedPayload :: ByteString prReviewRequestedPayload = $(embedFile "fixtures/pull-request-review-requested.json")++ prTeamReviewRequestedPayload :: ByteString+ prTeamReviewRequestedPayload = $(embedFile "fixtures/pull-request-team-review-requested.json") ------------------------------------------------------------------------------- -- Draft Pull Requests
spec/GitHub/ReleasesSpec.hs view
@@ -1,5 +1,4 @@ {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TemplateHaskell #-} module GitHub.ReleasesSpec where import qualified GitHub
spec/GitHub/ReposSpec.hs view
@@ -1,16 +1,22 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TemplateHaskell #-}++#if __GLASGOW_HASKELL__ >= 900+{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}+#endif+ module GitHub.ReposSpec where -import GitHub (Auth (..), Repo (..), RepoPublicity (..),- executeRequest, repositoryR)-import GitHub.Endpoints.Repos (currentUserRepos, languagesFor', userRepos')+import GitHub+ (Auth (..), FetchCount (..), Repo (..), RepoPublicity (..), github,+ repositoryR)+import GitHub.Endpoints.Repos (currentUserReposR, languagesForR, userReposR) import Data.Either.Compat (isRight) import Data.String (fromString) import System.Environment (lookupEnv)-import Test.Hspec (Spec, describe, it, pendingWith, shouldBe,- shouldSatisfy)+import Test.Hspec+ (Spec, describe, it, pendingWith, shouldBe, shouldSatisfy) import qualified Data.HashMap.Strict as HM @@ -29,24 +35,24 @@ spec = do describe "repositoryR" $ do it "works" $ withAuth $ \auth -> do- er <- executeRequest auth $ repositoryR "phadej" "github"+ er <- github auth repositoryR "haskell-github" "github" er `shouldSatisfy` isRight let Right r = er- -- https://github.com/phadej/github/pull/219+ -- https://github.com/haskell-github/github/pull/219 repoDefaultBranch r `shouldBe` Just "master" describe "currentUserRepos" $ do it "works" $ withAuth $ \auth -> do- cs <- currentUserRepos auth RepoPublicityAll+ cs <- github auth currentUserReposR RepoPublicityAll FetchAll cs `shouldSatisfy` isRight describe "userRepos" $ do it "works" $ withAuth $ \auth -> do- cs <- userRepos' (Just auth) "phadej" RepoPublicityAll+ cs <- github auth userReposR "phadej" RepoPublicityAll FetchAll cs `shouldSatisfy` isRight describe "languagesFor'" $ do it "works" $ withAuth $ \auth -> do- ls <- languagesFor' (Just auth) "phadej" "github"+ ls <- github auth languagesForR "haskell-github" "github" ls `shouldSatisfy` isRight fromRightS ls `shouldSatisfy` HM.member "Haskell"
+ spec/GitHub/ReviewDecodeSpec.hs view
@@ -0,0 +1,25 @@+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE TemplateHaskell #-}+module GitHub.ReviewDecodeSpec where++import Data.Aeson (eitherDecodeStrict)+import Data.Either.Compat (isRight)+import Data.FileEmbed (embedFile)+import Test.Hspec+ (Spec, describe, it, shouldSatisfy)++import GitHub.Data (Review)++spec :: Spec+spec = do+ describe "PENDING state" $ do+ -- https://docs.github.com/en/rest/reference/pulls#create-a-review-for-a-pull-request+ -- > Pull request reviews created in the PENDING state do not include the submitted_at property in the response.+ it "decodes review when submitted_at is missing" $ do+ let reviewInfo = eitherDecodeStrict $(embedFile "fixtures/pull-request-pending-review.json") :: Either String Review+ reviewInfo `shouldSatisfy` isRight++ describe "Other states" $ do+ it "decodes review" $ do+ let reviewInfo = eitherDecodeStrict $(embedFile "fixtures/pull-request-approved-review.json") :: Either String Review+ reviewInfo `shouldSatisfy` isRight
spec/GitHub/SearchSpec.hs view
@@ -14,9 +14,11 @@ import qualified Data.Vector as V +import GitHub (github) import GitHub.Data- (Auth (..), Issue (..), IssueNumber (..), IssueState (..), mkId)-import GitHub.Endpoints.Search (SearchResult (..), searchIssues')+ (Auth (..), Issue (..), IssueNumber (..), IssueState (..),+ SimpleUser (..), User, mkId)+import GitHub.Endpoints.Search (SearchResult' (..), SearchResult, searchIssuesR, searchUsersR) fromRightS :: Show a => Either a b -> b fromRightS (Right b) = b@@ -52,7 +54,14 @@ issueState issue2 `shouldBe` StateOpen it "performs an issue search via the API" $ withAuth $ \auth -> do- let query = "Decouple in:title repo:phadej/github created:<=2015-12-01"- issues <- searchResultResults . fromRightS <$> searchIssues' (Just auth) query+ let query = "Decouple in:title repo:haskell-github/github created:<=2015-12-01"+ issues <- fmap (searchResultResults . fromRightS) <$> github auth $ searchIssuesR query 5 length issues `shouldBe` 1 issueId (V.head issues) `shouldBe` mkId (Proxy :: Proxy Issue) 119694665++ describe "searchUsers" $+ it "performs a user search via the API" $ withAuth $ \auth -> do+ let query = "oleg.grenrus@iki.fi created:<2020-01-01"+ users <- fmap (searchResultResults . fromRightS) <$> github auth $ searchUsersR query 5+ length users `shouldBe` 1+ simpleUserId (V.head users) `shouldBe` mkId (Proxy :: Proxy User) 51087
spec/GitHub/UsersSpec.hs view
@@ -15,9 +15,9 @@ import GitHub.Data (Auth (..), Organization (..), User (..), fromOwner) import GitHub.Endpoints.Users- (ownerInfoForR, userInfoCurrent', userInfoFor')+ (ownerInfoForR, userInfoCurrentR, userInfoForR) import GitHub.Endpoints.Users.Followers (usersFollowedByR, usersFollowingR)-import GitHub.Request (executeRequest)+import GitHub.Request (github) fromRightS :: Show a => Either a b -> b fromRightS (Right b) = b@@ -46,37 +46,37 @@ userLogin (fromRightS userInfo) `shouldBe` "mike-burns" it "returns information about the user" $ withAuth $ \auth -> do- userInfo <- userInfoFor' (Just auth) "mike-burns"+ userInfo <- github auth userInfoForR "mike-burns" userLogin (fromRightS userInfo) `shouldBe` "mike-burns" it "catches http exceptions" $ withAuth $ \auth -> do- userInfo <- userInfoFor' (Just auth) "i-hope-this-user-will-never-exist"+ userInfo <- github auth userInfoForR "i-hope-this-user-will-never-exist" userInfo `shouldSatisfy` isLeft it "should fail for organization" $ withAuth $ \auth -> do- userInfo <- userInfoFor' (Just auth) "haskell"+ userInfo <- github auth userInfoForR "haskell" userInfo `shouldSatisfy` isLeft describe "ownerInfoFor" $ do it "works for users and organizations" $ withAuth $ \auth -> do- a <- executeRequest auth $ ownerInfoForR "haskell"- b <- executeRequest auth $ ownerInfoForR "phadej"+ a <- github auth ownerInfoForR "haskell"+ b <- github auth ownerInfoForR "phadej" a `shouldSatisfy` isRight b `shouldSatisfy` isRight (organizationLogin . fromRightS . fromOwner . fromRightS $ a) `shouldBe` "haskell" (userLogin . fromLeftS . fromOwner . fromRightS $ b) `shouldBe` "phadej" - describe "userInfoCurrent'" $ do- it "returns information about the autenticated user" $ withAuth $ \auth -> do- userInfo <- userInfoCurrent' auth+ describe "userInfoCurrentR" $ do+ it "returns information about the authenticated user" $ withAuth $ \auth -> do+ userInfo <- github auth userInfoCurrentR userInfo `shouldSatisfy` isRight describe "usersFollowing" $ do it "works" $ withAuth $ \auth -> do- us <- executeRequest auth $ usersFollowingR "phadej" (GitHub.FetchAtLeast 10)+ us <- github auth usersFollowingR "phadej" (GitHub.FetchAtLeast 10) us `shouldSatisfy` isRight describe "usersFollowedBy" $ do it "works" $ withAuth $ \auth -> do- us <- executeRequest auth $ usersFollowedByR "phadej" (GitHub.FetchAtLeast 10)+ us <- github auth usersFollowedByR "phadej" (GitHub.FetchAtLeast 10) us `shouldSatisfy` isRight
src/GitHub.hs view
@@ -1,16 +1,18 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>------ This module re-exports all request constructrors and data definitions from+-- This module re-exports all request constructors and data definitions from -- this package. ----- See "GitHub.Request" module for executing 'Request', or other modules--- of this package (e.g. "GitHub.Endpoints.Users") for already composed versions.+-- See "GitHub.Request" module for executing 'Request', in short+-- use @'github' request@, for example --+-- @+-- 'github' 'userInfoForR'+-- :: 'AuthMethod' am => am -> 'Name' 'User' -> IO (Either 'Error' 'User')+-- @+-- -- The missing endpoints lists show which endpoints we know are missing, there -- might be more.+ module GitHub ( -- * Activity -- | See <https://developer.github.com/v3/activity/>@@ -46,9 +48,9 @@ -- -- * Query a Repository Subscription -- * Set a Repository Subscription- -- * Delete a Repository Subscription watchersForR, reposWatchedByR,+ unwatchRepoR, -- * Gists -- | See <https://developer.github.com/v3/gists/>@@ -56,7 +58,6 @@ -- Missing endpoints: -- -- * Query a specific revision of a gist- -- * Create a gist -- * Edit a gist -- * List gist commits -- * Check if a gist is starred@@ -64,6 +65,7 @@ -- * List gist forks gistsR, gistR,+ createGistR, starGistR, unstarGistR, deleteGistR,@@ -94,6 +96,8 @@ referenceR, referencesR, createReferenceR,+ deleteReferenceR,+ namespacedReferencesR, -- ** Trees -- | See <https://developer.github.com/v3/git/trees/>@@ -146,11 +150,8 @@ -- milestonesR, milestoneR,- createMilestone, createMilestoneR,- updateMilestone, updateMilestoneR,- deleteMilestone, deleteMilestoneR, -- * Organizations@@ -172,6 +173,12 @@ membersOfWithR, isMemberOfR, orgInvitationsR,+ orgMembershipR,+ -- ** Outside Collaborators+ -- | See <https://developer.github.com/v3/orgs/outside_collaborators/>+ --+ -- Missing endpoints: All except /Outside Collaborator List/+ outsideCollaboratorsR, -- ** Teams -- | See <https://developer.github.com/v3/orgs/teams/>@@ -220,6 +227,7 @@ pullRequestCommentsR, pullRequestCommentR, createPullCommentR,+ createPullCommentReplyR, -- ** Pull request reviews -- | See <https://developer.github.com/v3/pulls/reviews/>@@ -231,14 +239,8 @@ -- * Submit a pull request review -- * Dismiss a pull request review pullRequestReviewsR,- pullRequestReviews,- pullRequestReviews', pullRequestReviewR,- pullRequestReview,- pullRequestReview', pullRequestReviewCommentsR,- pullRequestReviewCommentsIO,- pullRequestReviewCommentsIO', -- * Repositories -- | See <https://developer.github.com/v3/repos/>@@ -261,6 +263,7 @@ -- ** Collaborators -- | See <https://developer.github.com/v3/repos/collaborators/> collaboratorsOnR,+ collaboratorPermissionOnR, isCollaboratorOnR, addCollaboratorR, @@ -283,6 +286,31 @@ commitR, diffR, + -- ** Reactions+ -- | See <https://docs.github.com/en/rest/reactions/reactions?apiVersion=2022-11-28>+ issueReactionsR,+ createIssueReactionR,+ deleteIssueReactionR,+ commentReactionsR,+ createCommentReactionR,+ deleteCommentReactionR,++ -- ** Contents+ -- | See <https://developer.github.com/v3/repos/contents/>+ contentsForR,+ readmeForR,+ archiveForR,+ createFileR,+ updateFileR,+ deleteFileR,++ -- ** Deploy Keys+ -- | See <https://developer.github.com/v3/repos/keys/>+ deployKeysForR,+ deployKeyForR,+ createRepoDeployKeyR,+ deleteRepoDeployKeyR,+ -- ** Deployments -- | See <https://developer.github.com/v3/repos/deployments/#deployments> --@@ -303,6 +331,12 @@ -- * Create a fork forksForR, + -- ** Statuses+ -- | See <https://developer.github.com/v3/repos/statuses/>+ createStatusR,+ statusesForR,+ statusForR,+ -- ** Webhooks -- | See <https://developer.github.com/v3/repos/hooks/> webhooksForR,@@ -334,13 +368,10 @@ -- * Search -- | See <https://developer.github.com/v3/search/>- --- -- Missing endpoints:- --- -- * Search users searchReposR, searchCodeR, searchIssuesR,+ searchUsersR, -- * Users -- | See <https://developer.github.com/v3/users/>@@ -376,16 +407,88 @@ usersFollowingR, usersFollowedByR, - -- ** Statuses- -- | See <https://developer.github.com/v3/repos/statuses/>- createStatusR,- statusesForR,- statusForR,+ -- ** Git SSH Keys+ -- | See <https://developer.github.com/v3/users/keys/>+ publicSSHKeysR,+ publicSSHKeysForR,+ publicSSHKeyR,+ createUserPublicSSHKeyR,+ deleteUserPublicSSHKeyR, -- ** Rate Limit -- | See <https://developer.github.com/v3/rate_limit/> rateLimitR, + -- ** Actions - artifacts+ -- | See <https://docs.github.com/en/rest/actions/artifacts>+ artifactsForR,+ artifactR,+ deleteArtifactR,+ downloadArtifactR,+ artifactsForWorkflowRunR,++ -- ** Actions - cache+ -- | See <https://docs.github.com/en/rest/actions/cache>+ cacheUsageOrganizationR,+ cacheUsageByRepositoryR,+ cacheUsageR,+ cachesForRepoR,+ deleteCacheR,++ -- ** Actions - secrets+ -- | See <https://docs.github.com/en/rest/actions/secrets>+ organizationSecretsR,+ organizationPublicKeyR,+ organizationSecretR,+ setOrganizationSecretR,+ deleteOrganizationSecretR,+ organizationSelectedRepositoriesForSecretR,+ setOrganizationSelectedRepositoriesForSecretR,+ addOrganizationSelectedRepositoriesForSecretR,+ removeOrganizationSelectedRepositoriesForSecretR,+ repoSecretsR,+ repoPublicKeyR,+ repoSecretR,+ setRepoSecretR,+ deleteRepoSecretR,+ environmentSecretsR,+ environmentPublicKeyR,+ environmentSecretR,+ setEnvironmentSecretR,+ deleteEnvironmentSecretR,++ -- ** Actions - workflow jobs+ -- | See <https://docs.github.com/en/rest/actions/workflow-jobs>+ jobR,+ downloadJobLogsR,+ jobsForWorkflowRunAttemptR,+ jobsForWorkflowRunR,++ -- ** Actions - workflow runs+ -- | See <https://docs.github.com/en/rest/actions/workflow-runs>+ reRunJobR,+ workflowRunsR,+ workflowRunR,+ deleteWorkflowRunR,+ workflowRunReviewHistoryR,+ approveWorkflowRunR,+ workflowRunAttemptR,+ downloadWorkflowRunAttemptLogsR,+ cancelWorkflowRunR,+ downloadWorkflowRunLogsR,+ deleteWorkflowRunLogsR,+ reRunWorkflowR,+ reRunFailedJobsR,+ workflowRunsForWorkflowR,++ -- ** Actions - workflows+ -- | See <https://docs.github.com/en/rest/actions/workflows>+ repositoryWorkflowsR,+ workflowR,+ disableWorkflowR,+ triggerWorkflowR,+ enableWorkflowR,+ -- * Data definitions module GitHub.Data, -- * Request handling@@ -393,6 +496,12 @@ ) where import GitHub.Data+import GitHub.Endpoints.Actions.Artifacts+import GitHub.Endpoints.Actions.Cache+import GitHub.Endpoints.Actions.Secrets+import GitHub.Endpoints.Actions.WorkflowJobs+import GitHub.Endpoints.Actions.WorkflowRuns+import GitHub.Endpoints.Actions.Workflows import GitHub.Endpoints.Activity.Events import GitHub.Endpoints.Activity.Notifications import GitHub.Endpoints.Activity.Starring@@ -410,15 +519,19 @@ import GitHub.Endpoints.Issues.Milestones import GitHub.Endpoints.Organizations import GitHub.Endpoints.Organizations.Members+import GitHub.Endpoints.Organizations.OutsideCollaborators import GitHub.Endpoints.Organizations.Teams import GitHub.Endpoints.PullRequests import GitHub.Endpoints.PullRequests.Comments import GitHub.Endpoints.PullRequests.Reviews+import GitHub.Endpoints.Reactions import GitHub.Endpoints.RateLimit import GitHub.Endpoints.Repos import GitHub.Endpoints.Repos.Collaborators import GitHub.Endpoints.Repos.Comments import GitHub.Endpoints.Repos.Commits+import GitHub.Endpoints.Repos.Contents+import GitHub.Endpoints.Repos.DeployKeys import GitHub.Endpoints.Repos.Deployments import GitHub.Endpoints.Repos.Forks import GitHub.Endpoints.Repos.Invitations@@ -429,4 +542,5 @@ import GitHub.Endpoints.Users import GitHub.Endpoints.Users.Emails import GitHub.Endpoints.Users.Followers+import GitHub.Endpoints.Users.PublicSSHKeys import GitHub.Request
src/GitHub/Auth.hs view
@@ -1,10 +1,7 @@--------------------------------------------------------------------------------- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- module GitHub.Auth ( Auth (..),+ Token,+ JWTToken, AuthMethod, endpoint, setAuthRequest@@ -14,35 +11,46 @@ import Prelude () import qualified Data.ByteString as BS+import qualified Data.Text.Encoding as TE import qualified Network.HTTP.Client as HTTP type Token = BS.ByteString+type JWTToken = Text -- | The Github auth data type data Auth = BasicAuth BS.ByteString BS.ByteString -- ^ Username and password | OAuth Token -- ^ OAuth token+ | JWT JWTToken -- ^ JWT Token | EnterpriseOAuth Text Token -- ^ Custom endpoint and OAuth token- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData Auth where rnf = genericRnf+instance NFData Auth instance Binary Auth instance Hashable Auth -- | A type class for different authentication methods+--+-- Note the '()' intance, which doee nothing, i.e. is unauthenticated. class AuthMethod a where -- | Custom API endpoint without trailing slash endpoint :: a -> Maybe Text -- | A function which sets authorisation on an HTTP request setAuthRequest :: a -> HTTP.Request -> HTTP.Request +instance AuthMethod () where+ endpoint _ = Nothing+ setAuthRequest _ = id+ instance AuthMethod Auth where endpoint (BasicAuth _ _) = Nothing endpoint (OAuth _) = Nothing+ endpoint (JWT _) = Nothing endpoint (EnterpriseOAuth e _) = Just e setAuthRequest (BasicAuth u p) = HTTP.applyBasicAuth u p setAuthRequest (OAuth t) = setAuthHeader $ "token " <> t+ setAuthRequest (JWT t) = setAuthHeader $ "Bearer " <> TE.encodeUtf8 t setAuthRequest (EnterpriseOAuth _ t) = setAuthHeader $ "token " <> t setAuthHeader :: BS.ByteString -> HTTP.Request -> HTTP.Request
src/GitHub/Data.hs view
@@ -1,10 +1,6 @@-{-# LANGUAGE CPP #-}------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- This module re-exports the @GitHub.Data.@ and "GitHub.Auth" submodules.+ module GitHub.Data ( -- * Tagged types -- ** Name@@ -34,6 +30,13 @@ IssueNumber (..), -- * Module re-exports module GitHub.Auth,+ module GitHub.Data.Actions.Common,+ module GitHub.Data.Actions.Artifacts,+ module GitHub.Data.Actions.Cache,+ module GitHub.Data.Actions.Secrets,+ module GitHub.Data.Actions.Workflows,+ module GitHub.Data.Actions.WorkflowJobs,+ module GitHub.Data.Actions.WorkflowRuns, module GitHub.Data.Activities, module GitHub.Data.Comments, module GitHub.Data.Content,@@ -52,6 +55,7 @@ module GitHub.Data.PullRequests, module GitHub.Data.RateLimit, module GitHub.Data.Releases,+ module GitHub.Data.Reactions, module GitHub.Data.Repos, module GitHub.Data.Request, module GitHub.Data.Reviews,@@ -59,13 +63,21 @@ module GitHub.Data.Statuses, module GitHub.Data.Teams, module GitHub.Data.URL,- module GitHub.Data.Webhooks+ module GitHub.Data.Webhooks,+ module GitHub.Data.Webhooks.Validate, ) where import GitHub.Internal.Prelude import Prelude () import GitHub.Auth+import GitHub.Data.Actions.Common+import GitHub.Data.Actions.Artifacts+import GitHub.Data.Actions.Secrets+import GitHub.Data.Actions.Cache+import GitHub.Data.Actions.Workflows+import GitHub.Data.Actions.WorkflowJobs+import GitHub.Data.Actions.WorkflowRuns import GitHub.Data.Activities import GitHub.Data.Comments import GitHub.Data.Content@@ -86,6 +98,7 @@ import GitHub.Data.PullRequests import GitHub.Data.RateLimit import GitHub.Data.Releases+import GitHub.Data.Reactions import GitHub.Data.Repos import GitHub.Data.Request import GitHub.Data.Reviews@@ -94,6 +107,7 @@ import GitHub.Data.Teams import GitHub.Data.URL import GitHub.Data.Webhooks+import GitHub.Data.Webhooks.Validate mkOwnerId :: Int -> Id Owner mkOwnerId = Id
+ src/GitHub/Data/Actions/Artifacts.hs view
@@ -0,0 +1,76 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE KindSignatures #-}++module GitHub.Data.Actions.Artifacts (+ Artifact(..),+ ArtifactWorkflowRun(..),+ ) where++import GitHub.Data.Id (Id)+import GitHub.Data.URL (URL)+import GitHub.Internal.Prelude+import Prelude ()++import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount))+import GitHub.Data.Actions.WorkflowRuns (WorkflowRun)+import GitHub.Data.Repos (Repo)++-------------------------------------------------------------------------------+-- Artifact+-------------------------------------------------------------------------------++data ArtifactWorkflowRun = ArtifactWorkflowRun+ { artifactWorkflowRunWorkflowRunId :: !(Id WorkflowRun)+ , artifactWorkflowRunRepositoryId :: !(Id Repo)+ , artifactWorkflowRunHeadRepositoryId :: !(Id Repo)+ , artifactWorkflowRunHeadBranch :: !Text+ , artifactWorkflowRunHeadSha :: !Text+ }+ deriving (Show, Data, Eq, Ord, Generic)++data Artifact = Artifact+ { artifactArchiveDownloadUrl :: !URL+ , artifactCreatedAt :: !UTCTime+ , artifactExpired :: !Bool+ , artifactExpiresAt :: !UTCTime+ , artifactId :: !(Id Artifact)+ , artifactName :: !Text+ , artifactNodeId :: !Text+ , artifactSizeInBytes :: !Int+ , artifactUpdatedAt :: !UTCTime+ , artifactUrl :: !URL+ , artifactWorkflowRun :: !ArtifactWorkflowRun+ }+ deriving (Show, Data, Eq, Ord, Generic)++-------------------------------------------------------------------------------+-- JSON instances+-------------------------------------------------------------------------------++instance FromJSON ArtifactWorkflowRun where+ parseJSON = withObject "ArtifactWorkflowRun" $ \o -> ArtifactWorkflowRun+ <$> o .: "id"+ <*> o .: "repository_id"+ <*> o .: "head_repository_id"+ <*> o .: "head_branch"+ <*> o .: "head_sha"++instance FromJSON Artifact where+ parseJSON = withObject "Artifact" $ \o -> Artifact+ <$> o .: "archive_download_url"+ <*> o .: "created_at"+ <*> o .: "expired"+ <*> o .: "expires_at"+ <*> o .: "id"+ <*> o .: "name"+ <*> o .: "node_id"+ <*> o .: "size_in_bytes"+ <*> o .: "updated_at"+ <*> o .: "url"+ <*> o .: "workflow_run"++instance FromJSON (WithTotalCount Artifact) where+ parseJSON = withObject "ArtifactList" $ \o -> WithTotalCount+ <$> o .: "artifacts"+ <*> o .: "total_count"
+ src/GitHub/Data/Actions/Cache.hs view
@@ -0,0 +1,78 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE KindSignatures #-}++module GitHub.Data.Actions.Cache (+ Cache(..),+ RepositoryCacheUsage(..),+ OrganizationCacheUsage(..)+ ) where++import GitHub.Data.Id (Id)+import GitHub.Internal.Prelude+import Prelude ()++import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount))++-------------------------------------------------------------------------------+-- Cache+-------------------------------------------------------------------------------++data Cache = Cache+ { cacheId :: !(Id Cache)+ , cacheRef :: !Text+ , cacheKey :: !Text+ , cacheVersion :: !Text+ , cacheLastAccessedAt :: !UTCTime+ , cacheCreatedAt :: !UTCTime+ , cacheSizeInBytes :: !Int+ }+ deriving (Show, Data, Eq, Ord, Generic)++data RepositoryCacheUsage = RepositoryCacheUsage+ { repositoryCacheUsageFullName :: !Text+ , repositoryCacheUsageActiveCachesSizeInBytes :: !Int+ , repositoryCacheUsageActiveCachesCount :: !Int+ }+ deriving (Show, Data, Eq, Ord, Generic)++data OrganizationCacheUsage = OrganizationCacheUsage+ { organizationCacheUsageTotalActiveCachesSizeInBytes :: !Int+ , organizationCacheUsageTotalActiveCachesCount :: !Int+ }+ deriving (Show, Data, Eq, Ord, Generic)++-------------------------------------------------------------------------------+-- JSON instances+-------------------------------------------------------------------------------++instance FromJSON Cache where+ parseJSON = withObject "Cache" $ \o -> Cache+ <$> o .: "id"+ <*> o .: "ref"+ <*> o .: "key"+ <*> o .: "version"+ <*> o .: "last_accessed_at"+ <*> o .: "created_at"+ <*> o .: "size_in_bytes"++instance FromJSON (WithTotalCount Cache) where+ parseJSON = withObject "CacheList" $ \o -> WithTotalCount+ <$> o .: "actions_caches"+ <*> o .: "total_count"++instance FromJSON OrganizationCacheUsage where+ parseJSON = withObject "OrganizationCacheUsage" $ \o -> OrganizationCacheUsage+ <$> o .: "total_active_caches_size_in_bytes"+ <*> o .: "total_active_caches_count"++instance FromJSON RepositoryCacheUsage where+ parseJSON = withObject "RepositoryCacheUsage" $ \o -> RepositoryCacheUsage+ <$> o .: "full_name"+ <*> o .: "active_caches_size_in_bytes"+ <*> o .: "active_caches_count"++instance FromJSON (WithTotalCount RepositoryCacheUsage) where+ parseJSON = withObject "CacheUsageList" $ \o -> WithTotalCount+ <$> o .: "repository_cache_usages"+ <*> o .: "total_count"
+ src/GitHub/Data/Actions/Common.hs view
@@ -0,0 +1,33 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE KindSignatures #-}++module GitHub.Data.Actions.Common (+ WithTotalCount(..),+ ) where++import GitHub.Internal.Prelude+import Prelude ()++-------------------------------------------------------------------------------+-- Common+-------------------------------------------------------------------------------++-- | A page of a paginated response.+data WithTotalCount a = WithTotalCount+ { withTotalCountItems :: !(Vector a)+ -- ^ A snippet of the answer.+ , withTotalCountTotalCount :: !Int+ -- ^ The total size of the answer.+ }+ deriving (Show, Data, Eq, Ord, Generic)++-- | Joining two pages of a paginated response.+-- The 'withTotalCountTotalCount' is assumed to be the same in both pages,+-- but this is not checked.+instance Semigroup (WithTotalCount a) where+ WithTotalCount items1 count1 <> WithTotalCount items2 _ =+ WithTotalCount (items1 <> items2) count1++instance Foldable WithTotalCount where+ foldMap f (WithTotalCount items _) = foldMap f items
+ src/GitHub/Data/Actions/Secrets.hs view
@@ -0,0 +1,141 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE KindSignatures #-}+{-# LANGUAGE RecordWildCards #-}++module GitHub.Data.Actions.Secrets (+ OrganizationSecret(..),+ PublicKey(..),+ SetSecret(..),+ SetRepoSecret(..),+ SelectedRepo(..),+ SetSelectedRepositories(..),+ RepoSecret(..),+ Environment(..),+ ) where++import GitHub.Data.Id (Id)+import GitHub.Internal.Prelude+import Prelude ()++import Data.Maybe (maybeToList)+import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount))+import GitHub.Data.Name (Name)+import GitHub.Data.Repos (Repo)++-------------------------------------------------------------------------------+-- Secret+-------------------------------------------------------------------------------++data OrganizationSecret = OrganizationSecret+ { organizationSecretName :: !(Name OrganizationSecret)+ , organizationSecretCreatedAt :: !UTCTime+ , organizationSecretUpdatedAt :: !UTCTime+ , organizationSecretVisibility :: !Text+ }+ deriving (Show, Data, Eq, Ord, Generic)++data PublicKey = PublicKey+ { publicKeyId :: !Text+ , publicKeyKey :: !Text+ }+ deriving (Show, Data, Eq, Ord, Generic)++data SetSecret = SetSecret+ { setSecretPublicKeyId :: !Text+ , setSecretEncryptedValue :: !Text+ , setSecretVisibility :: !Text+ , setSecretSelectedRepositoryIds :: !(Maybe [Id Repo])+ }+ deriving (Show, Data, Eq, Ord, Generic)++data SetRepoSecret = SetRepoSecret+ { setRepoSecretPublicKeyId :: !Text+ , setRepoSecretEncryptedValue :: !Text+ }+ deriving (Show, Data, Eq, Ord, Generic)++data SelectedRepo = SelectedRepo+ { selectedRepoRepoId :: !(Id Repo)+ , selectedRepoRepoName :: !(Name Repo)+ }+ deriving (Show, Data, Eq, Ord, Generic)++data SetSelectedRepositories = SetSelectedRepositories+ { setSelectedRepositoriesRepositoryIds :: ![Id Repo]+ }+ deriving (Show, Data, Eq, Ord, Generic)++data RepoSecret = RepoSecret+ { repoSecretName :: !(Name RepoSecret)+ , repoSecretCreatedAt :: !UTCTime+ , repoSecretUpdatedAt :: !UTCTime+ }+ deriving (Show, Data, Eq, Ord, Generic)++-- TODO move somewhere else?+data Environment = Environment+ deriving (Show, Data, Eq, Ord, Generic)++-------------------------------------------------------------------------------+-- JSON instances+-------------------------------------------------------------------------------++instance FromJSON OrganizationSecret where+ parseJSON = withObject "Secret" $ \o -> OrganizationSecret+ <$> o .: "name"+ <*> o .: "created_at"+ <*> o .: "updated_at"+ <*> o .: "visibility"++instance FromJSON (WithTotalCount OrganizationSecret) where+ parseJSON = withObject "SecretList" $ \o -> WithTotalCount+ <$> o .: "secrets"+ <*> o .: "total_count"++instance FromJSON PublicKey where+ parseJSON = withObject "PublicKey" $ \o -> PublicKey+ <$> o .: "key_id"+ <*> o .: "key"++instance FromJSON SelectedRepo where+ parseJSON = withObject "SelectedRepo" $ \o -> SelectedRepo+ <$> o .: "id"+ <*> o .: "name"++instance ToJSON SetSelectedRepositories where+ toJSON SetSelectedRepositories{..} =+ object+ [ "selected_repository_ids" .= setSelectedRepositoriesRepositoryIds+ ]++instance ToJSON SetSecret where+ toJSON SetSecret{..} =+ object $+ [ "encrypted_value" .= setSecretEncryptedValue+ , "key_id" .= setSecretPublicKeyId+ , "visibility" .= setSecretVisibility+ ] <> maybeToList (fmap ("selected_repository_ids" .=) setSecretSelectedRepositoryIds)++instance ToJSON SetRepoSecret where+ toJSON SetRepoSecret{..} =+ object+ [ "encrypted_value" .= setRepoSecretEncryptedValue+ , "key_id" .= setRepoSecretPublicKeyId+ ]++instance FromJSON (WithTotalCount SelectedRepo) where+ parseJSON = withObject "SelectedRepoList" $ \o -> WithTotalCount+ <$> o .: "repositories"+ <*> o .: "total_count"++instance FromJSON RepoSecret where+ parseJSON = withObject "RepoSecret" $ \o -> RepoSecret+ <$> o .: "name"+ <*> o .: "created_at"+ <*> o .: "updated_at"++instance FromJSON (WithTotalCount RepoSecret) where+ parseJSON = withObject "RepoSecretList" $ \o -> WithTotalCount+ <$> o .: "secrets"+ <*> o .: "total_count"
+ src/GitHub/Data/Actions/WorkflowJobs.hs view
@@ -0,0 +1,100 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE KindSignatures #-}++module GitHub.Data.Actions.WorkflowJobs (+ JobStep(..),+ Job(..),+ ) where++import Prelude ()+import GitHub.Internal.Prelude+ (Applicative ((<*>)), Data, Eq, FromJSON (parseJSON), Generic, Integer,+ Ord, Show, Text, UTCTime, Vector, withObject, ($), (.:),+ (<$>))++import GitHub.Data.Id (Id)+import GitHub.Data.Name (Name)+import GitHub.Data.URL (URL)++import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount))+import GitHub.Data.Actions.WorkflowRuns (WorkflowRun)++-------------------------------------------------------------------------------+-- Workflow jobs+-------------------------------------------------------------------------------++data JobStep = JobStep+ { jobStepName :: !(Name JobStep)+ , jobStepStatus :: !Text+ , jobStepConclusion :: !Text+ , jobStepNumber :: !Integer+ , jobStepStartedAt :: !UTCTime+ , jobStepCompletedAt :: !UTCTime+ }+ deriving (Show, Data, Eq, Ord, Generic)++data Job = Job+ { jobId :: !(Id Job)+ , jobRunId :: !(Id WorkflowRun)+ , jobRunUrl :: !URL+ , jobRunAttempt :: !Integer+ , jobNodeId :: !Text+ , jobHeadSha :: !Text+ , jobUrl :: !URL+ , jobHtmlUrl :: !URL+ , jobStatus :: !Text+ , jobConclusion :: !Text+ , jobStartedAt :: !UTCTime+ , jobCompletedAt :: !UTCTime+ , jobName :: !(Name Job)+ , jobSteps :: !(Vector JobStep)+ , jobRunCheckUrl :: !URL+ , jobLabels :: !(Vector Text)+ , jobRunnerId :: !Integer+ , jobRunnerName :: !Text+ , jobRunnerGroupId :: !Integer+ , jobRunnerGroupName :: !Text+ }+ deriving (Show, Data, Eq, Ord, Generic)++-------------------------------------------------------------------------------+-- JSON instances+-------------------------------------------------------------------------------++instance FromJSON JobStep where+ parseJSON = withObject "JobStep" $ \o -> JobStep+ <$> o .: "name"+ <*> o .: "status"+ <*> o .: "conclusion"+ <*> o .: "number"+ <*> o .: "started_at"+ <*> o .: "completed_at"++instance FromJSON Job where+ parseJSON = withObject "Job" $ \o -> Job+ <$> o .: "id"+ <*> o .: "run_id"+ <*> o .: "run_url"+ <*> o .: "run_attempt"+ <*> o .: "node_id"+ <*> o .: "head_sha"+ <*> o .: "url"+ <*> o .: "html_url"+ <*> o .: "status"+ <*> o .: "conclusion"+ <*> o .: "started_at"+ <*> o .: "completed_at"+ <*> o .: "name"+ <*> o .: "steps"+ <*> o .: "check_run_url"+ <*> o .: "labels"+ <*> o .: "runner_id"+ <*> o .: "runner_name"+ <*> o .: "runner_group_id"+ <*> o .: "runner_group_name"++instance FromJSON (WithTotalCount Job) where+ parseJSON = withObject "JobList" $ \o -> WithTotalCount+ <$> o .: "jobs"+ <*> o .: "total_count"
+ src/GitHub/Data/Actions/WorkflowRuns.hs view
@@ -0,0 +1,91 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE KindSignatures #-}++module GitHub.Data.Actions.WorkflowRuns (+ WorkflowRun(..),+ RunAttempt(..),+ ReviewHistory(..),+ ) where++import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount))+import GitHub.Data.Definitions+import GitHub.Data.URL (URL)+import GitHub.Internal.Prelude+import Prelude ()++import GitHub.Data.Id (Id)+import GitHub.Data.Name (Name)++-------------------------------------------------------------------------------+-- Workflow runs+-------------------------------------------------------------------------------++data WorkflowRun = WorkflowRun+ { workflowRunWorkflowRunId :: !(Id WorkflowRun)+ , workflowRunName :: !(Name WorkflowRun)+ , workflowRunHeadBranch :: !Text+ , workflowRunHeadSha :: !Text+ , workflowRunPath :: !Text+ , workflowRunDisplayTitle :: !Text+ , workflowRunRunNumber :: !Integer+ , workflowRunEvent :: !Text+ , workflowRunStatus :: !Text+ , workflowRunConclusion :: !(Maybe Text)+ , workflowRunWorkflowId :: !Integer+ , workflowRunUrl :: !URL+ , workflowRunHtmlUrl :: !URL+ , workflowRunCreatedAt :: !UTCTime+ , workflowRunUpdatedAt :: !UTCTime+ , workflowRunActor :: !SimpleUser+ , workflowRunAttempt :: !Integer+ , workflowRunStartedAt :: !UTCTime+ }+ deriving (Show, Data, Eq, Ord, Generic)++data RunAttempt = RunAttempt+ deriving (Show, Data, Eq, Ord, Generic)++data ReviewHistory = ReviewHistory+ { reviewHistoryState :: !Text+ , reviewHistoryComment :: !Text+ , reviewHistoryUser :: !SimpleUser++ }+ deriving (Show, Data, Eq, Ord, Generic)++-------------------------------------------------------------------------------+-- JSON instances+-------------------------------------------------------------------------------++instance FromJSON WorkflowRun where+ parseJSON = withObject "WorkflowRun" $ \o -> WorkflowRun+ <$> o .: "id"+ <*> o .: "name"+ <*> o .: "head_branch"+ <*> o .: "head_sha"+ <*> o .: "path"+ <*> o .: "display_title"+ <*> o .: "run_number"+ <*> o .: "event"+ <*> o .: "status"+ <*> o .: "conclusion"+ <*> o .: "workflow_id"+ <*> o .: "url"+ <*> o .: "html_url"+ <*> o .: "created_at"+ <*> o .: "updated_at"+ <*> o .: "actor"+ <*> o .: "run_attempt"+ <*> o .: "run_started_at"++instance FromJSON (WithTotalCount WorkflowRun) where+ parseJSON = withObject "WorkflowRunList" $ \o -> WithTotalCount+ <$> o .: "workflow_runs"+ <*> o .: "total_count"++instance FromJSON ReviewHistory where+ parseJSON = withObject "ReviewHistory" $ \o -> ReviewHistory+ <$> o .: "state"+ <*> o .: "comment"+ <*> o .: "user"
+ src/GitHub/Data/Actions/Workflows.hs view
@@ -0,0 +1,62 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE KindSignatures #-}++module GitHub.Data.Actions.Workflows (+ Workflow(..),+ CreateWorkflowDispatchEvent(..),+ ) where++import Prelude ()+import GitHub.Internal.Prelude++import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount))+import GitHub.Data.Id (Id)+import GitHub.Data.URL (URL)++data Workflow = Workflow+ { workflowWorkflowId :: !(Id Workflow)+ , workflowName :: !Text+ , workflowPath :: !Text+ , workflowState :: !Text+ , workflowCreatedAt :: !UTCTime+ , workflowUpdatedAt :: !UTCTime+ , workflowUrl :: !URL+ , workflowHtmlUrl :: !URL+ , workflowBadgeUrl :: !URL+ }+ deriving (Show, Data, Eq, Ord, Generic)++data CreateWorkflowDispatchEvent a = CreateWorkflowDispatchEvent+ { createWorkflowDispatchEventRef :: !Text+ , createWorkflowDispatchEventInputs :: !a+ }+ deriving (Show, Generic)++instance (NFData a) => NFData (CreateWorkflowDispatchEvent a)+instance (Binary a) => Binary (CreateWorkflowDispatchEvent a)++-------------------------------------------------------------------------------+-- JSON instances+-------------------------------------------------------------------------------++instance FromJSON Workflow where+ parseJSON = withObject "Workflow" $ \o -> Workflow+ <$> o .: "id"+ <*> o .: "name"+ <*> o .: "path"+ <*> o .: "state"+ <*> o .: "created_at"+ <*> o .: "updated_at"+ <*> o .: "url"+ <*> o .: "html_url"+ <*> o .: "badge_url"++instance FromJSON (WithTotalCount Workflow) where+ parseJSON = withObject "WorkflowList" $ \o -> WithTotalCount+ <$> o .: "workflows"+ <*> o .: "total_count"++instance ToJSON a => ToJSON (CreateWorkflowDispatchEvent a) where+ toJSON (CreateWorkflowDispatchEvent ref inputs) =+ object [ "ref" .= ref, "inputs" .= inputs ]
src/GitHub/Data/Activities.hs view
@@ -1,8 +1,3 @@--------------------------------------------------------------------------------- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- module GitHub.Data.Activities where import GitHub.Data.Id (Id, mkId)@@ -18,9 +13,9 @@ { repoStarredStarredAt :: !UTCTime , repoStarredRepo :: !Repo }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData RepoStarred where rnf = genericRnf+instance NFData RepoStarred instance Binary RepoStarred -- JSON Instances@@ -31,16 +26,16 @@ data Subject = Subject { subjectTitle :: !Text- , subjectURL :: !URL+ , subjectURL :: !(Maybe URL) , subjectLatestCommentURL :: !(Maybe URL) -- https://developer.github.com/v3/activity/notifications/ doesn't indicate -- what the possible values for this field are. -- TODO: Make an ADT for this. , subjectType :: !Text }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData Subject where rnf = genericRnf+instance NFData Subject instance Binary Subject instance FromJSON Subject where@@ -51,34 +46,44 @@ <*> o .: "type" data NotificationReason- = AssignReason+ = ApprovalRequestedReason+ | AssignReason | AuthorReason | CommentReason+ | CiActivityReason | InvitationReason | ManualReason+ | MemberFeatureRequestedReason | MentionReason | ReviewRequestedReason+ | SecurityAlertReason+ | SecurityAdvisoryCreditReason | StateChangeReason | SubscribedReason | TeamMentionReason- deriving (Show, Data, Enum, Bounded, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Enum, Bounded, Eq, Ord, Generic) -instance NFData NotificationReason where rnf = genericRnf+instance NFData NotificationReason instance Binary NotificationReason instance FromJSON NotificationReason where parseJSON = withText "NotificationReason" $ \t -> case T.toLower t of- "assign" -> pure AssignReason- "author" -> pure AuthorReason- "comment" -> pure CommentReason- "invitation" -> pure InvitationReason- "manual" -> pure ManualReason- "mention" -> pure MentionReason- "review_requested" -> pure ReviewRequestedReason- "state_change" -> pure StateChangeReason- "subscribed" -> pure SubscribedReason- "team_mention" -> pure TeamMentionReason- _ -> fail $ "Unknown NotificationReason " ++ show t+ "approval_requested" -> pure ApprovalRequestedReason+ "assign" -> pure AssignReason+ "author" -> pure AuthorReason+ "comment" -> pure CommentReason+ "ci_activity" -> pure CiActivityReason+ "invitation" -> pure InvitationReason+ "manual" -> pure ManualReason+ "member_feature_requested" -> pure MemberFeatureRequestedReason+ "mention" -> pure MentionReason+ "review_requested" -> pure ReviewRequestedReason+ "security_alert" -> pure SecurityAlertReason+ "security_advisory_credit" -> pure SecurityAdvisoryCreditReason+ "state_change" -> pure StateChangeReason+ "subscribed" -> pure SubscribedReason+ "team_mention" -> pure TeamMentionReason+ _ -> fail $ "Unknown NotificationReason " ++ show t data Notification = Notification -- XXX: The notification id field type IS in fact string. Not sure why gh@@ -92,9 +97,9 @@ , notificationLastReadAt :: !(Maybe UTCTime) , notificationUrl :: !URL }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData Notification where rnf = genericRnf+instance NFData Notification instance Binary Notification instance FromJSON Notification where@@ -107,4 +112,3 @@ <*> o .: "updated_at" <*> o .: "last_read_at" <*> o .: "url"-
src/GitHub/Data/Comments.hs view
@@ -1,8 +1,3 @@--------------------------------------------------------------------------------- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- module GitHub.Data.Comments where import GitHub.Data.Definitions@@ -24,9 +19,9 @@ , commentUser :: !SimpleUser , commentId :: !(Id Comment) }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData Comment where rnf = genericRnf+instance NFData Comment instance Binary Comment instance FromJSON Comment where@@ -46,9 +41,9 @@ data NewComment = NewComment { newCommentBody :: !Text }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData NewComment where rnf = genericRnf+instance NFData NewComment instance Binary NewComment instance ToJSON NewComment where@@ -57,9 +52,9 @@ data EditComment = EditComment { editCommentBody :: !Text }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData EditComment where rnf = genericRnf+instance NFData EditComment instance Binary EditComment instance ToJSON EditComment where@@ -71,9 +66,9 @@ , newPullCommentPosition :: !Int , newPullCommentBody :: !Text }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData NewPullComment where rnf = genericRnf+instance NFData NewPullComment instance Binary NewPullComment instance ToJSON NewPullComment where@@ -82,4 +77,16 @@ , "commit_id" .= c , "path" .= path , "position" .= pos+ ]++data PullCommentReply = PullCommentReply+ { pullCommentReplyBody :: Text+ }+ deriving (Show, Data, Eq, Ord, Generic)++instance NFData PullCommentReply++instance ToJSON PullCommentReply where+ toJSON (PullCommentReply b) =+ object [ "body" .= b ]
src/GitHub/Data/Content.hs view
@@ -1,9 +1,6 @@ {-# LANGUAGE RecordWildCards #-}--------------------------------------------------------------------------------- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>---+{-# LANGUAGE CPP #-}+ module GitHub.Data.Content where import GitHub.Data.GitData@@ -12,15 +9,18 @@ import Prelude () import Data.Aeson.Types (Pair)-import Data.Maybe (maybe) import qualified Data.Text as T +#if MIN_VERSION_aeson(2,0,0)+import Data.Aeson (Key)+#endif+ data Content = ContentFile !ContentFileData | ContentDirectory !(Vector ContentItem)- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData Content where rnf = genericRnf+instance NFData Content instance Binary Content data ContentFileData = ContentFileData {@@ -28,24 +28,24 @@ ,contentFileEncoding :: !Text ,contentFileSize :: !Int ,contentFileContent :: !Text-} deriving (Show, Data, Typeable, Eq, Ord, Generic)+} deriving (Show, Data, Eq, Ord, Generic) -instance NFData ContentFileData where rnf = genericRnf+instance NFData ContentFileData instance Binary ContentFileData -- | An item in a directory listing. data ContentItem = ContentItem { contentItemType :: !ContentItemType ,contentItemInfo :: !ContentInfo-} deriving (Show, Data, Typeable, Eq, Ord, Generic)+} deriving (Show, Data, Eq, Ord, Generic) -instance NFData ContentItem where rnf = genericRnf+instance NFData ContentItem instance Binary ContentItem data ContentItemType = ItemFile | ItemDir- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData ContentItemType where rnf = genericRnf+instance NFData ContentItemType instance Binary ContentItemType -- | Information common to both kinds of Content: files and directories.@@ -56,34 +56,34 @@ ,contentUrl :: !URL ,contentGitUrl :: !URL ,contentHtmlUrl :: !URL-} deriving (Show, Data, Typeable, Eq, Ord, Generic)+} deriving (Show, Data, Eq, Ord, Generic) -instance NFData ContentInfo where rnf = genericRnf+instance NFData ContentInfo instance Binary ContentInfo data ContentResultInfo = ContentResultInfo { contentResultInfo :: !ContentInfo , contentResultSize :: !Int- } deriving (Show, Data, Typeable, Eq, Ord, Generic)+ } deriving (Show, Data, Eq, Ord, Generic) -instance NFData ContentResultInfo where rnf = genericRnf+instance NFData ContentResultInfo instance Binary ContentResultInfo data ContentResult = ContentResult { contentResultContent :: !ContentResultInfo , contentResultCommit :: !GitCommit- } deriving (Show, Data, Typeable, Eq, Ord, Generic)+ } deriving (Show, Data, Eq, Ord, Generic) -instance NFData ContentResult where rnf = genericRnf+instance NFData ContentResult instance Binary ContentResult data Author = Author { authorName :: !Text , authorEmail :: !Text }- deriving (Eq, Ord, Show, Data, Typeable, Generic)+ deriving (Eq, Ord, Show, Data, Generic) -instance NFData Author where rnf = genericRnf+instance NFData Author instance Binary Author data CreateFile = CreateFile@@ -94,9 +94,9 @@ , createFileAuthor :: !(Maybe Author) , createFileCommitter :: !(Maybe Author) }- deriving (Eq, Ord, Show, Data, Typeable, Generic)+ deriving (Eq, Ord, Show, Data, Generic) -instance NFData CreateFile where rnf = genericRnf+instance NFData CreateFile instance Binary CreateFile data UpdateFile = UpdateFile@@ -108,9 +108,9 @@ , updateFileAuthor :: !(Maybe Author) , updateFileCommitter :: !(Maybe Author) }- deriving (Eq, Ord, Show, Data, Typeable, Generic)+ deriving (Eq, Ord, Show, Data, Generic) -instance NFData UpdateFile where rnf = genericRnf+instance NFData UpdateFile instance Binary UpdateFile data DeleteFile = DeleteFile@@ -121,9 +121,9 @@ , deleteFileAuthor :: !(Maybe Author) , deleteFileCommitter :: !(Maybe Author) }- deriving (Eq, Ord, Show, Data, Typeable, Generic)+ deriving (Eq, Ord, Show, Data, Generic) -instance NFData DeleteFile where rnf = genericRnf+instance NFData DeleteFile instance Binary DeleteFile instance FromJSON Content where@@ -205,5 +205,9 @@ ++ "author" .=? deleteFileAuthor ++ "committer" .=? deleteFileCommitter +#if MIN_VERSION_aeson(2,0,0)+(.=?) :: ToJSON v => Key -> Maybe v -> [Pair]+#else (.=?) :: ToJSON v => Text -> Maybe v -> [Pair]+#endif name .=? value = maybe [] (pure . (name .=)) value
src/GitHub/Data/Definitions.hs view
@@ -1,8 +1,3 @@--------------------------------------------------------------------------------- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- module GitHub.Data.Definitions where import GitHub.Internal.Prelude@@ -27,13 +22,13 @@ | ParseError !Text -- ^ An error in the parser itself. | JsonError !Text -- ^ The JSON is malformed or unexpected. | UserError !Text -- ^ Incorrect input.- deriving (Show, Typeable)+ deriving (Show) instance E.Exception Error -- | Type of the repository owners. data OwnerType = OwnerUser | OwnerOrganization | OwnerBot- deriving (Eq, Ord, Enum, Bounded, Show, Read, Generic, Typeable, Data)+ deriving (Eq, Ord, Enum, Bounded, Show, Read, Generic, Data) instance NFData OwnerType instance Binary OwnerType@@ -44,9 +39,9 @@ , simpleUserAvatarUrl :: !URL , simpleUserUrl :: !URL }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData SimpleUser where rnf = genericRnf+instance NFData SimpleUser instance Binary SimpleUser data SimpleOrganization = SimpleOrganization@@ -55,9 +50,9 @@ , simpleOrganizationUrl :: !URL , simpleOrganizationAvatarUrl :: !URL }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData SimpleOrganization where rnf = genericRnf+instance NFData SimpleOrganization instance Binary SimpleOrganization -- | Sometimes we don't know the type of the owner, e.g. in 'Repo'@@ -68,9 +63,9 @@ , simpleOwnerAvatarUrl :: !URL , simpleOwnerType :: !OwnerType }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData SimpleOwner where rnf = genericRnf+instance NFData SimpleOwner instance Binary SimpleOwner data User = User@@ -93,9 +88,9 @@ , userUrl :: !URL , userHtmlUrl :: !URL }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData User where rnf = genericRnf+instance NFData User instance Binary User data Organization = Organization@@ -116,16 +111,16 @@ , organizationUrl :: !URL , organizationCreatedAt :: !UTCTime }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData Organization where rnf = genericRnf+instance NFData Organization instance Binary Organization --- | In practic, you cam't have concrete values of 'Owner'.+-- | In practice you can't have concrete values of 'Owner'. newtype Owner = Owner (Either User Organization)- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData Owner where rnf = genericRnf+instance NFData Owner instance Binary Owner fromOwner :: Owner -> Either User Organization@@ -223,14 +218,14 @@ data OrgMemberFilter = OrgMemberFilter2faDisabled -- ^ Members without two-factor authentication enabled. Available for organization owners. | OrgMemberFilterAll -- ^ All members the authenticated user can see.- deriving (Show, Eq, Ord, Enum, Bounded, Typeable, Data, Generic)+ deriving (Show, Eq, Ord, Enum, Bounded, Data, Generic) -- | Filter members returned by their role. data OrgMemberRole = OrgMemberRoleAll -- ^ All members of the organization, regardless of role. | OrgMemberRoleAdmin -- ^ Organization owners. | OrgMemberRoleMember -- ^ Non-owner organization members.- deriving (Show, Eq, Ord, Enum, Bounded, Typeable, Data, Generic)+ deriving (Show, Eq, Ord, Enum, Bounded, Data, Generic) -- | Request query string type QueryString = [(BS.ByteString, Maybe BS.ByteString)]@@ -238,12 +233,69 @@ -- | Count of elements type Count = Int +++data MembershipRole+ = MembershipRoleMember+ | MembershipRoleAdmin+ | MembershipRoleBillingManager+ deriving+ (Eq, Ord, Show, Enum, Bounded, Generic, Data)++instance NFData MembershipRole+instance Binary MembershipRole++instance FromJSON MembershipRole where+ parseJSON = withText "MembershipRole" $ \t -> case T.toLower t of+ "member" -> pure MembershipRoleMember+ "admin" -> pure MembershipRoleAdmin+ "billing_manager" -> pure MembershipRoleBillingManager+ _ -> fail $ "Unknown MembershipRole: " <> T.unpack t++data MembershipState+ = MembershipPending+ | MembershipActive+ deriving (Show, Data, Eq, Ord, Generic)++instance NFData MembershipState+instance Binary MembershipState++instance FromJSON MembershipState where+ parseJSON = withText "MembershipState" $ \t -> case T.toLower t of+ "active" -> pure MembershipActive+ "pending" -> pure MembershipPending+ _ -> fail $ "Unknown MembershipState: " <> T.unpack t+++data Membership = Membership+ { membershipUrl :: !URL+ , membershipState :: !MembershipState+ , membershipRole :: !MembershipRole+ , membershipOrganizationUrl :: !URL+ , membershipOrganization :: !SimpleOrganization+ , membershipUser :: !SimpleUser+ }+ deriving (Show, Data, Eq, Ord, Generic)++instance NFData Membership+instance Binary Membership++instance FromJSON Membership where+ parseJSON = withObject "Membership" $ \o -> Membership+ <$> o .: "url"+ <*> o .: "state"+ <*> o .: "role"+ <*> o .: "organization_url"+ <*> o .: "organization"+ <*> o .: "user"++ ------------------------------------------------------------------------------- -- IssueNumber ------------------------------------------------------------------------------- newtype IssueNumber = IssueNumber Int- deriving (Eq, Ord, Show, Generic, Typeable, Data)+ deriving (Eq, Ord, Show, Generic, Data) unIssueNumber :: IssueNumber -> Int unIssueNumber (IssueNumber i) = i@@ -268,10 +320,11 @@ { labelColor :: !Text , labelUrl :: !URL , labelName :: !(Name IssueLabel)+ , labelDesc :: !(Maybe Text) }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData IssueLabel where rnf = genericRnf+instance NFData IssueLabel instance Binary IssueLabel instance FromJSON IssueLabel where@@ -279,3 +332,57 @@ <$> o .: "color" <*> o .:? "url" .!= URL "" -- in events there aren't URL <*> o .: "name"+ <*> o .:? "description"+++-------------------------------------------------------------------------------+-- NewIssueLabel+-------------------------------------------------------------------------------++data NewIssueLabel = NewIssueLabel+ { newLabelColor :: !Text+ , newLabelName :: !(Name NewIssueLabel)+ , newLabelDesc :: !(Maybe Text)+ }+ deriving (Show, Data, Eq, Ord, Generic)++instance NFData NewIssueLabel+instance Binary NewIssueLabel+++instance ToJSON NewIssueLabel where+ toJSON (NewIssueLabel color lblName lblDesc) = object $ filter notNull+ [ "name" .= lblName+ , "color" .= color+ , "description" .= lblDesc+ ]+ where+ notNull (_, Null) = False+ notNull (_, _) = True++++-------------------------------------------------------------------------------+-- UpdateIssueLabel+-------------------------------------------------------------------------------++data UpdateIssueLabel = UpdateIssueLabel+ { updateLabelColor :: !Text+ , updateLabelName :: !(Name UpdateIssueLabel)+ , updateLabelDesc :: !(Maybe Text)+ }+ deriving (Show, Data, Eq, Ord, Generic)++instance NFData UpdateIssueLabel+instance Binary UpdateIssueLabel+++instance ToJSON UpdateIssueLabel where+ toJSON (UpdateIssueLabel color lblName lblDesc) = object $ filter notNull+ [ "new_name" .= lblName+ , "color" .= color+ , "description" .= lblDesc+ ]+ where+ notNull (_, Null) = False+ notNull (_, _) = True
src/GitHub/Data/DeployKeys.hs view
@@ -19,7 +19,7 @@ , repoDeployKeyCreatedAt :: !UTCTime , repoDeployKeyReadOnly :: !Bool }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) instance FromJSON RepoDeployKey where parseJSON = withObject "RepoDeployKey" $ \o -> RepoDeployKey@@ -36,7 +36,7 @@ , newRepoDeployKeyTitle :: !Text , newRepoDeployKeyReadOnly :: !Bool }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) instance ToJSON NewRepoDeployKey where toJSON (NewRepoDeployKey key title readOnly) = object
src/GitHub/Data/Deployments.hs view
@@ -19,10 +19,6 @@ import Control.Arrow (second) import Data.ByteString (ByteString)-import Data.Maybe (catMaybes)-import Data.Text (Text)-import Data.Time.Clock (UTCTime)-import Data.Vector (Vector) import GitHub.Data.Definitions (SimpleUser) import GitHub.Data.Id (Id)@@ -38,9 +34,9 @@ | DeploymentQueryRef !Text | DeploymentQueryTask !Text | DeploymentQueryEnvironment !Text- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData DeploymentQueryOption where rnf = genericRnf+instance NFData DeploymentQueryOption instance Binary DeploymentQueryOption renderDeploymentQueryOption :: DeploymentQueryOption -> (ByteString, ByteString)@@ -65,9 +61,9 @@ , deploymentUpdatedAt :: !UTCTime , deploymentStatusesUrl :: !URL , deploymentRepositoryUrl :: !URL- } deriving (Show, Data, Typeable, Eq, Ord, Generic)+ } deriving (Show, Data, Eq, Ord, Generic) -instance NFData a => NFData (Deployment a) where rnf = genericRnf+instance NFData a => NFData (Deployment a) instance Binary a => Binary (Deployment a) instance FromJSON a => FromJSON (Deployment a) where@@ -108,9 +104,9 @@ -- qa). Default: production , createDeploymentDescription :: !(Maybe Text) -- ^ Short description of the deployment. Default: ""- } deriving (Show, Data, Typeable, Eq, Ord, Generic)+ } deriving (Show, Data, Eq, Ord, Generic) -instance NFData a => NFData (CreateDeployment a) where rnf = genericRnf+instance NFData a => NFData (CreateDeployment a) instance Binary a => Binary (CreateDeployment a) instance ToJSON a => ToJSON (CreateDeployment a) where@@ -136,9 +132,9 @@ , deploymentStatusUpdatedAt :: !UTCTime , deploymentStatusDeploymentUrl :: !URL , deploymentStatusRepositoryUrl :: !URL- } deriving (Show, Data, Typeable, Eq, Ord, Generic)+ } deriving (Show, Data, Eq, Ord, Generic) -instance NFData DeploymentStatus where rnf = genericRnf+instance NFData DeploymentStatus instance Binary DeploymentStatus instance FromJSON DeploymentStatus where@@ -161,9 +157,9 @@ | DeploymentStatusPending | DeploymentStatusSuccess | DeploymentStatusInactive- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData DeploymentStatusState where rnf = genericRnf+instance NFData DeploymentStatusState instance Binary DeploymentStatusState instance ToJSON DeploymentStatusState where@@ -194,9 +190,9 @@ , createDeploymentStatusDescription :: !(Maybe Text) -- ^ A short description of the status. Maximum length of 140 characters. -- Default: ""- } deriving (Show, Data, Typeable, Eq, Ord, Generic)+ } deriving (Show, Data, Eq, Ord, Generic) -instance NFData CreateDeploymentStatus where rnf = genericRnf+instance NFData CreateDeploymentStatus instance Binary CreateDeploymentStatus instance ToJSON CreateDeploymentStatus where
src/GitHub/Data/Email.hs view
@@ -1,8 +1,3 @@--------------------------------------------------------------------------------- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- module GitHub.Data.Email where import GitHub.Internal.Prelude@@ -13,9 +8,9 @@ data EmailVisibility = EmailVisibilityPrivate | EmailVisibilityPublic- deriving (Show, Data, Enum, Bounded, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Enum, Bounded, Eq, Ord, Generic) -instance NFData EmailVisibility where rnf = genericRnf+instance NFData EmailVisibility instance Binary EmailVisibility instance FromJSON EmailVisibility where@@ -29,9 +24,9 @@ , emailVerified :: !Bool , emailPrimary :: !Bool , emailVisibility :: !(Maybe EmailVisibility)- } deriving (Show, Data, Typeable, Eq, Ord, Generic)+ } deriving (Show, Data, Eq, Ord, Generic) -instance NFData Email where rnf = genericRnf+instance NFData Email instance Binary Email instance FromJSON Email where
+ src/GitHub/Data/Enterprise.hs view
@@ -0,0 +1,9 @@+-- |+-- This module re-exports the @GitHub.Data.Enterprise.@ submodules.++module GitHub.Data.Enterprise (+ -- * Module re-exports+ module GitHub.Data.Enterprise.Organizations,+ ) where++import GitHub.Data.Enterprise.Organizations
+ src/GitHub/Data/Enterprise/Organizations.hs view
@@ -0,0 +1,59 @@+module GitHub.Data.Enterprise.Organizations where++import GitHub.Data.Definitions+import GitHub.Data.Name (Name)+import GitHub.Data.URL (URL)+import GitHub.Internal.Prelude+import Prelude ()++data CreateOrganization = CreateOrganization+ { createOrganizationLogin :: !(Name Organization)+ , createOrganizationAdmin :: !(Name User)+ , createOrganizationProfileName :: !(Maybe Text)+ }+ deriving (Show, Data, Eq, Ord, Generic)++instance NFData CreateOrganization+instance Binary CreateOrganization++data RenameOrganization = RenameOrganization+ { renameOrganizationLogin :: !(Name Organization)+ }+ deriving (Show, Data, Eq, Ord, Generic)++instance NFData RenameOrganization+instance Binary RenameOrganization++data RenameOrganizationResponse = RenameOrganizationResponse+ { renameOrganizationResponseMessage :: !Text+ , renameOrganizationResponseUrl :: !URL+ }+ deriving (Show, Data, Eq, Ord, Generic)++instance NFData RenameOrganizationResponse+instance Binary RenameOrganizationResponse++-- JSON Instances++instance ToJSON CreateOrganization where+ toJSON (CreateOrganization login admin profileName) =+ object $ filter notNull+ [ "login" .= login+ , "admin" .= admin+ , "profile_name" .= profileName+ ]+ where+ notNull (_, Null) = False+ notNull (_, _) = True++instance ToJSON RenameOrganization where+ toJSON (RenameOrganization login) =+ object+ [ "login" .= login+ ]++instance FromJSON RenameOrganizationResponse where+ parseJSON = withObject "RenameOrganizationResponse" $ \o ->+ RenameOrganizationResponse+ <$> o .: "message"+ <*> o .: "url"
src/GitHub/Data/Events.hs view
@@ -1,8 +1,3 @@--------------------------------------------------------------------------------- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- module GitHub.Data.Events where import GitHub.Data.Definitions@@ -14,19 +9,20 @@ -- /TODO:/ -- -- * missing repo, org, payload, id+-- data Event = Event -- { eventId :: !(Id Event) -- id can be encoded as string. { eventActor :: !SimpleUser , eventCreatedAt :: !UTCTime , eventPublic :: !Bool }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData Event where rnf = genericRnf-instance Binary Event +instance NFData Event+instance Binary Event instance FromJSON Event where- parseJSON = withObject "Event" $ \obj -> Event + parseJSON = withObject "Event" $ \obj -> Event -- <$> obj .: "id" <$> obj .: "actor" <*> obj .: "created_at"
src/GitHub/Data/Gists.hs view
@@ -1,8 +1,3 @@--------------------------------------------------------------------------------- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- module GitHub.Data.Gists where import GitHub.Data.Definitions@@ -26,9 +21,9 @@ , gistId :: !(Name Gist) , gistFiles :: !(HashMap Text GistFile) , gistGitPullUrl :: !URL- } deriving (Show, Data, Typeable, Eq, Generic)+ } deriving (Show, Data, Eq, Generic) -instance NFData Gist where rnf = genericRnf+instance NFData Gist instance Binary Gist instance FromJSON Gist where@@ -54,9 +49,9 @@ , gistFileFilename :: !Text , gistFileContent :: !(Maybe Text) }- deriving (Show, Data, Typeable, Eq, Generic)+ deriving (Show, Data, Eq, Generic) -instance NFData GistFile where rnf = genericRnf+instance NFData GistFile instance Binary GistFile instance FromJSON GistFile where@@ -76,9 +71,9 @@ , gistCommentUpdatedAt :: !UTCTime , gistCommentId :: !(Id GistComment) }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData GistComment where rnf = genericRnf+instance NFData GistComment instance Binary GistComment instance FromJSON GistComment where@@ -89,3 +84,35 @@ <*> o .: "body" <*> o .: "updated_at" <*> o .: "id"++data NewGist = NewGist+ { newGistDescription :: !(Maybe Text)+ , newGistFiles :: !(HashMap Text NewGistFile)+ , newGistPublic :: !(Maybe Bool)+ } deriving (Show, Data, Eq, Generic)++instance NFData NewGist+instance Binary NewGist++instance ToJSON NewGist where+ toJSON NewGist { newGistDescription = description+ , newGistFiles = files+ , newGistPublic = public+ } = object $ filter notNull+ [ "description" .= description+ , "files" .= files+ , "public" .= public+ ]+ where+ notNull (_, Null) = False+ notNull (_, _) = True++data NewGistFile = NewGistFile+ { newGistFileContent :: !Text+ } deriving (Show, Data, Eq, Generic)++instance NFData NewGistFile+instance Binary NewGistFile++instance ToJSON NewGistFile where+ toJSON (NewGistFile c) = object ["content" .= c]
src/GitHub/Data/GitData.hs view
@@ -1,8 +1,3 @@--------------------------------------------------------------------------------- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- module GitHub.Data.GitData where import GitHub.Data.Definitions@@ -20,16 +15,16 @@ | CommitQueryAuthor !Text | CommitQuerySince !UTCTime | CommitQueryUntil !UTCTime- deriving (Show, Eq, Ord, Generic, Typeable, Data)+ deriving (Show, Eq, Ord, Generic, Data) data Stats = Stats { statsAdditions :: !Int , statsTotal :: !Int , statsDeletions :: !Int }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData Stats where rnf = genericRnf+instance NFData Stats instance Binary Stats data Commit = Commit@@ -42,9 +37,9 @@ , commitFiles :: !(Vector File) , commitStats :: !(Maybe Stats) }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData Commit where rnf = genericRnf+instance NFData Commit instance Binary Commit data Tree = Tree@@ -52,9 +47,9 @@ , treeUrl :: !URL , treeGitTrees :: !(Vector GitTree) }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData Tree where rnf = genericRnf+instance NFData Tree instance Binary Tree data GitTree = GitTree@@ -66,9 +61,9 @@ , gitTreePath :: !Text , gitTreeMode :: !Text }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData GitTree where rnf = genericRnf+instance NFData GitTree instance Binary GitTree data GitCommit = GitCommit@@ -80,9 +75,9 @@ , gitCommitSha :: !(Maybe (Name GitCommit)) , gitCommitParents :: !(Vector Tree) }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData GitCommit where rnf = genericRnf+instance NFData GitCommit instance Binary GitCommit data Blob = Blob@@ -92,9 +87,9 @@ , blobSha :: !(Name Blob) , blobSize :: !Int }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData Blob where rnf = genericRnf+instance NFData Blob instance Binary Blob data Tag = Tag@@ -103,26 +98,26 @@ , tagTarballUrl :: !URL , tagCommit :: !BranchCommit }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData Tag where rnf = genericRnf+instance NFData Tag instance Binary Tag data Branch = Branch { branchName :: !Text , branchCommit :: !BranchCommit }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData Branch where rnf = genericRnf+instance NFData Branch data BranchCommit = BranchCommit { branchCommitSha :: !Text , branchCommitUrl :: !URL }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData BranchCommit where rnf = genericRnf+instance NFData BranchCommit instance Binary BranchCommit data Diff = Diff@@ -139,28 +134,28 @@ , diffDiffUrl :: !URL , diffPermalinkUrl :: !URL }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData Diff where rnf = genericRnf+instance NFData Diff instance Binary Diff data NewGitReference = NewGitReference { newGitReferenceRef :: !Text , newGitReferenceSha :: !Text }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData NewGitReference where rnf = genericRnf+instance NFData NewGitReference instance Binary NewGitReference data GitReference = GitReference { gitReferenceObject :: !GitObject , gitReferenceUrl :: !URL- , gitReferenceRef :: !Text+ , gitReferenceRef :: !(Name GitReference) }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData GitReference where rnf = genericRnf+instance NFData GitReference instance Binary GitReference data GitObject = GitObject@@ -168,9 +163,9 @@ , gitObjectSha :: !Text , gitObjectUrl :: !URL }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData GitObject where rnf = genericRnf+instance NFData GitObject instance Binary GitObject data GitUser = GitUser@@ -178,9 +173,9 @@ , gitUserEmail :: !Text , gitUserDate :: !UTCTime }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData GitUser where rnf = genericRnf+instance NFData GitUser instance Binary GitUser data File = File@@ -194,9 +189,9 @@ , fileFilename :: !Text , fileDeletions :: !Int }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData File where rnf = genericRnf+instance NFData File instance Binary File -- JSON instances@@ -213,8 +208,8 @@ <*> o .: "parents" <*> o .: "url" <*> o .: "commit"- <*> o .:? "committer"- <*> o .:? "author"+ <*> (o .:? "committer" <|> pure Nothing)+ <*> (o .:? "author" <|> pure Nothing) <*> o .:? "files" .!= V.empty <*> o .:? "stats"
src/GitHub/Data/Id.hs view
@@ -1,8 +1,3 @@--------------------------------------------------------------------------------- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- module GitHub.Data.Id ( Id(..), mkId,@@ -14,7 +9,7 @@ -- | Numeric identifier. newtype Id entity = Id Int- deriving (Eq, Ord, Show, Generic, Typeable, Data)+ deriving (Eq, Ord, Show, Generic, Data) -- | Smart constructor for 'Id'. mkId :: proxy entity -> Int -> Id entity
src/GitHub/Data/Invitation.hs view
@@ -1,8 +1,3 @@--------------------------------------------------------------------------------- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- module GitHub.Data.Invitation where import GitHub.Data.Definitions@@ -24,9 +19,9 @@ , invitationCreatedAt :: !UTCTime , inviter :: !SimpleUser }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData Invitation where rnf = genericRnf+instance NFData Invitation instance Binary Invitation instance FromJSON Invitation where@@ -46,9 +41,9 @@ | InvitationRoleHiringManager | InvitationRoleReinstate deriving- (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data)+ (Eq, Ord, Show, Enum, Bounded, Generic, Data) -instance NFData InvitationRole where rnf = genericRnf+instance NFData InvitationRole instance Binary InvitationRole instance FromJSON InvitationRole where@@ -70,9 +65,9 @@ , repoInvitationPermission :: !Text , repoInvitationHtmlUrl :: !URL }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData RepoInvitation where rnf = genericRnf+instance NFData RepoInvitation instance Binary RepoInvitation instance FromJSON RepoInvitation where
src/GitHub/Data/Issues.hs view
@@ -1,15 +1,10 @@--------------------------------------------------------------------------------- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- module GitHub.Data.Issues where import GitHub.Data.Definitions import GitHub.Data.Id (Id) import GitHub.Data.Milestone (Milestone) import GitHub.Data.Name (Name)-import GitHub.Data.Options (IssueState)+import GitHub.Data.Options (IssueState, IssueStateReason) import GitHub.Data.PullRequests import GitHub.Data.URL (URL) import GitHub.Internal.Prelude@@ -36,10 +31,11 @@ , issueId :: !(Id Issue) , issueComments :: !Int , issueMilestone :: !(Maybe Milestone)+ , issueStateReason :: !(Maybe IssueStateReason) }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData Issue where rnf = genericRnf+instance NFData Issue instance Binary Issue data NewIssue = NewIssue@@ -49,9 +45,9 @@ , newIssueMilestone :: !(Maybe (Id Milestone)) , newIssueLabels :: !(Maybe (Vector (Name IssueLabel))) }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData NewIssue where rnf = genericRnf+instance NFData NewIssue instance Binary NewIssue data EditIssue = EditIssue@@ -62,9 +58,9 @@ , editIssueMilestone :: !(Maybe (Id Milestone)) , editIssueLabels :: !(Maybe (Vector (Name IssueLabel))) }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData EditIssue where rnf = genericRnf+instance NFData EditIssue instance Binary EditIssue data IssueComment = IssueComment@@ -76,9 +72,9 @@ , issueCommentBody :: !Text , issueCommentId :: !Int }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData IssueComment where rnf = genericRnf+instance NFData IssueComment instance Binary IssueComment -- | See <https://developer.github.com/v3/issues/events/#events-1>@@ -110,9 +106,9 @@ | MovedColumnsInProject -- ^ The issue was moved between columns in a project board. | RemovedFromProject -- ^ The issue was removed from a project board. | ConvertedNoteToIssue -- ^ The issue was created by converting a note in a project board to an issue.- deriving (Show, Data, Enum, Bounded, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Enum, Bounded, Eq, Ord, Generic) -instance NFData EventType where rnf = genericRnf+instance NFData EventType instance Binary EventType -- | Issue event@@ -126,9 +122,9 @@ , issueEventIssue :: !(Maybe Issue) , issueEventLabel :: !(Maybe IssueLabel) }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData IssueEvent where rnf = genericRnf+instance NFData IssueEvent instance Binary IssueEvent instance FromJSON IssueEvent where@@ -203,6 +199,7 @@ <*> o .: "id" <*> o .: "comments" <*> o .:? "milestone"+ <*> o .:? "state_reason" instance ToJSON NewIssue where toJSON (NewIssue t b a m ls) = object $ filter notNull
src/GitHub/Data/Milestone.hs view
@@ -1,8 +1,3 @@--------------------------------------------------------------------------------- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- module GitHub.Data.Milestone where import GitHub.Data.Definitions@@ -23,9 +18,9 @@ , milestoneCreatedAt :: !UTCTime , milestoneState :: !Text }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData Milestone where rnf = genericRnf+instance NFData Milestone instance Binary Milestone instance FromJSON Milestone where@@ -47,9 +42,9 @@ , newMilestoneDescription :: !(Maybe Text) , newMilestoneDueOn :: !(Maybe UTCTime) }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData NewMilestone where rnf = genericRnf+instance NFData NewMilestone instance Binary NewMilestone @@ -70,9 +65,9 @@ , updateMilestoneDescription :: !(Maybe Text) , updateMilestoneDueOn :: !(Maybe UTCTime) }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData UpdateMilestone where rnf = genericRnf+instance NFData UpdateMilestone instance Binary UpdateMilestone
src/GitHub/Data/Name.hs view
@@ -1,9 +1,3 @@-{-# LANGUAGE CPP #-}--------------------------------------------------------------------------------- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- module GitHub.Data.Name ( Name(..), mkName,@@ -13,13 +7,11 @@ import Prelude () import GitHub.Internal.Prelude -#if MIN_VERSION_aeson(1,0,0) import Data.Aeson.Types (FromJSONKey (..), ToJSONKey (..), fromJSONKeyCoerce, toJSONKeyText)-#endif newtype Name entity = N Text- deriving (Eq, Ord, Show, Generic, Typeable, Data)+ deriving (Eq, Ord, Show, Generic, Data) -- | Smart constructor for 'Name' mkName :: proxy entity -> Text -> Name entity@@ -43,7 +35,6 @@ instance IsString (Name entity) where fromString = N . fromString -#if MIN_VERSION_aeson(1,0,0) -- | @since 0.15.0.0 instance ToJSONKey (Name entity) where toJSONKey = toJSONKeyText untagName@@ -51,4 +42,3 @@ -- | @since 0.15.0.0 instance FromJSONKey (Name entity) where fromJSONKey = fromJSONKeyCoerce-#endif
src/GitHub/Data/Options.hs view
@@ -1,10 +1,9 @@ {-# LANGUAGE RecordWildCards #-}------------------------------------------------------------------------------+{-# LANGUAGE LambdaCase #-}+ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- Module with modifiers for pull requests' and issues' listings.+ module GitHub.Data.Options ( -- * Common modifiers stateOpen,@@ -38,14 +37,44 @@ -- * Repo issues IssueRepoMod, issueRepoModToQueryString,+ optionsCreator,+ optionsMentioned, optionsIrrelevantMilestone, optionsAnyMilestone, optionsNoMilestone,+ optionsMilestone, optionsIrrelevantAssignee, optionsAnyAssignee, optionsNoAssignee,+ optionsAssignee,+ -- * Actions artifacts+ ArtifactMod,+ artifactModToQueryString,+ optionsArtifactName,+ -- * Actions cache+ CacheMod,+ cacheModToQueryString,+ optionsRef,+ optionsNoRef,+ optionsKey,+ optionsNoKey,+ optionsDirectionAsc,+ optionsDirectionDesc,+ sortByCreatedAt,+ sortByLastAccessedAt,+ sortBySizeInBytes,+ -- * Actions workflow runs+ WorkflowRunMod,+ workflowRunModToQueryString,+ optionsWorkflowRunActor,+ optionsWorkflowRunBranch,+ optionsWorkflowRunEvent,+ optionsWorkflowRunStatus,+ optionsWorkflowRunCreated,+ optionsWorkflowRunHeadSha, -- * Data IssueState (..),+ IssueStateReason (..), MergeableState (..), -- * Internal HasState,@@ -75,7 +104,7 @@ = StateOpen | StateClosed deriving- (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data)+ (Eq, Ord, Show, Enum, Bounded, Generic, Data) instance ToJSON IssueState where toJSON StateOpen = String "open"@@ -87,9 +116,36 @@ "closed" -> pure StateClosed _ -> fail $ "Unknown IssueState: " <> T.unpack t -instance NFData IssueState where rnf = genericRnf+instance NFData IssueState instance Binary IssueState +-- | 'GitHub.Data.Issues.Issue' state reason+data IssueStateReason+ = StateReasonCompleted+ | StateReasonDuplicate+ | StateReasonNotPlanned+ | StateReasonReopened+ deriving+ (Eq, Ord, Show, Enum, Bounded, Generic, Data)++instance ToJSON IssueStateReason where+ toJSON = String . \case+ StateReasonCompleted -> "completed"+ StateReasonDuplicate -> "duplicate"+ StateReasonNotPlanned -> "not_planned"+ StateReasonReopened -> "reopened"++instance FromJSON IssueStateReason where+ parseJSON = withText "IssueStateReason" $ \t -> case T.toLower t of+ "completed" -> pure StateReasonCompleted+ "duplicate" -> pure StateReasonDuplicate+ "not_planned" -> pure StateReasonNotPlanned+ "reopened" -> pure StateReasonReopened+ _ -> fail $ "Unknown IssueStateReason: " <> T.unpack t++instance NFData IssueStateReason+instance Binary IssueStateReason+ -- | 'GitHub.Data.PullRequests.PullRequest' mergeable_state data MergeableState = StateUnknown@@ -98,8 +154,9 @@ | StateUnstable | StateBlocked | StateBehind+ | StateDraft deriving- (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data)+ (Eq, Ord, Show, Enum, Bounded, Generic, Data) instance ToJSON MergeableState where toJSON StateUnknown = String "unknown"@@ -108,6 +165,7 @@ toJSON StateUnstable = String "unstable" toJSON StateBlocked = String "blocked" toJSON StateBehind = String "behind"+ toJSON StateDraft = String "draft" instance FromJSON MergeableState where parseJSON = withText "MergeableState" $ \t -> case T.toLower t of@@ -117,18 +175,19 @@ "unstable" -> pure StateUnstable "blocked" -> pure StateBlocked "behind" -> pure StateBehind+ "draft" -> pure StateDraft _ -> fail $ "Unknown MergeableState: " <> T.unpack t -instance NFData MergeableState where rnf = genericRnf+instance NFData MergeableState instance Binary MergeableState data SortDirection = SortAscending | SortDescending deriving- (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data)+ (Eq, Ord, Show, Enum, Bounded, Generic, Data) -instance NFData SortDirection where rnf = genericRnf+instance NFData SortDirection instance Binary SortDirection -- PR@@ -139,9 +198,9 @@ | SortPRPopularity | SortPRLongRunning deriving- (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data)+ (Eq, Ord, Show, Enum, Bounded, Generic, Data) -instance NFData SortPR where rnf = genericRnf+instance NFData SortPR instance Binary SortPR -- Issue@@ -152,9 +211,9 @@ | IssueFilterSubscribed | IssueFilterAll deriving- (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data)+ (Eq, Ord, Show, Enum, Bounded, Generic, Data) -instance NFData IssueFilter where rnf = genericRnf+instance NFData IssueFilter instance Binary IssueFilter data SortIssue@@ -162,9 +221,9 @@ | SortIssueUpdated | SortIssueComments deriving- (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data)+ (Eq, Ord, Show, Enum, Bounded, Generic, Data) -instance NFData SortIssue where rnf = genericRnf+instance NFData SortIssue instance Binary SortIssue data FilterBy a@@ -175,8 +234,20 @@ -- ^ e.g. for milestones "any" means "any milestone". -- I.e. won't show issues without mileston specified deriving- (Eq, Ord, Show, Generic, Typeable, Data)+ (Eq, Ord, Show, Generic, Data) +-- Actions cache++data SortCache+ = SortCacheCreatedAt+ | SortCacheLastAccessedAt+ | SortCacheSizeInBytes+ deriving+ (Eq, Ord, Show, Enum, Bounded, Generic, Data)++instance NFData SortCache+instance Binary SortCache+ ------------------------------------------------------------------------------- -- Classes -------------------------------------------------------------------------------@@ -263,7 +334,7 @@ , pullRequestOptionsDirection :: !SortDirection } deriving- (Eq, Ord, Show, Generic, Typeable, Data)+ (Eq, Ord, Show, Generic, Data) defaultPullRequestOptions :: PullRequestOptions defaultPullRequestOptions = PullRequestOptions@@ -348,7 +419,7 @@ -- Issues ------------------------------------------------------------------------------- --- | See <https://developer.github.com/v3/issues/#parameters>.+-- | See <https://docs.github.com/en/rest/reference/issues#list-issues-assigned-to-the-authenticated-user--parameters>. data IssueOptions = IssueOptions { issueOptionsFilter :: !IssueFilter , issueOptionsState :: !(Maybe IssueState)@@ -358,7 +429,7 @@ , issueOptionsSince :: !(Maybe UTCTime) } deriving- (Eq, Ord, Show, Generic, Typeable, Data)+ (Eq, Ord, Show, Generic, Data) defaultIssueOptions :: IssueOptions defaultIssueOptions = IssueOptions@@ -370,7 +441,7 @@ , issueOptionsSince = Nothing } --- | See <https://developer.github.com/v3/issues/#parameters>.+-- | See <https://docs.github.com/en/rest/reference/issues#list-issues-assigned-to-the-authenticated-user--parameters>. newtype IssueMod = IssueMod (IssueOptions -> IssueOptions) instance Semigroup IssueMod where@@ -488,19 +559,23 @@ -- Issues repo ------------------------------------------------------------------------------- +-- | Parameters of "list repository issues" (@get /repos/{owner}/{repo}/issues@).+--+-- See <https://docs.github.com/en/rest/reference/issues#list-repository-issues>.+-- data IssueRepoOptions = IssueRepoOptions- { issueRepoOptionsMilestone :: !(FilterBy (Id Milestone))- , issueRepoOptionsState :: !(Maybe IssueState)- , issueRepoOptionsAssignee :: !(FilterBy (Name User))- , issueRepoOptionsCreator :: !(Maybe (Name User))- , issueRepoOptionsMentioned :: !(Maybe (Name User))- , issueRepoOptionsLabels :: ![Name IssueLabel]- , issueRepoOptionsSort :: !SortIssue- , issueRepoOptionsDirection :: !SortDirection- , issueRepoOptionsSince :: !(Maybe UTCTime)+ { issueRepoOptionsMilestone :: !(FilterBy (Id Milestone)) -- ^ 'optionsMilestone' etc.+ , issueRepoOptionsState :: !(Maybe IssueState) -- ^ 'HasState'+ , issueRepoOptionsAssignee :: !(FilterBy (Name User)) -- ^ 'optionsAssignee' etc.+ , issueRepoOptionsCreator :: !(Maybe (Name User)) -- ^ 'optionsCreator'+ , issueRepoOptionsMentioned :: !(Maybe (Name User)) -- ^ 'optionsMentioned'+ , issueRepoOptionsLabels :: ![Name IssueLabel] -- ^ 'HasLabels'+ , issueRepoOptionsSort :: !SortIssue -- ^ 'HasCreatedUpdated' and 'HasComments'+ , issueRepoOptionsDirection :: !SortDirection -- ^ 'HasDirection'+ , issueRepoOptionsSince :: !(Maybe UTCTime) -- ^ 'HasSince' } deriving- (Eq, Ord, Show, Generic, Typeable, Data)+ (Eq, Ord, Show, Generic, Data) defaultIssueRepoOptions :: IssueRepoOptions defaultIssueRepoOptions = IssueRepoOptions@@ -576,7 +651,17 @@ -- Issues repo modifiers ------------------------------------------------------------------------------- --- | Don't care about milestones.+-- | Issues created by a certain user.+optionsCreator :: Name User -> IssueRepoMod+optionsCreator u = IssueRepoMod $ \opts ->+ opts { issueRepoOptionsCreator = Just u }++-- | Issue mentioning the given user.+optionsMentioned :: Name User -> IssueRepoMod+optionsMentioned u = IssueRepoMod $ \opts ->+ opts { issueRepoOptionsMentioned = Just u }++-- | Don't care about milestones (default). -- -- 'optionsAnyMilestone' means there should be some milestone, but it can be any. --@@ -585,22 +670,270 @@ optionsIrrelevantMilestone = IssueRepoMod $ \opts -> opts { issueRepoOptionsMilestone = FilterNotSpecified } +-- | Issues that have a milestone. optionsAnyMilestone :: IssueRepoMod optionsAnyMilestone = IssueRepoMod $ \opts -> opts { issueRepoOptionsMilestone = FilterAny } +-- | Issues that have no milestone. optionsNoMilestone :: IssueRepoMod optionsNoMilestone = IssueRepoMod $ \opts -> opts { issueRepoOptionsMilestone = FilterNone } +-- | Issues with the given milestone.+optionsMilestone :: Id Milestone -> IssueRepoMod+optionsMilestone m = IssueRepoMod $ \opts ->+ opts { issueRepoOptionsMilestone = FilterBy m }++-- | Issues with or without assignee (default). optionsIrrelevantAssignee :: IssueRepoMod optionsIrrelevantAssignee = IssueRepoMod $ \opts -> opts { issueRepoOptionsAssignee = FilterNotSpecified } +-- | Issues assigned to someone. optionsAnyAssignee :: IssueRepoMod optionsAnyAssignee = IssueRepoMod $ \opts -> opts { issueRepoOptionsAssignee = FilterAny } +-- | Issues assigned to nobody. optionsNoAssignee :: IssueRepoMod optionsNoAssignee = IssueRepoMod $ \opts -> opts { issueRepoOptionsAssignee = FilterNone }++-- | Issues assigned to a specific user.+optionsAssignee :: Name User -> IssueRepoMod+optionsAssignee u = IssueRepoMod $ \opts ->+ opts { issueRepoOptionsAssignee = FilterBy u }++-------------------------------------------------------------------------------+-- Actions artifacts+-------------------------------------------------------------------------------++-- | See <https://docs.github.com/en/rest/actions/artifacts#list-artifacts-for-a-repository>.+data ArtifactOptions = ArtifactOptions+ { artifactOptionsName :: !(Maybe Text)+ }+ deriving+ (Eq, Ord, Show, Generic, Data)++defaultArtifactOptions :: ArtifactOptions+defaultArtifactOptions = ArtifactOptions+ { artifactOptionsName = Nothing+ }++-- | See <https://docs.github.com/en/rest/actions/artifacts#list-artifacts-for-a-repository>.+newtype ArtifactMod = ArtifactMod (ArtifactOptions -> ArtifactOptions)++instance Semigroup ArtifactMod where+ ArtifactMod f <> ArtifactMod g = ArtifactMod (g . f)++instance Monoid ArtifactMod where+ mempty = ArtifactMod id+ mappend = (<>)++-- | Filters artifacts by exact match on their name field.+optionsArtifactName :: Text -> ArtifactMod+optionsArtifactName n = ArtifactMod $ \opts ->+ opts { artifactOptionsName = Just n }++toArtifactOptions :: ArtifactMod -> ArtifactOptions+toArtifactOptions (ArtifactMod f) = f defaultArtifactOptions++artifactModToQueryString :: ArtifactMod -> QueryString+artifactModToQueryString = artifactOptionsToQueryString . toArtifactOptions++artifactOptionsToQueryString :: ArtifactOptions -> QueryString+artifactOptionsToQueryString (ArtifactOptions name) =+ catMaybes+ [ mk "name" <$> name'+ ]+ where+ mk k v = (k, Just v)+ name' = fmap TE.encodeUtf8 name++-------------------------------------------------------------------------------+-- Actions cache+-------------------------------------------------------------------------------++-- | See <https://docs.github.com/en/rest/actions/cache#list-github-actions-caches-for-a-repository>.+data CacheOptions = CacheOptions+ { cacheOptionsRef :: !(Maybe Text)+ , cacheOptionsKey :: !(Maybe Text)+ , cacheOptionsSort :: !(Maybe SortCache)+ , cacheOptionsDirection :: !(Maybe SortDirection)+ }+ deriving+ (Eq, Ord, Show, Generic, Data)++defaultCacheOptions :: CacheOptions+defaultCacheOptions = CacheOptions+ { cacheOptionsRef = Nothing+ , cacheOptionsKey = Nothing+ , cacheOptionsSort = Nothing+ , cacheOptionsDirection = Nothing+ }++-- | See <https://docs.github.com/en/rest/actions/cache#list-github-actions-caches-for-a-repository>.+newtype CacheMod = CacheMod (CacheOptions -> CacheOptions)++instance Semigroup CacheMod where+ CacheMod f <> CacheMod g = CacheMod (g . f)++instance Monoid CacheMod where+ mempty = CacheMod id+ mappend = (<>)++toCacheOptions :: CacheMod -> CacheOptions+toCacheOptions (CacheMod f) = f defaultCacheOptions++cacheModToQueryString :: CacheMod -> QueryString+cacheModToQueryString = cacheOptionsToQueryString . toCacheOptions++cacheOptionsToQueryString :: CacheOptions -> QueryString+cacheOptionsToQueryString (CacheOptions ref key sort dir) =+ catMaybes+ [ mk "ref" <$> ref'+ , mk "key" <$> key'+ , mk "sort" <$> sort'+ , mk "directions" <$> direction'+ ]+ where+ mk k v = (k, Just v)+ sort' = sort <&> \case+ SortCacheCreatedAt -> "created_at"+ SortCacheLastAccessedAt -> "last_accessed_at"+ SortCacheSizeInBytes -> "size_in_bytes"+ direction' = dir <&> \case+ SortDescending -> "desc"+ SortAscending -> "asc"+ ref' = fmap TE.encodeUtf8 ref+ key' = fmap TE.encodeUtf8 key++-------------------------------------------------------------------------------+-- Cache modifiers+-------------------------------------------------------------------------------++optionsRef :: Text -> CacheMod+optionsRef x = CacheMod $ \opts ->+ opts { cacheOptionsRef = Just x }++optionsNoRef :: CacheMod+optionsNoRef = CacheMod $ \opts ->+ opts { cacheOptionsRef = Nothing }++optionsKey :: Text -> CacheMod+optionsKey x = CacheMod $ \opts ->+ opts { cacheOptionsKey = Just x }++optionsNoKey :: CacheMod+optionsNoKey = CacheMod $ \opts ->+ opts { cacheOptionsKey = Nothing }++optionsDirectionAsc :: CacheMod+optionsDirectionAsc = CacheMod $ \opts ->+ opts { cacheOptionsDirection = Just SortAscending }++optionsDirectionDesc :: CacheMod+optionsDirectionDesc = CacheMod $ \opts ->+ opts { cacheOptionsDirection = Just SortDescending }++sortByCreatedAt :: CacheMod+sortByCreatedAt = CacheMod $ \opts ->+ opts { cacheOptionsSort = Just SortCacheCreatedAt }++sortByLastAccessedAt :: CacheMod+sortByLastAccessedAt = CacheMod $ \opts ->+ opts { cacheOptionsSort = Just SortCacheLastAccessedAt }++sortBySizeInBytes :: CacheMod+sortBySizeInBytes = CacheMod $ \opts ->+ opts { cacheOptionsSort = Just SortCacheSizeInBytes }++-------------------------------------------------------------------------------+-- Actions workflow runs+-------------------------------------------------------------------------------++-- | See <https://docs.github.com/en/rest/actions/workflow-runs#list-workflow-runs-for-a-repository>.+data WorkflowRunOptions = WorkflowRunOptions+ { workflowRunOptionsActor :: !(Maybe Text)+ , workflowRunOptionsBranch :: !(Maybe Text)+ , workflowRunOptionsEvent :: !(Maybe Text)+ , workflowRunOptionsStatus :: !(Maybe Text)+ , workflowRunOptionsCreated :: !(Maybe Text)+ , workflowRunOptionsHeadSha :: !(Maybe Text)+ }+ deriving+ (Eq, Ord, Show, Generic, Data)++defaultWorkflowRunOptions :: WorkflowRunOptions+defaultWorkflowRunOptions = WorkflowRunOptions+ { workflowRunOptionsActor = Nothing+ , workflowRunOptionsBranch = Nothing+ , workflowRunOptionsEvent = Nothing+ , workflowRunOptionsStatus = Nothing+ , workflowRunOptionsCreated = Nothing+ , workflowRunOptionsHeadSha = Nothing+ }++-- | See <https://docs.github.com/en/rest/actions/workflow-runs#list-workflow-runs-for-a-repository>.+newtype WorkflowRunMod = WorkflowRunMod (WorkflowRunOptions -> WorkflowRunOptions)++instance Semigroup WorkflowRunMod where+ WorkflowRunMod f <> WorkflowRunMod g = WorkflowRunMod (g . f)++instance Monoid WorkflowRunMod where+ mempty = WorkflowRunMod id+ mappend = (<>)++toWorkflowRunOptions :: WorkflowRunMod -> WorkflowRunOptions+toWorkflowRunOptions (WorkflowRunMod f) = f defaultWorkflowRunOptions++workflowRunModToQueryString :: WorkflowRunMod -> QueryString+workflowRunModToQueryString = workflowRunOptionsToQueryString . toWorkflowRunOptions++workflowRunOptionsToQueryString :: WorkflowRunOptions -> QueryString+workflowRunOptionsToQueryString (WorkflowRunOptions actor branch event status created headSha) =+ catMaybes+ [ mk "actor" <$> actor'+ , mk "branch" <$> branch'+ , mk "event" <$> event'+ , mk "status" <$> status'+ , mk "created" <$> created'+ , mk "head_sha" <$> headSha'+ ]+ where+ mk k v = (k, Just v)+ actor' = fmap TE.encodeUtf8 actor+ branch' = fmap TE.encodeUtf8 branch+ event' = fmap TE.encodeUtf8 event+ status' = fmap TE.encodeUtf8 status+ created' = fmap TE.encodeUtf8 created+ headSha' = fmap TE.encodeUtf8 headSha++-------------------------------------------------------------------------------+-- Workflow run modifiers+-------------------------------------------------------------------------------++optionsWorkflowRunActor :: Text -> WorkflowRunMod+optionsWorkflowRunActor x = WorkflowRunMod $ \opts ->+ opts { workflowRunOptionsActor = Just x }++optionsWorkflowRunBranch :: Text -> WorkflowRunMod+optionsWorkflowRunBranch x = WorkflowRunMod $ \opts ->+ opts { workflowRunOptionsBranch = Just x }++optionsWorkflowRunEvent :: Text -> WorkflowRunMod+optionsWorkflowRunEvent x = WorkflowRunMod $ \opts ->+ opts { workflowRunOptionsEvent = Just x }++optionsWorkflowRunStatus :: Text -> WorkflowRunMod+optionsWorkflowRunStatus x = WorkflowRunMod $ \opts ->+ opts { workflowRunOptionsStatus = Just x }++optionsWorkflowRunCreated :: Text -> WorkflowRunMod+optionsWorkflowRunCreated x = WorkflowRunMod $ \opts ->+ opts { workflowRunOptionsCreated = Just x }++optionsWorkflowRunHeadSha :: Text -> WorkflowRunMod+optionsWorkflowRunHeadSha x = WorkflowRunMod $ \opts ->+ opts { workflowRunOptionsHeadSha = Just x }
src/GitHub/Data/PublicSSHKeys.hs view
@@ -14,7 +14,7 @@ { basicPublicSSHKeyId :: !(Id PublicSSHKey) , basicPublicSSHKeyKey :: !Text }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) instance FromJSON PublicSSHKeyBasic where parseJSON = withObject "PublicSSHKeyBasic" $ \o -> PublicSSHKeyBasic@@ -30,7 +30,7 @@ , publicSSHKeyCreatedAt :: !(Maybe UTCTime) , publicSSHKeyReadOnly :: !Bool }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) instance FromJSON PublicSSHKey where parseJSON = withObject "PublicSSHKey" $ \o -> PublicSSHKey@@ -46,7 +46,7 @@ { newPublicSSHKeyKey :: !Text , newPublicSSHKeyTitle :: !Text }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) instance ToJSON NewPublicSSHKey where toJSON (NewPublicSSHKey key title) = object
src/GitHub/Data/PullRequests.hs view
@@ -1,8 +1,3 @@--------------------------------------------------------------------------------- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- module GitHub.Data.PullRequests ( SimplePullRequest(..), PullRequest(..),@@ -21,6 +16,7 @@ import GitHub.Data.Options (IssueState (..), MergeableState (..)) import GitHub.Data.Repos (Repo) import GitHub.Data.URL (URL)+import GitHub.Data.Teams (SimpleTeam) import GitHub.Internal.Prelude import Prelude () @@ -38,6 +34,7 @@ , simplePullRequestBody :: !(Maybe Text) , simplePullRequestAssignees :: (Vector SimpleUser) , simplePullRequestRequestedReviewers :: (Vector SimpleUser)+ , simplePullRequestRequestedTeamReviewers:: (Vector SimpleTeam) , simplePullRequestIssueUrl :: !URL , simplePullRequestDiffUrl :: !URL , simplePullRequestUrl :: !URL@@ -46,9 +43,9 @@ , simplePullRequestTitle :: !Text , simplePullRequestId :: !(Id PullRequest) }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData SimplePullRequest where rnf = genericRnf+instance NFData SimplePullRequest instance Binary SimplePullRequest data PullRequest = PullRequest@@ -63,6 +60,7 @@ , pullRequestBody :: !(Maybe Text) , pullRequestAssignees :: (Vector SimpleUser) , pullRequestRequestedReviewers :: (Vector SimpleUser)+ , pullRequestRequestedTeamReviewers :: (Vector SimpleTeam) , pullRequestIssueUrl :: !URL , pullRequestDiffUrl :: !URL , pullRequestUrl :: !URL@@ -83,9 +81,9 @@ , pullRequestMergeable :: !(Maybe Bool) , pullRequestMergeableState :: !MergeableState }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData PullRequest where rnf = genericRnf+instance NFData PullRequest instance Binary PullRequest data EditPullRequest = EditPullRequest@@ -98,7 +96,7 @@ } deriving (Show, Generic) -instance NFData EditPullRequest where rnf = genericRnf+instance NFData EditPullRequest instance Binary EditPullRequest data CreatePullRequest@@ -115,7 +113,7 @@ } deriving (Show, Generic) -instance NFData CreatePullRequest where rnf = genericRnf+instance NFData CreatePullRequest instance Binary CreatePullRequest data PullRequestLinks = PullRequestLinks@@ -124,9 +122,9 @@ , pullRequestLinksHtml :: !URL , pullRequestLinksSelf :: !URL }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData PullRequestLinks where rnf = genericRnf+instance NFData PullRequestLinks instance Binary PullRequestLinks data PullRequestCommit = PullRequestCommit@@ -136,9 +134,9 @@ , pullRequestCommitUser :: !SimpleUser , pullRequestCommitRepo :: !(Maybe Repo) }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData PullRequestCommit where rnf = genericRnf+instance NFData PullRequestCommit instance Binary PullRequestCommit data PullRequestEvent = PullRequestEvent@@ -148,9 +146,9 @@ , pullRequestRepository :: !Repo , pullRequestSender :: !SimpleUser }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData PullRequestEvent where rnf = genericRnf+instance NFData PullRequestEvent instance Binary PullRequestEvent data PullRequestEventType@@ -165,9 +163,9 @@ | PullRequestReviewRequested | PullRequestReviewRequestRemoved | PullRequestEdited- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData PullRequestEventType where rnf = genericRnf+instance NFData PullRequestEventType instance Binary PullRequestEventType data PullRequestReference = PullRequestReference@@ -175,9 +173,9 @@ , pullRequestReferencePatchUrl :: !(Maybe URL) , pullRequestReferenceDiffUrl :: !(Maybe URL) }- deriving (Eq, Ord, Show, Generic, Typeable, Data)+ deriving (Eq, Ord, Show, Generic, Data) -instance NFData PullRequestReference where rnf = genericRnf+instance NFData PullRequestReference instance Binary PullRequestReference @@ -198,6 +196,7 @@ <*> o .:? "body" <*> o .: "assignees" <*> o .:? "requested_reviewers" .!= mempty+ <*> o .:? "requested_teams" .!= mempty <*> o .: "issue_url" <*> o .: "diff_url" <*> o .: "url"@@ -239,6 +238,7 @@ <*> o .:? "body" <*> o .: "assignees" <*> o .:? "requested_reviewers" .!= mempty+ <*> o .:? "requested_teams" .!= mempty <*> o .: "issue_url" <*> o .: "diff_url" <*> o .: "url"@@ -316,4 +316,4 @@ = MergeSuccessful | MergeCannotPerform | MergeConflict- deriving (Eq, Ord, Read, Show, Enum, Bounded, Generic, Typeable)+ deriving (Eq, Ord, Read, Show, Enum, Bounded, Generic)
src/GitHub/Data/RateLimit.hs view
@@ -1,37 +1,37 @@--------------------------------------------------------------------------------- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- module GitHub.Data.RateLimit where import GitHub.Internal.Prelude import Prelude () +import Data.Time.Clock.System (SystemTime (..))++import qualified Data.ByteString.Char8 as BS8+import qualified Network.HTTP.Client as HTTP+ data Limits = Limits { limitsMax :: !Int , limitsRemaining :: !Int- , limitsReset :: !Int -- TODO: change to proper type+ , limitsReset :: !SystemTime }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Eq, Ord, Generic) -instance NFData Limits where rnf = genericRnf+instance NFData Limits instance Binary Limits instance FromJSON Limits where parseJSON = withObject "Limits" $ \obj -> Limits <$> obj .: "limit" <*> obj .: "remaining"- <*> obj .: "reset"+ <*> fmap (\t -> MkSystemTime t 0) (obj .: "reset") data RateLimit = RateLimit { rateLimitCore :: Limits , rateLimitSearch :: Limits , rateLimitGraphQL :: Limits }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Eq, Ord, Generic) -instance NFData RateLimit where rnf = genericRnf+instance NFData RateLimit instance Binary RateLimit instance FromJSON RateLimit where@@ -41,3 +41,21 @@ <$> resources .: "core" <*> resources .: "search" <*> resources .: "graphql"++-------------------------------------------------------------------------------+-- Extras+-------------------------------------------------------------------------------++-- | @since 0.24+limitsFromHttpResponse :: HTTP.Response a -> Maybe Limits+limitsFromHttpResponse res = do+ let hdrs = HTTP.responseHeaders res+ m <- lookup "X-RateLimit-Limit" hdrs >>= readIntegral+ r <- lookup "X-RateLimit-Remaining" hdrs >>= readIntegral+ t <- lookup "X-RateLimit-Reset" hdrs >>= readIntegral+ return (Limits m r (MkSystemTime t 0))+ where+ readIntegral :: Num a => BS8.ByteString -> Maybe a+ readIntegral bs = case BS8.readInt bs of+ Just (n, bs') | BS8.null bs' -> Just (fromIntegral n)+ _ -> Nothing
+ src/GitHub/Data/Reactions.hs view
@@ -0,0 +1,78 @@+{-# LANGUAGE InstanceSigs #-}+module GitHub.Data.Reactions where++import qualified Data.Text as T+import GitHub.Data.Id (Id)+import GitHub.Data.Definitions (SimpleUser)+import GitHub.Internal.Prelude+import Prelude ()++data Reaction = Reaction+ { reactionId :: Id Reaction+ , reactionUser :: !(Maybe SimpleUser)+ , reactionContent :: !ReactionContent+ , reactionCreatedAt :: !UTCTime+ }+ deriving (Show, Data, Eq, Ord, Generic)++instance NFData Reaction+instance Binary Reaction++data NewReaction = NewReaction+ { newReactionContent :: !ReactionContent+ }+ deriving (Show, Data, Eq, Ord, Generic)++instance NFData NewReaction+instance Binary NewReaction++-- |+-- <https://docs.github.com/en/rest/reactions/reactions?apiVersion=2022-11-28#about-reactions>+data ReactionContent+ = PlusOne+ | MinusOne+ | Laugh+ | Confused+ | Heart+ | Hooray+ | Rocket+ | Eyes+ deriving (Show, Data, Eq, Ord, Enum, Bounded, Generic)++instance NFData ReactionContent+instance Binary ReactionContent++-- JSON instances++instance FromJSON Reaction where+ parseJSON = withObject "Reaction" $ \o ->+ Reaction+ <$> o .: "id"+ <*> o .:? "user"+ <*> o .: "content"+ <*> o .: "created_at"++instance ToJSON NewReaction where+ toJSON (NewReaction content) = object ["content" .= content]++instance FromJSON ReactionContent where+ parseJSON = withText "ReactionContent" $ \case+ "+1" -> pure PlusOne+ "-1" -> pure MinusOne+ "laugh" -> pure Laugh+ "confused" -> pure Confused+ "heart" -> pure Heart+ "hooray" -> pure Hooray+ "rocket" -> pure Rocket+ "eyes" -> pure Eyes+ t -> fail $ "Unknown ReactionContent: " <> T.unpack t++instance ToJSON ReactionContent where+ toJSON PlusOne = String "+1"+ toJSON MinusOne = String "-1"+ toJSON Laugh = String "laugh"+ toJSON Confused = String "confused"+ toJSON Heart = String "heart"+ toJSON Hooray = String "hooray"+ toJSON Rocket = String "rocket"+ toJSON Eyes = String "eyes"
src/GitHub/Data/Releases.hs view
@@ -25,7 +25,7 @@ , releaseAuthor :: !SimpleUser , releaseAssets :: !(Vector ReleaseAsset) }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) instance FromJSON Release where parseJSON = withObject "Event" $ \o -> Release@@ -47,7 +47,7 @@ <*> o .: "author" <*> o .: "assets" -instance NFData Release where rnf = genericRnf+instance NFData Release instance Binary Release data ReleaseAsset = ReleaseAsset@@ -64,7 +64,7 @@ , releaseAssetUpdatedAt :: !UTCTime , releaseAssetUploader :: !SimpleUser }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) instance FromJSON ReleaseAsset where parseJSON = withObject "Event" $ \o -> ReleaseAsset@@ -81,5 +81,5 @@ <*> o .: "updated_at" <*> o .: "uploader" -instance NFData ReleaseAsset where rnf = genericRnf+instance NFData ReleaseAsset instance Binary ReleaseAsset
src/GitHub/Data/Repos.hs view
@@ -1,14 +1,10 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-}-#define UNSAFE 1------------------------------------------------------------------------------+ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- This module also exports -- @'FromJSON' a => 'FromJSON' ('HM.HashMap' 'Language' a)@ -- orphan-ish instance for @aeson < 1@+ module GitHub.Data.Repos where import GitHub.Data.Definitions@@ -20,88 +16,144 @@ import Prelude () import qualified Data.HashMap.Strict as HM-#if MIN_VERSION_aeson(1,0,0)+import qualified Data.Text as T import Data.Aeson.Types (FromJSONKey (..), fromJSONKeyCoerce)-#else-#ifdef UNSAFE-import Unsafe.Coerce (unsafeCoerce)-#endif-#endif data Repo = Repo- { repoSshUrl :: !(Maybe URL)- , repoDescription :: !(Maybe Text)- , repoCreatedAt :: !(Maybe UTCTime)+ { repoId :: !(Id Repo)+ , repoName :: !(Name Repo)+ , repoOwner :: !SimpleOwner+ , repoPrivate :: !Bool , repoHtmlUrl :: !URL- , repoSvnUrl :: !(Maybe URL)- , repoForks :: !(Maybe Int)- , repoHomepage :: !(Maybe Text)+ , repoDescription :: !(Maybe Text) , repoFork :: !(Maybe Bool)+ , repoUrl :: !URL , repoGitUrl :: !(Maybe URL)- , repoPrivate :: !Bool- , repoArchived :: !Bool+ , repoSshUrl :: !(Maybe URL) , repoCloneUrl :: !(Maybe URL)- , repoSize :: !(Maybe Int)- , repoUpdatedAt :: !(Maybe UTCTime)- , repoWatchers :: !(Maybe Int)- , repoOwner :: !SimpleOwner- , repoName :: !(Name Repo)+ , repoHooksUrl :: !URL+ , repoSvnUrl :: !(Maybe URL)+ , repoHomepage :: !(Maybe Text) , repoLanguage :: !(Maybe Language)+ , repoForksCount :: !Int+ , repoStargazersCount :: !Int+ , repoWatchersCount :: !Int+ , repoSize :: !(Maybe Int) , repoDefaultBranch :: !(Maybe Text)- , repoPushedAt :: !(Maybe UTCTime) -- ^ this is Nothing for new repositories- , repoId :: !(Id Repo)- , repoUrl :: !URL- , repoOpenIssues :: !(Maybe Int)- , repoHasWiki :: !(Maybe Bool)+ , repoOpenIssuesCount :: !Int , repoHasIssues :: !(Maybe Bool)+ , repoHasProjects :: !(Maybe Bool)+ , repoHasWiki :: !(Maybe Bool)+ , repoHasPages :: !(Maybe Bool) , repoHasDownloads :: !(Maybe Bool)- , repoParent :: !(Maybe RepoRef)- , repoSource :: !(Maybe RepoRef)- , repoHooksUrl :: !URL- , repoStargazersCount :: !Int+ , repoArchived :: !Bool+ , repoDisabled :: !Bool+ , repoPushedAt :: !(Maybe UTCTime) -- ^ this is Nothing for new repositories+ , repoCreatedAt :: !(Maybe UTCTime)+ , repoUpdatedAt :: !(Maybe UTCTime)+ , repoPermissions :: !(Maybe RepoPermissions) -- ^ Repository permissions as they relate to the authenticated user. }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData Repo where rnf = genericRnf+instance NFData Repo instance Binary Repo +data CodeSearchRepo = CodeSearchRepo+ { codeSearchRepoId :: !(Id Repo)+ , codeSearchRepoName :: !(Name Repo)+ , codeSearchRepoOwner :: !SimpleOwner+ , codeSearchRepoPrivate :: !Bool+ , codeSearchRepoHtmlUrl :: !URL+ , codeSearchRepoDescription :: !(Maybe Text)+ , codeSearchRepoFork :: !(Maybe Bool)+ , codeSearchRepoUrl :: !URL+ , codeSearchRepoGitUrl :: !(Maybe URL)+ , codeSearchRepoSshUrl :: !(Maybe URL)+ , codeSearchRepoCloneUrl :: !(Maybe URL)+ , codeSearchRepoHooksUrl :: !URL+ , codeSearchRepoSvnUrl :: !(Maybe URL)+ , codeSearchRepoHomepage :: !(Maybe Text)+ , codeSearchRepoLanguage :: !(Maybe Language)+ , codeSearchRepoSize :: !(Maybe Int)+ , codeSearchRepoDefaultBranch :: !(Maybe Text)+ , codeSearchRepoHasIssues :: !(Maybe Bool)+ , codeSearchRepoHasProjects :: !(Maybe Bool)+ , codeSearchRepoHasWiki :: !(Maybe Bool)+ , codeSearchRepoHasPages :: !(Maybe Bool)+ , codeSearchRepoHasDownloads :: !(Maybe Bool)+ , codeSearchRepoArchived :: !Bool+ , codeSearchRepoDisabled :: !Bool+ , codeSearchRepoPushedAt :: !(Maybe UTCTime) -- ^ this is Nothing for new repositories+ , codeSearchRepoCreatedAt :: !(Maybe UTCTime)+ , codeSearchRepoUpdatedAt :: !(Maybe UTCTime)+ , codeSearchRepoPermissions :: !(Maybe RepoPermissions) -- ^ Repository permissions as they relate to the authenticated user.+ }+ deriving (Show, Data, Eq, Ord, Generic)++instance NFData CodeSearchRepo+instance Binary CodeSearchRepo++-- | Repository permissions, as they relate to the authenticated user.+--+-- Returned by for example 'GitHub.Endpoints.Repos.currentUserReposR'+data RepoPermissions = RepoPermissions+ { repoPermissionAdmin :: !Bool+ , repoPermissionPush :: !Bool+ , repoPermissionPull :: !Bool+ }+ deriving (Show, Data, Eq, Ord, Generic)++instance NFData RepoPermissions+instance Binary RepoPermissions+ data RepoRef = RepoRef { repoRefOwner :: !SimpleOwner , repoRefRepo :: !(Name Repo) }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData RepoRef where rnf = genericRnf+instance NFData RepoRef instance Binary RepoRef data NewRepo = NewRepo- { newRepoName :: !(Name Repo)- , newRepoDescription :: !(Maybe Text)- , newRepoHomepage :: !(Maybe Text)- , newRepoPrivate :: !(Maybe Bool)- , newRepoHasIssues :: !(Maybe Bool)- , newRepoHasWiki :: !(Maybe Bool)- , newRepoAutoInit :: !(Maybe Bool)- } deriving (Eq, Ord, Show, Data, Typeable, Generic)+ { newRepoName :: !(Name Repo)+ , newRepoDescription :: !(Maybe Text)+ , newRepoHomepage :: !(Maybe Text)+ , newRepoPrivate :: !(Maybe Bool)+ , newRepoHasIssues :: !(Maybe Bool)+ , newRepoHasProjects :: !(Maybe Bool)+ , newRepoHasWiki :: !(Maybe Bool)+ , newRepoAutoInit :: !(Maybe Bool)+ , newRepoGitignoreTemplate :: !(Maybe Text)+ , newRepoLicenseTemplate :: !(Maybe Text)+ , newRepoAllowSquashMerge :: !(Maybe Bool)+ , newRepoAllowMergeCommit :: !(Maybe Bool)+ , newRepoAllowRebaseMerge :: !(Maybe Bool)+ } deriving (Eq, Ord, Show, Data, Generic) -instance NFData NewRepo where rnf = genericRnf+instance NFData NewRepo instance Binary NewRepo newRepo :: Name Repo -> NewRepo-newRepo name = NewRepo name Nothing Nothing Nothing Nothing Nothing Nothing+newRepo name = NewRepo name Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing data EditRepo = EditRepo- { editName :: !(Maybe (Name Repo))- , editDescription :: !(Maybe Text)- , editHomepage :: !(Maybe Text)- , editPublic :: !(Maybe Bool)- , editHasIssues :: !(Maybe Bool)- , editHasWiki :: !(Maybe Bool)- , editHasDownloads :: !(Maybe Bool)+ { editName :: !(Maybe (Name Repo))+ , editDescription :: !(Maybe Text)+ , editHomepage :: !(Maybe Text)+ , editPrivate :: !(Maybe Bool)+ , editHasIssues :: !(Maybe Bool)+ , editHasProjects :: !(Maybe Bool)+ , editHasWiki :: !(Maybe Bool)+ , editDefaultBranch :: !(Maybe Text)+ , editAllowSquashMerge :: !(Maybe Bool)+ , editAllowMergeCommit :: !(Maybe Bool)+ , editAllowRebaseMerge :: !(Maybe Bool)+ , editArchived :: !(Maybe Bool) }- deriving (Eq, Ord, Show, Data, Typeable, Generic)+ deriving (Eq, Ord, Show, Data, Generic) -instance NFData EditRepo where rnf = genericRnf+instance NFData EditRepo instance Binary EditRepo -- | Filter the list of the user's repos using any of these constructors.@@ -111,19 +163,19 @@ | RepoPublicityPublic -- ^ Only public repos. | RepoPublicityPrivate -- ^ Only private repos. | RepoPublicityMember -- ^ Only repos to which the user is a member but not an owner.- deriving (Show, Eq, Ord, Enum, Bounded, Typeable, Data, Generic)+ deriving (Show, Eq, Ord, Enum, Bounded, Data, Generic) -- | The value is the number of bytes of code written in that language. type Languages = HM.HashMap Language Int -- | A programming language. newtype Language = Language Text- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) getLanguage :: Language -> Text getLanguage (Language l) = l -instance NFData Language where rnf = genericRnf+instance NFData Language instance Binary Language instance Hashable Language where hashWithSalt salt (Language l) = hashWithSalt salt l@@ -136,9 +188,9 @@ = KnownContributor !Int !URL !(Name User) !URL !(Id User) !Text -- | An unknown Github user with their number of contributions and recorded name. | AnonymousContributor !Int !Text- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData Contributor where rnf = genericRnf+instance NFData Contributor instance Binary Contributor contributorToSimpleUser :: Contributor -> Maybe SimpleUser@@ -146,76 +198,157 @@ contributorToSimpleUser (KnownContributor _contributions avatarUrl name url uid _gravatarid) = Just $ SimpleUser uid name avatarUrl url +-- | The permission of a collaborator on a repository.+-- See <https://developer.github.com/v3/repos/collaborators/#review-a-users-permission-level>+data CollaboratorPermission+ = CollaboratorPermissionAdmin+ | CollaboratorPermissionWrite+ | CollaboratorPermissionRead+ | CollaboratorPermissionNone+ deriving (Show, Data, Enum, Bounded, Eq, Ord, Generic)++instance NFData CollaboratorPermission+instance Binary CollaboratorPermission++-- | A collaborator and its permission on a repository.+-- See <https://developer.github.com/v3/repos/collaborators/#review-a-users-permission-level>+data CollaboratorWithPermission+ = CollaboratorWithPermission SimpleUser CollaboratorPermission+ deriving (Show, Data, Eq, Ord, Generic)++instance NFData CollaboratorWithPermission+instance Binary CollaboratorWithPermission+ -- JSON instances instance FromJSON Repo where- parseJSON = withObject "Repo" $ \o -> Repo <$> o .:? "ssh_url"- <*> o .: "description"- <*> o .:? "created_at"+ parseJSON = withObject "Repo" $ \o -> Repo <$> o .: "id"+ <*> o .: "name"+ <*> o .: "owner"+ <*> o .: "private" <*> o .: "html_url"- <*> o .:? "svn_url"- <*> o .:? "forks"- <*> o .:? "homepage"+ <*> o .:? "description" <*> o .: "fork"+ <*> o .: "url" <*> o .:? "git_url"- <*> o .: "private"- <*> o .:? "archived" .!= False+ <*> o .:? "ssh_url" <*> o .:? "clone_url"+ <*> o .: "hooks_url"+ <*> o .:? "svn_url"+ <*> o .:? "homepage"+ <*> o .:? "language"+ <*> o .: "forks_count"+ <*> o .: "stargazers_count"+ <*> o .: "watchers_count" <*> o .:? "size"+ <*> o .:? "default_branch"+ <*> o .: "open_issues_count"+ <*> o .:? "has_issues"+ <*> o .:? "has_projects"+ <*> o .:? "has_wiki"+ <*> o .:? "has_pages"+ <*> o .:? "has_downloads"+ <*> o .:? "archived" .!= False+ <*> o .:? "disabled" .!= False+ <*> o .:? "pushed_at"+ <*> o .:? "created_at" <*> o .:? "updated_at"- <*> o .:? "watchers"- <*> o .: "owner"+ <*> o .:? "permissions"++instance FromJSON CodeSearchRepo where+ parseJSON = withObject "Repo" $ \o -> CodeSearchRepo <$> o .: "id" <*> o .: "name"+ <*> o .: "owner"+ <*> o .: "private"+ <*> o .: "html_url"+ <*> o .:? "description"+ <*> o .: "fork"+ <*> o .: "url"+ <*> o .:? "git_url"+ <*> o .:? "ssh_url"+ <*> o .:? "clone_url"+ <*> o .: "hooks_url"+ <*> o .:? "svn_url"+ <*> o .:? "homepage" <*> o .:? "language"+ <*> o .:? "size" <*> o .:? "default_branch"- <*> o .:? "pushed_at"- <*> o .: "id"- <*> o .: "url"- <*> o .:? "open_issues"- <*> o .:? "has_wiki" <*> o .:? "has_issues"+ <*> o .:? "has_projects"+ <*> o .:? "has_wiki"+ <*> o .:? "has_pages" <*> o .:? "has_downloads"- <*> o .:? "parent"- <*> o .:? "source"- <*> o .: "hooks_url"- <*> o .: "stargazers_count"+ <*> o .:? "archived" .!= False+ <*> o .:? "disabled" .!= False+ <*> o .:? "pushed_at"+ <*> o .:? "created_at"+ <*> o .:? "updated_at"+ <*> o .:? "permissions" instance ToJSON NewRepo where- toJSON (NewRepo { newRepoName = name- , newRepoDescription = description- , newRepoHomepage = homepage- , newRepoPrivate = private- , newRepoHasIssues = hasIssues- , newRepoHasWiki = hasWiki- , newRepoAutoInit = autoInit+ toJSON (NewRepo { newRepoName = name+ , newRepoDescription = description+ , newRepoHomepage = homepage+ , newRepoPrivate = private+ , newRepoHasIssues = hasIssues+ , newRepoHasProjects = hasProjects+ , newRepoHasWiki = hasWiki+ , newRepoAutoInit = autoInit+ , newRepoGitignoreTemplate = gitignoreTemplate+ , newRepoLicenseTemplate = licenseTemplate+ , newRepoAllowSquashMerge = allowSquashMerge+ , newRepoAllowMergeCommit = allowMergeCommit+ , newRepoAllowRebaseMerge = allowRebaseMerge }) = object [ "name" .= name , "description" .= description , "homepage" .= homepage , "private" .= private , "has_issues" .= hasIssues+ , "has_projects" .= hasProjects , "has_wiki" .= hasWiki , "auto_init" .= autoInit+ , "gitignore_template" .= gitignoreTemplate+ , "license_template" .= licenseTemplate+ , "allow_squash_merge" .= allowSquashMerge+ , "allow_merge_commit" .= allowMergeCommit+ , "allow_rebase_merge" .= allowRebaseMerge ] instance ToJSON EditRepo where- toJSON (EditRepo { editName = name- , editDescription = description- , editHomepage = homepage- , editPublic = public- , editHasIssues = hasIssues- , editHasWiki = hasWiki- , editHasDownloads = hasDownloads+ toJSON (EditRepo { editName = name+ , editDescription = description+ , editHomepage = homepage+ , editPrivate = private+ , editHasIssues = hasIssues+ , editHasProjects = hasProjects+ , editHasWiki = hasWiki+ , editDefaultBranch = defaultBranch+ , editAllowSquashMerge = allowSquashMerge+ , editAllowMergeCommit = allowMergeCommit+ , editAllowRebaseMerge = allowRebaseMerge+ , editArchived = archived }) = object- [ "name" .= name- , "description" .= description- , "homepage" .= homepage- , "public" .= public- , "has_issues" .= hasIssues- , "has_wiki" .= hasWiki- , "has_downloads" .= hasDownloads+ [ "name" .= name+ , "description" .= description+ , "homepage" .= homepage+ , "private" .= private+ , "has_issues" .= hasIssues+ , "has_projects" .= hasProjects+ , "has_wiki" .= hasWiki+ , "default_branch" .= defaultBranch+ , "allow_squash_merge" .= allowSquashMerge+ , "allow_merge_commit" .= allowMergeCommit+ , "allow_rebase_merge" .= allowRebaseMerge+ , "archived" .= archived ] +instance FromJSON RepoPermissions where+ parseJSON = withObject "RepoPermissions" $ \o -> RepoPermissions+ <$> o .: "admin"+ <*> o .: "push"+ <*> o .: "pull"+ instance FromJSON RepoRef where parseJSON = withObject "RepoRef" $ \o -> RepoRef <$> o .: "owner"@@ -242,29 +375,34 @@ instance ToJSON Language where toJSON = toJSON . getLanguage -#if MIN_VERSION_aeson(1,0,0) instance FromJSONKey Language where fromJSONKey = fromJSONKeyCoerce-#else-instance FromJSON a => FromJSON (HM.HashMap Language a) where- parseJSON = fmap mapKeyLanguage . parseJSON- where- mapKeyLanguage :: HM.HashMap Text a -> HM.HashMap Language a-#ifdef UNSAFE- mapKeyLanguage = unsafeCoerce-#else- mapKeyLanguage = mapKey Language- mapKey :: (Eq k2, Hashable k2) => (k1 -> k2) -> HM.HashMap k1 a -> HM.HashMap k2 a- mapKey f = HM.fromList . map (first f) . HM.toList-#endif-#endif data ArchiveFormat = ArchiveFormatTarball -- ^ ".tar.gz" format | ArchiveFormatZipball -- ^ ".zip" format- deriving (Show, Eq, Ord, Enum, Bounded, Typeable, Data, Generic)+ deriving (Show, Eq, Ord, Enum, Bounded, Data, Generic) instance IsPathPart ArchiveFormat where toPathPart af = case af of ArchiveFormatTarball -> "tarball" ArchiveFormatZipball -> "zipball"++instance FromJSON CollaboratorPermission where+ parseJSON = withText "CollaboratorPermission" $ \t -> case T.toLower t of+ "admin" -> pure CollaboratorPermissionAdmin+ "write" -> pure CollaboratorPermissionWrite+ "read" -> pure CollaboratorPermissionRead+ "none" -> pure CollaboratorPermissionNone+ _ -> fail $ "Unknown CollaboratorPermission: " <> T.unpack t++instance ToJSON CollaboratorPermission where+ toJSON CollaboratorPermissionAdmin = "admin"+ toJSON CollaboratorPermissionWrite = "write"+ toJSON CollaboratorPermissionRead = "read"+ toJSON CollaboratorPermissionNone = "none"++instance FromJSON CollaboratorWithPermission where+ parseJSON = withObject "CollaboratorWithPermission" $ \o -> CollaboratorWithPermission+ <$> o .: "user"+ <*> o .: "permission"
src/GitHub/Data/Request.hs view
@@ -1,13 +1,8 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE StandaloneDeriving #-}--------------------------------------------------------------------------------- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>---+ module GitHub.Data.Request ( -- * Request Request,@@ -19,6 +14,8 @@ CommandMethod(..), toMethod, FetchCount(..),+ PageParams(..),+ PageLinks(..), MediaType (..), Paths, IsPathPart(..),@@ -34,6 +31,7 @@ import qualified Data.ByteString.Lazy as LBS import qualified Data.Text as T import qualified Network.HTTP.Types.Method as Method+import Network.URI (URI) ------------------------------------------------------------------------------ -- Path parts@@ -63,7 +61,7 @@ | Patch | Put | Delete- deriving (Eq, Ord, Read, Show, Enum, Bounded, Typeable, Data, Generic)+ deriving (Eq, Ord, Read, Show, Enum, Bounded, Data, Generic) instance Hashable CommandMethod @@ -79,8 +77,11 @@ -- | 'PagedQuery' returns just some results, using this data we can specify how -- many pages we want to fetch.-data FetchCount = FetchAtLeast !Word | FetchAll- deriving (Eq, Ord, Read, Show, Generic, Typeable)+data FetchCount =+ FetchAtLeast !Word+ | FetchAll+ | FetchPage PageParams+ deriving (Eq, Ord, Read, Show, Generic) -- | This instance is there mostly for 'fromInteger'.@@ -99,9 +100,40 @@ instance Hashable FetchCount instance Binary FetchCount-instance NFData FetchCount where rnf = genericRnf+instance NFData FetchCount -------------------------------------------------------------------------------+-- PageParams+-------------------------------------------------------------------------------++-- | Params for specifying the precise page and items per page.+data PageParams = PageParams {+ pageParamsPerPage :: Maybe Int+ , pageParamsPage :: Maybe Int+ }+ deriving (Eq, Ord, Read, Show, Generic)++instance Hashable PageParams+instance Binary PageParams+instance NFData PageParams++-------------------------------------------------------------------------------+-- PageLinks+-------------------------------------------------------------------------------++-- | 'PagedQuery' returns just some results, using this data we can specify how+-- many pages we want to fetch.+data PageLinks = PageLinks {+ pageLinksPrev :: Maybe URI+ , pageLinksNext :: Maybe URI+ , pageLinksLast :: Maybe URI+ , pageLinksFirst :: Maybe URI+ }+ deriving (Eq, Ord, Show, Generic)++instance NFData PageLinks++------------------------------------------------------------------------------- -- MediaType ------------------------------------------------------------------------------- @@ -116,7 +148,7 @@ | MtStatus -- ^ Parse status | MtUnit -- ^ Always succeeds | MtPreview a -- ^ Some other (preview) type; this is an extension point.- deriving (Eq, Ord, Read, Show, Typeable, Data, Generic)+ deriving (Eq, Ord, Read, Show, Data, Generic) ------------------------------------------------------------------------------ -- RW@@ -128,7 +160,7 @@ = RO -- ^ /Read-only/, doesn't necessarily requires authentication | RA -- ^ /Read authenticated/ | RW -- ^ /Read-write/, requires authentication- deriving (Eq, Ord, Read, Show, Enum, Bounded, Typeable, Data, Generic)+ deriving (Eq, Ord, Read, Show, Enum, Bounded, Data, Generic) {- data SRO (rw :: RW) where@@ -154,7 +186,7 @@ -- /Note:/ 'Request' is not 'Functor' on purpose. data GenRequest (mt :: MediaType *) (rw :: RW) a where Query :: Paths -> QueryString -> GenRequest mt rw a- PagedQuery :: Paths -> QueryString -> FetchCount -> GenRequest mt rw (Vector a)+ PagedQuery :: (a ~ t b, Foldable t, Semigroup a) => Paths -> QueryString -> FetchCount -> GenRequest mt rw a -- | Command Command@@ -162,7 +194,6 @@ -> Paths -- ^ path -> LBS.ByteString -- ^ body -> GenRequest mt 'RW a- deriving (Typeable) -- | Most requests ask for @JSON@. type Request = GenRequest 'MtJSON
src/GitHub/Data/Reviews.hs view
@@ -6,7 +6,6 @@ import GitHub.Internal.Prelude import Prelude () -import Data.Text (Text) import qualified Data.Text as T data ReviewState@@ -17,9 +16,7 @@ | ReviewStateChangesRequested deriving (Show, Enum, Bounded, Eq, Ord, Generic) -instance NFData ReviewState where- rnf = genericRnf-+instance NFData ReviewState instance Binary ReviewState instance FromJSON ReviewState where@@ -35,27 +32,25 @@ { reviewBody :: !Text , reviewCommitId :: !Text , reviewState :: ReviewState- , reviewSubmittedAt :: !UTCTime+ , reviewSubmittedAt :: !(Maybe UTCTime) , reviewPullRequestUrl :: !URL , reviewHtmlUrl :: !Text , reviewUser :: !SimpleUser , reviewId :: !(Id Review) } deriving (Show, Generic) -instance NFData Review where- rnf = genericRnf-+instance NFData Review instance Binary Review instance FromJSON Review where parseJSON = withObject "Review" $ \o -> Review <$> o .: "body" <*> o .: "commit_id" <*> o .: "state" <*>- o .: "submitted_at" <*>- o .: "pull_request_url" <*>- o .: "html_url" <*>- o .: "user" <*>- o .: "id"+ o .:? "submitted_at" <*>+ o .: "pull_request_url" <*>+ o .: "html_url" <*>+ o .: "user" <*>+ o .: "id" data ReviewComment = ReviewComment { reviewCommentId :: !(Id ReviewComment)@@ -75,9 +70,7 @@ , reviewCommentPullRequestUrl :: !URL } deriving (Show, Generic) -instance NFData ReviewComment where- rnf = genericRnf-+instance NFData ReviewComment instance Binary ReviewComment instance FromJSON ReviewComment where
src/GitHub/Data/Search.hs view
@@ -1,31 +1,34 @@--------------------------------------------------------------------------------- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- module GitHub.Data.Search where -import GitHub.Data.Repos (Repo)+import GitHub.Data.Repos (CodeSearchRepo) import GitHub.Data.URL (URL) import GitHub.Internal.Prelude import Prelude () import qualified Data.Vector as V -data SearchResult entity = SearchResult+data SearchResult' entities = SearchResult { searchResultTotalCount :: !Int- , searchResultResults :: !(Vector entity)+ , searchResultResults :: !entities }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData entity => NFData (SearchResult entity) where rnf = genericRnf-instance Binary entity => Binary (SearchResult entity)+type SearchResult entity = SearchResult' (V.Vector entity) -instance FromJSON entity => FromJSON (SearchResult entity) where+instance NFData entities => NFData (SearchResult' entities)+instance Binary entities => Binary (SearchResult' entities)++instance (Monoid entities, FromJSON entities) => FromJSON (SearchResult' entities) where parseJSON = withObject "SearchResult" $ \o -> SearchResult <$> o .: "total_count"- <*> o .:? "items" .!= V.empty+ <*> o .:? "items" .!= mempty +instance Semigroup res => Semigroup (SearchResult' res) where+ (SearchResult count res) <> (SearchResult count' res') = SearchResult (max count count') (res <> res')++instance Foldable SearchResult' where+ foldMap f (SearchResult _count results) = f results+ data Code = Code { codeName :: !Text , codePath :: !Text@@ -33,11 +36,11 @@ , codeUrl :: !URL , codeGitUrl :: !URL , codeHtmlUrl :: !URL- , codeRepo :: !Repo+ , codeRepo :: !CodeSearchRepo }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData Code where rnf = genericRnf+instance NFData Code instance Binary Code instance FromJSON Code where
src/GitHub/Data/Statuses.hs view
@@ -1,7 +1,5 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE NoImplicitPrelude #-}-{-# LANGUAGE OverloadedStrings #-}+ module GitHub.Data.Statuses where import GitHub.Data.Definitions@@ -21,9 +19,9 @@ | StatusSuccess | StatusError | StatusFailure- deriving (Show, Data, Enum, Bounded, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Enum, Bounded, Eq, Ord, Generic) -instance NFData StatusState where rnf = genericRnf+instance NFData StatusState instance Binary StatusState instance FromJSON StatusState where@@ -52,7 +50,7 @@ , statusContext :: !(Maybe Text) , statusCreator :: !(Maybe SimpleUser) }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) instance FromJSON Status where parseJSON = withObject "Status" $ \o -> Status@@ -73,9 +71,9 @@ , newStatusDescription :: !(Maybe Text) , newStatusContext :: !(Maybe Text) }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData NewStatus where rnf = genericRnf+instance NFData NewStatus instance Binary NewStatus instance ToJSON NewStatus where@@ -99,7 +97,7 @@ , combinedStatusCommitUrl :: !URL , combinedStatusUrl :: !URL }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) instance FromJSON CombinedStatus where parseJSON = withObject "CombinedStatus" $ \o -> CombinedStatus
src/GitHub/Data/Teams.hs view
@@ -1,12 +1,5 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE NoImplicitPrelude #-}-{-# LANGUAGE OverloadedStrings #-}--------------------------------------------------------------------------------- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>---+ module GitHub.Data.Teams where import GitHub.Data.Definitions@@ -22,26 +15,26 @@ data Privacy = PrivacyClosed | PrivacySecret- deriving (Show, Data, Enum, Bounded, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Enum, Bounded, Eq, Ord, Generic) -instance NFData Privacy where rnf = genericRnf+instance NFData Privacy instance Binary Privacy data Permission = PermissionPull | PermissionPush | PermissionAdmin- deriving (Show, Data, Enum, Bounded, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Enum, Bounded, Eq, Ord, Generic) -instance NFData Permission where rnf = genericRnf+instance NFData Permission instance Binary Permission data AddTeamRepoPermission = AddTeamRepoPermission { addTeamRepoPermission :: !Permission }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData AddTeamRepoPermission where rnf = genericRnf+instance NFData AddTeamRepoPermission instance Binary AddTeamRepoPermission data SimpleTeam = SimpleTeam@@ -50,14 +43,14 @@ , simpleTeamName :: !Text -- TODO (0.15.0): unify this and 'simpleTeamSlug' as in 'Team'. , simpleTeamSlug :: !(Name Team) , simpleTeamDescription :: !(Maybe Text)- , simpleTeamPrivacy :: !(Maybe Privacy)+ , simpleTeamPrivacy :: !Privacy , simpleTeamPermission :: !Permission , simpleTeamMembersUrl :: !URL , simpleTeamRepositoriesUrl :: !URL }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData SimpleTeam where rnf = genericRnf+instance NFData SimpleTeam instance Binary SimpleTeam data Team = Team@@ -66,7 +59,7 @@ , teamName :: !Text , teamSlug :: !(Name Team) , teamDescription :: !(Maybe Text)- , teamPrivacy :: !(Maybe Privacy)+ , teamPrivacy :: !Privacy , teamPermission :: !Permission , teamMembersUrl :: !URL , teamRepositoriesUrl :: !URL@@ -74,38 +67,38 @@ , teamReposCount :: !Int , teamOrganization :: !SimpleOrganization }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData Team where rnf = genericRnf+instance NFData Team instance Binary Team data CreateTeam = CreateTeam { createTeamName :: !(Name Team) , createTeamDescription :: !(Maybe Text) , createTeamRepoNames :: !(Vector (Name Repo))- -- , createTeamPrivacy :: Privacy- , createTeamPermission :: Permission+ , createTeamPrivacy :: !Privacy+ , createTeamPermission :: !Permission }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData CreateTeam where rnf = genericRnf+instance NFData CreateTeam instance Binary CreateTeam data EditTeam = EditTeam { editTeamName :: !(Name Team) , editTeamDescription :: !(Maybe Text)- -- , editTeamPrivacy :: Privacy- , editTeamPermission :: !Permission+ , editTeamPrivacy :: !(Maybe Privacy)+ , editTeamPermission :: !(Maybe Permission) }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData EditTeam where rnf = genericRnf+instance NFData EditTeam instance Binary EditTeam data Role = RoleMaintainer | RoleMember- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) instance NFData Role instance Binary Role@@ -113,9 +106,9 @@ data ReqState = StatePending | StateActive- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData ReqState where rnf = genericRnf+instance NFData ReqState instance Binary ReqState data TeamMembership = TeamMembership@@ -123,16 +116,16 @@ , teamMembershipRole :: !Role , teamMembershipReqState :: !ReqState }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData TeamMembership where rnf = genericRnf+instance NFData TeamMembership instance Binary TeamMembership data CreateTeamMembership = CreateTeamMembership { createTeamMembershipRole :: !Role-} deriving (Show, Data, Typeable, Eq, Ord, Generic)+} deriving (Show, Data, Eq, Ord, Generic) -instance NFData CreateTeamMembership where rnf = genericRnf+instance NFData CreateTeamMembership instance Binary CreateTeamMembership -- JSON Instances@@ -144,7 +137,7 @@ <*> o .: "name" <*> o .: "slug" <*> o .:?"description" .!= Nothing- <*> o .:?"privacy" .!= Nothing+ <*> o .: "privacy" <*> o .: "permission" <*> o .: "members_url" <*> o .: "repositories_url"@@ -156,7 +149,7 @@ <*> o .: "name" <*> o .: "slug" <*> o .:?"description" .!= Nothing- <*> o .:?"privacy" .!= Nothing+ <*> o .: "privacy" <*> o .: "permission" <*> o .: "members_url" <*> o .: "repositories_url"@@ -165,19 +158,29 @@ <*> o .: "organization" instance ToJSON CreateTeam where- toJSON (CreateTeam name desc repo_names {-privacy-} permissions) =- object [ "name" .= name- , "description" .= desc- , "repo_names" .= repo_names- {-, "privacy" .= privacy-}- , "permissions" .= permissions ]+ toJSON (CreateTeam name desc repo_names privacy permission) =+ object $ filter notNull+ [ "name" .= name+ , "description" .= desc+ , "repo_names" .= repo_names+ , "privacy" .= privacy+ , "permission" .= permission+ ]+ where+ notNull (_, Null) = False+ notNull (_, _) = True instance ToJSON EditTeam where- toJSON (EditTeam name desc {-privacy-} permissions) =- object [ "name" .= name- , "description" .= desc- {-, "privacy" .= privacy-}- , "permissions" .= permissions ]+ toJSON (EditTeam name desc privacy permission) =+ object $ filter notNull+ [ "name" .= name+ , "description" .= desc+ , "privacy" .= privacy+ , "permission" .= permission+ ]+ where+ notNull (_, Null) = False+ notNull (_, _) = True instance FromJSON TeamMembership where parseJSON = withObject "TeamMembership" $ \o -> TeamMembership@@ -248,4 +251,4 @@ = TeamMemberRoleAll -- ^ all members of the team. | TeamMemberRoleMaintainer -- ^ team maintainers | TeamMemberRoleMember -- ^ normal members of the team.- deriving (Show, Eq, Ord, Enum, Bounded, Typeable, Data, Generic)+ deriving (Show, Eq, Ord, Enum, Bounded, Data, Generic)
src/GitHub/Data/URL.hs view
@@ -1,8 +1,3 @@--------------------------------------------------------------------------------- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- module GitHub.Data.URL ( URL(..), getUrl,@@ -15,12 +10,12 @@ -- -- /N.B./ syntactical validity is not verified. newtype URL = URL Text- deriving (Eq, Ord, Show, Generic, Typeable, Data)+ deriving (Eq, Ord, Show, Generic, Data) getUrl :: URL -> Text getUrl (URL url) = url -instance NFData URL where rnf = genericRnf+instance NFData URL instance Binary URL instance ToJSON URL where
src/GitHub/Data/Webhooks.hs view
@@ -1,8 +1,3 @@--------------------------------------------------------------------------------- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- module GitHub.Data.Webhooks where import GitHub.Data.Id (Id)@@ -25,9 +20,9 @@ , repoWebhookUpdatedAt :: !UTCTime , repoWebhookCreatedAt :: !UTCTime }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData RepoWebhook where rnf = genericRnf+instance NFData RepoWebhook instance Binary RepoWebhook -- | See <https://developer.github.com/webhooks/#events>.@@ -35,6 +30,7 @@ = WebhookWildcardEvent | WebhookCheckRunEvent | WebhookCheckSuiteEvent+ | WebhookCodeScanningAlert | WebhookCommitCommentEvent | WebhookContentReferenceEvent | WebhookCreateEvent@@ -42,12 +38,13 @@ | WebhookDeployKeyEvent | WebhookDeploymentEvent | WebhookDeploymentStatusEvent+ | WebhookDiscussion+ | WebhookDiscussionComment | WebhookDownloadEvent | WebhookFollowEvent | WebhookForkEvent- | WebhookForkApplyEvent- | WebhookGitHubAppAuthorizationEvent | WebhookGistEvent+ | WebhookGitHubAppAuthorizationEvent | WebhookGollumEvent | WebhookInstallationEvent | WebhookInstallationRepositoriesEvent@@ -59,8 +56,9 @@ | WebhookMembershipEvent | WebhookMetaEvent | WebhookMilestoneEvent- | WebhookOrganizationEvent | WebhookOrgBlockEvent+ | WebhookOrganizationEvent+ | WebhookPackage | WebhookPageBuildEvent | WebhookPingEvent | WebhookProjectCardEvent@@ -68,33 +66,38 @@ | WebhookProjectEvent | WebhookPublicEvent | WebhookPullRequestEvent- | WebhookPullRequestReviewEvent | WebhookPullRequestReviewCommentEvent+ | WebhookPullRequestReviewEvent | WebhookPushEvent | WebhookRegistryPackageEvent | WebhookReleaseEvent+ | WebhookRepositoryDispatch | WebhookRepositoryEvent | WebhookRepositoryImportEvent | WebhookRepositoryVulnerabilityAlertEvent+ | WebhookSecretScanningAlert | WebhookSecurityAdvisoryEvent+ | WebhookSponsorship | WebhookStarEvent | WebhookStatusEvent- | WebhookTeamEvent | WebhookTeamAddEvent+ | WebhookTeamEvent | WebhookWatchEvent- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ | WebhookWorkflowDispatch+ | WebhookWorkflowRun+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData RepoWebhookEvent where rnf = genericRnf+instance NFData RepoWebhookEvent instance Binary RepoWebhookEvent data RepoWebhookResponse = RepoWebhookResponse { repoWebhookResponseCode :: !(Maybe Int)- , repoWebhookResponseStatus :: !Text+ , repoWebhookResponseStatus :: !(Maybe Text) , repoWebhookResponseMessage :: !(Maybe Text) }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData RepoWebhookResponse where rnf = genericRnf+instance NFData RepoWebhookResponse instance Binary RepoWebhookResponse data PingEvent = PingEvent@@ -102,9 +105,9 @@ , pingEventHook :: !RepoWebhook , pingEventHookId :: !(Id RepoWebhook) }- deriving (Show, Data, Typeable, Eq, Ord, Generic)+ deriving (Show, Data, Eq, Ord, Generic) -instance NFData PingEvent where rnf = genericRnf+instance NFData PingEvent instance Binary PingEvent data NewRepoWebhook = NewRepoWebhook@@ -113,9 +116,9 @@ , newRepoWebhookEvents :: !(Maybe (Vector RepoWebhookEvent)) , newRepoWebhookActive :: !(Maybe Bool) }- deriving (Eq, Ord, Show, Typeable, Data, Generic)+ deriving (Eq, Ord, Show, Data, Generic) -instance NFData NewRepoWebhook where rnf = genericRnf+instance NFData NewRepoWebhook instance Binary NewRepoWebhook data EditRepoWebhook = EditRepoWebhook@@ -125,9 +128,9 @@ , editRepoWebhookRemoveEvents :: !(Maybe (Vector RepoWebhookEvent)) , editRepoWebhookActive :: !(Maybe Bool) }- deriving (Eq, Ord, Show, Typeable, Data, Generic)+ deriving (Eq, Ord, Show, Data, Generic) -instance NFData EditRepoWebhook where rnf = genericRnf+instance NFData EditRepoWebhook instance Binary EditRepoWebhook -- JSON instances@@ -137,6 +140,7 @@ "*" -> pure WebhookWildcardEvent "check_run" -> pure WebhookCheckRunEvent "check_suite" -> pure WebhookCheckSuiteEvent+ "code_scanning_alert" -> pure WebhookCodeScanningAlert "commit_comment" -> pure WebhookCommitCommentEvent "content_reference" -> pure WebhookContentReferenceEvent "create" -> pure WebhookCreateEvent@@ -144,12 +148,13 @@ "deploy_key" -> pure WebhookDeployKeyEvent "deployment" -> pure WebhookDeploymentEvent "deployment_status" -> pure WebhookDeploymentStatusEvent+ "discussion" -> pure WebhookDiscussion+ "discussion_comment" -> pure WebhookDiscussionComment "download" -> pure WebhookDownloadEvent "follow" -> pure WebhookFollowEvent "fork" -> pure WebhookForkEvent- "fork_apply" -> pure WebhookForkApplyEvent- "github_app_authorization" -> pure WebhookGitHubAppAuthorizationEvent "gist" -> pure WebhookGistEvent+ "github_app_authorization" -> pure WebhookGitHubAppAuthorizationEvent "gollum" -> pure WebhookGollumEvent "installation" -> pure WebhookInstallationEvent "installation_repositories" -> pure WebhookInstallationRepositoriesEvent@@ -161,13 +166,14 @@ "membership" -> pure WebhookMembershipEvent "meta" -> pure WebhookMetaEvent "milestone" -> pure WebhookMilestoneEvent- "organization" -> pure WebhookOrganizationEvent "org_block" -> pure WebhookOrgBlockEvent+ "organization" -> pure WebhookOrganizationEvent+ "package" -> pure WebhookPackage "page_build" -> pure WebhookPageBuildEvent "ping" -> pure WebhookPingEvent+ "project" -> pure WebhookProjectEvent "project_card" -> pure WebhookProjectCardEvent "project_column" -> pure WebhookProjectColumnEvent- "project" -> pure WebhookProjectEvent "public" -> pure WebhookPublicEvent "pull_request" -> pure WebhookPullRequestEvent "pull_request_review" -> pure WebhookPullRequestReviewEvent@@ -176,20 +182,26 @@ "registry_package" -> pure WebhookRegistryPackageEvent "release" -> pure WebhookReleaseEvent "repository" -> pure WebhookRepositoryEvent+ "repository_dispatch" -> pure WebhookRepositoryDispatch "repository_import" -> pure WebhookRepositoryImportEvent "repository_vulnerability_alert" -> pure WebhookRepositoryVulnerabilityAlertEvent+ "secret_scanning_alert" -> pure WebhookSecretScanningAlert "security_advisory" -> pure WebhookSecurityAdvisoryEvent+ "sponsorship" -> pure WebhookSponsorship "star" -> pure WebhookStarEvent "status" -> pure WebhookStatusEvent "team" -> pure WebhookTeamEvent "team_add" -> pure WebhookTeamAddEvent "watch" -> pure WebhookWatchEvent+ "workflow_dispatch" -> pure WebhookWorkflowDispatch+ "workflow_run" -> pure WebhookWorkflowRun _ -> fail $ "Unknown RepoWebhookEvent: " <> T.unpack t instance ToJSON RepoWebhookEvent where toJSON WebhookWildcardEvent = String "*" toJSON WebhookCheckRunEvent = String "check_run" toJSON WebhookCheckSuiteEvent = String "check_suite"+ toJSON WebhookCodeScanningAlert = String "code_scanning_alert" toJSON WebhookCommitCommentEvent = String "commit_comment" toJSON WebhookContentReferenceEvent = String "content_reference" toJSON WebhookCreateEvent = String "create"@@ -197,12 +209,13 @@ toJSON WebhookDeployKeyEvent = String "deploy_key" toJSON WebhookDeploymentEvent = String "deployment" toJSON WebhookDeploymentStatusEvent = String "deployment_status"+ toJSON WebhookDiscussion = String "discussion"+ toJSON WebhookDiscussionComment = String "discussion_comment" toJSON WebhookDownloadEvent = String "download" toJSON WebhookFollowEvent = String "follow" toJSON WebhookForkEvent = String "fork"- toJSON WebhookForkApplyEvent = String "fork_apply"- toJSON WebhookGitHubAppAuthorizationEvent = String "github_app_authorization" toJSON WebhookGistEvent = String "gist"+ toJSON WebhookGitHubAppAuthorizationEvent = String "github_app_authorization" toJSON WebhookGollumEvent = String "gollum" toJSON WebhookInstallationEvent = String "installation" toJSON WebhookInstallationRepositoriesEvent = String "installation_repositories"@@ -214,8 +227,9 @@ toJSON WebhookMembershipEvent = String "membership" toJSON WebhookMetaEvent = String "meta" toJSON WebhookMilestoneEvent = String "milestone"- toJSON WebhookOrganizationEvent = String "organization" toJSON WebhookOrgBlockEvent = String "org_block"+ toJSON WebhookOrganizationEvent = String "organization"+ toJSON WebhookPackage = String "package" toJSON WebhookPageBuildEvent = String "page_build" toJSON WebhookPingEvent = String "ping" toJSON WebhookProjectCardEvent = String "project_card"@@ -223,20 +237,25 @@ toJSON WebhookProjectEvent = String "project" toJSON WebhookPublicEvent = String "public" toJSON WebhookPullRequestEvent = String "pull_request"- toJSON WebhookPullRequestReviewEvent = String "pull_request_review" toJSON WebhookPullRequestReviewCommentEvent = String "pull_request_review_comment"+ toJSON WebhookPullRequestReviewEvent = String "pull_request_review" toJSON WebhookPushEvent = String "push" toJSON WebhookRegistryPackageEvent = String "registry_package" toJSON WebhookReleaseEvent = String "release"+ toJSON WebhookRepositoryDispatch = String "repository_dispatch" toJSON WebhookRepositoryEvent = String "repository" toJSON WebhookRepositoryImportEvent = String "repository_import" toJSON WebhookRepositoryVulnerabilityAlertEvent = String "repository_vulnerability_alert"+ toJSON WebhookSecretScanningAlert = String "secret_scanning_alert" toJSON WebhookSecurityAdvisoryEvent = String "security_advisory"+ toJSON WebhookSponsorship = String "sponsorship" toJSON WebhookStarEvent = String "star" toJSON WebhookStatusEvent = String "status"- toJSON WebhookTeamEvent = String "team" toJSON WebhookTeamAddEvent = String "team_add"+ toJSON WebhookTeamEvent = String "team" toJSON WebhookWatchEvent = String "watch"+ toJSON WebhookWorkflowDispatch = String "workflow_dispatch"+ toJSON WebhookWorkflowRun = String "workflow_run" instance FromJSON RepoWebhook where parseJSON = withObject "RepoWebhook" $ \o -> RepoWebhook@@ -254,8 +273,8 @@ instance FromJSON RepoWebhookResponse where parseJSON = withObject "RepoWebhookResponse" $ \o -> RepoWebhookResponse <$> o .: "code"- <*> o .: "status"- <*> o .: "message"+ <*> o .:? "status"+ <*> o .:? "message" instance ToJSON NewRepoWebhook where toJSON (NewRepoWebhook { newRepoWebhookName = name
src/GitHub/Data/Webhooks/Validate.hs view
@@ -1,10 +1,7 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- Verification of incomming webhook payloads, as described at -- <https://developer.github.com/webhooks/securing/>+ module GitHub.Data.Webhooks.Validate ( isValidPayload ) where
+ src/GitHub/Endpoints/Actions/Artifacts.hs view
@@ -0,0 +1,61 @@+-- |+-- The actions API as documented at+-- <https://docs.github.com/en/rest/reference/actions>.++module GitHub.Endpoints.Actions.Artifacts (+ artifactsForR,+ artifactR,+ deleteArtifactR,+ downloadArtifactR,+ artifactsForWorkflowRunR,+ module GitHub.Data+ ) where++import GitHub.Data+import GitHub.Internal.Prelude+import Network.URI (URI)+import Prelude ()++-- | List artifacts for repository.+-- See <https://docs.github.com/en/rest/reference/actions#list-artifacts-for-a-repository>+artifactsForR+ :: Name Owner+ -> Name Repo+ -> ArtifactMod+ -> FetchCount+ -> Request 'RA (WithTotalCount Artifact)+artifactsForR user repo opts = PagedQuery+ ["repos", toPathPart user, toPathPart repo, "actions", "artifacts"]+ (artifactModToQueryString opts)++-- | Get an artifact.+-- See <https://docs.github.com/en/rest/reference/actions#get-an-artifact>+artifactR :: Name Owner -> Name Repo -> Id Artifact -> Request 'RA Artifact+artifactR user repo artid =+ query ["repos", toPathPart user, toPathPart repo, "actions", "artifacts", toPathPart artid] []++-- | Delete an artifact.+-- See <https://docs.github.com/en/rest/reference/actions#delete-an-artifact>+deleteArtifactR :: Name Owner -> Name Repo -> Id Comment -> GenRequest 'MtUnit 'RW ()+deleteArtifactR user repo artid =+ Command Delete parts mempty+ where+ parts = ["repos", toPathPart user, toPathPart repo, "actions", "artifacts", toPathPart artid]++-- | Download an artifact.+-- See <https://docs.github.com/en/rest/reference/actions#download-an-artifact>+downloadArtifactR :: Name Owner -> Name Repo -> Id Artifact -> GenRequest 'MtRedirect 'RW URI+downloadArtifactR user repo artid =+ Query ["repos", toPathPart user, toPathPart repo, "actions", "artifacts", toPathPart artid, "zip"] []++-- | List artifacts for a workflow run.+-- See <https://docs.github.com/en/rest/reference/actions#list-workflow-run-artifacts>+artifactsForWorkflowRunR+ :: Name Owner+ -> Name Repo+ -> Id WorkflowRun+ -> FetchCount+ -> Request 'RA (WithTotalCount Artifact)+artifactsForWorkflowRunR user repo runid = PagedQuery+ ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart runid, "artifacts"]+ []
+ src/GitHub/Endpoints/Actions/Cache.hs view
@@ -0,0 +1,66 @@+-- |+-- The actions API as documented at+-- <https://docs.github.com/en/rest/reference/actions>.++module GitHub.Endpoints.Actions.Cache (+ cacheUsageOrganizationR,+ cacheUsageByRepositoryR,+ cacheUsageR,+ cachesForRepoR,+ deleteCacheR,+ module GitHub.Data+ ) where++import GitHub.Data+import GitHub.Internal.Prelude+import Prelude ()++-- | Get Actions cache usage for the organization.+-- See <https://docs.github.com/en/rest/actions/cache#get-github-actions-cache-usage-for-an-organization>+cacheUsageOrganizationR+ :: Name Organization+ -> GenRequest 'MtJSON 'RA OrganizationCacheUsage+cacheUsageOrganizationR org =+ Query ["orgs", toPathPart org, "actions", "cache", "usage"] []++-- | List repositories with GitHub Actions cache usage for an organization.+-- See <https://docs.github.com/en/rest/actions/cache#list-repositories-with-github-actions-cache-usage-for-an-organization>+cacheUsageByRepositoryR+ :: Name Organization+ -> FetchCount+ -> GenRequest 'MtJSON 'RA (WithTotalCount RepositoryCacheUsage)+cacheUsageByRepositoryR org =+ PagedQuery ["orgs", toPathPart org, "actions", "cache", "usage-by-repository"] []++-- | Get GitHub Actions cache usage for a repository.+-- See <https://docs.github.com/en/rest/actions/cache#get-github-actions-cache-usage-for-a-repository>+cacheUsageR+ :: Name Owner+ -> Name Repo+ -> Request k RepositoryCacheUsage+cacheUsageR user repo =+ Query ["repos", toPathPart user, toPathPart repo, "actions", "cache", "usage"] []++-- | List the GitHub Actions caches for a repository.+-- See <https://docs.github.com/en/rest/actions/cache#list-github-actions-caches-for-a-repository>+cachesForRepoR+ :: Name Owner+ -> Name Repo+ -> CacheMod+ -> FetchCount+ -> GenRequest 'MtJSON 'RA (WithTotalCount Cache)+cachesForRepoR user repo opts = PagedQuery+ ["repos", toPathPart user, toPathPart repo, "actions", "caches"]+ (cacheModToQueryString opts)++-- | Delete GitHub Actions cache for a repository.+-- See <https://docs.github.com/en/rest/actions/cache#delete-a-github-actions-cache-for-a-repository-using-a-cache-id>+deleteCacheR+ :: Name Owner+ -> Name Repo+ -> Id Cache+ -> GenRequest 'MtUnit 'RW ()+deleteCacheR user repo cacheid =+ Command Delete parts mempty+ where+ parts = ["repos", toPathPart user, toPathPart repo, "actions", "caches", toPathPart cacheid]
+ src/GitHub/Endpoints/Actions/Secrets.hs view
@@ -0,0 +1,221 @@+-- |+-- The actions API as documented at+-- <https://docs.github.com/en/rest/reference/actions>.++module GitHub.Endpoints.Actions.Secrets (+ organizationSecretsR,+ organizationPublicKeyR,+ organizationSecretR,+ setOrganizationSecretR,+ deleteOrganizationSecretR,+ organizationSelectedRepositoriesForSecretR,+ setOrganizationSelectedRepositoriesForSecretR,+ addOrganizationSelectedRepositoriesForSecretR,+ removeOrganizationSelectedRepositoriesForSecretR,+ repoSecretsR,+ repoPublicKeyR,+ repoSecretR,+ setRepoSecretR,+ deleteRepoSecretR,+ environmentSecretsR,+ environmentPublicKeyR,+ environmentSecretR,+ setEnvironmentSecretR,+ deleteEnvironmentSecretR,+ module GitHub.Data+ ) where++import GitHub.Data+import GitHub.Internal.Prelude+import Prelude ()++-- | List organization secrets.+-- See <https://docs.github.com/en/rest/actions/secrets#list-organization-secrets>+organizationSecretsR+ :: Name Organization+ -> FetchCount+ -> GenRequest 'MtJSON 'RA (WithTotalCount OrganizationSecret)+organizationSecretsR org =+ PagedQuery ["orgs", toPathPart org, "actions", "secrets"] []++-- | List organization secrets.+-- See <https://docs.github.com/en/rest/actions/secrets#get-an-organization-public-key>+organizationPublicKeyR+ :: Name Organization+ -> GenRequest 'MtJSON 'RA PublicKey+organizationPublicKeyR org =+ Query ["orgs", toPathPart org, "actions", "secrets", "public-key"] []++-- | Get an organization secret.+-- See <https://docs.github.com/en/rest/actions/secrets#get-an-organization-secret>+organizationSecretR+ :: Name Organization+ -> Name OrganizationSecret+ -> GenRequest 'MtJSON 'RA OrganizationSecret+organizationSecretR org name =+ Query ["orgs", toPathPart org, "actions", "secrets", toPathPart name] []++-- | Create or update an organization secret.+-- See <https://docs.github.com/en/rest/actions/secrets#create-or-update-an-organization-secret>+setOrganizationSecretR+ :: Name Organization+ -> Name OrganizationSecret+ -> SetSecret+ -> GenRequest 'MtUnit 'RW ()+setOrganizationSecretR org name =+ Command Put ["orgs", toPathPart org, "actions", "secrets", toPathPart name] . encode++-- | Delete an organization secret.+-- See <https://docs.github.com/en/rest/actions/secrets#delete-an-organization-secret>+deleteOrganizationSecretR+ :: Name Organization+ -> Name OrganizationSecret+ -> GenRequest 'MtUnit 'RW ()+deleteOrganizationSecretR org name =+ Command Delete parts mempty+ where+ parts = ["orgs", toPathPart org, "actions", "secrets", toPathPart name]++-- | Get selected repositories for an organization secret.+-- See <https://docs.github.com/en/rest/actions/secrets#list-selected-repositories-for-an-organization-secret>+organizationSelectedRepositoriesForSecretR+ :: Name Organization+ -> Name OrganizationSecret+ -> FetchCount+ -> GenRequest 'MtJSON 'RA (WithTotalCount SelectedRepo)+organizationSelectedRepositoriesForSecretR org name =+ PagedQuery ["orgs", toPathPart org, "actions", "secrets", toPathPart name, "repositories"] []++-- | Set selected repositories for an organization secret.+-- See <https://docs.github.com/en/rest/actions/secrets#set-selected-repositories-for-an-organization-secret>+setOrganizationSelectedRepositoriesForSecretR+ :: Name Organization+ -> Name OrganizationSecret+ -> SetSelectedRepositories+ -> GenRequest 'MtUnit 'RW ()+setOrganizationSelectedRepositoriesForSecretR org name =+ Command Put ["orgs", toPathPart org, "actions", "secrets", toPathPart name, "repositories"] . encode++-- | Add selected repository to an organization secret.+-- See <https://docs.github.com/en/rest/actions/secrets#add-selected-repository-to-an-organization-secret>+addOrganizationSelectedRepositoriesForSecretR+ :: Name Organization+ -> Name OrganizationSecret+ -> Id Repo+ -> GenRequest 'MtUnit 'RW ()+addOrganizationSelectedRepositoriesForSecretR org name repo =+ Command Put ["orgs", toPathPart org, "actions", "secrets", toPathPart name, "repositories", toPathPart repo] mempty++-- | Remove selected repository from an organization secret.+-- See <https://docs.github.com/en/rest/actions/secrets#remove-selected-repository-from-an-organization-secret>+removeOrganizationSelectedRepositoriesForSecretR+ :: Name Organization+ -> Name OrganizationSecret+ -> Id Repo+ -> GenRequest 'MtUnit 'RW ()+removeOrganizationSelectedRepositoriesForSecretR org name repo =+ Command Delete ["orgs", toPathPart org, "actions", "secrets", toPathPart name, "repositories", toPathPart repo] mempty++-- | List repository secrets.+-- See <https://docs.github.com/en/rest/actions/secrets#list-repository-secrets>+repoSecretsR+ :: Name Owner+ -> Name Repo+ -> FetchCount+ -> GenRequest 'MtJSON 'RA (WithTotalCount RepoSecret)+repoSecretsR user repo =+ PagedQuery ["repos", toPathPart user, toPathPart repo, "actions", "secrets"] []++-- | Get a repository public key.+-- See <https://docs.github.com/en/rest/actions/secrets#get-a-repository-public-key>+repoPublicKeyR+ :: Name Owner+ -> Name Organization+ -> GenRequest 'MtJSON 'RA PublicKey+repoPublicKeyR user org =+ Query ["repos", toPathPart user, toPathPart org, "actions", "secrets", "public-key"] []++-- | Get a repository secret.+-- See <https://docs.github.com/en/rest/actions/secrets#get-a-repository-secret>+repoSecretR+ :: Name Owner+ -> Name Organization+ -> Name RepoSecret+ -> GenRequest 'MtJSON 'RA RepoSecret+repoSecretR user org name =+ Query ["repos", toPathPart user, toPathPart org, "actions", "secrets", toPathPart name] []++-- | Create or update a repository secret.+-- See <https://docs.github.com/en/rest/actions/secrets#create-or-update-a-repository-secret>+setRepoSecretR+ :: Name Owner+ -> Name Organization+ -> Name RepoSecret+ -> SetRepoSecret+ -> GenRequest 'MtUnit 'RW ()+setRepoSecretR user org name =+ Command Put ["repos", toPathPart user, toPathPart org, "actions", "secrets", toPathPart name] . encode++-- | Delete a repository secret.+-- See <https://docs.github.com/en/rest/actions/secrets#delete-a-repository-secret>+deleteRepoSecretR+ :: Name Owner+ -> Name Organization+ -> Name RepoSecret+ -> GenRequest 'MtUnit 'RW ()+deleteRepoSecretR user org name =+ Command Delete parts mempty+ where+ parts = ["repos", toPathPart user, toPathPart org, "actions", "secrets", toPathPart name]++-- | List environment secrets.+-- See <https://docs.github.com/en/rest/actions/secrets#list-environment-secrets>+environmentSecretsR+ :: Id Repo+ -> Name Environment+ -> FetchCount+ -> GenRequest 'MtJSON 'RA (WithTotalCount RepoSecret)+environmentSecretsR repo env =+ PagedQuery ["repositories", toPathPart repo, "environments", toPathPart env, "secrets"] []++-- | Get an environment public key.+-- See <https://docs.github.com/en/rest/actions/secrets#get-an-environment-public-key>+environmentPublicKeyR+ :: Id Repo+ -> Name Environment+ -> GenRequest 'MtJSON 'RA PublicKey+environmentPublicKeyR repo env =+ Query ["repositories", toPathPart repo, "environments", toPathPart env, "secrets", "public-key"] []++-- | Get an environment secret+-- See <https://docs.github.com/en/rest/actions/secrets#get-an-environment-secret>+environmentSecretR+ :: Id Repo+ -> Name Environment+ -> Name RepoSecret+ -> GenRequest 'MtJSON 'RA RepoSecret+environmentSecretR repo env name =+ Query ["repositories", toPathPart repo, "environments", toPathPart env, "secrets", toPathPart name] []++-- | Create or update an environment secret.+-- See <https://docs.github.com/en/rest/actions/secrets#create-or-update-an-environment-secret>+setEnvironmentSecretR+ :: Id Repo+ -> Name Environment+ -> Name RepoSecret+ -> SetRepoSecret+ -> GenRequest 'MtUnit 'RW ()+setEnvironmentSecretR repo env name =+ Command Put ["repositories", toPathPart repo, "environments", toPathPart env, "secrets", toPathPart name] . encode++-- | Delete an environment secret.+-- See <https://docs.github.com/en/rest/actions/secrets#delete-an-environment-secret>+deleteEnvironmentSecretR+ :: Id Repo+ -> Name Environment+ -> Name RepoSecret+ -> GenRequest 'MtUnit 'RW ()+deleteEnvironmentSecretR repo env name =+ Command Delete parts mempty+ where+ parts = ["repositories", toPathPart repo, "environments", toPathPart env, "secrets", toPathPart name]
+ src/GitHub/Endpoints/Actions/WorkflowJobs.hs view
@@ -0,0 +1,58 @@+-- |+-- The actions API as documented at+-- <https://docs.github.com/en/rest/reference/actions>.++module GitHub.Endpoints.Actions.WorkflowJobs (+ jobR,+ downloadJobLogsR,+ jobsForWorkflowRunAttemptR,+ jobsForWorkflowRunR,+ module GitHub.Data+ ) where++import GitHub.Data+import Network.URI (URI)+import Prelude ()++-- | Get a job for a workflow run.+-- See <https://docs.github.com/en/rest/actions/workflow-jobs#get-a-job-for-a-workflow-run>+jobR+ :: Name Owner+ -> Name Repo+ -> Id Job+ -> Request 'RA Job+jobR owner repo job =+ Query ["repos", toPathPart owner, toPathPart repo, "actions", "jobs", toPathPart job] []++-- | Download job logs for a workflow run.+-- See <https://docs.github.com/en/rest/actions/workflow-jobs#download-job-logs-for-a-workflow-run>+downloadJobLogsR+ :: Name Owner+ -> Name Repo+ -> Id Job+ -> GenRequest 'MtRedirect 'RO URI+downloadJobLogsR owner repo job =+ Query ["repos", toPathPart owner, toPathPart repo, "actions", "jobs", toPathPart job, "logs"] []++-- | List jobs for a workflow run attempt.+-- See <https://docs.github.com/en/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run-attempt>+jobsForWorkflowRunAttemptR+ :: Name Owner+ -> Name Repo+ -> Id WorkflowRun+ -> Id RunAttempt+ -> FetchCount+ -> GenRequest 'MtJSON 'RA (WithTotalCount Job)+jobsForWorkflowRunAttemptR owner repo run attempt =+ PagedQuery ["repos", toPathPart owner, toPathPart repo, "actions", "runs", toPathPart run, "attempts", toPathPart attempt, "jobs"] []++-- | List jobs for a workflow run.+-- See <https://docs.github.com/en/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run>+jobsForWorkflowRunR+ :: Name Owner+ -> Name Repo+ -> Id WorkflowRun+ -> FetchCount+ -> GenRequest 'MtJSON 'RA (WithTotalCount Job)+jobsForWorkflowRunR owner repo run =+ PagedQuery ["repos", toPathPart owner, toPathPart repo, "actions", "runs", toPathPart run, "jobs"] []
+ src/GitHub/Endpoints/Actions/WorkflowRuns.hs view
@@ -0,0 +1,181 @@+module GitHub.Endpoints.Actions.WorkflowRuns (+ reRunJobR,+ workflowRunsR,+ workflowRunR,+ deleteWorkflowRunR,+ workflowRunReviewHistoryR,+ approveWorkflowRunR,+ workflowRunAttemptR,+ downloadWorkflowRunAttemptLogsR,+ cancelWorkflowRunR,+ downloadWorkflowRunLogsR,+ deleteWorkflowRunLogsR,+ reRunWorkflowR,+ reRunFailedJobsR,+ workflowRunsForWorkflowR,+ module GitHub.Data+ ) where++import GitHub.Data+import GitHub.Internal.Prelude+import Network.URI (URI)+import Prelude ()++-- | Re-run a job from a workflow run.+-- See <https://docs.github.com/en/rest/actions/workflow-runs#re-run-a-job-from-a-workflow-run>+reRunJobR+ :: Name Owner+ -> Name Repo+ -> Id Job+ -> GenRequest 'MtUnit 'RW ()+reRunJobR user repo job = Command Post+ ["repos", toPathPart user, toPathPart repo, "actions", "jobs", toPathPart job, "rerun"]+ mempty++-- | List workflow runs for a repository.+-- See <https://docs.github.com/en/rest/actions/workflow-runs#list-workflow-runs-for-a-repository>+workflowRunsR+ :: Name Owner+ -> Name Repo+ -> WorkflowRunMod+ -> FetchCount+ -> GenRequest 'MtJSON 'RA (WithTotalCount WorkflowRun)+workflowRunsR user repo runMod = PagedQuery+ ["repos", toPathPart user, toPathPart repo, "actions", "runs"]+ (workflowRunModToQueryString runMod)++-- | Get a workflow run.+-- See <https://docs.github.com/en/rest/actions/workflow-runs#get-a-workflow-run>+workflowRunR+ :: Name Owner+ -> Name Repo+ -> Id WorkflowRun+ -> GenRequest 'MtJSON 'RA WorkflowRun+workflowRunR user repo run = Query+ ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run]+ []++-- | Delete a workflow run.+-- See <https://docs.github.com/en/rest/actions/workflow-runs#delete-a-workflow-run>+deleteWorkflowRunR+ :: Name Owner+ -> Name Repo+ -> Id WorkflowRun+ -> GenRequest 'MtUnit 'RW ()+deleteWorkflowRunR user repo run = Command Delete+ ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run]+ mempty++-- | Get the review history for a workflow run.+-- See <https://docs.github.com/en/rest/actions/workflow-runs#get-the-review-history-for-a-workflow-run>+workflowRunReviewHistoryR+ :: Name Owner+ -> Name Repo+ -> Id WorkflowRun+ -> GenRequest 'MtJSON 'RA (Vector ReviewHistory)+workflowRunReviewHistoryR user repo run = Query+ ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "approvals"]+ []++-- | Approve a workflow run for a fork pull request.+-- See <https://docs.github.com/en/rest/actions/workflow-runs#approve-a-workflow-run-for-a-fork-pull-request>+approveWorkflowRunR+ :: Name Owner+ -> Name Repo+ -> Id WorkflowRun+ -> GenRequest 'MtUnit 'RW ()+approveWorkflowRunR user repo run = Command Post+ ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "approve"]+ mempty++-- | Get a workflow run attempt.+-- See <https://docs.github.com/en/rest/actions/workflow-runs#get-a-workflow-run-attempt>+workflowRunAttemptR+ :: Name Owner+ -> Name Repo+ -> Id WorkflowRun+ -> Id RunAttempt+ -> GenRequest 'MtJSON 'RA WorkflowRun+workflowRunAttemptR user repo run attempt = Query+ ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "attempts", toPathPart attempt]+ []++-- | Download workflow run attempt logs.+-- See <https://docs.github.com/en/rest/actions/workflow-runs#download-workflow-run-attempt-logs>+downloadWorkflowRunAttemptLogsR+ :: Name Owner+ -> Name Repo+ -> Id WorkflowRun+ -> Id RunAttempt+ -> GenRequest 'MtRedirect 'RO URI+downloadWorkflowRunAttemptLogsR user repo run attempt = Query+ ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "attempts", toPathPart attempt, "logs"]+ []++-- | Cancel a workflow run.+-- See <https://docs.github.com/en/rest/actions/workflow-runs#cancel-a-workflow-run>+cancelWorkflowRunR+ :: Name Owner+ -> Name Repo+ -> Id WorkflowRun+ -> GenRequest 'MtUnit 'RW ()+cancelWorkflowRunR user repo run = Command Post+ ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "cancel"]+ mempty++-- | Download workflow run logs.+-- See <https://docs.github.com/en/rest/actions/workflow-runs#download-workflow-run-logs>+downloadWorkflowRunLogsR+ :: Name Owner+ -> Name Repo+ -> Id WorkflowRun+ -> GenRequest 'MtRedirect 'RA URI+downloadWorkflowRunLogsR user repo run = Query+ ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "logs"]+ []++-- | Delete workflow run logs.+-- See <https://docs.github.com/en/rest/actions/workflow-runs#delete-workflow-run-logs>+deleteWorkflowRunLogsR+ :: Name Owner+ -> Name Repo+ -> Id WorkflowRun+ -> GenRequest 'MtUnit 'RW ()+deleteWorkflowRunLogsR user repo run = Command Delete+ ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "logs"]+ mempty++-- | Re-run a workflow.+-- See <https://docs.github.com/en/rest/actions/workflow-runs#re-run-a-workflow>+reRunWorkflowR+ :: Name Owner+ -> Name Repo+ -> Id WorkflowRun+ -> GenRequest 'MtUnit 'RW ()+reRunWorkflowR user repo run = Command Post+ ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "rerun"]+ mempty++-- | Re-run failed jobs from a workflow run.+-- See <https://docs.github.com/en/rest/actions/re-run-failed-jobs-from-a-workflow-run>+reRunFailedJobsR+ :: Name Owner+ -> Name Repo+ -> Id WorkflowRun+ -> GenRequest 'MtUnit 'RW ()+reRunFailedJobsR user repo run = Command Post+ ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "rerun-failed-jobs"]+ mempty++-- | List workflow runs for a workflow.+-- See <https://docs.github.com/en/rest/actions/workflow-runs#list-workflow-runs-for-a-workflow>+workflowRunsForWorkflowR+ :: (IsPathPart idOrName) => Name Owner+ -> Name Repo+ -> idOrName+ -> WorkflowRunMod+ -> FetchCount+ -> GenRequest 'MtJSON 'RA (WithTotalCount WorkflowRun)+workflowRunsForWorkflowR user repo idOrName runMod = PagedQuery+ ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart idOrName, "runs"]+ (workflowRunModToQueryString runMod)
+ src/GitHub/Endpoints/Actions/Workflows.hs view
@@ -0,0 +1,68 @@+module GitHub.Endpoints.Actions.Workflows (+ repositoryWorkflowsR,+ workflowR,+ disableWorkflowR,+ triggerWorkflowR,+ enableWorkflowR,+ module GitHub.Data+ ) where++import GitHub.Data+import GitHub.Internal.Prelude+import Prelude ()++-- | List repository workflows.+-- See <https://docs.github.com/en/rest/actions/workflows#list-repository-workflows>+repositoryWorkflowsR+ :: Name Owner+ -> Name Repo+ -> FetchCount+ -> GenRequest 'MtJSON 'RA (WithTotalCount Workflow)+repositoryWorkflowsR user repo = PagedQuery+ ["repos", toPathPart user, toPathPart repo, "actions", "workflows"]+ []++-- | Get a workflow.+-- See <https://docs.github.com/en/rest/actions/workflows#get-a-workflow>+workflowR+ :: (IsPathPart idOrName) => Name Owner+ -> Name Repo+ -> idOrName+ -> GenRequest 'MtJSON 'RA Workflow+workflowR user repo idOrName = Query+ ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart idOrName]+ []++-- | Disable a workflow.+-- See <https://docs.github.com/en/rest/actions/workflows#disable-a-workflow>+disableWorkflowR+ :: (IsPathPart idOrName) => Name Owner+ -> Name Repo+ -> idOrName+ -> GenRequest 'MtUnit 'RW ()+disableWorkflowR user repo idOrName = Command Put+ ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart idOrName, "disable"]+ mempty++-- | Create a workflow dispatch event.+-- See <https://docs.github.com/en/rest/actions/workflows#create-a-workflow-dispatch-event>+triggerWorkflowR+ :: (ToJSON a, IsPathPart idOrName) => Name Owner+ -> Name Repo+ -> idOrName+ -> CreateWorkflowDispatchEvent a+ -> GenRequest 'MtUnit 'RW ()+triggerWorkflowR user repo idOrName = Command Post+ ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart idOrName, "dispatches"]+ . encode++-- | Enable a workflow.+-- See <https://docs.github.com/en/rest/actions/workflows#enable-a-workflow>+enableWorkflowR+ :: (IsPathPart idOrName) => Name Owner+ -> Name Repo+ -> idOrName+ -> GenRequest 'MtUnit 'RW ()+enableWorkflowR user repo idOrName = Command Put+ ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart idOrName, "enable"]+ mempty
src/GitHub/Endpoints/Activity/Events.hs view
@@ -1,9 +1,6 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The events API as described on <https://developer.github.com/v3/activity/events/>.+ module GitHub.Endpoints.Activity.Events ( -- * Events repositoryEventsR,
src/GitHub/Endpoints/Activity/Notifications.hs view
@@ -1,31 +1,22 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The repo watching API as described on -- <https://developer.github.com/v3/activity/notifications/>. -module GitHub.Endpoints.Activity.Notifications where+module GitHub.Endpoints.Activity.Notifications (+ getNotificationsR,+ markNotificationAsReadR,+ markAllNotificationsAsReadR,+ ) where import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () -getNotifications :: Auth -> IO (Either Error (Vector Notification))-getNotifications auth =- executeRequest auth $ getNotificationsR FetchAll- -- | List your notifications. -- See <https://developer.github.com/v3/activity/notifications/#list-your-notifications> getNotificationsR :: FetchCount -> Request 'RA (Vector Notification) getNotificationsR = pagedQuery ["notifications"] [] -markNotificationAsRead :: Auth -> Id Notification -> IO (Either Error ())-markNotificationAsRead auth nid =- executeRequest auth $ markNotificationAsReadR nid- -- | Mark a thread as read. -- See <https://developer.github.com/v3/activity/notifications/#mark-a-thread-as-read> markNotificationAsReadR :: Id Notification -> GenRequest 'MtUnit 'RW ()@@ -33,10 +24,6 @@ Patch ["notifications", "threads", toPathPart nid] (encode ())--markNotificationsAsRead :: Auth -> IO (Either Error ())-markNotificationsAsRead auth =- executeRequest auth markAllNotificationsAsReadR -- | Mark as read. -- See <https://developer.github.com/v3/activity/notifications/#mark-as-read>
src/GitHub/Endpoints/Activity/Starring.hs view
@@ -1,22 +1,13 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The repo starring API as described on -- <https://developer.github.com/v3/activity/starring/>.+ module GitHub.Endpoints.Activity.Starring (- stargazersFor, stargazersForR,- reposStarredBy, reposStarredByR,- myStarred, myStarredR,- myStarredAcceptStar, myStarredAcceptStarR,- starRepo, starRepoR,- unstarRepo, unstarRepoR, module GitHub.Data, ) where@@ -24,29 +15,14 @@ import GitHub.Auth import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () --- | The list of users that have starred the specified Github repo.------ > userInfoFor' Nothing "mike-burns"-stargazersFor :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector SimpleUser))-stargazersFor auth user repo =- executeRequestMaybe auth $ stargazersForR user repo FetchAll- -- | List Stargazers. -- See <https://developer.github.com/v3/activity/starring/#list-stargazers> stargazersForR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector SimpleUser) stargazersForR user repo = pagedQuery ["repos", toPathPart user, toPathPart repo, "stargazers"] [] --- | All the public repos starred by the specified user.------ > reposStarredBy Nothing "croaky"-reposStarredBy :: Maybe Auth -> Name Owner -> IO (Either Error (Vector Repo))-reposStarredBy auth user =- executeRequestMaybe auth $ reposStarredByR user FetchAll- -- | List repositories being starred. -- See <https://developer.github.com/v3/activity/starring/#list-repositories-being-starred> reposStarredByR :: Name Owner -> FetchCount -> Request k (Vector Repo)@@ -54,40 +30,21 @@ pagedQuery ["users", toPathPart user, "starred"] [] -- | All the repos starred by the authenticated user.-myStarred :: Auth -> IO (Either Error (Vector Repo))-myStarred auth =- executeRequest auth $ myStarredR FetchAll---- | All the repos starred by the authenticated user. -- See <https://developer.github.com/v3/activity/starring/#list-repositories-being-starred> myStarredR :: FetchCount -> Request 'RA (Vector Repo) myStarredR = pagedQuery ["user", "starred"] [] - -- | All the repos starred by the authenticated user.-myStarredAcceptStar :: Auth -> IO (Either Error (Vector RepoStarred))-myStarredAcceptStar auth =- executeRequest auth $ myStarredAcceptStarR FetchAll---- | All the repos starred by the authenticated user. -- See <https://developer.github.com/v3/activity/starring/#alternative-response-with-star-creation-timestamps-1> myStarredAcceptStarR :: FetchCount -> GenRequest 'MtStar 'RA (Vector RepoStarred) myStarredAcceptStarR = PagedQuery ["user", "starred"] [] -- | Star a repo by the authenticated user.-starRepo :: Auth -> Name Owner -> Name Repo -> IO (Either Error ())-starRepo auth user repo = executeRequest auth $ starRepoR user repo---- | Star a repo by the authenticated user. -- See <https://developer.github.com/v3/activity/starring/#star-a-repository> starRepoR :: Name Owner -> Name Repo -> GenRequest 'MtUnit 'RW () starRepoR user repo = Command Put paths mempty where paths = ["user", "starred", toPathPart user, toPathPart repo]---- | Unstar a repo by the authenticated user.-unstarRepo :: Auth -> Name Owner -> Name Repo -> IO (Either Error ())-unstarRepo auth user repo = executeRequest auth $ unstarRepoR user repo -- | Unstar a repo by the authenticated user. -- See <https://developer.github.com/v3/activity/starring/#unstar-a-repository>
src/GitHub/Endpoints/Activity/Watching.hs view
@@ -1,62 +1,33 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The repo watching API as described on -- <https://developer.github.com/v3/activity/watching/>.+ module GitHub.Endpoints.Activity.Watching (- watchersFor,- watchersFor', watchersForR,- reposWatchedBy,- reposWatchedBy', reposWatchedByR,+ unwatchRepoR, module GitHub.Data, ) where import GitHub.Auth import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () --- | The list of users that are watching the specified Github repo.------ > watchersFor "thoughtbot" "paperclip"-watchersFor :: Name Owner -> Name Repo -> IO (Either Error (Vector SimpleUser))-watchersFor = watchersFor' Nothing---- | The list of users that are watching the specified Github repo.--- With authentication------ > watchersFor' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip"-watchersFor' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector SimpleUser))-watchersFor' auth user repo =- executeRequestMaybe auth $ watchersForR user repo FetchAll- -- | List watchers. -- See <https://developer.github.com/v3/activity/watching/#list-watchers> watchersForR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector SimpleUser) watchersForR user repo limit = pagedQuery ["repos", toPathPart user, toPathPart repo, "watchers"] [] limit --- | All the public repos watched by the specified user.------ > reposWatchedBy "croaky"-reposWatchedBy :: Name Owner -> IO (Either Error (Vector Repo))-reposWatchedBy = reposWatchedBy' Nothing---- | All the public repos watched by the specified user.--- With authentication------ > reposWatchedBy' (Just $ BasicAuth "github-username" "github-password") "croaky"-reposWatchedBy' :: Maybe Auth -> Name Owner -> IO (Either Error (Vector Repo))-reposWatchedBy' auth user =- executeRequestMaybe auth $ reposWatchedByR user FetchAll- -- | List repositories being watched. -- See <https://developer.github.com/v3/activity/watching/#list-repositories-being-watched> reposWatchedByR :: Name Owner -> FetchCount -> Request k (Vector Repo) reposWatchedByR user = pagedQuery ["users", toPathPart user, "subscriptions"] []++-- | Stop watching repository.+-- See <https://docs.github.com/en/rest/reference/activity#delete-a-repository-subscription>+unwatchRepoR :: Name Owner -> Name Repo -> Request 'RW ()+unwatchRepoR owner repo =+ command Delete ["repos", toPathPart owner, toPathPart repo, "subscription"] mempty
+ src/GitHub/Endpoints/Enterprise/Organizations.hs view
@@ -0,0 +1,25 @@+-- |+-- The GitHub Enterprise orgs API as described on <https://developer.github.com/enterprise/v3/enterprise-admin/orgs/>.++module GitHub.Endpoints.Enterprise.Organizations (+ createOrganizationR,+ renameOrganizationR,+ module GitHub.Data,+ ) where++import GitHub.Data+import GitHub.Data.Enterprise+import GitHub.Internal.Prelude+import Prelude ()++-- | Create an organization.+-- See <https://developer.github.com/enterprise/v3/enterprise-admin/orgs/#create-an-organization>+createOrganizationR :: CreateOrganization -> Request 'RW SimpleOrganization+createOrganizationR =+ command Post ["admin", "organizations"] . encode++-- | Rename an organization.+-- See <https://developer.github.com/enterprise/v3/enterprise-admin/orgs/#rename-an-organization>+renameOrganizationR :: Name Organization -> RenameOrganization -> Request 'RW RenameOrganizationResponse+renameOrganizationR org =+ command Patch ["admin", "organizations", toPathPart org] . encode
src/GitHub/Endpoints/Gists.hs view
@@ -1,72 +1,35 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The gists API as described at <http://developer.github.com/v3/gists/>.+ module GitHub.Endpoints.Gists (- gists,- gists', gistsR,- gist,- gist', gistR,- starGist,+ createGistR, starGistR,- unstarGist, unstarGistR,- deleteGist, deleteGistR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () --- | The list of all gists created by the user------ > gists' (Just $ BasicAuth "github-username" "github-password") "mike-burns"-gists' :: Maybe Auth -> Name Owner -> IO (Either Error (Vector Gist))-gists' auth user =- executeRequestMaybe auth $ gistsR user FetchAll---- | The list of all public gists created by the user.------ > gists "mike-burns"-gists :: Name Owner -> IO (Either Error (Vector Gist))-gists = gists' Nothing- -- | List gists. -- See <https://developer.github.com/v3/gists/#list-gists> gistsR :: Name Owner -> FetchCount -> Request k (Vector Gist) gistsR user = pagedQuery ["users", toPathPart user, "gists"] [] --- | A specific gist, given its id, with authentication credentials------ > gist' (Just $ BasicAuth "github-username" "github-password") "225074"-gist' :: Maybe Auth -> Name Gist -> IO (Either Error Gist)-gist' auth gid =- executeRequestMaybe auth $ gistR gid---- | A specific gist, given its id.------ > gist "225074"-gist :: Name Gist -> IO (Either Error Gist)-gist = gist' Nothing- -- | Query a single gist. -- See <https://developer.github.com/v3/gists/#get-a-single-gist> gistR :: Name Gist -> Request k Gist gistR gid = query ["gists", toPathPart gid] [] --- | Star a gist by the authenticated user.------ > starGist (BasicAuth "github-username" "github-password") "225074"-starGist :: Auth -> Name Gist -> IO (Either Error ())-starGist auth gid = executeRequest auth $ starGistR gid+-- | Create a new gist+-- See <https://docs.github.com/rest/reference/gists#create-a-gist>+createGistR :: NewGist -> Request 'RW Gist+createGistR ngist = command Post ["gists"] (encode ngist) -- | Star a gist by the authenticated user. -- See <https://developer.github.com/v3/gists/#star-a-gist>@@ -74,21 +37,9 @@ starGistR gid = Command Put ["gists", toPathPart gid, "star"] mempty -- | Unstar a gist by the authenticated user.------ > unstarGist (BasicAuth "github-username" "github-password") "225074"-unstarGist :: Auth -> Name Gist -> IO (Either Error ())-unstarGist auth gid = executeRequest auth $ unstarGistR gid---- | Unstar a gist by the authenticated user. -- See <https://developer.github.com/v3/gists/#unstar-a-gist> unstarGistR :: Name Gist -> GenRequest 'MtUnit 'RW () unstarGistR gid = Command Delete ["gists", toPathPart gid, "star"] mempty---- | Delete a gist by the authenticated user.------ > deleteGist (BasicAuth "github-username" "github-password") "225074"-deleteGist :: Auth -> Name Gist -> IO (Either Error ())-deleteGist auth gid = executeRequest auth $ deleteGistR gid -- | Delete a gist by the authenticated user. -- See <https://developer.github.com/v3/gists/#delete-a-gist>
src/GitHub/Endpoints/Gists/Comments.hs view
@@ -1,42 +1,22 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The loving comments people have left on Gists, described on -- <http://developer.github.com/v3/gists/comments/>.+ module GitHub.Endpoints.Gists.Comments (- commentsOn, commentsOnR,- comment, gistCommentR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () --- | All the comments on a Gist, given the Gist ID.------ > commentsOn "1174060"-commentsOn :: Name Gist -> IO (Either Error (Vector GistComment))-commentsOn gid =- executeRequest' $ commentsOnR gid FetchAll- -- | List comments on a gist. -- See <https://developer.github.com/v3/gists/comments/#list-comments-on-a-gist> commentsOnR :: Name Gist -> FetchCount -> Request k (Vector GistComment) commentsOnR gid = pagedQuery ["gists", toPathPart gid, "comments"] []---- | A specific comment, by the comment ID.------ > comment (Id 62449)-comment :: Id GistComment -> IO (Either Error GistComment)-comment cid =- executeRequest' $ gistCommentR cid -- | Query a single comment. -- See <https://developer.github.com/v3/gists/comments/#get-a-single-comment>
src/GitHub/Endpoints/GitData/Blobs.hs view
@@ -1,34 +1,14 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The API for dealing with git blobs from Github repos, as described in -- <http://developer.github.com/v3/git/blobs/>.+ module GitHub.Endpoints.GitData.Blobs (- blob,- blob', blobR, module GitHub.Data, ) where import GitHub.Data-import GitHub.Internal.Prelude-import GitHub.Request import Prelude ()---- | Query a blob by SHA1.------ > blob' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" "bc5c51d1ece1ee45f94b056a0f5a1674d7e8cba9"-blob' :: Maybe Auth -> Name Owner -> Name Repo -> Name Blob -> IO (Either Error Blob)-blob' auth user repo sha =- executeRequestMaybe auth $ blobR user repo sha---- | Query a blob by SHA1.------ > blob "thoughtbot" "paperclip" "bc5c51d1ece1ee45f94b056a0f5a1674d7e8cba9"-blob :: Name Owner -> Name Repo -> Name Blob -> IO (Either Error Blob)-blob = blob' Nothing -- | Query a blob. -- See <https://developer.github.com/v3/git/blobs/#get-a-blob>
src/GitHub/Endpoints/GitData/Commits.hs view
@@ -1,27 +1,14 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The API for underlying git commits of a Github repo, as described on -- <http://developer.github.com/v3/git/commits/>.+ module GitHub.Endpoints.GitData.Commits (- commit, gitCommitR, module GitHub.Data, ) where import GitHub.Data-import GitHub.Internal.Prelude-import GitHub.Request import Prelude ()---- | A single commit, by SHA1.------ > commit "thoughtbot" "paperclip" "bc5c51d1ece1ee45f94b056a0f5a1674d7e8cba9"-commit :: Name Owner -> Name Repo -> Name GitCommit -> IO (Either Error GitCommit)-commit user repo sha =- executeRequest' $ gitCommitR user repo sha -- | Query a commit. -- See <https://developer.github.com/v3/git/commits/#get-a-commit>
src/GitHub/Endpoints/GitData/References.hs view
@@ -1,61 +1,27 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The underlying git references on a Github repo, exposed for the world to -- see. The git internals documentation will also prove handy for understanding -- these. API documentation at <http://developer.github.com/v3/git/refs/>.+ module GitHub.Endpoints.GitData.References (- reference,- reference', referenceR,- references,- references', referencesR,- createReference, createReferenceR,- namespacedReferences,+ deleteReferenceR,+ namespacedReferencesR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () --- | A single reference by the ref name.------ > reference' (Just $ BasicAuth "github-username" "github-password") "mike-burns" "github" "heads/master"-reference' :: Maybe Auth -> Name Owner -> Name Repo -> Name GitReference -> IO (Either Error GitReference)-reference' auth user repo ref =- executeRequestMaybe auth $ referenceR user repo ref---- | A single reference by the ref name.------ > reference "mike-burns" "github" "heads/master"-reference :: Name Owner -> Name Repo -> Name GitReference -> IO (Either Error GitReference)-reference = reference' Nothing---- | Query a reference.+-- | A single reference -- | Query a reference. -- See <https://developer.github.com/v3/git/refs/#get-a-reference> referenceR :: Name Owner -> Name Repo -> Name GitReference -> Request k GitReference referenceR user repo ref = query ["repos", toPathPart user, toPathPart repo, "git", "refs", toPathPart ref] [] --- | The history of references for a repo.------ > references "mike-burns" "github"-references' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector GitReference))-references' auth user repo =- executeRequestMaybe auth $ referencesR user repo FetchAll---- | The history of references for a repo.------ > references "mike-burns" "github"-references :: Name Owner -> Name Repo -> IO (Either Error (Vector GitReference))-references = references' Nothing- -- | Query all References. -- See <https://developer.github.com/v3/git/refs/#get-all-references> referencesR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector GitReference)@@ -63,22 +29,16 @@ pagedQuery ["repos", toPathPart user, toPathPart repo, "git", "refs"] [] -- | Create a reference.-createReference :: Auth -> Name Owner -> Name Repo -> NewGitReference -> IO (Either Error GitReference)-createReference auth user repo newRef =- executeRequest auth $ createReferenceR user repo newRef---- | Create a reference. -- See <https://developer.github.com/v3/git/refs/#create-a-reference> createReferenceR :: Name Owner -> Name Repo -> NewGitReference -> Request 'RW GitReference createReferenceR user repo newRef = command Post ["repos", toPathPart user, toPathPart repo , "git", "refs"] (encode newRef) --- | Limited references by a namespace.------ > namespacedReferences "thoughtbot" "paperclip" "tags"-namespacedReferences :: Name Owner -> Name Repo -> Text -> IO (Either Error [GitReference])-namespacedReferences user repo namespace =- executeRequest' $ namespacedReferencesR user repo namespace+-- | Delete a reference.+-- See <https://developer.github.com/v3/git/refs/#delete-a-reference>+deleteReferenceR :: Name Owner -> Name Repo -> Name GitReference -> GenRequest 'MtUnit 'RW ()+deleteReferenceR user repo ref =+ Command Delete ["repos", toPathPart user, toPathPart repo , "git", "refs", toPathPart ref] mempty -- | Query namespaced references. -- See <https://developer.github.com/v3/git/refs/#get-all-references>
src/GitHub/Endpoints/GitData/Trees.hs view
@@ -1,56 +1,22 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The underlying tree of SHA1s and files that make up a git repo. The API is -- described on <http://developer.github.com/v3/git/trees/>.+ module GitHub.Endpoints.GitData.Trees (- tree,- tree', treeR,- nestedTree,- nestedTree', nestedTreeR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () --- | A tree for a SHA1.------ > tree (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" "fe114451f7d066d367a1646ca7ac10e689b46844"-tree' :: Maybe Auth -> Name Owner -> Name Repo -> Name Tree -> IO (Either Error Tree)-tree' auth user repo sha =- executeRequestMaybe auth $ treeR user repo sha---- | A tree for a SHA1.------ > tree "thoughtbot" "paperclip" "fe114451f7d066d367a1646ca7ac10e689b46844"-tree :: Name Owner -> Name Repo -> Name Tree -> IO (Either Error Tree)-tree = tree' Nothing- -- | Query a Tree. -- See <https://developer.github.com/v3/git/trees/#get-a-tree> treeR :: Name Owner -> Name Repo -> Name Tree -> Request k Tree treeR user repo sha = query ["repos", toPathPart user, toPathPart repo, "git", "trees", toPathPart sha] []---- | A recursively-nested tree for a SHA1.------ > nestedTree' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" "fe114451f7d066d367a1646ca7ac10e689b46844"-nestedTree' :: Maybe Auth -> Name Owner -> Name Repo -> Name Tree -> IO (Either Error Tree)-nestedTree' auth user repo sha =- executeRequestMaybe auth $ nestedTreeR user repo sha---- | A recursively-nested tree for a SHA1.------ > nestedTree "thoughtbot" "paperclip" "fe114451f7d066d367a1646ca7ac10e689b46844"-nestedTree :: Name Owner -> Name Repo -> Name Tree -> IO (Either Error Tree)-nestedTree = nestedTree' Nothing -- | Query a Tree Recursively. -- See <https://developer.github.com/v3/git/trees/#get-a-tree-recursively>
src/GitHub/Endpoints/Issues.hs view
@@ -1,23 +1,13 @@-{-# LANGUAGE CPP #-}------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The issues API as described on <http://developer.github.com/v3/issues/>.+ module GitHub.Endpoints.Issues ( currentUserIssuesR, organizationIssuesR,- issue,- issue', issueR,- issuesForRepo,- issuesForRepo', issuesForRepoR,- createIssue, createIssueR, newIssue,- editIssue, editIssueR, editOfIssue, module GitHub.Data,@@ -25,7 +15,6 @@ import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () -- | See <https://developer.github.com/v3/issues/#list-issues>.@@ -38,42 +27,12 @@ organizationIssuesR org opts = pagedQuery ["orgs", toPathPart org, "issues"] (issueModToQueryString opts) --- | Details on a specific issue, given the repo owner and name, and the issue--- number.'------ > issue' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" "462"-issue' :: Maybe Auth -> Name Owner -> Name Repo -> Id Issue -> IO (Either Error Issue)-issue' auth user reqRepoName reqIssueNumber =- executeRequestMaybe auth $ issueR user reqRepoName reqIssueNumber---- | Details on a specific issue, given the repo owner and name, and the issue--- number.------ > issue "thoughtbot" "paperclip" (Id "462")-issue :: Name Owner -> Name Repo -> Id Issue -> IO (Either Error Issue)-issue = issue' Nothing- -- | Query a single issue. -- See <https://developer.github.com/v3/issues/#get-a-single-issue>-issueR :: Name Owner -> Name Repo -> Id Issue -> Request k Issue+issueR :: Name Owner -> Name Repo -> IssueNumber -> Request k Issue issueR user reqRepoName reqIssueNumber = query ["repos", toPathPart user, toPathPart reqRepoName, "issues", toPathPart reqIssueNumber] [] --- | All issues for a repo (given the repo owner and name), with optional--- restrictions as described in the 'IssueRepoMod' data type.------ > issuesForRepo' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" [NoMilestone, OnlyClosed, Mentions "jyurek", Ascending]-issuesForRepo' :: Maybe Auth -> Name Owner -> Name Repo -> IssueRepoMod -> IO (Either Error (Vector Issue))-issuesForRepo' auth user reqRepoName opts =- executeRequestMaybe auth $ issuesForRepoR user reqRepoName opts FetchAll---- | All issues for a repo (given the repo owner and name), with optional--- restrictions as described in the 'IssueRepoMod' data type.------ > issuesForRepo "thoughtbot" "paperclip" [NoMilestone, OnlyClosed, Mentions "jyurek", Ascending]-issuesForRepo :: Name Owner -> Name Repo -> IssueRepoMod -> IO (Either Error (Vector Issue))-issuesForRepo = issuesForRepo' Nothing- -- | List issues for a repository. -- See <https://developer.github.com/v3/issues/#list-issues-for-a-repository> issuesForRepoR :: Name Owner -> Name Repo -> IssueRepoMod -> FetchCount -> Request k (Vector Issue)@@ -87,16 +46,6 @@ newIssue :: Text -> NewIssue newIssue title = NewIssue title Nothing mempty Nothing Nothing ---- | Create a new issue.------ > createIssue (BasicAuth "github-username" "github-password") user repo--- > (newIssue "some_repo") {...}-createIssue :: Auth -> Name Owner -> Name Repo -> NewIssue- -> IO (Either Error Issue)-createIssue auth user repo ni =- executeRequest auth $ createIssueR user repo ni- -- | Create an issue. -- See <https://developer.github.com/v3/issues/#create-an-issue> createIssueR :: Name Owner -> Name Repo -> NewIssue -> Request 'RW Issue@@ -109,16 +58,7 @@ editOfIssue = EditIssue Nothing Nothing Nothing Nothing Nothing Nothing -- | Edit an issue.------ > editIssue (BasicAuth "github-username" "github-password") user repo issue--- > editOfIssue {...}-editIssue :: Auth -> Name Owner -> Name Repo -> Id Issue -> EditIssue- -> IO (Either Error Issue)-editIssue auth user repo iss edit =- executeRequest auth $ editIssueR user repo iss edit---- | Edit an issue. -- See <https://developer.github.com/v3/issues/#edit-an-issue>-editIssueR :: Name Owner -> Name Repo -> Id Issue -> EditIssue -> Request 'RW Issue+editIssueR :: Name Owner -> Name Repo -> IssueNumber -> EditIssue -> Request 'RW Issue editIssueR user repo iss = command Patch ["repos", toPathPart user, toPathPart repo, "issues", toPathPart iss] . encode
src/GitHub/Endpoints/Issues/Comments.hs view
@@ -1,71 +1,32 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The Github issue comments API from -- <http://developer.github.com/v3/issues/comments/>.+ module GitHub.Endpoints.Issues.Comments (- comment, commentR,- comments, commentsR,- comments',- createComment, createCommentR,- deleteComment, deleteCommentR,- editComment, editCommentR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () --- | A specific comment, by ID.------ > comment "thoughtbot" "paperclip" 1468184-comment :: Name Owner -> Name Repo -> Id Comment -> IO (Either Error IssueComment)-comment user repo cid =- executeRequest' $ commentR user repo cid- -- | Query a single comment. -- See <https://developer.github.com/v3/issues/comments/#get-a-single-comment> commentR :: Name Owner -> Name Repo -> Id Comment -> Request k IssueComment commentR user repo cid = query ["repos", toPathPart user, toPathPart repo, "issues", "comments", toPathPart cid] [] --- | All comments on an issue, by the issue's number.------ > comments "thoughtbot" "paperclip" 635-comments :: Name Owner -> Name Repo -> IssueNumber -> IO (Either Error (Vector IssueComment))-comments = comments' Nothing---- | All comments on an issue, by the issue's number, using authentication.------ > comments' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" 635-comments' :: Maybe Auth -> Name Owner -> Name Repo -> IssueNumber -> IO (Either Error (Vector IssueComment))-comments' auth user repo iid =- executeRequestMaybe auth $ commentsR user repo iid FetchAll- -- | List comments on an issue. -- See <https://developer.github.com/v3/issues/comments/#list-comments-on-an-issue> commentsR :: Name Owner -> Name Repo -> IssueNumber -> FetchCount -> Request k (Vector IssueComment) commentsR user repo iid = pagedQuery ["repos", toPathPart user, toPathPart repo, "issues", toPathPart iid, "comments"] [] --- | Create a new comment.------ > createComment (BasicAuth "github-username" "github-password") user repo issue--- > "some words"-createComment :: Auth -> Name Owner -> Name Repo -> IssueNumber -> Text- -> IO (Either Error Comment)-createComment auth user repo iss body =- executeRequest auth $ createCommentR user repo iss body- -- | Create a comment. -- See <https://developer.github.com/v3/issues/comments/#create-a-comment> createCommentR :: Name Owner -> Name Repo -> IssueNumber -> Text -> Request 'RW Comment@@ -75,29 +36,12 @@ parts = ["repos", toPathPart user, toPathPart repo, "issues", toPathPart iss, "comments"] -- | Edit a comment.------ > editComment (BasicAuth "github-username" "github-password") user repo commentid--- > "new words"-editComment :: Auth -> Name Owner -> Name Repo -> Id Comment -> Text- -> IO (Either Error Comment)-editComment auth user repo commid body =- executeRequest auth $ editCommentR user repo commid body---- | Edit a comment. -- See <https://developer.github.com/v3/issues/comments/#edit-a-comment> editCommentR :: Name Owner -> Name Repo -> Id Comment -> Text -> Request 'RW Comment editCommentR user repo commid body = command Patch parts (encode $ EditComment body) where parts = ["repos", toPathPart user, toPathPart repo, "issues", "comments", toPathPart commid]---- | Delete a comment.------ > deleteComment (BasicAuth "github-username" "github-password") user repo commentid-deleteComment :: Auth -> Name Owner -> Name Repo -> Id Comment- -> IO (Either Error ())-deleteComment auth user repo commid =- executeRequest auth $ deleteCommentR user repo commid -- | Delete a comment. -- See <https://developer.github.com/v3/issues/comments/#delete-a-comment>
src/GitHub/Endpoints/Issues/Events.hs view
@@ -1,78 +1,29 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The Github issue events API, which is described on -- <http://developer.github.com/v3/issues/events/>+ module GitHub.Endpoints.Issues.Events (- eventsForIssue,- eventsForIssue', eventsForIssueR,- eventsForRepo,- eventsForRepo', eventsForRepoR,- event,- event', eventR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () --- | All events that have happened on an issue.------ > eventsForIssue "thoughtbot" "paperclip" 49-eventsForIssue :: Name Owner -> Name Repo -> Id Issue -> IO (Either Error (Vector IssueEvent))-eventsForIssue = eventsForIssue' Nothing---- | All events that have happened on an issue, using authentication.------ > eventsForIssue' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" 49-eventsForIssue' :: Maybe Auth -> Name Owner -> Name Repo -> Id Issue -> IO (Either Error (Vector IssueEvent))-eventsForIssue' auth user repo iid =- executeRequestMaybe auth $ eventsForIssueR user repo iid FetchAll- -- | List events for an issue. -- See <https://developer.github.com/v3/issues/events/#list-events-for-an-issue> eventsForIssueR :: Name Owner -> Name Repo -> Id Issue -> FetchCount -> Request k (Vector IssueEvent) eventsForIssueR user repo iid = pagedQuery ["repos", toPathPart user, toPathPart repo, "issues", toPathPart iid, "events"] [] --- | All the events for all issues in a repo.------ > eventsForRepo "thoughtbot" "paperclip"-eventsForRepo :: Name Owner -> Name Repo -> IO (Either Error (Vector IssueEvent))-eventsForRepo = eventsForRepo' Nothing---- | All the events for all issues in a repo, using authentication.------ > eventsForRepo' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip"-eventsForRepo' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector IssueEvent))-eventsForRepo' auth user repo =- executeRequestMaybe auth $ eventsForRepoR user repo FetchAll- -- | List events for a repository. -- See <https://developer.github.com/v3/issues/events/#list-events-for-a-repository> eventsForRepoR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector IssueEvent) eventsForRepoR user repo = pagedQuery ["repos", toPathPart user, toPathPart repo, "issues", "events"] []---- | Details on a specific event, by the event's ID.------ > event "thoughtbot" "paperclip" 5335772-event :: Name Owner -> Name Repo -> Id IssueEvent -> IO (Either Error IssueEvent)-event = event' Nothing---- | Details on a specific event, by the event's ID, using authentication.------ > event' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" 5335772-event' :: Maybe Auth -> Name Owner -> Name Repo -> Id IssueEvent -> IO (Either Error IssueEvent)-event' auth user repo eid =- executeRequestMaybe auth $ eventR user repo eid -- | Query a single event. -- See <https://developer.github.com/v3/issues/events/#get-a-single-event>
src/GitHub/Endpoints/Issues/Labels.hs view
@@ -1,132 +1,53 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The API for dealing with labels on Github issues as described on -- <http://developer.github.com/v3/issues/labels/>.+ module GitHub.Endpoints.Issues.Labels (- labelsOnRepo,- labelsOnRepo', labelsOnRepoR,- label,- label', labelR,- createLabel, createLabelR,- updateLabel, updateLabelR,- deleteLabel, deleteLabelR,- labelsOnIssue,- labelsOnIssue', labelsOnIssueR,- addLabelsToIssue, addLabelsToIssueR,- removeLabelFromIssue, removeLabelFromIssueR,- replaceAllLabelsForIssue, replaceAllLabelsForIssueR,- removeAllLabelsFromIssue, removeAllLabelsFromIssueR,- labelsOnMilestone,- labelsOnMilestone', labelsOnMilestoneR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () --- | All the labels available to use on any issue in the repo.------ > labelsOnRepo "thoughtbot" "paperclip"-labelsOnRepo :: Name Owner -> Name Repo -> IO (Either Error (Vector IssueLabel))-labelsOnRepo = labelsOnRepo' Nothing---- | All the labels available to use on any issue in the repo using authentication.------ > labelsOnRepo' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip"-labelsOnRepo' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector IssueLabel))-labelsOnRepo' auth user repo =- executeRequestMaybe auth $ labelsOnRepoR user repo FetchAll- -- | List all labels for this repository. -- See <https://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository> labelsOnRepoR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector IssueLabel) labelsOnRepoR user repo = pagedQuery ["repos", toPathPart user, toPathPart repo, "labels"] [] --- | A label by name.------ > label "thoughtbot" "paperclip" "bug"-label :: Name Owner -> Name Repo -> Name IssueLabel -> IO (Either Error IssueLabel)-label = label' Nothing---- | A label by name using authentication.------ > label' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" "bug"-label' :: Maybe Auth -> Name Owner -> Name Repo -> Name IssueLabel -> IO (Either Error IssueLabel)-label' auth user repo lbl =- executeRequestMaybe auth $ labelR user repo lbl- -- | Query a single label. -- See <https://developer.github.com/v3/issues/labels/#get-a-single-label> labelR :: Name Owner -> Name Repo -> Name IssueLabel -> Request k IssueLabel labelR user repo lbl = query ["repos", toPathPart user, toPathPart repo, "labels", toPathPart lbl] [] --- | Create a label------ > createLabel (BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" "bug" "f29513"-createLabel :: Auth -> Name Owner -> Name Repo -> Name IssueLabel -> String -> IO (Either Error IssueLabel)-createLabel auth user repo lbl color =- executeRequest auth $ createLabelR user repo lbl color- -- | Create a label. -- See <https://developer.github.com/v3/issues/labels/#create-a-label>-createLabelR :: Name Owner -> Name Repo -> Name IssueLabel -> String -> Request 'RW IssueLabel-createLabelR user repo lbl color =- command Post paths $ encode body- where- paths = ["repos", toPathPart user, toPathPart repo, "labels"]- body = object ["name" .= untagName lbl, "color" .= color]---- | Update a label------ > updateLabel (BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" "bug" "new-bug" "ff1111"-updateLabel :: Auth- -> Name Owner- -> Name Repo- -> Name IssueLabel -- ^ old label name- -> Name IssueLabel -- ^ new label name- -> String -- ^ new color- -> IO (Either Error IssueLabel)-updateLabel auth user repo oldLbl newLbl color =- executeRequest auth $ updateLabelR user repo oldLbl newLbl color+createLabelR :: Name Owner -> Name Repo -> NewIssueLabel -> Request 'RW IssueLabel+createLabelR user repo =+ command Post ["repos", toPathPart user, toPathPart repo, "labels"] . encode -- | Update a label. -- See <https://developer.github.com/v3/issues/labels/#update-a-label> updateLabelR :: Name Owner -> Name Repo -> Name IssueLabel -- ^ old label name- -> Name IssueLabel -- ^ new label name- -> String -- ^ new color+ -> UpdateIssueLabel -- ^ new label -> Request 'RW IssueLabel-updateLabelR user repo oldLbl newLbl color =- command Patch paths (encode body)- where- paths = ["repos", toPathPart user, toPathPart repo, "labels", toPathPart oldLbl]- body = object ["name" .= untagName newLbl, "color" .= color]---- | Delete a label------ > deleteLabel (BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" "bug"-deleteLabel :: Auth -> Name Owner -> Name Repo -> Name IssueLabel -> IO (Either Error ())-deleteLabel auth user repo lbl =- executeRequest auth $ deleteLabelR user repo lbl+updateLabelR user repo oldLbl =+ command Patch ["repos", toPathPart user, toPathPart repo, "labels", toPathPart oldLbl] . encode -- | Delete a label. -- See <https://developer.github.com/v3/issues/labels/#delete-a-label>@@ -134,38 +55,12 @@ deleteLabelR user repo lbl = Command Delete ["repos", toPathPart user, toPathPart repo, "labels", toPathPart lbl] mempty --- | The labels on an issue in a repo.------ > labelsOnIssue "thoughtbot" "paperclip" 585-labelsOnIssue :: Name Owner -> Name Repo -> Id Issue -> IO (Either Error (Vector IssueLabel))-labelsOnIssue = labelsOnIssue' Nothing---- | The labels on an issue in a repo using authentication.------ > labelsOnIssue' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" (Id 585)-labelsOnIssue' :: Maybe Auth -> Name Owner -> Name Repo -> Id Issue -> IO (Either Error (Vector IssueLabel))-labelsOnIssue' auth user repo iid =- executeRequestMaybe auth $ labelsOnIssueR user repo iid FetchAll- -- | List labels on an issue. -- See <https://developer.github.com/v3/issues/labels/#list-labels-on-an-issue> labelsOnIssueR :: Name Owner -> Name Repo -> Id Issue -> FetchCount -> Request k (Vector IssueLabel) labelsOnIssueR user repo iid = pagedQuery ["repos", toPathPart user, toPathPart repo, "issues", toPathPart iid, "labels"] [] --- | Add labels to an issue.------ > addLabelsToIssue (BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" (Id 585) ["Label1" "Label2"]-addLabelsToIssue :: Foldable f- => Auth- -> Name Owner- -> Name Repo- -> Id Issue- -> f (Name IssueLabel)- -> IO (Either Error (Vector IssueLabel))-addLabelsToIssue auth user repo iid lbls =- executeRequest auth $ addLabelsToIssueR user repo iid lbls- -- | Add lables to an issue. -- See <https://developer.github.com/v3/issues/labels/#add-labels-to-an-issue> addLabelsToIssueR :: Foldable f@@ -180,31 +75,11 @@ paths = ["repos", toPathPart user, toPathPart repo, "issues", toPathPart iid, "labels"] -- | Remove a label from an issue.------ > removeLabelFromIssue (BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" (Id 585) "bug"-removeLabelFromIssue :: Auth -> Name Owner -> Name Repo -> Id Issue -> Name IssueLabel -> IO (Either Error ())-removeLabelFromIssue auth user repo iid lbl =- executeRequest auth $ removeLabelFromIssueR user repo iid lbl---- | Remove a label from an issue. -- See <https://developer.github.com/v3/issues/labels/#remove-a-label-from-an-issue> removeLabelFromIssueR :: Name Owner -> Name Repo -> Id Issue -> Name IssueLabel -> GenRequest 'MtUnit 'RW () removeLabelFromIssueR user repo iid lbl = Command Delete ["repos", toPathPart user, toPathPart repo, "issues", toPathPart iid, "labels", toPathPart lbl] mempty --- | Replace all labels on an issue. Sending an empty list will remove all labels from the issue.------ > replaceAllLabelsForIssue (BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" (Id 585) ["Label1" "Label2"]-replaceAllLabelsForIssue :: Foldable f- => Auth- -> Name Owner- -> Name Repo- -> Id Issue- -> f (Name IssueLabel)- -> IO (Either Error (Vector IssueLabel))-replaceAllLabelsForIssue auth user repo iid lbls =- executeRequest auth $ replaceAllLabelsForIssueR user repo iid lbls- -- | Replace all labels on an issue. -- See <https://developer.github.com/v3/issues/labels/#replace-all-labels-for-an-issue> --@@ -221,30 +96,10 @@ paths = ["repos", toPathPart user, toPathPart repo, "issues", toPathPart iid, "labels"] -- | Remove all labels from an issue.------ > removeAllLabelsFromIssue (BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" (Id 585)-removeAllLabelsFromIssue :: Auth -> Name Owner -> Name Repo -> Id Issue -> IO (Either Error ())-removeAllLabelsFromIssue auth user repo iid =- executeRequest auth $ removeAllLabelsFromIssueR user repo iid---- | Remove all labels from an issue. -- See <https://developer.github.com/v3/issues/labels/#remove-all-labels-from-an-issue> removeAllLabelsFromIssueR :: Name Owner -> Name Repo -> Id Issue -> GenRequest 'MtUnit 'RW () removeAllLabelsFromIssueR user repo iid = Command Delete ["repos", toPathPart user, toPathPart repo, "issues", toPathPart iid, "labels"] mempty---- | All the labels on a repo's milestone given the milestone ID.------ > labelsOnMilestone "thoughtbot" "paperclip" (Id 2)-labelsOnMilestone :: Name Owner -> Name Repo -> Id Milestone -> IO (Either Error (Vector IssueLabel))-labelsOnMilestone = labelsOnMilestone' Nothing---- | All the labels on a repo's milestone given the milestone ID using authentication.------ > labelsOnMilestone' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" (Id 2)-labelsOnMilestone' :: Maybe Auth -> Name Owner -> Name Repo -> Id Milestone -> IO (Either Error (Vector IssueLabel))-labelsOnMilestone' auth user repo mid =- executeRequestMaybe auth $ labelsOnMilestoneR user repo mid FetchAll -- | Query labels for every issue in a milestone. -- See <https://developer.github.com/v3/issues/labels/#get-labels-for-every-issue-in-a-milestone>
src/GitHub/Endpoints/Issues/Milestones.hs view
@@ -1,82 +1,43 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The milestones API as described on -- <http://developer.github.com/v3/issues/milestones/>.+ module GitHub.Endpoints.Issues.Milestones (- milestones,- milestones', milestonesR,- milestone, milestoneR,- createMilestone, createMilestoneR,- updateMilestone, updateMilestoneR,- deleteMilestone, deleteMilestoneR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () --- | All milestones in the repo.------ > milestones "thoughtbot" "paperclip"-milestones :: Name Owner -> Name Repo -> IO (Either Error (Vector Milestone))-milestones = milestones' Nothing---- | All milestones in the repo, using authentication.------ > milestones' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip"-milestones' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector Milestone))-milestones' auth user repo =- executeRequestMaybe auth $ milestonesR user repo FetchAll- -- | List milestones for a repository. -- See <https://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository> milestonesR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector Milestone) milestonesR user repo = pagedQuery ["repos", toPathPart user, toPathPart repo, "milestones"] [] --- | Details on a specific milestone, given it's milestone number.------ > milestone "thoughtbot" "paperclip" (Id 2)-milestone :: Name Owner -> Name Repo -> Id Milestone -> IO (Either Error Milestone)-milestone user repo mid =- executeRequest' $ milestoneR user repo mid- -- | Query a single milestone. -- See <https://developer.github.com/v3/issues/milestones/#get-a-single-milestone> milestoneR :: Name Owner -> Name Repo -> Id Milestone -> Request k Milestone milestoneR user repo mid = query ["repos", toPathPart user, toPathPart repo, "milestones", toPathPart mid] [] -createMilestone :: Auth -> Name Owner -> Name Repo -> NewMilestone -> IO (Either Error Milestone)-createMilestone auth user repo mlstn = executeRequest auth $ createMilestoneR user repo mlstn- -- | Create a milestone. -- See <https://developer.github.com/v3/issues/milestones/#create-a-milestone> createMilestoneR :: Name Owner -> Name Repo -> NewMilestone -> Request 'RW Milestone createMilestoneR user repo = command Post ["repos", toPathPart user, toPathPart repo, "milestones"] . encode -updateMilestone :: Auth -> Name Owner -> Name Repo -> Id Milestone -> UpdateMilestone -> IO (Either Error Milestone)-updateMilestone auth user repo mid mlstn = executeRequest auth $ updateMilestoneR user repo mid mlstn- -- | Update a milestone. -- See <https://developer.github.com/v3/issues/milestones/#update-a-milestone> updateMilestoneR :: Name Owner -> Name Repo -> Id Milestone -> UpdateMilestone -> Request 'RW Milestone updateMilestoneR user repo mid = command Patch ["repos", toPathPart user, toPathPart repo, "milestones", toPathPart mid ] . encode--deleteMilestone :: Auth -> Name Owner -> Name Repo -> Id Milestone -> IO (Either Error ())-deleteMilestone auth user repo mid = executeRequest auth $ deleteMilestoneR user repo mid -- | Delete a milestone. -- See <https://developer.github.com/v3/issues/milestones/#delete-a-milestone>
src/GitHub/Endpoints/Organizations.hs view
@@ -1,15 +1,8 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The orgs API as described on <http://developer.github.com/v3/orgs/>.+ module GitHub.Endpoints.Organizations (- publicOrganizationsFor,- publicOrganizationsFor', publicOrganizationsForR,- publicOrganization,- publicOrganization', publicOrganizationR, organizationsR, module GitHub.Data,@@ -17,22 +10,8 @@ import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () --- | The public organizations for a user, given the user's login, with authorization------ > publicOrganizationsFor' (Just $ BasicAuth "github-username" "github-password") "mike-burns"-publicOrganizationsFor' :: Maybe Auth -> Name User -> IO (Either Error (Vector SimpleOrganization))-publicOrganizationsFor' auth org =- executeRequestMaybe auth $ publicOrganizationsForR org FetchAll---- | List user organizations. The public organizations for a user, given the user's login.------ > publicOrganizationsFor "mike-burns"-publicOrganizationsFor :: Name User -> IO (Either Error (Vector SimpleOrganization))-publicOrganizationsFor = publicOrganizationsFor' Nothing- -- | List all user organizations. -- See <https://developer.github.com/v3/orgs/#list-your-organizations> organizationsR :: FetchCount -> Request k (Vector SimpleOrganization)@@ -42,18 +21,6 @@ -- See <https://developer.github.com/v3/orgs/#list-user-organizations> publicOrganizationsForR :: Name User -> FetchCount -> Request k (Vector SimpleOrganization) publicOrganizationsForR user = pagedQuery ["users", toPathPart user, "orgs"] []---- | Details on a public organization. Takes the organization's login.------ > publicOrganization' (Just $ BasicAuth "github-username" "github-password") "thoughtbot"-publicOrganization' :: Maybe Auth -> Name Organization -> IO (Either Error Organization)-publicOrganization' auth = executeRequestMaybe auth . publicOrganizationR---- | Query an organization. Details on a public organization. Takes the organization's login.------ > publicOrganization "thoughtbot"-publicOrganization :: Name Organization -> IO (Either Error Organization)-publicOrganization = publicOrganization' Nothing -- | Query an organization. -- See <https://developer.github.com/v3/orgs/#get-an-organization>
src/GitHub/Endpoints/Organizations/Members.hs view
@@ -1,42 +1,20 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The organization members API as described on -- <http://developer.github.com/v3/orgs/members/>.+ module GitHub.Endpoints.Organizations.Members (- membersOf,- membersOf', membersOfR, membersOfWithR,- isMemberOf,- isMemberOf', isMemberOfR, orgInvitationsR,+ orgMembershipR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () --- | All the users who are members of the specified organization,--- | with or without authentication.------ > membersOf' (Just $ OAuth "token") "thoughtbot"-membersOf' :: Maybe Auth -> Name Organization -> IO (Either Error (Vector SimpleUser))-membersOf' auth org =- executeRequestMaybe auth $ membersOfR org FetchAll---- | All the users who are members of the specified organization,--- | without authentication.------ > membersOf "thoughtbot"-membersOf :: Name Organization -> IO (Either Error (Vector SimpleUser))-membersOf = membersOf' Nothing- -- | All the users who are members of the specified organization. -- -- See <https://developer.github.com/v3/orgs/members/#members-list>@@ -59,21 +37,6 @@ OrgMemberRoleAdmin -> "admin" OrgMemberRoleMember -> "member" --- | Check if a user is a member of an organization,--- | with or without authentication.------ > isMemberOf' (Just $ OAuth "token") "phadej" "haskell-infra"-isMemberOf' :: Maybe Auth -> Name User -> Name Organization -> IO (Either Error Bool)-isMemberOf' auth user org =- executeRequestMaybe auth $ isMemberOfR user org---- | Check if a user is a member of an organization,--- | without authentication.------ > isMemberOf "phadej" "haskell-infra"-isMemberOf :: Name User -> Name Organization -> IO (Either Error Bool)-isMemberOf = isMemberOf' Nothing- -- | Check if a user is a member of an organization. -- -- See <https://developer.github.com/v3/orgs/members/#check-membership>@@ -86,3 +49,10 @@ -- See <https://developer.github.com/v3/orgs/members/#list-pending-organization-invitations> orgInvitationsR :: Name Organization -> FetchCount -> Request 'RA (Vector Invitation) orgInvitationsR org = pagedQuery ["orgs", toPathPart org, "invitations"] []++-- | Get user membership information in an organization+--+-- See <https://docs.github.com/en/rest/orgs/members#get-organization-membership-for-a-user>+orgMembershipR :: Name User -> Name Organization -> Request 'RA Membership+orgMembershipR user org =+ Query [ "orgs", toPathPart org, "memberships", toPathPart user ] []
+ src/GitHub/Endpoints/Organizations/OutsideCollaborators.hs view
@@ -0,0 +1,18 @@+-- |+-- The organization members API as described on+-- <https://developer.github.com/v3/orgs/outside_collaborators/>.++module GitHub.Endpoints.Organizations.OutsideCollaborators (+ outsideCollaboratorsR,+ ) where++import GitHub.Data+import GitHub.Internal.Prelude+import Prelude ()++-- | All the users who are outside collaborators of the specified organization.+--+-- See <https://developer.github.com/v3/orgs/outside_collaborators/#list-outside-collaborators>+outsideCollaboratorsR :: Name Organization -> FetchCount -> Request k (Vector SimpleUser)+outsideCollaboratorsR organization =+ pagedQuery ["orgs", toPathPart organization, "outside_collaborators"] []
src/GitHub/Endpoints/Organizations/Teams.hs view
@@ -1,128 +1,52 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The Owner teams API as described on -- <http://developer.github.com/v3/orgs/teams/>.+ module GitHub.Endpoints.Organizations.Teams (- teamsOf,- teamsOf', teamsOfR,- teamInfoFor,- teamInfoFor', teamInfoForR,- createTeamFor', createTeamForR,- editTeam', editTeamR,- deleteTeam', deleteTeamR, listTeamMembersR,- listTeamRepos,- listTeamRepos', listTeamReposR,- addOrUpdateTeamRepo', addOrUpdateTeamRepoR,- teamMembershipInfoFor,- teamMembershipInfoFor', teamMembershipInfoForR,- addTeamMembershipFor', addTeamMembershipForR,- deleteTeamMembershipFor', deleteTeamMembershipForR,- listTeamsCurrent', listTeamsCurrentR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () --- | List teams. List the teams of an Owner.--- When authenticated, lists private teams visible to the authenticated user.--- When unauthenticated, lists only public teams for an Owner.------ > teamsOf' (Just $ OAuth "token") "thoughtbot"-teamsOf' :: Maybe Auth -> Name Organization -> IO (Either Error (Vector SimpleTeam))-teamsOf' auth org =- executeRequestMaybe auth $ teamsOfR org FetchAll---- | List the public teams of an Owner.------ > teamsOf "thoughtbot"-teamsOf :: Name Organization -> IO (Either Error (Vector SimpleTeam))-teamsOf = teamsOf' Nothing- -- | List teams. -- See <https://developer.github.com/v3/orgs/teams/#list-teams> teamsOfR :: Name Organization -> FetchCount -> Request k (Vector SimpleTeam) teamsOfR org = pagedQuery ["orgs", toPathPart org, "teams"] [] --- | The information for a single team, by team id.--- With authentication------ > teamInfoFor' (Just $ OAuth "token") 1010101-teamInfoFor' :: Maybe Auth -> Id Team -> IO (Either Error Team)-teamInfoFor' auth tid =- executeRequestMaybe auth $ teamInfoForR tid---- | The information for a single team, by team id.------ > teamInfoFor' (Just $ OAuth "token") 1010101-teamInfoFor :: Id Team -> IO (Either Error Team)-teamInfoFor = teamInfoFor' Nothing- -- | Query team. -- See <https://developer.github.com/v3/orgs/teams/#get-team> teamInfoForR :: Id Team -> Request k Team teamInfoForR tid = query ["teams", toPathPart tid] [] --- | Create a team under an Owner------ > createTeamFor' (OAuth "token") "Owner" (CreateTeam "newteamname" "some description" [] PermssionPull)-createTeamFor' :: Auth- -> Name Organization- -> CreateTeam- -> IO (Either Error Team)-createTeamFor' auth org cteam =- executeRequest auth $ createTeamForR org cteam- -- | Create team. -- See <https://developer.github.com/v3/orgs/teams/#create-team> createTeamForR :: Name Organization -> CreateTeam -> Request 'RW Team createTeamForR org cteam = command Post ["orgs", toPathPart org, "teams"] (encode cteam) --- | Edit a team, by id.------ > editTeamFor'-editTeam' :: Auth- -> Id Team- -> EditTeam- -> IO (Either Error Team)-editTeam' auth tid eteam =- executeRequest auth $ editTeamR tid eteam- -- | Edit team. -- See <https://developer.github.com/v3/orgs/teams/#edit-team> editTeamR :: Id Team -> EditTeam -> Request 'RW Team editTeamR tid eteam = command Patch ["teams", toPathPart tid] (encode eteam) --- | Delete a team, by id. ----- > deleteTeam' (OAuth "token") 1010101-deleteTeam' :: Auth -> Id Team -> IO (Either Error ())-deleteTeam' auth tid =- executeRequest auth $ deleteTeamR tid---- | Delete team.--- -- See <https://developer.github.com/v3/orgs/teams/#delete-team> deleteTeamR :: Id Team -> GenRequest 'MtUnit 'RW () deleteTeamR tid =@@ -140,89 +64,35 @@ TeamMemberRoleMaintainer -> "maintainer" TeamMemberRoleMember -> "member" --- | The repositories of a single team, by team id.--- With authentication------ > listTeamRepos' (Just $ GitHub.OAuth token) (GitHub.mkTeamId team_id)-listTeamRepos' :: Maybe Auth -> Id Team -> IO (Either Error (Vector Repo))-listTeamRepos' auth tid = executeRequestMaybe auth $ listTeamReposR tid FetchAll- -- | Query team repositories. -- See <https://developer.github.com/v3/orgs/teams/#list-team-repos> listTeamReposR :: Id Team -> FetchCount -> Request k (Vector Repo) listTeamReposR tid = pagedQuery ["teams", toPathPart tid, "repos"] [] --- | Retrieve repositories for a team.------ > listTeamRepos (GitHub.mkTeamId team_id)-listTeamRepos :: Id Team -> IO (Either Error (Vector Repo))-listTeamRepos = listTeamRepos' Nothing---- | Add a repository to a team or update the permission on the repository.------ > addOrUpdateTeamRepo' (OAuth "token") 1010101 "mburns" (Just PermissionPull)-addOrUpdateTeamRepo' :: Auth -> Id Team -> Name Organization -> Name Repo -> Permission -> IO (Either Error ())-addOrUpdateTeamRepo' auth tid org repo permission =- executeRequest auth $ addOrUpdateTeamRepoR tid org repo permission- -- | Add or update a team repository. -- See <https://developer.github.com/v3/orgs/teams/#add-or-update-team-repository> addOrUpdateTeamRepoR :: Id Team -> Name Organization -> Name Repo -> Permission -> GenRequest 'MtUnit 'RW () addOrUpdateTeamRepoR tid org repo permission = Command Put ["teams", toPathPart tid, "repos", toPathPart org, toPathPart repo] (encode $ AddTeamRepoPermission permission) --- | Retrieve team mebership information for a user.--- With authentication------ > teamMembershipInfoFor' (Just $ OAuth "token") 1010101 "mburns"-teamMembershipInfoFor' :: Maybe Auth -> Id Team -> Name Owner -> IO (Either Error TeamMembership)-teamMembershipInfoFor' auth tid user =- executeRequestMaybe auth $ teamMembershipInfoForR tid user- -- | Query team membership. -- See <https://developer.github.com/v3/orgs/teams/#get-team-membership teamMembershipInfoForR :: Id Team -> Name Owner -> Request k TeamMembership teamMembershipInfoForR tid user = query ["teams", toPathPart tid, "memberships", toPathPart user] [] --- | Retrieve team mebership information for a user.------ > teamMembershipInfoFor 1010101 "mburns"-teamMembershipInfoFor :: Id Team -> Name Owner -> IO (Either Error TeamMembership)-teamMembershipInfoFor = teamMembershipInfoFor' Nothing---- | Add (or invite) a member to a team.------ > addTeamMembershipFor' (OAuth "token") 1010101 "mburns" RoleMember-addTeamMembershipFor' :: Auth -> Id Team -> Name Owner -> Role -> IO (Either Error TeamMembership)-addTeamMembershipFor' auth tid user role =- executeRequest auth $ addTeamMembershipForR tid user role- -- | Add team membership. -- See <https://developer.github.com/v3/orgs/teams/#add-team-membership> addTeamMembershipForR :: Id Team -> Name Owner -> Role -> Request 'RW TeamMembership addTeamMembershipForR tid user role = command Put ["teams", toPathPart tid, "memberships", toPathPart user] (encode $ CreateTeamMembership role) --- | Delete a member of a team.------ > deleteTeamMembershipFor' (OAuth "token") 1010101 "mburns"-deleteTeamMembershipFor' :: Auth -> Id Team -> Name Owner -> IO (Either Error ())-deleteTeamMembershipFor' auth tid user =- executeRequest auth $ deleteTeamMembershipForR tid user- -- | Remove team membership. -- See <https://developer.github.com/v3/orgs/teams/#remove-team-membership> deleteTeamMembershipForR :: Id Team -> Name Owner -> GenRequest 'MtUnit 'RW () deleteTeamMembershipForR tid user = Command Delete ["teams", toPathPart tid, "memberships", toPathPart user] mempty---- | List teams for current authenticated user------ > listTeamsCurrent' (OAuth "token")-listTeamsCurrent' :: Auth -> IO (Either Error (Vector Team))-listTeamsCurrent' auth = executeRequest auth $ listTeamsCurrentR FetchAll -- | List user teams. -- See <https://developer.github.com/v3/orgs/teams/#list-user-teams>
src/GitHub/Endpoints/PullRequests.hs view
@@ -1,60 +1,26 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The pull requests API as documented at -- <http://developer.github.com/v3/pulls/>.+ module GitHub.Endpoints.PullRequests (- pullRequestsFor,- pullRequestsFor', pullRequestsForR,- pullRequest',- pullRequest, pullRequestR,- pullRequestDiff',- pullRequestDiff, pullRequestDiffR,- pullRequestPatch',- pullRequestPatch, pullRequestPatchR,- createPullRequest, createPullRequestR,- updatePullRequest, updatePullRequestR,- pullRequestCommits',- pullRequestCommitsIO, pullRequestCommitsR,- pullRequestFiles',- pullRequestFiles, pullRequestFilesR,- isPullRequestMerged, isPullRequestMergedR,- mergePullRequest, mergePullRequestR, module GitHub.Data ) where import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () import Data.ByteString.Lazy (ByteString) --- | All open pull requests for the repo, by owner and repo name.------ > pullRequestsFor "rails" "rails"-pullRequestsFor :: Name Owner -> Name Repo -> IO (Either Error (Vector SimplePullRequest))-pullRequestsFor user repo =- executeRequest' $ pullRequestsForR user repo mempty FetchAll---- | All open pull requests for the repo, by owner and repo name.------ > pullRequestsFor "rails" "rails"-pullRequestsFor' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector SimplePullRequest))-pullRequestsFor' auth user repo =- executeRequestMaybe auth $ pullRequestsForR user repo mempty FetchAll- -- | List pull requests. -- See <https://developer.github.com/v3/pulls/#list-pull-requests> pullRequestsForR@@ -67,71 +33,24 @@ ["repos", toPathPart user, toPathPart repo, "pulls"] (prModToQueryString opts) --- | Obtain the diff of a pull request--- See <https://developer.github.com/v3/pulls/#get-a-single-pull-request>-pullRequestDiff' :: Maybe Auth -> Name Owner -> Name Repo -> IssueNumber -> IO (Either Error ByteString)-pullRequestDiff' auth user repo prid =- executeRequestMaybe auth $ pullRequestDiffR user repo prid---- | Obtain the diff of a pull request--- See <https://developer.github.com/v3/pulls/#get-a-single-pull-request>-pullRequestDiff :: Name Owner -> Name Repo -> IssueNumber -> IO (Either Error ByteString)-pullRequestDiff = pullRequestDiff' Nothing- -- | Query a single pull request to obtain the diff -- See <https://developer.github.com/v3/pulls/#get-a-single-pull-request> pullRequestDiffR :: Name Owner -> Name Repo -> IssueNumber -> GenRequest 'MtDiff rw ByteString pullRequestDiffR user repo prid = Query ["repos", toPathPart user, toPathPart repo, "pulls", toPathPart prid] [] --- | Obtain the patch of a pull request------ See <https://developer.github.com/v3/pulls/#get-a-single-pull-request>-pullRequestPatch' :: Maybe Auth -> Name Owner -> Name Repo -> IssueNumber -> IO (Either Error ByteString)-pullRequestPatch' auth user repo prid =- executeRequestMaybe auth $ pullRequestPatchR user repo prid---- | Obtain the patch of a pull request--- See <https://developer.github.com/v3/pulls/#get-a-single-pull-request>-pullRequestPatch :: Name Owner -> Name Repo -> IssueNumber -> IO (Either Error ByteString)-pullRequestPatch = pullRequestPatch' Nothing- -- | Query a single pull request to obtain the patch -- See <https://developer.github.com/v3/pulls/#get-a-single-pull-request> pullRequestPatchR :: Name Owner -> Name Repo -> IssueNumber -> GenRequest 'MtPatch rw ByteString pullRequestPatchR user repo prid = Query ["repos", toPathPart user, toPathPart repo, "pulls", toPathPart prid] [] --- | A detailed pull request, which has much more information. This takes the--- repo owner and name along with the number assigned to the pull request.--- With authentification.------ > pullRequest' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" 562-pullRequest' :: Maybe Auth -> Name Owner -> Name Repo -> IssueNumber -> IO (Either Error PullRequest)-pullRequest' auth user repo prid =- executeRequestMaybe auth $ pullRequestR user repo prid---- | A detailed pull request, which has much more information. This takes the--- repo owner and name along with the number assigned to the pull request.------ > pullRequest "thoughtbot" "paperclip" 562-pullRequest :: Name Owner -> Name Repo -> IssueNumber -> IO (Either Error PullRequest)-pullRequest = pullRequest' Nothing- -- | Query a single pull request. -- See <https://developer.github.com/v3/pulls/#get-a-single-pull-request> pullRequestR :: Name Owner -> Name Repo -> IssueNumber -> Request k PullRequest pullRequestR user repo prid = query ["repos", toPathPart user, toPathPart repo, "pulls", toPathPart prid] [] -createPullRequest :: Auth- -> Name Owner- -> Name Repo- -> CreatePullRequest- -> IO (Either Error PullRequest)-createPullRequest auth user repo cpr =- executeRequest auth $ createPullRequestR user repo cpr- -- | Create a pull request. -- See <https://developer.github.com/v3/pulls/#create-a-pull-request> createPullRequestR :: Name Owner@@ -141,11 +60,6 @@ createPullRequestR user repo cpr = command Post ["repos", toPathPart user, toPathPart repo, "pulls"] (encode cpr) --- | Update a pull request-updatePullRequest :: Auth -> Name Owner -> Name Repo -> IssueNumber -> EditPullRequest -> IO (Either Error PullRequest)-updatePullRequest auth user repo prid epr =- executeRequest auth $ updatePullRequestR user repo prid epr- -- | Update a pull request. -- See <https://developer.github.com/v3/pulls/#update-a-pull-request> updatePullRequestR :: Name Owner@@ -156,66 +70,24 @@ updatePullRequestR user repo prid epr = command Patch ["repos", toPathPart user, toPathPart repo, "pulls", toPathPart prid] (encode epr) --- | All the commits on a pull request, given the repo owner, repo name, and--- the number of the pull request.--- With authentification.------ > pullRequestCommits' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" 688-pullRequestCommits' :: Maybe Auth -> Name Owner -> Name Repo -> IssueNumber -> IO (Either Error (Vector Commit))-pullRequestCommits' auth user repo prid =- executeRequestMaybe auth $ pullRequestCommitsR user repo prid FetchAll---- | All the commits on a pull request, given the repo owner, repo name, and--- the number of the pull request.------ > pullRequestCommits "thoughtbot" "paperclip" 688-pullRequestCommitsIO :: Name Owner -> Name Repo -> IssueNumber -> IO (Either Error (Vector Commit))-pullRequestCommitsIO = pullRequestCommits' Nothing- -- | List commits on a pull request. -- See <https://developer.github.com/v3/pulls/#list-commits-on-a-pull-request> pullRequestCommitsR :: Name Owner -> Name Repo -> IssueNumber -> FetchCount -> Request k (Vector Commit) pullRequestCommitsR user repo prid = pagedQuery ["repos", toPathPart user, toPathPart repo, "pulls", toPathPart prid, "commits"] [] --- | The individual files that a pull request patches. Takes the repo owner and--- name, plus the number assigned to the pull request.--- With authentification.------ > pullRequestFiles' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" 688-pullRequestFiles' :: Maybe Auth -> Name Owner -> Name Repo -> IssueNumber -> IO (Either Error (Vector File))-pullRequestFiles' auth user repo prid =- executeRequestMaybe auth $ pullRequestFilesR user repo prid FetchAll---- | The individual files that a pull request patches. Takes the repo owner and--- name, plus the number assigned to the pull request.------ > pullRequestFiles "thoughtbot" "paperclip" 688-pullRequestFiles :: Name Owner -> Name Repo -> IssueNumber -> IO (Either Error (Vector File))-pullRequestFiles = pullRequestFiles' Nothing- -- | List pull requests files. -- See <https://developer.github.com/v3/pulls/#list-pull-requests-files> pullRequestFilesR :: Name Owner -> Name Repo -> IssueNumber -> FetchCount -> Request k (Vector File) pullRequestFilesR user repo prid = pagedQuery ["repos", toPathPart user, toPathPart repo, "pulls", toPathPart prid, "files"] [] --- | Check if pull request has been merged.-isPullRequestMerged :: Auth -> Name Owner -> Name Repo -> IssueNumber -> IO (Either Error Bool)-isPullRequestMerged auth user repo prid =- executeRequest auth $ isPullRequestMergedR user repo prid- -- | Query if a pull request has been merged. -- See <https://developer.github.com/v3/pulls/#get-if-a-pull-request-has-been-merged> isPullRequestMergedR :: Name Owner -> Name Repo -> IssueNumber -> GenRequest 'MtStatus rw Bool isPullRequestMergedR user repo prid = Query ["repos", toPathPart user, toPathPart repo, "pulls", toPathPart prid, "merge"] [] --- | Merge a pull request.-mergePullRequest :: Auth -> Name Owner -> Name Repo -> IssueNumber -> Maybe Text -> IO (Either Error MergeResult)-mergePullRequest auth user repo prid commitMessage =- executeRequest auth $ mergePullRequestR user repo prid commitMessage- -- | Merge a pull request (Merge Button). -- https://developer.github.com/v3/pulls/#merge-a-pull-request-merge-button mergePullRequestR :: Name Owner -> Name Repo -> IssueNumber -> Maybe Text -> GenRequest 'MtStatus 'RW MergeResult@@ -227,4 +99,3 @@ buildCommitMessageMap :: Maybe Text -> Value buildCommitMessageMap (Just msg) = object ["commit_message" .= msg ] buildCommitMessageMap Nothing = object []-
src/GitHub/Endpoints/PullRequests/Comments.hs view
@@ -1,60 +1,31 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The pull request review comments API as described at -- <http://developer.github.com/v3/pulls/comments/>.+ module GitHub.Endpoints.PullRequests.Comments (- pullRequestCommentsIO, pullRequestCommentsR,- pullRequestComment, pullRequestCommentR,- createPullComment, createPullCommentR,+ createPullCommentReplyR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () --- | All the comments on a pull request with the given ID.------ > pullRequestComments "thoughtbot" "factory_girl" (Id 256)-pullRequestCommentsIO :: Name Owner -> Name Repo -> IssueNumber -> IO (Either Error (Vector Comment))-pullRequestCommentsIO user repo prid =- executeRequest' $ pullRequestCommentsR user repo prid FetchAll- -- | List comments on a pull request. -- See <https://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request> pullRequestCommentsR :: Name Owner -> Name Repo -> IssueNumber -> FetchCount -> Request k (Vector Comment) pullRequestCommentsR user repo prid = pagedQuery ["repos", toPathPart user, toPathPart repo, "pulls", toPathPart prid, "comments"] [] --- | One comment on a pull request, by the comment's ID.------ > pullRequestComment "thoughtbot" "factory_girl" (Id 301819)-pullRequestComment :: Name Owner -> Name Repo -> Id Comment -> IO (Either Error Comment)-pullRequestComment user repo cid =- executeRequest' $ pullRequestCommentR user repo cid- -- | Query a single comment. -- See <https://developer.github.com/v3/pulls/comments/#get-a-single-comment> pullRequestCommentR :: Name Owner -> Name Repo -> Id Comment -> Request k Comment pullRequestCommentR user repo cid = query ["repos", toPathPart user, toPathPart repo, "pulls", "comments", toPathPart cid] [] --- | Create a new comment.------ > createPullComment (BasicAuth "github-username" "github-password") user repo issue commit path position--- > "some words"-createPullComment :: Auth -> Name Owner -> Name Repo -> IssueNumber -> Text -> Text -> Int -> Text- -> IO (Either Error Comment)-createPullComment auth user repo iss commit path position body =- executeRequest auth $ createPullCommentR user repo iss commit path position body- -- | Create a comment. -- -- See <https://developer.github.com/v3/pulls/comments/#create-a-comment>@@ -63,3 +34,13 @@ command Post parts (encode $ NewPullComment commit path position body) where parts = ["repos", toPathPart user, toPathPart repo, "pulls", toPathPart iss, "comments"]++-- | Create a comment reply.+--+-- See <https://developer.github.com/v3/pulls/comments/#create-a-review-comment-reply>+createPullCommentReplyR :: Name Owner -> Name Repo -> IssueNumber -> Id Comment -> Text -> Request 'RW Comment+createPullCommentReplyR user repo iss cid body =+ command Post parts (encode $ PullCommentReply body)+ where+ parts = ["repos", toPathPart user, toPathPart repo, "pulls", toPathPart iss+ , "comments", toPathPart cid, "replies"]
src/GitHub/Endpoints/PullRequests/Reviews.hs view
@@ -1,27 +1,15 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The reviews API as described on <http://developer.github.com/v3/pulls/reviews/>.+ module GitHub.Endpoints.PullRequests.Reviews ( pullRequestReviewsR- , pullRequestReviews- , pullRequestReviews' , pullRequestReviewR- , pullRequestReview- , pullRequestReview' , pullRequestReviewCommentsR- , pullRequestReviewCommentsIO- , pullRequestReviewCommentsIO' , module GitHub.Data ) where import GitHub.Data-import GitHub.Data.Id (Id) import GitHub.Internal.Prelude-import GitHub.Request- (Request, executeRequest', executeRequestMaybe) import Prelude () -- | List reviews for a pull request.@@ -29,7 +17,7 @@ pullRequestReviewsR :: Name Owner -> Name Repo- -> Id PullRequest+ -> IssueNumber -> FetchCount -> Request k (Vector Review) pullRequestReviewsR owner repo prid =@@ -43,37 +31,12 @@ ] [] --- | All reviews for a pull request given the repo owner, repo name and the pull--- request id.------ > pullRequestReviews "thoughtbot" "paperclip" (Id 101)-pullRequestReviews- :: Name Owner- -> Name Repo- -> Id PullRequest- -> IO (Either Error (Vector Review))-pullRequestReviews owner repo prid =- executeRequest' $ pullRequestReviewsR owner repo prid FetchAll---- | All reviews for a pull request given the repo owner, repo name and the pull--- request id. With authentication.------ > pullRequestReviews' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" (Id 101)-pullRequestReviews'- :: Maybe Auth- -> Name Owner- -> Name Repo- -> Id PullRequest- -> IO (Either Error (Vector Review))-pullRequestReviews' auth owner repo pr =- executeRequestMaybe auth $ pullRequestReviewsR owner repo pr FetchAll- -- | Query a single pull request review. -- see <https://developer.github.com/v3/pulls/reviews/#get-a-single-review> pullRequestReviewR :: Name Owner -> Name Repo- -> Id PullRequest+ -> IssueNumber -> Id Review -> Request k Review pullRequestReviewR owner repo prid rid =@@ -88,40 +51,12 @@ ] [] --- | A detailed review on a pull request given the repo owner, repo name, pull--- request id and review id.------ > pullRequestReview "thoughtbot" "factory_girl" (Id 301819) (Id 332)-pullRequestReview- :: Name Owner- -> Name Repo- -> Id PullRequest- -> Id Review- -> IO (Either Error Review)-pullRequestReview owner repo prid rid =- executeRequest' $ pullRequestReviewR owner repo prid rid---- | A detailed review on a pull request given the repo owner, repo name, pull--- request id and review id. With authentication.------ > pullRequestReview' (Just $ BasicAuth "github-username" "github-password")--- > "thoughtbot" "factory_girl" (Id 301819) (Id 332)-pullRequestReview'- :: Maybe Auth- -> Name Owner- -> Name Repo- -> Id PullRequest- -> Id Review- -> IO (Either Error Review)-pullRequestReview' auth owner repo prid rid =- executeRequestMaybe auth $ pullRequestReviewR owner repo prid rid- -- | Query the comments for a single pull request review. -- see <https://developer.github.com/v3/pulls/reviews/#get-comments-for-a-single-review> pullRequestReviewCommentsR :: Name Owner -> Name Repo- -> Id PullRequest+ -> IssueNumber -> Id Review -> Request k [ReviewComment] pullRequestReviewCommentsR owner repo prid rid =@@ -136,30 +71,3 @@ , "comments" ] []---- | All comments for a review on a pull request given the repo owner, repo--- name, pull request id and review id.------ > pullRequestReviewComments "thoughtbot" "factory_girl" (Id 301819) (Id 332)-pullRequestReviewCommentsIO- :: Name Owner- -> Name Repo- -> Id PullRequest- -> Id Review- -> IO (Either Error [ReviewComment])-pullRequestReviewCommentsIO owner repo prid rid =- executeRequest' $ pullRequestReviewCommentsR owner repo prid rid---- | All comments for a review on a pull request given the repo owner, repo--- name, pull request id and review id. With authentication.------ > pullRequestReviewComments' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "factory_girl" (Id 301819) (Id 332)-pullRequestReviewCommentsIO'- :: Maybe Auth- -> Name Owner- -> Name Repo- -> Id PullRequest- -> Id Review- -> IO (Either Error [ReviewComment])-pullRequestReviewCommentsIO' auth owner repo prid rid =- executeRequestMaybe auth $ pullRequestReviewCommentsR owner repo prid rid
src/GitHub/Endpoints/RateLimit.hs view
@@ -1,31 +1,14 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The Github RateLimit API, as described at -- <http://developer.github.com/v3/rate_limit/>.+ module GitHub.Endpoints.RateLimit ( rateLimitR,- rateLimit,- rateLimit', module GitHub.Data, ) where import GitHub.Data-import GitHub.Internal.Prelude-import GitHub.Request import Prelude ()---- | Get your current rate limit status (Note: Accessing this endpoint does not count against your rate limit.)--- With authentication.-rateLimit' :: Maybe Auth -> IO (Either Error RateLimit)-rateLimit' auth = executeRequestMaybe auth rateLimitR---- | Get your current rate limit status (Note: Accessing this endpoint does not count against your rate limit.)--- Without authentication.-rateLimit :: IO (Either Error RateLimit)-rateLimit = rateLimit' Nothing -- | Get your current rate limit status. -- <https://developer.github.com/v3/rate_limit/#get-your-current-rate-limit-status>
+ src/GitHub/Endpoints/Reactions.hs view
@@ -0,0 +1,60 @@+-- |+-- The Reactions API as described at+-- <https://docs.github.com/en/rest/reactions/reactions?apiVersion=2022-11-28>.+module GitHub.Endpoints.Reactions (+ issueReactionsR,+ createIssueReactionR,+ deleteIssueReactionR,+ commentReactionsR,+ createCommentReactionR,+ deleteCommentReactionR,+ module GitHub.Data,+) where++import GitHub.Data+import GitHub.Internal.Prelude+import Prelude ()++-- | List reactions for an issue.+-- See <https://docs.github.com/en/rest/reactions/reactions?apiVersion=2022-11-28#list-reactions-for-an-issue>+issueReactionsR :: Name Owner -> Name Repo -> Id Issue -> FetchCount -> Request k (Vector Reaction)+issueReactionsR owner repo iid =+ pagedQuery ["repos", toPathPart owner, toPathPart repo, "issues", toPathPart iid, "reactions"] []++-- | Create reaction for an issue comment.+-- See <https://docs.github.com/en/rest/reactions/reactions?apiVersion=2022-11-28#create-reaction-for-an-issue>+createIssueReactionR :: Name Owner -> Name Repo -> Id Issue -> ReactionContent -> Request 'RW Reaction+createIssueReactionR owner repo iid content =+ command Post parts (encode $ NewReaction content)+ where+ parts = ["repos", toPathPart owner, toPathPart repo, "issues", toPathPart iid, "reactions"]++-- | Delete an issue comment reaction.+-- See <https://docs.github.com/en/rest/reactions/reactions?apiVersion=2022-11-28#delete-an-issue-reaction>+deleteIssueReactionR :: Name Owner -> Name Repo -> Id Issue -> Id Reaction -> GenRequest 'MtUnit 'RW ()+deleteIssueReactionR owner repo iid rid =+ Command Delete parts mempty+ where+ parts = ["repos", toPathPart owner, toPathPart repo, "issues", toPathPart iid, "reactions", toPathPart rid]++-- | List reactions for an issue comment.+-- See <https://docs.github.com/en/rest/reactions/reactions?apiVersion=2022-11-28#list-reactions-for-an-issue-comment>+commentReactionsR :: Name Owner -> Name Repo -> Id Comment -> FetchCount -> Request k (Vector Reaction)+commentReactionsR owner repo cid =+ pagedQuery ["repos", toPathPart owner, toPathPart repo, "issues", "comments", toPathPart cid, "reactions"] []++-- | Create reaction for an issue comment.+-- See https://docs.github.com/en/rest/reactions/reactions?apiVersion=2022-11-28#create-reaction-for-an-issue-comment+createCommentReactionR :: Name Owner -> Name Repo -> Id Comment -> ReactionContent -> Request 'RW Reaction+createCommentReactionR owner repo cid content =+ command Post parts (encode $ NewReaction content)+ where+ parts = ["repos", toPathPart owner, toPathPart repo, "issues", "comments", toPathPart cid, "reactions"]++-- | Delete an issue comment reaction.+-- See <https://docs.github.com/en/rest/reactions/reactions?apiVersion=2022-11-28#delete-an-issue-comment-reaction>+deleteCommentReactionR :: Name Owner -> Name Repo -> Id Comment -> Id Reaction -> GenRequest 'MtUnit 'RW ()+deleteCommentReactionR owner repo cid rid =+ Command Delete parts mempty+ where+ parts = ["repos", toPathPart owner, toPathPart repo, "issues", "comments", toPathPart cid, "reactions", toPathPart rid]
src/GitHub/Endpoints/Repos.hs view
@@ -1,52 +1,27 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The Github Repos API, as documented at -- <http://developer.github.com/v3/repos/>+ module GitHub.Endpoints.Repos ( -- * Querying repositories- currentUserRepos, currentUserReposR,- userRepos,- userRepos', userReposR,- organizationRepos,- organizationRepos', organizationReposR,- repository,- repository', repositoryR,- contributors,- contributors', contributorsR,- contributorsWithAnonymous,- contributorsWithAnonymous',- languagesFor,- languagesFor', languagesForR,- tagsFor,- tagsFor', tagsForR,- branchesFor,- branchesFor', branchesForR, -- ** Create- createRepo', createRepoR,- createOrganizationRepo', createOrganizationRepoR,- forkExistingRepo', forkExistingRepoR, -- ** Edit- editRepo, editRepoR, -- ** Delete- deleteRepo, deleteRepoR, -- * Data@@ -55,7 +30,6 @@ import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () repoPublicityQueryString :: RepoPublicity -> QueryString@@ -66,65 +40,23 @@ repoPublicityQueryString RepoPublicityPrivate = [("type", Just "private")] -- | List your repositories.-currentUserRepos :: Auth -> RepoPublicity -> IO (Either Error (Vector Repo))-currentUserRepos auth publicity =- executeRequest auth $ currentUserReposR publicity FetchAll---- | List your repositories.--- See <https://developer.github.com/v3/repos/#list-your-repositories>+-- See <https://docs.github.com/en/rest/reference/repos#list-repositories-for-the-authenticated-user> currentUserReposR :: RepoPublicity -> FetchCount -> Request k (Vector Repo) currentUserReposR publicity = pagedQuery ["user", "repos"] qs where qs = repoPublicityQueryString publicity --- | The repos for a user, by their login. Can be restricted to just repos they--- own, are a member of, or publicize. Private repos will return empty list.------ > userRepos "mike-burns" All-userRepos :: Name Owner -> RepoPublicity -> IO (Either Error (Vector Repo))-userRepos = userRepos' Nothing---- | The repos for a user, by their login.--- With authentication.------ > userRepos' (Just $ BasicAuth "github-username" "github-password") "mike-burns" All-userRepos'- :: Maybe Auth- -> Name Owner- -> RepoPublicity- -> IO (Either Error (Vector Repo))-userRepos' auth user publicity =- executeRequestMaybe auth $ userReposR user publicity FetchAll- -- | List user repositories.--- See <https://developer.github.com/v3/repos/#list-user-repositories>+-- See <https://docs.github.com/en/rest/reference/repos#list-repositories-for-a-user> userReposR :: Name Owner -> RepoPublicity -> FetchCount -> Request k(Vector Repo) userReposR user publicity = pagedQuery ["users", toPathPart user, "repos"] qs where qs = repoPublicityQueryString publicity --- | The repos for an organization, by the organization name.------ > organizationRepos "thoughtbot"-organizationRepos :: Name Organization -> IO (Either Error (Vector Repo))-organizationRepos org = organizationRepos' Nothing org RepoPublicityAll---- | The repos for an organization, by the organization name.--- With authentication.------ > organizationRepos (Just $ BasicAuth "github-username" "github-password") "thoughtbot" All-organizationRepos'- :: Maybe Auth- -> Name Organization- -> RepoPublicity- -> IO (Either Error (Vector Repo))-organizationRepos' auth org publicity =- executeRequestMaybe auth $ organizationReposR org publicity FetchAll- -- | List organization repositories.--- See <https://developer.github.com/v3/repos/#list-organization-repositories>+-- See <https://docs.github.com/en/rest/reference/repos#list-organization-repositories> organizationReposR :: Name Organization -> RepoPublicity@@ -135,20 +67,6 @@ where qs = repoPublicityQueryString publicity --- | Details on a specific repo, given the owner and repo name.------ > repository "mike-burns" "github"-repository :: Name Owner -> Name Repo -> IO (Either Error Repo)-repository = repository' Nothing---- | Details on a specific repo, given the owner and repo name.--- With authentication.------ > repository' (Just $ BasicAuth "github-username" "github-password") "mike-burns" "github"-repository' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error Repo)-repository' auth user repo =- executeRequestMaybe auth $ repositoryR user repo- -- | Query single repository. -- See <https://developer.github.com/v3/repos/#get> repositoryR :: Name Owner -> Name Repo -> Request k Repo@@ -156,24 +74,12 @@ query ["repos", toPathPart user, toPathPart repo] [] -- | Create a new repository.------ > createRepo' (BasicAuth (user, password)) (newRepo "some_repo") {newRepoHasIssues = Just False}-createRepo' :: Auth -> NewRepo -> IO (Either Error Repo)-createRepo' auth nrepo =- executeRequest auth $ createRepoR nrepo---- | Create a new repository. -- See <https://developer.github.com/v3/repos/#create> createRepoR :: NewRepo -> Request 'RW Repo createRepoR nrepo = command Post ["user", "repos"] (encode nrepo) -- | Fork an existing repository.-forkExistingRepo' :: Auth -> Name Owner -> Name Repo -> Maybe (Name Owner) -> IO (Either Error Repo)-forkExistingRepo' auth owner repo morg =- executeRequest auth $ forkExistingRepoR owner repo morg---- | Fork an existing repository. -- See <https://developer.github.com/v3/repos/forks/#create-a-fork> -- TODO: The third paramater (an optional Organisation) is not used yet. forkExistingRepoR :: Name Owner -> Name Repo -> Maybe (Name Owner) -> Request 'RW Repo@@ -181,32 +87,12 @@ command Post ["repos", toPathPart owner, toPathPart repo, "forks" ] mempty -- | Create a new repository for an organization.------ > createOrganizationRepo (BasicAuth (user, password)) "thoughtbot" (newRepo "some_repo") {newRepoHasIssues = Just False}-createOrganizationRepo' :: Auth -> Name Organization -> NewRepo -> IO (Either Error Repo)-createOrganizationRepo' auth org nrepo =- executeRequest auth $ createOrganizationRepoR org nrepo---- | Create a new repository for an organization. -- See <https://developer.github.com/v3/repos/#create> createOrganizationRepoR :: Name Organization -> NewRepo -> Request 'RW Repo createOrganizationRepoR org nrepo = command Post ["orgs", toPathPart org, "repos"] (encode nrepo) -- | Edit an existing repository.------ > editRepo (BasicAuth (user, password)) "some_user" "some_repo" def {editDescription = Just "some description"}-editRepo- :: Auth- -> Name Owner -- ^ owner- -> Name Repo -- ^ repository name- -> EditRepo- -> IO (Either Error Repo)-editRepo auth user repo body =- executeRequest auth $ editRepoR user repo body----- | Edit an existing repository. -- See <https://developer.github.com/v3/repos/#edit> editRepoR :: Name Owner -> Name Repo -> EditRepo -> Request 'RW Repo editRepoR user repo body =@@ -215,20 +101,6 @@ -- if no name is given, use curent name b = body {editName = editName body <|> Just repo} --- | The contributors to a repo, given the owner and repo name.------ > contributors "thoughtbot" "paperclip"-contributors :: Name Owner -> Name Repo -> IO (Either Error (Vector Contributor))-contributors = contributors' Nothing---- | The contributors to a repo, given the owner and repo name.--- With authentication.------ > contributors' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip"-contributors' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector Contributor))-contributors' auth user repo =- executeRequestMaybe auth $ contributorsR user repo False FetchAll- -- | List contributors. -- See <https://developer.github.com/v3/repos/#list-contributors> contributorsR@@ -243,92 +115,23 @@ qs | anon = [("anon", Just "true")] | otherwise = [] --- | The contributors to a repo, including anonymous contributors (such as--- deleted users or git commits with unknown email addresses), given the owner--- and repo name.------ > contributorsWithAnonymous "thoughtbot" "paperclip"-contributorsWithAnonymous :: Name Owner -> Name Repo -> IO (Either Error (Vector Contributor))-contributorsWithAnonymous = contributorsWithAnonymous' Nothing---- | The contributors to a repo, including anonymous contributors (such as--- deleted users or git commits with unknown email addresses), given the owner--- and repo name.--- With authentication.------ > contributorsWithAnonymous' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip"-contributorsWithAnonymous' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector Contributor))-contributorsWithAnonymous' auth user repo =- executeRequestMaybe auth $ contributorsR user repo True FetchAll---- | The programming languages used in a repo along with the number of--- characters written in that language. Takes the repo owner and name.------ > languagesFor "mike-burns" "ohlaunch"-languagesFor :: Name Owner -> Name Repo -> IO (Either Error Languages)-languagesFor = languagesFor' Nothing---- | The programming languages used in a repo along with the number of--- characters written in that language. Takes the repo owner and name.--- With authentication.------ > languagesFor' (Just $ BasicAuth "github-username" "github-password") "mike-burns" "ohlaunch"-languagesFor' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error Languages)-languagesFor' auth user repo =- executeRequestMaybe auth $ languagesForR user repo- -- | List languages. -- See <https://developer.github.com/v3/repos/#list-languages> languagesForR :: Name Owner -> Name Repo -> Request k Languages languagesForR user repo = query ["repos", toPathPart user, toPathPart repo, "languages"] [] --- | The git tags on a repo, given the repo owner and name.------ > tagsFor "thoughtbot" "paperclip"-tagsFor :: Name Owner -> Name Repo -> IO (Either Error (Vector Tag))-tagsFor = tagsFor' Nothing---- | The git tags on a repo, given the repo owner and name.--- With authentication.------ > tagsFor' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip"-tagsFor' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector Tag))-tagsFor' auth user repo =- executeRequestMaybe auth $ tagsForR user repo FetchAll- -- | List tags. -- See <https://developer.github.com/v3/repos/#list-tags> tagsForR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector Tag) tagsForR user repo = pagedQuery ["repos", toPathPart user, toPathPart repo, "tags"] [] --- | The git branches on a repo, given the repo owner and name.------ > branchesFor "thoughtbot" "paperclip"-branchesFor :: Name Owner -> Name Repo -> IO (Either Error (Vector Branch))-branchesFor = branchesFor' Nothing---- | The git branches on a repo, given the repo owner and name.--- With authentication.------ > branchesFor' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip"-branchesFor' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector Branch))-branchesFor' auth user repo =- executeRequestMaybe auth $ branchesForR user repo FetchAll- -- | List branches. -- See <https://developer.github.com/v3/repos/#list-branches> branchesForR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector Branch) branchesForR user repo = pagedQuery ["repos", toPathPart user, toPathPart repo, "branches"] []---- | Delete an existing repository.------ > deleteRepo (BasicAuth (user, password)) "thoughtbot" "some_repo"-deleteRepo :: Auth -> Name Owner -> Name Repo -> IO (Either Error ())-deleteRepo auth user repo =- executeRequest auth $ deleteRepoR user repo -- | Delete a repository,. -- See <https://developer.github.com/v3/repos/#delete-a-repository>
src/GitHub/Endpoints/Repos/Collaborators.hs view
@@ -1,57 +1,34 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The repo collaborators API as described on -- <http://developer.github.com/v3/repos/collaborators/>.+ module GitHub.Endpoints.Repos.Collaborators (- collaboratorsOn,- collaboratorsOn', collaboratorsOnR,- isCollaboratorOn,+ collaboratorPermissionOnR, isCollaboratorOnR,- addCollaborator, addCollaboratorR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () --- | All the users who have collaborated on a repo.------ > collaboratorsOn "thoughtbot" "paperclip"-collaboratorsOn :: Name Owner -> Name Repo -> IO (Either Error (Vector SimpleUser))-collaboratorsOn = collaboratorsOn' Nothing---- | All the users who have collaborated on a repo.--- With authentication.-collaboratorsOn' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector SimpleUser))-collaboratorsOn' auth user repo =- executeRequestMaybe auth $ collaboratorsOnR user repo FetchAll- -- | List collaborators. -- See <https://developer.github.com/v3/repos/collaborators/#list-collaborators> collaboratorsOnR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector SimpleUser) collaboratorsOnR user repo = pagedQuery ["repos", toPathPart user, toPathPart repo, "collaborators"] [] --- | Whether the user is collaborating on a repo. Takes the user in question,--- the user who owns the repo, and the repo name.------ > isCollaboratorOn Nothing "mike-burns" "thoughtbot" "paperclip"--- > isCollaboratorOn Nothing "johnson" "thoughtbot" "paperclip"-isCollaboratorOn- :: Maybe Auth- -> Name Owner -- ^ Repository owner+-- | Review a user's permission level.+-- <https://developer.github.com/v3/repos/collaborators/#review-a-users-permission-level>+collaboratorPermissionOnR+ :: Name Owner -- ^ Repository owner -> Name Repo -- ^ Repository name- -> Name User -- ^ Collaborator?- -> IO (Either Error Bool)-isCollaboratorOn auth user repo coll =- executeRequestMaybe auth $ isCollaboratorOnR user repo coll+ -> Name User -- ^ Collaborator to check permissions of.+ -> GenRequest 'MtJSON rw CollaboratorWithPermission+collaboratorPermissionOnR owner repo coll =+ query ["repos", toPathPart owner, toPathPart repo, "collaborators", toPathPart coll, "permission"] [] -- | Check if a user is a collaborator. -- See <https://developer.github.com/v3/repos/collaborators/#check-if-a-user-is-a-collaborator>@@ -62,15 +39,6 @@ -> GenRequest 'MtStatus rw Bool isCollaboratorOnR user repo coll = Query ["repos", toPathPart user, toPathPart repo, "collaborators", toPathPart coll] []--addCollaborator- :: Auth- -> Name Owner -- ^ Repository owner- -> Name Repo -- ^ Repository name- -> Name User -- ^ Collaborator to add- -> IO (Either Error (Maybe RepoInvitation))-addCollaborator auth owner repo coll =- executeRequest auth $ addCollaboratorR owner repo coll -- | Invite a user as a collaborator. -- See <https://developer.github.com/v3/repos/collaborators/#add-user-as-a-collaborator>
src/GitHub/Endpoints/Repos/Comments.hs view
@@ -1,81 +1,29 @@-{-# LANGUAGE CPP #-}------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The repo commits API as described on -- <http://developer.github.com/v3/repos/comments/>.+ module GitHub.Endpoints.Repos.Comments (- commentsFor,- commentsFor', commentsForR,- commitCommentsFor,- commitCommentsFor', commitCommentsForR,- commitCommentFor,- commitCommentFor', commitCommentForR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () --- | All the comments on a Github repo.------ > commentsFor "thoughtbot" "paperclip"-commentsFor :: Name Owner -> Name Repo -> IO (Either Error (Vector Comment))-commentsFor = commentsFor' Nothing---- | All the comments on a Github repo.--- With authentication.------ > commentsFor "thoughtbot" "paperclip"-commentsFor' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector Comment))-commentsFor' auth user repo =- executeRequestMaybe auth $ commentsForR user repo FetchAll- -- | List commit comments for a repository. -- See <https://developer.github.com/v3/repos/comments/#list-commit-comments-for-a-repository> commentsForR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector Comment) commentsForR user repo = pagedQuery ["repos", toPathPart user, toPathPart repo, "comments"] [] --- | Just the comments on a specific SHA for a given Github repo.------ > commitCommentsFor "thoughtbot" "paperclip" "41f685f6e01396936bb8cd98e7cca517e2c7d96b"-commitCommentsFor :: Name Owner -> Name Repo -> Name Commit -> IO (Either Error (Vector Comment))-commitCommentsFor = commitCommentsFor' Nothing---- | Just the comments on a specific SHA for a given Github repo.--- With authentication.------ > commitCommentsFor "thoughtbot" "paperclip" "41f685f6e01396936bb8cd98e7cca517e2c7d96b"-commitCommentsFor' :: Maybe Auth -> Name Owner -> Name Repo -> Name Commit -> IO (Either Error (Vector Comment))-commitCommentsFor' auth user repo sha =- executeRequestMaybe auth $ commitCommentsForR user repo sha FetchAll- -- | List comments for a single commit. -- See <https://developer.github.com/v3/repos/comments/#list-comments-for-a-single-commit> commitCommentsForR :: Name Owner -> Name Repo -> Name Commit -> FetchCount -> Request k (Vector Comment) commitCommentsForR user repo sha = pagedQuery ["repos", toPathPart user, toPathPart repo, "commits", toPathPart sha, "comments"] []---- | A comment, by its ID, relative to the Github repo.------ > commitCommentFor "thoughtbot" "paperclip" "669575"-commitCommentFor :: Name Owner -> Name Repo -> Id Comment -> IO (Either Error Comment)-commitCommentFor = commitCommentFor' Nothing---- | A comment, by its ID, relative to the Github repo.------ > commitCommentFor "thoughtbot" "paperclip" "669575"-commitCommentFor' :: Maybe Auth -> Name Owner -> Name Repo -> Id Comment -> IO (Either Error Comment)-commitCommentFor' auth user repo cid =- executeRequestMaybe auth $ commitCommentForR user repo cid -- | Query a single commit comment. -- See <https://developer.github.com/v3/repos/comments/#get-a-single-commit-comment>
src/GitHub/Endpoints/Repos/Commits.hs view
@@ -1,31 +1,18 @@-{-# LANGUAGE CPP #-}------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The repo commits API as described on -- <http://developer.github.com/v3/repos/commits/>.+ module GitHub.Endpoints.Repos.Commits ( CommitQueryOption(..),- commitsFor,- commitsFor', commitsForR,- commitsWithOptionsFor,- commitsWithOptionsFor', commitsWithOptionsForR,- commit,- commit', commitR,- diff,- diff', diffR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () import qualified Data.ByteString as BS@@ -39,37 +26,11 @@ renderCommitQueryOption (CommitQuerySince date) = ("since", Just $ TE.encodeUtf8 . T.pack $ formatISO8601 date) renderCommitQueryOption (CommitQueryUntil date) = ("until", Just $ TE.encodeUtf8 . T.pack $ formatISO8601 date) --- | The commit history for a repo.------ > commitsFor "mike-burns" "github"-commitsFor :: Name Owner -> Name Repo -> IO (Either Error (Vector Commit))-commitsFor = commitsFor' Nothing---- | The commit history for a repo.--- With authentication.------ > commitsFor' (Just $ BasicAuth "github-username" "github-password") "mike-burns" "github"-commitsFor' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector Commit))-commitsFor' auth user repo =- commitsWithOptionsFor' auth user repo []- -- | List commits on a repository. -- See <https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository> commitsForR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector Commit) commitsForR user repo limit = commitsWithOptionsForR user repo limit [] -commitsWithOptionsFor :: Name Owner -> Name Repo -> [CommitQueryOption] -> IO (Either Error (Vector Commit))-commitsWithOptionsFor = commitsWithOptionsFor' Nothing---- | The commit history for a repo, with commits filtered to satisfy a list of--- query options.--- With authentication.------ > commitsWithOptionsFor' (Just $ BasicAuth "github-username" "github-password") "mike-burns" "github" [CommitQueryAuthor "djeik"]-commitsWithOptionsFor' :: Maybe Auth -> Name Owner -> Name Repo -> [CommitQueryOption] -> IO (Either Error (Vector Commit))-commitsWithOptionsFor' auth user repo opts =- executeRequestMaybe auth $ commitsWithOptionsForR user repo FetchAll opts- -- | List commits on a repository. -- See <https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository> commitsWithOptionsForR :: Name Owner -> Name Repo -> FetchCount -> [CommitQueryOption] -> Request k (Vector Commit)@@ -78,39 +39,11 @@ where qs = map renderCommitQueryOption opts ---- | Details on a specific SHA1 for a repo.------ > commit "mike-burns" "github" "9d1a9a361266c3c890b1108ad2fdf52f824b1b81"-commit :: Name Owner -> Name Repo -> Name Commit -> IO (Either Error Commit)-commit = commit' Nothing---- | Details on a specific SHA1 for a repo.--- With authentication.------ > commit (Just $ BasicAuth "github-username" "github-password") "mike-burns" "github" "9d1a9a361266c3c890b1108ad2fdf52f824b1b81"-commit' :: Maybe Auth -> Name Owner -> Name Repo -> Name Commit -> IO (Either Error Commit)-commit' auth user repo sha =- executeRequestMaybe auth $ commitR user repo sha- -- | Query a single commit. -- See <https://developer.github.com/v3/repos/commits/#get-a-single-commit> commitR :: Name Owner -> Name Repo -> Name Commit -> Request k Commit commitR user repo sha = query ["repos", toPathPart user, toPathPart repo, "commits", toPathPart sha] []---- | The diff between two treeishes on a repo.------ > diff "thoughtbot" "paperclip" "41f685f6e01396936bb8cd98e7cca517e2c7d96b" "HEAD"-diff :: Name Owner -> Name Repo -> Name Commit -> Name Commit -> IO (Either Error Diff)-diff = diff' Nothing---- | The diff between two treeishes on a repo.------ > diff "thoughtbot" "paperclip" "41f685f6e01396936bb8cd98e7cca517e2c7d96b" "HEAD"-diff' :: Maybe Auth -> Name Owner -> Name Repo -> Name Commit -> Name Commit -> IO (Either Error Diff)-diff' auth user repo base headref =- executeRequestMaybe auth $ diffR user repo base headref -- | Compare two commits. -- See <https://developer.github.com/v3/repos/commits/#compare-two-commits>
src/GitHub/Endpoints/Repos/Contents.hs view
@@ -1,32 +1,20 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The Github Repo Contents API, as documented at -- <https://developer.github.com/v3/repos/contents/>+ module GitHub.Endpoints.Repos.Contents ( -- * Querying contents- contentsFor,- contentsFor', contentsForR,- readmeFor,- readmeFor', readmeForR,- archiveFor,- archiveFor', archiveForR, -- ** Create- createFile, createFileR, -- ** Update- updateFile, updateFileR, -- ** Delete- deleteFile, deleteFileR, module GitHub.Data@@ -34,27 +22,12 @@ import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () import Data.Maybe (maybeToList) import qualified Data.Text.Encoding as TE import Network.URI (URI) --- | The contents of a file or directory in a repo, given the repo owner, name, and path to the file------ > contentsFor "thoughtbot" "paperclip" "README.md"-contentsFor :: Name Owner -> Name Repo -> Text -> Maybe Text -> IO (Either Error Content)-contentsFor = contentsFor' Nothing---- | The contents of a file or directory in a repo, given the repo owner, name, and path to the file--- With Authentication------ > contentsFor' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" "README.md" Nothing-contentsFor' :: Maybe Auth -> Name Owner -> Name Repo -> Text -> Maybe Text -> IO (Either Error Content)-contentsFor' auth user repo path ref =- executeRequestMaybe auth $ contentsForR user repo path ref- contentsForR :: Name Owner -> Name Repo@@ -66,38 +39,10 @@ where qs = maybe [] (\r -> [("ref", Just . TE.encodeUtf8 $ r)]) ref --- | The contents of a README file in a repo, given the repo owner and name------ > readmeFor "thoughtbot" "paperclip"-readmeFor :: Name Owner -> Name Repo -> IO (Either Error Content)-readmeFor = readmeFor' Nothing---- | The contents of a README file in a repo, given the repo owner and name--- With Authentication------ > readmeFor' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip"-readmeFor' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error Content)-readmeFor' auth user repo =- executeRequestMaybe auth $ readmeForR user repo- readmeForR :: Name Owner -> Name Repo -> Request k Content readmeForR user repo = query ["repos", toPathPart user, toPathPart repo, "readme"] [] --- | The archive of a repo, given the repo owner, name, and archive type------ > archiveFor "thoughtbot" "paperclip" ArchiveFormatTarball Nothing-archiveFor :: Name Owner -> Name Repo -> ArchiveFormat -> Maybe Text -> IO (Either Error URI)-archiveFor = archiveFor' Nothing---- | The archive of a repo, given the repo owner, name, and archive type--- With Authentication------ > archiveFor' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" ArchiveFormatTarball Nothing-archiveFor' :: Maybe Auth -> Name Owner -> Name Repo -> ArchiveFormat -> Maybe Text -> IO (Either Error URI)-archiveFor' auth user repo path ref =- executeRequestMaybe auth $ archiveForR user repo path ref- -- | Get archive link. -- See <https://developer.github.com/v3/repos/contents/#get-archive-link> archiveForR@@ -111,16 +56,6 @@ path = ["repos", toPathPart user, toPathPart repo, toPathPart format] <> maybeToList ref -- | Create a file.-createFile- :: Auth- -> Name Owner -- ^ owner- -> Name Repo -- ^ repository name- -> CreateFile- -> IO (Either Error ContentResult)-createFile auth user repo body =- executeRequest auth $ createFileR user repo body---- | Create a file. -- See <https://developer.github.com/v3/repos/contents/#create-a-file> createFileR :: Name Owner@@ -131,16 +66,6 @@ command Put ["repos", toPathPart user, toPathPart repo, "contents", createFilePath body] (encode body) -- | Update a file.-updateFile- :: Auth- -> Name Owner -- ^ owner- -> Name Repo -- ^ repository name- -> UpdateFile- -> IO (Either Error ContentResult)-updateFile auth user repo body =- executeRequest auth $ updateFileR user repo body---- | Update a file. -- See <https://developer.github.com/v3/repos/contents/#update-a-file> updateFileR :: Name Owner@@ -149,16 +74,6 @@ -> Request 'RW ContentResult updateFileR user repo body = command Put ["repos", toPathPart user, toPathPart repo, "contents", updateFilePath body] (encode body)---- | Delete a file.-deleteFile- :: Auth- -> Name Owner -- ^ owner- -> Name Repo -- ^ repository name- -> DeleteFile- -> IO (Either Error ())-deleteFile auth user repo body =- executeRequest auth $ deleteFileR user repo body -- | Delete a file. -- See <https://developer.github.com/v3/repos/contents/#delete-a-file>
src/GitHub/Endpoints/Repos/DeployKeys.hs view
@@ -7,61 +7,37 @@ -- <https://developer.github.com/v3/repos/keys> module GitHub.Endpoints.Repos.DeployKeys ( -- * Querying deploy keys- deployKeysFor', deployKeysForR,- deployKeyFor', deployKeyForR, -- ** Create- createRepoDeployKey', createRepoDeployKeyR, -- ** Delete- deleteRepoDeployKey', deleteRepoDeployKeyR, ) where import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () -- | Querying deploy keys.-deployKeysFor' :: Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector RepoDeployKey))-deployKeysFor' auth user repo =- executeRequest auth $ deployKeysForR user repo FetchAll---- | Querying deploy keys. -- See <https://developer.github.com/v3/repos/keys/#list-deploy-keys> deployKeysForR :: Name Owner -> Name Repo -> FetchCount -> Request 'RA (Vector RepoDeployKey) deployKeysForR user repo = pagedQuery ["repos", toPathPart user, toPathPart repo, "keys"] [] --- | Querying a deploy key-deployKeyFor' :: Auth -> Name Owner -> Name Repo -> Id RepoDeployKey -> IO (Either Error RepoDeployKey)-deployKeyFor' auth user repo keyId =- executeRequest auth $ deployKeyForR user repo keyId- -- | Querying a deploy key. -- See <https://developer.github.com/v3/repos/keys/#get-a-deploy-key> deployKeyForR :: Name Owner -> Name Repo -> Id RepoDeployKey -> Request 'RA RepoDeployKey deployKeyForR user repo keyId = query ["repos", toPathPart user, toPathPart repo, "keys", toPathPart keyId] [] --- | Create a deploy key-createRepoDeployKey' :: Auth -> Name Owner -> Name Repo -> NewRepoDeployKey -> IO (Either Error RepoDeployKey)-createRepoDeployKey' auth user repo key =- executeRequest auth $ createRepoDeployKeyR user repo key- -- | Create a deploy key. -- See <https://developer.github.com/v3/repos/keys/#add-a-new-deploy-key>. createRepoDeployKeyR :: Name Owner -> Name Repo -> NewRepoDeployKey -> Request 'RW RepoDeployKey createRepoDeployKeyR user repo key = command Post ["repos", toPathPart user, toPathPart repo, "keys"] (encode key)--deleteRepoDeployKey' :: Auth -> Name Owner -> Name Repo -> Id RepoDeployKey -> IO (Either Error ())-deleteRepoDeployKey' auth user repo keyId =- executeRequest auth $ deleteRepoDeployKeyR user repo keyId -- | Delete a deploy key. -- See <https://developer.github.com/v3/repos/keys/#remove-a-deploy-key>
src/GitHub/Endpoints/Repos/Deployments.hs view
@@ -11,8 +11,6 @@ import Control.Arrow (second) -import Data.Vector (Vector)- import GitHub.Data import GitHub.Internal.Prelude
src/GitHub/Endpoints/Repos/Forks.hs view
@@ -1,35 +1,15 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- Hot forking action, as described at -- <http://developer.github.com/v3/repos/forks/>.+ module GitHub.Endpoints.Repos.Forks (- forksFor,- forksFor', forksForR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude ()---- | All the repos that are forked off the given repo.------ > forksFor "thoughtbot" "paperclip"-forksFor :: Name Owner -> Name Repo -> IO (Either Error (Vector Repo))-forksFor = forksFor' Nothing---- | All the repos that are forked off the given repo.--- | With authentication------ > forksFor' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip"-forksFor' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector Repo))-forksFor' auth user repo =- executeRequestMaybe auth $ forksForR user repo FetchAll -- | List forks. -- See <https://developer.github.com/v3/repos/forks/#list-forks>
src/GitHub/Endpoints/Repos/Invitations.hs view
@@ -1,10 +1,7 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The repo invitations API as described on -- <https://developer.github.com/v3/repos/invitations/>.+ module GitHub.Endpoints.Repos.Invitations ( listInvitationsOnR, listInvitationsForR,
src/GitHub/Endpoints/Repos/Releases.hs view
@@ -1,95 +1,34 @@ -- The Release API, as described at -- <https://developer.github.com/v3/repos/releases/>. module GitHub.Endpoints.Repos.Releases (- releases,- releases', releasesR,- release,- release', releaseR,- latestRelease,- latestRelease', latestReleaseR,- releaseByTagName,- releaseByTagName', releaseByTagNameR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () --- | All releases for the given repo.------ > releases "calleerlandsson" "pick"-releases :: Name Owner -> Name Repo -> IO (Either Error (Vector Release))-releases = releases' Nothing---- | All releases for the given repo with authentication.------ > releases' (Just $ BasicAuth "github-username" "github-password") "calleerlandsson" "pick"-releases' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector Release))-releases' auth user repo =- executeRequestMaybe auth $ releasesR user repo FetchAll- -- | List releases for a repository. -- See <https://developer.github.com/v3/repos/releases/#list-releases-for-a-repository> releasesR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector Release) releasesR user repo = pagedQuery ["repos", toPathPart user, toPathPart repo, "releases"] [] --- | Query a single release.------ > release "calleerlandsson" "pick"-release :: Name Owner -> Name Repo -> Id Release -> IO (Either Error Release)-release = release' Nothing---- | Query a single release with authentication.------ > release' (Just $ BasicAuth "github-username" "github-password") "calleerlandsson" "pick"-release' :: Maybe Auth -> Name Owner -> Name Repo -> Id Release -> IO (Either Error Release)-release' auth user repo reqReleaseId =- executeRequestMaybe auth $ releaseR user repo reqReleaseId- -- | Get a single release. -- See <https://developer.github.com/v3/repos/releases/#get-a-single-release> releaseR :: Name Owner -> Name Repo -> Id Release -> Request k Release releaseR user repo reqReleaseId = query ["repos", toPathPart user, toPathPart repo, "releases", toPathPart reqReleaseId ] [] --- | Query latest release.------ > latestRelease "calleerlandsson" "pick"-latestRelease :: Name Owner -> Name Repo -> IO (Either Error Release)-latestRelease = latestRelease' Nothing---- | Query latest release with authentication.------ > latestRelease' (Just $ BasicAuth "github-username" "github-password") "calleerlandsson" "pick"-latestRelease' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error Release)-latestRelease' auth user repo =- executeRequestMaybe auth $ latestReleaseR user repo- -- | Get the latest release. -- See <https://developer.github.com/v3/repos/releases/#get-the-latest-release> latestReleaseR :: Name Owner -> Name Repo -> Request k Release latestReleaseR user repo = query ["repos", toPathPart user, toPathPart repo, "releases", "latest" ] []---- | Query release by tag name.------ > releaseByTagName "calleerlandsson" "pick"-releaseByTagName :: Name Owner -> Name Repo -> Text -> IO (Either Error Release)-releaseByTagName = releaseByTagName' Nothing---- | Query release by tag name with authentication.------ > releaseByTagName' (Just $ BasicAuth "github-username" "github-password") "calleerlandsson" "pick"-releaseByTagName' :: Maybe Auth -> Name Owner -> Name Repo -> Text -> IO (Either Error Release)-releaseByTagName' auth user repo reqTagName =- executeRequestMaybe auth $ releaseByTagNameR user repo reqTagName -- | Get a release by tag name -- See <https://developer.github.com/v3/repos/releases/#get-a-release-by-tag-name>
src/GitHub/Endpoints/Repos/Statuses.hs view
@@ -1,35 +1,19 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The repo statuses API as described on -- <https://developer.github.com/v3/repos/statuses/>.+ module GitHub.Endpoints.Repos.Statuses (- createStatus, createStatusR,- statusesFor, statusesForR,- statusFor, statusForR, module GitHub.Data ) where import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () -- | Create a new status------ > createStatus (BasicAuth user password) "thoughtbot" "paperclip"--- > "41f685f6e01396936bb8cd98e7cca517e2c7d96b"--- > (NewStatus StatusSuccess Nothing "Looks good!" Nothing)-createStatus :: Auth -> Name Owner -> Name Repo -> Name Commit -> NewStatus -> IO (Either Error Status)-createStatus auth owner repo sha ns =- executeRequest auth $ createStatusR owner repo sha ns---- | Create a new status -- See <https://developer.github.com/v3/repos/statuses/#create-a-status> createStatusR :: Name Owner -> Name Repo -> Name Commit -> NewStatus -> Request 'RW Status createStatusR owner repo sha =@@ -38,26 +22,10 @@ parts = ["repos", toPathPart owner, toPathPart repo, "statuses", toPathPart sha] -- | All statuses for a commit------ > statusesFor (BasicAuth user password) "thoughtbot" "paperclip"--- > "41f685f6e01396936bb8cd98e7cca517e2c7d96b"-statusesFor :: Auth -> Name Owner -> Name Repo -> Name Commit -> IO (Either Error (Vector Status))-statusesFor auth user repo sha =- executeRequest auth $ statusesForR user repo sha FetchAll---- | All statuses for a commit -- See <https://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref> statusesForR :: Name Owner -> Name Repo -> Name Commit -> FetchCount -> Request 'RW (Vector Status) statusesForR user repo sha = pagedQuery ["repos", toPathPart user, toPathPart repo, "commits", toPathPart sha, "statuses"] []---- | The combined status for a specific commit------ > statusFor (BasicAuth user password) "thoughtbot" "paperclip"--- > "41f685f6e01396936bb8cd98e7cca517e2c7d96b"-statusFor :: Auth -> Name Owner -> Name Repo -> Name Commit -> IO (Either Error CombinedStatus)-statusFor auth user repo sha =- executeRequest auth $ statusForR user repo sha -- | The combined status for a specific commit -- See <https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref>
src/GitHub/Endpoints/Repos/Webhooks.hs view
@@ -1,105 +1,64 @@- ----------------------------------------------------------------------------- -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The webhooks API, as described at -- <https://developer.github.com/v3/repos/hooks/> -- <https://developer.github.com/webhooks>+ module GitHub.Endpoints.Repos.Webhooks ( -- * Querying repositories- webhooksFor', webhooksForR,- webhookFor', webhookForR, -- ** Create- createRepoWebhook', createRepoWebhookR, -- ** Edit- editRepoWebhook', editRepoWebhookR, -- ** Test- testPushRepoWebhook', testPushRepoWebhookR,- pingRepoWebhook', pingRepoWebhookR, -- ** Delete- deleteRepoWebhook', deleteRepoWebhookR, ) where import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () -webhooksFor' :: Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector RepoWebhook))-webhooksFor' auth user repo =- executeRequest auth $ webhooksForR user repo FetchAll- -- | List hooks. -- See <https://developer.github.com/v3/repos/hooks/#list-hooks> webhooksForR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector RepoWebhook) webhooksForR user repo = pagedQuery ["repos", toPathPart user, toPathPart repo, "hooks"] []--webhookFor' :: Auth -> Name Owner -> Name Repo -> Id RepoWebhook -> IO (Either Error RepoWebhook)-webhookFor' auth user repo hookId =- executeRequest auth $ webhookForR user repo hookId---- | Query single hook. -- See <https://developer.github.com/v3/repos/hooks/#get-single-hook> webhookForR :: Name Owner -> Name Repo -> Id RepoWebhook -> Request k RepoWebhook webhookForR user repo hookId = query ["repos", toPathPart user, toPathPart repo, "hooks", toPathPart hookId] [] -createRepoWebhook' :: Auth -> Name Owner -> Name Repo -> NewRepoWebhook -> IO (Either Error RepoWebhook)-createRepoWebhook' auth user repo hook =- executeRequest auth $ createRepoWebhookR user repo hook- -- | Create a hook. -- See <https://developer.github.com/v3/repos/hooks/#create-a-hook> createRepoWebhookR :: Name Owner -> Name Repo -> NewRepoWebhook -> Request 'RW RepoWebhook createRepoWebhookR user repo hook = command Post ["repos", toPathPart user, toPathPart repo, "hooks"] (encode hook) -editRepoWebhook' :: Auth -> Name Owner -> Name Repo -> Id RepoWebhook -> EditRepoWebhook -> IO (Either Error RepoWebhook)-editRepoWebhook' auth user repo hookId hookEdit =- executeRequest auth $ editRepoWebhookR user repo hookId hookEdit- -- | Edit a hook. -- See <https://developer.github.com/v3/repos/hooks/#edit-a-hook> editRepoWebhookR :: Name Owner -> Name Repo -> Id RepoWebhook -> EditRepoWebhook -> Request 'RW RepoWebhook editRepoWebhookR user repo hookId hookEdit = command Patch ["repos", toPathPart user, toPathPart repo, "hooks", toPathPart hookId] (encode hookEdit) -testPushRepoWebhook' :: Auth -> Name Owner -> Name Repo -> Id RepoWebhook -> IO (Either Error Bool)-testPushRepoWebhook' auth user repo hookId =- executeRequest auth $ testPushRepoWebhookR user repo hookId- -- | Test a push hook. -- See <https://developer.github.com/v3/repos/hooks/#test-a-push-hook> testPushRepoWebhookR :: Name Owner -> Name Repo -> Id RepoWebhook -> GenRequest 'MtStatus 'RW Bool testPushRepoWebhookR user repo hookId = Command Post (createWebhookOpPath user repo hookId $ Just "tests") (encode ()) -pingRepoWebhook' :: Auth -> Name Owner -> Name Repo -> Id RepoWebhook -> IO (Either Error Bool)-pingRepoWebhook' auth user repo hookId =- executeRequest auth $ pingRepoWebhookR user repo hookId- -- | Ping a hook. -- See <https://developer.github.com/v3/repos/hooks/#ping-a-hook> pingRepoWebhookR :: Name Owner -> Name Repo -> Id RepoWebhook -> GenRequest 'MtStatus 'RW Bool pingRepoWebhookR user repo hookId = Command Post (createWebhookOpPath user repo hookId $ Just "pings") (encode ())--deleteRepoWebhook' :: Auth -> Name Owner -> Name Repo -> Id RepoWebhook -> IO (Either Error ())-deleteRepoWebhook' auth user repo hookId =- executeRequest auth $ deleteRepoWebhookR user repo hookId -- | Delete a hook. -- See <https://developer.github.com/v3/repos/hooks/#delete-a-hook>
src/GitHub/Endpoints/Search.hs view
@@ -1,86 +1,41 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The Github Search API, as described at -- <http://developer.github.com/v3/search/>.+ module GitHub.Endpoints.Search(- searchRepos',- searchRepos, searchReposR,- searchCode',- searchCode, searchCodeR,- searchIssues',- searchIssues, searchIssuesR,+ searchUsersR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () import qualified Data.Text.Encoding as TE --- | Perform a repository search.--- With authentication.------ > searchRepos' (Just $ BasicAuth "github-username" "github-password') "a in%3Aname language%3Ahaskell created%3A>2013-10-01&per_page=100"-searchRepos' :: Maybe Auth -> Text -> IO (Either Error (SearchResult Repo))-searchRepos' auth = executeRequestMaybe auth . searchReposR---- | Perform a repository search.--- Without authentication.------ > searchRepos "q=a in%3Aname language%3Ahaskell created%3A>2013-10-01&per_page=100"-searchRepos :: Text -> IO (Either Error (SearchResult Repo))-searchRepos = searchRepos' Nothing- -- | Search repositories. -- See <https://developer.github.com/v3/search/#search-repositories>-searchReposR :: Text -> Request k (SearchResult Repo)+searchReposR :: Text -> FetchCount -> Request k (SearchResult Repo) searchReposR searchString =- query ["search", "repositories"] [("q", Just $ TE.encodeUtf8 searchString)]---- | Perform a code search.--- With authentication.------ > searchCode' (Just $ BasicAuth "github-username" "github-password') "a in%3Aname language%3Ahaskell created%3A>2013-10-01&per_page=100"-searchCode' :: Maybe Auth -> Text -> IO (Either Error (SearchResult Code))-searchCode' auth = executeRequestMaybe auth . searchCodeR---- | Perform a code search.--- Without authentication.------ > searchCode "q=addClass+in:file+language:js+repo:jquery/jquery"-searchCode :: Text -> IO (Either Error (SearchResult Code))-searchCode = searchCode' Nothing+ PagedQuery ["search", "repositories"] [("q", Just $ TE.encodeUtf8 searchString)] -- | Search code. -- See <https://developer.github.com/v3/search/#search-code>-searchCodeR :: Text -> Request k (SearchResult Code)+searchCodeR :: Text -> FetchCount -> Request k (SearchResult Code) searchCodeR searchString =- query ["search", "code"] [("q", Just $ TE.encodeUtf8 searchString)]---- | Perform an issue search.--- With authentication.------ > searchIssues' (Just $ BasicAuth "github-username" "github-password') "a repo%3Aphadej%2Fgithub&per_page=100"-searchIssues' :: Maybe Auth -> Text -> IO (Either Error (SearchResult Issue))-searchIssues' auth = executeRequestMaybe auth . searchIssuesR---- | Perform an issue search.--- Without authentication.------ > searchIssues "q=a repo%3Aphadej%2Fgithub&per_page=100"-searchIssues :: Text -> IO (Either Error (SearchResult Issue))-searchIssues = searchIssues' Nothing+ PagedQuery ["search", "code"] [("q", Just $ TE.encodeUtf8 searchString)] -- | Search issues. -- See <https://developer.github.com/v3/search/#search-issues>-searchIssuesR :: Text -> Request k (SearchResult Issue)+searchIssuesR :: Text -> FetchCount -> Request k (SearchResult Issue) searchIssuesR searchString =- query ["search", "issues"] [("q", Just $ TE.encodeUtf8 searchString)]+ PagedQuery ["search", "issues"] [("q", Just $ TE.encodeUtf8 searchString)]++-- | Search users.+-- See <https://developer.github.com/v3/search/#search-code>+searchUsersR :: Text -> FetchCount -> Request k (SearchResult SimpleUser)+searchUsersR searchString =+ PagedQuery ["search", "users"] [("q", Just $ TE.encodeUtf8 searchString)]
src/GitHub/Endpoints/Users.hs view
@@ -1,40 +1,26 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The Github Users API, as described at -- <http://developer.github.com/v3/users/>.+ module GitHub.Endpoints.Users (- userInfoFor,- userInfoFor', userInfoForR, ownerInfoForR,- userInfoCurrent', userInfoCurrentR, module GitHub.Data, ) where import GitHub.Data-import GitHub.Internal.Prelude-import GitHub.Request import Prelude () --- | The information for a single user, by login name.--- With authentification------ > userInfoFor' (Just $ BasicAuth "github-username" "github-password") "mike-burns"-userInfoFor' :: Maybe Auth -> Name User -> IO (Either Error User)-userInfoFor' auth = executeRequestMaybe auth . userInfoForR---- | The information for a single user, by login name.------ > userInfoFor "mike-burns"-userInfoFor :: Name User -> IO (Either Error User)-userInfoFor = executeRequest' . userInfoForR- -- | Query a single user. -- See <https://developer.github.com/v3/users/#get-a-single-user>+--+-- >>> github' userInfoForR "mike-burns"+--+-- or+--+-- >>> github userInfoForR (OAuth "github-token") "mike-burns"+-- userInfoForR :: Name User -> Request k User userInfoForR user = query ["users", toPathPart user] [] @@ -42,13 +28,6 @@ -- See <https://developer.github.com/v3/users/#get-a-single-user> ownerInfoForR :: Name Owner -> Request k Owner ownerInfoForR owner = query ["users", toPathPart owner] []---- | Retrieve information about the user associated with the supplied authentication.------ > userInfoCurrent' (OAuth "...")-userInfoCurrent' :: Auth -> IO (Either Error User)-userInfoCurrent' auth =- executeRequest auth $ userInfoCurrentR -- | Query the authenticated user. -- See <https://developer.github.com/v3/users/#get-the-authenticated-user>
src/GitHub/Endpoints/Users/Emails.hs view
@@ -1,42 +1,22 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The user emails API as described on -- <http://developer.github.com/v3/users/emails/>.+ module GitHub.Endpoints.Users.Emails (- currentUserEmails', currentUserEmailsR,- currentUserPublicEmails', currentUserPublicEmailsR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () --- | List email addresses for the authenticated user.------ > currentUserEmails' (OAuth "token")-currentUserEmails' :: Auth -> IO (Either Error (Vector Email))-currentUserEmails' auth =- executeRequest auth $ currentUserEmailsR FetchAll- -- | List email addresses. -- See <https://developer.github.com/v3/users/emails/#list-email-addresses-for-a-user> currentUserEmailsR :: FetchCount -> Request 'RA (Vector Email) currentUserEmailsR = pagedQuery ["user", "emails"] []---- | List public email addresses for the authenticated user.------ > currentUserPublicEmails' (OAuth "token")-currentUserPublicEmails' :: Auth -> IO (Either Error (Vector Email))-currentUserPublicEmails' auth =- executeRequest auth $ currentUserPublicEmailsR FetchAll -- | List public email addresses. -- See <https://developer.github.com/v3/users/emails/#list-public-email-addresses-for-a-user>
src/GitHub/Endpoints/Users/Followers.hs view
@@ -1,13 +1,8 @@------------------------------------------------------------------------------ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- The user followers API as described on -- <http://developer.github.com/v3/users/followers/>.+ module GitHub.Endpoints.Users.Followers (- usersFollowing,- usersFollowedBy, usersFollowingR, usersFollowedByR, module GitHub.Data,@@ -15,28 +10,13 @@ import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () --- | All the users following the given user.------ > usersFollowing "mike-burns"-usersFollowing :: Name User -> IO (Either Error (Vector SimpleUser))-usersFollowing user =- executeRequest' $ usersFollowingR user FetchAll- -- | List followers of a user. -- See <https://developer.github.com/v3/users/followers/#list-followers-of-a-user> usersFollowingR :: Name User -> FetchCount -> Request k (Vector SimpleUser) usersFollowingR user = pagedQuery ["users", toPathPart user, "followers"] []---- | All the users that the given user follows.------ > usersFollowedBy "mike-burns"-usersFollowedBy :: Name User -> IO (Either Error (Vector SimpleUser))-usersFollowedBy user =- executeRequest' $ usersFollowedByR user FetchAll -- | List users followed by another user. -- See <https://developer.github.com/v3/users/followers/#list-users-followed-by-another-user>
src/GitHub/Endpoints/Users/PublicSSHKeys.hs view
@@ -7,74 +7,44 @@ -- <https://developer.github.com/v3/users/keys/> module GitHub.Endpoints.Users.PublicSSHKeys ( -- * Querying public SSH keys- publicSSHKeys', publicSSHKeysR,- publicSSHKeysFor', publicSSHKeysForR,- publicSSHKey', publicSSHKeyR, -- ** Create- createUserPublicSSHKey', createUserPublicSSHKeyR, -- ** Delete- deleteUserPublicSSHKey', deleteUserPublicSSHKeyR, ) where import GitHub.Data import GitHub.Internal.Prelude-import GitHub.Request import Prelude () -- | Querying public SSH keys.-publicSSHKeysFor' :: Name Owner -> IO (Either Error (Vector PublicSSHKeyBasic))-publicSSHKeysFor' user =- executeRequest' $ publicSSHKeysForR user FetchAll---- | Querying public SSH keys. -- See <https://developer.github.com/v3/users/keys/#list-public-keys-for-a-user> publicSSHKeysForR :: Name Owner -> FetchCount -> Request 'RO (Vector PublicSSHKeyBasic) publicSSHKeysForR user = pagedQuery ["users", toPathPart user, "keys"] [] -- | Querying the authenticated users' public SSH keys-publicSSHKeys' :: Auth -> IO (Either Error (Vector PublicSSHKey))-publicSSHKeys' auth =- executeRequest auth publicSSHKeysR---- | Querying the authenticated users' public SSH keys -- See <https://developer.github.com/v3/users/keys/#list-your-public-keys> publicSSHKeysR :: Request 'RA (Vector PublicSSHKey) publicSSHKeysR = query ["user", "keys"] [] --- | Querying a public SSH key-publicSSHKey' :: Auth -> Id PublicSSHKey -> IO (Either Error PublicSSHKey)-publicSSHKey' auth keyId =- executeRequest auth $ publicSSHKeyR keyId- -- | Querying a public SSH key. -- See <https://developer.github.com/v3/users/keys/#get-a-single-public-key> publicSSHKeyR :: Id PublicSSHKey -> Request 'RA PublicSSHKey publicSSHKeyR keyId = query ["user", "keys", toPathPart keyId] [] --- | Create a public SSH key-createUserPublicSSHKey' :: Auth -> NewPublicSSHKey -> IO (Either Error PublicSSHKey)-createUserPublicSSHKey' auth key =- executeRequest auth $ createUserPublicSSHKeyR key- -- | Create a public SSH key. -- See <https://developer.github.com/v3/users/keys/#create-a-public-key>. createUserPublicSSHKeyR :: NewPublicSSHKey -> Request 'RW PublicSSHKey createUserPublicSSHKeyR key = command Post ["user", "keys"] (encode key)--deleteUserPublicSSHKey' :: Auth -> Id PublicSSHKey -> IO (Either Error ())-deleteUserPublicSSHKey' auth keyId =- executeRequest auth $ deleteUserPublicSSHKeyR keyId -- | Delete a public SSH key. -- See <https://developer.github.com/v3/users/keys/#delete-a-public-key>
+ src/GitHub/Enterprise.hs view
@@ -0,0 +1,19 @@+-- |+-- This module re-exports all request constructors and data definitions for+-- working with GitHub Enterprise.++module GitHub.Enterprise (+ -- * Enterprise Admin+ -- | See <https://developer.github.com/enterprise/v3/enterprise-admin/>++ -- ** Organizations+ -- | See <https://developer.github.com/enterprise/v3/enterprise-admin/orgs/>+ createOrganizationR,+ renameOrganizationR,++ -- * Data definitions+ module GitHub.Data.Enterprise,+ ) where++import GitHub.Data.Enterprise+import GitHub.Endpoints.Enterprise.Organizations
src/GitHub/Internal/Prelude.hs view
@@ -1,61 +1,30 @@ {-# LANGUAGE NoImplicitPrelude #-}------------------------------------------------------------------------------+ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- This module may change between minor releases. Do not rely on its contents.-module GitHub.Internal.Prelude (- module Prelude.Compat,- -- * Commonly used types- UTCTime,- HashMap,- Text, pack, unpack,- Vector,- -- * Commonly used typeclasses- Binary,- Data, Typeable,- Generic,- Hashable(..),- IsString(..),- NFData(..), genericRnf,- Semigroup(..),- -- * Aeson- FromJSON(..), ToJSON(..), Value(..), Object,- emptyObject,- encode,- withText, withObject, (.:), (.:?), (.!=), (.=), object, typeMismatch,- -- * Control.Applicative- (<|>),- -- * Data.Maybe- catMaybes,- -- * Data.List- intercalate, toList,- -- * Data.Time.ISO8601- formatISO8601,- ) where -import Control.Applicative ((<|>))-import Control.DeepSeq (NFData (..))-import Control.DeepSeq.Generics (genericRnf)-import Data.Aeson+module GitHub.Internal.Prelude ( module X ) where++import Control.Applicative as X ((<|>))+import Control.DeepSeq as X (NFData (..))+import Data.Aeson as X (FromJSON (..), Object, ToJSON (..), Value (..), encode, object, withObject, withText, (.!=), (.:), (.:?), (.=))-import Data.Aeson.Types (emptyObject, typeMismatch)-import Data.Binary (Binary)-import Data.Binary.Instances ()-import Data.Data (Data, Typeable)-import Data.Foldable (toList)-import Data.Hashable (Hashable (..))-import Data.HashMap.Strict (HashMap)-import Data.List (intercalate)-import Data.Maybe (catMaybes)-import Data.Semigroup (Semigroup (..))-import Data.String (IsString (..))-import Data.Text (Text, pack, unpack)-import Data.Time (UTCTime)-import Data.Time.ISO8601 (formatISO8601)-import Data.Vector (Vector)-import Data.Vector.Instances ()-import GHC.Generics (Generic)-import Prelude.Compat+import Data.Aeson.Types as X (emptyObject, typeMismatch)+import Data.Binary as X (Binary)+import Data.Binary.Instances as X ()+import Data.Data as X (Data)+import Data.Foldable as X (toList)+import Data.Hashable as X (Hashable (..))+import Data.HashMap.Strict as X (HashMap)+import Data.List as X (intercalate)+import Data.Maybe as X (catMaybes)+import Data.Semigroup as X (Semigroup (..))+import Data.String as X (IsString (..))+import Data.Text as X (Text, pack, unpack)+import Data.Time as X (UTCTime)+import Data.Time.ISO8601 as X (formatISO8601)+import Data.Vector as X (Vector)+import GHC.Generics as X (Generic)+import Prelude.Compat as X+import Data.Functor.Compat as X ((<&>))
src/GitHub/Request.hs view
@@ -1,14 +1,13 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE GADTs #-}-{-# LANGUAGE KindSignatures #-}-{-# LANGUAGE MultiParamTypeClasses #-}------------------------------------------------------------------------------+{-# LANGUAGE CPP #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE FunctionalDependencies #-}+{-# LANGUAGE GADTs #-}+{-# LANGUAGE KindSignatures #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE UndecidableInstances #-}+ -- |--- License : BSD-3-Clause--- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>--- -- This module provides data types and helper methods, which makes possible -- to build alternative API request intepreters in addition to provided -- 'IO' functions.@@ -28,7 +27,13 @@ -- > -- | Lift request into Monad -- > githubRequest :: GH.Request 'False a -> GithubMonad a -- > githubRequest = singleton+ module GitHub.Request (+ -- * A convenient execution of requests+ github,+ github',+ GitHubRW,+ GitHubRO, -- * Types Request, GenRequest (..),@@ -39,6 +44,7 @@ -- * Request execution in IO executeRequest, executeRequestWithMgr,+ executeRequestWithMgrAndRes, executeRequest', executeRequestWithMgr', executeRequestMaybe,@@ -48,6 +54,7 @@ ParseResponse (..), makeHttpRequest, parseStatus,+ parsePageLinks, StatusMap, getNextUrl, performPagedRequest,@@ -55,6 +62,11 @@ -- ** Preview PreviewAccept (..), PreviewParseResponse (..),+ -- * SSL+ -- | This always exist, independently of @openssl@ configuration flag.+ -- They change accordingly, to make use of the library simpler.+ withOpenSSL,+ tlsManagerSettings, ) where import GitHub.Internal.Prelude@@ -67,8 +79,8 @@ import Control.Monad.Trans.Class (lift) import Control.Monad.Trans.Except (ExceptT (..), runExceptT) import Data.Aeson (eitherDecode)-import Data.List (find, intercalate)-import Data.String (fromString)+import Data.List (find)+import Data.Maybe (fromMaybe) import Data.Tagged (Tagged (..)) import Data.Version (showVersion) @@ -77,17 +89,17 @@ httpLbs, method, newManager, redirectCount, requestBody, requestHeaders, setQueryString, setRequestIgnoreStatus) import Network.HTTP.Link.Parser (parseLinkHeaderBS)-import Network.HTTP.Link.Types (Link (..), LinkParam (..), href, linkParams)+import Network.HTTP.Link.Types (Link(..), LinkParam (..), href, linkParams) import Network.HTTP.Types (Method, RequestHeaders, Status (..)) import Network.URI (URI, escapeURIString, isUnescapedInURIComponent, parseURIReference, relativeTo) import qualified Data.ByteString as BS+import Data.ByteString.Builder (intDec, toLazyByteString) import qualified Data.ByteString.Lazy as LBS import qualified Data.Text as T import qualified Data.Text.Encoding as TE-import qualified Data.Vector as V import qualified Network.HTTP.Client as HTTP import qualified Network.HTTP.Client.Internal as HTTP @@ -100,13 +112,70 @@ import qualified OpenSSL.X509.SystemStore as SSL #endif -import GitHub.Auth (Auth, AuthMethod, endpoint, setAuthRequest)+import GitHub.Auth (AuthMethod, endpoint, setAuthRequest) import GitHub.Data (Error (..)) import GitHub.Data.PullRequests (MergeResult (..)) import GitHub.Data.Request import Paths_github (version) +-------------------------------------------------------------------------------+-- Convenience+-------------------------------------------------------------------------------++-- | A convenience function to turn functions returning @'Request' rw x@,+-- into functions returning @IO (Either 'Error' x)@.+--+-- >>> :t \auth -> github auth userInfoForR+-- \auth -> github auth userInfoForR+-- :: AuthMethod am => am -> Name User -> IO (Either Error User)+--+-- >>> :t github pullRequestsForR+-- \auth -> github auth pullRequestsForR+-- :: AuthMethod am =>+-- am+-- -> Name Owner+-- -> Name Repo+-- -> PullRequestMod+-- -> FetchCount+-- -> IO (Either Error (Data.Vector.Vector SimplePullRequest))+--+github :: (AuthMethod am, GitHubRW req res) => am -> req -> res+github = githubImpl++-- | Like 'github'' but for 'RO' i.e. read-only requests.+-- Note that GitHub has low request limit for non-authenticated requests.+--+-- >>> :t github' userInfoForR+-- github' userInfoForR :: Name User -> IO (Either Error User)+--+github' :: GitHubRO req res => req -> res+github' = githubImpl'++-- | A type-class implementing 'github'.+class GitHubRW req res | req -> res where+ githubImpl :: AuthMethod am => am -> req -> res++-- | A type-class implementing 'github''.+class GitHubRO req res | req -> res where+ githubImpl' :: req -> res++instance (ParseResponse mt req, res ~ Either Error req) => GitHubRW (GenRequest mt rw req) (IO res) where+ githubImpl = executeRequest++instance (ParseResponse mt req, res ~ Either Error req, rw ~ 'RO) => GitHubRO (GenRequest mt rw req) (IO res) where+ githubImpl' = executeRequest'++instance GitHubRW req res => GitHubRW (a -> req) (a -> res) where+ githubImpl am req x = githubImpl am (req x)++instance GitHubRO req res => GitHubRO (a -> req) (a -> res) where+ githubImpl' req x = githubImpl' (req x)++-------------------------------------------------------------------------------+-- Execution+-------------------------------------------------------------------------------+ #ifdef MIN_VERSION_http_client_tls withOpenSSL :: IO a -> IO a withOpenSSL = id@@ -129,14 +198,10 @@ => am -> GenRequest mt rw a -> IO (Either Error a)-executeRequest auth req = withOpenSSL $ withOpenSSL $ do+executeRequest auth req = withOpenSSL $ do manager <- newManager tlsManagerSettings executeRequestWithMgr manager auth req -lessFetchCount :: Int -> FetchCount -> Bool-lessFetchCount _ FetchAll = True-lessFetchCount i (FetchAtLeast j) = i < fromIntegral j- -- | Like 'executeRequest' but with provided 'Manager'. executeRequestWithMgr :: (AuthMethod am, ParseResponse mt a)@@ -144,26 +209,41 @@ -> am -> GenRequest mt rw a -> IO (Either Error a)-executeRequestWithMgr mgr auth req = runExceptT $ do+executeRequestWithMgr mgr auth req =+ fmap (fmap responseBody) (executeRequestWithMgrAndRes mgr auth req)++-- | Execute request and return the last received 'HTTP.Response'.+--+-- @since 0.24+executeRequestWithMgrAndRes+ :: (AuthMethod am, ParseResponse mt a)+ => Manager+ -> am+ -> GenRequest mt rw a+ -> IO (Either Error (HTTP.Response a))+executeRequestWithMgrAndRes mgr auth req = runExceptT $ do httpReq <- makeHttpRequest (Just auth) req performHttpReq httpReq req where- httpLbs' :: HTTP.Request -> ExceptT Error IO (Response LBS.ByteString)+ httpLbs' :: HTTP.Request -> ExceptT Error IO (HTTP.Response LBS.ByteString) httpLbs' req' = lift (httpLbs req' mgr) `catch` onHttpException - performHttpReq :: forall rw mt b. ParseResponse mt b => HTTP.Request -> GenRequest mt rw b -> ExceptT Error IO b+ performHttpReq :: forall rw mt b. ParseResponse mt b => HTTP.Request -> GenRequest mt rw b -> ExceptT Error IO (HTTP.Response b) performHttpReq httpReq Query {} = do res <- httpLbs' httpReq- unTagged (parseResponse httpReq res :: Tagged mt (ExceptT Error IO b))+ (<$ res) <$> unTagged (parseResponse httpReq res :: Tagged mt (ExceptT Error IO b)) - performHttpReq httpReq (PagedQuery _ _ l) =- unTagged (performPagedRequest httpLbs' predicate httpReq :: Tagged mt (ExceptT Error IO b))- where- predicate v = lessFetchCount (V.length v) l+ performHttpReq httpReq (PagedQuery _ _ (FetchPage _)) = do+ (res, _pageLinks) <- unTagged (performPerPageRequest httpLbs' httpReq :: Tagged mt (ExceptT Error IO (HTTP.Response b, PageLinks)))+ return res+ performHttpReq httpReq (PagedQuery _ _ FetchAll) =+ unTagged (performPagedRequest httpLbs' (const True) httpReq :: Tagged mt (ExceptT Error IO (HTTP.Response b)))+ performHttpReq httpReq (PagedQuery _ _ (FetchAtLeast j)) =+ unTagged (performPagedRequest httpLbs' (\v -> length v < fromIntegral j) httpReq :: Tagged mt (ExceptT Error IO (HTTP.Response b))) performHttpReq httpReq (Command _ _ _) = do res <- httpLbs' httpReq- unTagged (parseResponse httpReq res :: Tagged mt (ExceptT Error IO b))+ (<$ res) <$> unTagged (parseResponse httpReq res :: Tagged mt (ExceptT Error IO b)) -- | Like 'executeRequest' but without authentication. executeRequest' :: ParseResponse mt a => GenRequest mt 'RO a -> IO (Either Error a)@@ -177,21 +257,7 @@ => Manager -> GenRequest mt 'RO a -> IO (Either Error a)-executeRequestWithMgr' mgr req = runExceptT $ do- httpReq <- makeHttpRequest (Nothing :: Maybe Auth) req- performHttpReq httpReq req- where- httpLbs' :: HTTP.Request -> ExceptT Error IO (Response LBS.ByteString)- httpLbs' req' = lift (httpLbs req' mgr) `catch` onHttpException-- performHttpReq :: forall mt b. ParseResponse mt b => HTTP.Request -> GenRequest mt 'RO b -> ExceptT Error IO b- performHttpReq httpReq Query {} = do- res <- httpLbs' httpReq- unTagged (parseResponse httpReq res :: Tagged mt (ExceptT Error IO b))- performHttpReq httpReq (PagedQuery _ _ l) =- unTagged (performPagedRequest httpLbs' predicate httpReq :: Tagged mt (ExceptT Error IO b))- where- predicate v = lessFetchCount (V.length v) l+executeRequestWithMgr' mgr = executeRequestWithMgr mgr () -- | Helper for picking between 'executeRequest' and 'executeRequest''. --@@ -233,9 +299,9 @@ -- | Parse API response. -- -- @--- parseResponse :: 'FromJSON' a => 'Response' 'LBS.ByteString' -> 'Either' 'Error' a+-- parseResponse :: 'FromJSON' a => 'HTTP.Response' 'LBS.ByteString' -> 'Either' 'Error' a -- @-parseResponseJSON :: (FromJSON a, MonadError Error m) => Response LBS.ByteString -> m a+parseResponseJSON :: (FromJSON a, MonadError Error m) => HTTP.Response LBS.ByteString -> m a parseResponseJSON res = case eitherDecode (responseBody res) of Right x -> return x Left err -> throwError . ParseError . T.pack $ err@@ -280,9 +346,9 @@ -- | Helper for handling of 'RequestRedirect'. -- -- @--- parseRedirect :: 'Response' 'LBS.ByteString' -> 'Either' 'Error' a+-- parseRedirect :: 'HTTP.Response' 'LBS.ByteString' -> 'Either' 'Error' a -- @-parseRedirect :: MonadError Error m => URI -> Response LBS.ByteString -> m URI+parseRedirect :: MonadError Error m => URI -> HTTP.Response LBS.ByteString -> m URI parseRedirect originalUri rsp = do let status = responseStatus rsp when (statusCode status /= 302) $@@ -391,7 +457,7 @@ $ setReqHeaders . unTagged (modifyRequest :: Tagged mt (HTTP.Request -> HTTP.Request)) . maybe id setAuthRequest auth- . setQueryString qs+ . setQueryString (qs <> extraQueryItems) $ req PagedQuery paths qs _ -> do req <- parseUrl' $ url paths@@ -399,7 +465,7 @@ $ setReqHeaders . unTagged (modifyRequest :: Tagged mt (HTTP.Request -> HTTP.Request)) . maybe id setAuthRequest auth- . setQueryString qs+ . setQueryString (qs <> extraQueryItems) $ req Command m paths body -> do req <- parseUrl' $ url paths@@ -431,15 +497,23 @@ setBody :: LBS.ByteString -> HTTP.Request -> HTTP.Request setBody body req = req { requestBody = RequestBodyLBS body } + extraQueryItems :: [(BS.ByteString, Maybe BS.ByteString)]+ extraQueryItems = case r of+ PagedQuery _ _ (FetchPage pp) -> catMaybes [+ (\page -> ("page", Just (LBS.toStrict $ toLazyByteString $ intDec page))) <$> pageParamsPage pp+ , (\perPage -> ("per_page", Just (LBS.toStrict $ toLazyByteString $ intDec perPage))) <$> pageParamsPerPage pp+ ]+ _ -> []+ -- | Query @Link@ header with @rel=next@ from the request headers.-getNextUrl :: Response a -> Maybe URI+getNextUrl :: HTTP.Response a -> Maybe URI getNextUrl req = do linkHeader <- lookup "Link" (responseHeaders req) links <- parseLinkHeaderBS linkHeader nextURI <- find isRelNext links return $ href nextURI where- isRelNext :: Link -> Bool+ -- isRelNext :: Link -> Bool or Link uri -> Bool isRelNext = any (== relNextLinkParam) . linkParams relNextLinkParam :: (LinkParam, Text)@@ -447,25 +521,27 @@ -- | Helper for making paginated requests. Responses, @a@ are combined monoidally. --+-- The result is wrapped in the last received 'HTTP.Response'.+-- -- @ -- performPagedRequest :: ('FromJSON' a, 'Semigroup' a)--- => ('HTTP.Request' -> 'ExceptT' 'Error' 'IO' ('Response' 'LBS.ByteString'))+-- => ('HTTP.Request' -> 'ExceptT' 'Error' 'IO' ('HTTP.Response' 'LBS.ByteString')) -- -> (a -> 'Bool') -- -> 'HTTP.Request'--- -> 'ExceptT' 'Error' 'IO' a+-- -> 'ExceptT' 'Error' 'IO' ('HTTP.Response' a) -- @ performPagedRequest :: forall a m mt. (ParseResponse mt a, Semigroup a, MonadCatch m, MonadError Error m)- => (HTTP.Request -> m (Response LBS.ByteString)) -- ^ `httpLbs` analogue- -> (a -> Bool) -- ^ predicate to continue iteration- -> HTTP.Request -- ^ initial request- -> Tagged mt (m a)+ => (HTTP.Request -> m (HTTP.Response LBS.ByteString)) -- ^ `httpLbs` analogue+ -> (a -> Bool) -- ^ predicate to continue iteration+ -> HTTP.Request -- ^ initial request+ -> Tagged mt (m (HTTP.Response a)) performPagedRequest httpLbs' predicate initReq = Tagged $ do res <- httpLbs' initReq m <- unTagged (parseResponse initReq res :: Tagged mt (m a)) go m res initReq where- go :: a -> Response LBS.ByteString -> HTTP.Request -> m a+ go :: a -> HTTP.Response LBS.ByteString -> HTTP.Request -> m (HTTP.Response a) go acc res req = case (predicate acc, getNextUrl res) of (True, Just uri) -> do@@ -473,7 +549,36 @@ res' <- httpLbs' req' m <- unTagged (parseResponse req' res' :: Tagged mt (m a)) go (acc <> m) res' req'- (_, _) -> return acc+ (_, _) -> return (acc <$ res)++-- | Helper for requesting a single page, as specified by 'PageParams'.+--+-- This parses and returns the 'PageLinks' alongside the HTTP response.+performPerPageRequest+ :: forall a m mt. (ParseResponse mt a, MonadCatch m, MonadError Error m)+ => (HTTP.Request -> m (HTTP.Response LBS.ByteString)) -- ^ `httpLbs` analogue+ -> HTTP.Request -- ^ initial request+ -> Tagged mt (m (HTTP.Response a, PageLinks))+performPerPageRequest httpLbs' initReq = Tagged $ do+ res <- httpLbs' initReq+ m <- unTagged (parseResponse initReq res :: Tagged mt (m a))+ return (m <$ res, parsePageLinks res)++-- | Parse the 'PageLinks' from an HTTP response, where the information is+-- encoded in the Link header.+parsePageLinks :: HTTP.Response a -> PageLinks+parsePageLinks res = PageLinks {+ pageLinksPrev = linkToUri <$> find (elem (Rel, "prev") . linkParams) links+ , pageLinksNext = linkToUri <$> find (elem (Rel, "next") . linkParams) links+ , pageLinksLast = linkToUri <$> find (elem (Rel, "last") . linkParams) links+ , pageLinksFirst = linkToUri <$> find (elem (Rel, "first") . linkParams) links+ }+ where+ links :: [Link URI]+ links = fromMaybe [] (lookup "Link" (responseHeaders res) >>= parseLinkHeaderBS)++ linkToUri :: Link URI -> URI+ linkToUri (Link uri _) = uri ------------------------------------------------------------------------------- -- Internal