Package com.cloudinary.android
Class UploadRequest<T extends Payload>
java.lang.Object
com.cloudinary.android.UploadRequest<T>
- Type Parameters:
T- The payload type this request will upload
public class UploadRequest<T extends Payload>
extends java.lang.Object
A request to upload a single
Payload to Cloudinary. Note: Once calling dispatch() the request is sealed and any
attempt to modify it will produce an IllegalStateException. If there's a need to change a request after dispatching,
it needs to be cancelled (MediaManager.cancelRequest(String)) and a new request should be dispatched in it's place.-
Constructor Summary
Constructors Constructor Description UploadRequest(UploadContext<T> uploadContext) -
Method Summary
Modifier and Type Method Description UploadRequest<T>callback(UploadCallback callback)Setup a callback to get notified on upload events.UploadRequest<T>constrain(TimeWindow timeWindow)Constrain this request to run within a specificTimeWindow.java.lang.Stringdispatch()Dispatch the requestjava.lang.Stringdispatch(android.content.Context context)Dispatch the requestTgetPayload()java.lang.StringgetRequestId()UploadRequest<T>maxFileSize(long bytes)Fail the request is the file size is larger than thisUploadRequest<T>option(java.lang.String name, java.lang.Object value)Add an option to this request.UploadRequest<T>options(java.util.Map<java.lang.String,java.lang.Object> options)Set a map of options for this request.UploadRequest<T>policy(UploadPolicy policy)Set the upload uploadPolicy for the requestUploadRequest<T>preprocess(PreprocessChain preprocessChain)Add a chain of preprocessing step to run on the resource before uploadingjava.lang.StringstartNow(android.content.Context context)Start the request immediately, ignoring all other constraints.UploadRequest<T>unsigned(java.lang.String uploadPreset)Make this an unsigned upload
-
Constructor Details
-
Method Details
-
callback
Setup a callback to get notified on upload events.- Returns:
- This request for chaining.
-
unsigned
Make this an unsigned upload- Parameters:
uploadPreset- The name of the upload preset to use, as defined in your cloudinary console- Returns:
- This request for chaining.
-
maxFileSize
Fail the request is the file size is larger than this- Parameters:
bytes- Maximum allowed file size to upload- Returns:
- This request for chaining
-
preprocess
Add a chain of preprocessing step to run on the resource before uploading- Parameters:
preprocessChain- Preprocess chain to run on the file before the upload- Returns:
- This request for chaining.
-
constrain
Constrain this request to run within a specificTimeWindow.- Returns:
- This request for chaining.
-
options
Set a map of options for this request. Note: This replaces any existing options.- Returns:
- This request for chaining.
-
option
Add an option to this request.- Parameters:
name- Option name.value- Option value.- Returns:
- This request for chaining.
-
policy
Set the upload uploadPolicy for the request- Parameters:
policy- The uploadPolicy to set. SeeUploadPolicy.Builder- Returns:
- This request for chaining.
-
dispatch
public java.lang.String dispatch()Dispatch the request- Returns:
- The unique id of the request.
-
startNow
public java.lang.String startNow(@NonNull android.content.Context context)Start the request immediately, ignoring all other constraints.- Parameters:
context- Android context- Returns:
- The started request id.
-
dispatch
public java.lang.String dispatch(@Nullable android.content.Context context)Dispatch the request- Parameters:
context- Android context. Needed if using preprocessing. Otherwise can be null.- Returns:
- The unique id of the request.
-
getRequestId
public java.lang.String getRequestId() -
getPayload
-