Class UnsubscribeStreamsApiRequest
java.lang.Object
com.github.jamesnetherton.zulip.client.api.core.ZulipApiRequest
com.github.jamesnetherton.zulip.client.api.stream.request.UnsubscribeStreamsApiRequest
- All Implemented Interfaces:
ExecutableApiRequest<StreamUnsubscribeResult>
public class UnsubscribeStreamsApiRequest
extends ZulipApiRequest
implements ExecutableApiRequest<StreamUnsubscribeResult>
Zulip API request builder for unsubscribing users from a stream.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionUnsubscribeStreamsApiRequest(ZulipHttpClient client, String[] subscriptions) Constructs aUnsubscribeStreamsApiRequest. -
Method Summary
Modifier and TypeMethodDescriptionexecute()Executes the Zulip API request for unsubscribing users from a stream.withPrincipals(long... userIds) Sets the list of users that are to be unsubscribed from the stream.withPrincipals(String... emailAddresses) Sets the list of users that are to be unsubscribed from the stream.withSendMessagesToRemovedSubscribers(boolean sendMessagesToRemovedSubscribers) Sets whether Notification Bot should send a direct message to other users unsubscribed from channels by this request.Methods inherited from class ZulipApiRequest
client, getParam, getParam, getParams, putParam, putParamAsJsonString, putParamAsWrappedObject
-
Field Details
-
SUBSCRIPTIONS
- See Also:
-
PRINCIPALS
- See Also:
-
SEND_MESSAGES_TO_REMOVED_SUBSCRIBERS
- See Also:
-
-
Constructor Details
-
UnsubscribeStreamsApiRequest
Constructs aUnsubscribeStreamsApiRequest.- Parameters:
client- The Zulip HTTP clientsubscriptions- An array of stream names to unsubscribe from
-
-
Method Details
-
withPrincipals
Sets the list of users that are to be unsubscribed from the stream.- Parameters:
emailAddresses- The array of user email addresses to unsubscribe to the stream- Returns:
- This
UnsubscribeStreamsApiRequestinstance
-
withPrincipals
Sets the list of users that are to be unsubscribed from the stream.- Parameters:
userIds- The array of user ids to unsubscribe to the stream- Returns:
- This
UnsubscribeStreamsApiRequestinstance
-
withSendMessagesToRemovedSubscribers
public UnsubscribeStreamsApiRequest withSendMessagesToRemovedSubscribers(boolean sendMessagesToRemovedSubscribers) Sets whether Notification Bot should send a direct message to other users unsubscribed from channels by this request. Requires Zulip 13 or later. https://zulip.com/api/unsubscribe#parameter-send_messages_to_removed_subscribers- Parameters:
sendMessagesToRemovedSubscribers-trueto notify users who were unsubscribed by this request- Returns:
- This
UnsubscribeStreamsApiRequestinstance
-
execute
Executes the Zulip API request for unsubscribing users from a stream.- Specified by:
executein interfaceExecutableApiRequest<StreamUnsubscribeResult>- Returns:
StreamUnsubscribeResultdescribing the result of the request to unsubscribe users from streams- Throws:
ZulipClientException- if the request was not successful
-