All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.jamesnetherton.zulip.client.api.user.request.DeleteUserGroupApiRequest Maven / Gradle / Ivy

The newest version!
package com.github.jamesnetherton.zulip.client.api.user.request;

import static com.github.jamesnetherton.zulip.client.api.user.request.UserRequestConstants.USER_GROUPS_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 user group.
 *
 * @see https://zulip.com/api/remove-user-group
 */
public class DeleteUserGroupApiRequest extends ZulipApiRequest implements VoidExecutableApiRequest {

    private final long groupId;

    /**
     * Constructs a {@link DeleteUserGroupApiRequest}.
     *
     * @param client  The Zulip HTTP client
     * @param groupId The id of the group to delete
     */
    public DeleteUserGroupApiRequest(ZulipHttpClient client, long groupId) {
        super(client);
        this.groupId = groupId;
    }

    /**
     * Executes the Zulip API request for deleting a user group.
     *
     * @throws ZulipClientException if the request was not successful
     */
    @Override
    public void execute() throws ZulipClientException {
        String path = String.format(USER_GROUPS_WITH_ID, groupId);
        client().delete(path, getParams(), ZulipApiResponse.class);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy