com.github.jamesnetherton.zulip.client.api.server.request.SendMobilePushTestNotification 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.server.request;
import static com.github.jamesnetherton.zulip.client.api.server.request.ServerRequestConstants.MOBILE_PUSH_TEST;
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 sending mobile push test notifications.
*
* @see https://zulip.com/api/test-notify
*
*/
public class SendMobilePushTestNotification extends ZulipApiRequest implements VoidExecutableApiRequest {
public static final String TOKEN = "token";
/**
* Constructs a {@link SendMobilePushTestNotification}.
*
* @param client The Zulip HTTP client
*/
public SendMobilePushTestNotification(ZulipHttpClient client) {
super(client);
}
/**
* The push token for the device to which to send the test notification.
*
* @see https://zulip.com/api/test-notify#parameter-token
*
* @param token The mobile device token
* @return This {@link SendMobilePushTestNotification} instance
*/
public SendMobilePushTestNotification withToken(String token) {
putParam(TOKEN, token);
return this;
}
/**
* Executes the Zulip API request for sending mobile push test notifications.
*
* @throws ZulipClientException if the request was not successful
*/
@Override
public void execute() throws ZulipClientException {
client().post(MOBILE_PUSH_TEST, getParams(), ZulipApiResponse.class);
}
}