CallConnectionsImpl.java
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.communication.callingserver.implementation;
import com.azure.communication.callingserver.implementation.models.AddParticipantRequest;
import com.azure.communication.callingserver.implementation.models.AddParticipantResultInternal;
import com.azure.communication.callingserver.implementation.models.CancelAllMediaOperationsRequest;
import com.azure.communication.callingserver.implementation.models.CancelAllMediaOperationsResultInternal;
import com.azure.communication.callingserver.implementation.models.CommunicationErrorResponseException;
import com.azure.communication.callingserver.implementation.models.CreateCallRequest;
import com.azure.communication.callingserver.implementation.models.CreateCallResultInternal;
import com.azure.communication.callingserver.implementation.models.PlayAudioRequest;
import com.azure.communication.callingserver.implementation.models.PlayAudioResultInternal;
import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.Delete;
import com.azure.core.annotation.ExpectedResponses;
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.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
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 AzureCommunicationCallingServerServiceImpl client;
/**
* Initializes an instance of CallConnectionsImpl.
*
* @param client the instance of the service client containing this operation class.
*/
CallConnectionsImpl(AzureCommunicationCallingServerServiceImpl client) {
this.service =
RestProxy.create(CallConnectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for AzureCommunicationCallingServerServiceCallConnections to be used by
* the proxy service to perform REST calls.
*/
@Host("{endpoint}")
@ServiceInterface(name = "AzureCommunicationCa")
private interface CallConnectionsService {
@Post("/calling/callConnections")
@ExpectedResponses({201})
@UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
Mono<Response<CreateCallResultInternal>> createCall(
@HostParam("endpoint") String endpoint,
@QueryParam("api-version") String apiVersion,
@BodyParam("application/json") CreateCallRequest callRequest,
@HeaderParam("Accept") String accept,
Context context);
@Post("/calling/callConnections/{callConnectionId}/:hangup")
@ExpectedResponses({202})
@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}/:playAudio")
@ExpectedResponses({202})
@UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
Mono<Response<PlayAudioResultInternal>> playAudio(
@HostParam("endpoint") String endpoint,
@PathParam("callConnectionId") String callConnectionId,
@QueryParam("api-version") String apiVersion,
@BodyParam("application/json") PlayAudioRequest request,
@HeaderParam("Accept") String accept,
Context context);
@Post("/calling/callConnections/{callConnectionId}/:cancelAllMediaOperations")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
Mono<Response<CancelAllMediaOperationsResultInternal>> cancelAllMediaOperations(
@HostParam("endpoint") String endpoint,
@PathParam("callConnectionId") String callConnectionId,
@QueryParam("api-version") String apiVersion,
@BodyParam("application/json") CancelAllMediaOperationsRequest cancelAllMediaOperationRequest,
@HeaderParam("Accept") String accept,
Context context);
@Post("/calling/callConnections/{callConnectionId}/participants")
@ExpectedResponses({202})
@UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
Mono<Response<AddParticipantResultInternal>> addParticipant(
@HostParam("endpoint") String endpoint,
@PathParam("callConnectionId") String callConnectionId,
@QueryParam("api-version") String apiVersion,
@BodyParam("application/json") AddParticipantRequest addParticipantRequest,
@HeaderParam("Accept") String accept,
Context context);
@Delete("/calling/callConnections/{callConnectionId}/participants/{participantId}")
@ExpectedResponses({202})
@UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
Mono<Response<Void>> removeParticipant(
@HostParam("endpoint") String endpoint,
@PathParam("callConnectionId") String callConnectionId,
@PathParam("participantId") String participantId,
@QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept,
Context context);
}
/**
* Create a new call.
*
* @param callRequest Create call request.
* @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 of the create call operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<CreateCallResultInternal>> createCallWithResponseAsync(CreateCallRequest callRequest) {
final String accept = "application/json";
return FluxUtil.withContext(
context ->
service.createCall(
this.client.getEndpoint(), this.client.getApiVersion(), callRequest, accept, context));
}
/**
* Create a new call.
*
* @param callRequest Create call request.
* @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 of the create call operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<CreateCallResultInternal>> createCallWithResponseAsync(
CreateCallRequest callRequest, Context context) {
final String accept = "application/json";
return service.createCall(this.client.getEndpoint(), this.client.getApiVersion(), callRequest, accept, context);
}
/**
* Create a new call.
*
* @param callRequest Create call request.
* @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 of the create call operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<CreateCallResultInternal> createCallAsync(CreateCallRequest callRequest) {
return createCallWithResponseAsync(callRequest)
.flatMap(
(Response<CreateCallResultInternal> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Create a new call.
*
* @param callRequest Create call request.
* @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 of the create call operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<CreateCallResultInternal> createCallAsync(CreateCallRequest callRequest, Context context) {
return createCallWithResponseAsync(callRequest, context)
.flatMap(
(Response<CreateCallResultInternal> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Create a new call.
*
* @param callRequest Create call request.
* @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 of the create call operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public CreateCallResultInternal createCall(CreateCallRequest callRequest) {
return createCallAsync(callRequest).block();
}
/**
* Create a new call.
*
* @param callRequest Create call request.
* @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 of the create call operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<CreateCallResultInternal> createCallWithResponse(CreateCallRequest callRequest, Context context) {
return createCallWithResponseAsync(callRequest, 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();
}
/**
* Play audio in the call.
*
* @param callConnectionId The call connection id.
* @param request Play audio request.
* @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 play audio operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<PlayAudioResultInternal>> playAudioWithResponseAsync(
String callConnectionId, PlayAudioRequest request) {
final String accept = "application/json";
return FluxUtil.withContext(
context ->
service.playAudio(
this.client.getEndpoint(),
callConnectionId,
this.client.getApiVersion(),
request,
accept,
context));
}
/**
* Play audio in the call.
*
* @param callConnectionId The call connection id.
* @param request Play audio request.
* @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 play audio operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<PlayAudioResultInternal>> playAudioWithResponseAsync(
String callConnectionId, PlayAudioRequest request, Context context) {
final String accept = "application/json";
return service.playAudio(
this.client.getEndpoint(), callConnectionId, this.client.getApiVersion(), request, accept, context);
}
/**
* Play audio in the call.
*
* @param callConnectionId The call connection id.
* @param request Play audio request.
* @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 play audio operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PlayAudioResultInternal> playAudioAsync(String callConnectionId, PlayAudioRequest request) {
return playAudioWithResponseAsync(callConnectionId, request)
.flatMap(
(Response<PlayAudioResultInternal> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Play audio in the call.
*
* @param callConnectionId The call connection id.
* @param request Play audio request.
* @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 play audio operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PlayAudioResultInternal> playAudioAsync(
String callConnectionId, PlayAudioRequest request, Context context) {
return playAudioWithResponseAsync(callConnectionId, request, context)
.flatMap(
(Response<PlayAudioResultInternal> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Play audio in the call.
*
* @param callConnectionId The call connection id.
* @param request Play audio request.
* @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 play audio operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PlayAudioResultInternal playAudio(String callConnectionId, PlayAudioRequest request) {
return playAudioAsync(callConnectionId, request).block();
}
/**
* Play audio in the call.
*
* @param callConnectionId The call connection id.
* @param request Play audio request.
* @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 play audio operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<PlayAudioResultInternal> playAudioWithResponse(
String callConnectionId, PlayAudioRequest request, Context context) {
return playAudioWithResponseAsync(callConnectionId, request, context).block();
}
/**
* Cancel all media operations.
*
* @param callConnectionId The call connection id.
* @param cancelAllMediaOperationRequest The cancel all media operations context.
* @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 of the cancel all media operations.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<CancelAllMediaOperationsResultInternal>> cancelAllMediaOperationsWithResponseAsync(
String callConnectionId, CancelAllMediaOperationsRequest cancelAllMediaOperationRequest) {
final String accept = "application/json";
return FluxUtil.withContext(
context ->
service.cancelAllMediaOperations(
this.client.getEndpoint(),
callConnectionId,
this.client.getApiVersion(),
cancelAllMediaOperationRequest,
accept,
context));
}
/**
* Cancel all media operations.
*
* @param callConnectionId The call connection id.
* @param cancelAllMediaOperationRequest The cancel all media operations context.
* @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 of the cancel all media operations.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<CancelAllMediaOperationsResultInternal>> cancelAllMediaOperationsWithResponseAsync(
String callConnectionId, CancelAllMediaOperationsRequest cancelAllMediaOperationRequest, Context context) {
final String accept = "application/json";
return service.cancelAllMediaOperations(
this.client.getEndpoint(),
callConnectionId,
this.client.getApiVersion(),
cancelAllMediaOperationRequest,
accept,
context);
}
/**
* Cancel all media operations.
*
* @param callConnectionId The call connection id.
* @param cancelAllMediaOperationRequest The cancel all media operations context.
* @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 of the cancel all media operations.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<CancelAllMediaOperationsResultInternal> cancelAllMediaOperationsAsync(
String callConnectionId, CancelAllMediaOperationsRequest cancelAllMediaOperationRequest) {
return cancelAllMediaOperationsWithResponseAsync(callConnectionId, cancelAllMediaOperationRequest)
.flatMap(
(Response<CancelAllMediaOperationsResultInternal> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Cancel all media operations.
*
* @param callConnectionId The call connection id.
* @param cancelAllMediaOperationRequest The cancel all media operations context.
* @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 of the cancel all media operations.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<CancelAllMediaOperationsResultInternal> cancelAllMediaOperationsAsync(
String callConnectionId, CancelAllMediaOperationsRequest cancelAllMediaOperationRequest, Context context) {
return cancelAllMediaOperationsWithResponseAsync(callConnectionId, cancelAllMediaOperationRequest, context)
.flatMap(
(Response<CancelAllMediaOperationsResultInternal> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Cancel all media operations.
*
* @param callConnectionId The call connection id.
* @param cancelAllMediaOperationRequest The cancel all media operations context.
* @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 of the cancel all media operations.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public CancelAllMediaOperationsResultInternal cancelAllMediaOperations(
String callConnectionId, CancelAllMediaOperationsRequest cancelAllMediaOperationRequest) {
return cancelAllMediaOperationsAsync(callConnectionId, cancelAllMediaOperationRequest).block();
}
/**
* Cancel all media operations.
*
* @param callConnectionId The call connection id.
* @param cancelAllMediaOperationRequest The cancel all media operations context.
* @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 of the cancel all media operations.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<CancelAllMediaOperationsResultInternal> cancelAllMediaOperationsWithResponse(
String callConnectionId, CancelAllMediaOperationsRequest cancelAllMediaOperationRequest, Context context) {
return cancelAllMediaOperationsWithResponseAsync(callConnectionId, cancelAllMediaOperationRequest, context)
.block();
}
/**
* Add a participant to the call.
*
* @param callConnectionId The call connection id.
* @param addParticipantRequest Add participant request.
* @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 add participant result.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<AddParticipantResultInternal>> addParticipantWithResponseAsync(
String callConnectionId, AddParticipantRequest addParticipantRequest) {
final String accept = "application/json";
return FluxUtil.withContext(
context ->
service.addParticipant(
this.client.getEndpoint(),
callConnectionId,
this.client.getApiVersion(),
addParticipantRequest,
accept,
context));
}
/**
* Add a participant to the call.
*
* @param callConnectionId The call connection id.
* @param addParticipantRequest Add participant request.
* @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 add participant result.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<AddParticipantResultInternal>> addParticipantWithResponseAsync(
String callConnectionId, AddParticipantRequest addParticipantRequest, Context context) {
final String accept = "application/json";
return service.addParticipant(
this.client.getEndpoint(),
callConnectionId,
this.client.getApiVersion(),
addParticipantRequest,
accept,
context);
}
/**
* Add a participant to the call.
*
* @param callConnectionId The call connection id.
* @param addParticipantRequest Add participant request.
* @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 add participant result.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<AddParticipantResultInternal> addParticipantAsync(
String callConnectionId, AddParticipantRequest addParticipantRequest) {
return addParticipantWithResponseAsync(callConnectionId, addParticipantRequest)
.flatMap(
(Response<AddParticipantResultInternal> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Add a participant to the call.
*
* @param callConnectionId The call connection id.
* @param addParticipantRequest Add participant request.
* @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 add participant result.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<AddParticipantResultInternal> addParticipantAsync(
String callConnectionId, AddParticipantRequest addParticipantRequest, Context context) {
return addParticipantWithResponseAsync(callConnectionId, addParticipantRequest, context)
.flatMap(
(Response<AddParticipantResultInternal> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Add a participant to the call.
*
* @param callConnectionId The call connection id.
* @param addParticipantRequest Add participant request.
* @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 add participant result.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public AddParticipantResultInternal addParticipant(
String callConnectionId, AddParticipantRequest addParticipantRequest) {
return addParticipantAsync(callConnectionId, addParticipantRequest).block();
}
/**
* Add a participant to the call.
*
* @param callConnectionId The call connection id.
* @param addParticipantRequest Add participant request.
* @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 add participant result.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<AddParticipantResultInternal> addParticipantWithResponse(
String callConnectionId, AddParticipantRequest addParticipantRequest, Context context) {
return addParticipantWithResponseAsync(callConnectionId, addParticipantRequest, context).block();
}
/**
* Remove a participant from the call.
*
* @param callConnectionId The call connection id.
* @param participantId The participant 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>> removeParticipantWithResponseAsync(String callConnectionId, String participantId) {
final String accept = "application/json";
return FluxUtil.withContext(
context ->
service.removeParticipant(
this.client.getEndpoint(),
callConnectionId,
participantId,
this.client.getApiVersion(),
accept,
context));
}
/**
* Remove a participant from the call.
*
* @param callConnectionId The call connection id.
* @param participantId The participant 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>> removeParticipantWithResponseAsync(
String callConnectionId, String participantId, Context context) {
final String accept = "application/json";
return service.removeParticipant(
this.client.getEndpoint(),
callConnectionId,
participantId,
this.client.getApiVersion(),
accept,
context);
}
/**
* Remove a participant from the call.
*
* @param callConnectionId The call connection id.
* @param participantId The participant 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> removeParticipantAsync(String callConnectionId, String participantId) {
return removeParticipantWithResponseAsync(callConnectionId, participantId)
.flatMap((Response<Void> res) -> Mono.empty());
}
/**
* Remove a participant from the call.
*
* @param callConnectionId The call connection id.
* @param participantId The participant 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> removeParticipantAsync(String callConnectionId, String participantId, Context context) {
return removeParticipantWithResponseAsync(callConnectionId, participantId, context)
.flatMap((Response<Void> res) -> Mono.empty());
}
/**
* Remove a participant from the call.
*
* @param callConnectionId The call connection id.
* @param participantId The participant 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 removeParticipant(String callConnectionId, String participantId) {
removeParticipantAsync(callConnectionId, participantId).block();
}
/**
* Remove a participant from the call.
*
* @param callConnectionId The call connection id.
* @param participantId The participant 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> removeParticipantWithResponse(
String callConnectionId, String participantId, Context context) {
return removeParticipantWithResponseAsync(callConnectionId, participantId, context).block();
}
}