Merge branch 'develop' into stable
This commit is contained in:
commit
ce92fc5b22
@ -19,8 +19,8 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.inteligr8.http.BaseResponse;
|
import com.inteligr8.github.http.BaseResponse;
|
||||||
import com.inteligr8.http.PreemptiveAuthInterceptor;
|
import com.inteligr8.github.http.PreemptiveAuthInterceptor;
|
||||||
|
|
||||||
public class ApiGateway {
|
public class ApiGateway {
|
||||||
|
|
||||||
@ -84,15 +84,21 @@ public class ApiGateway {
|
|||||||
if (this.logger.isDebugEnabled())
|
if (this.logger.isDebugEnabled())
|
||||||
this.logger.debug("Received response from " + method + ": " + response.getStatusLine().getStatusCode());
|
this.logger.debug("Received response from " + method + ": " + response.getStatusLine().getStatusCode());
|
||||||
|
|
||||||
InputStream istream = response.getEntity().getContent();
|
Response responseObject = null;
|
||||||
try {
|
if (response.getEntity() != null) {
|
||||||
Response responseObject = this.omapper.readerFor(responseType).readValue(istream);
|
InputStream istream = response.getEntity().getContent();
|
||||||
responseObject.setHttpStatusCode(response.getStatusLine().getStatusCode());
|
try {
|
||||||
responseObject.setHttpStatusReason(response.getStatusLine().getReasonPhrase());
|
responseObject = this.omapper.readerFor(responseType).readValue(istream);
|
||||||
return responseObject;
|
} finally {
|
||||||
} finally {
|
istream.close();
|
||||||
istream.close();
|
}
|
||||||
|
} else {
|
||||||
|
responseObject = this.omapper.readerFor(responseType).readValue("{}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
responseObject.setHttpStatusCode(response.getStatusLine().getStatusCode());
|
||||||
|
responseObject.setHttpStatusReason(response.getStatusLine().getReasonPhrase());
|
||||||
|
return responseObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package com.inteligr8.http;
|
package com.inteligr8.github.http;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.inteligr8.http;
|
package com.inteligr8.github.http;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
@ -2,7 +2,7 @@ package com.inteligr8.github.model;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.inteligr8.http.BaseResponse;
|
import com.inteligr8.github.http.BaseResponse;
|
||||||
|
|
||||||
public class CreatePullRequest {
|
public class CreatePullRequest {
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ package com.inteligr8.github.model;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.inteligr8.http.BaseResponse;
|
import com.inteligr8.github.http.BaseResponse;
|
||||||
|
|
||||||
public class CreateReference {
|
public class CreateReference {
|
||||||
|
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.inteligr8.github.model;
|
||||||
|
|
||||||
|
public class DeleteReference {
|
||||||
|
|
||||||
|
private DeleteReference() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String constructRequestPath(String repoName, String ref) {
|
||||||
|
return "/repos/" + repoName + "/" + httpPath + "/" + ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String constructRequestPathByBranch(String repoName, String branchName) {
|
||||||
|
return constructRequestPath(repoName, "refs/heads/" + branchName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String httpPath = "git";
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user