Skip to content

Commit 609f532

Browse files
committed
Merge pull request #143
2 parents 3b6ca30 + c6fc03c commit 609f532

18 files changed

Lines changed: 164 additions & 354 deletions

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<plugin>
3636
<groupId>com.infradna.tool</groupId>
3737
<artifactId>bridge-method-injector</artifactId>
38-
<version>1.12</version>
38+
<version>1.14</version>
3939
<executions>
4040
<execution>
4141
<goals>
@@ -77,7 +77,7 @@
7777
<dependency>
7878
<groupId>com.infradna.tool</groupId>
7979
<artifactId>bridge-method-annotation</artifactId>
80-
<version>1.12</version>
80+
<version>1.14</version>
8181
</dependency>
8282
<dependency>
8383
<groupId>org.kohsuke.stapler</groupId>

src/main/java/org/kohsuke/github/GHAsset.java

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,21 @@
11
package org.kohsuke.github;
22

33
import java.io.IOException;
4-
import java.util.Date;
54

65
/**
76
* Asset in a release.
87
*
98
* @see GHRelease#getAssets()
109
*/
11-
public class GHAsset {
10+
public class GHAsset extends GHObject {
1211
GitHub root;
1312
GHRepository owner;
14-
private String url;
15-
private String id;
1613
private String name;
1714
private String label;
1815
private String state;
1916
private String content_type;
2017
private long size;
2118
private long download_count;
22-
private Date created_at;
23-
private Date updated_at;
2419
private String browser_download_url;
2520

2621
public String getContentType() {
@@ -32,18 +27,10 @@ public void setContentType(String contentType) throws IOException {
3227
this.content_type = contentType;
3328
}
3429

35-
public Date getCreatedAt() {
36-
return created_at;
37-
}
38-
3930
public long getDownloadCount() {
4031
return download_count;
4132
}
4233

43-
public String getId() {
44-
return id;
45-
}
46-
4734
public String getLabel() {
4835
return label;
4936
}
@@ -73,14 +60,6 @@ public String getState() {
7360
return state;
7461
}
7562

76-
public Date getUpdatedAt() {
77-
return updated_at;
78-
}
79-
80-
public String getUrl() {
81-
return url;
82-
}
83-
8463
public String getBrowserDownloadUrl() {
8564
return browser_download_url;
8665
}

src/main/java/org/kohsuke/github/GHAuthorization.java

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* @see GitHub#createToken(Collection, String, String)
1313
* @see http://developer.github.com/v3/oauth/#create-a-new-authorization
1414
*/
15-
public class GHAuthorization {
15+
public class GHAuthorization extends GHObject {
1616
public static final String USER = "user";
1717
public static final String USER_EMAIL = "user:email";
1818
public static final String USER_FOLLOW = "user:follow";
@@ -33,24 +33,16 @@ public class GHAuthorization {
3333
public static final String ADMIN_KEY = "admin:public_key";
3434

3535
private GitHub root;
36-
private int id;
37-
private String url;
3836
private List<String> scopes;
3937
private String token;
4038
private App app;
4139
private String note;
4240
private String note_url;
43-
private String updated_at;
44-
private String created_at;
4541

4642
public GitHub getRoot() {
4743
return root;
4844
}
4945

50-
public int getId() {
51-
return id;
52-
}
53-
5446
public List<String> getScopes() {
5547
return scopes;
5648
}
@@ -78,14 +70,6 @@ public String getNote() {
7870
public URL getNoteUrl(){
7971
return GitHub.parseURL(note_url);
8072
}
81-
82-
public Date getCreatedAt() {
83-
return GitHub.parseDate(created_at);
84-
}
85-
86-
public Date getUpdatedAt() {
87-
return GitHub.parseDate(updated_at);
88-
}
8973

9074
/*package*/ GHAuthorization wrap(GitHub root) {
9175
this.root = root;

src/main/java/org/kohsuke/github/GHCommitComment.java

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@
1212
* @see GHCommit#listComments()
1313
* @see GHCommit#createComment(String, String, Integer, Integer)
1414
*/
15-
public class GHCommitComment {
15+
public class GHCommitComment extends GHObject {
1616
private GHRepository owner;
1717

18-
String updated_at, created_at;
19-
String body, url, html_url, commit_id;
18+
String body, html_url, commit_id;
2019
Integer line;
21-
int id;
2220
String path;
2321
User user;
2422

@@ -32,14 +30,6 @@ public GHRepository getOwner() {
3230
return owner;
3331
}
3432

35-
public Date getCreatedAt() {
36-
return GitHub.parseDate(created_at);
37-
}
38-
39-
public Date getUpdatedAt() {
40-
return GitHub.parseDate(updated_at);
41-
}
42-
4333
/**
4434
* URL like 'https://github.com/kohsuke/sandbox-ant/commit/8ae38db0ea5837313ab5f39d43a6f73de3bd9000#commitcomment-1252827' to
4535
* show this commit comment in a browser.
@@ -75,10 +65,6 @@ public int getLine() {
7565
return line!=null ? line : -1;
7666
}
7767

78-
public int getId() {
79-
return id;
80-
}
81-
8268
/**
8369
* Gets the user who put this comment.
8470
*/

src/main/java/org/kohsuke/github/GHCommitStatus.java

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,9 @@
1010
* @see GHRepository#getCommitStatus(String)
1111
* @see GHCommit#getStatus()
1212
*/
13-
public class GHCommitStatus {
14-
String created_at, updated_at;
13+
public class GHCommitStatus extends GHObject {
1514
String state;
1615
String target_url,description;
17-
int id;
18-
String url;
1916
String context;
2017
GHUser creator;
2118

@@ -27,14 +24,6 @@ public class GHCommitStatus {
2724
return this;
2825
}
2926

30-
public Date getCreatedAt() {
31-
return GitHub.parseDate(created_at);
32-
}
33-
34-
public Date getUpdatedAt() {
35-
return GitHub.parseDate(updated_at);
36-
}
37-
3827
public GHCommitState getState() {
3928
for (GHCommitState s : GHCommitState.values()) {
4029
if (s.name().equalsIgnoreCase(state))
@@ -56,17 +45,6 @@ public String getDescription() {
5645
return description;
5746
}
5847

59-
public int getId() {
60-
return id;
61-
}
62-
63-
/**
64-
* API URL of this commit status.
65-
*/
66-
public String getUrl() {
67-
return url;
68-
}
69-
7048
public GHUser getCreator() {
7149
return creator;
7250
}

src/main/java/org/kohsuke/github/GHDeployment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import java.net.URL;
55

6-
public class GHDeployment extends Identifiable {
6+
public class GHDeployment extends GHObject {
77
private GHRepository owner;
88
private GitHub root;
99
protected String sha;
Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
1-
package org.kohsuke.github;
2-
3-
import java.net.URL;
4-
5-
public class GHDeploymentStatus extends Identifiable {
6-
private GHRepository owner;
7-
private GitHub root;
8-
protected GHUser creator;
9-
protected String state;
10-
protected String description;
11-
protected String target_url;
12-
protected String deployment_url;
13-
protected String repository_url;
14-
public GHDeploymentStatus wrap(GHRepository owner) {
15-
this.owner = owner;
16-
this.root = owner.root;
17-
if(creator != null) creator.wrapUp(root);
18-
return this;
19-
}
20-
public URL getTargetUrl() {
21-
return GitHub.parseURL(target_url);
22-
}
23-
24-
public URL getDeploymentUrl() {
25-
return GitHub.parseURL(deployment_url);
26-
}
27-
28-
public URL getRepositoryUrl() {
29-
return GitHub.parseURL(repository_url);
30-
}
31-
public GHDeploymentState getState() {
32-
return GHDeploymentState.valueOf(state.toUpperCase());
33-
}
34-
35-
36-
}
1+
package org.kohsuke.github;
2+
3+
import java.net.URL;
4+
5+
public class GHDeploymentStatus extends GHObject {
6+
private GHRepository owner;
7+
private GitHub root;
8+
protected GHUser creator;
9+
protected String state;
10+
protected String description;
11+
protected String target_url;
12+
protected String deployment_url;
13+
protected String repository_url;
14+
public GHDeploymentStatus wrap(GHRepository owner) {
15+
this.owner = owner;
16+
this.root = owner.root;
17+
if(creator != null) creator.wrapUp(root);
18+
return this;
19+
}
20+
public URL getTargetUrl() {
21+
return GitHub.parseURL(target_url);
22+
}
23+
24+
public URL getDeploymentUrl() {
25+
return GitHub.parseURL(deployment_url);
26+
}
27+
28+
public URL getRepositoryUrl() {
29+
return GitHub.parseURL(repository_url);
30+
}
31+
public GHDeploymentState getState() {
32+
return GHDeploymentState.valueOf(state.toUpperCase());
33+
}
34+
35+
36+
}
Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
package org.kohsuke.github;
2-
3-
import java.io.IOException;
4-
5-
public class GHDeploymentStatusBuilder {
6-
private final Requester builder;
7-
private GHRepository repo;
8-
private int deploymentId;
9-
10-
public GHDeploymentStatusBuilder(GHRepository repo, int deploymentId, GHDeploymentState state) {
11-
this.repo = repo;
12-
this.deploymentId = deploymentId;
13-
this.builder = new Requester(repo.root);
14-
this.builder.with("state",state.toString().toLowerCase());
15-
}
16-
17-
public GHDeploymentStatusBuilder description(String description) {
18-
this.builder.with("description",description);
19-
return this;
20-
}
21-
22-
public GHDeploymentStatusBuilder targetUrl(String targetUrl) {
23-
this.builder.with("target_url",targetUrl);
24-
return this;
25-
}
26-
27-
public GHDeploymentStatus create() throws IOException {
28-
return builder.to(repo.getApiTailUrl("deployments")+"/"+deploymentId+"/statuses",GHDeploymentStatus.class).wrap(repo);
29-
}
30-
}
1+
package org.kohsuke.github;
2+
3+
import java.io.IOException;
4+
5+
public class GHDeploymentStatusBuilder {
6+
private final Requester builder;
7+
private GHRepository repo;
8+
private int deploymentId;
9+
10+
public GHDeploymentStatusBuilder(GHRepository repo, int deploymentId, GHDeploymentState state) {
11+
this.repo = repo;
12+
this.deploymentId = deploymentId;
13+
this.builder = new Requester(repo.root);
14+
this.builder.with("state",state.toString().toLowerCase());
15+
}
16+
17+
public GHDeploymentStatusBuilder description(String description) {
18+
this.builder.with("description",description);
19+
return this;
20+
}
21+
22+
public GHDeploymentStatusBuilder targetUrl(String targetUrl) {
23+
this.builder.with("target_url",targetUrl);
24+
return this;
25+
}
26+
27+
public GHDeploymentStatus create() throws IOException {
28+
return builder.to(repo.getApiTailUrl("deployments")+"/"+deploymentId+"/statuses",GHDeploymentStatus.class).wrap(repo);
29+
}
30+
}

0 commit comments

Comments
 (0)