com.github.jamesnetherton.zulip.client.api.invitation.request.GetAllInvitationsApiRequest 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.invitation.request;
import static com.github.jamesnetherton.zulip.client.api.invitation.request.InvitationRequestConstants.INVITATIONS_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.invitation.Invitation;
import com.github.jamesnetherton.zulip.client.api.invitation.response.GetAllInvitationsApiResponse;
import com.github.jamesnetherton.zulip.client.exception.ZulipClientException;
import com.github.jamesnetherton.zulip.client.http.ZulipHttpClient;
import java.util.List;
/**
* Zulip API request builder for fetching invitations.
*
* @see https://zulip.com/api/get-invites
*/
public class GetAllInvitationsApiRequest extends ZulipApiRequest implements ExecutableApiRequest> {
/**
* Constructs a {@link GetAllInvitationsApiRequest}.
*
* @param client The Zulip HTTP client
*/
public GetAllInvitationsApiRequest(ZulipHttpClient client) {
super(client);
}
/**
* Executes the Zulip API request for fetching invitations.
*
* @return List of {@link Invitation} containing each unexpired invitation
* @throws ZulipClientException if the request was not successful
*/
@Override
public List execute() throws ZulipClientException {
return client().get(INVITATIONS_API_PATH, getParams(), GetAllInvitationsApiResponse.class).getInvites();
}
}