public interface UploadManager
Upload flow consists of 3 separate steps: request creation key, upload content and server processing. See details: http://developers.gfycat.com/api/#upload-gifs
Modifier and Type | Interface and Description |
---|---|
static class |
UploadManager.CanNotCreateKeyException
Indicates that request creation key step failed.
|
static class |
UploadManager.CanNotGetGfycatStatusException
Indicates that request creation key and upload content steps have passed, but
UploadManager was unable to retrieve creation status from Gfycat.com |
static class |
UploadManager.CanNotUploadGfycatException
Indicates that upload content step failed.
|
static class |
UploadManager.CreationTimeoutException
Happens when creation flow ended by timeout.
|
static class |
UploadManager.FailedToCreateGfycatException
Indicates that request creation key and upload content steps have passed, but
Gfycat.com was unable to create Gfycat from uploaded content.
|
static class |
UploadManager.GfycatWasDeletedBeforeCompletionException
Indicates that Gfycat was deleted on server, while creation flow was in process.
|
static class |
UploadManager.InternalCreationException
Indicates that creation flow terminated due to internal logic error.
|
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_SERVER_PROCESSING_TIMEOUT
Estimated time for a server to process a
Gfycat . |
Modifier and Type | Method and Description |
---|---|
Gfycat |
createGfycat(CreateGfycatRequest creationParams,
java.io.InputStream inputStream)
Encapsulates all three steps of creation flow.
|
Gfycat |
createGfycat(CreateGfycatRequest creationParams,
java.io.InputStream inputStream,
UploadListener uploadListener)
Same as
createGfycat(CreateGfycatRequest, InputStream) but with progress reporting. |
Gfycat |
getGfycatIfReady(java.lang.String gfyName) |
boolean |
isGfycatReady(java.lang.String gfyName) |
java.lang.String |
requestCreationKey(CreateGfycatRequest creationParams)
Creation key request.
|
void |
upload(java.lang.String creationKey,
java.io.InputStream inputStream)
Upload video file with creation key provided by
requestCreationKey(CreateGfycatRequest) . |
void |
upload(java.lang.String creationKey,
java.io.InputStream inputStream,
UploadListener uploadListener)
Same as
upload(String, InputStream) but with progress reporting. |
Gfycat |
waitUntilReady(java.lang.String creationKey)
Same as
waitUntilReady(String) but with DEFAULT_SERVER_PROCESSING_TIMEOUT |
Gfycat |
waitUntilReady(java.lang.String creationKey,
long timeout)
Synchronously wait for server processing result.
|
static final long DEFAULT_SERVER_PROCESSING_TIMEOUT
Gfycat
.java.lang.String requestCreationKey(CreateGfycatRequest creationParams) throws UploadManager.CanNotCreateKeyException
Call upload(String, InputStream)
method next, by providing returned key.
creationParams
- creation parameters.UploadManager.CanNotCreateKeyException
- in case of request failure.void upload(java.lang.String creationKey, java.io.InputStream inputStream) throws UploadManager.CanNotUploadGfycatException
requestCreationKey(CreateGfycatRequest)
. This is a second creation flow step.creationKey
- unique key for this upload.inputStream
- gfycat content from stream.UploadManager.CanNotUploadGfycatException
- thrown error happens during uploading.void upload(java.lang.String creationKey, java.io.InputStream inputStream, UploadListener uploadListener) throws UploadManager.CanNotUploadGfycatException
upload(String, InputStream)
but with progress reporting.Gfycat waitUntilReady(java.lang.String creationKey, long timeout) throws UploadManager.CanNotGetGfycatStatusException, UploadManager.FailedToCreateGfycatException, UploadManager.GfycatWasDeletedBeforeCompletionException
Gfycat
will be returned once it becomes available on server.
creationKey
- unique key for this upload provided by requestCreationKey(CreateGfycatRequest)
timeout
- wait timeout.Gfycat
available on server.UploadManager.CanNotGetGfycatStatusException
- if Gfycat
was not returned by server within a specified timeout.UploadManager.FailedToCreateGfycatException
UploadManager.GfycatWasDeletedBeforeCompletionException
Gfycat waitUntilReady(java.lang.String creationKey) throws UploadManager.CanNotGetGfycatStatusException, UploadManager.FailedToCreateGfycatException, UploadManager.GfycatWasDeletedBeforeCompletionException
waitUntilReady(String)
but with DEFAULT_SERVER_PROCESSING_TIMEOUT
Gfycat getGfycatIfReady(java.lang.String gfyName)
gfyName
- of uploaded gfycatGfycat
if it exists, null otherwise.boolean isGfycatReady(java.lang.String gfyName)
gfyName
- of uploaded gfycat.true
if Gfycat is available, false otherwise. Tip: use FeedManager.getGfycat(String)
to get it if true
returned.Gfycat createGfycat(CreateGfycatRequest creationParams, java.io.InputStream inputStream) throws UploadManager.CanNotCreateKeyException, UploadManager.CanNotGetGfycatStatusException, UploadManager.CanNotUploadGfycatException, UploadManager.FailedToCreateGfycatException, UploadManager.GfycatWasDeletedBeforeCompletionException
requestCreationKey(CreateGfycatRequest)
, upload(String, InputStream)
, waitUntilReady(String)
creationParams
- creation parameters.inputStream
- gfycat content from stream.Gfycat
available on server.UploadManager.CanNotGetGfycatStatusException
- if Gfycat
was not returned by server within a default DEFAULT_SERVER_PROCESSING_TIMEOUT
timeout.UploadManager.CanNotCreateKeyException
UploadManager.CanNotUploadGfycatException
UploadManager.FailedToCreateGfycatException
UploadManager.GfycatWasDeletedBeforeCompletionException
Gfycat createGfycat(CreateGfycatRequest creationParams, java.io.InputStream inputStream, UploadListener uploadListener) throws UploadManager.CanNotCreateKeyException, UploadManager.CanNotGetGfycatStatusException, UploadManager.CanNotUploadGfycatException, UploadManager.FailedToCreateGfycatException, UploadManager.GfycatWasDeletedBeforeCompletionException
createGfycat(CreateGfycatRequest, InputStream)
but with progress reporting.