diff --git a/sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/RoomsAsyncClient.java b/sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/RoomsAsyncClient.java index e235fe20ae04d..cb4d91825458d 100644 --- a/sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/RoomsAsyncClient.java +++ b/sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/RoomsAsyncClient.java @@ -9,8 +9,6 @@ import com.azure.communication.rooms.implementation.models.RoomParticipantInternal; import com.azure.communication.rooms.implementation.models.UpdateRoomRequest; import com.azure.communication.rooms.implementation.models.CreateRoomRequest; -import com.azure.communication.rooms.implementation.models.CreateRoomResponse; -import com.azure.communication.rooms.implementation.models.UpdateRoomResponse; import com.azure.communication.rooms.models.CommunicationRoom; import com.azure.communication.rooms.models.RoomParticipant; import com.azure.core.annotation.ReturnType; @@ -61,8 +59,8 @@ Mono createRoom(OffsetDateTime validFrom, OffsetDateTime vali try { return this.roomsClient .createRoomWithResponseAsync(toCreateRoomRequest(validFrom, validUntil, participants), context) - .flatMap((Response response) -> { - return Mono.just(getCommunicationRoomFromResponse(response.getValue().getRoom(), response.getValue().getInvalidParticipants())); + .flatMap((Response response) -> { + return Mono.just(getCommunicationRoomFromResponse(response.getValue())); }); } catch (RuntimeException ex) { return monoError(logger, ex); @@ -87,8 +85,8 @@ Mono> createRoomWithResponse(OffsetDateTime validFro try { return this.roomsClient .createRoomWithResponseAsync(toCreateRoomRequest(validFrom, validUntil, participants), context) - .flatMap((Response response) -> { - CommunicationRoom communicationRoom = getCommunicationRoomFromResponse(response.getValue().getRoom(), response.getValue().getInvalidParticipants()); + .flatMap((Response response) -> { + CommunicationRoom communicationRoom = getCommunicationRoomFromResponse(response.getValue()); return Mono.just(new SimpleResponse(response, communicationRoom)); }); } catch (RuntimeException ex) { @@ -114,8 +112,8 @@ Mono updateRoom(String roomId, OffsetDateTime validFrom, Offs try { return this.roomsClient .updateRoomWithResponseAsync(roomId, toUpdateRoomRequest(validFrom, validUntil, null, false), context) - .flatMap((Response response) -> { - return Mono.just(getCommunicationRoomFromResponse(response.getValue().getRoom(), response.getValue().getInvalidParticipants())); + .flatMap((Response response) -> { + return Mono.just(getCommunicationRoomFromResponse(response.getValue())); }); } catch (RuntimeException ex) { return monoError(logger, ex); @@ -141,8 +139,8 @@ Mono> updateRoomWithResponse(String roomId, OffsetDa try { return this.roomsClient .updateRoomWithResponseAsync(roomId, toUpdateRoomRequest(validFrom, validUntil, null, false), context) - .flatMap((Response response) -> { - CommunicationRoom communicationRoom = getCommunicationRoomFromResponse(response.getValue().getRoom(), response.getValue().getInvalidParticipants()); + .flatMap((Response response) -> { + CommunicationRoom communicationRoom = getCommunicationRoomFromResponse(response.getValue()); return Mono.just(new SimpleResponse(response, communicationRoom)); }); } catch (RuntimeException ex) { @@ -169,7 +167,7 @@ Mono getRoom(String roomId, Context context) { .getRoomWithResponseAsync(roomId, context) .flatMap( (Response response) -> { - return Mono.just(getCommunicationRoomFromResponse(response.getValue(), null)); + return Mono.just(getCommunicationRoomFromResponse(response.getValue())); } ); } catch (RuntimeException ex) { @@ -196,7 +194,7 @@ Mono> getRoomWithResponse(String roomId, Context con .getRoomWithResponseAsync(roomId, context) .flatMap( (Response response) -> { - CommunicationRoom communicationRoom = getCommunicationRoomFromResponse(response.getValue(), null); + CommunicationRoom communicationRoom = getCommunicationRoomFromResponse(response.getValue()); return Mono.just(new SimpleResponse(response, communicationRoom)); } ); @@ -247,8 +245,8 @@ Mono addParticipants(String roomId, List par try { return this.roomsClient .updateRoomWithResponseAsync(roomId, toUpdateRoomRequest(null, null, participants, false), context) - .flatMap((Response response) -> { - return Mono.just(getCommunicationRoomFromResponse(response.getValue().getRoom(), response.getValue().getInvalidParticipants())); + .flatMap((Response response) -> { + return Mono.just(getCommunicationRoomFromResponse(response.getValue())); }); } catch (RuntimeException ex) { return monoError(logger, ex); @@ -273,8 +271,8 @@ Mono> addParticipantsWithResponse(String roomId, Lis try { return this.roomsClient .updateRoomWithResponseAsync(roomId, toUpdateRoomRequest(null, null, participants, false), context) - .flatMap((Response response) -> { - CommunicationRoom communicationRoom = getCommunicationRoomFromResponse(response.getValue().getRoom(), response.getValue().getInvalidParticipants()); + .flatMap((Response response) -> { + CommunicationRoom communicationRoom = getCommunicationRoomFromResponse(response.getValue()); return Mono.just(new SimpleResponse(response, communicationRoom)); }); } catch (RuntimeException ex) { @@ -299,8 +297,8 @@ Mono updateParticipants(String roomId, List try { return this.roomsClient .updateRoomWithResponseAsync(roomId, toUpdateRoomRequest(null, null, participants, false), context) - .flatMap((Response response) -> { - return Mono.just(getCommunicationRoomFromResponse(response.getValue().getRoom(), response.getValue().getInvalidParticipants())); + .flatMap((Response response) -> { + return Mono.just(getCommunicationRoomFromResponse(response.getValue())); }); } catch (RuntimeException ex) { return monoError(logger, ex); @@ -325,8 +323,8 @@ Mono> updateParticipantsWithResponse(String roomId, try { return this.roomsClient .updateRoomWithResponseAsync(roomId, toUpdateRoomRequest(null, null, participants, false), context) - .flatMap((Response response) -> { - CommunicationRoom communicationRoom = getCommunicationRoomFromResponse(response.getValue().getRoom(), response.getValue().getInvalidParticipants()); + .flatMap((Response response) -> { + CommunicationRoom communicationRoom = getCommunicationRoomFromResponse(response.getValue()); return Mono.just(new SimpleResponse(response, communicationRoom)); }); } catch (RuntimeException ex) { @@ -351,8 +349,8 @@ Mono removeParticipants(String roomId, List try { return this.roomsClient .updateRoomWithResponseAsync(roomId, toUpdateRoomRequest(null, null, participants, true), context) - .flatMap((Response response) -> { - return Mono.just(getCommunicationRoomFromResponse(response.getValue().getRoom(), response.getValue().getInvalidParticipants())); + .flatMap((Response response) -> { + return Mono.just(getCommunicationRoomFromResponse(response.getValue())); }); } catch (RuntimeException ex) { return monoError(logger, ex); @@ -377,8 +375,8 @@ Mono> removeParticipantsWithResponse(String roomId, try { return this.roomsClient .updateRoomWithResponseAsync(roomId, toUpdateRoomRequest(null, null, participants, true), context) - .flatMap((Response response) -> { - CommunicationRoom communicationRoom = getCommunicationRoomFromResponse(response.getValue().getRoom(), response.getValue().getInvalidParticipants()); + .flatMap((Response response) -> { + CommunicationRoom communicationRoom = getCommunicationRoomFromResponse(response.getValue()); return Mono.just(new SimpleResponse(response, communicationRoom)); }); } catch (RuntimeException ex) { @@ -403,8 +401,8 @@ Mono removeAllParticipants(String roomId, Context context) { Map participants = new HashMap<>(); return this.roomsClient .updateRoomWithResponseAsync(roomId, toUpdateRoomRequest(null, null, participants), context) - .flatMap((Response response) -> { - return Mono.just(getCommunicationRoomFromResponse(response.getValue().getRoom(), response.getValue().getInvalidParticipants())); + .flatMap((Response response) -> { + return Mono.just(getCommunicationRoomFromResponse(response.getValue())); }); } catch (RuntimeException ex) { return monoError(logger, ex); @@ -429,8 +427,8 @@ Mono> removeAllParticipantsWithResponse(String roomI Map participants = new HashMap<>(); return this.roomsClient .updateRoomWithResponseAsync(roomId, toUpdateRoomRequest(null, null, participants), context) - .flatMap((Response response) -> { - CommunicationRoom communicationRoom = getCommunicationRoomFromResponse(response.getValue().getRoom(), response.getValue().getInvalidParticipants()); + .flatMap((Response response) -> { + CommunicationRoom communicationRoom = getCommunicationRoomFromResponse(response.getValue()); return Mono.just(new SimpleResponse(response, communicationRoom)); }); } catch (RuntimeException ex) { @@ -447,7 +445,7 @@ private Map createParticipantMapFromCollection( return participantMap; } - private CommunicationRoom getCommunicationRoomFromResponse(RoomModel room, Map invalidParticipant) { + private CommunicationRoom getCommunicationRoomFromResponse(RoomModel room) { List participants = new ArrayList<>(); if (room.getParticipants() != null) { participants = room.getParticipants().entrySet().stream() @@ -458,8 +456,7 @@ private CommunicationRoom getCommunicationRoomFromResponse(RoomModel room, Map, + ConfigurationTrait, + EndpointTrait { + @Generated private static final String SDK_NAME = "name"; - private static final String SDK_VERSION = "version"; + @Generated private static final String SDK_VERSION = "version"; - private final Map properties = new HashMap<>(); + @Generated private final Map properties = new HashMap<>(); + + @Generated private final List pipelinePolicies; /** Create an instance of the AzureCommunicationRoomServiceImplBuilder. */ + @Generated public AzureCommunicationRoomServiceImplBuilder() { this.pipelinePolicies = new ArrayList<>(); } /* - * The endpoint of the Azure Communication resource. + * The HTTP pipeline to send requests through. */ - private String endpoint; + @Generated private HttpPipeline pipeline; - /** - * Sets The endpoint of the Azure Communication resource. - * - * @param endpoint the endpoint value. - * @return the AzureCommunicationRoomServiceImplBuilder. - */ - public AzureCommunicationRoomServiceImplBuilder endpoint(String endpoint) { - this.endpoint = endpoint; + /** {@inheritDoc}. */ + @Generated + @Override + public AzureCommunicationRoomServiceImplBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; return this; } /* - * Api Version + * The HTTP client used to send the request. */ - private String apiVersion; + @Generated private HttpClient httpClient; - /** - * Sets Api Version. - * - * @param apiVersion the apiVersion value. - * @return the AzureCommunicationRoomServiceImplBuilder. - */ - public AzureCommunicationRoomServiceImplBuilder apiVersion(String apiVersion) { - this.apiVersion = apiVersion; + /** {@inheritDoc}. */ + @Generated + @Override + public AzureCommunicationRoomServiceImplBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; return this; } /* - * The HTTP pipeline to send requests through + * The logging configuration for HTTP requests and responses. */ - private HttpPipeline pipeline; + @Generated private HttpLogOptions httpLogOptions; - /** - * Sets The HTTP pipeline to send requests through. - * - * @param pipeline the pipeline value. - * @return the AzureCommunicationRoomServiceImplBuilder. - */ - public AzureCommunicationRoomServiceImplBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = pipeline; + /** {@inheritDoc}. */ + @Generated + @Override + public AzureCommunicationRoomServiceImplBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; return this; } /* - * The serializer to serialize an object into a string + * The client options such as application ID and custom headers to set on a + * request. */ - private SerializerAdapter serializerAdapter; + @Generated private ClientOptions clientOptions; - /** - * Sets The serializer to serialize an object into a string. - * - * @param serializerAdapter the serializerAdapter value. - * @return the AzureCommunicationRoomServiceImplBuilder. - */ - public AzureCommunicationRoomServiceImplBuilder serializerAdapter(SerializerAdapter serializerAdapter) { - this.serializerAdapter = serializerAdapter; + /** {@inheritDoc}. */ + @Generated + @Override + public AzureCommunicationRoomServiceImplBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; return this; } /* - * The HTTP client used to send the request. + * The retry options to configure retry policy for failed requests. */ - private HttpClient httpClient; + @Generated private RetryOptions retryOptions; - /** - * Sets The HTTP client used to send the request. - * - * @param httpClient the httpClient value. - * @return the AzureCommunicationRoomServiceImplBuilder. - */ - public AzureCommunicationRoomServiceImplBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; + /** {@inheritDoc}. */ + @Generated + @Override + public AzureCommunicationRoomServiceImplBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** {@inheritDoc}. */ + @Generated + @Override + public AzureCommunicationRoomServiceImplBuilder addPolicy(HttpPipelinePolicy customPolicy) { + pipelinePolicies.add(customPolicy); return this; } @@ -121,65 +136,78 @@ public AzureCommunicationRoomServiceImplBuilder httpClient(HttpClient httpClient * The configuration store that is used during construction of the service * client. */ - private Configuration configuration; + @Generated private Configuration configuration; - /** - * Sets The configuration store that is used during construction of the service client. - * - * @param configuration the configuration value. - * @return the AzureCommunicationRoomServiceImplBuilder. - */ + /** {@inheritDoc}. */ + @Generated + @Override public AzureCommunicationRoomServiceImplBuilder configuration(Configuration configuration) { this.configuration = configuration; return this; } /* - * The logging configuration for HTTP requests and responses. + * The service endpoint */ - private HttpLogOptions httpLogOptions; + @Generated private String endpoint; + + /** {@inheritDoc}. */ + @Generated + @Override + public AzureCommunicationRoomServiceImplBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Api Version + */ + @Generated private String apiVersion; /** - * Sets The logging configuration for HTTP requests and responses. + * Sets Api Version. * - * @param httpLogOptions the httpLogOptions value. + * @param apiVersion the apiVersion value. * @return the AzureCommunicationRoomServiceImplBuilder. */ - public AzureCommunicationRoomServiceImplBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; + @Generated + public AzureCommunicationRoomServiceImplBuilder apiVersion(String apiVersion) { + this.apiVersion = apiVersion; return this; } /* - * The retry policy that will attempt to retry failed requests, if - * applicable. + * The serializer to serialize an object into a string */ - private RetryPolicy retryPolicy; + @Generated private SerializerAdapter serializerAdapter; /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. + * Sets The serializer to serialize an object into a string. * - * @param retryPolicy the retryPolicy value. + * @param serializerAdapter the serializerAdapter value. * @return the AzureCommunicationRoomServiceImplBuilder. */ - public AzureCommunicationRoomServiceImplBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; + @Generated + public AzureCommunicationRoomServiceImplBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; return this; } /* - * The list of Http pipeline policies to add. + * The retry policy that will attempt to retry failed requests, if + * applicable. */ - private final List pipelinePolicies; + @Generated private RetryPolicy retryPolicy; /** - * Adds a custom Http pipeline policy. + * Sets The retry policy that will attempt to retry failed requests, if applicable. * - * @param customPolicy The custom Http pipeline policy to add. + * @param retryPolicy the retryPolicy value. * @return the AzureCommunicationRoomServiceImplBuilder. */ - public AzureCommunicationRoomServiceImplBuilder addPolicy(HttpPipelinePolicy customPolicy) { - pipelinePolicies.add(customPolicy); + @Generated + public AzureCommunicationRoomServiceImplBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; return this; } @@ -188,13 +216,14 @@ public AzureCommunicationRoomServiceImplBuilder addPolicy(HttpPipelinePolicy cus * * @return an instance of AzureCommunicationRoomServiceImpl. */ + @Generated public AzureCommunicationRoomServiceImpl buildClient() { - if (apiVersion == null) { - this.apiVersion = "2022-02-01"; - } if (pipeline == null) { this.pipeline = createHttpPipeline(); } + if (apiVersion == null) { + this.apiVersion = "2022-02-01"; + } if (serializerAdapter == null) { this.serializerAdapter = JacksonAdapter.createDefaultSerializerAdapter(); } @@ -203,27 +232,47 @@ public AzureCommunicationRoomServiceImpl buildClient() { return client; } + @Generated private HttpPipeline createHttpPipeline() { Configuration buildConfiguration = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; if (httpLogOptions == null) { httpLogOptions = new HttpLogOptions(); } + if (clientOptions == null) { + clientOptions = new ClientOptions(); + } List policies = new ArrayList<>(); String clientName = properties.getOrDefault(SDK_NAME, "UnknownName"); String clientVersion = properties.getOrDefault(SDK_VERSION, "UnknownVersion"); - policies.add( - new UserAgentPolicy(httpLogOptions.getApplicationId(), clientName, clientVersion, buildConfiguration)); + String applicationId = CoreUtils.getApplicationId(clientOptions, httpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = new HttpHeaders(); + clientOptions.getHeaders().forEach(header -> headers.set(header.getName(), header.getValue())); + if (headers.getSize() > 0) { + policies.add(new AddHeadersPolicy(headers)); + } + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(retryPolicy == null ? new RetryPolicy() : retryPolicy); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); policies.add(new CookiePolicy()); - policies.addAll(this.pipelinePolicies); + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); HttpPipeline httpPipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) + .clientOptions(clientOptions) .build(); return httpPipeline; } diff --git a/sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/implementation/RoomsImpl.java b/sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/implementation/RoomsImpl.java index efd3a750d3b72..2fbeb15403f8d 100644 --- a/sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/implementation/RoomsImpl.java +++ b/sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/implementation/RoomsImpl.java @@ -6,10 +6,8 @@ import com.azure.communication.rooms.implementation.models.CommunicationErrorResponseException; import com.azure.communication.rooms.implementation.models.CreateRoomRequest; -import com.azure.communication.rooms.implementation.models.CreateRoomResponse; import com.azure.communication.rooms.implementation.models.RoomModel; import com.azure.communication.rooms.implementation.models.UpdateRoomRequest; -import com.azure.communication.rooms.implementation.models.UpdateRoomResponse; import com.azure.core.annotation.BodyParam; import com.azure.core.annotation.Delete; import com.azure.core.annotation.ExpectedResponses; @@ -29,6 +27,11 @@ import com.azure.core.http.rest.RestProxy; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import java.time.OffsetDateTime; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; +import java.util.Locale; +import java.util.UUID; import reactor.core.publisher.Mono; /** An instance of this class provides access to all the operations defined in Rooms. */ @@ -58,16 +61,24 @@ public final class RoomsImpl { private interface RoomsService { @Post("/rooms") @ExpectedResponses({201}) + @UnexpectedResponseExceptionType( + value = CommunicationErrorResponseException.class, + code = {400, 401, 403, 500, 501, 412}) @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class) - Mono> createRoom( + 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( + value = CommunicationErrorResponseException.class, + code = {400, 401, 403, 500}) @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class) Mono> getRoom( @HostParam("endpoint") String endpoint, @@ -78,8 +89,11 @@ Mono> getRoom( @Patch("/rooms/{roomId}") @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = CommunicationErrorResponseException.class, + code = {400, 401, 403, 500}) @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class) - Mono> updateRoom( + Mono> updateRoom( @HostParam("endpoint") String endpoint, @PathParam("roomId") String roomId, @QueryParam("api-version") String apiVersion, @@ -89,6 +103,9 @@ Mono> updateRoom( @Delete("/rooms/{roomId}") @ExpectedResponses({204}) + @UnexpectedResponseExceptionType( + value = CommunicationErrorResponseException.class, + code = {400, 401, 403, 500}) @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class) Mono> deleteRoom( @HostParam("endpoint") String endpoint, @@ -104,12 +121,19 @@ Mono> deleteRoom( * @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 CommunicationErrorResponseException thrown if the request is rejected by server on status code 400, 401, + * 403, 500, 501, 412. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response payload for create room operation. + * @return the meeting room along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createRoomWithResponseAsync(CreateRoomRequest createRoomRequest) { + public Mono> createRoomWithResponseAsync(CreateRoomRequest createRoomRequest) { final String accept = "application/json, text/json"; + String repeatabilityRequestId = UUID.randomUUID().toString(); + String repeatabilityFirstSent = + DateTimeFormatter.ofPattern("EEE, dd MMM yyyy HH:mm:ss z", Locale.ENGLISH) + .withZone(ZoneId.of("GMT")) + .format(OffsetDateTime.now()); return FluxUtil.withContext( context -> service.createRoom( @@ -117,6 +141,8 @@ public Mono> createRoomWithResponseAsync(CreateRoom this.client.getApiVersion(), createRoomRequest, accept, + repeatabilityRequestId, + repeatabilityFirstSent, context)); } @@ -127,15 +153,27 @@ public Mono> createRoomWithResponseAsync(CreateRoom * @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 CommunicationErrorResponseException thrown if the request is rejected by server on status code 400, 401, + * 403, 500, 501, 412. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response payload for create room operation. + * @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) { + public Mono> createRoomWithResponseAsync(CreateRoomRequest createRoomRequest, Context context) { final String accept = "application/json, text/json"; + String repeatabilityRequestId = UUID.randomUUID().toString(); + String repeatabilityFirstSent = + DateTimeFormatter.ofPattern("EEE, dd MMM yyyy HH:mm:ss z", Locale.ENGLISH) + .withZone(ZoneId.of("GMT")) + .format(OffsetDateTime.now()); return service.createRoom( - this.client.getEndpoint(), this.client.getApiVersion(), createRoomRequest, accept, context); + this.client.getEndpoint(), + this.client.getApiVersion(), + createRoomRequest, + accept, + repeatabilityRequestId, + repeatabilityFirstSent, + context); } /** @@ -144,14 +182,16 @@ public Mono> createRoomWithResponseAsync( * @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 CommunicationErrorResponseException thrown if the request is rejected by server on status code 400, 401, + * 403, 500, 501, 412. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response payload for create room operation. + * @return the meeting room on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createRoomAsync(CreateRoomRequest createRoomRequest) { + public Mono createRoomAsync(CreateRoomRequest createRoomRequest) { return createRoomWithResponseAsync(createRoomRequest) .flatMap( - (Response res) -> { + (Response res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { @@ -167,14 +207,16 @@ public Mono createRoomAsync(CreateRoomRequest createRoomRequ * @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 CommunicationErrorResponseException thrown if the request is rejected by server on status code 400, 401, + * 403, 500, 501, 412. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response payload for create room operation. + * @return the meeting room on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createRoomAsync(CreateRoomRequest createRoomRequest, Context context) { + public Mono createRoomAsync(CreateRoomRequest createRoomRequest, Context context) { return createRoomWithResponseAsync(createRoomRequest, context) .flatMap( - (Response res) -> { + (Response res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { @@ -189,11 +231,13 @@ public Mono createRoomAsync(CreateRoomRequest createRoomRequ * @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 CommunicationErrorResponseException thrown if the request is rejected by server on status code 400, 401, + * 403, 500, 501, 412. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response payload for create room operation. + * @return the meeting room. */ @ServiceMethod(returns = ReturnType.SINGLE) - public CreateRoomResponse createRoom(CreateRoomRequest createRoomRequest) { + public RoomModel createRoom(CreateRoomRequest createRoomRequest) { return createRoomAsync(createRoomRequest).block(); } @@ -204,11 +248,13 @@ public CreateRoomResponse createRoom(CreateRoomRequest createRoomRequest) { * @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 CommunicationErrorResponseException thrown if the request is rejected by server on status code 400, 401, + * 403, 500, 501, 412. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response payload for create room operation. + * @return the meeting room along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response createRoomWithResponse(CreateRoomRequest createRoomRequest, Context context) { + public Response createRoomWithResponse(CreateRoomRequest createRoomRequest, Context context) { return createRoomWithResponseAsync(createRoomRequest, context).block(); } @@ -218,8 +264,10 @@ public Response createRoomWithResponse(CreateRoomRequest cre * @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 CommunicationErrorResponseException thrown if the request is rejected by server on status code 400, 401, + * 403, 500. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the meeting room. + * @return the meeting room along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getRoomWithResponseAsync(String roomId) { @@ -237,8 +285,10 @@ public Mono> getRoomWithResponseAsync(String roomId) { * @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 CommunicationErrorResponseException thrown if the request is rejected by server on status code 400, 401, + * 403, 500. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the meeting room. + * @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) { @@ -252,8 +302,10 @@ public Mono> getRoomWithResponseAsync(String roomId, Context * @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 CommunicationErrorResponseException thrown if the request is rejected by server on status code 400, 401, + * 403, 500. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the meeting room. + * @return the meeting room on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getRoomAsync(String roomId) { @@ -275,8 +327,10 @@ public Mono getRoomAsync(String roomId) { * @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 CommunicationErrorResponseException thrown if the request is rejected by server on status code 400, 401, + * 403, 500. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the meeting room. + * @return the meeting room on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getRoomAsync(String roomId, Context context) { @@ -297,6 +351,8 @@ public Mono getRoomAsync(String roomId, Context context) { * @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 CommunicationErrorResponseException thrown if the request is rejected by server on status code 400, 401, + * 403, 500. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the meeting room. */ @@ -312,8 +368,10 @@ public RoomModel getRoom(String roomId) { * @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 CommunicationErrorResponseException thrown if the request is rejected by server on status code 400, 401, + * 403, 500. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the meeting room. + * @return the meeting room along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getRoomWithResponse(String roomId, Context context) { @@ -327,12 +385,13 @@ public Response getRoomWithResponse(String roomId, Context context) { * @param patchRoomRequest Request payload for updating a room. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server on status code 400, 401, + * 403, 500. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response payload for update room operation. + * @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) { + public Mono> updateRoomWithResponseAsync(String roomId, UpdateRoomRequest patchRoomRequest) { final String accept = "application/json, text/json"; return FluxUtil.withContext( context -> @@ -353,11 +412,13 @@ public Mono> updateRoomWithResponseAsync( * @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 CommunicationErrorResponseException thrown if the request is rejected by server on status code 400, 401, + * 403, 500. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response payload for update room operation. + * @return the meeting room along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateRoomWithResponseAsync( + public Mono> updateRoomWithResponseAsync( String roomId, UpdateRoomRequest patchRoomRequest, Context context) { final String accept = "application/json, text/json"; return service.updateRoom( @@ -371,14 +432,16 @@ public Mono> updateRoomWithResponseAsync( * @param patchRoomRequest Request payload for updating a room. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server on status code 400, 401, + * 403, 500. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response payload for update room operation. + * @return the meeting room on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono updateRoomAsync(String roomId, UpdateRoomRequest patchRoomRequest) { + public Mono updateRoomAsync(String roomId, UpdateRoomRequest patchRoomRequest) { return updateRoomWithResponseAsync(roomId, patchRoomRequest) .flatMap( - (Response res) -> { + (Response res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { @@ -395,15 +458,16 @@ public Mono updateRoomAsync(String roomId, UpdateRoomRequest * @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 CommunicationErrorResponseException thrown if the request is rejected by server on status code 400, 401, + * 403, 500. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response payload for update room operation. + * @return the meeting room on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono updateRoomAsync( - String roomId, UpdateRoomRequest patchRoomRequest, Context context) { + public Mono updateRoomAsync(String roomId, UpdateRoomRequest patchRoomRequest, Context context) { return updateRoomWithResponseAsync(roomId, patchRoomRequest, context) .flatMap( - (Response res) -> { + (Response res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { @@ -419,11 +483,13 @@ public Mono updateRoomAsync( * @param patchRoomRequest Request payload for updating a room. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server on status code 400, 401, + * 403, 500. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response payload for update room operation. + * @return the meeting room. */ @ServiceMethod(returns = ReturnType.SINGLE) - public UpdateRoomResponse updateRoom(String roomId, UpdateRoomRequest patchRoomRequest) { + public RoomModel updateRoom(String roomId, UpdateRoomRequest patchRoomRequest) { return updateRoomAsync(roomId, patchRoomRequest).block(); } @@ -435,11 +501,13 @@ public UpdateRoomResponse updateRoom(String roomId, UpdateRoomRequest patchRoomR * @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 CommunicationErrorResponseException thrown if the request is rejected by server on status code 400, 401, + * 403, 500. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response payload for update room operation. + * @return the meeting room along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateRoomWithResponse( + public Response updateRoomWithResponse( String roomId, UpdateRoomRequest patchRoomRequest, Context context) { return updateRoomWithResponseAsync(roomId, patchRoomRequest, context).block(); } @@ -450,8 +518,10 @@ public Response updateRoomWithResponse( * @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 CommunicationErrorResponseException thrown if the request is rejected by server on status code 400, 401, + * 403, 500. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> deleteRoomWithResponseAsync(String roomId) { @@ -469,8 +539,10 @@ public Mono> deleteRoomWithResponseAsync(String roomId) { * @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 CommunicationErrorResponseException thrown if the request is rejected by server on status code 400, 401, + * 403, 500. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> deleteRoomWithResponseAsync(String roomId, Context context) { @@ -484,8 +556,10 @@ public Mono> deleteRoomWithResponseAsync(String roomId, Context c * @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 CommunicationErrorResponseException thrown if the request is rejected by server on status code 400, 401, + * 403, 500. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono deleteRoomAsync(String roomId) { @@ -499,8 +573,10 @@ public Mono deleteRoomAsync(String roomId) { * @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 CommunicationErrorResponseException thrown if the request is rejected by server on status code 400, 401, + * 403, 500. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono deleteRoomAsync(String roomId, Context context) { @@ -513,6 +589,8 @@ public Mono deleteRoomAsync(String roomId, Context context) { * @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 CommunicationErrorResponseException thrown if the request is rejected by server on status code 400, 401, + * 403, 500. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -527,8 +605,10 @@ public void deleteRoom(String roomId) { * @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 CommunicationErrorResponseException thrown if the request is rejected by server on status code 400, 401, + * 403, 500. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteRoomWithResponse(String roomId, Context context) { diff --git a/sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/implementation/models/CreateRoomRequest.java b/sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/implementation/models/CreateRoomRequest.java index a1f0ad76c8a08..689c49ee4824c 100644 --- a/sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/implementation/models/CreateRoomRequest.java +++ b/sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/implementation/models/CreateRoomRequest.java @@ -9,7 +9,7 @@ import java.time.OffsetDateTime; import java.util.Map; -/** Request payload for creating new room. */ +/** The create room request body. */ @Fluent public final class CreateRoomRequest { /* diff --git a/sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/implementation/models/CreateRoomResponse.java b/sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/implementation/models/CreateRoomResponse.java deleted file mode 100644 index dbad8f81725d5..0000000000000 --- a/sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/implementation/models/CreateRoomResponse.java +++ /dev/null @@ -1,65 +0,0 @@ -// 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.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.Map; - -/** Response payload for create room operation. */ -@Fluent -public final class CreateRoomResponse { - /* - * The meeting room. - */ - @JsonProperty(value = "room", required = true) - private RoomModel room; - - /* - * Collection of participants failed to be added to the room - */ - @JsonProperty(value = "invalidParticipants") - private Map invalidParticipants; - - /** - * Get the room property: The meeting room. - * - * @return the room value. - */ - public RoomModel getRoom() { - return this.room; - } - - /** - * Set the room property: The meeting room. - * - * @param room the room value to set. - * @return the CreateRoomResponse object itself. - */ - public CreateRoomResponse setRoom(RoomModel room) { - this.room = room; - return this; - } - - /** - * Get the invalidParticipants property: Collection of participants failed to be added to the room. - * - * @return the invalidParticipants value. - */ - public Map getInvalidParticipants() { - return this.invalidParticipants; - } - - /** - * Set the invalidParticipants property: Collection of participants failed to be added to the room. - * - * @param invalidParticipants the invalidParticipants value to set. - * @return the CreateRoomResponse object itself. - */ - public CreateRoomResponse setInvalidParticipants(Map invalidParticipants) { - this.invalidParticipants = invalidParticipants; - return this; - } -} diff --git a/sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/implementation/models/UpdateRoomResponse.java b/sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/implementation/models/UpdateRoomResponse.java deleted file mode 100644 index d5d1e5c727ab4..0000000000000 --- a/sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/implementation/models/UpdateRoomResponse.java +++ /dev/null @@ -1,65 +0,0 @@ -// 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.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.Map; - -/** Response payload for update room operation. */ -@Fluent -public final class UpdateRoomResponse { - /* - * The meeting room. - */ - @JsonProperty(value = "room", required = true) - private RoomModel room; - - /* - * Collection of participants failed to be added to the room - */ - @JsonProperty(value = "invalidParticipants") - private Map invalidParticipants; - - /** - * Get the room property: The meeting room. - * - * @return the room value. - */ - public RoomModel getRoom() { - return this.room; - } - - /** - * Set the room property: The meeting room. - * - * @param room the room value to set. - * @return the UpdateRoomResponse object itself. - */ - public UpdateRoomResponse setRoom(RoomModel room) { - this.room = room; - return this; - } - - /** - * Get the invalidParticipants property: Collection of participants failed to be added to the room. - * - * @return the invalidParticipants value. - */ - public Map getInvalidParticipants() { - return this.invalidParticipants; - } - - /** - * Set the invalidParticipants property: Collection of participants failed to be added to the room. - * - * @param invalidParticipants the invalidParticipants value to set. - * @return the UpdateRoomResponse object itself. - */ - public UpdateRoomResponse setInvalidParticipants(Map invalidParticipants) { - this.invalidParticipants = invalidParticipants; - return this; - } -} diff --git a/sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/models/CommunicationRoom.java b/sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/models/CommunicationRoom.java index fe1eb01553d27..5033f42156843 100644 --- a/sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/models/CommunicationRoom.java +++ b/sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/models/CommunicationRoom.java @@ -18,7 +18,6 @@ public final class CommunicationRoom { private final OffsetDateTime validUntil; private final OffsetDateTime createdTime; private final List participants; - private final Map invalidParticipants; /** * The default constructor of CommunicationRoom. @@ -28,16 +27,14 @@ public final class CommunicationRoom { * @param validUntil The ending time point of the room. * @param createdTime The created time point of the room. * @param participants The participants of the room. - * @param invalidParticipants The invalid participants as a returned map from request. */ public CommunicationRoom(String roomId, OffsetDateTime validFrom, OffsetDateTime validUntil, OffsetDateTime createdTime, - List participants, Map invalidParticipants) { + List participants) { this.roomId = roomId; this.validFrom = validFrom; this.validUntil = validUntil; this.createdTime = createdTime; this.participants = participants; - this.invalidParticipants = invalidParticipants; } /** @@ -84,14 +81,5 @@ public OffsetDateTime getValidUntil() { public OffsetDateTime getCreatedTime() { return this.createdTime; } - - /** - * The invalid participants for create and update operation. - * - * @return the invalid participants. - */ - public Map getInvalidParticipants() { - return this.invalidParticipants; - } } diff --git a/sdk/communication/azure-communication-rooms/src/test/java/com/azure/communication/rooms/RoomsTestBase.java b/sdk/communication/azure-communication-rooms/src/test/java/com/azure/communication/rooms/RoomsTestBase.java index 03537939b62f5..f1520c36115b7 100644 --- a/sdk/communication/azure-communication-rooms/src/test/java/com/azure/communication/rooms/RoomsTestBase.java +++ b/sdk/communication/azure-communication-rooms/src/test/java/com/azure/communication/rooms/RoomsTestBase.java @@ -39,7 +39,6 @@ public class RoomsTestBase extends TestBase { protected static final TestMode TEST_MODE = initializeTestMode(); - protected static final String LOCAL_STRING = "endpoint=https://rooms-ppe-us.ppe.communication.azure.net/;accesskey=J9gcDYLfopqKzHIKg7BI7+Qt/ZKTg0jeO/xvUF1JWxr8sHeA9Wq3DT+bjEIo3kRfjuj84CNm3s7B/zDrqkeLnA=="; protected static final String CONNECTION_STRING = Configuration.getGlobalConfiguration().get( "COMMUNICATION_LIVETEST_STATIC_CONNECTION_STRING", "endpoint=https://REDACTED.communication.azure.com/;accesskey=P2tP5RwZVFcJa3sfJvHEmGaKbemSAw2e"); diff --git a/sdk/communication/azure-communication-rooms/swagger/rooms.json b/sdk/communication/azure-communication-rooms/swagger/rooms.json index a9add9dc36770..f16a5104e1869 100644 --- a/sdk/communication/azure-communication-rooms/swagger/rooms.json +++ b/sdk/communication/azure-communication-rooms/swagger/rooms.json @@ -25,22 +25,44 @@ { "$ref": "#/parameters/ApiVersionParameter" }, + { + "in": "header", + "name": "Repeatability-Request-ID", + "description": "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, globally unique for all time, identifier for the request. It is recommended to use version 4 (random) UUIDs.", + "type": "string", + "format": "uuid" + }, + { + "in": "header", + "name": "Repeatability-First-Sent", + "description": "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", + "type": "string", + "format": "date-time" + }, { "in": "body", "name": "createRoomRequest", "description": "The create room request body.", "schema": { "$ref": "#/definitions/CreateRoomRequest" - } + }, + "required": true } ], "responses": { "201": { "description": "Request successful. The action returns a new `Room`.", "schema": { - "$ref": "#/definitions/CreateRoomResponse" + "$ref": "#/definitions/RoomModel" } }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/CommunicationErrorResponse" + }, + "x-ms-error-response": true + }, "401": { "description": "Unauthorized", "schema": { @@ -55,12 +77,26 @@ }, "x-ms-error-response": true }, + "412": { + "description": "Precondition Failed", + "schema": { + "$ref": "#/definitions/CommunicationErrorResponse" + }, + "x-ms-error-response": true + }, "500": { "description": "InternalServerError", "schema": { "$ref": "#/definitions/CommunicationErrorResponse" }, "x-ms-error-response": true + }, + "501": { + "description": "Not Implemented", + "schema": { + "$ref": "#/definitions/CommunicationErrorResponse" + }, + "x-ms-error-response": true } }, "x-ms-examples": { @@ -101,6 +137,13 @@ "$ref": "#/definitions/RoomModel" } }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/CommunicationErrorResponse" + }, + "x-ms-error-response": true + }, "401": { "description": "Unauthorized", "schema": { @@ -166,9 +209,16 @@ "200": { "description": "Request successful. The action returns a updated `Room`.", "schema": { - "$ref": "#/definitions/UpdateRoomResponse" + "$ref": "#/definitions/RoomModel" } }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/CommunicationErrorResponse" + }, + "x-ms-error-response": true + }, "401": { "description": "Unauthorized", "schema": { @@ -222,6 +272,13 @@ "204": { "description": "Request successful." }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/CommunicationErrorResponse" + }, + "x-ms-error-response": true + }, "401": { "description": "Unauthorized", "schema": { @@ -298,7 +355,7 @@ } }, "CreateRoomRequest": { - "description": "Request payload for creating new room.", + "description": "The create room request body.", "type": "object", "properties": { "validFrom": { @@ -322,25 +379,6 @@ } } }, - "CreateRoomResponse": { - "description": "Response payload for create room operation.", - "required": [ - "room" - ], - "type": "object", - "properties": { - "room": { - "$ref": "#/definitions/RoomModel" - }, - "invalidParticipants": { - "description": "Collection of participants failed to be added to the room", - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/RoomParticipantInternal" - } - } - } - }, "RoomParticipantInternal": { "description": "A participant of the room.", "type": "object", @@ -411,25 +449,6 @@ } } } - }, - "UpdateRoomResponse": { - "description": "Response payload for update room operation.", - "required": [ - "room" - ], - "type": "object", - "properties": { - "room": { - "$ref": "#/definitions/RoomModel" - }, - "invalidParticipants": { - "description": "Collection of participants failed to be added to the room", - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/RoomParticipantInternal" - } - } - } } }, "parameters": {