Package com.zendesk.sdk.network
Interface RequestProvider
-
public interface RequestProvider
A provider which will offer a higher level of abstraction compared to the
RequestService
You can create an instance of RequestProvider like this:import com.zendesk.sdk.network.RequestProvider; import com.zendesk.sdk.network.impl.ZendeskConfig; ... RequestProvider provider = ZendeskConfig.INSTANCE.provider().requestProvider(); ...
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, like requests, comments, and so on. 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
For example you can list all your requests like this:ErrorResponse
provider.getAllRequests(new ZendeskCallback <List<Request>>() { @Override public void onSuccess(List<Request> requests) { // 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
addComment(java.lang.String requestId, EndUserComment endUserComment, <any> callback)
Add aEndUserComment
to a request.void
createRequest(CreateRequest request, <any> callback)
Calls a request service to create a request on behalf of the end-user.void
getAllRequests(<any> callback)
Gets all requests that user has opened.void
getComments(java.lang.String requestId, <any> callback)
Gets all comments for a request.void
getRequest(java.lang.String requestId, <any> callback)
Calls a request service to get a request for the given request id.void
getRequests(java.lang.String status, <any> callback)
Filters requests that user has opened by a status.void
getTicketFormsById(java.util.List<java.lang.Long> ids, <any> callback)
Get all available ticket forms.
-
-
-
Method Detail
-
createRequest
void createRequest(CreateRequest request, <any> callback)
Calls a request service to create a request on behalf of the end-user.- Parameters:
request
- The request to createcallback
- Callback that will deliver a newly created request of typeCreateRequest
orErrorResponse
- Since:
- 1.2.0.1
-
getAllRequests
void getAllRequests(<any> callback)
Gets all requests that user has opened.- Parameters:
callback
- The callback to invoke which will return a list ofRequest
or anErrorResponse
- Since:
- 1.0.0.1
-
getRequests
void getRequests(java.lang.String status, <any> callback)
Filters requests that user has opened by a status.- Parameters:
status
- A comma separated list of status to filter the results by status.- new
- open
- pending
- hold
- solved
- closed
callback
- The callback to invoke which will return a list ofRequest
or anErrorResponse
- Since:
- 1.0.0.1
-
getComments
void getComments(java.lang.String requestId, <any> callback)
Gets all comments for a request.- Parameters:
requestId
- Id of a request. This is a String Id that will have been returned by#getAllRequests(ZendeskCallback)
or#getRequests(String, ZendeskCallback)
callback
- Callback that will deliver aCommentsResponse
orErrorResponse
- Since:
- 1.0.0.1
-
addComment
void addComment(java.lang.String requestId, EndUserComment endUserComment, <any> callback)
Add aEndUserComment
to a request.- Parameters:
requestId
- Id of a request to post this comment toendUserComment
- AEndUserComment
containing text and attachment tokenscallback
- Callback that will deliver aComment
orErrorResponse
- Since:
- 1.1.0.1
-
getRequest
void getRequest(java.lang.String requestId, <any> callback)
Calls a request service to get a request for the given request id.- Parameters:
requestId
- Id of a requestcallback
- Callback that will deliver aRequest
orErrorResponse
- Since:
- 1.2.0.1
-
getTicketFormsById
void getTicketFormsById(java.util.List<java.lang.Long> ids, <any> callback)
Get all available ticket forms.- Parameters:
ids
- List of ticket form ids to fetchcallback
- Callback that will deliver a list ofTicketForm
orErrorResponse
-
-