com.github.jamesnetherton.zulip.client.api.stream.request.ArchiveStreamApiRequest 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.stream.request;
import static com.github.jamesnetherton.zulip.client.api.stream.request.StreamRequestConstants.STREAMS_WITH_ID;
import com.github.jamesnetherton.zulip.client.api.core.VoidExecutableApiRequest;
import com.github.jamesnetherton.zulip.client.api.core.ZulipApiRequest;
import com.github.jamesnetherton.zulip.client.api.core.ZulipApiResponse;
import com.github.jamesnetherton.zulip.client.exception.ZulipClientException;
import com.github.jamesnetherton.zulip.client.http.ZulipHttpClient;
/**
* Zulip API request builder for deleting a topic.
*
* @see https://zulip.com/api/archive-stream
*/
public class ArchiveStreamApiRequest extends ZulipApiRequest implements VoidExecutableApiRequest {
private final String path;
/**
* Constructs a {@link ArchiveStreamApiRequest}.
*
* @param client The Zulip HTTP client
* @param streamId The id of the stream to archive
*/
public ArchiveStreamApiRequest(ZulipHttpClient client, long streamId) {
super(client);
this.path = String.format(STREAMS_WITH_ID, streamId);
}
/**
* Executes the Zulip API request for archiving a stream.
*
* @throws ZulipClientException if the request was not successful
*/
@Override
public void execute() throws ZulipClientException {
client().delete(this.path, getParams(), ZulipApiResponse.class);
}
}