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

java.lang.Object
  extended by org.eclipse.egit.github.core.service.GitHubService
      extended by org.eclipse.egit.github.core.service.GistService

public class GistService
extends GitHubService

Service class for interacting with Gists and Gist comments.

See Also:
GitHub Gist API documentation, GitHub Gist comments API documentation

Field Summary
 
Fields inherited from class org.eclipse.egit.github.core.service.GitHubService
ACCEPT_FULL, ACCEPT_HTML, ACCEPT_TEXT, client
 
Constructor Summary
GistService()
          Create gist service
GistService(GitHubClient client)
          Create gist service
 
Method Summary
protected  String checkGistId(String gistId)
          Check that gist id is non-null and non-empty
 Comment createComment(String gistId, String comment)
          Create comment on specified gist id
 Gist createGist(Gist gist)
          Create a gist
protected  PagedRequest<Gist> createUserGistRequest(String user, int start, int size)
          Create user gist paged request
 void deleteComment(long commentId)
          Delete the Gist comment with the given id
 void deleteGist(String gistId)
          Delete the Gist with the given id
 Comment editComment(Comment comment)
          Edit gist comment
 Gist forkGist(String gistId)
          Fork gist with given id
 Comment getComment(long commentId)
          Get gist comment with id
 List<Comment> getComments(String gistId)
          Get comments for specified gist id
 Gist getGist(String id)
          Get gist
 List<Gist> getGists(String user)
          Get gists for specified user
 List<Gist> getStarredGists()
          Get starred gists for currently authenticated user
 boolean isStarred(String gistId)
          Check if a gist is starred
 PageIterator<Gist> pageGists(String user)
          Create page iterator for given user's gists
 PageIterator<Gist> pageGists(String user, int size)
          Create page iterator for given user's gists
 PageIterator<Gist> pageGists(String user, int start, int size)
          Create page iterator for given user's gists
 PageIterator<Gist> pagePublicGists()
          Create page iterator for all public gists
 PageIterator<Gist> pagePublicGists(int size)
          Create page iterator for all public gists
 PageIterator<Gist> pagePublicGists(int start, int size)
          Create page iterator for all public gists
 PageIterator<Gist> pageStarredGists()
          Create page iterator for the current user's starred gists
 PageIterator<Gist> pageStarredGists(int size)
          Create page iterator for the current user's starred gists
 PageIterator<Gist> pageStarredGists(int start, int size)
          Create page iterator for the current user's starred gists
 void starGist(String gistId)
          Star the gist with the given id
 void unstarGist(String gistId)
          Unstar the gist with the given id
 Gist updateGist(Gist gist)
          Update a gist
 
Methods inherited from class org.eclipse.egit.github.core.service.GitHubService
check, createPagedRequest, createPagedRequest, createPageIterator, createRequest, getAll, getAll, getClient, getId, verifyRepository
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GistService

public GistService()
Create gist service


GistService

public GistService(GitHubClient client)
Create gist service

Parameters:
client -
Method Detail

checkGistId

protected String checkGistId(String gistId)
Check that gist id is non-null and non-empty

Parameters:
gistId -
Returns:
gist id

getGist

public Gist getGist(String id)
             throws IOException
Get gist

Parameters:
id -
Returns:
gist
Throws:
IOException

pageStarredGists

public PageIterator<Gist> pageStarredGists()
Create page iterator for the current user's starred gists

Returns:
gist page iterator

pageStarredGists

public PageIterator<Gist> pageStarredGists(int size)
Create page iterator for the current user's starred gists

Parameters:
size - size of page
Returns:
gist page iterator

pageStarredGists

public PageIterator<Gist> pageStarredGists(int start,
                                           int size)
Create page iterator for the current user's starred gists

Parameters:
size - size of page
start - starting page
Returns:
gist page iterator

getStarredGists

public List<Gist> getStarredGists()
                           throws IOException
Get starred gists for currently authenticated user

Returns:
list of gists
Throws:
IOException

createUserGistRequest

protected PagedRequest<Gist> createUserGistRequest(String user,
                                                   int start,
                                                   int size)
Create user gist paged request

Parameters:
user -
start -
size -
Returns:
request

getGists

public List<Gist> getGists(String user)
                    throws IOException
Get gists for specified user

Parameters:
user -
Returns:
list of gists
Throws:
IOException

pageGists

public PageIterator<Gist> pageGists(String user)
Create page iterator for given user's gists

Parameters:
user -
Returns:
gist page iterator

pageGists

public PageIterator<Gist> pageGists(String user,
                                    int size)
Create page iterator for given user's gists

Parameters:
user -
size - size of page
Returns:
gist page iterator

pageGists

public PageIterator<Gist> pageGists(String user,
                                    int start,
                                    int size)
Create page iterator for given user's gists

Parameters:
user -
size - size of page
start - starting page
Returns:
gist page iterator

pagePublicGists

public PageIterator<Gist> pagePublicGists()
Create page iterator for all public gists

Returns:
gist page iterator

pagePublicGists

public PageIterator<Gist> pagePublicGists(int size)
Create page iterator for all public gists

Parameters:
size - size of page
Returns:
gist page iterator

pagePublicGists

public PageIterator<Gist> pagePublicGists(int start,
                                          int size)
Create page iterator for all public gists

Parameters:
start - starting page number
size - size of page
Returns:
gist page iterator

createGist

public Gist createGist(Gist gist)
                throws IOException
Create a gist

Parameters:
gist -
Returns:
created gist
Throws:
IOException

updateGist

public Gist updateGist(Gist gist)
                throws IOException
Update a gist

Parameters:
gist -
Returns:
updated gist
Throws:
IOException

createComment

public Comment createComment(String gistId,
                             String comment)
                      throws IOException
Create comment on specified gist id

Parameters:
gistId -
comment -
Returns:
created issue
Throws:
IOException

getComments

public List<Comment> getComments(String gistId)
                          throws IOException
Get comments for specified gist id

Parameters:
gistId -
Returns:
list of comments
Throws:
IOException

deleteGist

public void deleteGist(String gistId)
                throws IOException
Delete the Gist with the given id

Parameters:
gistId -
Throws:
IOException

getComment

public Comment getComment(long commentId)
                   throws IOException
Get gist comment with id

Parameters:
commentId -
Returns:
comment
Throws:
IOException

editComment

public Comment editComment(Comment comment)
                    throws IOException
Edit gist comment

Parameters:
comment -
Returns:
edited comment
Throws:
IOException

deleteComment

public void deleteComment(long commentId)
                   throws IOException
Delete the Gist comment with the given id

Parameters:
commentId -
Throws:
IOException

starGist

public void starGist(String gistId)
              throws IOException
Star the gist with the given id

Parameters:
gistId -
Throws:
IOException

unstarGist

public void unstarGist(String gistId)
                throws IOException
Unstar the gist with the given id

Parameters:
gistId -
Throws:
IOException

isStarred

public boolean isStarred(String gistId)
                  throws IOException
Check if a gist is starred

Parameters:
gistId -
Returns:
true if starred, false if not starred
Throws:
IOException

forkGist

public Gist forkGist(String gistId)
              throws IOException
Fork gist with given id

Parameters:
gistId -
Returns:
forked gist
Throws:
IOException


Copyright © 2012. All Rights Reserved.