Skip to content

Commit

Permalink
Add more properties to the common model classes
Browse files Browse the repository at this point in the history
  • Loading branch information
Shredder121 committed Apr 15, 2016
1 parent b0160cb commit 1fb4fac
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@

import java.time.ZonedDateTime;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.github.shredder121.gh_event_api.model.json.PropertyBasedJsonCreator;
import com.google.common.collect.ImmutableMap;

/**
* A comment on a part of the commit diff.
Expand Down Expand Up @@ -87,6 +89,11 @@ public class Comment {
*/
String htmlUrl;

/**
* The user that created the comment.
*/
User user;

/**
* The time the comment was created.
*/
Expand All @@ -96,4 +103,11 @@ public class Comment {
* The time the comment was last modified.
*/
ZonedDateTime updatedAt;

/**
* Additional links included in the Comment.
* (Only populated with pull request review comments)
*/
@JsonProperty("_links")
ImmutableMap<String, Link> links;
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@ public class Deployment {
*/
Integer id;

/**
* The (API) URL of this deployment.
*/
String url;

/**
* The (API) URL to view this deployment's statuses.
*/
String statusesUrl;

/**
* The (API) URL to view the repository this deployment is for.
*/
String repositoryUrl;

/**
* The ref to deploy.
* This can be a branch, tag or SHA.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
*/
package com.github.shredder121.gh_event_api.model;

import java.time.ZonedDateTime;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.github.shredder121.gh_event_api.model.json.PropertyBasedJsonCreator;
Expand All @@ -30,6 +33,11 @@
)
public class Repository {

/**
* The id of this repository.
*/
Integer id;

/**
* The name of the repository.
*/
Expand All @@ -40,6 +48,26 @@ public class Repository {
*/
String fullName;

/**
* The description of the repository.
*/
String description;

/**
* The default branch of the repository.
*/
String defaultBranch;

/**
* The homepage of the repository.
*/
String homepage;

/**
* The most prevalent language that
*/
String language;

/**
* The owner of the repository
*/
Expand All @@ -54,4 +82,41 @@ public class Repository {
* How many forks there are currently.
*/
Long forks;

/**
* Whether this repository is a fork of another repository.
*/
@JsonProperty("fork")
boolean isFork;

/**
* Whether this repository is a private repository.
*/
@JsonProperty("private")
boolean isPrivate;

/**
* The (API) URL to view this repository.
*/
String url;

/**
* The (GitHub Web UI) URL to view this repository.
*/
String htmlUrl;

/**
* The time this repository was created.
*/
ZonedDateTime createdAt;

/**
* The time this repository was last updated.
*/
ZonedDateTime updatedAt;

/**
* The time the repository was last pushed to.
*/
ZonedDateTime pushedAt;
}
14 changes: 14 additions & 0 deletions src/main/java/com/github/shredder121/gh_event_api/model/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package com.github.shredder121.gh_event_api.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.github.shredder121.gh_event_api.model.json.PropertyBasedJsonCreator;
Expand Down Expand Up @@ -51,4 +52,17 @@ public class User {
* The (GitHub Web UI) URL to view this user.
*/
String htmlUrl;

/**
* The type of User.
* (Payloads can be sent from {@code User}s or {@code Organization}s)
*/
String type;

/**
* Whether the user is the administrator.
* (On GitHub.com this means a GitHub employee)
*/
@JsonProperty("site_admin")
boolean isSiteAdmin;
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ private BaxterTheHacker() {
public static final Matcher<User> BAXTERTHEHACKER = allOf(asList(
property(User::getId, is(6752317)),
property(User::getLogin, is("baxterthehacker")),
property(User::getHtmlUrl, is("https://github.com/baxterthehacker"))
property(User::getHtmlUrl, is("https://github.com/baxterthehacker")),
property(User::isSiteAdmin, is(false))
));

public static final Matcher<Repository> BAXTERTHEHACKER_PUBLIC_REPO = allOf(asList(
Expand All @@ -125,7 +126,8 @@ private JasonRudolph() {
public static final Matcher<User> JASONRUDOLPH = allOf(asList(
property(User::getId, is(2988)),
property(User::getLogin, is("jasonrudolph")),
property(User::getHtmlUrl, is("https://github.com/jasonrudolph"))
property(User::getHtmlUrl, is("https://github.com/jasonrudolph")),
property(User::isSiteAdmin, is(true))
));
}

Expand All @@ -137,7 +139,8 @@ private Kdaigle() {
public static final Matcher<User> KDAIGLE = allOf(asList(
property(User::getId, is(2501)),
property(User::getLogin, is("kdaigle")),
property(User::getHtmlUrl, is("https://github.com/kdaigle"))
property(User::getHtmlUrl, is("https://github.com/kdaigle")),
property(User::isSiteAdmin, is(true))
));
}

Expand Down

0 comments on commit 1fb4fac

Please sign in to comment.