Package zendesk.support
Interface UploadProvider
-
public interface UploadProvider
A provider which will offer a higher level of abstraction compared to the
UploadService
You can create an instance of UploadProvider like this:import zendesk.support.UploadProvider; import zendesk.support.Support; ... UploadProvider provider = Support.INSTANCE.provider().uploadProvider(); ...
Once you have an instance of the provider you can call methods on it and handle the results in callbacks. A success callback will give you the resource(s) that you are requesting. The error callback will be called if there was some issue with the method call and it will define details about the error in an
ErrorResponse
For example you can upload a file like this:
File fileToUpload = new File(getExternalFilesDir(Environment.DIRECTORY_PICTURES), "picture.png"); provider.uploadAttachment("screenshot.png", fileToUpload, "image/png", new ZendeskCallback<UploadResponse>() { @Override public void onSuccess(UploadResponse uploadResponse) { // Handle success } @Override public void onError(ErrorResponse errorResponse) { // Handle error } });
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description void
deleteAttachment(java.lang.String token, <any> callback)
Calls a upload service to delete an upload on behalf of the end-user.void
uploadAttachment(java.lang.String fileName, java.io.File file, java.lang.String mimeType, <any> callback)
Calls a upload service to upload a file on behalf of the end-user.
-
-
-
Method Detail
-
uploadAttachment
void uploadAttachment(java.lang.String fileName, java.io.File file, java.lang.String mimeType, <any> callback)
Calls a upload service to upload a file on behalf of the end-user.- Parameters:
fileName
- Name of the filefile
- The actual file which should be uploadedmimeType
- The MIME type of the file (e.g. "image/png")callback
- Callback that will deliver a newly uploaded file of typeUploadResponse
orErrorResponse
- Since:
- 1.1.0.1
-
deleteAttachment
void deleteAttachment(java.lang.String token, <any> callback)
Calls a upload service to delete an upload on behalf of the end-user.- Parameters:
token
- Token of an attachment (UploadResponse.getToken()
)callback
- Callback that will deliver a newly uploaded file of typeResponse
orErrorResponse
- Since:
- 1.1.0.1
-
-