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

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

public class DownloadService
extends GitHubService

Service for accessing, creating, and deleting repositories downloads.

See Also:
GitHub downloads API documentation

Field Summary
static String UPLOAD_ACL
          UPLOAD_ACL
static String UPLOAD_AWS_ACCESS_KEY_ID
          UPLOAD_AWS_ACCESS_KEY_ID
static String UPLOAD_CONTENT_TYPE
          UPLOAD_CONTENT_TYPE
static String UPLOAD_FILE
          UPLOAD_FILE
static String UPLOAD_FILENAME
          UPLOAD_FILENAME
static String UPLOAD_KEY
          UPLOAD_KEY
static String UPLOAD_POLICY
          UPLOAD_POLICY
static String UPLOAD_SIGNATURE
          UPLOAD_SIGNATURE
static String UPLOAD_SUCCESS_ACTION_STATUS
          UPLOAD_SUCCESS_ACTION_STATUS
 
Fields inherited from class org.eclipse.egit.github.core.service.GitHubService
ACCEPT_FULL, ACCEPT_HTML, ACCEPT_TEXT, client
 
Constructor Summary
DownloadService()
          Create download service
DownloadService(GitHubClient client)
          Create download service
 
Method Summary
 DownloadResource createDownload(IRepositoryIdProvider repository, Download download, File file)
          Create download from content of given file.
 DownloadResource createDownload(IRepositoryIdProvider repository, Download download, InputStream content, long size)
          Create download and set the content to be the content of given input stream.
protected  PagedRequest<Download> createDownloadsRequest(IRepositoryIdProvider repository, int start, int size)
          Create paged downloads request
 DownloadResource createResource(IRepositoryIdProvider repository, Download download)
          Create a new resource for download associated with the given repository
 void deleteDownload(IRepositoryIdProvider repository, int id)
          Delete download with given id from given repository
 Download getDownload(IRepositoryIdProvider repository, int id)
          Get download metadata for given repository and id
 List<Download> getDownloads(IRepositoryIdProvider repository)
          Get metadata for all downloads for given repository
 PageIterator<Download> pageDownloads(IRepositoryIdProvider repository)
          Page metadata for downloads for given repository
 PageIterator<Download> pageDownloads(IRepositoryIdProvider repository, int size)
          Page downloads for given repository
 PageIterator<Download> pageDownloads(IRepositoryIdProvider repository, int start, int size)
          Page downloads for given repository
 void uploadResource(DownloadResource resource, InputStream content, long size)
          Upload a resource to be available as the download described by the given resource.
 
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
 

Field Detail

UPLOAD_KEY

public static final String UPLOAD_KEY
UPLOAD_KEY

See Also:
Constant Field Values

UPLOAD_ACL

public static final String UPLOAD_ACL
UPLOAD_ACL

See Also:
Constant Field Values

UPLOAD_SUCCESS_ACTION_STATUS

public static final String UPLOAD_SUCCESS_ACTION_STATUS
UPLOAD_SUCCESS_ACTION_STATUS

See Also:
Constant Field Values

UPLOAD_FILENAME

public static final String UPLOAD_FILENAME
UPLOAD_FILENAME

See Also:
Constant Field Values

UPLOAD_AWS_ACCESS_KEY_ID

public static final String UPLOAD_AWS_ACCESS_KEY_ID
UPLOAD_AWS_ACCESS_KEY_ID

See Also:
Constant Field Values

UPLOAD_POLICY

public static final String UPLOAD_POLICY
UPLOAD_POLICY

See Also:
Constant Field Values

UPLOAD_SIGNATURE

public static final String UPLOAD_SIGNATURE
UPLOAD_SIGNATURE

See Also:
Constant Field Values

UPLOAD_FILE

public static final String UPLOAD_FILE
UPLOAD_FILE

See Also:
Constant Field Values

UPLOAD_CONTENT_TYPE

public static final String UPLOAD_CONTENT_TYPE
UPLOAD_CONTENT_TYPE

See Also:
Constant Field Values
Constructor Detail

DownloadService

public DownloadService()
Create download service


DownloadService

public DownloadService(GitHubClient client)
Create download service

Parameters:
client -
Method Detail

getDownload

public Download getDownload(IRepositoryIdProvider repository,
                            int id)
                     throws IOException
Get download metadata for given repository and id

Parameters:
repository -
id -
Returns:
download
Throws:
IOException

createDownloadsRequest

protected PagedRequest<Download> createDownloadsRequest(IRepositoryIdProvider repository,
                                                        int start,
                                                        int size)
Create paged downloads request

Parameters:
repository -
start -
size -
Returns:
request

getDownloads

public List<Download> getDownloads(IRepositoryIdProvider repository)
                            throws IOException
Get metadata for all downloads for given repository

Parameters:
repository -
Returns:
non-null but possibly empty list of download metadata
Throws:
IOException

pageDownloads

public PageIterator<Download> pageDownloads(IRepositoryIdProvider repository)
Page metadata for downloads for given repository

Parameters:
repository -
Returns:
iterator over pages of downloads

pageDownloads

public PageIterator<Download> pageDownloads(IRepositoryIdProvider repository,
                                            int size)
Page downloads for given repository

Parameters:
repository -
size -
Returns:
iterator over pages of downloads

pageDownloads

public PageIterator<Download> pageDownloads(IRepositoryIdProvider repository,
                                            int start,
                                            int size)
Page downloads for given repository

Parameters:
repository -
start -
size -
Returns:
iterator over pages of downloads

deleteDownload

public void deleteDownload(IRepositoryIdProvider repository,
                           int id)
                    throws IOException
Delete download with given id from given repository

Parameters:
repository -
id -
Throws:
IOException

createResource

public DownloadResource createResource(IRepositoryIdProvider repository,
                                       Download download)
                                throws IOException
Create a new resource for download associated with the given repository

Parameters:
repository -
download -
Returns:
download resource
Throws:
IOException

uploadResource

public void uploadResource(DownloadResource resource,
                           InputStream content,
                           long size)
                    throws IOException
Upload a resource to be available as the download described by the given resource.

Parameters:
resource -
content -
size -
Throws:
IOException

createDownload

public DownloadResource createDownload(IRepositoryIdProvider repository,
                                       Download download,
                                       InputStream content,
                                       long size)
                                throws IOException
Create download and set the content to be the content of given input stream. This is a convenience method that performs a createResource(IRepositoryIdProvider, Download) followed by a uploadResource(DownloadResource, InputStream, long) with the results.

Parameters:
repository -
download - metadata about the download
content - raw content of the download
size - size of content in the input stream
Returns:
created resource
Throws:
IOException

createDownload

public DownloadResource createDownload(IRepositoryIdProvider repository,
                                       Download download,
                                       File file)
                                throws IOException
Create download from content of given file.

Parameters:
repository -
download - metadata about the download
file - must be non-null
Returns:
created resource
Throws:
IOException
See Also:
createDownload(IRepositoryIdProvider, Download, InputStream, long)


Copyright © 2012. All Rights Reserved.