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

com.github.jamesnetherton.zulip.client.api.invitation.request.RevokeReusableInvitationApiRequest Maven / Gradle / Ivy

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

import static com.github.jamesnetherton.zulip.client.api.invitation.request.InvitationRequestConstants.MULTIUSE_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 revoking a reusable invitation.
 *
 * @see https://zulip.com/api/revoke-invite-link
 */
public class RevokeReusableInvitationApiRequest extends ZulipApiRequest implements VoidExecutableApiRequest {
    private final long invitationId;

    /**
     * Constructs a {@link RevokeReusableInvitationApiRequest}.
     *
     * @param client       The Zulip HTTP client
     * @param invitationId The id of the invitation to revoke
     */
    public RevokeReusableInvitationApiRequest(ZulipHttpClient client, long invitationId) {
        super(client);
        this.invitationId = invitationId;
    }

    /**
     * Executes the Zulip API request for revoking a reusable invitation.
     *
     * @throws ZulipClientException if the request was not successful
     */
    @Override
    public void execute() throws ZulipClientException {
        String path = String.format(MULTIUSE_WITH_ID, invitationId);
        client().delete(path, getParams(), ZulipApiResponse.class);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy