Class SubscribeStreamsApiRequest
java.lang.Object
com.github.jamesnetherton.zulip.client.api.core.ZulipApiRequest
com.github.jamesnetherton.zulip.client.api.stream.request.SubscribeStreamsApiRequest
- All Implemented Interfaces:
ExecutableApiRequest<StreamSubscriptionResult>
public class SubscribeStreamsApiRequest
extends ZulipApiRequest
implements ExecutableApiRequest<StreamSubscriptionResult>
Zulip API request builder for subscribing to a stream.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSubscribeStreamsApiRequest(ZulipHttpClient client, StreamSubscriptionRequest[] subscriptions) Constructs aSubscribeStreamsApiRequest. -
Method Summary
Modifier and TypeMethodDescriptionexecute()Executes the Zulip API request for subscribing to a stream.withAnnounce(boolean announce) Sets whether creation of the new stream should be announced.withAuthorizationErrorsFatal(boolean authorizationErrorsFatal) Sets whether authorization failures should result in a failure response.withCanRemoveSubscribersGroup(long userGroupID) Sets the user group id whose members are allowed to unsubscribe others from the stream.withDefaultStream(boolean defaultStream) Sets whether any newly created streams will be added as default streams for new users joining the organization.withHistoryPublicToSubscribers(boolean historyPublicToSubscribers) Sets whether the stream history is public to new subscribers.withInviteOnly(boolean inviteOnly) Sets whether a created stream will be private.withMessageRetention(int messageRetentionDays) Sets the number of days that message history should be retained.withMessageRetention(RetentionPolicy messageRetentionPolicy) Sets the message retention policy of a stream.withPrincipals(long... userIds) Sets the list of users that are to be subscribed to the stream.withPrincipals(String... emailAddresses) Sets the list of users that are to be subscribed to the stream.withStreamPostPolicy(StreamPostPolicy policy) Sets the policy for which users can post messages to the stream.withWebPublic(boolean webPublic) Sets whether any newly created streams will be web-public streams.Methods inherited from class com.github.jamesnetherton.zulip.client.api.core.ZulipApiRequest
client, getParam, getParams, putParam, putParamAsJsonString, putParamAsWrappedObject
-
Field Details
-
SUBSCRIPTIONS
- See Also:
-
PRINCIPALS
- See Also:
-
AUTHORIZATION_ERRORS_FATAL
- See Also:
-
ANNOUNCE
- See Also:
-
INVITE_ONLY
- See Also:
-
IS_DEFAULT_STREAM
- See Also:
-
IS_WEB_PUBLIC
- See Also:
-
HISTORY_PUBLIC_TO_SUBSCRIBERS
- See Also:
-
STREAM_POST_POLICY
- See Also:
-
MESSAGE_RETENTION_DAYS
- See Also:
-
CAN_REMOVE_SUBSCRIBERS_GROUP
- See Also:
-
-
Constructor Details
-
SubscribeStreamsApiRequest
public SubscribeStreamsApiRequest(ZulipHttpClient client, StreamSubscriptionRequest[] subscriptions) Constructs aSubscribeStreamsApiRequest.- Parameters:
client- The Zulip HTTP clientsubscriptions- An array ofStreamSubscriptionRequestobjects detailing the stream name and description
-
-
Method Details
-
withPrincipals
Sets the list of users that are to be subscribed to the stream.- Parameters:
emailAddresses- The array of user email addresses to subscribe to the stream- Returns:
- This
SubscribeStreamsApiRequestinstance
-
withPrincipals
Sets the list of users that are to be subscribed to the stream.- Parameters:
userIds- The array of user ids to subscribe to the stream- Returns:
- This
SubscribeStreamsApiRequestinstance
-
withAuthorizationErrorsFatal
Sets whether authorization failures should result in a failure response. I.e if a specified user does not have access to the stream.- Parameters:
authorizationErrorsFatal-trueif authorization failures should result in a failure response.trueif authorization failures should be ignored- Returns:
- This
SubscribeStreamsApiRequestinstance
-
withAnnounce
Sets whether creation of the new stream should be announced.- Parameters:
announce-trueto announce the creation of the new stream.falseto not make any announcement- Returns:
- This
SubscribeStreamsApiRequestinstance
-
withDefaultStream
Sets whether any newly created streams will be added as default streams for new users joining the organization.- Parameters:
defaultStream-trueresults in any newly created streams as the default.falseresults in any newly created streams being the default- Returns:
- This
SubscribeStreamsApiRequestinstance
-
withInviteOnly
Sets whether a created stream will be private.- Parameters:
inviteOnly-trueresults in any streams created as private.falseresults in created streams being public- Returns:
- This
SubscribeStreamsApiRequestinstance
-
withWebPublic
Sets whether any newly created streams will be web-public streams.- Parameters:
webPublic-trueresults in any newly created streams created as web0public.falseresults in created streams being non web-public- Returns:
- This
SubscribeStreamsApiRequestinstance
-
withHistoryPublicToSubscribers
public SubscribeStreamsApiRequest withHistoryPublicToSubscribers(boolean historyPublicToSubscribers) Sets whether the stream history is public to new subscribers.- Parameters:
historyPublicToSubscribers-trueif stream history should be public to new subscribers.falseif stream history should not be public to new subscribers- Returns:
- This
SubscribeStreamsApiRequestinstance
-
withStreamPostPolicy
Sets the policy for which users can post messages to the stream.- Parameters:
policy- TheStreamPostPolicythat should apply to the stream- Returns:
- This
SubscribeStreamsApiRequestinstance
-
withMessageRetention
Sets the number of days that message history should be retained.- Parameters:
messageRetentionDays- The number of days for which message history should be retained- Returns:
- This
SubscribeStreamsApiRequestinstance
-
withMessageRetention
Sets the message retention policy of a stream.- Parameters:
messageRetentionPolicy- TheRetentionPolicythat should apply to the stream- Returns:
- This
SubscribeStreamsApiRequestinstance
-
withCanRemoveSubscribersGroup
Sets the user group id whose members are allowed to unsubscribe others from the stream.- Parameters:
userGroupID- The user group id whose members are allowed to unsubscribe others from the stream- Returns:
- This
SubscribeStreamsApiRequestinstance
-
execute
Executes the Zulip API request for subscribing to a stream.- Specified by:
executein interfaceExecutableApiRequest<StreamSubscriptionResult>- Returns:
StreamSubscriptionRequestdescribing the result of theStreamSubscriptionRequest- Throws:
ZulipClientException- if the request was not successful
-