// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.communication.callautomation.implementation;

import com.azure.communication.callautomation.implementation.models.AddParticipantRequestInternal;
import com.azure.communication.callautomation.implementation.models.AddParticipantResponseInternal;
import com.azure.communication.callautomation.implementation.models.CallConnectionPropertiesInternal;
import com.azure.communication.callautomation.implementation.models.CallParticipantInternal;
import com.azure.communication.callautomation.implementation.models.CommunicationErrorResponseException;
import com.azure.communication.callautomation.implementation.models.GetParticipantsResponseInternal;
import com.azure.communication.callautomation.implementation.models.MuteParticipantsRequestInternal;
import com.azure.communication.callautomation.implementation.models.MuteParticipantsResponseInternal;
import com.azure.communication.callautomation.implementation.models.RemoveParticipantRequestInternal;
import com.azure.communication.callautomation.implementation.models.RemoveParticipantResponseInternal;
import com.azure.communication.callautomation.implementation.models.TransferCallResponseInternal;
import com.azure.communication.callautomation.implementation.models.TransferToParticipantRequestInternal;
import com.azure.communication.callautomation.implementation.models.UnmuteParticipantsRequestInternal;
import com.azure.communication.callautomation.implementation.models.UnmuteParticipantsResponseInternal;
import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.Delete;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
import com.azure.core.annotation.HeaderParam;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Post;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.PagedResponse;
import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.util.Context;
import com.azure.core.util.DateTimeRfc1123;
import com.azure.core.util.FluxUtil;
import java.time.OffsetDateTime;
import java.util.UUID;
import reactor.core.publisher.Mono;

/** An instance of this class provides access to all the operations defined in CallConnections. */
public final class CallConnectionsImpl {
    /** The proxy service used to perform REST calls. */
    private final CallConnectionsService service;

    /** The service client containing this operation class. */
    private final AzureCommunicationCallAutomationServiceImpl client;

    /**
     * Initializes an instance of CallConnectionsImpl.
     *
     * @param client the instance of the service client containing this operation class.
     */
    CallConnectionsImpl(AzureCommunicationCallAutomationServiceImpl client) {
        this.service =
                RestProxy.create(CallConnectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
        this.client = client;
    }

    /**
     * The interface defining all the services for AzureCommunicationCallAutomationServiceCallConnections to be used by
     * the proxy service to perform REST calls.
     */
    @Host("{endpoint}")
    @ServiceInterface(name = "AzureCommunicationCa")
    public interface CallConnectionsService {
        @Get("/calling/callConnections/{callConnectionId}")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
        Mono<Response<CallConnectionPropertiesInternal>> getCall(
                @HostParam("endpoint") String endpoint,
                @PathParam("callConnectionId") String callConnectionId,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Accept") String accept,
                Context context);

        @Delete("/calling/callConnections/{callConnectionId}")
        @ExpectedResponses({204})
        @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
        Mono<Response<Void>> hangupCall(
                @HostParam("endpoint") String endpoint,
                @PathParam("callConnectionId") String callConnectionId,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Accept") String accept,
                Context context);

        @Post("/calling/callConnections/{callConnectionId}:terminate")
        @ExpectedResponses({204})
        @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
        Mono<Response<Void>> terminateCall(
                @HostParam("endpoint") String endpoint,
                @PathParam("callConnectionId") String callConnectionId,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Repeatability-Request-ID") UUID repeatabilityRequestID,
                @HeaderParam("Repeatability-First-Sent") DateTimeRfc1123 repeatabilityFirstSent,
                @HeaderParam("Accept") String accept,
                Context context);

        @Post("/calling/callConnections/{callConnectionId}:transferToParticipant")
        @ExpectedResponses({202})
        @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
        Mono<Response<TransferCallResponseInternal>> transferToParticipant(
                @HostParam("endpoint") String endpoint,
                @PathParam("callConnectionId") String callConnectionId,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Repeatability-Request-ID") UUID repeatabilityRequestID,
                @HeaderParam("Repeatability-First-Sent") DateTimeRfc1123 repeatabilityFirstSent,
                @BodyParam("application/json") TransferToParticipantRequestInternal transferToParticipantRequest,
                @HeaderParam("Accept") String accept,
                Context context);

        @Get("/calling/callConnections/{callConnectionId}/participants")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
        Mono<Response<GetParticipantsResponseInternal>> getParticipants(
                @HostParam("endpoint") String endpoint,
                @PathParam("callConnectionId") String callConnectionId,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Accept") String accept,
                Context context);

        @Post("/calling/callConnections/{callConnectionId}/participants:add")
        @ExpectedResponses({202})
        @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
        Mono<Response<AddParticipantResponseInternal>> addParticipant(
                @HostParam("endpoint") String endpoint,
                @PathParam("callConnectionId") String callConnectionId,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Repeatability-Request-ID") UUID repeatabilityRequestID,
                @HeaderParam("Repeatability-First-Sent") DateTimeRfc1123 repeatabilityFirstSent,
                @BodyParam("application/json") AddParticipantRequestInternal addParticipantRequest,
                @HeaderParam("Accept") String accept,
                Context context);

        @Post("/calling/callConnections/{callConnectionId}/participants:remove")
        @ExpectedResponses({202})
        @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
        Mono<Response<RemoveParticipantResponseInternal>> removeParticipant(
                @HostParam("endpoint") String endpoint,
                @PathParam("callConnectionId") String callConnectionId,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Repeatability-Request-ID") UUID repeatabilityRequestID,
                @HeaderParam("Repeatability-First-Sent") DateTimeRfc1123 repeatabilityFirstSent,
                @BodyParam("application/json") RemoveParticipantRequestInternal removeParticipantRequest,
                @HeaderParam("Accept") String accept,
                Context context);

        @Post("/calling/callConnections/{callConnectionId}/participants:mute")
        @ExpectedResponses({202})
        @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
        Mono<Response<MuteParticipantsResponseInternal>> mute(
                @HostParam("endpoint") String endpoint,
                @PathParam("callConnectionId") String callConnectionId,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Repeatability-Request-ID") UUID repeatabilityRequestID,
                @HeaderParam("Repeatability-First-Sent") DateTimeRfc1123 repeatabilityFirstSent,
                @BodyParam("application/json") MuteParticipantsRequestInternal muteParticipantsRequest,
                @HeaderParam("Accept") String accept,
                Context context);

        @Post("/calling/callConnections/{callConnectionId}/participants:unmute")
        @ExpectedResponses({202})
        @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
        Mono<Response<UnmuteParticipantsResponseInternal>> unmute(
                @HostParam("endpoint") String endpoint,
                @PathParam("callConnectionId") String callConnectionId,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Repeatability-Request-ID") UUID repeatabilityRequestID,
                @HeaderParam("Repeatability-First-Sent") DateTimeRfc1123 repeatabilityFirstSent,
                @BodyParam("application/json") UnmuteParticipantsRequestInternal unmuteParticipantsRequest,
                @HeaderParam("Accept") String accept,
                Context context);

        @Get("/calling/callConnections/{callConnectionId}/participants/{participantRawId}")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
        Mono<Response<CallParticipantInternal>> getParticipant(
                @HostParam("endpoint") String endpoint,
                @PathParam("callConnectionId") String callConnectionId,
                @PathParam("participantRawId") String participantRawId,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Accept") String accept,
                Context context);

        @Get("{nextLink}")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
        Mono<Response<GetParticipantsResponseInternal>> getParticipantsNext(
                @PathParam(value = "nextLink", encoded = true) String nextLink,
                @HostParam("endpoint") String endpoint,
                @HeaderParam("Accept") String accept,
                Context context);
    }

    /**
     * Get call connection.
     *
     * @param callConnectionId The call connection id.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return call connection.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<CallConnectionPropertiesInternal>> getCallWithResponseAsync(String callConnectionId) {
        final String accept = "application/json";
        return FluxUtil.withContext(
                context ->
                        service.getCall(
                                this.client.getEndpoint(),
                                callConnectionId,
                                this.client.getApiVersion(),
                                accept,
                                context));
    }

    /**
     * Get call connection.
     *
     * @param callConnectionId The call connection id.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return call connection.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<CallConnectionPropertiesInternal>> getCallWithResponseAsync(
            String callConnectionId, Context context) {
        final String accept = "application/json";
        return service.getCall(
                this.client.getEndpoint(), callConnectionId, this.client.getApiVersion(), accept, context);
    }

    /**
     * Get call connection.
     *
     * @param callConnectionId The call connection id.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return call connection.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<CallConnectionPropertiesInternal> getCallAsync(String callConnectionId) {
        return getCallWithResponseAsync(callConnectionId)
                .flatMap(
                        (Response<CallConnectionPropertiesInternal> res) -> {
                            if (res.getValue() != null) {
                                return Mono.just(res.getValue());
                            } else {
                                return Mono.empty();
                            }
                        });
    }

    /**
     * Get call connection.
     *
     * @param callConnectionId The call connection id.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return call connection.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<CallConnectionPropertiesInternal> getCallAsync(String callConnectionId, Context context) {
        return getCallWithResponseAsync(callConnectionId, context)
                .flatMap(
                        (Response<CallConnectionPropertiesInternal> res) -> {
                            if (res.getValue() != null) {
                                return Mono.just(res.getValue());
                            } else {
                                return Mono.empty();
                            }
                        });
    }

    /**
     * Get call connection.
     *
     * @param callConnectionId The call connection id.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return call connection.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public CallConnectionPropertiesInternal getCall(String callConnectionId) {
        return getCallAsync(callConnectionId).block();
    }

    /**
     * Get call connection.
     *
     * @param callConnectionId The call connection id.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return call connection.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<CallConnectionPropertiesInternal> getCallWithResponse(String callConnectionId, Context context) {
        return getCallWithResponseAsync(callConnectionId, context).block();
    }

    /**
     * Hangup the call.
     *
     * @param callConnectionId The call connection id.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the completion.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<Void>> hangupCallWithResponseAsync(String callConnectionId) {
        final String accept = "application/json";
        return FluxUtil.withContext(
                context ->
                        service.hangupCall(
                                this.client.getEndpoint(),
                                callConnectionId,
                                this.client.getApiVersion(),
                                accept,
                                context));
    }

    /**
     * Hangup the call.
     *
     * @param callConnectionId The call connection id.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the completion.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<Void>> hangupCallWithResponseAsync(String callConnectionId, Context context) {
        final String accept = "application/json";
        return service.hangupCall(
                this.client.getEndpoint(), callConnectionId, this.client.getApiVersion(), accept, context);
    }

    /**
     * Hangup the call.
     *
     * @param callConnectionId The call connection id.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the completion.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Void> hangupCallAsync(String callConnectionId) {
        return hangupCallWithResponseAsync(callConnectionId).flatMap((Response<Void> res) -> Mono.empty());
    }

    /**
     * Hangup the call.
     *
     * @param callConnectionId The call connection id.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the completion.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Void> hangupCallAsync(String callConnectionId, Context context) {
        return hangupCallWithResponseAsync(callConnectionId, context).flatMap((Response<Void> res) -> Mono.empty());
    }

    /**
     * Hangup the call.
     *
     * @param callConnectionId The call connection id.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public void hangupCall(String callConnectionId) {
        hangupCallAsync(callConnectionId).block();
    }

    /**
     * Hangup the call.
     *
     * @param callConnectionId The call connection id.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<Void> hangupCallWithResponse(String callConnectionId, Context context) {
        return hangupCallWithResponseAsync(callConnectionId, context).block();
    }

    /**
     * Terminate a call using CallConnectionId.
     *
     * @param callConnectionId The terminate call request.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the completion.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<Void>> terminateCallWithResponseAsync(
            String callConnectionId, UUID repeatabilityRequestID, OffsetDateTime repeatabilityFirstSent) {
        final String accept = "application/json";
        DateTimeRfc1123 repeatabilityFirstSentConverted =
                repeatabilityFirstSent == null ? null : new DateTimeRfc1123(repeatabilityFirstSent);
        return FluxUtil.withContext(
                context ->
                        service.terminateCall(
                                this.client.getEndpoint(),
                                callConnectionId,
                                this.client.getApiVersion(),
                                repeatabilityRequestID,
                                repeatabilityFirstSentConverted,
                                accept,
                                context));
    }

    /**
     * Terminate a call using CallConnectionId.
     *
     * @param callConnectionId The terminate call request.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the completion.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<Void>> terminateCallWithResponseAsync(
            String callConnectionId,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent,
            Context context) {
        final String accept = "application/json";
        DateTimeRfc1123 repeatabilityFirstSentConverted =
                repeatabilityFirstSent == null ? null : new DateTimeRfc1123(repeatabilityFirstSent);
        return service.terminateCall(
                this.client.getEndpoint(),
                callConnectionId,
                this.client.getApiVersion(),
                repeatabilityRequestID,
                repeatabilityFirstSentConverted,
                accept,
                context);
    }

    /**
     * Terminate a call using CallConnectionId.
     *
     * @param callConnectionId The terminate call request.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the completion.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Void> terminateCallAsync(
            String callConnectionId, UUID repeatabilityRequestID, OffsetDateTime repeatabilityFirstSent) {
        return terminateCallWithResponseAsync(callConnectionId, repeatabilityRequestID, repeatabilityFirstSent)
                .flatMap((Response<Void> res) -> Mono.empty());
    }

    /**
     * Terminate a call using CallConnectionId.
     *
     * @param callConnectionId The terminate call request.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the completion.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Void> terminateCallAsync(
            String callConnectionId,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent,
            Context context) {
        return terminateCallWithResponseAsync(callConnectionId, repeatabilityRequestID, repeatabilityFirstSent, context)
                .flatMap((Response<Void> res) -> Mono.empty());
    }

    /**
     * Terminate a call using CallConnectionId.
     *
     * @param callConnectionId The terminate call request.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public void terminateCall(
            String callConnectionId, UUID repeatabilityRequestID, OffsetDateTime repeatabilityFirstSent) {
        terminateCallAsync(callConnectionId, repeatabilityRequestID, repeatabilityFirstSent).block();
    }

    /**
     * Terminate a call using CallConnectionId.
     *
     * @param callConnectionId The terminate call request.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<Void> terminateCallWithResponse(
            String callConnectionId,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent,
            Context context) {
        return terminateCallWithResponseAsync(callConnectionId, repeatabilityRequestID, repeatabilityFirstSent, context)
                .block();
    }

    /**
     * Transfer the call to a participant.
     *
     * @param callConnectionId The call connection id.
     * @param transferToParticipantRequest The transfer to participant request.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for transferring the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<TransferCallResponseInternal>> transferToParticipantWithResponseAsync(
            String callConnectionId,
            TransferToParticipantRequestInternal transferToParticipantRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent) {
        final String accept = "application/json";
        DateTimeRfc1123 repeatabilityFirstSentConverted =
                repeatabilityFirstSent == null ? null : new DateTimeRfc1123(repeatabilityFirstSent);
        return FluxUtil.withContext(
                context ->
                        service.transferToParticipant(
                                this.client.getEndpoint(),
                                callConnectionId,
                                this.client.getApiVersion(),
                                repeatabilityRequestID,
                                repeatabilityFirstSentConverted,
                                transferToParticipantRequest,
                                accept,
                                context));
    }

    /**
     * Transfer the call to a participant.
     *
     * @param callConnectionId The call connection id.
     * @param transferToParticipantRequest The transfer to participant request.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for transferring the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<TransferCallResponseInternal>> transferToParticipantWithResponseAsync(
            String callConnectionId,
            TransferToParticipantRequestInternal transferToParticipantRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent,
            Context context) {
        final String accept = "application/json";
        DateTimeRfc1123 repeatabilityFirstSentConverted =
                repeatabilityFirstSent == null ? null : new DateTimeRfc1123(repeatabilityFirstSent);
        return service.transferToParticipant(
                this.client.getEndpoint(),
                callConnectionId,
                this.client.getApiVersion(),
                repeatabilityRequestID,
                repeatabilityFirstSentConverted,
                transferToParticipantRequest,
                accept,
                context);
    }

    /**
     * Transfer the call to a participant.
     *
     * @param callConnectionId The call connection id.
     * @param transferToParticipantRequest The transfer to participant request.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for transferring the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<TransferCallResponseInternal> transferToParticipantAsync(
            String callConnectionId,
            TransferToParticipantRequestInternal transferToParticipantRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent) {
        return transferToParticipantWithResponseAsync(
                        callConnectionId, transferToParticipantRequest, repeatabilityRequestID, repeatabilityFirstSent)
                .flatMap(
                        (Response<TransferCallResponseInternal> res) -> {
                            if (res.getValue() != null) {
                                return Mono.just(res.getValue());
                            } else {
                                return Mono.empty();
                            }
                        });
    }

    /**
     * Transfer the call to a participant.
     *
     * @param callConnectionId The call connection id.
     * @param transferToParticipantRequest The transfer to participant request.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for transferring the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<TransferCallResponseInternal> transferToParticipantAsync(
            String callConnectionId,
            TransferToParticipantRequestInternal transferToParticipantRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent,
            Context context) {
        return transferToParticipantWithResponseAsync(
                        callConnectionId,
                        transferToParticipantRequest,
                        repeatabilityRequestID,
                        repeatabilityFirstSent,
                        context)
                .flatMap(
                        (Response<TransferCallResponseInternal> res) -> {
                            if (res.getValue() != null) {
                                return Mono.just(res.getValue());
                            } else {
                                return Mono.empty();
                            }
                        });
    }

    /**
     * Transfer the call to a participant.
     *
     * @param callConnectionId The call connection id.
     * @param transferToParticipantRequest The transfer to participant request.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for transferring the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public TransferCallResponseInternal transferToParticipant(
            String callConnectionId,
            TransferToParticipantRequestInternal transferToParticipantRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent) {
        return transferToParticipantAsync(
                        callConnectionId, transferToParticipantRequest, repeatabilityRequestID, repeatabilityFirstSent)
                .block();
    }

    /**
     * Transfer the call to a participant.
     *
     * @param callConnectionId The call connection id.
     * @param transferToParticipantRequest The transfer to participant request.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for transferring the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<TransferCallResponseInternal> transferToParticipantWithResponse(
            String callConnectionId,
            TransferToParticipantRequestInternal transferToParticipantRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent,
            Context context) {
        return transferToParticipantWithResponseAsync(
                        callConnectionId,
                        transferToParticipantRequest,
                        repeatabilityRequestID,
                        repeatabilityFirstSent,
                        context)
                .block();
    }

    /**
     * Get participants from a call.
     *
     * @param callConnectionId The call connection Id.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return participants from a call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<CallParticipantInternal>> getParticipantsSinglePageAsync(String callConnectionId) {
        final String accept = "application/json";
        return FluxUtil.withContext(
                        context ->
                                service.getParticipants(
                                        this.client.getEndpoint(),
                                        callConnectionId,
                                        this.client.getApiVersion(),
                                        accept,
                                        context))
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        res.getValue().getValues(),
                                        res.getValue().getNextLink(),
                                        null));
    }

    /**
     * Get participants from a call.
     *
     * @param callConnectionId The call connection Id.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return participants from a call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<CallParticipantInternal>> getParticipantsSinglePageAsync(
            String callConnectionId, Context context) {
        final String accept = "application/json";
        return service.getParticipants(
                        this.client.getEndpoint(), callConnectionId, this.client.getApiVersion(), accept, context)
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        res.getValue().getValues(),
                                        res.getValue().getNextLink(),
                                        null));
    }

    /**
     * Get participants from a call.
     *
     * @param callConnectionId The call connection Id.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return participants from a call.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<CallParticipantInternal> getParticipantsAsync(String callConnectionId) {
        return new PagedFlux<>(
                () -> getParticipantsSinglePageAsync(callConnectionId),
                nextLink -> getParticipantsNextSinglePageAsync(nextLink));
    }

    /**
     * Get participants from a call.
     *
     * @param callConnectionId The call connection Id.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return participants from a call.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<CallParticipantInternal> getParticipantsAsync(String callConnectionId, Context context) {
        return new PagedFlux<>(
                () -> getParticipantsSinglePageAsync(callConnectionId, context),
                nextLink -> getParticipantsNextSinglePageAsync(nextLink, context));
    }

    /**
     * Get participants from a call.
     *
     * @param callConnectionId The call connection Id.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return participants from a call.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<CallParticipantInternal> getParticipants(String callConnectionId) {
        return new PagedIterable<>(getParticipantsAsync(callConnectionId));
    }

    /**
     * Get participants from a call.
     *
     * @param callConnectionId The call connection Id.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return participants from a call.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<CallParticipantInternal> getParticipants(String callConnectionId, Context context) {
        return new PagedIterable<>(getParticipantsAsync(callConnectionId, context));
    }

    /**
     * Add participants to the call.
     *
     * @param callConnectionId The call connection Id.
     * @param addParticipantRequest The request payload for adding participant to the call.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for adding participants to the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<AddParticipantResponseInternal>> addParticipantWithResponseAsync(
            String callConnectionId,
            AddParticipantRequestInternal addParticipantRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent) {
        final String accept = "application/json";
        DateTimeRfc1123 repeatabilityFirstSentConverted =
                repeatabilityFirstSent == null ? null : new DateTimeRfc1123(repeatabilityFirstSent);
        return FluxUtil.withContext(
                context ->
                        service.addParticipant(
                                this.client.getEndpoint(),
                                callConnectionId,
                                this.client.getApiVersion(),
                                repeatabilityRequestID,
                                repeatabilityFirstSentConverted,
                                addParticipantRequest,
                                accept,
                                context));
    }

    /**
     * Add participants to the call.
     *
     * @param callConnectionId The call connection Id.
     * @param addParticipantRequest The request payload for adding participant to the call.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for adding participants to the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<AddParticipantResponseInternal>> addParticipantWithResponseAsync(
            String callConnectionId,
            AddParticipantRequestInternal addParticipantRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent,
            Context context) {
        final String accept = "application/json";
        DateTimeRfc1123 repeatabilityFirstSentConverted =
                repeatabilityFirstSent == null ? null : new DateTimeRfc1123(repeatabilityFirstSent);
        return service.addParticipant(
                this.client.getEndpoint(),
                callConnectionId,
                this.client.getApiVersion(),
                repeatabilityRequestID,
                repeatabilityFirstSentConverted,
                addParticipantRequest,
                accept,
                context);
    }

    /**
     * Add participants to the call.
     *
     * @param callConnectionId The call connection Id.
     * @param addParticipantRequest The request payload for adding participant to the call.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for adding participants to the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<AddParticipantResponseInternal> addParticipantAsync(
            String callConnectionId,
            AddParticipantRequestInternal addParticipantRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent) {
        return addParticipantWithResponseAsync(
                        callConnectionId, addParticipantRequest, repeatabilityRequestID, repeatabilityFirstSent)
                .flatMap(
                        (Response<AddParticipantResponseInternal> res) -> {
                            if (res.getValue() != null) {
                                return Mono.just(res.getValue());
                            } else {
                                return Mono.empty();
                            }
                        });
    }

    /**
     * Add participants to the call.
     *
     * @param callConnectionId The call connection Id.
     * @param addParticipantRequest The request payload for adding participant to the call.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for adding participants to the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<AddParticipantResponseInternal> addParticipantAsync(
            String callConnectionId,
            AddParticipantRequestInternal addParticipantRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent,
            Context context) {
        return addParticipantWithResponseAsync(
                        callConnectionId,
                        addParticipantRequest,
                        repeatabilityRequestID,
                        repeatabilityFirstSent,
                        context)
                .flatMap(
                        (Response<AddParticipantResponseInternal> res) -> {
                            if (res.getValue() != null) {
                                return Mono.just(res.getValue());
                            } else {
                                return Mono.empty();
                            }
                        });
    }

    /**
     * Add participants to the call.
     *
     * @param callConnectionId The call connection Id.
     * @param addParticipantRequest The request payload for adding participant to the call.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for adding participants to the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public AddParticipantResponseInternal addParticipant(
            String callConnectionId,
            AddParticipantRequestInternal addParticipantRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent) {
        return addParticipantAsync(
                        callConnectionId, addParticipantRequest, repeatabilityRequestID, repeatabilityFirstSent)
                .block();
    }

    /**
     * Add participants to the call.
     *
     * @param callConnectionId The call connection Id.
     * @param addParticipantRequest The request payload for adding participant to the call.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for adding participants to the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<AddParticipantResponseInternal> addParticipantWithResponse(
            String callConnectionId,
            AddParticipantRequestInternal addParticipantRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent,
            Context context) {
        return addParticipantWithResponseAsync(
                        callConnectionId,
                        addParticipantRequest,
                        repeatabilityRequestID,
                        repeatabilityFirstSent,
                        context)
                .block();
    }

    /**
     * Remove participant from the call using identifier.
     *
     * @param callConnectionId The call connection id.
     * @param removeParticipantRequest The participant to be removed from the call.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for removing participants of the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<RemoveParticipantResponseInternal>> removeParticipantWithResponseAsync(
            String callConnectionId,
            RemoveParticipantRequestInternal removeParticipantRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent) {
        final String accept = "application/json";
        DateTimeRfc1123 repeatabilityFirstSentConverted =
                repeatabilityFirstSent == null ? null : new DateTimeRfc1123(repeatabilityFirstSent);
        return FluxUtil.withContext(
                context ->
                        service.removeParticipant(
                                this.client.getEndpoint(),
                                callConnectionId,
                                this.client.getApiVersion(),
                                repeatabilityRequestID,
                                repeatabilityFirstSentConverted,
                                removeParticipantRequest,
                                accept,
                                context));
    }

    /**
     * Remove participant from the call using identifier.
     *
     * @param callConnectionId The call connection id.
     * @param removeParticipantRequest The participant to be removed from the call.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for removing participants of the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<RemoveParticipantResponseInternal>> removeParticipantWithResponseAsync(
            String callConnectionId,
            RemoveParticipantRequestInternal removeParticipantRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent,
            Context context) {
        final String accept = "application/json";
        DateTimeRfc1123 repeatabilityFirstSentConverted =
                repeatabilityFirstSent == null ? null : new DateTimeRfc1123(repeatabilityFirstSent);
        return service.removeParticipant(
                this.client.getEndpoint(),
                callConnectionId,
                this.client.getApiVersion(),
                repeatabilityRequestID,
                repeatabilityFirstSentConverted,
                removeParticipantRequest,
                accept,
                context);
    }

    /**
     * Remove participant from the call using identifier.
     *
     * @param callConnectionId The call connection id.
     * @param removeParticipantRequest The participant to be removed from the call.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for removing participants of the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<RemoveParticipantResponseInternal> removeParticipantAsync(
            String callConnectionId,
            RemoveParticipantRequestInternal removeParticipantRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent) {
        return removeParticipantWithResponseAsync(
                        callConnectionId, removeParticipantRequest, repeatabilityRequestID, repeatabilityFirstSent)
                .flatMap(
                        (Response<RemoveParticipantResponseInternal> res) -> {
                            if (res.getValue() != null) {
                                return Mono.just(res.getValue());
                            } else {
                                return Mono.empty();
                            }
                        });
    }

    /**
     * Remove participant from the call using identifier.
     *
     * @param callConnectionId The call connection id.
     * @param removeParticipantRequest The participant to be removed from the call.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for removing participants of the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<RemoveParticipantResponseInternal> removeParticipantAsync(
            String callConnectionId,
            RemoveParticipantRequestInternal removeParticipantRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent,
            Context context) {
        return removeParticipantWithResponseAsync(
                        callConnectionId,
                        removeParticipantRequest,
                        repeatabilityRequestID,
                        repeatabilityFirstSent,
                        context)
                .flatMap(
                        (Response<RemoveParticipantResponseInternal> res) -> {
                            if (res.getValue() != null) {
                                return Mono.just(res.getValue());
                            } else {
                                return Mono.empty();
                            }
                        });
    }

    /**
     * Remove participant from the call using identifier.
     *
     * @param callConnectionId The call connection id.
     * @param removeParticipantRequest The participant to be removed from the call.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for removing participants of the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public RemoveParticipantResponseInternal removeParticipant(
            String callConnectionId,
            RemoveParticipantRequestInternal removeParticipantRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent) {
        return removeParticipantAsync(
                        callConnectionId, removeParticipantRequest, repeatabilityRequestID, repeatabilityFirstSent)
                .block();
    }

    /**
     * Remove participant from the call using identifier.
     *
     * @param callConnectionId The call connection id.
     * @param removeParticipantRequest The participant to be removed from the call.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for removing participants of the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<RemoveParticipantResponseInternal> removeParticipantWithResponse(
            String callConnectionId,
            RemoveParticipantRequestInternal removeParticipantRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent,
            Context context) {
        return removeParticipantWithResponseAsync(
                        callConnectionId,
                        removeParticipantRequest,
                        repeatabilityRequestID,
                        repeatabilityFirstSent,
                        context)
                .block();
    }

    /**
     * Mute participants from the call using identifier.
     *
     * @param callConnectionId The call connection id.
     * @param muteParticipantsRequest The participants to be muted from the call.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for muting participants from the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<MuteParticipantsResponseInternal>> muteWithResponseAsync(
            String callConnectionId,
            MuteParticipantsRequestInternal muteParticipantsRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent) {
        final String accept = "application/json";
        DateTimeRfc1123 repeatabilityFirstSentConverted =
                repeatabilityFirstSent == null ? null : new DateTimeRfc1123(repeatabilityFirstSent);
        return FluxUtil.withContext(
                context ->
                        service.mute(
                                this.client.getEndpoint(),
                                callConnectionId,
                                this.client.getApiVersion(),
                                repeatabilityRequestID,
                                repeatabilityFirstSentConverted,
                                muteParticipantsRequest,
                                accept,
                                context));
    }

    /**
     * Mute participants from the call using identifier.
     *
     * @param callConnectionId The call connection id.
     * @param muteParticipantsRequest The participants to be muted from the call.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for muting participants from the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<MuteParticipantsResponseInternal>> muteWithResponseAsync(
            String callConnectionId,
            MuteParticipantsRequestInternal muteParticipantsRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent,
            Context context) {
        final String accept = "application/json";
        DateTimeRfc1123 repeatabilityFirstSentConverted =
                repeatabilityFirstSent == null ? null : new DateTimeRfc1123(repeatabilityFirstSent);
        return service.mute(
                this.client.getEndpoint(),
                callConnectionId,
                this.client.getApiVersion(),
                repeatabilityRequestID,
                repeatabilityFirstSentConverted,
                muteParticipantsRequest,
                accept,
                context);
    }

    /**
     * Mute participants from the call using identifier.
     *
     * @param callConnectionId The call connection id.
     * @param muteParticipantsRequest The participants to be muted from the call.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for muting participants from the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<MuteParticipantsResponseInternal> muteAsync(
            String callConnectionId,
            MuteParticipantsRequestInternal muteParticipantsRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent) {
        return muteWithResponseAsync(
                        callConnectionId, muteParticipantsRequest, repeatabilityRequestID, repeatabilityFirstSent)
                .flatMap(
                        (Response<MuteParticipantsResponseInternal> res) -> {
                            if (res.getValue() != null) {
                                return Mono.just(res.getValue());
                            } else {
                                return Mono.empty();
                            }
                        });
    }

    /**
     * Mute participants from the call using identifier.
     *
     * @param callConnectionId The call connection id.
     * @param muteParticipantsRequest The participants to be muted from the call.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for muting participants from the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<MuteParticipantsResponseInternal> muteAsync(
            String callConnectionId,
            MuteParticipantsRequestInternal muteParticipantsRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent,
            Context context) {
        return muteWithResponseAsync(
                        callConnectionId,
                        muteParticipantsRequest,
                        repeatabilityRequestID,
                        repeatabilityFirstSent,
                        context)
                .flatMap(
                        (Response<MuteParticipantsResponseInternal> res) -> {
                            if (res.getValue() != null) {
                                return Mono.just(res.getValue());
                            } else {
                                return Mono.empty();
                            }
                        });
    }

    /**
     * Mute participants from the call using identifier.
     *
     * @param callConnectionId The call connection id.
     * @param muteParticipantsRequest The participants to be muted from the call.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for muting participants from the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public MuteParticipantsResponseInternal mute(
            String callConnectionId,
            MuteParticipantsRequestInternal muteParticipantsRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent) {
        return muteAsync(callConnectionId, muteParticipantsRequest, repeatabilityRequestID, repeatabilityFirstSent)
                .block();
    }

    /**
     * Mute participants from the call using identifier.
     *
     * @param callConnectionId The call connection id.
     * @param muteParticipantsRequest The participants to be muted from the call.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for muting participants from the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<MuteParticipantsResponseInternal> muteWithResponse(
            String callConnectionId,
            MuteParticipantsRequestInternal muteParticipantsRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent,
            Context context) {
        return muteWithResponseAsync(
                        callConnectionId,
                        muteParticipantsRequest,
                        repeatabilityRequestID,
                        repeatabilityFirstSent,
                        context)
                .block();
    }

    /**
     * Unmute participants from the call using identifier.
     *
     * @param callConnectionId The call connection id.
     * @param unmuteParticipantsRequest The participants to be unmuted from the call.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for unmuting participants from the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<UnmuteParticipantsResponseInternal>> unmuteWithResponseAsync(
            String callConnectionId,
            UnmuteParticipantsRequestInternal unmuteParticipantsRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent) {
        final String accept = "application/json";
        DateTimeRfc1123 repeatabilityFirstSentConverted =
                repeatabilityFirstSent == null ? null : new DateTimeRfc1123(repeatabilityFirstSent);
        return FluxUtil.withContext(
                context ->
                        service.unmute(
                                this.client.getEndpoint(),
                                callConnectionId,
                                this.client.getApiVersion(),
                                repeatabilityRequestID,
                                repeatabilityFirstSentConverted,
                                unmuteParticipantsRequest,
                                accept,
                                context));
    }

    /**
     * Unmute participants from the call using identifier.
     *
     * @param callConnectionId The call connection id.
     * @param unmuteParticipantsRequest The participants to be unmuted from the call.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for unmuting participants from the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<UnmuteParticipantsResponseInternal>> unmuteWithResponseAsync(
            String callConnectionId,
            UnmuteParticipantsRequestInternal unmuteParticipantsRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent,
            Context context) {
        final String accept = "application/json";
        DateTimeRfc1123 repeatabilityFirstSentConverted =
                repeatabilityFirstSent == null ? null : new DateTimeRfc1123(repeatabilityFirstSent);
        return service.unmute(
                this.client.getEndpoint(),
                callConnectionId,
                this.client.getApiVersion(),
                repeatabilityRequestID,
                repeatabilityFirstSentConverted,
                unmuteParticipantsRequest,
                accept,
                context);
    }

    /**
     * Unmute participants from the call using identifier.
     *
     * @param callConnectionId The call connection id.
     * @param unmuteParticipantsRequest The participants to be unmuted from the call.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for unmuting participants from the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<UnmuteParticipantsResponseInternal> unmuteAsync(
            String callConnectionId,
            UnmuteParticipantsRequestInternal unmuteParticipantsRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent) {
        return unmuteWithResponseAsync(
                        callConnectionId, unmuteParticipantsRequest, repeatabilityRequestID, repeatabilityFirstSent)
                .flatMap(
                        (Response<UnmuteParticipantsResponseInternal> res) -> {
                            if (res.getValue() != null) {
                                return Mono.just(res.getValue());
                            } else {
                                return Mono.empty();
                            }
                        });
    }

    /**
     * Unmute participants from the call using identifier.
     *
     * @param callConnectionId The call connection id.
     * @param unmuteParticipantsRequest The participants to be unmuted from the call.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for unmuting participants from the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<UnmuteParticipantsResponseInternal> unmuteAsync(
            String callConnectionId,
            UnmuteParticipantsRequestInternal unmuteParticipantsRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent,
            Context context) {
        return unmuteWithResponseAsync(
                        callConnectionId,
                        unmuteParticipantsRequest,
                        repeatabilityRequestID,
                        repeatabilityFirstSent,
                        context)
                .flatMap(
                        (Response<UnmuteParticipantsResponseInternal> res) -> {
                            if (res.getValue() != null) {
                                return Mono.just(res.getValue());
                            } else {
                                return Mono.empty();
                            }
                        });
    }

    /**
     * Unmute participants from the call using identifier.
     *
     * @param callConnectionId The call connection id.
     * @param unmuteParticipantsRequest The participants to be unmuted from the call.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for unmuting participants from the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public UnmuteParticipantsResponseInternal unmute(
            String callConnectionId,
            UnmuteParticipantsRequestInternal unmuteParticipantsRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent) {
        return unmuteAsync(callConnectionId, unmuteParticipantsRequest, repeatabilityRequestID, repeatabilityFirstSent)
                .block();
    }

    /**
     * Unmute participants from the call using identifier.
     *
     * @param callConnectionId The call connection id.
     * @param unmuteParticipantsRequest The participants to be unmuted from the call.
     * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the
     *     client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate
     *     response without the server executing the request multiple times. The value of the Repeatability-Request-Id
     *     is an opaque string representing a client-generated unique identifier for the request. It is a version 4
     *     (random) UUID.
     * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent
     *     header must also be specified. The value should be the date and time at which the request was first created,
     *     expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for unmuting participants from the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<UnmuteParticipantsResponseInternal> unmuteWithResponse(
            String callConnectionId,
            UnmuteParticipantsRequestInternal unmuteParticipantsRequest,
            UUID repeatabilityRequestID,
            OffsetDateTime repeatabilityFirstSent,
            Context context) {
        return unmuteWithResponseAsync(
                        callConnectionId,
                        unmuteParticipantsRequest,
                        repeatabilityRequestID,
                        repeatabilityFirstSent,
                        context)
                .block();
    }

    /**
     * Get participant from a call.
     *
     * @param callConnectionId The call connection Id.
     * @param participantRawId Raw id of the participant to retrieve.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return participant from a call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<CallParticipantInternal>> getParticipantWithResponseAsync(
            String callConnectionId, String participantRawId) {
        final String accept = "application/json";
        return FluxUtil.withContext(
                context ->
                        service.getParticipant(
                                this.client.getEndpoint(),
                                callConnectionId,
                                participantRawId,
                                this.client.getApiVersion(),
                                accept,
                                context));
    }

    /**
     * Get participant from a call.
     *
     * @param callConnectionId The call connection Id.
     * @param participantRawId Raw id of the participant to retrieve.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return participant from a call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<CallParticipantInternal>> getParticipantWithResponseAsync(
            String callConnectionId, String participantRawId, Context context) {
        final String accept = "application/json";
        return service.getParticipant(
                this.client.getEndpoint(),
                callConnectionId,
                participantRawId,
                this.client.getApiVersion(),
                accept,
                context);
    }

    /**
     * Get participant from a call.
     *
     * @param callConnectionId The call connection Id.
     * @param participantRawId Raw id of the participant to retrieve.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return participant from a call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<CallParticipantInternal> getParticipantAsync(String callConnectionId, String participantRawId) {
        return getParticipantWithResponseAsync(callConnectionId, participantRawId)
                .flatMap(
                        (Response<CallParticipantInternal> res) -> {
                            if (res.getValue() != null) {
                                return Mono.just(res.getValue());
                            } else {
                                return Mono.empty();
                            }
                        });
    }

    /**
     * Get participant from a call.
     *
     * @param callConnectionId The call connection Id.
     * @param participantRawId Raw id of the participant to retrieve.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return participant from a call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<CallParticipantInternal> getParticipantAsync(
            String callConnectionId, String participantRawId, Context context) {
        return getParticipantWithResponseAsync(callConnectionId, participantRawId, context)
                .flatMap(
                        (Response<CallParticipantInternal> res) -> {
                            if (res.getValue() != null) {
                                return Mono.just(res.getValue());
                            } else {
                                return Mono.empty();
                            }
                        });
    }

    /**
     * Get participant from a call.
     *
     * @param callConnectionId The call connection Id.
     * @param participantRawId Raw id of the participant to retrieve.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return participant from a call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public CallParticipantInternal getParticipant(String callConnectionId, String participantRawId) {
        return getParticipantAsync(callConnectionId, participantRawId).block();
    }

    /**
     * Get participant from a call.
     *
     * @param callConnectionId The call connection Id.
     * @param participantRawId Raw id of the participant to retrieve.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return participant from a call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<CallParticipantInternal> getParticipantWithResponse(
            String callConnectionId, String participantRawId, Context context) {
        return getParticipantWithResponseAsync(callConnectionId, participantRawId, context).block();
    }

    /**
     * Get the next page of items.
     *
     * @param nextLink The nextLink parameter.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for getting participants of the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<CallParticipantInternal>> getParticipantsNextSinglePageAsync(String nextLink) {
        final String accept = "application/json";
        return FluxUtil.withContext(
                        context -> service.getParticipantsNext(nextLink, this.client.getEndpoint(), accept, context))
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        res.getValue().getValues(),
                                        res.getValue().getNextLink(),
                                        null));
    }

    /**
     * Get the next page of items.
     *
     * @param nextLink The nextLink parameter.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CommunicationErrorResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response payload for getting participants of the call.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<CallParticipantInternal>> getParticipantsNextSinglePageAsync(
            String nextLink, Context context) {
        final String accept = "application/json";
        return service.getParticipantsNext(nextLink, this.client.getEndpoint(), accept, context)
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        res.getValue().getValues(),
                                        res.getValue().getNextLink(),
                                        null));
    }
}
