Skip to content

Commit

Permalink
Merge pull request #1472 from alexanderkjall/expose-disabled-in-api
Browse files Browse the repository at this point in the history
Expose the boolean 'disabled' in the repository api
  • Loading branch information
bitwiseman committed Jun 20, 2022
2 parents 48f847c + e0ab67b commit 7a16c30
Show file tree
Hide file tree
Showing 10 changed files with 966 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/main/java/org/kohsuke/github/GHRepository.java
Expand Up @@ -94,7 +94,7 @@ public class GHRepository extends GHObject {

private GHUser owner; // not fully populated. beware.

private boolean has_issues, has_wiki, fork, has_downloads, has_pages, archived, has_projects;
private boolean has_issues, has_wiki, fork, has_downloads, has_pages, archived, disabled, has_projects;

private boolean allow_squash_merge;

Expand Down Expand Up @@ -660,6 +660,15 @@ public boolean isArchived() {
return archived;
}

/**
* Is disabled boolean.
*
* @return the boolean
*/
public boolean isDisabled() {
return disabled;
}

/**
* Is allow squash merge boolean.
*
Expand Down
14 changes: 14 additions & 0 deletions src/test/java/org/kohsuke/github/GHRepositoryTest.java
Expand Up @@ -93,6 +93,20 @@ public void archive() throws Exception {
assertThat(getRepository().isArchived(), is(true));
}

@Test
public void isDisabled() throws Exception {
GHRepository r = getRepository();

assertThat(r.isDisabled(), is(false));
}

@Test
public void isDisabledTrue() throws Exception {
GHRepository r = getRepository();

assertThat(r.isDisabled(), is(true));
}

@Test
public void getBranch_URLEncoded() throws Exception {
GHRepository repo = getRepository();
Expand Down
@@ -0,0 +1,42 @@
{
"login": "hub4j-test-org",
"id": 7544739,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
"url": "https://api.github.com/orgs/hub4j-test-org",
"repos_url": "https://api.github.com/orgs/hub4j-test-org/repos",
"events_url": "https://api.github.com/orgs/hub4j-test-org/events",
"hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks",
"issues_url": "https://api.github.com/orgs/hub4j-test-org/issues",
"members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}",
"public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}",
"avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4",
"description": null,
"is_verified": false,
"has_organization_projects": true,
"has_repository_projects": true,
"public_repos": 9,
"public_gists": 0,
"followers": 0,
"following": 0,
"html_url": "https://github.com/hub4j-test-org",
"created_at": "2014-05-10T19:39:11Z",
"updated_at": "2015-04-20T00:42:30Z",
"type": "Organization",
"total_private_repos": 0,
"owned_private_repos": 0,
"private_gists": 0,
"disk_usage": 132,
"collaborators": 0,
"billing_email": "kk@kohsuke.org",
"default_repository_permission": "none",
"members_can_create_repositories": false,
"two_factor_requirement_enabled": false,
"members_allowed_repository_creation_type": "none",
"plan": {
"name": "free",
"space": 976562499,
"private_repos": 0,
"filled_seats": 3,
"seats": 0
}
}

Large diffs are not rendered by default.

@@ -0,0 +1,48 @@
{
"id": "cb173af2-c793-444a-acdf-c3850e7afdbe",
"name": "orgs_hub4j-test-org",
"request": {
"url": "/orgs/hub4j-test-org",
"method": "GET",
"headers": {
"Accept": {
"equalTo": "application/vnd.github.v3+json"
}
}
},
"response": {
"status": 200,
"bodyFileName": "orgs_hub4j-test-org-2.json",
"headers": {
"Date": "Wed, 25 Sep 2019 23:35:58 GMT",
"Content-Type": "application/json; charset=utf-8",
"Server": "GitHub.com",
"Status": "200 OK",
"X-RateLimit-Limit": "5000",
"X-RateLimit-Remaining": "4989",
"X-RateLimit-Reset": "1569457884",
"Cache-Control": "private, max-age=60, s-maxage=60",
"Vary": [
"Accept, Authorization, Cookie, X-GitHub-OTP",
"Accept-Encoding"
],
"ETag": "W/\"b7989d48e6539c9c76038995b902421b\"",
"Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT",
"X-OAuth-Scopes": "gist, notifications, read:org, read:public_key, read:repo_hook, repo",
"X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org",
"X-GitHub-Media-Type": "unknown, github.v3",
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
"Access-Control-Allow-Origin": "*",
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
"X-Frame-Options": "deny",
"X-Content-Type-Options": "nosniff",
"X-XSS-Protection": "1; mode=block",
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy": "default-src 'none'",
"X-GitHub-Request-Id": "F855:59E1:1397ED7:171400E:5D8BF9DE"
}
},
"uuid": "cb173af2-c793-444a-acdf-c3850e7afdbe",
"persistent": true,
"insertionIndex": 2
}
@@ -0,0 +1,51 @@
{
"id": "0a4d7a1a-f99c-47ca-840a-3e920c18bd1f",
"name": "repos_hub4j-test-org_github-api",
"request": {
"url": "/repos/hub4j-test-org/github-api",
"method": "GET",
"headers": {
"Accept": {
"equalTo": "application/vnd.github.v3+json"
}
}
},
"response": {
"status": 200,
"bodyFileName": "repos_hub4j-test-org_github-api-3.json",
"headers": {
"Date": "Wed, 25 Sep 2019 23:35:58 GMT",
"Content-Type": "application/json; charset=utf-8",
"Server": "GitHub.com",
"Status": "200 OK",
"X-RateLimit-Limit": "5000",
"X-RateLimit-Remaining": "4988",
"X-RateLimit-Reset": "1569457884",
"Cache-Control": "private, max-age=60, s-maxage=60",
"Vary": [
"Accept, Authorization, Cookie, X-GitHub-OTP",
"Accept-Encoding"
],
"ETag": "W/\"0678d1c39ea574f68cc0fb330b067cb7\"",
"Last-Modified": "Wed, 25 Sep 2019 23:32:35 GMT",
"X-OAuth-Scopes": "gist, notifications, read:org, read:public_key, read:repo_hook, repo",
"X-Accepted-OAuth-Scopes": "repo",
"X-GitHub-Media-Type": "unknown, github.v3",
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
"Access-Control-Allow-Origin": "*",
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
"X-Frame-Options": "deny",
"X-Content-Type-Options": "nosniff",
"X-XSS-Protection": "1; mode=block",
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy": "default-src 'none'",
"X-GitHub-Request-Id": "F855:59E1:1397EEB:1714029:5D8BF9DE"
}
},
"uuid": "0a4d7a1a-f99c-47ca-840a-3e920c18bd1f",
"persistent": true,
"scenarioName": "scenario-1-repos-hub4j-test-org-github-api",
"requiredScenarioState": "Started",
"newScenarioState": "scenario-1-repos-hub4j-test-org-github-api-2",
"insertionIndex": 3
}
@@ -0,0 +1,42 @@
{
"login": "hub4j-test-org",
"id": 7544739,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
"url": "https://api.github.com/orgs/hub4j-test-org",
"repos_url": "https://api.github.com/orgs/hub4j-test-org/repos",
"events_url": "https://api.github.com/orgs/hub4j-test-org/events",
"hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks",
"issues_url": "https://api.github.com/orgs/hub4j-test-org/issues",
"members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}",
"public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}",
"avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4",
"description": null,
"is_verified": false,
"has_organization_projects": true,
"has_repository_projects": true,
"public_repos": 9,
"public_gists": 0,
"followers": 0,
"following": 0,
"html_url": "https://github.com/hub4j-test-org",
"created_at": "2014-05-10T19:39:11Z",
"updated_at": "2015-04-20T00:42:30Z",
"type": "Organization",
"total_private_repos": 0,
"owned_private_repos": 0,
"private_gists": 0,
"disk_usage": 132,
"collaborators": 0,
"billing_email": "kk@kohsuke.org",
"default_repository_permission": "none",
"members_can_create_repositories": false,
"two_factor_requirement_enabled": false,
"members_allowed_repository_creation_type": "none",
"plan": {
"name": "free",
"space": 976562499,
"private_repos": 0,
"filled_seats": 3,
"seats": 0
}
}

0 comments on commit 7a16c30

Please sign in to comment.