Skip to content

Commit

Permalink
Add bio, hireable, and twitter_username fields to Person
Browse files Browse the repository at this point in the history
  • Loading branch information
Chew committed Jun 6, 2020
1 parent 10482c0 commit 4695b54
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
40 changes: 38 additions & 2 deletions src/main/java/org/kohsuke/github/GHPerson.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ public abstract class GHPerson extends GHObject {
protected String login, avatar_url;

// other fields (that only show up in full data)
protected String location, blog, email, name, company, type;
protected String location, blog, email, bio, name, company, type, twitter_username;
protected String html_url;
protected int followers, following, public_repos, public_gists;
protected boolean site_admin;
protected boolean site_admin, hireable;

// other fields (that only show up in full data) that require privileged scope
protected Integer total_private_repos;
Expand Down Expand Up @@ -213,6 +213,18 @@ public String getName() throws IOException {
return name;
}

/**
* Gets the bio of this user, like "I am a developer and love to code!"
*
* @return the bio
* @throws IOException
* the io exception
*/
public String getBio() throws IOException {
populate();
return bio;
}

/**
* Gets the company name of this user, like "Sun Microsystems, Inc."
*
Expand All @@ -237,6 +249,18 @@ public String getLocation() throws IOException {
return location;
}

/**
* Gets the Twitter Username of this user, like "GitHub"
*
* @return the Twitter username
* @throws IOException
* the io exception
*/
public String getTwitterUsername() throws IOException {
populate();
return twitter_username;
}

public Date getCreatedAt() throws IOException {
populate();
return super.getCreatedAt();
Expand Down Expand Up @@ -348,6 +372,18 @@ public boolean isSiteAdmin() throws IOException {
return site_admin;
}

/**
* Gets the hireable field
*
* @return the hireable field
* @throws IOException
* the io exception
*/
public boolean isHireable() throws IOException {
populate();
return hireable;
}

/**
* Gets total private repo count.
*
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/kohsuke/github/GHObjectTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public void test_toString() throws Exception {
GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG);
assertThat(org.toString(),
containsString(
"login=hub4j-test-org,location=<null>,blog=<null>,email=<null>,name=<null>,company=<null>,type=Organization,followers=0,following=0"));
"login=hub4j-test-org,location=<null>,blog=<null>,email=<null>,bio=<null>,name=<null>,company=<null>,type=Organization,followers=0,following=0,hireable=false"));

// getResponseHeaderFields is deprecated but we should not break it.
assertThat(org.getResponseHeaderFields(), notNullValue());
Expand Down

0 comments on commit 4695b54

Please sign in to comment.