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 ofStreamSubscriptionRequest
objects 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
SubscribeStreamsApiRequest
instance
-
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
SubscribeStreamsApiRequest
instance
-
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
-true
if authorization failures should result in a failure response.true
if authorization failures should be ignored- Returns:
- This
SubscribeStreamsApiRequest
instance
-
withAnnounce
Sets whether creation of the new stream should be announced.- Parameters:
announce
-true
to announce the creation of the new stream.false
to not make any announcement- Returns:
- This
SubscribeStreamsApiRequest
instance
-
withDefaultStream
Sets whether any newly created streams will be added as default streams for new users joining the organization.- Parameters:
defaultStream
-true
results in any newly created streams as the default.false
results in any newly created streams being the default- Returns:
- This
SubscribeStreamsApiRequest
instance
-
withInviteOnly
Sets whether a created stream will be private.- Parameters:
inviteOnly
-true
results in any streams created as private.false
results in created streams being public- Returns:
- This
SubscribeStreamsApiRequest
instance
-
withWebPublic
Sets whether any newly created streams will be web-public streams.- Parameters:
webPublic
-true
results in any newly created streams created as web0public.false
results in created streams being non web-public- Returns:
- This
SubscribeStreamsApiRequest
instance
-
withHistoryPublicToSubscribers
public SubscribeStreamsApiRequest withHistoryPublicToSubscribers(boolean historyPublicToSubscribers) Sets whether the stream history is public to new subscribers.- Parameters:
historyPublicToSubscribers
-true
if stream history should be public to new subscribers.false
if stream history should not be public to new subscribers- Returns:
- This
SubscribeStreamsApiRequest
instance
-
withStreamPostPolicy
Sets the policy for which users can post messages to the stream.- Parameters:
policy
- TheStreamPostPolicy
that should apply to the stream- Returns:
- This
SubscribeStreamsApiRequest
instance
-
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
SubscribeStreamsApiRequest
instance
-
withMessageRetention
Sets the message retention policy of a stream.- Parameters:
messageRetentionPolicy
- TheRetentionPolicy
that should apply to the stream- Returns:
- This
SubscribeStreamsApiRequest
instance
-
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
SubscribeStreamsApiRequest
instance
-
execute
Executes the Zulip API request for subscribing to a stream.- Specified by:
execute
in interfaceExecutableApiRequest<StreamSubscriptionResult>
- Returns:
StreamSubscriptionRequest
describing the result of theStreamSubscriptionRequest
- Throws:
ZulipClientException
- if the request was not successful
-