com.github.jamesnetherton.zulip.client.api.draft.request.GetDraftsApiRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of zulip-java-client Show documentation
Show all versions of zulip-java-client Show documentation
Java client for the Zulip REST API
The newest version!
package com.github.jamesnetherton.zulip.client.api.draft.request;
import static com.github.jamesnetherton.zulip.client.api.draft.request.DraftRequestConstants.DRAFTS_API_PATH;
import com.github.jamesnetherton.zulip.client.api.core.ExecutableApiRequest;
import com.github.jamesnetherton.zulip.client.api.core.ZulipApiRequest;
import com.github.jamesnetherton.zulip.client.api.draft.Draft;
import com.github.jamesnetherton.zulip.client.api.draft.response.GetDraftsApiResponse;
import com.github.jamesnetherton.zulip.client.exception.ZulipClientException;
import com.github.jamesnetherton.zulip.client.http.ZulipHttpClient;
import java.util.List;
public class GetDraftsApiRequest extends ZulipApiRequest implements ExecutableApiRequest> {
/**
* Constructs a {@link GetDraftsApiRequest}.
*
* @param client The Zulip HTTP client
*/
public GetDraftsApiRequest(ZulipHttpClient client) {
super(client);
}
/**
* Executes the Zulip API request for fetching drafts.
*
* @return The list of drafts
* @throws ZulipClientException if the request was not successful
*/
@Override
public List execute() throws ZulipClientException {
GetDraftsApiResponse response = client().get(DRAFTS_API_PATH, getParams(), GetDraftsApiResponse.class);
return response.getDrafts();
}
}