├── .github └── workflows │ ├── gen-java-docs.yml │ ├── maven-version-determiner.py │ ├── prepare-release.yml │ ├── pullrequest.yml │ ├── release-on-github.yml │ └── release.yml ├── .gitignore ├── .sdkmanrc ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── catalog-info.yaml ├── checkstyle.xml ├── pom.xml ├── spotbugsexclude.xml ├── src ├── main │ └── java │ │ └── com │ │ └── spotify │ │ └── github │ │ ├── CloseTracking.java │ │ ├── GitHubInstant.java │ │ ├── GithubStyle.java │ │ ├── Links.java │ │ ├── Parameters.java │ │ ├── UpdateTracking.java │ │ ├── async │ │ ├── Async.java │ │ └── AsyncPage.java │ │ ├── http │ │ ├── BaseHttpResponse.java │ │ ├── HttpClient.java │ │ ├── HttpRequest.java │ │ ├── HttpResponse.java │ │ ├── Link.java │ │ ├── Pagination.java │ │ └── okhttp │ │ │ ├── OkHttpHttpClient.java │ │ │ └── OkHttpHttpResponse.java │ │ ├── jackson │ │ ├── CommentReactionContentDeserializer.java │ │ ├── CommentReactionContentSerializer.java │ │ ├── GitHubInstantJsonDeserializer.java │ │ ├── GitHubInstantJsonSerializer.java │ │ ├── GithubApiModule.java │ │ └── Json.java │ │ ├── opencensus │ │ ├── OpenCensusSpan.java │ │ └── OpenCensusTracer.java │ │ ├── tracing │ │ ├── BaseTracer.java │ │ ├── NoopTracer.java │ │ ├── Span.java │ │ ├── TraceHelper.java │ │ ├── Tracer.java │ │ ├── opencensus │ │ │ ├── OpenCensusSpan.java │ │ │ └── OpenCensusTracer.java │ │ └── opentelemetry │ │ │ ├── OpenTelemetrySpan.java │ │ │ └── OpenTelemetryTracer.java │ │ └── v3 │ │ ├── ActionState.java │ │ ├── Milestone.java │ │ ├── Team.java │ │ ├── User.java │ │ ├── activity │ │ └── events │ │ │ ├── BaseEvent.java │ │ │ ├── CheckRunEvent.java │ │ │ ├── CommitCommentEvent.java │ │ │ ├── CreateEvent.java │ │ │ ├── DeleteEvent.java │ │ │ ├── DeploymentEvent.java │ │ │ ├── DeploymentStatusEvent.java │ │ │ ├── EventInstallation.java │ │ │ ├── ForkEvent.java │ │ │ ├── IssueCommentEvent.java │ │ │ ├── IssuesEvent.java │ │ │ ├── PullRequestEvent.java │ │ │ ├── PullRequestReviewCommentEvent.java │ │ │ ├── PullRequestReviewEvent.java │ │ │ ├── PushEvent.java │ │ │ ├── RepositoryEvent.java │ │ │ ├── ReviewActionState.java │ │ │ ├── ReviewLinks.java │ │ │ ├── ReviewState.java │ │ │ └── StatusEvent.java │ │ ├── apps │ │ └── InstallationRepositoriesResponse.java │ │ ├── checks │ │ ├── AccessToken.java │ │ ├── Annotation.java │ │ ├── AnnotationLevel.java │ │ ├── App.java │ │ ├── CheckRunAction.java │ │ ├── CheckRunBase.java │ │ ├── CheckRunConclusion.java │ │ ├── CheckRunImage.java │ │ ├── CheckRunOutput.java │ │ ├── CheckRunRequest.java │ │ ├── CheckRunResponse.java │ │ ├── CheckRunResponseList.java │ │ ├── CheckRunStatus.java │ │ ├── CheckSuite.java │ │ ├── CheckSuiteResponseList.java │ │ ├── Installation.java │ │ └── InstallationList.java │ │ ├── clients │ │ ├── ActionsClient.java │ │ ├── ChecksClient.java │ │ ├── GitDataClient.java │ │ ├── GitHubClient.java │ │ ├── GithubAppClient.java │ │ ├── GithubPage.java │ │ ├── GithubPageIterator.java │ │ ├── IssueClient.java │ │ ├── JwtTokenIssuer.java │ │ ├── OrganisationClient.java │ │ ├── PKCS1PEMKey.java │ │ ├── PullRequestClient.java │ │ ├── RepositoryClient.java │ │ ├── SearchClient.java │ │ ├── TeamClient.java │ │ ├── UserClient.java │ │ └── WorkflowsClient.java │ │ ├── comment │ │ ├── Comment.java │ │ ├── CommentReaction.java │ │ └── CommentReactionContent.java │ │ ├── exceptions │ │ ├── DeserializationException.java │ │ ├── GithubException.java │ │ ├── ReadOnlyRepositoryException.java │ │ └── RequestNotOkException.java │ │ ├── git │ │ ├── Author.java │ │ ├── Blob.java │ │ ├── Commit.java │ │ ├── FileItem.java │ │ ├── ParentItem.java │ │ ├── RefType.java │ │ ├── Reference.java │ │ ├── ReferenceObject.java │ │ ├── ShaLink.java │ │ ├── StatItem.java │ │ ├── Tag.java │ │ ├── Tree.java │ │ ├── TreeItem.java │ │ ├── TreeItemType.java │ │ └── Verification.java │ │ ├── hooks │ │ ├── Webhook.java │ │ ├── WebhookConfig.java │ │ └── requests │ │ │ └── WebhookCreate.java │ │ ├── issues │ │ ├── Event.java │ │ ├── Issue.java │ │ ├── IssueActionState.java │ │ ├── Label.java │ │ ├── PullRequest.java │ │ └── changes │ │ │ ├── Body.java │ │ │ └── Changes.java │ │ ├── orgs │ │ ├── Membership.java │ │ ├── OrgMembership.java │ │ ├── TeamInvitation.java │ │ └── requests │ │ │ ├── MembershipCreate.java │ │ │ ├── OrgMembershipCreate.java │ │ │ ├── TeamCreate.java │ │ │ └── TeamUpdate.java │ │ ├── prs │ │ ├── AutoMerge.java │ │ ├── Comment.java │ │ ├── CommentLinks.java │ │ ├── MergeMethod.java │ │ ├── MergeParameters.java │ │ ├── PartialPullRequestItem.java │ │ ├── PullRequest.java │ │ ├── PullRequestActionState.java │ │ ├── PullRequestItem.java │ │ ├── PullRequestLinks.java │ │ ├── PullRequestRef.java │ │ ├── RequestReviewParameters.java │ │ ├── Review.java │ │ ├── ReviewComment.java │ │ ├── ReviewParameters.java │ │ ├── ReviewRequests.java │ │ ├── ReviewState.java │ │ └── requests │ │ │ ├── PullRequestCreate.java │ │ │ ├── PullRequestParameters.java │ │ │ └── PullRequestUpdate.java │ │ ├── repos │ │ ├── Branch.java │ │ ├── BranchProtectionUrlDeserializer.java │ │ ├── Commit.java │ │ ├── CommitComparison.java │ │ ├── CommitItem.java │ │ ├── CommitStatus.java │ │ ├── CommitWithFolderContent.java │ │ ├── Content.java │ │ ├── ContentType.java │ │ ├── Deployment.java │ │ ├── File.java │ │ ├── FolderContent.java │ │ ├── Languages.java │ │ ├── Organization.java │ │ ├── Permissions.java │ │ ├── Protection.java │ │ ├── PushCommit.java │ │ ├── PushRepository.java │ │ ├── Repository.java │ │ ├── RepositoryActionState.java │ │ ├── RepositoryBase.java │ │ ├── RepositoryInvitation.java │ │ ├── RepositoryPermission.java │ │ ├── RequiredStatusChecks.java │ │ ├── Status.java │ │ ├── StatusState.java │ │ └── requests │ │ │ ├── AuthenticatedUserRepositoriesFilter.java │ │ │ ├── FileCreate.java │ │ │ ├── FileUpdate.java │ │ │ ├── RepositoryCreateStatus.java │ │ │ ├── RepositoryDispatch.java │ │ │ └── RepositoryUpdate.java │ │ ├── search │ │ ├── Search.java │ │ ├── SearchIssue.java │ │ ├── SearchIssues.java │ │ ├── SearchRepositories.java │ │ ├── SearchUsers.java │ │ └── requests │ │ │ └── SearchParameters.java │ │ ├── user │ │ └── requests │ │ │ └── SuspensionReason.java │ │ └── workflows │ │ ├── WorkflowsRepositoryResponseList.java │ │ ├── WorkflowsResponse.java │ │ └── WorkflowsState.java └── test │ ├── java │ └── com │ │ └── spotify │ │ └── github │ │ ├── FixtureHelper.java │ │ ├── GitHubInstantTest.java │ │ ├── MockHelper.java │ │ ├── hooks │ │ └── PullRequestEventTest.java │ │ ├── http │ │ ├── HttpRequestTest.java │ │ ├── HttpResponseTest.java │ │ ├── LinkTest.java │ │ └── okhttp │ │ │ └── OkHttpHttpClientTest.java │ │ ├── jackson │ │ ├── Foo.java │ │ └── GitHubInstantModuleTest.java │ │ ├── tracing │ │ ├── OcTestExportHandler.java │ │ ├── OpenCensusSpanTest.java │ │ ├── OpenCensusTracerTest.java │ │ ├── OpenTelemetrySpanTest.java │ │ ├── OpenTelemetryTracerTest.java │ │ └── OtTestExportHandler.java │ │ └── v3 │ │ ├── TeamTest.java │ │ ├── TreeItemTest.java │ │ ├── UserTest.java │ │ ├── activity │ │ └── events │ │ │ ├── CheckRunEventTest.java │ │ │ ├── IssueCommentEventTest.java │ │ │ ├── PullRequestEventTest.java │ │ │ ├── PullRequestReviewCommentEventTest.java │ │ │ ├── PullRequestReviewEventTest.java │ │ │ └── StatusEventTest.java │ │ ├── checks │ │ ├── AccessTokenTest.java │ │ ├── AnnotationTest.java │ │ ├── CheckRunActionTest.java │ │ ├── CheckRunOutputTest.java │ │ └── CheckSuiteTest.java │ │ ├── clients │ │ ├── ChecksClientTest.java │ │ ├── GitDataClientTest.java │ │ ├── GitHubAuthTest.java │ │ ├── GitHubClientTest.java │ │ ├── GithubAppClientTest.java │ │ ├── IssueClientTest.java │ │ ├── JwtTokenIssuerTest.java │ │ ├── OrganisationClientTest.java │ │ ├── PullRequestClientTest.java │ │ ├── RepositoryClientTest.java │ │ ├── SearchClientTest.java │ │ ├── TeamClientTest.java │ │ ├── UserClientTest.java │ │ └── WorkflowsClientTest.java │ │ ├── comment │ │ └── CommentReactionContentTest.java │ │ ├── prs │ │ ├── PullRequestTest.java │ │ ├── RequestReviewParametersTest.java │ │ ├── ReviewParametersTest.java │ │ ├── ReviewRequestsTest.java │ │ ├── ReviewTest.java │ │ └── requests │ │ │ ├── PullRequestCreateTest.java │ │ │ └── PullRequestParametersTest.java │ │ ├── repos │ │ ├── LanguagesTest.java │ │ ├── PushCommitTest.java │ │ ├── RepositoryTest.java │ │ ├── StatusTest.java │ │ └── requests │ │ │ └── RepositoryCreateStatusTest.java │ │ └── search │ │ ├── SearchTest.java │ │ └── requests │ │ └── SearchParametersTest.java │ └── resources │ └── com │ └── spotify │ └── github │ └── v3 │ ├── activity │ └── events │ │ └── fixtures │ │ ├── check_run_event.json │ │ ├── commit_comment_event.json │ │ ├── create_event.json │ │ ├── delete_event.json │ │ ├── deployment_event.json │ │ ├── deployment_status_event.json │ │ ├── fork_event.json │ │ ├── issue_comment_event.json │ │ ├── issues_event.json │ │ ├── pull_request_event.json │ │ ├── pull_request_review_comment_event.json │ │ ├── pull_request_review_event.json │ │ ├── push_event.json │ │ ├── repository_event.json │ │ └── status_event.json │ ├── checks │ ├── access-token.json │ ├── check-suites-response-long-id.json │ ├── check-suites-response.json │ ├── checks-run-completed-long-id-response.json │ ├── checks-run-completed-request.json │ ├── checks-run-completed-response.json │ ├── checks-run-in-progress-request.json │ ├── checks-run-in-progress-response.json │ └── checks-runs-list.json │ ├── clients │ ├── annotated-tag.json │ ├── branch.json │ ├── comment_created.json │ ├── comment_created_long_id.json │ ├── comments_page1.json │ ├── comments_page2.json │ ├── commit.json │ ├── diff.txt │ ├── list_members.json │ ├── list_members_page1.json │ ├── list_members_page2.json │ ├── list_team_invitations.json │ ├── membership.json │ ├── membership_update.json │ ├── membership_update_response.json │ ├── org_membership.json │ ├── patch.txt │ ├── pull_request.json │ ├── pull_request_review_comment_reply.json │ ├── recursive-tree.json │ ├── reference.json │ ├── reference_list.json │ ├── release-tag.json │ ├── repository_invitation.json │ ├── requestedReviews.json │ ├── shalink.json │ ├── statuses_page1.json │ ├── statuses_page2.json │ ├── tag.json │ ├── tags_list.json │ ├── team_get.json │ ├── teams_list.json │ ├── teams_patch.json │ ├── teams_patch_response.json │ ├── teams_request.json │ └── tree.json │ ├── comment │ └── comment.json │ ├── fake-github-app-key.pem │ ├── git │ ├── commit.json │ ├── reference.json │ ├── tree.json │ └── treeItem.json │ ├── github-private-key │ ├── githubapp │ ├── accessible-repositories.json │ ├── installation.json │ ├── installations-list.json │ └── key.pem │ ├── hooks │ ├── requests │ │ ├── create.json │ │ └── pull-request-closed.json │ └── webhook.json │ ├── issues │ └── issue.json │ ├── milestone.json │ ├── prs │ ├── comment.json │ ├── create_review.json │ ├── merge_params_full.json │ ├── pull_request.json │ ├── pull_request_automerge_disabled.json │ ├── pull_request_automerge_enabled.json │ ├── pull_request_item.json │ ├── pull_request_long_id.json │ ├── requests │ │ ├── create.json │ │ └── update.json │ ├── required_reviews.json │ └── review.json │ ├── repos │ ├── branch-escape-chars-url-variation-two.json │ ├── branch-escape-chars.json │ ├── branch-no-protection-fields.json │ ├── branch-not-protected.json │ ├── branch.json │ ├── comment.json │ ├── commit.json │ ├── commit_item.json │ ├── commit_status.json │ ├── compare_commit.json │ ├── content.json │ ├── create-content-repsonse.json │ ├── create-content-request.json │ ├── deployment.json │ ├── fork_create_item.json │ ├── languages.json │ ├── list_branches.json │ ├── list_of_repos_for_authenticated_user.json │ ├── list_of_repos_for_org.json │ ├── merge_commit_item.json │ ├── push_commit.json │ ├── reference.json │ ├── repository.json │ ├── repository_get.json │ ├── repository_invitation.json │ ├── shaLink.json │ ├── status.json │ ├── update-content-repsonse.json │ └── update-content-request.json │ ├── search │ ├── issues-long-id.json │ └── issues.json │ ├── team.json │ ├── treeItem.json │ ├── user.json │ └── workflows │ ├── workflows-get-workflow-response.json │ └── workflows-list-workflows-response.json └── suppressions.xml /.github/workflows/gen-java-docs.yml: -------------------------------------------------------------------------------- 1 | name: Generate Java Docs 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Checkout code 14 | uses: actions/checkout@v2 15 | 16 | - name: Set up JDK 11 17 | uses: actions/setup-java@v4 18 | with: 19 | java-version: 11 20 | distribution: corretto 21 | 22 | - name: Build with Maven 23 | run: mvn clean install 24 | 25 | - name: Generate Javadocs 26 | run: mvn javadoc:javadoc 27 | 28 | # Publishes Javadocs to GitHub Pages by pushing to `gh-pages` branch 29 | - name: Deploy Javadocs to GitHub Pages 30 | run: | 31 | git config --global user.name 'github-actions[bot]' 32 | git config --global user.email 'github-actions[bot]@users.noreply.github.com' 33 | mvn scm-publish:publish-scm 34 | env: 35 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -------------------------------------------------------------------------------- /.github/workflows/pullrequest.yml: -------------------------------------------------------------------------------- 1 | name: maven-build 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - master 7 | # Do not execute only for specific paths if workflow is required. 8 | # https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks 9 | 10 | jobs: 11 | build: 12 | 13 | strategy: 14 | matrix: 15 | os: 16 | - ubuntu-latest 17 | java-version: 18 | - 11 19 | - 17 20 | - 21 21 | 22 | runs-on: ${{ matrix.os }} 23 | 24 | steps: 25 | 26 | - uses: actions/checkout@v4 27 | 28 | - uses: actions/setup-java@v3 29 | with: 30 | java-version: ${{ matrix.java-version }} 31 | distribution: corretto 32 | cache: maven 33 | 34 | - name: Build with Maven 35 | run: > 36 | mvn 37 | --batch-mode 38 | --file pom.xml 39 | -Pcoverage 40 | -Dsytle.colors=always 41 | --errors 42 | package 43 | 44 | - name: Upload coverage to Codecov 45 | uses: codecov/codecov-action@v3 46 | with: 47 | token: ${{ secrets.CODECOV_TOKEN }} 48 | -------------------------------------------------------------------------------- /.github/workflows/release-on-github.yml: -------------------------------------------------------------------------------- 1 | name: github-release 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | tag: 7 | description: Create GitHub release of following tag 8 | required: true 9 | type: string 10 | workflow_call: 11 | inputs: 12 | tag: 13 | required: true 14 | type: string 15 | 16 | jobs: 17 | create-release: 18 | runs-on: ubuntu-latest 19 | steps: 20 | 21 | - name: Create GitHub release 22 | run: | 23 | curl -L \ 24 | -X POST \ 25 | -H "Accept: application/vnd.github+json" \ 26 | -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ 27 | -H "X-GitHub-Api-Version: 2022-11-28" \ 28 | https://api.github.com/repos/spotify/github-java-client/releases \ 29 | -d '{"tag_name":"${{ inputs.tag }}","target_commitish":"master","draft":false,"prerelease":false,"generate_release_notes":true}' -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Artifacts 2 | *.class 3 | 4 | ## Package Files 5 | *.jar 6 | *.war 7 | *.ear 8 | target 9 | 10 | ## IntelliJ 11 | .idea 12 | *.iml 13 | 14 | ## Logs 15 | *.log 16 | 17 | ## Temp 18 | *~ 19 | .#* 20 | 21 | dependency-reduced-pom.xml 22 | .factorypath 23 | .classpath 24 | .project 25 | .settings/ 26 | 27 | # mvn release 28 | pom.xml.releaseBackup 29 | release.properties 30 | 31 | # macOS 32 | .DS_Store -------------------------------------------------------------------------------- /.sdkmanrc: -------------------------------------------------------------------------------- 1 | # Enable auto-env through the sdkman_auto_env config 2 | # Add key=value pairs of SDKs to use below 3 | java=11.0.21-amzn 4 | maven=3.8.6 5 | -------------------------------------------------------------------------------- /catalog-info.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: backstage.io/v1alpha1 2 | kind: Resource 3 | metadata: 4 | name: github-java-client 5 | spec: 6 | type: resource 7 | owner: hotsauce 8 | -------------------------------------------------------------------------------- /spotbugsexclude.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/CloseTracking.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import java.util.Optional; 26 | import org.immutables.value.Value; 27 | 28 | /** 29 | * Convenience interface for tracking closing time and whatever is tracked in {@link 30 | * UpdateTracking}. 31 | */ 32 | @Value.Immutable 33 | @GithubStyle 34 | @JsonSerialize(as = ImmutableCloseTracking.class) 35 | @JsonDeserialize(as = ImmutableCloseTracking.class) 36 | public interface CloseTracking extends UpdateTracking { 37 | 38 | /** 39 | * Closed date. 40 | * 41 | * @return The date when the issue was closed 42 | */ 43 | Optional closedAt(); 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/GithubStyle.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-client 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github; 22 | 23 | import org.immutables.value.Value; 24 | 25 | /** The Immutables Value Style annotations. */ 26 | @Value.Style(jdkOnly = true, forceJacksonPropertyNames = false) 27 | public @interface GithubStyle {} 28 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/UpdateTracking.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import javax.annotation.Nullable; 26 | import org.immutables.value.Value; 27 | 28 | /** Convenience interface for tracking creation and update times */ 29 | @Value.Immutable 30 | @GithubStyle 31 | @JsonSerialize(as = ImmutableUpdateTracking.class) 32 | @JsonDeserialize(as = ImmutableUpdateTracking.class) 33 | public interface UpdateTracking { 34 | 35 | /** 36 | * Created date 37 | * 38 | * @return The date when the issue was created 39 | */ 40 | @Nullable 41 | GitHubInstant createdAt(); 42 | 43 | /** 44 | * Updated date 45 | * 46 | * @return The date when the issue was updated 47 | */ 48 | @Nullable 49 | GitHubInstant updatedAt(); 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/async/AsyncPage.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.async; 22 | 23 | import com.spotify.github.http.Pagination; 24 | import java.util.concurrent.CompletableFuture; 25 | 26 | /** 27 | * Async page 28 | * 29 | * @param resource type 30 | */ 31 | public interface AsyncPage extends Iterable { 32 | 33 | /** 34 | * Pagination data. 35 | * 36 | * @return pagination object 37 | */ 38 | CompletableFuture pagination(); 39 | 40 | /** 41 | * Next page. 42 | * 43 | * @return page 44 | */ 45 | CompletableFuture> nextPage(); 46 | 47 | /** 48 | * Has next page. 49 | * 50 | * @return true or false 51 | */ 52 | CompletableFuture hasNextPage(); 53 | 54 | /** 55 | * Clone page object. 56 | * 57 | * @return new page object 58 | */ 59 | AsyncPage clone(); 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/http/HttpClient.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2021 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.http; 22 | 23 | import com.spotify.github.tracing.Tracer; 24 | import java.util.concurrent.CompletableFuture; 25 | 26 | public interface HttpClient { 27 | CompletableFuture send(HttpRequest request); 28 | void setTracer(Tracer tracer); 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/http/Pagination.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.http; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import java.util.Optional; 27 | import org.immutables.value.Value; 28 | 29 | /** Pagination object. */ 30 | @Value.Immutable 31 | @GithubStyle 32 | @JsonSerialize(as = ImmutablePagination.class) 33 | @JsonDeserialize(as = ImmutablePagination.class) 34 | public interface Pagination { 35 | 36 | /** 37 | * Current page number. 38 | * 39 | * @return page number 40 | */ 41 | Integer current(); 42 | 43 | /** 44 | * Last page number. 45 | * 46 | * @return page number 47 | */ 48 | Integer last(); 49 | 50 | /** 51 | * Previous page number. 52 | * 53 | * @return page number 54 | */ 55 | Optional previous(); 56 | 57 | /** 58 | * Next page number. 59 | * 60 | * @return page number 61 | */ 62 | Optional next(); 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/jackson/CommentReactionContentDeserializer.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | package com.spotify.github.jackson; 21 | 22 | import com.fasterxml.jackson.core.JsonParser; 23 | import com.fasterxml.jackson.databind.DeserializationContext; 24 | import com.fasterxml.jackson.databind.JsonDeserializer; 25 | import com.spotify.github.v3.comment.CommentReactionContent; 26 | 27 | import java.io.IOException; 28 | /** 29 | * Custom deserializer for {@link CommentReactionContent}. 30 | */ 31 | public class CommentReactionContentDeserializer extends JsonDeserializer { 32 | @Override 33 | public CommentReactionContent deserialize(final JsonParser p, final DeserializationContext ctxt) 34 | throws IOException { 35 | String value = p.getText(); 36 | for (CommentReactionContent content : CommentReactionContent.values()) { 37 | if (content.toString().equals(value)) { 38 | return content; 39 | } 40 | } 41 | return null; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/jackson/CommentReactionContentSerializer.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | package com.spotify.github.jackson; 21 | 22 | import com.fasterxml.jackson.core.JsonGenerator; 23 | import com.fasterxml.jackson.databind.JsonSerializer; 24 | import com.fasterxml.jackson.databind.SerializerProvider; 25 | import com.spotify.github.v3.comment.CommentReactionContent; 26 | import java.io.IOException; 27 | /** 28 | * Custom serializer for {@link CommentReactionContent}. 29 | */ 30 | public class CommentReactionContentSerializer extends JsonSerializer { 31 | @Override 32 | public void serialize(final CommentReactionContent value, final JsonGenerator gen, final SerializerProvider serializers) throws IOException { 33 | gen.writeString(value.toString()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/jackson/GithubApiModule.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.jackson; 22 | 23 | import com.fasterxml.jackson.databind.module.SimpleModule; 24 | import com.spotify.github.GitHubInstant; 25 | 26 | /** Jackson databind module for Github API serialization. */ 27 | public class GithubApiModule extends SimpleModule { 28 | 29 | /** c'tor. */ 30 | public GithubApiModule() { 31 | addSerializer(GitHubInstantJsonSerializer.INSTANCE); 32 | addDeserializer(GitHubInstant.class, GitHubInstantJsonDeserializer.INSTANCE); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/opencensus/OpenCensusSpan.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2021 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.opencensus; 22 | 23 | import io.opencensus.trace.Span; 24 | 25 | /** 26 | * OpenCensusSpan is a wrapper around OpenCensus Span. This class is kept for backward 27 | * compatibility. 28 | * 29 | * @deprecated This class has been moved to the package com.spotify.github.tracing.opencensus. 30 | * Please use com.spotify.github.tracing.opencensus.OpenCensusSpan instead. 31 | */ 32 | @Deprecated 33 | public class OpenCensusSpan extends com.spotify.github.tracing.opencensus.OpenCensusSpan { 34 | public OpenCensusSpan(final Span span) { 35 | super(span); 36 | } 37 | // This class is kept for backward compatibility 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/opencensus/OpenCensusTracer.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2021 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.opencensus; 22 | 23 | /** 24 | * OpenCensusTracer is a wrapper around OpenCensus Tracer. This class is kept for backward 25 | * compatibility. 26 | * 27 | * @deprecated This class has been moved to the package com.spotify.github.tracing.opencensus. 28 | * Please use com.spotify.github.tracing.opencensus.OpenCensusTracer instead. 29 | */ 30 | @Deprecated 31 | public class OpenCensusTracer extends com.spotify.github.tracing.opencensus.OpenCensusTracer { 32 | // This class is kept for backward compatibility 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/tracing/Span.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2021 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.tracing; 22 | 23 | public interface Span extends AutoCloseable { 24 | 25 | Span success(); 26 | 27 | Span failure(Throwable t); 28 | 29 | /** Close span. Must be called for any opened span. */ 30 | @Override 31 | void close(); 32 | 33 | Span addTag(String key, String value); 34 | 35 | Span addTag(String key, boolean value); 36 | 37 | Span addTag(String key, long value); 38 | 39 | Span addTag(String key, double value); 40 | 41 | Span addEvent(String description); 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/tracing/Tracer.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2021 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.tracing; 22 | 23 | import com.spotify.github.http.HttpRequest; 24 | import java.util.concurrent.CompletionStage; 25 | 26 | public interface Tracer { 27 | 28 | /** Create scoped span. Span will be closed when future completes. */ 29 | Span span(String path, String method, CompletionStage future); 30 | 31 | Span span(String path, String method); 32 | 33 | Span span(HttpRequest request); 34 | 35 | Span span(HttpRequest request, CompletionStage future); 36 | 37 | void attachSpanToFuture(Span span, CompletionStage future); 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/ActionState.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3; 22 | 23 | /** Helpful constants for common Action states. */ 24 | public class ActionState { 25 | 26 | public static final String CREATED = "created"; 27 | public static final String DELETED = "deleted"; 28 | public static final String EDITED = "edited"; 29 | 30 | private ActionState() {} 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/activity/events/CheckRunEvent.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.activity.events; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import com.spotify.github.UpdateTracking; 27 | import com.spotify.github.v3.checks.CheckRunResponse; 28 | import org.immutables.value.Value; 29 | 30 | import javax.annotation.Nullable; 31 | 32 | @Value.Immutable 33 | @GithubStyle 34 | @JsonSerialize(as = ImmutableCheckRunEvent.class) 35 | @JsonDeserialize(as = ImmutableCheckRunEvent.class) 36 | public interface CheckRunEvent extends BaseEvent, UpdateTracking { 37 | 38 | @Nullable 39 | String action(); 40 | 41 | @Nullable 42 | CheckRunResponse checkRun(); 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/activity/events/CommitCommentEvent.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.activity.events; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import com.spotify.github.v3.comment.Comment; 27 | import javax.annotation.Nullable; 28 | import org.immutables.value.Value; 29 | 30 | /** Triggered when a commit comment is created. */ 31 | @Value.Immutable 32 | @GithubStyle 33 | @JsonSerialize(as = ImmutableCommitCommentEvent.class) 34 | @JsonDeserialize(as = ImmutableCommitCommentEvent.class) 35 | public interface CommitCommentEvent extends BaseEvent { 36 | 37 | /** The action that was performed. */ 38 | @Nullable 39 | String action(); 40 | 41 | /** The repository {@link Comment} created. */ 42 | @Nullable 43 | Comment comment(); 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/activity/events/DeleteEvent.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.activity.events; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import javax.annotation.Nullable; 27 | import org.immutables.value.Value; 28 | 29 | /** Represents a deleted branch or tag event */ 30 | @Value.Immutable 31 | @GithubStyle 32 | @JsonSerialize(as = ImmutableDeleteEvent.class) 33 | @JsonDeserialize(as = ImmutableDeleteEvent.class) 34 | public interface DeleteEvent extends BaseEvent { 35 | 36 | /** Full git reference */ 37 | @Nullable 38 | String ref(); 39 | 40 | /** The object that was deleted. Can be "branch" or "tag". */ 41 | @Nullable 42 | String refType(); 43 | 44 | /** 45 | * Pusher type. E.g. user. The github api does not document any other types, yet. To be totally 46 | * honest, it does not document *ANYTHING* about this field, so leave it as string for now. 47 | */ 48 | @Nullable 49 | String pusherType(); 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/activity/events/DeploymentEvent.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.activity.events; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import com.spotify.github.v3.repos.Deployment; 27 | import javax.annotation.Nullable; 28 | import org.immutables.value.Value; 29 | 30 | /** 31 | * Represents a deployment. 32 | * 33 | *

Events of this type are not visible in timelines. These events are only used to trigger hooks. 34 | */ 35 | @Value.Immutable 36 | @GithubStyle 37 | @JsonSerialize(as = ImmutableDeploymentEvent.class) 38 | @JsonDeserialize(as = ImmutableDeploymentEvent.class) 39 | public interface DeploymentEvent extends BaseEvent { 40 | 41 | /** Deployment */ 42 | @Nullable 43 | Deployment deployment(); 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/activity/events/DeploymentStatusEvent.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.activity.events; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import com.spotify.github.v3.repos.Deployment; 27 | import com.spotify.github.v3.repos.Status; 28 | import javax.annotation.Nullable; 29 | import org.immutables.value.Value; 30 | 31 | /** 32 | * Represents a deployment status. 33 | * 34 | *

Events of this type are not visible in timelines. These events are only used to trigger hooks. 35 | */ 36 | @Value.Immutable 37 | @GithubStyle 38 | @JsonSerialize(as = ImmutableDeploymentStatusEvent.class) 39 | @JsonDeserialize(as = ImmutableDeploymentStatusEvent.class) 40 | public interface DeploymentStatusEvent extends BaseEvent { 41 | 42 | /** The deployment status. */ 43 | @Nullable 44 | Status deploymentStatus(); 45 | 46 | /** Deployment */ 47 | @Nullable 48 | Deployment deployment(); 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/activity/events/EventInstallation.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.activity.events; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import org.immutables.value.Value; 27 | 28 | /** 29 | * The Event installation resource. Contained in events payloads, in case they come from a Github 30 | * App. 31 | */ 32 | @Value.Immutable 33 | @GithubStyle 34 | @JsonSerialize(as = ImmutableEventInstallation.class) 35 | @JsonDeserialize(as = ImmutableEventInstallation.class) 36 | public interface EventInstallation { 37 | /** 38 | * The Installation ID. 39 | * 40 | * @return the ID 41 | */ 42 | Integer id(); 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/activity/events/ForkEvent.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.activity.events; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import com.spotify.github.v3.repos.Repository; 27 | import javax.annotation.Nullable; 28 | import org.immutables.value.Value; 29 | 30 | /** Triggered when a user forks a repository. */ 31 | @Value.Immutable 32 | @GithubStyle 33 | @JsonSerialize(as = ImmutableForkEvent.class) 34 | @JsonDeserialize(as = ImmutableForkEvent.class) 35 | public interface ForkEvent extends BaseEvent { 36 | 37 | /** The {@link Repository} that was created. */ 38 | @Nullable 39 | Repository forkee(); 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/activity/events/IssuesEvent.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.activity.events; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import com.spotify.github.v3.issues.Issue; 27 | import javax.annotation.Nullable; 28 | import org.immutables.value.Value; 29 | 30 | /** 31 | * Triggered when an issue is assigned, unassigned, labeled, unlabeled, opened, edited, closed, or 32 | * reopened. 33 | */ 34 | @Value.Immutable 35 | @GithubStyle 36 | @JsonSerialize(as = ImmutableIssuesEvent.class) 37 | @JsonDeserialize(as = ImmutableIssuesEvent.class) 38 | public interface IssuesEvent extends BaseEvent { 39 | 40 | /** 41 | * The action that was performed. Can be one of "assigned", "unassigned", "labeled", "unlabeled", 42 | * "opened", "edited", "closed", or "reopened". 43 | */ 44 | @Nullable 45 | String action(); 46 | 47 | /** Issue */ 48 | @Nullable 49 | Issue issue(); 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/activity/events/PullRequestReviewEvent.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.activity.events; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import com.spotify.github.v3.prs.PullRequestItem; 27 | import com.spotify.github.v3.prs.Review; 28 | import javax.annotation.Nullable; 29 | import org.immutables.value.Value; 30 | 31 | /** Triggered when a pull request review happens. */ 32 | @Value.Immutable 33 | @GithubStyle 34 | @JsonSerialize(as = ImmutablePullRequestReviewEvent.class) 35 | @JsonDeserialize(as = ImmutablePullRequestReviewEvent.class) 36 | public interface PullRequestReviewEvent extends BaseEvent { 37 | 38 | /** State of the action. */ 39 | @Nullable 40 | String action(); 41 | 42 | /** Review. */ 43 | @Nullable 44 | Review review(); 45 | 46 | /** Pull Request. */ 47 | @Nullable 48 | PullRequestItem pullRequest(); 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/activity/events/ReviewActionState.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.activity.events; 22 | 23 | /** Helpful constants for common Review Action states. */ 24 | public class ReviewActionState { 25 | 26 | public static final String SUBMITTED = "submitted"; 27 | public static final String EDITED = "edited"; 28 | public static final String DISMISSED = "dismissed"; 29 | 30 | private ReviewActionState() {} 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/activity/events/ReviewLinks.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.activity.events; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import java.net.URI; 27 | import javax.annotation.Nullable; 28 | import org.immutables.value.Value; 29 | 30 | /** Reference links for the Review entity */ 31 | @Value.Immutable 32 | @GithubStyle 33 | @JsonSerialize(as = ImmutableReviewLinks.class) 34 | @JsonDeserialize(as = ImmutableReviewLinks.class) 35 | public interface ReviewLinks { 36 | 37 | /** Html. */ 38 | @Nullable 39 | Href html(); 40 | 41 | /** Pull Request. */ 42 | @Nullable 43 | Href pullRequest(); 44 | 45 | /** 46 | * Holder for href values. 47 | * 48 | * @param either String or URI 49 | */ 50 | @Value.Immutable 51 | @GithubStyle 52 | @JsonSerialize(as = ImmutableHref.class) 53 | @JsonDeserialize(as = ImmutableHref.class) 54 | interface Href { 55 | T href(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/activity/events/ReviewState.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-client 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.activity.events; 22 | 23 | /** 24 | * Helpful constants for common Review states in reviews events. 25 | * 26 | * @see "https://developer.github.com/v3/activity/events/types/#pullrequestreviewevent" 27 | */ 28 | public class ReviewState { 29 | 30 | public static final String PENDING = "pending"; 31 | public static final String COMMENTED = "commented"; 32 | public static final String APPROVED = "approved"; 33 | public static final String REJECTED = "rejected"; 34 | public static final String CHANGES_REQUESTED = "changes_requested"; 35 | public static final String DISMISSED = "dismissed"; 36 | 37 | private ReviewState() {} 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/apps/InstallationRepositoriesResponse.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-client 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.apps; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.spotify.github.GithubStyle; 25 | import com.spotify.github.v3.repos.Repository; 26 | import java.util.List; 27 | import org.immutables.value.Value; 28 | 29 | /** 30 | * Response for requests to "List repositories accessible to the app installation" 31 | * 32 | * https://docs.github.com/en/free-pro-team@latest/rest/reference/apps#list-repositories-accessible-to-the-app-installation 33 | */ 34 | @Value.Immutable 35 | @GithubStyle 36 | @JsonDeserialize(as = ImmutableInstallationRepositoriesResponse.class) 37 | public interface InstallationRepositoriesResponse { 38 | int totalCount(); 39 | 40 | List repositories(); 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/checks/AccessToken.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.checks; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.spotify.github.GithubStyle; 25 | import java.time.ZonedDateTime; 26 | import org.immutables.value.Value; 27 | 28 | /** The Github Installation Access token. */ 29 | @Value.Immutable 30 | @GithubStyle 31 | @JsonDeserialize(as = ImmutableAccessToken.class) 32 | public interface AccessToken { 33 | 34 | /** 35 | * Access Token. 36 | * 37 | * @return the token content 38 | */ 39 | String token(); 40 | 41 | /** 42 | * Token expiration date. 43 | * 44 | * @return the zoned date time 45 | */ 46 | ZonedDateTime expiresAt(); 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/checks/AnnotationLevel.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-client 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.checks; 22 | 23 | /** The enum AnnotationLevel. */ 24 | public enum AnnotationLevel { 25 | notice, 26 | failure, 27 | warning 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/checks/CheckRunConclusion.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.checks; 22 | 23 | /** 24 | * The enum Check run conclusion. 25 | * 26 | * @see "https://developer.github.com/v3/checks/runs/" 27 | */ 28 | public enum CheckRunConclusion { 29 | action_required, 30 | cancelled, 31 | timed_out, 32 | failure, 33 | neutral, 34 | success, 35 | skipped, 36 | stale 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/checks/CheckRunImage.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.checks; 22 | 23 | import com.fasterxml.jackson.annotation.JsonInclude; 24 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 25 | import com.spotify.github.GithubStyle; 26 | import java.util.Optional; 27 | import org.immutables.value.Value; 28 | 29 | /** 30 | * The interface CheckRun image. Adds images to the output displayed in the GitHub pull request UI. 31 | */ 32 | @Value.Immutable 33 | @GithubStyle 34 | @JsonDeserialize(as = ImmutableCheckRunImage.class) 35 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 36 | public interface CheckRunImage { 37 | 38 | /** 39 | * The alternative text for the image. 40 | * 41 | * @return the string 42 | */ 43 | String alt(); 44 | 45 | /** 46 | * The full URL of the image. 47 | * 48 | * @return the string 49 | */ 50 | String imageUrl(); 51 | 52 | /** 53 | * A short image description. 54 | * 55 | * @return the optional string 56 | */ 57 | Optional caption(); 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/checks/CheckRunResponseList.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.checks; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.spotify.github.GithubStyle; 25 | import java.util.List; 26 | import org.immutables.value.Value; 27 | 28 | /** 29 | * The CheckRunResponse list resource 30 | * 31 | * @see "https://developer.github.com/v3/checks/runs/#list-check-runs-for-a-git-reference" 32 | */ 33 | @Value.Immutable 34 | @GithubStyle 35 | @JsonDeserialize(as = ImmutableCheckRunResponseList.class) 36 | public interface CheckRunResponseList { 37 | 38 | /** 39 | * The count of checks in the response 40 | * 41 | * @return the int 42 | */ 43 | int totalCount(); 44 | 45 | /** 46 | * CheckRuns list. 47 | * 48 | * @return the list 49 | */ 50 | List checkRuns(); 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/checks/CheckRunStatus.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.checks; 22 | 23 | /** The CheckRun status. */ 24 | public enum CheckRunStatus { 25 | queued, 26 | in_progress, 27 | completed 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/checks/CheckSuite.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.checks; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.spotify.github.GithubStyle; 25 | 26 | import java.util.List; 27 | import java.util.Optional; 28 | 29 | import com.spotify.github.v3.prs.PartialPullRequestItem; 30 | import org.immutables.value.Value; 31 | 32 | /** GitHub CheckSuite */ 33 | @Value.Immutable 34 | @GithubStyle 35 | @JsonDeserialize(as = ImmutableCheckSuite.class) 36 | public interface CheckSuite { 37 | 38 | /** 39 | * The Check Suite id. 40 | * 41 | * @return the long id 42 | */ 43 | Long id(); 44 | 45 | Optional app(); 46 | 47 | Optional headBranch(); 48 | 49 | /** 50 | * Pull Requests where this check suite is applied. 51 | * 52 | * @return the list of pull requests 53 | */ 54 | List pullRequests(); 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/checks/CheckSuiteResponseList.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.checks; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.spotify.github.GithubStyle; 25 | import java.util.List; 26 | import org.immutables.value.Value; 27 | 28 | /** The CheckSuiteResponse list resource. */ 29 | @Value.Immutable 30 | @GithubStyle 31 | @JsonDeserialize(as = ImmutableCheckSuiteResponseList.class) 32 | public interface CheckSuiteResponseList { 33 | 34 | /** 35 | * The count. 36 | * 37 | * @return the int 38 | */ 39 | int totalCount(); 40 | 41 | /** 42 | * Check suites list. 43 | * 44 | * @return the list 45 | */ 46 | List checkSuites(); 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/checks/InstallationList.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.checks; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.spotify.github.GithubStyle; 25 | import java.util.List; 26 | import org.immutables.value.Value; 27 | 28 | /** The interface InstallationList content. */ 29 | @Value.Immutable 30 | @GithubStyle 31 | @JsonDeserialize(as = ImmutableInstallationList.class) 32 | public interface InstallationList { 33 | 34 | /** 35 | * Count of installations of the App the caller has access to. 36 | * 37 | * @see "https://developer.github.com/v3/apps/installations/#list-installations-for-a-user" 38 | * @return the int 39 | */ 40 | int totalCount(); 41 | 42 | /** 43 | * Installations list. 44 | * 45 | * @return the list 46 | */ 47 | List installations(); 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/clients/ActionsClient.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.clients; 22 | 23 | public class ActionsClient { 24 | private final String owner; 25 | private final String repo; 26 | private final GitHubClient github; 27 | 28 | ActionsClient(final GitHubClient github, final String owner, final String repo) { 29 | this.github = github; 30 | this.owner = owner; 31 | this.repo = repo; 32 | } 33 | 34 | static ActionsClient create(final GitHubClient github, final String owner, final String repo) { 35 | return new ActionsClient(github, owner, repo); 36 | } 37 | 38 | /** 39 | * Workflows API client 40 | * 41 | * @return Workflows API client 42 | */ 43 | public WorkflowsClient createWorkflowsClient() { 44 | return WorkflowsClient.create(github, owner, repo); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/comment/CommentReaction.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | package com.spotify.github.v3.comment; 21 | 22 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 23 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 24 | import com.spotify.github.GithubStyle; 25 | import com.spotify.github.UpdateTracking; 26 | import com.spotify.github.v3.User; 27 | import org.immutables.value.Value; 28 | 29 | /** 30 | * Comment reaction object. 31 | * 32 | *

See About 34 | * GitHub Issue Comment reactions 35 | */ 36 | @Value.Immutable 37 | @GithubStyle 38 | @JsonSerialize(as = ImmutableCommentReaction.class) 39 | @JsonDeserialize(as = ImmutableCommentReaction.class) 40 | public interface CommentReaction extends UpdateTracking { 41 | 42 | /** Reaction ID. */ 43 | long id(); 44 | 45 | /** Reaction user. */ 46 | User user(); 47 | 48 | /** Reaction content. */ 49 | CommentReactionContent content(); 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/exceptions/DeserializationException.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.exceptions; 22 | 23 | /** Marks deserialization issues */ 24 | public class DeserializationException extends GithubException { 25 | 26 | /** 27 | * Constructor for setting data and message 28 | * 29 | * @param data usually json data 30 | * @param msg error message 31 | */ 32 | public DeserializationException(final String data, final String msg) { 33 | super("Failed deserializing: " + data + ":\n" + msg); 34 | } 35 | 36 | /** 37 | * Constructor for setting data 38 | * 39 | * @param data usually json date 40 | */ 41 | public DeserializationException(final String data) { 42 | super("Failed deserializing: " + data); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/exceptions/GithubException.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.exceptions; 22 | 23 | /** Common github exception */ 24 | public class GithubException extends RuntimeException { 25 | private static final long serialVersionUID = 1L; 26 | 27 | 28 | /** 29 | * C'tor for setting a message 30 | * 31 | * @param message exception message 32 | */ 33 | public GithubException(final String message) { 34 | super(message); 35 | } 36 | 37 | /** 38 | * C'tor for setting a message 39 | * 40 | * @param message exception message 41 | */ 42 | public GithubException(final String message, final Throwable cause) { 43 | super(message, cause); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/exceptions/ReadOnlyRepositoryException.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.exceptions; 22 | 23 | import java.util.List; 24 | import java.util.Map; 25 | 26 | /** The Read only repository exception. */ 27 | public class ReadOnlyRepositoryException extends RequestNotOkException { 28 | private static final long serialVersionUID = 1L; 29 | 30 | /** 31 | * Instantiates a new Read only repository exception. 32 | * 33 | * @param method HTTP method 34 | * @param path the path 35 | * @param statusCode the status code 36 | * @param msg the msg 37 | */ 38 | public ReadOnlyRepositoryException( 39 | final String method, final String path, final int statusCode, final String msg, final Map> headers) { 40 | super(method, path, statusCode, msg, headers); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/git/Author.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.git; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GitHubInstant; 26 | import com.spotify.github.GithubStyle; 27 | import java.util.Optional; 28 | import javax.annotation.Nullable; 29 | import org.immutables.value.Value; 30 | 31 | /** An entity with information about the individual. */ 32 | @Value.Immutable 33 | @GithubStyle 34 | @JsonSerialize(as = ImmutableAuthor.class) 35 | @JsonDeserialize(as = ImmutableAuthor.class) 36 | public interface Author { 37 | 38 | /** The name of the author. */ 39 | @Nullable 40 | String name(); 41 | 42 | /** The email of the author. */ 43 | Optional email(); 44 | 45 | /** The username of the author, not always set. */ 46 | Optional username(); 47 | 48 | /** Date when action occurred. */ 49 | Optional date(); 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/git/Blob.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.git; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import javax.annotation.Nullable; 27 | import org.immutables.value.Value; 28 | 29 | /** Git blob */ 30 | @Value.Immutable 31 | @GithubStyle 32 | @JsonSerialize(as = ImmutableBlob.class) 33 | @JsonDeserialize(as = ImmutableBlob.class) 34 | public interface Blob extends ShaLink { 35 | 36 | /** Encoded blob content. */ 37 | @Nullable 38 | String content(); 39 | 40 | /** Encoding name. Currently, "utf-8" and "base64" are supported. Default: "utf-8". */ 41 | @Nullable 42 | String encoding(); 43 | 44 | /** Content size in bytes. */ 45 | @Nullable 46 | Integer size(); 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/git/ParentItem.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2021 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.git; 22 | 23 | import com.fasterxml.jackson.annotation.JsonProperty; 24 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 25 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 26 | import com.spotify.github.GithubStyle; 27 | import org.immutables.value.Value; 28 | 29 | import javax.annotation.Nullable; 30 | import java.net.URI; 31 | 32 | 33 | @Value.Immutable 34 | @GithubStyle 35 | @JsonSerialize(as = ImmutableParentItem.class) 36 | @JsonDeserialize(as = ImmutableParentItem.class) 37 | 38 | public interface ParentItem { 39 | 40 | @Nullable 41 | String sha(); 42 | 43 | @Nullable 44 | URI url(); 45 | 46 | @Nullable 47 | @JsonProperty("html_url") 48 | URI htmlUrl(); 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/git/RefType.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.git; 22 | 23 | /** Helpful constants for common Ref types. */ 24 | public class RefType { 25 | 26 | public static final String BRANCH = "branch"; 27 | public static final String REPOSITORY = "repository"; 28 | public static final String TAG = "tag"; 29 | 30 | private RefType() {} 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/git/Reference.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.git; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import java.net.URI; 27 | import javax.annotation.Nullable; 28 | import org.immutables.value.Value; 29 | 30 | /** Github reference. */ 31 | @Value.Immutable 32 | @GithubStyle 33 | @JsonSerialize(as = ImmutableReference.class) 34 | @JsonDeserialize(as = ImmutableReference.class) 35 | public interface Reference { 36 | 37 | /** Full reference path. E.g. lrefs/heads/featureA. */ 38 | @Nullable 39 | String ref(); 40 | 41 | /** Reference API URL. */ 42 | @Nullable 43 | URI url(); 44 | 45 | /** Reference object. */ 46 | @Nullable 47 | ReferenceObject object(); 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/git/ReferenceObject.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.git; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import javax.annotation.Nullable; 27 | import org.immutables.value.Value; 28 | 29 | /** Reference object resource. */ 30 | @Value.Immutable 31 | @GithubStyle 32 | @JsonSerialize(as = ImmutableReferenceObject.class) 33 | @JsonDeserialize(as = ImmutableReferenceObject.class) 34 | public interface ReferenceObject extends ShaLink { 35 | 36 | /** The type of the reference object. */ 37 | @Nullable 38 | String type(); 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/git/ShaLink.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.git; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import java.net.URI; 27 | import javax.annotation.Nullable; 28 | import org.immutables.value.Value; 29 | 30 | /** Github sha resource. */ 31 | @Value.Immutable 32 | @GithubStyle 33 | @JsonSerialize(as = ImmutableShaLink.class) 34 | @JsonDeserialize(as = ImmutableShaLink.class) 35 | public interface ShaLink { 36 | 37 | /** SHA. */ 38 | @Nullable 39 | String sha(); 40 | 41 | /** URL. */ 42 | @Nullable 43 | URI url(); 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/git/StatItem.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2021 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.git; 22 | 23 | import javax.annotation.Nullable; 24 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 25 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 26 | import com.spotify.github.GithubStyle; 27 | import org.immutables.value.Value; 28 | 29 | @Value.Immutable 30 | @GithubStyle 31 | @JsonSerialize(as = ImmutableStatItem.class) 32 | @JsonDeserialize(as = ImmutableStatItem.class) 33 | 34 | public interface StatItem { 35 | 36 | @Nullable 37 | Integer total(); 38 | 39 | @Nullable 40 | Integer additions(); 41 | 42 | @Nullable 43 | Integer deletions(); 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/git/Tag.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.git; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import javax.annotation.Nullable; 27 | import org.immutables.value.Value; 28 | 29 | /** Git tag resource. Only available for annotated tags (no lightweight tags). */ 30 | @Value.Immutable 31 | @GithubStyle 32 | @JsonSerialize(as = ImmutableTag.class) 33 | @JsonDeserialize(as = ImmutableTag.class) 34 | public interface Tag extends ShaLink { 35 | 36 | /** The tag. */ 37 | @Nullable 38 | String tag(); 39 | 40 | /** The tag message. */ 41 | @Nullable 42 | String message(); 43 | 44 | /** An object with information about the individual creating the tag. */ 45 | @Nullable 46 | Author tagger(); 47 | 48 | /** The SHA of the git object this is tagging. */ 49 | @Nullable 50 | ReferenceObject object(); 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/git/Tree.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.git; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import java.util.List; 27 | import javax.annotation.Nullable; 28 | import org.immutables.value.Value; 29 | 30 | /** Git tree resource. */ 31 | @Value.Immutable 32 | @GithubStyle 33 | @JsonSerialize(as = ImmutableTree.class) 34 | @JsonDeserialize(as = ImmutableTree.class) 35 | public interface Tree extends ShaLink { 36 | 37 | /** Tree items. */ 38 | @Nullable 39 | List tree(); 40 | 41 | /** If true, the number of items in the tree array exceeded our maximum limit. */ 42 | @Nullable 43 | Boolean truncated(); 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/git/TreeItemType.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.git; 22 | 23 | /** Helpful constants for common TreeItem types. */ 24 | public class TreeItemType { 25 | 26 | public static final String BLOB = "blob"; 27 | public static final String COMMIT = "commit"; 28 | public static final String TREE = "tree"; 29 | 30 | private TreeItemType() {} 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/git/Verification.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2021 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.git; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import org.immutables.value.Value; 27 | 28 | import javax.annotation.Nullable; 29 | 30 | 31 | 32 | @Value.Immutable 33 | @GithubStyle 34 | @JsonSerialize(as = ImmutableVerification.class) 35 | @JsonDeserialize(as = ImmutableVerification.class) 36 | public interface Verification { 37 | 38 | @Nullable 39 | Boolean verified(); 40 | 41 | @Nullable 42 | String reason(); 43 | 44 | @Nullable 45 | String signature(); 46 | 47 | @Nullable 48 | String payload(); 49 | 50 | } 51 | 52 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/hooks/requests/WebhookCreate.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.hooks.requests; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import com.spotify.github.v3.hooks.WebhookConfig; 27 | import java.util.List; 28 | import javax.annotation.Nullable; 29 | import org.immutables.value.Value; 30 | 31 | /** Webhooks create request resource */ 32 | @Value.Immutable 33 | @GithubStyle 34 | @JsonSerialize(as = ImmutableWebhookCreate.class) 35 | @JsonDeserialize(as = ImmutableWebhookCreate.class) 36 | public interface WebhookCreate { 37 | 38 | /** Webhook name */ 39 | @Nullable 40 | String name(); 41 | 42 | /** Should it be active */ 43 | @Nullable 44 | Boolean active(); 45 | 46 | /** Events */ 47 | @Nullable 48 | List events(); 49 | 50 | /** Webhook config. See {@link WebhookConfig} for more details. */ 51 | @Nullable 52 | WebhookConfig config(); 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/issues/IssueActionState.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.issues; 22 | 23 | /** Helpful constants for common Issue Action states. */ 24 | public class IssueActionState { 25 | 26 | public static final String ASSIGNED = "assigned"; 27 | public static final String CLOSED = "closed"; 28 | public static final String EDITED = "edited"; 29 | public static final String LABELED = "labeled"; 30 | public static final String OPENED = "opened"; 31 | public static final String REOPENED = "reopened"; 32 | public static final String UNASSIGNED = "unassigned"; 33 | public static final String UNLABELED = "unlabeled"; 34 | 35 | private IssueActionState() {} 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/issues/PullRequest.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.issues; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import java.net.URI; 27 | import javax.annotation.Nullable; 28 | import org.immutables.value.Value; 29 | 30 | /** Issues pull request resource. */ 31 | @Value.Immutable 32 | @GithubStyle 33 | @JsonSerialize(as = ImmutablePullRequest.class) 34 | @JsonDeserialize(as = ImmutablePullRequest.class) 35 | public interface PullRequest { 36 | 37 | /** URL. */ 38 | @Nullable 39 | URI url(); 40 | 41 | /** HTML URL. */ 42 | @Nullable 43 | URI htmlUrl(); 44 | 45 | /** Diff URL. */ 46 | @Nullable 47 | URI diffUrl(); 48 | 49 | /** Patch URL. */ 50 | @Nullable 51 | URI patchUrl(); 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/issues/changes/Body.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.issues.changes; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import javax.annotation.Nullable; 27 | import org.immutables.value.Value; 28 | 29 | /** Placeholder resource for the previous version of an issue comment in case it was edited. */ 30 | @Value.Immutable 31 | @GithubStyle 32 | @JsonSerialize(as = ImmutableBody.class) 33 | @JsonDeserialize(as = ImmutableBody.class) 34 | public interface Body { 35 | 36 | /** 37 | * The previous version of the body if the issue comment was edited. 38 | * 39 | * @return The previous version of the body if the issue comment was edited. 40 | */ 41 | @Nullable 42 | String from(); 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/issues/changes/Changes.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.issues.changes; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import javax.annotation.Nullable; 27 | import org.immutables.value.Value; 28 | 29 | /** 30 | * The changes to the comment if the action was "edited". Placeholder resource for the {@link Body} 31 | * with previous version of the comment. 32 | */ 33 | @Value.Immutable 34 | @GithubStyle 35 | @JsonSerialize(as = ImmutableChanges.class) 36 | @JsonDeserialize(as = ImmutableChanges.class) 37 | public interface Changes { 38 | 39 | /** 40 | * The previous version of the body if the action was "edited". 41 | * 42 | * @return The previous version of the body if the action was "edited". 43 | */ 44 | @Nullable 45 | Body body(); 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/orgs/Membership.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.orgs; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import java.net.URI; 27 | import javax.annotation.Nullable; 28 | import org.immutables.value.Value; 29 | 30 | /** 31 | * Membership resource represents data returned by a single Membership get operation. 32 | */ 33 | @Value.Immutable 34 | @GithubStyle 35 | @JsonSerialize(as = ImmutableMembership.class) 36 | @JsonDeserialize(as = ImmutableMembership.class) 37 | public interface Membership { 38 | 39 | /** URL */ 40 | @Nullable 41 | URI url(); 42 | 43 | /** ROLE */ 44 | @Nullable 45 | String role(); 46 | 47 | /** STATE */ 48 | @Nullable 49 | String state(); 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/orgs/OrgMembership.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.orgs; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import com.spotify.github.v3.User; 27 | import com.spotify.github.v3.repos.Organization; 28 | import java.net.URI; 29 | import javax.annotation.Nullable; 30 | import org.immutables.value.Value; 31 | 32 | /** 33 | * Org Membership resource represents data returned by a single Membership get operation. 34 | */ 35 | @Value.Immutable 36 | @GithubStyle 37 | @JsonSerialize(as = ImmutableOrgMembership.class) 38 | @JsonDeserialize(as = ImmutableOrgMembership.class) 39 | public interface OrgMembership { 40 | 41 | /** URL */ 42 | @Nullable 43 | URI url(); 44 | 45 | /** ROLE */ 46 | @Nullable 47 | String role(); 48 | 49 | /** STATE */ 50 | @Nullable 51 | String state(); 52 | 53 | @Nullable 54 | Organization organization(); 55 | 56 | /** USER */ 57 | @Nullable 58 | User user(); 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/orgs/requests/MembershipCreate.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.orgs.requests; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import javax.annotation.Nullable; 27 | import org.immutables.value.Value; 28 | 29 | /** Request to create a team within a given organisation */ 30 | @Value.Immutable 31 | @GithubStyle 32 | @JsonSerialize(as = ImmutableMembershipCreate.class) 33 | @JsonDeserialize(as = ImmutableMembershipCreate.class) 34 | public interface MembershipCreate { 35 | 36 | /** 37 | * The role that this user should have in the team. 38 | * Defaults to 'member' 39 | */ 40 | @Nullable 41 | String role(); 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/orgs/requests/OrgMembershipCreate.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.orgs.requests; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import javax.annotation.Nullable; 27 | import org.immutables.value.Value; 28 | 29 | /** Request to create a member within a given org */ 30 | @Value.Immutable 31 | @GithubStyle 32 | @JsonSerialize(as = ImmutableOrgMembershipCreate.class) 33 | @JsonDeserialize(as = ImmutableOrgMembershipCreate.class) 34 | public interface OrgMembershipCreate { 35 | 36 | /** 37 | * The role that this user should have in the org. 38 | * Defaults to 'member' 39 | */ 40 | @Nullable 41 | String role(); 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/prs/AutoMerge.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.prs; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import com.spotify.github.v3.User; 27 | import org.immutables.value.Value; 28 | 29 | import javax.annotation.Nullable; 30 | 31 | @Value.Immutable 32 | @GithubStyle 33 | @JsonSerialize(as = ImmutableAutoMerge.class) 34 | @JsonDeserialize(as = ImmutableAutoMerge.class) 35 | public interface AutoMerge { 36 | // Who enabled the auto merge 37 | User enabledBy(); 38 | 39 | // Merge Method chosen for the auto merge 40 | String mergeMethod(); 41 | 42 | // The commit title to use when merging the pull request 43 | @Nullable 44 | String commitTitle(); 45 | 46 | // The commit message to use when merging the pull request 47 | @Nullable 48 | String commitMessage(); 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/prs/CommentLinks.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.prs; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import com.spotify.github.Links; 27 | import java.net.URI; 28 | import javax.annotation.Nullable; 29 | import org.immutables.value.Value; 30 | 31 | /** Reference links for the Comment entity */ 32 | @Value.Immutable 33 | @GithubStyle 34 | @JsonSerialize(as = ImmutableCommentLinks.class) 35 | @JsonDeserialize(as = ImmutableCommentLinks.class) 36 | public interface CommentLinks extends Links { 37 | 38 | /** Link to the pull request that this comment belongs to. {@link PullRequest} */ 39 | @Nullable 40 | Href pullRequest(); 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/prs/MergeMethod.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-client 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.prs; 22 | 23 | /** 24 | * The enum MergeMethod. 25 | * 26 | * @see "https://developer.github.com/v3/pulls/#input-3" 27 | */ 28 | public enum MergeMethod { 29 | merge, 30 | squash, 31 | rebase 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/prs/PartialPullRequestItem.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | package com.spotify.github.v3.prs; 21 | 22 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 23 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 24 | import com.spotify.github.CloseTracking; 25 | import com.spotify.github.GithubStyle; 26 | import org.immutables.value.Value; 27 | 28 | import javax.annotation.Nullable; 29 | import java.net.URI; 30 | 31 | @Value.Immutable 32 | @GithubStyle 33 | @JsonSerialize(as = ImmutablePartialPullRequestItem.class) 34 | @JsonDeserialize(as = ImmutablePartialPullRequestItem.class) 35 | public interface PartialPullRequestItem extends CloseTracking { 36 | /** ID. */ 37 | Long id(); 38 | 39 | /** URL. */ 40 | URI url(); 41 | 42 | /** Number. */ 43 | Long number(); 44 | 45 | /** Head reference. */ 46 | @Nullable 47 | PullRequestRef head(); 48 | 49 | /** Base reference. */ 50 | @Nullable 51 | PullRequestRef base(); 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/prs/PullRequestActionState.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.prs; 22 | 23 | /** Helpful constants for common PullRequest Action states. */ 24 | public class PullRequestActionState { 25 | 26 | public static final String ASSIGNED = "assigned"; 27 | public static final String CLOSED = "closed"; 28 | public static final String EDITED = "edited"; 29 | public static final String LABELED = "labeled"; 30 | public static final String OPENED = "opened"; 31 | public static final String REOPENED = "reopened"; 32 | public static final String REVIEW_REQUESTED = "review_requested"; 33 | public static final String REVIEW_REQUEST_REMOVED = "review_request_removed"; 34 | public static final String SYNCHRONIZE = "synchronize"; 35 | public static final String UNASSIGNED = "unassigned"; 36 | public static final String UNLABELED = "unlabeled"; 37 | 38 | private PullRequestActionState() {} 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/prs/PullRequestRef.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.prs; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import com.spotify.github.v3.User; 27 | import com.spotify.github.v3.repos.Repository; 28 | import java.util.Optional; 29 | import javax.annotation.Nullable; 30 | import org.immutables.value.Value; 31 | 32 | /** Pull request reference resource */ 33 | @Value.Immutable 34 | @GithubStyle 35 | @JsonSerialize(as = ImmutablePullRequestRef.class) 36 | @JsonDeserialize(as = ImmutablePullRequestRef.class) 37 | public interface PullRequestRef { 38 | 39 | /** Label */ 40 | Optional label(); 41 | 42 | /** Reference */ 43 | @Nullable 44 | String ref(); 45 | 46 | /** SHA */ 47 | @Nullable 48 | String sha(); 49 | 50 | /** User */ 51 | Optional user(); 52 | 53 | /** Repository */ 54 | Optional repo(); 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/prs/ReviewRequests.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.prs; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import com.spotify.github.v3.User; 27 | import com.spotify.github.v3.Team; 28 | import java.util.List; 29 | import javax.annotation.Nullable; 30 | import org.immutables.value.Value; 31 | 32 | /** 33 | * Pull request review resource represents data returned by a single PR review get operation. It 34 | * contains all the fields from {@link Review} entity. 35 | * 36 | * @see https://docs.github.com/en/rest/reference/pulls#list-requested-reviewers-for-a-pull-request 37 | */ 38 | @Value.Immutable 39 | @GithubStyle 40 | @JsonSerialize(as = ImmutableReviewRequests.class) 41 | @JsonDeserialize(as = ImmutableReviewRequests.class) 42 | public interface ReviewRequests { 43 | 44 | @Nullable 45 | List users(); 46 | 47 | @Nullable 48 | List teams(); 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/prs/ReviewState.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-client 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.prs; 22 | 23 | /** 24 | * Helpful constants for common Review states in reviews. 25 | * 26 | * @see "https://developer.github.com/v3/pulls/reviews/#list-reviews-on-a-pull-request" 27 | */ 28 | public class ReviewState { 29 | 30 | public static final String PENDING = "PENDING"; 31 | public static final String COMMENTED = "COMMENTED"; 32 | public static final String APPROVED = "APPROVED"; 33 | public static final String REJECTED = "REJECTED"; 34 | public static final String CHANGES_REQUESTED = "CHANGES_REQUESTED"; 35 | public static final String DISMISSED = "DISMISSED"; 36 | 37 | private ReviewState() {} 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/prs/requests/PullRequestUpdate.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.prs.requests; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import java.util.Optional; 27 | import org.immutables.value.Value; 28 | 29 | /** Pull request update request resource */ 30 | @Value.Immutable 31 | @GithubStyle 32 | @JsonSerialize(as = ImmutablePullRequestUpdate.class) 33 | @JsonDeserialize(as = ImmutablePullRequestUpdate.class) 34 | public interface PullRequestUpdate { 35 | 36 | /** The title of the pull request. */ 37 | Optional title(); 38 | 39 | /** The contents of the pull request. */ 40 | Optional body(); 41 | 42 | /** State of this Pull Request. Either open or closed. */ 43 | Optional state(); 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/repos/Commit.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.repos; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import com.spotify.github.v3.git.ShaLink; 27 | import java.util.List; 28 | import java.util.Map; 29 | import javax.annotation.Nullable; 30 | import org.immutables.value.Value; 31 | 32 | /** Single repository commit resource. */ 33 | @Value.Immutable 34 | @GithubStyle 35 | @JsonSerialize(as = ImmutableCommit.class) 36 | @JsonDeserialize(as = ImmutableCommit.class) 37 | public interface Commit extends CommitItem { 38 | 39 | /** Commit statistics key, value map. E.g. additions: 104 deletions: 4 total: 108 */ 40 | @Nullable 41 | Map stats(); 42 | 43 | /** File objects included in the commit. */ 44 | @Nullable 45 | List files(); 46 | 47 | /** The SHA of the tree object this commit points to. */ 48 | @Nullable 49 | ShaLink tree(); 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/repos/CommitWithFolderContent.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2023 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.repos; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import com.spotify.github.v3.git.Commit; 27 | import org.immutables.value.Value; 28 | 29 | @Value.Immutable 30 | @GithubStyle 31 | @JsonSerialize(as = ImmutableCommitWithFolderContent.class) 32 | @JsonDeserialize(as = ImmutableCommitWithFolderContent.class) 33 | public interface CommitWithFolderContent { 34 | 35 | /** Repository content resource */ 36 | FolderContent content(); 37 | 38 | /** Commit resource */ 39 | Commit commit(); 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/repos/Content.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.repos; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import javax.annotation.Nullable; 27 | import org.immutables.value.Value; 28 | 29 | /** Repository content resource */ 30 | @Value.Immutable 31 | @GithubStyle 32 | @JsonSerialize(as = ImmutableContent.class) 33 | @JsonDeserialize(as = ImmutableContent.class) 34 | public interface Content extends FolderContent { 35 | 36 | /** Encoding name. E.g. base64 */ 37 | @Nullable 38 | String encoding(); 39 | 40 | /** Actual encoded content */ 41 | @Nullable 42 | String content(); 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/repos/ContentType.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.repos; 22 | 23 | /** Helpful constants for common content types. */ 24 | public class ContentType { 25 | 26 | public static final String FILE = "file"; 27 | public static final String DIR = "dir"; 28 | public static final String SYMLINK = "symlink"; 29 | public static final String SUBMODULE = "submodule"; 30 | 31 | private ContentType() {} 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/repos/Languages.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-client 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.repos; 22 | 23 | import java.util.LinkedHashMap; 24 | 25 | /** 26 | * The Languages type. 27 | * 28 | * @see "https://developer.github.com/v3/repos/#list-languages" 29 | */ 30 | public class Languages extends LinkedHashMap { 31 | private static final long serialVersionUID = 1L; 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/repos/Permissions.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.repos; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import javax.annotation.Nullable; 27 | import org.immutables.value.Value; 28 | 29 | /** Repository permissions resource */ 30 | @Value.Immutable 31 | @GithubStyle 32 | @JsonSerialize(as = ImmutablePermissions.class) 33 | @JsonDeserialize(as = ImmutablePermissions.class) 34 | public interface Permissions { 35 | 36 | /** Has admin */ 37 | @Nullable 38 | Boolean admin(); 39 | 40 | /** Can push */ 41 | @Nullable 42 | Boolean push(); 43 | 44 | /** Can pull */ 45 | @Nullable 46 | Boolean pull(); 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/repos/Protection.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.repos; 22 | 23 | import com.fasterxml.jackson.annotation.JsonProperty; 24 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 25 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 26 | import com.spotify.github.GithubStyle; 27 | import org.immutables.value.Value; 28 | 29 | /** Branch resource */ 30 | @Value.Immutable 31 | @GithubStyle 32 | @JsonSerialize(as = ImmutableProtection.class) 33 | @JsonDeserialize(as = ImmutableProtection.class) 34 | public interface Protection { 35 | boolean enabled(); 36 | 37 | @JsonProperty("required_status_checks") 38 | RequiredStatusChecks requiredStatusChecks(); 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/repos/PushRepository.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.repos; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import com.spotify.github.v3.git.Author; 27 | import javax.annotation.Nullable; 28 | import org.immutables.value.Value; 29 | 30 | /** 31 | * Repository resource for push events. This ONLY exists because the github api is 32 | * inconsistent in the way it represents pushedAt and updatedAt. :( 33 | */ 34 | @Value.Immutable 35 | @GithubStyle 36 | @JsonSerialize(as = ImmutablePushRepository.class) 37 | @JsonDeserialize(as = ImmutablePushRepository.class) 38 | public interface PushRepository extends RepositoryBase { 39 | 40 | /** Owner */ 41 | @Nullable 42 | Author owner(); 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/repos/Repository.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.repos; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import com.spotify.github.v3.User; 27 | import javax.annotation.Nullable; 28 | import org.immutables.value.Value; 29 | 30 | /** Repository resource */ 31 | @Value.Immutable 32 | @GithubStyle 33 | @JsonSerialize(as = ImmutableRepository.class) 34 | @JsonDeserialize(as = ImmutableRepository.class) 35 | public interface Repository extends RepositoryBase { 36 | 37 | /** Owner */ 38 | @Nullable 39 | User owner(); 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/repos/RepositoryActionState.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.repos; 22 | 23 | /** Helpful constants for common Repository Action states. */ 24 | public class RepositoryActionState { 25 | 26 | public static final String CREATED = "created"; 27 | public static final String DELETED = "deleted"; 28 | public static final String PUBLICIZED = "publicized"; 29 | public static final String PRIVATIZED = "privatized"; 30 | 31 | private RepositoryActionState() {} 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/repos/RepositoryPermission.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-client 4 | * -- 5 | * Copyright (C) 2016 - 2022 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.repos; 22 | 23 | /** Helpful constants for Repository permissions. */ 24 | public class RepositoryPermission { 25 | 26 | public static final String PULL = "pull"; 27 | public static final String PUSH = "push"; 28 | public static final String ADMIN = "admin"; 29 | public static final String MAINTAIN = "maintain"; 30 | public static final String TRIAGE = "triage"; 31 | 32 | private RepositoryPermission() {} 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/repos/RequiredStatusChecks.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.repos; 22 | 23 | import com.fasterxml.jackson.annotation.JsonProperty; 24 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 25 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 26 | import com.spotify.github.GithubStyle; 27 | import java.util.Collections; 28 | import java.util.List; 29 | import org.immutables.value.Value; 30 | import org.immutables.value.Value.Default; 31 | 32 | /** Branch resource */ 33 | @Value.Immutable 34 | @GithubStyle 35 | @JsonSerialize(as = ImmutableRequiredStatusChecks.class) 36 | @JsonDeserialize(as = ImmutableRequiredStatusChecks.class) 37 | public interface RequiredStatusChecks { 38 | @JsonProperty("enforcement_level") 39 | String enforcementLevel(); 40 | 41 | @Default 42 | default List contexts() { 43 | return Collections.emptyList(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/repos/StatusState.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.repos; 22 | 23 | /** Helpful constants for common Status states. */ 24 | public class StatusState { 25 | 26 | public static final String PENDING = "pending"; 27 | public static final String SUCCESS = "success"; 28 | public static final String ERROR = "error"; 29 | public static final String FAILURE = "failure"; 30 | 31 | private StatusState() {} 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/repos/requests/FileCreate.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2023 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.repos.requests; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import org.immutables.value.Value; 27 | 28 | import javax.annotation.Nullable; 29 | 30 | /** 31 | * Request to create a file. 32 | */ 33 | @Value.Immutable 34 | @GithubStyle 35 | @JsonSerialize(as = ImmutableFileCreate.class) 36 | @JsonDeserialize(as = ImmutableFileCreate.class) 37 | public interface FileCreate { 38 | 39 | /** The commit message */ 40 | String message(); 41 | 42 | /** The new file content, using Base64 encoding */ 43 | String content(); 44 | 45 | /** The branch name. Default: the repository’s default branch */ 46 | @Nullable 47 | String branch(); 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/repos/requests/FileUpdate.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2023 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.repos.requests; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import org.immutables.value.Value; 27 | 28 | import javax.annotation.Nullable; 29 | 30 | /** 31 | * Request to update file content. 32 | */ 33 | @Value.Immutable 34 | @GithubStyle 35 | @JsonSerialize(as = ImmutableFileUpdate.class) 36 | @JsonDeserialize(as = ImmutableFileUpdate.class) 37 | public interface FileUpdate { 38 | 39 | /** The commit message */ 40 | String message(); 41 | 42 | /** The new file content, using Base64 encoding */ 43 | String content(); 44 | 45 | /** The SHA of the file being replaced. */ 46 | String sha(); 47 | 48 | /** The branch name. Default: the repository’s default branch */ 49 | @Nullable 50 | String branch(); 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/repos/requests/RepositoryDispatch.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2023 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.repos.requests; 22 | 23 | import com.fasterxml.jackson.databind.JsonNode; 24 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 25 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 26 | import com.spotify.github.GithubStyle; 27 | import java.util.Optional; 28 | import org.immutables.value.Value; 29 | 30 | @Value.Immutable 31 | @GithubStyle 32 | @JsonSerialize(as = ImmutableRepositoryDispatch.class) 33 | @JsonDeserialize(as = ImmutableRepositoryDispatch.class) 34 | public interface RepositoryDispatch { 35 | 36 | /** The custom webhook event name */ 37 | 38 | String eventType(); 39 | 40 | /** JSON payload with extra information about the webhook event 41 | * that your action or workflow may use. */ 42 | Optional clientPayload(); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/search/Search.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.search; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import javax.annotation.Nullable; 27 | import org.immutables.value.Value; 28 | 29 | /** 30 | * Search result base resource. This base entity for specific search result resources exists to 31 | * overcome gson generics serialization issues. 32 | */ 33 | @Value.Immutable 34 | @GithubStyle 35 | @JsonSerialize(as = ImmutableSearch.class) 36 | @JsonDeserialize(as = ImmutableSearch.class) 37 | public interface Search { 38 | 39 | /** Total count of search hits */ 40 | @Nullable 41 | Integer totalCount(); 42 | 43 | /** Are returned results incomplete */ 44 | @Nullable 45 | Boolean incompleteResults(); 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/search/SearchIssue.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.search; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import com.spotify.github.v3.issues.Issue; 27 | import javax.annotation.Nullable; 28 | import org.immutables.value.Value; 29 | 30 | /** Issues search results */ 31 | @Value.Immutable 32 | @GithubStyle 33 | @JsonSerialize(as = ImmutableSearchIssue.class) 34 | @JsonDeserialize(as = ImmutableSearchIssue.class) 35 | public interface SearchIssue extends Issue { 36 | 37 | /** 38 | * Score of item 39 | * 40 | * @return float 41 | */ 42 | @Nullable 43 | Float score(); 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/search/SearchIssues.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.search; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import java.util.List; 27 | import javax.annotation.Nullable; 28 | import org.immutables.value.Value; 29 | 30 | /** Issues search result resource */ 31 | @Value.Immutable 32 | @GithubStyle 33 | @JsonSerialize(as = ImmutableSearchIssues.class) 34 | @JsonDeserialize(as = ImmutableSearchIssues.class) 35 | public interface SearchIssues extends Search { 36 | 37 | /** Issues search results */ 38 | @Nullable 39 | List items(); 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/search/SearchRepositories.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.search; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import com.spotify.github.v3.repos.Repository; 27 | import java.util.List; 28 | import javax.annotation.Nullable; 29 | import org.immutables.value.Value; 30 | 31 | /** Repositories search result resource */ 32 | @Value.Immutable 33 | @GithubStyle 34 | @JsonSerialize(as = ImmutableSearchRepositories.class) 35 | @JsonDeserialize(as = ImmutableSearchRepositories.class) 36 | public interface SearchRepositories extends Search { 37 | 38 | /** Repositories search results */ 39 | @Nullable 40 | List items(); 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/search/SearchUsers.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.search; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GithubStyle; 26 | import com.spotify.github.v3.User; 27 | import java.util.List; 28 | import javax.annotation.Nullable; 29 | import org.immutables.value.Value; 30 | 31 | /** Users search result resource */ 32 | @Value.Immutable 33 | @GithubStyle 34 | @JsonSerialize(as = ImmutableSearchUsers.class) 35 | @JsonDeserialize(as = ImmutableSearchUsers.class) 36 | public interface SearchUsers extends Search { 37 | 38 | /** Users search results */ 39 | @Nullable 40 | List items(); 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/user/requests/SuspensionReason.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2024 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | package com.spotify.github.v3.user.requests; 21 | 22 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 23 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 24 | import com.spotify.github.GithubStyle; 25 | import org.immutables.value.Value; 26 | 27 | @Value.Immutable 28 | @GithubStyle 29 | @JsonSerialize(as = ImmutableSuspensionReason.class) 30 | @JsonDeserialize(as = ImmutableSuspensionReason.class) 31 | public interface SuspensionReason { 32 | 33 | String reason(); 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/workflows/WorkflowsRepositoryResponseList.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.workflows; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.spotify.github.GithubStyle; 25 | import org.immutables.value.Value; 26 | 27 | import java.util.List; 28 | 29 | /** 30 | * The WorkflowsResponse list resource 31 | * 32 | * @see "https://docs.github.com/en/rest/actions/workflows#list-repository-workflows" 33 | */ 34 | @Value.Immutable 35 | @GithubStyle 36 | @JsonDeserialize(as = ImmutableWorkflowsRepositoryResponseList.class) 37 | public interface WorkflowsRepositoryResponseList { 38 | /** 39 | * The count of workflows in the response 40 | * 41 | * @return the int 42 | */ 43 | int totalCount(); 44 | 45 | /** 46 | * Workflows list. 47 | * 48 | * @return the list of workflows 49 | */ 50 | List workflows(); 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/spotify/github/v3/workflows/WorkflowsState.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.workflows; 22 | 23 | /** The Workflow State. */ 24 | public enum WorkflowsState { 25 | active, 26 | deleted, 27 | disabled_fork, 28 | disabled_inactivity, 29 | disabled_manually 30 | } 31 | -------------------------------------------------------------------------------- /src/test/java/com/spotify/github/hooks/PullRequestEventTest.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.hooks; 22 | 23 | import static com.spotify.github.FixtureHelper.loadFixture; 24 | import static org.hamcrest.MatcherAssert.assertThat; 25 | import static org.hamcrest.core.Is.is; 26 | 27 | import com.spotify.github.jackson.Json; 28 | import com.spotify.github.v3.activity.events.PullRequestEvent; 29 | import java.io.IOException; 30 | import org.junit.jupiter.api.Test; 31 | 32 | public class PullRequestEventTest { 33 | 34 | @Test 35 | public void testParsingPullRequestClosedEventWithoutLabelOrUser() throws IOException { 36 | final String fixture = loadFixture("hooks/requests/pull-request-closed.json"); 37 | final PullRequestEvent prEvent = Json.create().fromJson(fixture, PullRequestEvent.class); 38 | 39 | assertThat(prEvent.pullRequest().head().label().isPresent(), is(false)); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/test/java/com/spotify/github/http/LinkTest.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.http; 22 | 23 | import static java.util.stream.Collectors.toList; 24 | import static org.hamcrest.core.Is.is; 25 | import static org.hamcrest.MatcherAssert.assertThat; 26 | 27 | import java.util.Arrays; 28 | import java.util.List; 29 | import org.junit.jupiter.api.Test; 30 | 31 | public class LinkTest { 32 | 33 | @Test 34 | public void testFromLinkString() { 35 | final String link = 36 | "; rel=\"next\", ; rel=\"last\""; 37 | 38 | final List links = 39 | Arrays.stream(link.split(",")) 40 | .map(linkString -> Link.from(linkString.split(";"))) 41 | .collect(toList()); 42 | 43 | assertThat( 44 | links.get(0).url().toString(), 45 | is("https://github.com/api/v3/repositories/44219/issues/53/comments?page=2")); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/test/java/com/spotify/github/jackson/Foo.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.jackson; 22 | 23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 25 | import com.spotify.github.GitHubInstant; 26 | import com.spotify.github.GithubStyle; 27 | import org.immutables.value.Value; 28 | 29 | @Value.Immutable 30 | @GithubStyle 31 | @JsonSerialize(as = ImmutableFoo.class) 32 | @JsonDeserialize(as = ImmutableFoo.class) 33 | public interface Foo { 34 | 35 | GitHubInstant longValue(); 36 | 37 | GitHubInstant instantValue(); 38 | } 39 | -------------------------------------------------------------------------------- /src/test/java/com/spotify/github/v3/activity/events/StatusEventTest.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-client 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.activity.events; 22 | 23 | import static com.google.common.io.Resources.getResource; 24 | import static java.nio.charset.Charset.defaultCharset; 25 | import static org.hamcrest.MatcherAssert.assertThat; 26 | import static org.hamcrest.core.Is.is; 27 | 28 | import com.google.common.io.Resources; 29 | import com.spotify.github.jackson.Json; 30 | import java.io.IOException; 31 | import org.junit.jupiter.api.Test; 32 | 33 | public class StatusEventTest { 34 | @Test 35 | public void testDeserialization() throws IOException { 36 | String fixture = 37 | Resources.toString( 38 | getResource(this.getClass(), "fixtures/status_event.json"), defaultCharset()); 39 | final StatusEvent statusEvent = Json.create().fromJson(fixture, StatusEvent.class); 40 | assertThat(statusEvent.context(), is("default")); 41 | assertThat(statusEvent.sha(), is("9049f1265b7d61be4a8904a9a27120d2064dab3b")); 42 | assertThat(statusEvent.state(), is("success")); 43 | } 44 | } -------------------------------------------------------------------------------- /src/test/java/com/spotify/github/v3/checks/AccessTokenTest.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-client 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.checks; 22 | 23 | import static org.hamcrest.CoreMatchers.is; 24 | import static org.hamcrest.MatcherAssert.assertThat; 25 | 26 | import com.spotify.github.FixtureHelper; 27 | import com.spotify.github.jackson.Json; 28 | import java.io.IOException; 29 | import java.time.ZonedDateTime; 30 | import org.junit.jupiter.api.Test; 31 | 32 | public class AccessTokenTest { 33 | private final Json json = Json.create(); 34 | 35 | @Test 36 | public void canDeserializeToken() throws IOException { 37 | final AccessToken accessToken = 38 | json.fromJson(FixtureHelper.loadFixture("checks/access-token.json"), AccessToken.class); 39 | assertThat(accessToken.token(), is("v1.1f699f1069f60xxx")); 40 | assertThat(accessToken.expiresAt(), is(ZonedDateTime.parse("2016-07-11T22:14:10Z"))); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/test/java/com/spotify/github/v3/checks/CheckRunOutputTest.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-client 4 | * -- 5 | * Copyright (C) 2016 - 2022 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.checks; 22 | 23 | import static org.junit.jupiter.api.Assertions.assertThrows; 24 | 25 | import com.spotify.github.v3.checks.ImmutableCheckRunOutput.Builder; 26 | import org.junit.jupiter.api.Test; 27 | 28 | public class CheckRunOutputTest { 29 | 30 | private Builder builder() { 31 | return ImmutableCheckRunOutput.builder(); 32 | } 33 | 34 | @Test 35 | public void allowsCreationWithinLimits() { 36 | builder().build(); 37 | builder() 38 | .text("t".repeat(65535)).summary("s".repeat(65535)).build(); 39 | } 40 | 41 | @Test 42 | public void failsCreationWhenMaxLengthExceeded() { 43 | assertThrows(IllegalStateException.class, 44 | () -> builder().text("t".repeat(65536)).build()); 45 | assertThrows(IllegalStateException.class, 46 | () -> builder().summary("s".repeat(65536)).build()); 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /src/test/java/com/spotify/github/v3/comment/CommentReactionContentTest.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | package com.spotify.github.v3.comment; 21 | 22 | import static org.junit.jupiter.api.Assertions.*; 23 | 24 | import com.fasterxml.jackson.databind.ObjectMapper; 25 | import org.junit.jupiter.params.ParameterizedTest; 26 | import org.junit.jupiter.params.provider.EnumSource; 27 | 28 | class CommentReactionContentTest { 29 | @ParameterizedTest 30 | @EnumSource(CommentReactionContent.class) 31 | public void testDeserialize(CommentReactionContent reaction) throws Exception { 32 | ObjectMapper mapper = new ObjectMapper(); 33 | 34 | String json = "\"" + reaction.toString() + "\""; 35 | 36 | CommentReactionContent content = mapper.readValue(json, CommentReactionContent.class); 37 | 38 | assertEquals(reaction, content); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/test/java/com/spotify/github/v3/prs/RequestReviewParametersTest.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.prs; 22 | 23 | import static org.hamcrest.MatcherAssert.assertThat; 24 | import static org.hamcrest.core.Is.is; 25 | 26 | import com.google.common.collect.ImmutableList; 27 | import com.spotify.github.jackson.Json; 28 | import org.junit.jupiter.api.Test; 29 | 30 | public class RequestReviewParametersTest { 31 | 32 | @Test 33 | public void testFullSerialize() { 34 | final RequestReviewParameters params = 35 | ImmutableRequestReviewParameters.builder() 36 | .reviewers(ImmutableList.of("foo", "bar")) 37 | .teamReviewers(ImmutableList.of("fox", "dog")) 38 | .build(); 39 | 40 | final String expected = "{" 41 | + "\"reviewers\":[\"foo\",\"bar\"]," 42 | + "\"team_reviewers\":[\"fox\",\"dog\"]" 43 | + "}"; 44 | 45 | assertThat( 46 | Json.create().toJsonUnchecked(params), 47 | is(expected)); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/test/java/com/spotify/github/v3/prs/ReviewTest.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-client 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.prs; 22 | 23 | import static com.google.common.io.Resources.getResource; 24 | import static java.nio.charset.Charset.defaultCharset; 25 | import static org.hamcrest.MatcherAssert.assertThat; 26 | import static org.hamcrest.core.Is.is; 27 | 28 | import com.google.common.io.Resources; 29 | import com.spotify.github.jackson.Json; 30 | import java.io.IOException; 31 | import org.junit.jupiter.api.Test; 32 | 33 | public class ReviewTest { 34 | @Test 35 | public void testDeserialization() throws IOException { 36 | String fixture = 37 | Resources.toString( 38 | getResource(this.getClass(), "review.json"), 39 | defaultCharset()); 40 | final Review review = 41 | Json.create().fromJson(fixture, Review.class); 42 | assertThat(review.state(), is(ReviewState.APPROVED)); 43 | assertThat(review.commitId(), is("ecdd80bb57125d7ba9641ffaa4d7d2c19d3f3091")); 44 | assertThat(review.id(), is(80)); 45 | } 46 | } -------------------------------------------------------------------------------- /src/test/java/com/spotify/github/v3/prs/requests/PullRequestParametersTest.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-api 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.prs.requests; 22 | 23 | import static org.hamcrest.MatcherAssert.assertThat; 24 | import static org.hamcrest.core.Is.is; 25 | 26 | import org.junit.jupiter.api.Test; 27 | 28 | public class PullRequestParametersTest { 29 | 30 | @Test 31 | public void testFullSerialize() { 32 | final PullRequestParameters params = 33 | ImmutablePullRequestParameters.builder() 34 | .base("bogus-base") 35 | .direction("bogus-direction") 36 | .head("bogus-head") 37 | .sort("bogus-sort") 38 | .state("bogus-state") 39 | .page(2) 40 | .per_page(5) 41 | .build(); 42 | 43 | assertThat( 44 | params.serialize(), 45 | is( 46 | "base=bogus-base&direction=bogus-direction&head=bogus-head&page=2" + 47 | "&per_page=5&sort=bogus-sort&state=bogus-state")); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/test/java/com/spotify/github/v3/repos/LanguagesTest.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * -\-\- 3 | * github-client 4 | * -- 5 | * Copyright (C) 2016 - 2020 Spotify AB 6 | * -- 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * -/-/- 19 | */ 20 | 21 | package com.spotify.github.v3.repos; 22 | 23 | import static com.google.common.io.Resources.getResource; 24 | import static java.nio.charset.Charset.defaultCharset; 25 | import static org.hamcrest.MatcherAssert.assertThat; 26 | import static org.hamcrest.core.Is.is; 27 | 28 | import com.google.common.io.Resources; 29 | import com.spotify.github.jackson.Json; 30 | import java.io.IOException; 31 | import org.junit.jupiter.api.Test; 32 | 33 | public class LanguagesTest { 34 | 35 | @Test 36 | public void testDeserialization() throws IOException { 37 | String fixture = 38 | Resources.toString(getResource(this.getClass(), "languages.json"), defaultCharset()); 39 | final Languages languages = Json.create().fromJson(fixture, Languages.class); 40 | assertThat(languages.get("Python"), is(7769)); 41 | assertThat(languages.get("C"), is(78769)); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/checks/checks-run-completed-request.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mighty_readme", 3 | "head_sha": "ce587453ced02b1526dfb4cb910479d431683101", 4 | "status": "completed", 5 | "started_at": "2017-11-30T19:39:10Z", 6 | "completed_at": "2017-11-30T19:49:10Z", 7 | "output": { 8 | "title": "Mighty Readme report", 9 | "summary": "There are 0 failures, 2 warnings, and 1 notices.", 10 | "text": "You may have some misspelled words on lines 2 and 4. You also may want to add a section in your README about how to install your app.", 11 | "annotations": [ 12 | { 13 | "path": "README.md", 14 | "annotation_level": "warning", 15 | "title": "Spell Checker", 16 | "message": "Check your spelling for 'banaas'.", 17 | "raw_details": "Do you mean 'bananas' or 'banana'?", 18 | "start_line": 2, 19 | "end_line": 2 20 | }, 21 | { 22 | "path": "README.md", 23 | "annotation_level": "warning", 24 | "title": "Spell Checker", 25 | "message": "Check your spelling for 'aples'", 26 | "raw_details": "Do you mean 'apples' or 'Naples'", 27 | "start_line": 4, 28 | "end_line": 4 29 | } 30 | ], 31 | "images": [ 32 | { 33 | "alt": "Super bananas", 34 | "image_url": "http://example.com/images/42" 35 | } 36 | ] 37 | }, 38 | "actions": [ 39 | { 40 | "label": "Fix", 41 | "identifier": "fix_errors", 42 | "description": "Allow us to fix these errors for you" 43 | } 44 | ] 45 | } -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/checks/checks-run-in-progress-request.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mighty_readme", 3 | "head_sha": "ce587453ced02b1526dfb4cb910479d431683101", 4 | "status": "in_progress", 5 | "external_id": "42", 6 | "started_at": "2018-05-04T01:14:52Z", 7 | "output": { 8 | "title": "Mighty Readme report", 9 | "summary": "", 10 | "text": "" 11 | } 12 | } -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/clients/annotated-tag.json: -------------------------------------------------------------------------------- 1 | { 2 | "node_id": "MDM6VGFnODc0MTU6ODI3MjEwNjI1YjU1MTIwMGU3ZDNkYzYwODkzNWIxNDU0NTIzZWFhOA==", 3 | "sha": "827210625b551200e7d3dc608935b1454523eaa8", 4 | "url": "https://github.com/api/v3/repos/golden-path-wilson/data-gp-workshop-wilson/git/tags/827210625b551200e7d3dc608935b1454523eaa8", 5 | "tagger": { 6 | "name": "Tasnim Rahman", 7 | "email": "tasnimr@spotify.com", 8 | "date": "2018-12-28T21:44:33Z" 9 | }, 10 | "object": { 11 | "sha": "ee959eb71f7041260dc864fb24574eec4caa8019", 12 | "type": "commit", 13 | "url": "https://github.com/api/v3/repos/golden-path-wilson/data-gp-workshop-wilson/git/commits/ee959eb71f7041260dc864fb24574eec4caa8019" 14 | }, 15 | "tag": "v7.0.0", 16 | "message": "7.0.0\n", 17 | "verification": { 18 | "verified": false, 19 | "reason": "unsigned", 20 | "signature": null, 21 | "payload": null 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/clients/branch.json: -------------------------------------------------------------------------------- 1 | { 2 | "ref": "refs/heads/featureA", 3 | "node_id": "MDM6UmVmcmVmcy9oZWFkcy9mZWF0dXJlQQ==", 4 | "url": "https://api.github.com/repos/octocat/Hello-World/git/refs/heads/featureA", 5 | "object": { 6 | "type": "commit", 7 | "sha": "aa218f56b14c9653891f9e74264a383fa43fefbd", 8 | "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd" 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/clients/comment_created.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 114, 3 | "url": "https://api.github.com/repos/octocat/Hello-World/issues/comments/1", 4 | "html_url": "https://github.com/octocat/Hello-World/issues/1347#issuecomment-1", 5 | "body": "Me too", 6 | "user": { 7 | "login": "octocat", 8 | "id": 1, 9 | "avatar_url": "https://github.com/images/error/octocat_happy.gif", 10 | "gravatar_id": "", 11 | "url": "https://api.github.com/users/octocat", 12 | "html_url": "https://github.com/octocat", 13 | "followers_url": "https://api.github.com/users/octocat/followers", 14 | "following_url": "https://api.github.com/users/octocat/following{/other_user}", 15 | "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", 16 | "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", 17 | "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", 18 | "organizations_url": "https://api.github.com/users/octocat/orgs", 19 | "repos_url": "https://api.github.com/users/octocat/repos", 20 | "events_url": "https://api.github.com/users/octocat/events{/privacy}", 21 | "received_events_url": "https://api.github.com/users/octocat/received_events", 22 | "type": "User", 23 | "site_admin": false 24 | }, 25 | "created_at": "2011-04-14T16:00:49Z", 26 | "updated_at": "2011-04-14T16:00:49Z" 27 | } -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/clients/diff.txt: -------------------------------------------------------------------------------- 1 | diff --git a/filename b/filename 2 | index 01a9f34..500bb03 100644 3 | --- a/nf 4 | +++ b/nf 5 | @@ -1,3 +1,4 @@ 6 | asdf 7 | +asdf 8 | -- 9 | 2.39.0 -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/clients/list_members_page1.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "login": "octocat", 4 | "id": 1, 5 | "node_id": "MDQ6VXNlcjE=", 6 | "avatar_url": "https://github.com/images/error/octocat_happy.gif", 7 | "gravatar_id": "", 8 | "url": "https://api.github.com/users/octocat", 9 | "html_url": "https://github.com/octocat", 10 | "followers_url": "https://api.github.com/users/octocat/followers", 11 | "following_url": "https://api.github.com/users/octocat/following{/other_user}", 12 | "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", 13 | "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", 14 | "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", 15 | "organizations_url": "https://api.github.com/users/octocat/orgs", 16 | "repos_url": "https://api.github.com/users/octocat/repos", 17 | "events_url": "https://api.github.com/users/octocat/events{/privacy}", 18 | "received_events_url": "https://api.github.com/users/octocat/received_events", 19 | "type": "User", 20 | "site_admin": false 21 | } 22 | ] -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/clients/list_members_page2.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "login": "octocat2", 4 | "id": 2, 5 | "node_id": "MDQ2VXNlcjE=", 6 | "avatar_url": "https://github.com/images/error/octocat2_happy.gif", 7 | "gravatar_id": "", 8 | "url": "https://api.github.com/users/octocat2", 9 | "html_url": "https://github.com/octocat2", 10 | "followers_url": "https://api.github.com/users/octocat2/followers", 11 | "following_url": "https://api.github.com/users/octoca2t/following{/other_user}", 12 | "gists_url": "https://api.github.com/users/octocat2/gists{/gist_id}", 13 | "starred_url": "https://api.github.com/users/octocat2/starred{/owner}{/repo}", 14 | "subscriptions_url": "https://api.github.com/users/octocat2/subscriptions", 15 | "organizations_url": "https://api.github.com/users/octocat2/orgs", 16 | "repos_url": "https://api.github.com/users/octocat2/repos", 17 | "events_url": "https://api.github.com/users/octocat2/events{/privacy}", 18 | "received_events_url": "https://api.github.com/users/octocat2/received_events", 19 | "type": "User", 20 | "site_admin": false 21 | } 22 | ] -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/clients/membership.json: -------------------------------------------------------------------------------- 1 | { 2 | "url": "https://api.github.com/teams/1/memberships/octocat", 3 | "role": "maintainer", 4 | "state": "active" 5 | } -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/clients/membership_update.json: -------------------------------------------------------------------------------- 1 | { 2 | "role": "member" 3 | } -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/clients/membership_update_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "url": "https://api.github.com/teams/1/memberships/octocat", 3 | "role": "member", 4 | "state": "active" 5 | } -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/clients/patch.txt: -------------------------------------------------------------------------------- 1 | From 81c53612268423500bb086afbf7f6545a97ce181 Thu Jul 17 00:00:00 2000 2 | From: Spotify 3 | Date: Thu, 17 Jul 2023 22:12:00 -0700 4 | Subject: [PATCH] Update filename 5 | 6 | --- 7 | filename | 1 + 8 | 1 file changed, 1 insertion(+) 9 | 10 | diff --git a/filename b/filename 11 | index 01a9f34..500bb03 100644 12 | --- a/nf 13 | +++ b/nf 14 | @@ -1,3 +1,4 @@ 15 | asdf 16 | +asdf 17 | -- 18 | 2.39.0 -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/clients/reference.json: -------------------------------------------------------------------------------- 1 | { 2 | "ref": "featureA", 3 | "node_id": "MDM6UmVmcmVmcy9oZWFkcy9mZWF0dXJlQQ==", 4 | "url": "https://api.github.com/repos/octocat/Hello-World/git/featureA", 5 | "object": { 6 | "type": "commit", 7 | "sha": "aa218f56b14c9653891f9e74264a383fa43fefbd", 8 | "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/clients/reference_list.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ref": "refs/heads/feature-a", 4 | "node_id": "MDM6UmVmcmVmcy9oZWFkcy9mZWF0dXJlLWE=", 5 | "url": "https://api.github.com/repos/octocat/Hello-World/git/refs/heads/feature-a", 6 | "object": { 7 | "type": "commit", 8 | "sha": "aa218f56b14c9653891f9e74264a383fa43fefbd", 9 | "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd" 10 | } 11 | }, 12 | { 13 | "ref": "refs/heads/feature-b", 14 | "node_id": "MDM6UmVmcmVmcy9oZWFkcy9mZWF0dXJlLWI=", 15 | "url": "https://api.github.com/repos/octocat/Hello-World/git/refs/heads/feature-b", 16 | "object": { 17 | "type": "commit", 18 | "sha": "612077ae6dffb4d2fbd8ce0cccaa58893b07b5ac", 19 | "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/612077ae6dffb4d2fbd8ce0cccaa58893b07b5ac" 20 | } 21 | } 22 | ] -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/clients/release-tag.json: -------------------------------------------------------------------------------- 1 | { 2 | "node_id": "MDM6VGFnODc0MTU6ODI3MjEwNjI1YjU1MTIwMGU3ZDNkYzYwODkzNWIxNDU0NTIzZWFhOA==", 3 | "sha": "827210625b551200e7d3dc608935b1454523eaa8", 4 | "url": "https://github.com/api/v3/repos/someowner/somerepo/git/tags/827210625b551200e7d3dc608935b1454523eaa8", 5 | "tagger": { 6 | "name": "tingle", 7 | "email": "janedoe@foo.com", 8 | "date": "2018-12-28T21:44:33Z" 9 | }, 10 | "object": { 11 | "sha": "5926dd300de5fee31d445c57be223f00e128a634", 12 | "type": "commit", 13 | "url": "https://github.com/api/v3/repos/someowner/somerepo/git/commits/5926dd300de5fee31d445c57be223f00e128a634" 14 | }, 15 | "tag": "1.0.0", 16 | "message": "7.0.0\n", 17 | "verification": { 18 | "verified": false, 19 | "reason": "unsigned", 20 | "signature": null, 21 | "payload": null 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/clients/requestedReviews.json: -------------------------------------------------------------------------------- 1 | { 2 | "users": [ 3 | { 4 | "login": "octocat", 5 | "id": 1, 6 | "node_id": "MDQ6VXNlcjE=", 7 | "avatar_url": "https://github.com/images/error/octocat_happy.gif", 8 | "gravatar_id": "", 9 | "url": "https://api.github.com/users/octocat", 10 | "html_url": "https://github.com/octocat", 11 | "followers_url": "https://api.github.com/users/octocat/followers", 12 | "following_url": "https://api.github.com/users/octocat/following{/other_user}", 13 | "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", 14 | "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", 15 | "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", 16 | "organizations_url": "https://api.github.com/users/octocat/orgs", 17 | "repos_url": "https://api.github.com/users/octocat/repos", 18 | "events_url": "https://api.github.com/users/octocat/events{/privacy}", 19 | "received_events_url": "https://api.github.com/users/octocat/received_events", 20 | "type": "User", 21 | "site_admin": false 22 | } 23 | ], 24 | "teams": [ 25 | { 26 | "id": 1, 27 | "node_id": "MDQ6VGVhbTE=", 28 | "url": "https://api.github.com/teams/1", 29 | "html_url": "https://api.github.com/teams/justice-league", 30 | "name": "Justice League", 31 | "slug": "justice-league", 32 | "description": "A great team.", 33 | "privacy": "closed", 34 | "permission": "admin", 35 | "members_url": "https://api.github.com/teams/1/members{/member}", 36 | "repositories_url": "https://api.github.com/teams/1/repos", 37 | "parent": null 38 | } 39 | ] 40 | } -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/clients/shalink.json: -------------------------------------------------------------------------------- 1 | { 2 | "sha": "8fc4e0fe57752b892a921806a1352e4cc72dff37", 3 | "url": "https://github.com/octocat/Hello-World/repos/someowner/somerepo/git/blobs/8fc4e0fe57752b892a921806a1352e4cc72dff37" 4 | } 5 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/clients/tag.json: -------------------------------------------------------------------------------- 1 | { 2 | "ref": "refs/tags/0.0.1", 3 | "url": "https://github.com/api/v3/repos/someorg/somerepo/git/refs/tags/0.0.1", 4 | "object": { 5 | "sha": "5926dd300de5fee31d445c57be223f00e128a634", 6 | "type": "commit", 7 | "url": "https://github.com/api/v3/repos/someorg/somerepo/git/commits/5926dd300de5fee31d445c57be223f00e128a634" 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/clients/tags_list.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ref": "refs/tags/v0.0.1", 4 | "node_id": "MDM6UmVmcmVmcy90YWdzL3YwLjAuMQ==", 5 | "url": "https://api.github.com/repos/octocat/Hello-World/git/refs/tags/v0.0.1", 6 | "object": { 7 | "type": "tag", 8 | "sha": "940bd336248efae0f9ee5bc7b2d5c985887b16ac", 9 | "url": "https://api.github.com/repos/octocat/Hello-World/git/tags/940bd336248efae0f9ee5bc7b2d5c985887b16ac" 10 | } 11 | } 12 | ] -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/clients/teams_patch.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Justice League2" 3 | } -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/clients/teams_request.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Justice League" 3 | } -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/clients/tree.json: -------------------------------------------------------------------------------- 1 | { 2 | "sha": "9c27bd92524e2b57b569d4c86695b3993d9b8f9f", 3 | "url": "https://ghe.spotify.net/api/v3/repos/ugc-sharing/test-repo/git/trees/9c27bd92524e2b57b569d4c86695b3993d9b8f9f", 4 | "tree": [ 5 | { 6 | "path": "README.md", 7 | "mode": "100644", 8 | "type": "blob", 9 | "sha": "6e091fd045dc88806e5c70357326af7fa0e1ccde", 10 | "size": 12, 11 | "url": "https://ghe.spotify.net/api/v3/repos/ugc-sharing/test-repo/git/blobs/6e091fd045dc88806e5c70357326af7fa0e1ccde" 12 | }, 13 | { 14 | "path": "UserGeneratedContentUtils.java", 15 | "mode": "100644", 16 | "type": "blob", 17 | "sha": "77b3e188803e717a0a5ce53b818b0ed6fb6b8a23", 18 | "size": 5340, 19 | "url": "https://ghe.spotify.net/api/v3/repos/ugc-sharing/test-repo/git/blobs/77b3e188803e717a0a5ce53b818b0ed6fb6b8a23" 20 | }, 21 | { 22 | "path": "readme.md", 23 | "mode": "100644", 24 | "type": "blob", 25 | "sha": "f09eac953086b8760f600822f057141d7b311165", 26 | "size": 29, 27 | "url": "https://ghe.spotify.net/api/v3/repos/ugc-sharing/test-repo/git/blobs/f09eac953086b8760f600822f057141d7b311165" 28 | }, 29 | { 30 | "path": "src", 31 | "mode": "040000", 32 | "type": "tree", 33 | "sha": "26cd96e1394d6c4982d8cec879ad4fefa423bec8", 34 | "url": "https://ghe.spotify.net/api/v3/repos/ugc-sharing/test-repo/git/trees/26cd96e1394d6c4982d8cec879ad4fefa423bec8" 35 | } 36 | ], 37 | "truncated": false 38 | } 39 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/comment/comment.json: -------------------------------------------------------------------------------- 1 | { 2 | "html_url": "https://github.com/octocat/Hello-World/commit/6dcb09b5b57875f334f61aebed695e2e4193db5e#commitcomment-1", 3 | "url": "https://api.github.com/repos/octocat/Hello-World/comments/1", 4 | "id": 123, 5 | "node_id": "MDEzOkNvbW1pdENvbW1lbnQx", 6 | "body": "Great stuff", 7 | "path": "file1.txt", 8 | "position": 4, 9 | "line": 14, 10 | "commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e", 11 | "user": { 12 | "login": "octocat", 13 | "id": 1, 14 | "node_id": "MDQ6VXNlcjE=", 15 | "avatar_url": "https://github.com/images/error/octocat_happy.gif", 16 | "gravatar_id": "", 17 | "url": "https://api.github.com/users/octocat", 18 | "html_url": "https://github.com/octocat", 19 | "followers_url": "https://api.github.com/users/octocat/followers", 20 | "following_url": "https://api.github.com/users/octocat/following{/other_user}", 21 | "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", 22 | "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", 23 | "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", 24 | "organizations_url": "https://api.github.com/users/octocat/orgs", 25 | "repos_url": "https://api.github.com/users/octocat/repos", 26 | "events_url": "https://api.github.com/users/octocat/events{/privacy}", 27 | "received_events_url": "https://api.github.com/users/octocat/received_events", 28 | "type": "User", 29 | "site_admin": false 30 | }, 31 | "created_at": "2011-04-14T16:00:49Z", 32 | "updated_at": "2011-04-14T16:00:49Z" 33 | } 34 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/git/reference.json: -------------------------------------------------------------------------------- 1 | { 2 | "ref": "refs/heads/featureA", 3 | "url": "https://api.github.com/repos/octocat/Hello-World/git/refs/heads/featureA", 4 | "object": { 5 | "type": "commit", 6 | "sha": "aa218f56b14c9653891f9e74264a383fa43fefbd", 7 | "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/git/tree.json: -------------------------------------------------------------------------------- 1 | { 2 | "sha": "9c27bd92524e2b57b569d4c86695b3993d9b8f9f", 3 | "url": "https://ghe.spotify.net/api/v3/repos/ugc-sharing/test-repo/git/trees/9c27bd92524e2b57b569d4c86695b3993d9b8f9f", 4 | "tree": [ 5 | { 6 | "path": "README.md", 7 | "mode": "100644", 8 | "type": "blob", 9 | "sha": "6e091fd045dc88806e5c70357326af7fa0e1ccde", 10 | "size": 12, 11 | "url": "https://ghe.spotify.net/api/v3/repos/ugc-sharing/test-repo/git/blobs/6e091fd045dc88806e5c70357326af7fa0e1ccde" 12 | }, 13 | { 14 | "path": "UserGeneratedContentUtils.java", 15 | "mode": "100644", 16 | "type": "blob", 17 | "sha": "77b3e188803e717a0a5ce53b818b0ed6fb6b8a23", 18 | "size": 5340, 19 | "url": "https://ghe.spotify.net/api/v3/repos/ugc-sharing/test-repo/git/blobs/77b3e188803e717a0a5ce53b818b0ed6fb6b8a23" 20 | }, 21 | { 22 | "path": "readme.md", 23 | "mode": "100644", 24 | "type": "blob", 25 | "sha": "f09eac953086b8760f600822f057141d7b311165", 26 | "size": 29, 27 | "url": "https://ghe.spotify.net/api/v3/repos/ugc-sharing/test-repo/git/blobs/f09eac953086b8760f600822f057141d7b311165" 28 | }, 29 | { 30 | "path": "src", 31 | "mode": "040000", 32 | "type": "tree", 33 | "sha": "26cd96e1394d6c4982d8cec879ad4fefa423bec8", 34 | "url": "https://ghe.spotify.net/api/v3/repos/ugc-sharing/test-repo/git/trees/26cd96e1394d6c4982d8cec879ad4fefa423bec8" 35 | } 36 | ], 37 | "truncated": false 38 | } 39 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/git/treeItem.json: -------------------------------------------------------------------------------- 1 | { 2 | "path": "README.md", 3 | "mode": "100644", 4 | "type": "blob", 5 | "sha": "6e091fd045dc88806e5c70357326af7fa0e1ccde", 6 | "size": 12, 7 | "url": "https://github.com/octocat/Hello-World/repos/someowner/somerepo/git/blobs/6e091fd045dc88806e5c70357326af7fa0e1ccde" 8 | } 9 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/github-private-key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spotify/github-java-client/ae3cb1927f582bf3c72e001daa4b69109d4509e3/src/test/resources/com/spotify/github/v3/github-private-key -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/githubapp/installation.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 1, 3 | "account": { 4 | "login": "github", 5 | "id": 1, 6 | "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=", 7 | "url": "https://api.github.com/orgs/github", 8 | "repos_url": "https://api.github.com/orgs/github/repos", 9 | "events_url": "https://api.github.com/orgs/github/events", 10 | "hooks_url": "https://api.github.com/orgs/github/hooks", 11 | "issues_url": "https://api.github.com/orgs/github/issues", 12 | "members_url": "https://api.github.com/orgs/github/members{/member}", 13 | "public_members_url": "https://api.github.com/orgs/github/public_members{/member}", 14 | "avatar_url": "https://github.com/images/error/octocat_happy.gif", 15 | "description": "A great organization" 16 | }, 17 | "access_tokens_url": "https://api.github.com/installations/1/access_tokens", 18 | "repositories_url": "https://api.github.com/installation/repositories", 19 | "html_url": "https://github.com/organizations/github/settings/installations/1", 20 | "app_id": 1, 21 | "target_id": 1, 22 | "target_type": "Organization", 23 | "permissions": { 24 | "metadata": "read", 25 | "contents": "read", 26 | "issues": "write", 27 | "single_file": "write" 28 | }, 29 | "events": [ 30 | "push", 31 | "pull_request" 32 | ], 33 | "single_file_name": "config.yml" 34 | } -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/githubapp/key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEowIBAAKCAQEApAmDiEfT9LCMnAbF6kk2do01WCUApwFErjOneNOxtBeGuxjj 3 | xaQlVf9swNqQNxQGzipWZxjHBL1A5wvtLKVSKGog7N5d8Ti0mOet3UdPb5vsrq4s 4 | ehGpIgPAaIpGSh2K6lB9+qFXlsvKz7uBuDjesm84KWQW+HXzzdGYD0GyuNu+9BBz 5 | X1U9C28WkAIqabPsvS22tOVtVALhXFJoRPsac47jCczlPWT7b2nbkaJKe6QR7HcL 6 | 2gKVDyZOnFNCurD5KLFN+I5NzAQda2Wi4P0BCrgRH20i2gyontgHfG70qBNwgw2g 7 | 629AbTWEf8rOrbV0wicZ1i/zolIoU/0Wtg0hVQIDAQABAoIBAFTyxFYH9IDsCPUo 8 | IMhSf8znFa//AZZ69qlMALd20bkU0eYEXrhUaC1f6F77EOIlEd0kWbhsQWx34auF 9 | Jp8PQjvBsilYgsfP+N6SZByKuF1xHyHa+xeAG9mMndDFgt8Q64aqhoMLmMNz6CSp 10 | 0uSnNtSq+iedOLQUyVxV5WxJNpe6CKbab7JkuToW7p3CHU3N+N0DmPvpZKmHFTrU 11 | VK+ZvgCmoOj5UPuAZ8XhhRAjKeg2Od9nthOqgVHbEgRMUgPy/aAk+R1OXvE5tmBA 12 | IGnCHkF8DgzFVlQcty5R7PbwxbcsC1/eLrogpMh04/uOHqYNWNYDdhcbEjl4cOHS 13 | c4ti00ECgYEAz5cx/3D0+N4atJNwAGREbrPuyZZTq/+i6DEp6edg5ZXSKKpL5u5v 14 | IAoqkbNjxuvoGv3TksjD9bzx+mZ3H52QnUEvajUrFl5vrG4/g/2lRO/2BNf4/nag 15 | czWP1Hh8ZlLJ6dIbQ1+YIoR+HLGZ8Yo0AI3WAWXCR/Pf+s7UsoQtRyUCgYEAykpA 16 | lweefa2oEu5sI8Ld8EoJRfbDLBfQhBCl5hL4IG/YyoSZLxcMlPMklFO/GSCvnbtq 17 | 5a7T0mgg+Ya9iHdewegTfTzHsbehrLjCwo5E9dVrwK1wXMS74ACR79yRWFlFje7e 18 | v9A6uNr/jtgnglATtHXB0vEWUiKSeVrcqj1lsnECgYBLfRfZZCIxPdNIRzU7bzrT 19 | Zus2s0vKCDQda4NqY5GA63J5BzSCzcHrTMceJLXr6G2HIzaE8i0Qd50nCYvYG1wz 20 | UzkCzkLU55KEibLfNKWc5AX6zO7m2gyO2LNs+EOEkiaKuLThUynno3aYyJzKkQ9I 21 | BEwGRhLYR37znbMLF7W/YQKBgQCnEXgSxBojlf6P1BW/2zrNL3hFLi23BtwRlmZN 22 | hDElKPqVF7oj6BdeFQmK7zeOmy4vSRBaLW+IALPrIVr7kArUfsVJ057hqdV+/wDr 23 | CfDuT5s0gImiNGEt+YqN3U609tW5CSUyqdk1vrj90oue1l/P1MmFW9Ohdigezeod 24 | N6P8IQKBgGyHtrhwmqVdFqCwNZH0P8uyiz0CnbCjLSP1mMy/L30g6vqwXj+KsXhH 25 | lEcPvgQCeU9mf24jjzHSGTseUDXSyKrtgI3X5iaIudemDfnZUDTFw31DNkq2+eW5 26 | 6ONmTnzyuw/qK71IKjHBNXlTL6ACtI0o776clWxk5tuH9nJ+d/DD 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/hooks/requests/create.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "web", 3 | "active": true, 4 | "events": [ 5 | "push", 6 | "pull_request" 7 | ], 8 | "config": { 9 | "url": "http://example.com/webhook", 10 | "content_type": "json" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/hooks/webhook.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 1, 3 | "url": "https://api.github.com/repos/octocat/Hello-World/hooks/1", 4 | "test_url": "https://api.github.com/repos/octocat/Hello-World/hooks/1/test", 5 | "ping_url": "https://api.github.com/repos/octocat/Hello-World/hooks/1/pings", 6 | "name": "web", 7 | "events": [ 8 | "push", 9 | "pull_request" 10 | ], 11 | "active": true, 12 | "config": { 13 | "url": "http://example.com/webhook", 14 | "content_type": "json" 15 | }, 16 | "updated_at": "2011-09-06T20:39:23Z", 17 | "created_at": "2011-09-06T17:26:27Z" 18 | } 19 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/milestone.json: -------------------------------------------------------------------------------- 1 | { 2 | "url": "https://api.github.com/repos/octocat/Hello-World/milestones/1", 3 | "html_url": "https://github.com/octocat/Hello-World/milestones/v1.0", 4 | "labels_url": "https://api.github.com/repos/octocat/Hello-World/milestones/1/labels", 5 | "id": 1002604, 6 | "number": 1, 7 | "state": "open", 8 | "title": "v1.0", 9 | "description": "Tracking milestone for version 1.0", 10 | "creator": { 11 | "login": "octocat", 12 | "id": 1, 13 | "avatar_url": "https://github.com/images/error/octocat_happy.gif", 14 | "gravatar_id": "", 15 | "url": "https://api.github.com/users/octocat", 16 | "html_url": "https://github.com/octocat", 17 | "followers_url": "https://api.github.com/users/octocat/followers", 18 | "following_url": "https://api.github.com/users/octocat/following{/other_user}", 19 | "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", 20 | "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", 21 | "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", 22 | "organizations_url": "https://api.github.com/users/octocat/orgs", 23 | "repos_url": "https://api.github.com/users/octocat/repos", 24 | "events_url": "https://api.github.com/users/octocat/events{/privacy}", 25 | "received_events_url": "https://api.github.com/users/octocat/received_events", 26 | "type": "User", 27 | "site_admin": false 28 | }, 29 | "open_issues": 4, 30 | "closed_issues": 8, 31 | "created_at": "2011-04-10T20:09:31Z", 32 | "updated_at": "2014-03-03T18:58:10Z", 33 | "closed_at": "2013-02-12T13:22:01Z", 34 | "due_on": "2012-10-09T23:39:01Z" 35 | } -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/prs/comment.json: -------------------------------------------------------------------------------- 1 | { 2 | "url": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1", 3 | "id": 1, 4 | "diff_hunk": "@@ -16,33 +16,40 @@ public class Connection : IConnection...", 5 | "path": "file1.txt", 6 | "position": 1, 7 | "original_position": 4, 8 | "commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e", 9 | "original_commit_id": "9c48853fa3dc5c1c3d6f1f1cd1f2743e72652840", 10 | "user": { 11 | "login": "octocat", 12 | "id": 1, 13 | "avatar_url": "https://github.com/images/error/octocat_happy.gif", 14 | "gravatar_id": "", 15 | "url": "https://api.github.com/users/octocat", 16 | "html_url": "https://github.com/octocat", 17 | "followers_url": "https://api.github.com/users/octocat/followers", 18 | "following_url": "https://api.github.com/users/octocat/following{/other_user}", 19 | "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", 20 | "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", 21 | "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", 22 | "organizations_url": "https://api.github.com/users/octocat/orgs", 23 | "repos_url": "https://api.github.com/users/octocat/repos", 24 | "events_url": "https://api.github.com/users/octocat/events{/privacy}", 25 | "received_events_url": "https://api.github.com/users/octocat/received_events", 26 | "type": "User", 27 | "site_admin": false 28 | }, 29 | "body": "Great stuff", 30 | "created_at": "2011-04-14T16:00:49Z", 31 | "updated_at": "2011-04-14T16:00:49Z", 32 | "html_url": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1", 33 | "pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1" 34 | } 35 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/prs/create_review.json: -------------------------------------------------------------------------------- 1 | { 2 | "commit_id": "some_commit_id", 3 | "body": "some_approval_comment", 4 | "event": "APPROVE", 5 | "comments": [ 6 | { 7 | "path": "some_file.txt", 8 | "position": 2, 9 | "body": "some_comment_on_file.txt" 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/prs/merge_params_full.json: -------------------------------------------------------------------------------- 1 | { 2 | "commit_title": "a title", 3 | "commit_message": "a message", 4 | "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e", 5 | "merge_method": "merge" 6 | } 7 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/prs/requests/create.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Amazing new feature", 3 | "body": "Please pull this in!", 4 | "head": "octocat:new-feature", 5 | "base": "master" 6 | } -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/prs/requests/update.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "new title", 3 | "body": "updated body", 4 | "state": "open" 5 | } -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/prs/required_reviews.json: -------------------------------------------------------------------------------- 1 | { 2 | "users": [ 3 | { 4 | "login": "octocat", 5 | "id": 1, 6 | "avatar_url": "https://github.com/images/error/octocat_happy.gif", 7 | "gravatar_id": "", 8 | "url": "https://api.github.com/users/octocat", 9 | "html_url": "https://github.com/octocat", 10 | "followers_url": "https://api.github.com/users/octocat/followers", 11 | "following_url": "https://api.github.com/users/octocat/following{/other_user}", 12 | "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", 13 | "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", 14 | "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", 15 | "organizations_url": "https://api.github.com/users/octocat/orgs", 16 | "repos_url": "https://api.github.com/users/octocat/repos", 17 | "events_url": "https://api.github.com/users/octocat/events{/privacy}", 18 | "received_events_url": "https://api.github.com/users/octocat/received_events", 19 | "type": "User", 20 | "site_admin": false 21 | } 22 | ], 23 | "teams": [ 24 | { 25 | "id": 1, 26 | "node_id": "MDQ6VGVhbTE=", 27 | "url": "https://api.github.com/teams/1", 28 | "html_url": "https://api.github.com/teams/justice-league", 29 | "name": "Justice League", 30 | "slug": "justice-league", 31 | "description": "A great team.", 32 | "privacy": "closed", 33 | "permission": "admin", 34 | "members_url": "https://api.github.com/teams/1/members{/member}", 35 | "repositories_url": "https://api.github.com/teams/1/repos", 36 | "parent": null 37 | } 38 | ] 39 | } 40 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/prs/review.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 80, 3 | "node_id": "MDE3OlB1bGxSZXF1ZXN0UmV2aWV3ODA=", 4 | "user": { 5 | "login": "octocat", 6 | "id": 1, 7 | "node_id": "MDQ6VXNlcjE=", 8 | "avatar_url": "https://github.com/images/error/octocat_happy.gif", 9 | "gravatar_id": "", 10 | "url": "https://api.github.com/users/octocat", 11 | "html_url": "https://github.com/octocat", 12 | "followers_url": "https://api.github.com/users/octocat/followers", 13 | "following_url": "https://api.github.com/users/octocat/following{/other_user}", 14 | "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", 15 | "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", 16 | "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", 17 | "organizations_url": "https://api.github.com/users/octocat/orgs", 18 | "repos_url": "https://api.github.com/users/octocat/repos", 19 | "events_url": "https://api.github.com/users/octocat/events{/privacy}", 20 | "received_events_url": "https://api.github.com/users/octocat/received_events", 21 | "type": "User", 22 | "site_admin": false 23 | }, 24 | "body": "Here is the body for the review.", 25 | "submitted_at": "2019-11-17T17:43:43Z", 26 | "commit_id": "ecdd80bb57125d7ba9641ffaa4d7d2c19d3f3091", 27 | "state": "APPROVED", 28 | "html_url": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80", 29 | "pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/12", 30 | "_links": { 31 | "html": { 32 | "href": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80" 33 | }, 34 | "pull_request": { 35 | "href": "https://api.github.com/repos/octocat/Hello-World/pulls/12" 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/repos/branch-escape-chars-url-variation-two.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "unescaped-percent-sign-%", 3 | "commit": { 4 | "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e", 5 | "url": "https://api.github.com/repos/octocat/Hello-World/commits/c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc" 6 | }, 7 | "protected": true, 8 | "protection_url": "https://api.github.com/api/v3/repos/octocat/Hello-World/branches/branch-name-with-slashes/unescaped-percent-sign-%/protection" 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/repos/branch-escape-chars.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "unescaped-percent-sign-%", 3 | "commit": { 4 | "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e", 5 | "url": "https://api.github.com/repos/octocat/Hello-World/commits/c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc" 6 | }, 7 | "protected": true, 8 | "protection_url": "https://api.github.com/repos/octocat/Hello-World/branches/unescaped-percent-sign-%/protection" 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/repos/branch-no-protection-fields.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "master", 3 | "commit": { 4 | "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e", 5 | "url": "https://api.github.com/repos/octocat/Hello-World/commits/c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/repos/branch-not-protected.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "master", 3 | "commit": { 4 | "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e", 5 | "url": "https://api.github.com/repos/octocat/Hello-World/commits/c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc" 6 | }, 7 | "protected": false 8 | } 9 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/repos/branch.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "master", 3 | "commit": { 4 | "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e", 5 | "url": "https://api.github.com/repos/octocat/Hello-World/commits/c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc" 6 | }, 7 | "protected": true, 8 | "protection": { 9 | "enabled": true, 10 | "required_status_checks": { 11 | "enforcement_level": "non_admins", 12 | "contexts": [ 13 | "Context 1", 14 | "Context 2" 15 | ] 16 | } 17 | }, 18 | "protection_url": "https://api.github.com/repos/octocat/Hello-World/branches/master/protection" 19 | } 20 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/repos/comment.json: -------------------------------------------------------------------------------- 1 | { 2 | "html_url": "https://github.com/octocat/Hello-World/commit/6dcb09b5b57875f334f61aebed695e2e4193db5e#commitcomment-1", 3 | "url": "https://api.github.com/repos/octocat/Hello-World/comments/1", 4 | "id": 123, 5 | "node_id": "MDEzOkNvbW1pdENvbW1lbnQx", 6 | "body": "Great stuff", 7 | "path": "file1.txt", 8 | "position": 4, 9 | "line": 14, 10 | "commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e", 11 | "user": { 12 | "login": "octocat", 13 | "id": 1, 14 | "node_id": "MDQ6VXNlcjE=", 15 | "avatar_url": "https://github.com/images/error/octocat_happy.gif", 16 | "gravatar_id": "", 17 | "url": "https://api.github.com/users/octocat", 18 | "html_url": "https://github.com/octocat", 19 | "followers_url": "https://api.github.com/users/octocat/followers", 20 | "following_url": "https://api.github.com/users/octocat/following{/other_user}", 21 | "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", 22 | "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", 23 | "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", 24 | "organizations_url": "https://api.github.com/users/octocat/orgs", 25 | "repos_url": "https://api.github.com/users/octocat/repos", 26 | "events_url": "https://api.github.com/users/octocat/events{/privacy}", 27 | "received_events_url": "https://api.github.com/users/octocat/received_events", 28 | "type": "User", 29 | "site_admin": false 30 | }, 31 | "created_at": "2011-04-14T16:00:49Z", 32 | "updated_at": "2011-04-14T16:00:49Z" 33 | } 34 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/repos/content.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "file", 3 | "encoding": "base64", 4 | "size": 5362, 5 | "name": "README.md", 6 | "path": "README.md", 7 | "content": "encoded content ...", 8 | "sha": "3d21ec53a331a6f037a91c368710b99387d012c1", 9 | "url": "https://api.github.com/repos/octokit/octokit.rb/contents/README.md", 10 | "git_url": "https://api.github.com/repos/octokit/octokit.rb/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1", 11 | "html_url": "https://github.com/octokit/octokit.rb/blob/master/README.md", 12 | "download_url": "https://raw.githubusercontent.com/octokit/octokit.rb/master/README.md", 13 | "_links": { 14 | "git": "https://api.github.com/repos/octokit/octokit.rb/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1", 15 | "self": "https://api.github.com/repos/octokit/octokit.rb/contents/README.md", 16 | "html": "https://github.com/octokit/octokit.rb/blob/master/README.md" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/repos/create-content-request.json: -------------------------------------------------------------------------------- 1 | { 2 | "message": "my commit message", 3 | "content": "encoded content ..." 4 | } -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/repos/deployment.json: -------------------------------------------------------------------------------- 1 | { 2 | "url": "https://api.github.com/repos/octocat/example/deployments/1", 3 | "id": 1, 4 | "sha": "a84d88e7554fc1fa21bcbc4efae3c782a70d2b9d", 5 | "ref": "master", 6 | "task": "deploy", 7 | "payload": { 8 | "task": "deploy:migrate" 9 | }, 10 | "environment": "production", 11 | "description": "Deploy request from hubot", 12 | "creator": { 13 | "login": "octocat", 14 | "id": 1, 15 | "avatar_url": "https://github.com/images/error/octocat_happy.gif", 16 | "gravatar_id": "", 17 | "url": "https://api.github.com/users/octocat", 18 | "html_url": "https://github.com/octocat", 19 | "followers_url": "https://api.github.com/users/octocat/followers", 20 | "following_url": "https://api.github.com/users/octocat/following{/other_user}", 21 | "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", 22 | "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", 23 | "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", 24 | "organizations_url": "https://api.github.com/users/octocat/orgs", 25 | "repos_url": "https://api.github.com/users/octocat/repos", 26 | "events_url": "https://api.github.com/users/octocat/events{/privacy}", 27 | "received_events_url": "https://api.github.com/users/octocat/received_events", 28 | "type": "User", 29 | "site_admin": false 30 | }, 31 | "created_at": "2012-07-20T01:19:13Z", 32 | "updated_at": "2012-07-20T01:19:13Z", 33 | "statuses_url": "https://api.github.com/repos/octocat/example/deployments/1/statuses", 34 | "repository_url": "https://api.github.com/repos/octocat/example" 35 | } 36 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/repos/languages.json: -------------------------------------------------------------------------------- 1 | { 2 | "C": 78769, 3 | "Python": 7769 4 | } -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/repos/list_branches.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "master", 4 | "commit": { 5 | "sha": "c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc", 6 | "url": "https://api.github.com/repos/octocat/Hello-World/commits/c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc" 7 | }, 8 | "protected": true, 9 | "protection": { 10 | "enabled": true, 11 | "required_status_checks": { 12 | "enforcement_level": "non_admins", 13 | "contexts": [ 14 | "ci-test", 15 | "linter" 16 | ] 17 | } 18 | }, 19 | "protection_url": "https://api.github.com/repos/octocat/hello-world/branches/master/protection" 20 | } 21 | ] -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/repos/push_commit.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c", 3 | "tree_id": "f9d2a07e9488b91af2641b26b9407fe22a451433", 4 | "distinct": true, 5 | "message": "Update README.md", 6 | "timestamp": "2015-05-05T19:40:15-04:00", 7 | "url": "https://github.com/baxterthehacker/public-repo/commit/0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c", 8 | "author": { 9 | "name": "baxterthehacker", 10 | "email": "baxterthehacker@users.noreply.github.com", 11 | "username": "baxterthehacker" 12 | }, 13 | "committer": { 14 | "name": "baxterthehacker", 15 | "email": "baxterthehacker@users.noreply.github.com", 16 | "username": "baxterthehacker" 17 | }, 18 | "added": [ 19 | ], 20 | "removed": [ 21 | ], 22 | "modified": [ 23 | "README.md" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/repos/reference.json: -------------------------------------------------------------------------------- 1 | { 2 | "ref": "refs/heads/newBranch", 3 | "node_id": "MDM6UmVmMTc3NzI0OnJlZnMvaGVhZHMvYW5uYS9uZXd0ZXN0", 4 | "url": "https://github.com/octocat/Hello-World/repos/someowner/somerepo/git/refs/heads/newBranch", 5 | "object": { 6 | "sha": "3d9d329812e120d3a01111cfee1f91cacebc7793", 7 | "type": "commit", 8 | "url": "https://github.com/octocat/Hello-World/repos/someowner/somerepo/git/commits/3d9d329812e120d3a01111cfee1f91cacebc7793" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/repos/shaLink.json: -------------------------------------------------------------------------------- 1 | { 2 | "sha": "8fc4e0fe57752b892a921806a1352e4cc72dff37", 3 | "url": "https://github.com/octocat/Hello-World/repos/someowner/somerepo/git/blobs/8fc4e0fe57752b892a921806a1352e4cc72dff37" 4 | } 5 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/repos/status.json: -------------------------------------------------------------------------------- 1 | { 2 | "created_at": "2012-07-20T01:19:13Z", 3 | "updated_at": "2012-07-20T01:19:13Z", 4 | "state": "success", 5 | "target_url": "https://ci.example.com/1000/output", 6 | "description": "Build has completed successfully", 7 | "id": 1, 8 | "url": "https://api.github.com/repos/octocat/Hello-World/statuses/1", 9 | "context": "continuous-integration/jenkins", 10 | "creator": { 11 | "login": "octocat", 12 | "id": 1, 13 | "avatar_url": "https://github.com/images/error/octocat_happy.gif", 14 | "gravatar_id": "", 15 | "url": "https://api.github.com/users/octocat", 16 | "html_url": "https://github.com/octocat", 17 | "followers_url": "https://api.github.com/users/octocat/followers", 18 | "following_url": "https://api.github.com/users/octocat/following{/other_user}", 19 | "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", 20 | "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", 21 | "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", 22 | "organizations_url": "https://api.github.com/users/octocat/orgs", 23 | "repos_url": "https://api.github.com/users/octocat/repos", 24 | "events_url": "https://api.github.com/users/octocat/events{/privacy}", 25 | "received_events_url": "https://api.github.com/users/octocat/received_events", 26 | "type": "User", 27 | "site_admin": false 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/repos/update-content-request.json: -------------------------------------------------------------------------------- 1 | { 2 | "message": "my commit message", 3 | "content": "encoded content ...", 4 | "sha": "12345", 5 | "branch": "test-branch" 6 | } -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/team.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 1, 3 | "node_id": "MDQ6VGVhbTE=", 4 | "url": "https://api.github.com/teams/1", 5 | "html_url": "https://api.github.com/teams/justice-league", 6 | "name": "Justice League", 7 | "slug": "justice-league", 8 | "description": "A great team.", 9 | "privacy": "closed", 10 | "permission": "admin", 11 | "members_url": "https://api.github.com/teams/1/members{/member}", 12 | "repositories_url": "https://api.github.com/teams/1/repos", 13 | "parent": null 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/treeItem.json: -------------------------------------------------------------------------------- 1 | { 2 | "path": "README.md", 3 | "mode": "100644", 4 | "type": "blob", 5 | "sha": "6e091fd045dc88806e5c70357326af7fa0e1ccde", 6 | "size": 12, 7 | "url": "https://github.com/octocat/Hello-World/repos/someowner/somerepo/git/blobs/6e091fd045dc88806e5c70357326af7fa0e1ccde" 8 | } 9 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/user.json: -------------------------------------------------------------------------------- 1 | { 2 | "login": "octocat", 3 | "id": 1, 4 | "avatar_url": "https://github.com/images/error/octocat_happy.gif", 5 | "gravatar_id": "", 6 | "url": "https://api.github.com/users/octocat", 7 | "html_url": "https://github.com/octocat", 8 | "followers_url": "https://api.github.com/users/octocat/followers", 9 | "following_url": "https://api.github.com/users/octocat/following{/other_user}", 10 | "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", 11 | "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", 12 | "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", 13 | "organizations_url": "https://api.github.com/users/octocat/orgs", 14 | "repos_url": "https://api.github.com/users/octocat/repos", 15 | "events_url": "https://api.github.com/users/octocat/events{/privacy}", 16 | "received_events_url": "https://api.github.com/users/octocat/received_events", 17 | "type": "User", 18 | "site_admin": false 19 | } 20 | -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/workflows/workflows-get-workflow-response.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 161335, 3 | "node_id": "MDg6V29ya2Zsb3cxNjEzMzU=", 4 | "name": "CI", 5 | "path": ".github/workflows/blank.yaml", 6 | "state": "active", 7 | "created_at": "2020-01-08T23:48:37.000-08:00", 8 | "updated_at": "2020-01-08T23:50:21.000-08:00", 9 | "deleted_at": "2020-01-09T23:50:21.000-08:00", 10 | "url": "https://api.github.com/repos/octo-org/octo-repo/actions/workflows/161335", 11 | "html_url": "https://github.com/octo-org/octo-repo/blob/master/.github/workflows/161335", 12 | "badge_url": "https://github.com/octo-org/octo-repo/workflows/CI/badge.svg" 13 | } -------------------------------------------------------------------------------- /src/test/resources/com/spotify/github/v3/workflows/workflows-list-workflows-response.json: -------------------------------------------------------------------------------- 1 | { 2 | "total_count": 2, 3 | "workflows": [ 4 | { 5 | "id": 161335, 6 | "node_id": "MDg6V29ya2Zsb3cxNjEzMzU=", 7 | "name": "CI", 8 | "path": ".github/workflows/blank.yaml", 9 | "state": "active", 10 | "created_at": "2020-01-08T23:48:37.000-08:00", 11 | "updated_at": "2020-01-08T23:50:21.000-08:00", 12 | "deleted_at": "2020-01-09T23:50:21.000-08:00", 13 | "url": "https://api.github.com/repos/octo-org/octo-repo/actions/workflows/161335", 14 | "html_url": "https://github.com/octo-org/octo-repo/blob/master/.github/workflows/161335", 15 | "badge_url": "https://github.com/octo-org/octo-repo/workflows/CI/badge.svg" 16 | }, 17 | { 18 | "id": 269289, 19 | "node_id": "MDE4OldvcmtmbG93IFNlY29uZGFyeTI2OTI4OQ==", 20 | "name": "Linter", 21 | "path": ".github/workflows/linter.yaml", 22 | "state": "active", 23 | "created_at": "2020-01-08T23:48:37.000-08:00", 24 | "updated_at": "2020-01-08T23:50:21.000-08:00", 25 | "deleted_at": "2020-01-09T23:50:21.000-08:00", 26 | "url": "https://api.github.com/repos/octo-org/octo-repo/actions/workflows/269289", 27 | "html_url": "https://github.com/octo-org/octo-repo/blob/master/.github/workflows/269289", 28 | "badge_url": "https://github.com/octo-org/octo-repo/workflows/Linter/badge.svg" 29 | } 30 | ] 31 | } -------------------------------------------------------------------------------- /suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | --------------------------------------------------------------------------------