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

com.azure.communication.rooms.implementation.RoomsImpl Maven / Gradle / Ivy

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

package com.azure.communication.rooms.implementation;

import com.azure.communication.rooms.implementation.models.AddParticipantsRequest;
import com.azure.communication.rooms.implementation.models.CommunicationErrorResponseException;
import com.azure.communication.rooms.implementation.models.CreateRoomRequest;
import com.azure.communication.rooms.implementation.models.ParticipantsCollection;
import com.azure.communication.rooms.implementation.models.RemoveParticipantsRequest;
import com.azure.communication.rooms.implementation.models.RoomModel;
import com.azure.communication.rooms.implementation.models.UpdateParticipantsRequest;
import com.azure.communication.rooms.implementation.models.UpdateRoomRequest;
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.Patch;
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.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 Rooms. */
public final class RoomsImpl {
    /** The proxy service used to perform REST calls. */
    private final RoomsService service;

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

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

    /**
     * The interface defining all the services for AzureCommunicationRoomServiceRooms to be used by the proxy service to
     * perform REST calls.
     */
    @Host("{endpoint}")
    @ServiceInterface(name = "AzureCommunicationRo")
    public interface RoomsService {
        @Post("/rooms")
        @ExpectedResponses({201})
        @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
        Mono> createRoom(
                @HostParam("endpoint") String endpoint,
                @QueryParam("api-version") String apiVersion,
                @BodyParam("application/json") CreateRoomRequest createRoomRequest,
                @HeaderParam("Accept") String accept,
                @HeaderParam("repeatability-request-id") String repeatabilityRequestId,
                @HeaderParam("repeatability-first-sent") String repeatabilityFirstSent,
                Context context);

        @Get("/rooms/{roomId}")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
        Mono> getRoom(
                @HostParam("endpoint") String endpoint,
                @PathParam("roomId") String roomId,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Accept") String accept,
                Context context);

        @Patch("/rooms/{roomId}")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
        Mono> updateRoom(
                @HostParam("endpoint") String endpoint,
                @PathParam("roomId") String roomId,
                @QueryParam("api-version") String apiVersion,
                @BodyParam("application/json") UpdateRoomRequest patchRoomRequest,
                @HeaderParam("Accept") String accept,
                Context context);

        @Delete("/rooms/{roomId}")
        @ExpectedResponses({204})
        @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
        Mono> deleteRoom(
                @HostParam("endpoint") String endpoint,
                @PathParam("roomId") String roomId,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Accept") String accept,
                Context context);

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

        @Post("/rooms/{roomId}/participants:add")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
        Mono> addParticipants(
                @HostParam("endpoint") String endpoint,
                @PathParam("roomId") String roomId,
                @QueryParam("api-version") String apiVersion,
                @BodyParam("application/json") AddParticipantsRequest addParticipantsRequest,
                @HeaderParam("Accept") String accept,
                Context context);

        @Post("/rooms/{roomId}/participants:update")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
        Mono> updateParticipants(
                @HostParam("endpoint") String endpoint,
                @PathParam("roomId") String roomId,
                @QueryParam("api-version") String apiVersion,
                @BodyParam("application/json") UpdateParticipantsRequest updateParticipantsRequest,
                @HeaderParam("Accept") String accept,
                Context context);

        @Post("/rooms/{roomId}/participants:remove")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
        Mono> removeParticipants(
                @HostParam("endpoint") String endpoint,
                @PathParam("roomId") String roomId,
                @QueryParam("api-version") String apiVersion,
                @BodyParam("application/json") RemoveParticipantsRequest removeParticipantsRequest,
                @HeaderParam("Accept") String accept,
                Context context);
    }

    /**
     * Creates a new room.
     *
     * @param createRoomRequest The create room request body.
     * @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 meeting room along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono> createRoomWithResponseAsync(CreateRoomRequest createRoomRequest) {
        final String accept = "application/json";
        String repeatabilityRequestId = UUID.randomUUID().toString();
        String repeatabilityFirstSent = DateTimeRfc1123.toRfc1123String(OffsetDateTime.now());
        return FluxUtil.withContext(
                context ->
                        service.createRoom(
                                this.client.getEndpoint(),
                                this.client.getApiVersion(),
                                createRoomRequest,
                                accept,
                                repeatabilityRequestId,
                                repeatabilityFirstSent,
                                context));
    }

    /**
     * Creates a new room.
     *
     * @param createRoomRequest The create room request body.
     * @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 meeting room along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono> createRoomWithResponseAsync(CreateRoomRequest createRoomRequest, Context context) {
        final String accept = "application/json";
        String repeatabilityRequestId = UUID.randomUUID().toString();
        String repeatabilityFirstSent = DateTimeRfc1123.toRfc1123String(OffsetDateTime.now());
        return service.createRoom(
                this.client.getEndpoint(),
                this.client.getApiVersion(),
                createRoomRequest,
                accept,
                repeatabilityRequestId,
                repeatabilityFirstSent,
                context);
    }

    /**
     * Creates a new room.
     *
     * @param createRoomRequest The create room request body.
     * @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 meeting room on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono createRoomAsync(CreateRoomRequest createRoomRequest) {
        return createRoomWithResponseAsync(createRoomRequest).flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Creates a new room.
     *
     * @param createRoomRequest The create room request body.
     * @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 meeting room on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono createRoomAsync(CreateRoomRequest createRoomRequest, Context context) {
        return createRoomWithResponseAsync(createRoomRequest, context).flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Creates a new room.
     *
     * @param createRoomRequest The create room request body.
     * @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 meeting room.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public RoomModel createRoom(CreateRoomRequest createRoomRequest) {
        return createRoomAsync(createRoomRequest).block();
    }

    /**
     * Creates a new room.
     *
     * @param createRoomRequest The create room request body.
     * @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 meeting room along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response createRoomWithResponse(CreateRoomRequest createRoomRequest, Context context) {
        return createRoomWithResponseAsync(createRoomRequest, context).block();
    }

    /**
     * Retrieves an existing room by id.
     *
     * @param roomId The id of the room requested.
     * @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 meeting room along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono> getRoomWithResponseAsync(String roomId) {
        final String accept = "application/json";
        return FluxUtil.withContext(
                context ->
                        service.getRoom(
                                this.client.getEndpoint(), roomId, this.client.getApiVersion(), accept, context));
    }

    /**
     * Retrieves an existing room by id.
     *
     * @param roomId The id of the room requested.
     * @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 meeting room along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono> getRoomWithResponseAsync(String roomId, Context context) {
        final String accept = "application/json";
        return service.getRoom(this.client.getEndpoint(), roomId, this.client.getApiVersion(), accept, context);
    }

    /**
     * Retrieves an existing room by id.
     *
     * @param roomId The id of the room requested.
     * @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 meeting room on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono getRoomAsync(String roomId) {
        return getRoomWithResponseAsync(roomId).flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Retrieves an existing room by id.
     *
     * @param roomId The id of the room requested.
     * @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 meeting room on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono getRoomAsync(String roomId, Context context) {
        return getRoomWithResponseAsync(roomId, context).flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Retrieves an existing room by id.
     *
     * @param roomId The id of the room requested.
     * @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 meeting room.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public RoomModel getRoom(String roomId) {
        return getRoomAsync(roomId).block();
    }

    /**
     * Retrieves an existing room by id.
     *
     * @param roomId The id of the room requested.
     * @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 meeting room along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response getRoomWithResponse(String roomId, Context context) {
        return getRoomWithResponseAsync(roomId, context).block();
    }

    /**
     * Update a room with given changes.
     *
     * @param roomId The id of the room requested.
     * @param patchRoomRequest The patch room 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 meeting room along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono> updateRoomWithResponseAsync(String roomId, UpdateRoomRequest patchRoomRequest) {
        final String accept = "application/json";
        return FluxUtil.withContext(
                context ->
                        service.updateRoom(
                                this.client.getEndpoint(),
                                roomId,
                                this.client.getApiVersion(),
                                patchRoomRequest,
                                accept,
                                context));
    }

    /**
     * Update a room with given changes.
     *
     * @param roomId The id of the room requested.
     * @param patchRoomRequest The patch room 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 meeting room along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono> updateRoomWithResponseAsync(
            String roomId, UpdateRoomRequest patchRoomRequest, Context context) {
        final String accept = "application/json";
        return service.updateRoom(
                this.client.getEndpoint(), roomId, this.client.getApiVersion(), patchRoomRequest, accept, context);
    }

    /**
     * Update a room with given changes.
     *
     * @param roomId The id of the room requested.
     * @param patchRoomRequest The patch room 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 meeting room on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono updateRoomAsync(String roomId, UpdateRoomRequest patchRoomRequest) {
        return updateRoomWithResponseAsync(roomId, patchRoomRequest).flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Update a room with given changes.
     *
     * @param roomId The id of the room requested.
     * @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 meeting room on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono updateRoomAsync(String roomId) {
        final UpdateRoomRequest patchRoomRequest = null;
        return updateRoomWithResponseAsync(roomId, patchRoomRequest).flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Update a room with given changes.
     *
     * @param roomId The id of the room requested.
     * @param patchRoomRequest The patch room 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 meeting room on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono updateRoomAsync(String roomId, UpdateRoomRequest patchRoomRequest, Context context) {
        return updateRoomWithResponseAsync(roomId, patchRoomRequest, context)
                .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Update a room with given changes.
     *
     * @param roomId The id of the room requested.
     * @param patchRoomRequest The patch room 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 meeting room.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public RoomModel updateRoom(String roomId, UpdateRoomRequest patchRoomRequest) {
        return updateRoomAsync(roomId, patchRoomRequest).block();
    }

    /**
     * Update a room with given changes.
     *
     * @param roomId The id of the room requested.
     * @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 meeting room.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public RoomModel updateRoom(String roomId) {
        final UpdateRoomRequest patchRoomRequest = null;
        return updateRoomAsync(roomId, patchRoomRequest).block();
    }

    /**
     * Update a room with given changes.
     *
     * @param roomId The id of the room requested.
     * @param patchRoomRequest The patch room 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 meeting room along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response updateRoomWithResponse(
            String roomId, UpdateRoomRequest patchRoomRequest, Context context) {
        return updateRoomWithResponseAsync(roomId, patchRoomRequest, context).block();
    }

    /**
     * Delete a room.
     *
     * @param roomId The id of the room to be deleted.
     * @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 {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono> deleteRoomWithResponseAsync(String roomId) {
        final String accept = "application/json";
        return FluxUtil.withContext(
                context ->
                        service.deleteRoom(
                                this.client.getEndpoint(), roomId, this.client.getApiVersion(), accept, context));
    }

    /**
     * Delete a room.
     *
     * @param roomId The id of the room to be deleted.
     * @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 {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono> deleteRoomWithResponseAsync(String roomId, Context context) {
        final String accept = "application/json";
        return service.deleteRoom(this.client.getEndpoint(), roomId, this.client.getApiVersion(), accept, context);
    }

    /**
     * Delete a room.
     *
     * @param roomId The id of the room to be deleted.
     * @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 A {@link Mono} that completes when a successful response is received.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono deleteRoomAsync(String roomId) {
        return deleteRoomWithResponseAsync(roomId).flatMap(ignored -> Mono.empty());
    }

    /**
     * Delete a room.
     *
     * @param roomId The id of the room to be deleted.
     * @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 A {@link Mono} that completes when a successful response is received.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono deleteRoomAsync(String roomId, Context context) {
        return deleteRoomWithResponseAsync(roomId, context).flatMap(ignored -> Mono.empty());
    }

    /**
     * Delete a room.
     *
     * @param roomId The id of the room to be deleted.
     * @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 deleteRoom(String roomId) {
        deleteRoomAsync(roomId).block();
    }

    /**
     * Delete a room.
     *
     * @param roomId The id of the room to be deleted.
     * @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 {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response deleteRoomWithResponse(String roomId, Context context) {
        return deleteRoomWithResponseAsync(roomId, context).block();
    }

    /**
     * Get participants in a room.
     *
     * @param roomId The id of the room to get participants from.
     * @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 in a room along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono> getParticipantsWithResponseAsync(String roomId) {
        final String accept = "application/json";
        return FluxUtil.withContext(
                context ->
                        service.getParticipants(
                                this.client.getEndpoint(), roomId, this.client.getApiVersion(), accept, context));
    }

    /**
     * Get participants in a room.
     *
     * @param roomId The id of the room to get participants from.
     * @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 in a room along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono> getParticipantsWithResponseAsync(String roomId, Context context) {
        final String accept = "application/json";
        return service.getParticipants(this.client.getEndpoint(), roomId, this.client.getApiVersion(), accept, context);
    }

    /**
     * Get participants in a room.
     *
     * @param roomId The id of the room to get participants from.
     * @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 in a room on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono getParticipantsAsync(String roomId) {
        return getParticipantsWithResponseAsync(roomId).flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Get participants in a room.
     *
     * @param roomId The id of the room to get participants from.
     * @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 in a room on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono getParticipantsAsync(String roomId, Context context) {
        return getParticipantsWithResponseAsync(roomId, context).flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Get participants in a room.
     *
     * @param roomId The id of the room to get participants from.
     * @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 in a room.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public ParticipantsCollection getParticipants(String roomId) {
        return getParticipantsAsync(roomId).block();
    }

    /**
     * Get participants in a room.
     *
     * @param roomId The id of the room to get participants from.
     * @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 in a room along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response getParticipantsWithResponse(String roomId, Context context) {
        return getParticipantsWithResponseAsync(roomId, context).block();
    }

    /**
     * Adds participants to a room. If participants already exist, no change occurs.
     *
     * @param roomId Room id to add participants.
     * @param addParticipantsRequest Participants to be added to the room.
     * @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 collection of participants in a room along with {@link Response} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono> addParticipantsWithResponseAsync(
            String roomId, AddParticipantsRequest addParticipantsRequest) {
        final String accept = "application/json";
        return FluxUtil.withContext(
                context ->
                        service.addParticipants(
                                this.client.getEndpoint(),
                                roomId,
                                this.client.getApiVersion(),
                                addParticipantsRequest,
                                accept,
                                context));
    }

    /**
     * Adds participants to a room. If participants already exist, no change occurs.
     *
     * @param roomId Room id to add participants.
     * @param addParticipantsRequest Participants to be added to the room.
     * @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 collection of participants in a room along with {@link Response} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono> addParticipantsWithResponseAsync(
            String roomId, AddParticipantsRequest addParticipantsRequest, Context context) {
        final String accept = "application/json";
        return service.addParticipants(
                this.client.getEndpoint(),
                roomId,
                this.client.getApiVersion(),
                addParticipantsRequest,
                accept,
                context);
    }

    /**
     * Adds participants to a room. If participants already exist, no change occurs.
     *
     * @param roomId Room id to add participants.
     * @param addParticipantsRequest Participants to be added to the room.
     * @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 collection of participants in a room on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono addParticipantsAsync(
            String roomId, AddParticipantsRequest addParticipantsRequest) {
        return addParticipantsWithResponseAsync(roomId, addParticipantsRequest)
                .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Adds participants to a room. If participants already exist, no change occurs.
     *
     * @param roomId Room id to add participants.
     * @param addParticipantsRequest Participants to be added to the room.
     * @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 collection of participants in a room on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono addParticipantsAsync(
            String roomId, AddParticipantsRequest addParticipantsRequest, Context context) {
        return addParticipantsWithResponseAsync(roomId, addParticipantsRequest, context)
                .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Adds participants to a room. If participants already exist, no change occurs.
     *
     * @param roomId Room id to add participants.
     * @param addParticipantsRequest Participants to be added to the room.
     * @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 collection of participants in a room.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public ParticipantsCollection addParticipants(String roomId, AddParticipantsRequest addParticipantsRequest) {
        return addParticipantsAsync(roomId, addParticipantsRequest).block();
    }

    /**
     * Adds participants to a room. If participants already exist, no change occurs.
     *
     * @param roomId Room id to add participants.
     * @param addParticipantsRequest Participants to be added to the room.
     * @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 collection of participants in a room along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response addParticipantsWithResponse(
            String roomId, AddParticipantsRequest addParticipantsRequest, Context context) {
        return addParticipantsWithResponseAsync(roomId, addParticipantsRequest, context).block();
    }

    /**
     * Update participants in a room.
     *
     * @param roomId The room id.
     * @param updateParticipantsRequest Participants in a room to be updated.
     * @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 collection of participants in a room along with {@link Response} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono> updateParticipantsWithResponseAsync(
            String roomId, UpdateParticipantsRequest updateParticipantsRequest) {
        final String accept = "application/json";
        return FluxUtil.withContext(
                context ->
                        service.updateParticipants(
                                this.client.getEndpoint(),
                                roomId,
                                this.client.getApiVersion(),
                                updateParticipantsRequest,
                                accept,
                                context));
    }

    /**
     * Update participants in a room.
     *
     * @param roomId The room id.
     * @param updateParticipantsRequest Participants in a room to be updated.
     * @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 collection of participants in a room along with {@link Response} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono> updateParticipantsWithResponseAsync(
            String roomId, UpdateParticipantsRequest updateParticipantsRequest, Context context) {
        final String accept = "application/json";
        return service.updateParticipants(
                this.client.getEndpoint(),
                roomId,
                this.client.getApiVersion(),
                updateParticipantsRequest,
                accept,
                context);
    }

    /**
     * Update participants in a room.
     *
     * @param roomId The room id.
     * @param updateParticipantsRequest Participants in a room to be updated.
     * @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 collection of participants in a room on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono updateParticipantsAsync(
            String roomId, UpdateParticipantsRequest updateParticipantsRequest) {
        return updateParticipantsWithResponseAsync(roomId, updateParticipantsRequest)
                .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Update participants in a room.
     *
     * @param roomId The room id.
     * @param updateParticipantsRequest Participants in a room to be updated.
     * @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 collection of participants in a room on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono updateParticipantsAsync(
            String roomId, UpdateParticipantsRequest updateParticipantsRequest, Context context) {
        return updateParticipantsWithResponseAsync(roomId, updateParticipantsRequest, context)
                .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Update participants in a room.
     *
     * @param roomId The room id.
     * @param updateParticipantsRequest Participants in a room to be updated.
     * @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 collection of participants in a room.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public ParticipantsCollection updateParticipants(
            String roomId, UpdateParticipantsRequest updateParticipantsRequest) {
        return updateParticipantsAsync(roomId, updateParticipantsRequest).block();
    }

    /**
     * Update participants in a room.
     *
     * @param roomId The room id.
     * @param updateParticipantsRequest Participants in a room to be updated.
     * @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 collection of participants in a room along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response updateParticipantsWithResponse(
            String roomId, UpdateParticipantsRequest updateParticipantsRequest, Context context) {
        return updateParticipantsWithResponseAsync(roomId, updateParticipantsRequest, context).block();
    }

    /**
     * Remove participants from a room.
     *
     * @param roomId Room id to remove the participants from.
     * @param removeParticipantsRequest Participants in a room to be removed.
     * @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 collection of participants in a room along with {@link Response} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono> removeParticipantsWithResponseAsync(
            String roomId, RemoveParticipantsRequest removeParticipantsRequest) {
        final String accept = "application/json";
        return FluxUtil.withContext(
                context ->
                        service.removeParticipants(
                                this.client.getEndpoint(),
                                roomId,
                                this.client.getApiVersion(),
                                removeParticipantsRequest,
                                accept,
                                context));
    }

    /**
     * Remove participants from a room.
     *
     * @param roomId Room id to remove the participants from.
     * @param removeParticipantsRequest Participants in a room to be removed.
     * @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 collection of participants in a room along with {@link Response} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono> removeParticipantsWithResponseAsync(
            String roomId, RemoveParticipantsRequest removeParticipantsRequest, Context context) {
        final String accept = "application/json";
        return service.removeParticipants(
                this.client.getEndpoint(),
                roomId,
                this.client.getApiVersion(),
                removeParticipantsRequest,
                accept,
                context);
    }

    /**
     * Remove participants from a room.
     *
     * @param roomId Room id to remove the participants from.
     * @param removeParticipantsRequest Participants in a room to be removed.
     * @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 collection of participants in a room on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono removeParticipantsAsync(
            String roomId, RemoveParticipantsRequest removeParticipantsRequest) {
        return removeParticipantsWithResponseAsync(roomId, removeParticipantsRequest)
                .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Remove participants from a room.
     *
     * @param roomId Room id to remove the participants from.
     * @param removeParticipantsRequest Participants in a room to be removed.
     * @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 collection of participants in a room on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono removeParticipantsAsync(
            String roomId, RemoveParticipantsRequest removeParticipantsRequest, Context context) {
        return removeParticipantsWithResponseAsync(roomId, removeParticipantsRequest, context)
                .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Remove participants from a room.
     *
     * @param roomId Room id to remove the participants from.
     * @param removeParticipantsRequest Participants in a room to be removed.
     * @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 collection of participants in a room.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public ParticipantsCollection removeParticipants(
            String roomId, RemoveParticipantsRequest removeParticipantsRequest) {
        return removeParticipantsAsync(roomId, removeParticipantsRequest).block();
    }

    /**
     * Remove participants from a room.
     *
     * @param roomId Room id to remove the participants from.
     * @param removeParticipantsRequest Participants in a room to be removed.
     * @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 collection of participants in a room along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response removeParticipantsWithResponse(
            String roomId, RemoveParticipantsRequest removeParticipantsRequest, Context context) {
        return removeParticipantsWithResponseAsync(roomId, removeParticipantsRequest, context).block();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy