Skip to content

Commit 67f5adb

Browse files
committed
Organization and Pull Request API.
1 parent 8b6b0e9 commit 67f5adb

File tree

6 files changed

+25
-42
lines changed

6 files changed

+25
-42
lines changed

core/src/main/java/com/github/api/v2/services/impl/BaseGitHubService.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -129,19 +129,6 @@ protected GsonBuilder getGsonBuilder() {
129129
GsonBuilder builder = new GsonBuilder();
130130
builder.setDateFormat(ApplicationConstants.DATE_FORMAT);
131131
builder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES);
132-
// builder.setFieldNamingStrategy(new FieldNamingStrategy() {
133-
// @Override
134-
// public String translateName(Field field) {
135-
// if (field.getType().equals(Repository.Visibility.class)) {
136-
// return "private";
137-
// } else if (field.getType().equals(Gist.Visibility.class)) {
138-
// return "public";
139-
// } else {
140-
// return field.getName();
141-
// }
142-
// }
143-
//
144-
// });
145132
builder.registerTypeAdapter(Issue.State.class, new JsonDeserializer<Issue.State>() {
146133
@Override
147134
public Issue.State deserialize(JsonElement arg0, Type arg1,

core/src/main/java/com/github/api/v2/services/impl/RepositoryServiceImpl.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import com.github.api.v2.services.constant.GitHubApiUrls;
3131
import com.github.api.v2.services.constant.ParameterNames;
3232
import com.github.api.v2.services.constant.GitHubApiUrls.GitHubApiUrlBuilder;
33-
import com.google.gson.GsonBuilder;
3433
import com.google.gson.JsonObject;
3534
import com.google.gson.reflect.TypeToken;
3635

@@ -373,13 +372,4 @@ public ZipInputStream getRepositoryArchive(String userName, String repositoryNam
373372
String apiUrl = builder.withField(ParameterNames.USER_NAME, userName).withField(ParameterNames.REPOSITORY_NAME, repositoryName).withField(ParameterNames.BRANCH, branchName).buildUrl();
374373
return new ZipInputStream(callApiGet(apiUrl));
375374
}
376-
377-
/* (non-Javadoc)
378-
* @see com.github.api.v2.services.impl.BaseGitHubService#getGsonBuilder()
379-
*/
380-
protected GsonBuilder getGsonBuilder() {
381-
GsonBuilder gson = super.getGsonBuilder();
382-
gson.setDateFormat("yyyy-MM-dd'T'HH:mm:ss");
383-
return gson;
384-
}
385375
}

core/src/main/resources/com/github/api/v2/services/constant/GitHubApiUrls.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ com.github.api.v2.services.repositoryService.getForks=http://github.com/api/{ver
7373
com.github.api.v2.services.repositoryService.getLanguageBreakdown=http://github.com/api/{version}/{format}/repos/show/{userName}/{repositoryName}/languages
7474
com.github.api.v2.services.repositoryService.getTags=http://github.com/api/{version}/{format}/repos/show/{userName}/{repositoryName}/tags
7575
com.github.api.v2.services.repositoryService.getBranches=http://github.com/api/{version}/{format}/repos/show/{userName}/{repositoryName}/branches
76-
com.github.api.v2.services.repositoryService.getRepositoryArchive=http://github.com/{userName}/{repositoryName}/zipball/{branch}
76+
com.github.api.v2.services.repositoryService.getRepositoryArchive=https://github.com/{userName}/{repositoryName}/zipball/{branch}
7777

7878
# Commit API
7979
com.github.api.v2.services.commitService.getCommits=http://github.com/api/{version}/{format}/commits/list/{userName}/{repositoryName}/{branch}

dist/github-java-sdk.jar

27.1 KB
Binary file not shown.

schema/src/main/java/com/github/api/v2/schema/Gist.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import java.util.List;
2222
import java.util.Map;
2323

24+
import com.google.gson.annotations.SerializedName;
25+
2426
/**
2527
* The Class Gist.
2628
*/
@@ -90,7 +92,8 @@ public static Visibility fromValue(String value) {
9092
private String repo;
9193

9294
/** The visibility. */
93-
private Visibility visibility;
95+
@SerializedName("public")
96+
private boolean visibility;
9497

9598
/** The created at. */
9699
private Date createdAt;
@@ -145,7 +148,7 @@ public void setRepo(String repo) {
145148
* @return the visibility
146149
*/
147150
public Visibility getVisibility() {
148-
return visibility;
151+
return visibility ? Visibility.PUBLIC : Visibility.PRIVATE;
149152
}
150153

151154
/**
@@ -155,7 +158,7 @@ public Visibility getVisibility() {
155158
* the new visibility
156159
*/
157160
public void setVisibility(Visibility visibility) {
158-
this.visibility = visibility;
161+
this.visibility = (visibility == Visibility.PUBLIC);
159162
}
160163

161164
/**

schema/src/main/java/com/github/api/v2/schema/Repository.java

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
import java.util.HashMap;
2121
import java.util.Map;
2222

23+
import com.google.gson.annotations.SerializedName;
24+
2325
/**
2426
* The Class Repository.
2527
*/
@@ -98,7 +100,8 @@ public static Visibility fromValue(String value) {
98100
private String description;
99101

100102
/** The visibility. */
101-
private Visibility visibility;
103+
@SerializedName("private")
104+
private boolean visibility;
102105

103106
/** The url. */
104107
private String url;
@@ -140,10 +143,10 @@ public static Visibility fromValue(String value) {
140143
private String id;
141144

142145
/** The pushed. */
143-
private Date pushed;
146+
private Date pushedAt;
144147

145148
/** The created. */
146-
private Date created;
149+
private Date createdAt;
147150

148151
/** The source. */
149152
private String source;
@@ -248,7 +251,7 @@ public void setDescription(String description) {
248251
* @return the visibility
249252
*/
250253
public Visibility getVisibility() {
251-
return visibility;
254+
return visibility ? Visibility.PRIVATE : Visibility.PUBLIC ;
252255
}
253256

254257
/**
@@ -258,7 +261,7 @@ public Visibility getVisibility() {
258261
* the new visibility
259262
*/
260263
public void setVisibility(Visibility visibility) {
261-
this.visibility = visibility;
264+
this.visibility = (visibility == Visibility.PRIVATE);
262265
}
263266

264267
/**
@@ -513,8 +516,8 @@ public void setId(String id) {
513516
*
514517
* @return the pushed
515518
*/
516-
public Date getPushed() {
517-
return pushed;
519+
public Date getPushedAt() {
520+
return pushedAt;
518521
}
519522

520523
/**
@@ -523,17 +526,17 @@ public Date getPushed() {
523526
* @param pushed
524527
* the new pushed
525528
*/
526-
public void setPushed(Date pushed) {
527-
this.pushed = pushed;
529+
public void setPushedAt(Date pushedAt) {
530+
this.pushedAt = pushedAt;
528531
}
529532

530533
/**
531534
* Gets the created.
532535
*
533536
* @return the created
534537
*/
535-
public Date getCreated() {
536-
return created;
538+
public Date getCreatedAt() {
539+
return createdAt;
537540
}
538541

539542
/**
@@ -542,8 +545,8 @@ public Date getCreated() {
542545
* @param created
543546
* the new created
544547
*/
545-
public void setCreated(Date created) {
546-
this.created = created;
548+
public void setCreated(Date createdAt) {
549+
this.createdAt = createdAt;
547550
}
548551

549552
/**
@@ -684,14 +687,14 @@ public void setPermission(Permission permission) {
684687
*/
685688
@Override
686689
public String toString() {
687-
return "Repository [actions=" + actions + ", created=" + created
690+
return "Repository [actions=" + actions + ", created=" + createdAt
688691
+ ", description=" + description + ", followers=" + followers
689692
+ ", fork=" + fork + ", forks=" + forks + ", hasDownloads="
690693
+ hasDownloads + ", hasIssues=" + hasIssues + ", hasWiki="
691694
+ hasWiki + ", homepage=" + homepage + ", id=" + id
692695
+ ", language=" + language + ", name=" + name + ", openIssues="
693696
+ openIssues + ", owner=" + owner + ", parent=" + parent
694-
+ ", pushed=" + pushed + ", score=" + score + ", size=" + size
697+
+ ", pushed=" + pushedAt + ", score=" + score + ", size=" + size
695698
+ ", source=" + source + ", type=" + type + ", url=" + url
696699
+ ", username=" + username + ", visibiity=" + visibility
697700
+ ", watchers=" + watchers + "]";

0 commit comments

Comments
 (0)