Class WebPubSubServiceAsyncClient


  • public final class WebPubSubServiceAsyncClient
    extends Object
    Initializes a new instance of the asynchronous AzureWebPubSubServiceRestAPI type.
    • Method Detail

      • sendToAllWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> sendToAllWithResponse​(com.azure.core.util.BinaryData message,
                                                                                   WebPubSubContentType contentType,
                                                                                   long contentLength,
                                                                                   com.azure.core.http.rest.RequestOptions requestOptions)
        Broadcast content inside request body to all the connected client connections.
        Parameters:
        message - The payload body.
        contentType - Upload file type.
        contentLength - The contentLength parameter.
        requestOptions - The options to configure the HTTP request before HTTP client sends it.
        Returns:
        the completion.
        Throws:
        IllegalArgumentException - thrown if parameters fail the validation.
        com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
        RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
      • sendToAllWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> sendToAllWithResponse​(com.azure.core.util.BinaryData message,
                                                                                   com.azure.core.http.rest.RequestOptions requestOptions)
        Broadcast content inside request body to all the connected client connections.
        Parameters:
        message - The payload body.
        requestOptions - The options to configure the HTTP request before HTTP client sends it.
        Returns:
        the completion.
        Throws:
        IllegalArgumentException - thrown if parameters fail the validation.
        com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
        RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
      • sendToAll

        public Mono<Void> sendToAll​(String message,
                                    WebPubSubContentType contentType)
        Broadcast content inside request body to all the connected client connections.
        Parameters:
        message - The payload body.
        contentType - Upload file type.
        Returns:
        the completion.
        Throws:
        IllegalArgumentException - thrown if parameters fail the validation.
        com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
        RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
      • connectionExistsWithResponse

        public Mono<com.azure.core.http.rest.Response<Boolean>> connectionExistsWithResponse​(String connectionId,
                                                                                             com.azure.core.http.rest.RequestOptions requestOptions)
        Check if the connection with the given connectionId exists.
        Parameters:
        connectionId - The connection Id.
        requestOptions - The options to configure the HTTP request before HTTP client sends it.
        Returns:
        whether resource exists.
        Throws:
        IllegalArgumentException - thrown if parameters fail the validation.
        com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
        RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
      • closeConnectionWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> closeConnectionWithResponse​(String connectionId,
                                                                                         com.azure.core.http.rest.RequestOptions requestOptions)
        Close the client connection.
        Parameters:
        connectionId - Target connection Id.
        requestOptions - The options to configure the HTTP request before HTTP client sends it.
        Returns:
        the completion.
        Throws:
        IllegalArgumentException - thrown if parameters fail the validation.
        com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
        RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
      • sendToConnectionWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> sendToConnectionWithResponse​(String connectionId,
                                                                                          com.azure.core.util.BinaryData message,
                                                                                          WebPubSubContentType contentType,
                                                                                          long contentLength,
                                                                                          com.azure.core.http.rest.RequestOptions requestOptions)
        Send content inside request body to the specific connection.
        Parameters:
        connectionId - The connection Id.
        message - The payload body.
        contentType - Upload file type.
        contentLength - The contentLength parameter.
        requestOptions - The options to configure the HTTP request before HTTP client sends it.
        Returns:
        the completion.
        Throws:
        IllegalArgumentException - thrown if parameters fail the validation.
        com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
        RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
      • sendToConnectionWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> sendToConnectionWithResponse​(String connectionId,
                                                                                          com.azure.core.util.BinaryData message,
                                                                                          com.azure.core.http.rest.RequestOptions requestOptions)
        Send content inside request body to the specific connection.
        Parameters:
        connectionId - The connection Id.
        message - The payload body.
        requestOptions - The options to configure the HTTP request before HTTP client sends it.
        Returns:
        the completion.
        Throws:
        IllegalArgumentException - thrown if parameters fail the validation.
        com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
        RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
      • sendToConnection

        public Mono<Void> sendToConnection​(String connectionId,
                                           String message,
                                           WebPubSubContentType contentType)
        Send content inside request body to the specific connection.
        Parameters:
        connectionId - The connection Id.
        message - The payload body.
        contentType - Upload file type.
        Returns:
        the completion.
        Throws:
        IllegalArgumentException - thrown if parameters fail the validation.
        com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
        RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
      • groupExistsWithResponse

        public Mono<com.azure.core.http.rest.Response<Boolean>> groupExistsWithResponse​(String group,
                                                                                        com.azure.core.http.rest.RequestOptions requestOptions)
        Check if there are any client connections inside the given group.
        Parameters:
        group - Target group name, which length should be greater than 0 and less than 1025.
        requestOptions - The options to configure the HTTP request before HTTP client sends it.
        Returns:
        whether resource exists.
        Throws:
        IllegalArgumentException - thrown if parameters fail the validation.
        com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
        RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
      • sendToGroupWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> sendToGroupWithResponse​(String group,
                                                                                     com.azure.core.util.BinaryData message,
                                                                                     WebPubSubContentType contentType,
                                                                                     long contentLength,
                                                                                     com.azure.core.http.rest.RequestOptions requestOptions)
        Send content inside request body to a group of connections.
        Parameters:
        group - Target group name, which length should be greater than 0 and less than 1025.
        message - The payload body.
        contentType - Upload file type.
        contentLength - The contentLength parameter.
        requestOptions - The options to configure the HTTP request before HTTP client sends it.
        Returns:
        the completion.
        Throws:
        IllegalArgumentException - thrown if parameters fail the validation.
        com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
        RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
      • sendToGroupWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> sendToGroupWithResponse​(String group,
                                                                                     com.azure.core.util.BinaryData message,
                                                                                     com.azure.core.http.rest.RequestOptions requestOptions)
        Send content inside request body to a group of connections.
        Parameters:
        group - Target group name, which length should be greater than 0 and less than 1025.
        message - The payload body.
        requestOptions - The options to configure the HTTP request before HTTP client sends it.
        Returns:
        the completion.
        Throws:
        IllegalArgumentException - thrown if parameters fail the validation.
        com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
        RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
      • sendToGroup

        public Mono<Void> sendToGroup​(String group,
                                      String message,
                                      WebPubSubContentType contentType)
        Send content inside request body to a group of connections.
        Parameters:
        group - Target group name, which length should be greater than 0 and less than 1025.
        message - The payload body.
        contentType - Upload file type.
        Returns:
        the completion.
        Throws:
        IllegalArgumentException - thrown if parameters fail the validation.
        com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
        RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
      • addConnectionToGroupWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> addConnectionToGroupWithResponse​(String group,
                                                                                              String connectionId,
                                                                                              com.azure.core.http.rest.RequestOptions requestOptions)
        Add a connection to the target group.
        Parameters:
        group - Target group name, which length should be greater than 0 and less than 1025.
        connectionId - Target connection Id.
        requestOptions - The options to configure the HTTP request before HTTP client sends it.
        Returns:
        the completion.
        Throws:
        IllegalArgumentException - thrown if parameters fail the validation.
        com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
        RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
      • removeConnectionFromGroupWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> removeConnectionFromGroupWithResponse​(String group,
                                                                                                   String connectionId,
                                                                                                   com.azure.core.http.rest.RequestOptions requestOptions)
        Remove a connection from the target group.
        Parameters:
        group - Target group name, which length should be greater than 0 and less than 1025.
        connectionId - Target connection Id.
        requestOptions - The options to configure the HTTP request before HTTP client sends it.
        Returns:
        the completion.
        Throws:
        IllegalArgumentException - thrown if parameters fail the validation.
        com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
        RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
      • userExistsWithResponse

        public Mono<com.azure.core.http.rest.Response<Boolean>> userExistsWithResponse​(String userId,
                                                                                       com.azure.core.http.rest.RequestOptions requestOptions)
        Check if there are any client connections connected for the given user.
        Parameters:
        userId - Target user Id.
        requestOptions - The options to configure the HTTP request before HTTP client sends it.
        Returns:
        whether resource exists.
        Throws:
        IllegalArgumentException - thrown if parameters fail the validation.
        com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
        RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
      • sendToUserWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> sendToUserWithResponse​(String userId,
                                                                                    com.azure.core.util.BinaryData message,
                                                                                    WebPubSubContentType contentType,
                                                                                    long contentLength,
                                                                                    com.azure.core.http.rest.RequestOptions requestOptions)
        Send content inside request body to the specific user.
        Parameters:
        userId - The user Id.
        message - The payload body.
        contentType - Upload file type.
        contentLength - The contentLength parameter.
        requestOptions - The options to configure the HTTP request before HTTP client sends it.
        Returns:
        the completion.
        Throws:
        IllegalArgumentException - thrown if parameters fail the validation.
        com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
        RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
      • sendToUserWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> sendToUserWithResponse​(String userId,
                                                                                    com.azure.core.util.BinaryData message,
                                                                                    com.azure.core.http.rest.RequestOptions requestOptions)
        Send content inside request body to the specific user.
        Parameters:
        userId - The user Id.
        message - The payload body.
        requestOptions - The options to configure the HTTP request before HTTP client sends it.
        Returns:
        the completion.
        Throws:
        IllegalArgumentException - thrown if parameters fail the validation.
        com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
        RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
      • sendToUser

        public Mono<Void> sendToUser​(String userId,
                                     String message,
                                     WebPubSubContentType contentType)
        Send content inside request body to the specific user.
        Parameters:
        userId - The user Id.
        message - The payload body.
        contentType - Upload file type.
        Returns:
        the completion.
        Throws:
        IllegalArgumentException - thrown if parameters fail the validation.
        com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
        RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
      • addUserToGroupWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> addUserToGroupWithResponse​(String group,
                                                                                        String userId,
                                                                                        com.azure.core.http.rest.RequestOptions requestOptions)
        Add a user to the target group.
        Parameters:
        group - Target group name, which length should be greater than 0 and less than 1025.
        userId - Target user Id.
        requestOptions - The options to configure the HTTP request before HTTP client sends it.
        Returns:
        the completion.
        Throws:
        IllegalArgumentException - thrown if parameters fail the validation.
        com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
        RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
      • removeUserFromGroupWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> removeUserFromGroupWithResponse​(String group,
                                                                                             String userId,
                                                                                             com.azure.core.http.rest.RequestOptions requestOptions)
        Remove a user from the target group.
        Parameters:
        group - Target group name, which length should be greater than 0 and less than 1025.
        userId - Target user Id.
        requestOptions - The options to configure the HTTP request before HTTP client sends it.
        Returns:
        the completion.
        Throws:
        IllegalArgumentException - thrown if parameters fail the validation.
        com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
        RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
      • removeUserFromAllGroupsWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> removeUserFromAllGroupsWithResponse​(String userId,
                                                                                                 com.azure.core.http.rest.RequestOptions requestOptions)
        Remove a user from all groups.
        Parameters:
        userId - Target user Id.
        requestOptions - The options to configure the HTTP request before HTTP client sends it.
        Returns:
        the completion.
        Throws:
        IllegalArgumentException - thrown if parameters fail the validation.
        com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
        RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
      • grantPermissionWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> grantPermissionWithResponse​(WebPubSubPermission permission,
                                                                                         String connectionId,
                                                                                         com.azure.core.http.rest.RequestOptions requestOptions)
        Grant permission to the connection.
        Parameters:
        permission - The permission: current supported actions are joinLeaveGroup and sendToGroup.
        connectionId - Target connection Id.
        requestOptions - The options to configure the HTTP request before HTTP client sends it.
        Returns:
        the completion.
        Throws:
        IllegalArgumentException - thrown if parameters fail the validation.
        com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
        RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
      • revokePermissionWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> revokePermissionWithResponse​(WebPubSubPermission permission,
                                                                                          String connectionId,
                                                                                          com.azure.core.http.rest.RequestOptions requestOptions)
        Revoke permission for the connection.
        Parameters:
        permission - The permission: current supported actions are joinLeaveGroup and sendToGroup.
        connectionId - Target connection Id.
        requestOptions - The options to configure the HTTP request before HTTP client sends it.
        Returns:
        the completion.
        Throws:
        IllegalArgumentException - thrown if parameters fail the validation.
        com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
        RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
      • checkPermissionWithResponse

        public Mono<com.azure.core.http.rest.Response<Boolean>> checkPermissionWithResponse​(WebPubSubPermission permission,
                                                                                            String connectionId,
                                                                                            com.azure.core.http.rest.RequestOptions requestOptions)
        Check if a connection has permission to the specified action.
        Parameters:
        permission - The permission: current supported actions are joinLeaveGroup and sendToGroup.
        connectionId - Target connection Id.
        requestOptions - The options to configure the HTTP request before HTTP client sends it.
        Returns:
        whether resource exists.
        Throws:
        IllegalArgumentException - thrown if parameters fail the validation.
        com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
        RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
      • closeAllConnectionsWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> closeAllConnectionsWithResponse​(com.azure.core.http.rest.RequestOptions requestOptions)
        Close the connections in the hub.

        Query Parameters

        Query Parameters
        NameTypeRequiredDescription
        excludedStringNoExclude these connectionIds when closing the connections in the hub.
        reasonStringNoThe reason closing the client connection.
        apiVersionStringYesApi Version
        Parameters:
        requestOptions - The options to configure the HTTP request before HTTP client sends it.
        Returns:
        the completion.
        Throws:
        com.azure.core.exception.HttpResponseException - thrown if status code is 400 or above, if throwOnError in requestOptions is not false.
      • closeGroupConnectionsWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> closeGroupConnectionsWithResponse​(String group,
                                                                                               com.azure.core.http.rest.RequestOptions requestOptions)
        Close connections in the specific group.

        Query Parameters

        Query Parameters
        NameTypeRequiredDescription
        excludedStringNoExclude these connectionIds when closing the connections in the group.
        reasonStringNoThe reason closing the client connection.
        apiVersionStringYesApi Version
        Parameters:
        group - Target group name, which length should be greater than 0 and less than 1025.
        requestOptions - The options to configure the HTTP request before HTTP client sends it.
        Returns:
        the completion.
        Throws:
        com.azure.core.exception.HttpResponseException - thrown if status code is 400 or above, if throwOnError in requestOptions is not false.
      • closeUserConnectionsWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> closeUserConnectionsWithResponse​(String userId,
                                                                                              com.azure.core.http.rest.RequestOptions requestOptions)
        Close connections for the specific user.

        Query Parameters

        Query Parameters
        NameTypeRequiredDescription
        excludedStringNoExclude these connectionIds when closing the connections for the user.
        reasonStringNoThe reason closing the client connection.
        apiVersionStringYesApi Version
        Parameters:
        userId - The user Id.
        requestOptions - The options to configure the HTTP request before HTTP client sends it.
        Returns:
        the completion.
        Throws:
        com.azure.core.exception.HttpResponseException - thrown if status code is 400 or above, if throwOnError in requestOptions is not false.