|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.egit.github.core.client.GitHubClient
public class GitHubClient
Client class for interacting with GitHub HTTP/JSON API.
| Constructor Summary | |
|---|---|
GitHubClient()
Create default client |
|
GitHubClient(org.apache.http.HttpHost httpHost)
Create client for host configuration |
|
GitHubClient(String hostname)
Create client for host name |
|
GitHubClient(String hostname,
int port,
String scheme)
Create client for host, port, and scheme |
|
| Method Summary | ||
|---|---|---|
protected
|
configureRequest(V request)
Configure request with standard headers |
|
protected String |
configureUri(String uri)
Configure request URI |
|
static GitHubClient |
createClient(String url)
Create API v3 client from URL. |
|
protected org.apache.http.client.methods.HttpDelete |
createDelete(String uri)
Create delete method |
|
protected IOException |
createException(org.apache.http.HttpResponse response,
org.apache.http.StatusLine status)
Create error exception from response and throw it |
|
protected org.apache.http.client.methods.HttpGet |
createGet(String uri)
Create get method |
|
protected org.apache.http.client.methods.HttpPost |
createPost(String uri)
Create standard post method |
|
protected org.apache.http.client.methods.HttpPut |
createPut(String uri)
Create standard put method |
|
void |
delete(String uri)
Delete resource at URI. |
|
void |
delete(String uri,
Object params)
Delete resource at URI. |
|
GitHubResponse |
get(GitHubRequest request)
Get response from URI and bind to specified type |
|
protected org.apache.http.HttpEntity |
getEntity(org.apache.http.HttpResponse response)
Get HttpEntity from response |
|
protected org.apache.http.StatusLine |
getStatus(org.apache.http.HttpResponse response)
Get status line from response |
|
InputStream |
getStream(GitHubRequest request)
Get response stream from URI. |
|
protected InputStream |
getStream(org.apache.http.HttpResponse response)
Get InputStream from response |
|
String |
getUser()
Get the user that this client is currently authenticating as |
|
protected boolean |
isEmpty(org.apache.http.HttpResponse response,
org.apache.http.StatusLine status)
Is the response empty? |
|
protected boolean |
isOk(org.apache.http.HttpResponse response,
org.apache.http.StatusLine status)
Is the response successful? |
|
protected RequestError |
parseError(org.apache.http.HttpResponse response)
Parse error from response |
|
protected
|
parseJson(org.apache.http.HttpResponse response,
Type type)
Parse JSON to specified type |
|
void |
post(String uri)
Post to URI |
|
|
post(String uri,
Object params,
Type type)
Post data to URI |
|
void |
put(String uri)
Put to URI |
|
|
put(String uri,
Object params,
Type type)
Put data to URI |
|
protected
|
sendJson(org.apache.http.client.methods.HttpEntityEnclosingRequestBase method,
Object params,
Type type)
Send JSON using specified method |
|
GitHubClient |
setCredentials(String user,
String password)
Set credentials |
|
GitHubClient |
setOAuth2Token(String token)
Set OAuth2 token |
|
GitHubClient |
setSerializeNulls(boolean serializeNulls)
Set whether or not serialized data should include fields that are null. |
|
GitHubClient |
setUserAgent(String agent)
Set the value to set as the user agent header on every request created. |
|
protected GitHubClient |
updateCredentials(String user,
String password)
Update credential on HTTP client credentials provider |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public GitHubClient()
public GitHubClient(String hostname)
hostname -
public GitHubClient(String hostname,
int port,
String scheme)
hostname - port - scheme - public GitHubClient(org.apache.http.HttpHost httpHost)
httpHost - | Method Detail |
|---|
public static GitHubClient createClient(String url)
This creates an HTTPS-based client with a host that contains the host value of the given URL prefixed with 'api' if the given URL is github.com or gist.github.com
url -
public GitHubClient setSerializeNulls(boolean serializeNulls)
serializeNulls -
public GitHubClient setUserAgent(String agent)
agent -
protected <V extends org.apache.http.HttpMessage> V configureRequest(V request)
request -
protected String configureUri(String uri)
uri -
protected org.apache.http.client.methods.HttpPost createPost(String uri)
uri -
protected org.apache.http.client.methods.HttpPut createPut(String uri)
uri -
protected org.apache.http.client.methods.HttpGet createGet(String uri)
uri -
protected org.apache.http.client.methods.HttpDelete createDelete(String uri)
uri -
protected GitHubClient updateCredentials(String user,
String password)
user - password -
public GitHubClient setCredentials(String user,
String password)
user - password -
public GitHubClient setOAuth2Token(String token)
token -
public String getUser()
protected <V> V parseJson(org.apache.http.HttpResponse response,
Type type)
throws IOException
V - response - type -
IOException
protected org.apache.http.HttpEntity getEntity(org.apache.http.HttpResponse response)
throws IOException
HttpEntity from response
response -
IOException
protected InputStream getStream(org.apache.http.HttpResponse response)
throws IOException
InputStream from response
response -
IOException
protected RequestError parseError(org.apache.http.HttpResponse response)
throws IOException
response -
IOException
protected IOException createException(org.apache.http.HttpResponse response,
org.apache.http.StatusLine status)
response - status -
IOException
protected boolean isOk(org.apache.http.HttpResponse response,
org.apache.http.StatusLine status)
response - status -
protected boolean isEmpty(org.apache.http.HttpResponse response,
org.apache.http.StatusLine status)
response - status -
protected org.apache.http.StatusLine getStatus(org.apache.http.HttpResponse response)
throws IOException
response -
IOException
public InputStream getStream(GitHubRequest request)
throws IOException
request -
IOException
public GitHubResponse get(GitHubRequest request)
throws IOException
request -
IOException
protected <V> V sendJson(org.apache.http.client.methods.HttpEntityEnclosingRequestBase method,
Object params,
Type type)
throws IOException
V - method - params - type -
IOException
public <V> V post(String uri,
Object params,
Type type)
throws IOException
V - uri - params - type -
IOException
public void post(String uri)
throws IOException
uri -
IOException
public <V> V put(String uri,
Object params,
Type type)
throws IOException
V - uri - params - type -
IOException
public void put(String uri)
throws IOException
uri -
IOException
public void delete(String uri,
Object params)
throws IOException
IOException
when the response status is not a 204 (No Content).
uri - params -
IOException
public void delete(String uri)
throws IOException
IOException
when the response status is not a 204 (No Content).
uri -
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||