org.eclipse.egit.github.core.service
Class GitHubService

java.lang.Object
  extended by org.eclipse.egit.github.core.service.GitHubService
Direct Known Subclasses:
CollaboratorService, CommitService, DataService, DeployKeyService, DownloadService, EventService, GistService, IssueService, LabelService, MilestoneService, OAuthService, OrganizationService, PullRequestService, RepositoryService, TeamService, UserService, WatcherService

public abstract class GitHubService
extends Object

Base GitHub service class.


Field Summary
protected static String ACCEPT_FULL
          Accept header for full response
protected static String ACCEPT_HTML
          Accept header for HTML response
protected static String ACCEPT_TEXT
          Accept header for text response
protected  GitHubClient client
          Client field
 
Constructor Summary
GitHubService()
          Create service using a default GitHubClient
GitHubService(GitHubClient client)
          Create service for client
 
Method Summary
protected  boolean check(String uri)
          Check if the uri returns a non-404
protected
<V> PagedRequest<V>
createPagedRequest()
          Unified paged request creation method that all sub-classes should use so overriding classes can extend and configure the default request.
protected
<V> PagedRequest<V>
createPagedRequest(int start, int size)
          Unified paged request creation method that all sub-classes should use so overriding classes can extend and configure the default request.
protected
<V> PageIterator<V>
createPageIterator(PagedRequest<V> request)
          Unified page iterator creation method that all sub-classes should use so overriding classes can extend and configure the default iterator.
protected  GitHubRequest createRequest()
          Unified request creation method that all sub-classes should use so overriding classes can extend and configure the default request.
protected
<V> List<V>
getAll(PagedRequest<V> request)
          Get paged request by performing multiple requests until no more pages are available or an exception occurs.
protected
<V> List<V>
getAll(PageIterator<V> iterator)
          Get paged request by performing multiple requests until no more pages are available or an exception occurs.
 GitHubClient getClient()
          Get configured client
protected  String getId(IRepositoryIdProvider provider)
          Get id for repository
protected  GitHubService verifyRepository(String user, String repository)
          Verify user and repository name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACCEPT_FULL

protected static final String ACCEPT_FULL
Accept header for full response

See Also:
Constant Field Values

ACCEPT_HTML

protected static final String ACCEPT_HTML
Accept header for HTML response

See Also:
Constant Field Values

ACCEPT_TEXT

protected static final String ACCEPT_TEXT
Accept header for text response

See Also:
Constant Field Values

client

protected final GitHubClient client
Client field

Constructor Detail

GitHubService

public GitHubService()
Create service using a default GitHubClient


GitHubService

public GitHubService(GitHubClient client)
Create service for client

Parameters:
client - must be non-null
Method Detail

getClient

public GitHubClient getClient()
Get configured client

Returns:
non-null client

createRequest

protected GitHubRequest createRequest()
Unified request creation method that all sub-classes should use so overriding classes can extend and configure the default request.

Returns:
request

createPagedRequest

protected <V> PagedRequest<V> createPagedRequest()
Unified paged request creation method that all sub-classes should use so overriding classes can extend and configure the default request.

Returns:
request

createPagedRequest

protected <V> PagedRequest<V> createPagedRequest(int start,
                                                 int size)
Unified paged request creation method that all sub-classes should use so overriding classes can extend and configure the default request.

Parameters:
start -
size -
Returns:
request

createPageIterator

protected <V> PageIterator<V> createPageIterator(PagedRequest<V> request)
Unified page iterator creation method that all sub-classes should use so overriding classes can extend and configure the default iterator.

Parameters:
request -
Returns:
iterator

getAll

protected <V> List<V> getAll(PagedRequest<V> request)
                  throws IOException
Get paged request by performing multiple requests until no more pages are available or an exception occurs.

Type Parameters:
V -
Parameters:
request -
Returns:
list of all elements
Throws:
IOException

getAll

protected <V> List<V> getAll(PageIterator<V> iterator)
                  throws IOException
Get paged request by performing multiple requests until no more pages are available or an exception occurs.

Type Parameters:
V -
Parameters:
iterator -
Returns:
list of all elements
Throws:
IOException

check

protected boolean check(String uri)
                 throws IOException
Check if the uri returns a non-404

Parameters:
uri -
Returns:
true if no exception, false if 404
Throws:
IOException

getId

protected String getId(IRepositoryIdProvider provider)
Get id for repository

Parameters:
provider -
Returns:
non-null id

verifyRepository

protected GitHubService verifyRepository(String user,
                                         String repository)
Verify user and repository name

Parameters:
user -
repository -
Returns:
this service


Copyright © 2012. All Rights Reserved.