Response Body Schema
"; + int responseStart = corrected.indexOf(responseHeading); + if (responseStart >= 0) { + // Topic state is required on read even though it isn't accepted on create. + corrected = corrected.substring(0, responseStart) + + corrected.substring(responseStart) + .replace("(Optional, Required on create)", "(Required)") + .replace("state: String(Normal/Archived/SoftDeleted) (Optional)", + "state: String(Normal/Archived/SoftDeleted) (Required)"); + } + int requestStart = corrected.indexOf("Request Body Schema
"); + if (requestStart >= 0) { + if (responseStart < requestStart) { + throw new IllegalStateException("Missing response schema for " + method.getNameAsString()); + } + String request = corrected.substring(requestStart, responseStart); + String readOnlyFields; + String name = method.getNameAsString(); + if (name.startsWith("updateMessage")) { + readOnlyFields = "id|createdAt|etag"; + } else if (name.startsWith("createOrReplaceRole")) { + readOnlyFields = "name|etag"; + } else if (name.startsWith("createOrReplaceRoomMember")) { + readOnlyFields = "userId|etag"; + } else if (name.startsWith("createOrReplaceRoom")) { + readOnlyFields = "id|defaultConversation|etag"; + } else if (name.startsWith("createOrReplaceUser")) { + readOnlyFields = "id|etag"; + } else if (name.startsWith("createOrReplaceTopic") || name.startsWith("updateTopic")) { + readOnlyFields = "id|createdAt|createdBy|conversationId|etag"; + } else { + throw new IllegalStateException("Unrecognized request schema for " + name); + } + request = request.replaceAll("(?m)^\\h*\\*\\h+(?:" + readOnlyFields + "):[^\\r\\n]*\\R", ""); + request = request.replace("(Optional, Required on create)", + name.startsWith("update") ? "(Optional)" : "(Required)"); + if (name.startsWith("createOrReplaceTopic")) { + request = request.replaceAll("(state: [^\\r\\n]+)\\(Required\\)", "$1(Optional)"); + } + corrected = corrected.substring(0, requestStart) + request + corrected.substring(responseStart); + } + if (method.getNameAsString().startsWith("createOrReplaceTopic") + && !corrected.contains("When creating a topic, omit state")) { + corrected = corrected.replace("Create or replace a topic.", + "Create or replace a topic.\n *\n" + + " *When creating a topic, omit state. " + + "Other states are only valid when replacing an existing topic.
"); + } + if (!original.equals(corrected)) { + source = source.replace(original, corrected); + } + } + return source; + } + + static void customizeMessageContent(CompilationUnit ast) { + // Partial update preserves handwritten members without @Generated, but regenerates removed setters. + ClassOrInterfaceDeclaration model = ast.getClassByName("MessageContent") + .orElseThrow(() -> new IllegalStateException("MessageContent model not found.")); + ast.getImports() + .removeIf( + importDeclaration -> importDeclaration.getNameAsString().equals("com.azure.core.annotation.Fluent") + || importDeclaration.getNameAsString().equals("java.util.HashSet") + || importDeclaration.getNameAsString().equals("java.util.Set")); + ast.addImport("com.azure.core.annotation.Immutable"); + model.getAnnotations().removeIf(annotation -> annotation.getNameAsString().equals("Fluent")); + if (!model.getAnnotationByName("Immutable").isPresent()) { + model.addMarkerAnnotation("Immutable"); + } + model.setJavadocComment("Message content containing exactly one of text or binary data.\n" + + "Use {@link #fromText(String)} or {@link #fromBinary(byte[])} to create content.\n" + + "The getter for the unselected representation returns {@code null}."); + model.getFieldByName("updatedProperties").ifPresent(field -> field.remove()); + model.getMethodsByName("setText").forEach(method -> method.remove()); + model.getMethodsByName("setBinary").forEach(method -> method.remove()); + model.getMethodsByName("toJsonMergePatch").forEach(method -> method.remove()); + } + private static void customizeTokenClient(PackageCustomization chatPackage, String className) { chatPackage.getClass(className).customizeAst(ast -> { ast.getImports() diff --git a/sdk/webpubsub/azure-messaging-webpubsub-chat/src/main/java/com/azure/messaging/webpubsub/chat/WebPubSubChatServiceAsyncClient.java b/sdk/webpubsub/azure-messaging-webpubsub-chat/src/main/java/com/azure/messaging/webpubsub/chat/WebPubSubChatServiceAsyncClient.java index acd46bde95c3d..2a8619d3ff320 100644 --- a/sdk/webpubsub/azure-messaging-webpubsub-chat/src/main/java/com/azure/messaging/webpubsub/chat/WebPubSubChatServiceAsyncClient.java +++ b/sdk/webpubsub/azure-messaging-webpubsub-chat/src/main/java/com/azure/messaging/webpubsub/chat/WebPubSubChatServiceAsyncClient.java @@ -28,8 +28,10 @@ import com.azure.messaging.webpubsub.chat.models.ChatRole; import com.azure.messaging.webpubsub.chat.models.ChatRoom; import com.azure.messaging.webpubsub.chat.models.ChatRoomMember; +import com.azure.messaging.webpubsub.chat.models.ChatTopic; import com.azure.messaging.webpubsub.chat.models.ChatUser; -import com.azure.messaging.webpubsub.chat.models.GetClientAccessTokenOptions; +import com.azure.messaging.webpubsub.chat.models.ChatUserRoom; +import com.azure.messaging.webpubsub.chat.models.ClientAccessTokenOptions; import com.azure.messaging.webpubsub.chat.models.WebPubSubClientAccessToken; import java.util.stream.Collectors; import reactor.core.publisher.Flux; @@ -85,6 +87,9 @@ public MonoQuery Parameters
*
* {@code
* {
- * id: String (Required)
* title: String (Required)
- * defaultConversation: String (Required)
- * etag: String (Required)
* }
* }
*
@@ -433,7 +430,7 @@ public Mono
* {@code
* {
- * userId: String (Required)
* roleName: String (Required)
- * etag: String (Required)
* }
* }
*
@@ -585,7 +580,7 @@ public PagedFluxQuery Parameters
+ *| Name | Type | Required | Description |
|---|---|---|---|
| maxpagesize | Integer | No | The maximum number of result items per page. |
| continuationToken | String | No | Continuation token for pagination. |
Response Body Schema
+ * + *
+ * {@code
+ * {
+ * id: String (Required)
+ * title: String (Required)
+ * defaultConversation: String (Required)
+ * etag: String (Required)
+ * }
+ * }
+ *
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ChatRoom items as paginated response with {@link PagedFlux}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFluxQuery Parameters
+ *| Name | Type | Required | Description |
|---|---|---|---|
| maxpagesize | Integer | No | The maximum number of result items per page. |
| continuationToken | String | No | Continuation token for pagination. |
Response Body Schema
+ * + *
+ * {@code
+ * {
+ * id: String (Required)
+ * title: String (Required)
+ * createdAt: OffsetDateTime (Required)
+ * createdBy: String (Required)
+ * state: String(Normal/Archived/SoftDeleted) (Required)
+ * conversationId: String (Required)
+ * etag: String (Required)
+ * }
+ * }
+ *
+ *
+ * @param roomId Room identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ChatTopic items as paginated response with {@link PagedFlux}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFluxWhen creating a topic, omit state. Other states are only valid when replacing an existing topic.
+ * + * Create or replace a topic with a client-specified ID. + *Header Parameters
+ *| Name | Type | Required | Description |
|---|---|---|---|
| If-Match | String | No | The request should only proceed if an entity matches this + * string. |
| If-None-Match | String | No | The request should only proceed if no entity matches this + * string. |
Request Body Schema
+ * + *
+ * {@code
+ * {
+ * title: String (Required)
+ * state: String(Normal/Archived/SoftDeleted) (Optional)
+ * }
+ * }
+ *
+ *
+ * Response Body Schema
+ * + *
+ * {@code
+ * {
+ * id: String (Required)
+ * title: String (Required)
+ * createdAt: OffsetDateTime (Required)
+ * createdBy: String (Required)
+ * state: String(Normal/Archived/SoftDeleted) (Required)
+ * conversationId: String (Required)
+ * etag: String (Required)
+ * }
+ * }
+ *
+ *
+ * Response Headers
+ *| Name | Type | Description |
|---|---|---|
| ETag | String | The entity tag for the response. |
Response Body Schema
+ * + *
+ * {@code
+ * {
+ * id: String (Required)
+ * title: String (Required)
+ * createdAt: OffsetDateTime (Required)
+ * createdBy: String (Required)
+ * state: String(Normal/Archived/SoftDeleted) (Required)
+ * conversationId: String (Required)
+ * etag: String (Required)
+ * }
+ * }
+ *
+ *
+ * @param roomId Room identifier.
+ * @param topicId Topic identifier unique within the room.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return topic information along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public MonoHeader Parameters
+ *| Name | Type | Required | Description |
|---|---|---|---|
| If-Match | String | No | The request should only proceed if an entity matches this + * string. |
| If-None-Match | String | No | The request should only proceed if no entity matches this + * string. |
Request Body Schema
+ * + *
+ * {@code
+ * {
+ * title: String (Optional)
+ * state: String(Normal/Archived/SoftDeleted) (Optional)
+ * }
+ * }
+ *
+ *
+ * Response Body Schema
+ * + *
+ * {@code
+ * {
+ * id: String (Required)
+ * title: String (Required)
+ * createdAt: OffsetDateTime (Required)
+ * createdBy: String (Required)
+ * state: String(Normal/Archived/SoftDeleted) (Required)
+ * conversationId: String (Required)
+ * etag: String (Required)
+ * }
+ * }
+ *
+ *
+ * Response Headers
+ *| Name | Type | Description |
|---|---|---|
| ETag | String | The entity tag for the response. |
Header Parameters
+ *| Name | Type | Required | Description |
|---|---|---|---|
| If-Match | String | No | The request should only proceed if an entity matches this + * string. |
| If-None-Match | String | No | The request should only proceed if no entity matches this + * string. |
Query Parameters
+ *| Name | Type | Required | Description |
|---|---|---|---|
| maxpagesize | Integer | No | The maximum number of result items per page. |
| continuationToken | String | No | Continuation token for pagination. |
Response Body Schema
+ * + *
+ * {@code
+ * {
+ * kind: String(Human) (Required)
+ * id: String (Required)
+ * nickname: String (Required)
+ * etag: String (Required)
+ * }
+ * }
+ *
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ChatUser items as paginated response with {@link PagedFlux}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFluxQuery Parameters
+ *| Name | Type | Required | Description |
|---|---|---|---|
| maxpagesize | Integer | No | The maximum number of result items per page. |
| continuationToken | String | No | Continuation token for pagination. |
Response Body Schema
+ * + *
+ * {@code
+ * {
+ * id: String (Required)
+ * title: String (Required)
+ * defaultConversation: String (Required)
+ * etag: String (Required)
+ * }
+ * }
+ *
+ *
+ * @param userId User identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ChatUserRoom items as paginated response with {@link PagedFlux}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFluxWhen creating a topic, omit state. Other states are only valid when replacing an existing topic.
+ * + * Create or replace a topic with a client-specified ID. + * + * @param roomId Room identifier. + * @param topicId Topic identifier unique within the room. + * @param topic The resource instance. + * @param matchConditions Specifies HTTP options for conditional requests. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a chat topic in a room on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public MonoWhen creating a topic, omit state. Other states are only valid when replacing an existing topic.
+ * + * Create or replace a topic with a client-specified ID. + * + * @param roomId Room identifier. + * @param topicId Topic identifier unique within the room. + * @param topic The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a chat topic in a room on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public MonoQuery Parameters
*
* {@code
* {
- * id: String (Required)
* title: String (Required)
- * defaultConversation: String (Required)
- * etag: String (Required)
* }
* }
*
@@ -425,7 +422,7 @@ public Response
* {@code
* {
- * userId: String (Required)
* roleName: String (Required)
- * etag: String (Required)
* }
* }
*
@@ -577,7 +572,7 @@ public PagedIterableQuery Parameters
+ *| Name | Type | Required | Description |
|---|---|---|---|
| maxpagesize | Integer | No | The maximum number of result items per page. |
| continuationToken | String | No | Continuation token for pagination. |
Response Body Schema
+ * + *
+ * {@code
+ * {
+ * id: String (Required)
+ * title: String (Required)
+ * defaultConversation: String (Required)
+ * etag: String (Required)
+ * }
+ * }
+ *
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ChatRoom items as paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterableQuery Parameters
+ *| Name | Type | Required | Description |
|---|---|---|---|
| maxpagesize | Integer | No | The maximum number of result items per page. |
| continuationToken | String | No | Continuation token for pagination. |
Response Body Schema
+ * + *
+ * {@code
+ * {
+ * id: String (Required)
+ * title: String (Required)
+ * createdAt: OffsetDateTime (Required)
+ * createdBy: String (Required)
+ * state: String(Normal/Archived/SoftDeleted) (Required)
+ * conversationId: String (Required)
+ * etag: String (Required)
+ * }
+ * }
+ *
+ *
+ * @param roomId Room identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ChatTopic items as paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterableWhen creating a topic, omit state. Other states are only valid when replacing an existing topic.
+ * + * Create or replace a topic with a client-specified ID. + *Header Parameters
+ *| Name | Type | Required | Description |
|---|---|---|---|
| If-Match | String | No | The request should only proceed if an entity matches this + * string. |
| If-None-Match | String | No | The request should only proceed if no entity matches this + * string. |
Request Body Schema
+ * + *
+ * {@code
+ * {
+ * title: String (Required)
+ * state: String(Normal/Archived/SoftDeleted) (Optional)
+ * }
+ * }
+ *
+ *
+ * Response Body Schema
+ * + *
+ * {@code
+ * {
+ * id: String (Required)
+ * title: String (Required)
+ * createdAt: OffsetDateTime (Required)
+ * createdBy: String (Required)
+ * state: String(Normal/Archived/SoftDeleted) (Required)
+ * conversationId: String (Required)
+ * etag: String (Required)
+ * }
+ * }
+ *
+ *
+ * Response Headers
+ *| Name | Type | Description |
|---|---|---|
| ETag | String | The entity tag for the response. |
Response Body Schema
+ * + *
+ * {@code
+ * {
+ * id: String (Required)
+ * title: String (Required)
+ * createdAt: OffsetDateTime (Required)
+ * createdBy: String (Required)
+ * state: String(Normal/Archived/SoftDeleted) (Required)
+ * conversationId: String (Required)
+ * etag: String (Required)
+ * }
+ * }
+ *
+ *
+ * @param roomId Room identifier.
+ * @param topicId Topic identifier unique within the room.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return topic information along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ResponseHeader Parameters
+ *| Name | Type | Required | Description |
|---|---|---|---|
| If-Match | String | No | The request should only proceed if an entity matches this + * string. |
| If-None-Match | String | No | The request should only proceed if no entity matches this + * string. |
Request Body Schema
+ * + *
+ * {@code
+ * {
+ * title: String (Optional)
+ * state: String(Normal/Archived/SoftDeleted) (Optional)
+ * }
+ * }
+ *
+ *
+ * Response Body Schema
+ * + *
+ * {@code
+ * {
+ * id: String (Required)
+ * title: String (Required)
+ * createdAt: OffsetDateTime (Required)
+ * createdBy: String (Required)
+ * state: String(Normal/Archived/SoftDeleted) (Required)
+ * conversationId: String (Required)
+ * etag: String (Required)
+ * }
+ * }
+ *
+ *
+ * Response Headers
+ *| Name | Type | Description |
|---|---|---|
| ETag | String | The entity tag for the response. |
Header Parameters
+ *| Name | Type | Required | Description |
|---|---|---|---|
| If-Match | String | No | The request should only proceed if an entity matches this + * string. |
| If-None-Match | String | No | The request should only proceed if no entity matches this + * string. |
Query Parameters
+ *| Name | Type | Required | Description |
|---|---|---|---|
| maxpagesize | Integer | No | The maximum number of result items per page. |
| continuationToken | String | No | Continuation token for pagination. |
Response Body Schema
+ * + *
+ * {@code
+ * {
+ * kind: String(Human) (Required)
+ * id: String (Required)
+ * nickname: String (Required)
+ * etag: String (Required)
+ * }
+ * }
+ *
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ChatUser items as paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterableQuery Parameters
+ *| Name | Type | Required | Description |
|---|---|---|---|
| maxpagesize | Integer | No | The maximum number of result items per page. |
| continuationToken | String | No | Continuation token for pagination. |
Response Body Schema
+ * + *
+ * {@code
+ * {
+ * id: String (Required)
+ * title: String (Required)
+ * defaultConversation: String (Required)
+ * etag: String (Required)
+ * }
+ * }
+ *
+ *
+ * @param userId User identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ChatUserRoom items as paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterableWhen creating a topic, omit state. Other states are only valid when replacing an existing topic.
+ * + * Create or replace a topic with a client-specified ID. + * + * @param roomId Room identifier. + * @param topicId Topic identifier unique within the room. + * @param topic The resource instance. + * @param matchConditions Specifies HTTP options for conditional requests. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a chat topic in a room. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ChatTopic createOrReplaceTopic(String roomId, String topicId, ChatTopic topic, + MatchConditions matchConditions) { + // Generated convenience method for createOrReplaceTopicWithResponse + RequestOptions requestOptions = new RequestOptions(); + String ifMatch = matchConditions == null ? null : matchConditions.getIfMatch(); + String ifNoneMatch = matchConditions == null ? null : matchConditions.getIfNoneMatch(); + if (ifMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); + } + if (ifNoneMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } + return createOrReplaceTopicWithResponse(roomId, topicId, BinaryData.fromObject(topic), requestOptions) + .getValue() + .toObject(ChatTopic.class); + } + + /** + * Create or replace a topic. + * + *When creating a topic, omit state. Other states are only valid when replacing an existing topic.
+ * + * Create or replace a topic with a client-specified ID. + * + * @param roomId Room identifier. + * @param topicId Topic identifier unique within the room. + * @param topic The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a chat topic in a room. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ChatTopic createOrReplaceTopic(String roomId, String topicId, ChatTopic topic) { + // Generated convenience method for createOrReplaceTopicWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createOrReplaceTopicWithResponse(roomId, topicId, BinaryData.fromObject(topic), requestOptions) + .getValue() + .toObject(ChatTopic.class); + } + + /** + * Get topic information. + * + * @param roomId Room identifier. + * @param topicId Topic identifier unique within the room. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return topic information. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ChatTopic getTopic(String roomId, String topicId) { + // Generated convenience method for getTopicWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getTopicWithResponse(roomId, topicId, requestOptions).getValue().toObject(ChatTopic.class); + } + + /** + * Update a topic. + * + * @param roomId Room identifier. + * @param topicId Topic identifier unique within the room. + * @param topic The resource instance. + * @param matchConditions Specifies HTTP options for conditional requests. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a chat topic in a room. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ChatTopic updateTopic(String roomId, String topicId, ChatTopic topic, MatchConditions matchConditions) { + // Generated convenience method for updateTopicWithResponse + RequestOptions requestOptions = new RequestOptions(); + String ifMatch = matchConditions == null ? null : matchConditions.getIfMatch(); + String ifNoneMatch = matchConditions == null ? null : matchConditions.getIfNoneMatch(); + if (ifMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); + } + if (ifNoneMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } + JsonMergePatchHelper.getChatTopicAccessor().prepareModelForJsonMergePatch(topic, true); + BinaryData topicInBinaryData = BinaryData.fromObject(topic); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + topicInBinaryData.getLength(); + JsonMergePatchHelper.getChatTopicAccessor().prepareModelForJsonMergePatch(topic, false); + return updateTopicWithResponse(roomId, topicId, topicInBinaryData, requestOptions).getValue() + .toObject(ChatTopic.class); + } + + /** + * Update a topic. + * + * @param roomId Room identifier. + * @param topicId Topic identifier unique within the room. + * @param topic The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a chat topic in a room. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ChatTopic updateTopic(String roomId, String topicId, ChatTopic topic) { + // Generated convenience method for updateTopicWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getChatTopicAccessor().prepareModelForJsonMergePatch(topic, true); + BinaryData topicInBinaryData = BinaryData.fromObject(topic); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + topicInBinaryData.getLength(); + JsonMergePatchHelper.getChatTopicAccessor().prepareModelForJsonMergePatch(topic, false); + return updateTopicWithResponse(roomId, topicId, topicInBinaryData, requestOptions).getValue() + .toObject(ChatTopic.class); + } + + /** + * Soft delete a topic. + * + * @param roomId Room identifier. + * @param topicId Topic identifier unique within the room. + * @param matchConditions Specifies HTTP options for conditional requests. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteTopic(String roomId, String topicId, MatchConditions matchConditions) { + // Generated convenience method for deleteTopicWithResponse + RequestOptions requestOptions = new RequestOptions(); + String ifMatch = matchConditions == null ? null : matchConditions.getIfMatch(); + String ifNoneMatch = matchConditions == null ? null : matchConditions.getIfNoneMatch(); + if (ifMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); + } + if (ifNoneMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } + deleteTopicWithResponse(roomId, topicId, requestOptions).getValue(); + } + + /** + * Soft delete a topic. + * + * @param roomId Room identifier. + * @param topicId Topic identifier unique within the room. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteTopic(String roomId, String topicId) { + // Generated convenience method for deleteTopicWithResponse + RequestOptions requestOptions = new RequestOptions(); + deleteTopicWithResponse(roomId, topicId, requestOptions).getValue(); + } + + /** + * List all users with pagination. + * + * @param continuationToken Continuation token for pagination. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of ChatUser items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterableQuery Parameters
*
* {@code
* {
- * name: String (Required)
* permissions (Required): [
* String(user.create_room/user.fetch_all_rooms/room.publish_message/room.history/room.invite/room.remove_user) (Required)
* ]
- * etag: String (Required)
* }
* }
*
@@ -1512,7 +1772,7 @@ public MonoHeader Parameters
+ * List rooms with pagination. + *Query Parameters
*| Name | Type | Required | Description |
|---|---|---|---|
| If-Match | String | No | The request should only proceed if an entity matches this - * string. |
| If-None-Match | String | No | The request should only proceed if no entity matches this - * string. |
| maxpagesize | Integer | No | The maximum number of result items per page. |
| continuationToken | String | No | Continuation token for pagination. |
Request Body Schema
- * - *
- * {@code
- * {
- * id: String (Required)
- * title: String (Required)
- * defaultConversation: String (Required)
- * etag: String (Required)
- * }
- * }
- *
- *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
* Response Body Schema
* *@@ -1624,16 +1867,228 @@ public Response- * - *deleteRoleWithResponse(String roleName, RequestOptions req * } * } *
Response Headers
- *| Name | Type | Description |
|---|---|---|
| ETag | String | The entity tag for the response. |
Query Parameters
+ *| Name | Type | Required | Description |
|---|---|---|---|
| maxpagesize | Integer | No | The maximum number of result items per page. |
| continuationToken | String | No | Continuation token for pagination. |
Response Body Schema
+ * + *
+ * {@code
+ * {
+ * id: String (Required)
+ * title: String (Required)
+ * defaultConversation: String (Required)
+ * etag: String (Required)
+ * }
+ * }
+ *
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ChatRoom items as paginated response with {@link PagedFlux}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFluxQuery Parameters
+ *| Name | Type | Required | Description |
|---|---|---|---|
| maxpagesize | Integer | No | The maximum number of result items per page. |
| continuationToken | String | No | Continuation token for pagination. |
Response Body Schema
+ * + *
+ * {@code
+ * {
+ * id: String (Required)
+ * title: String (Required)
+ * defaultConversation: String (Required)
+ * etag: String (Required)
+ * }
+ * }
+ *
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ChatRoom items along with {@link PagedResponse}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private PagedResponseQuery Parameters
+ *| Name | Type | Required | Description |
|---|---|---|---|
| maxpagesize | Integer | No | The maximum number of result items per page. |
| continuationToken | String | No | Continuation token for pagination. |
Response Body Schema
+ * + *
+ * {@code
+ * {
+ * id: String (Required)
+ * title: String (Required)
+ * defaultConversation: String (Required)
+ * etag: String (Required)
+ * }
+ * }
+ *
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ChatRoom items as paginated response with {@link PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterableHeader Parameters
+ *| Name | Type | Required | Description |
|---|---|---|---|
| If-Match | String | No | The request should only proceed if an entity matches this + * string. |
| If-None-Match | String | No | The request should only proceed if no entity matches this + * string. |
Request Body Schema
+ * + *
+ * {@code
+ * {
+ * title: String (Required)
+ * }
+ * }
+ *
+ *
+ * Response Body Schema
+ * + *
+ * {@code
+ * {
+ * id: String (Required)
+ * title: String (Required)
+ * defaultConversation: String (Required)
+ * etag: String (Required)
+ * }
+ * }
+ *
+ *
+ * Response Headers
+ *| Name | Type | Description |
|---|---|---|
| ETag | String | The entity tag for the response. |
* {@code
* {
- * id: String (Required)
* title: String (Required)
- * defaultConversation: String (Required)
- * etag: String (Required)
* }
* }
*
@@ -1699,7 +2151,7 @@ public MonoQuery Parameters
*When creating a topic, omit state. Other states are only valid when replacing an existing topic.
+ * + * Create or replace a topic with a client-specified ID. *Header Parameters
*