diff --git a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/WebPubSubServiceClient.cs b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/WebPubSubServiceClient.cs index dfe3afbaaa9c..1987689785e5 100644 --- a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/WebPubSubServiceClient.cs +++ b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/WebPubSubServiceClient.cs @@ -34,6 +34,82 @@ protected WebPubSubServiceClient() { } + /// Close the connections in the hub. + /// Exclude these connectionIds when closing the connections in the hub. + /// The reason closing the client connection. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + /// This sample shows how to call CloseAllConnectionsAsync. + /// ", ""); + /// + /// Response response = await client.CloseAllConnectionsAsync(); + /// Console.WriteLine(response.Status); + /// ]]> + /// This sample shows how to call CloseAllConnectionsAsync with all parameters. + /// ", ""); + /// + /// Response response = await client.CloseAllConnectionsAsync(new String[]{""}, ""); + /// Console.WriteLine(response.Status); + /// ]]> + /// + public virtual async Task CloseAllConnectionsAsync(IEnumerable excluded = null, string reason = null, RequestContext context = null) + { + using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.CloseAllConnections"); + scope.Start(); + try + { + using HttpMessage message = CreateCloseAllConnectionsRequest(excluded, reason, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Close the connections in the hub. + /// Exclude these connectionIds when closing the connections in the hub. + /// The reason closing the client connection. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + /// This sample shows how to call CloseAllConnections. + /// ", ""); + /// + /// Response response = client.CloseAllConnections(); + /// Console.WriteLine(response.Status); + /// ]]> + /// This sample shows how to call CloseAllConnections with all parameters. + /// ", ""); + /// + /// Response response = client.CloseAllConnections(new String[]{""}, ""); + /// Console.WriteLine(response.Status); + /// ]]> + /// + public virtual Response CloseAllConnections(IEnumerable excluded = null, string reason = null, RequestContext context = null) + { + using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.CloseAllConnections"); + scope.Start(); + try + { + using HttpMessage message = CreateCloseAllConnectionsRequest(excluded, reason, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// Generate token for the client to connect Azure Web PubSub service. /// User Id. /// Roles that the connection with the generated token will have. @@ -144,82 +220,6 @@ internal virtual Response GenerateClientTokenImpl(string userId = null, IEnumera } } - /// Close the connections in the hub. - /// Exclude these connectionIds when closing the connections in the hub. - /// The reason closing the client connection. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - /// This sample shows how to call CloseAllConnectionsAsync. - /// ", ""); - /// - /// Response response = await client.CloseAllConnectionsAsync(); - /// Console.WriteLine(response.Status); - /// ]]> - /// This sample shows how to call CloseAllConnectionsAsync with all parameters. - /// ", ""); - /// - /// Response response = await client.CloseAllConnectionsAsync(new String[]{""}, ""); - /// Console.WriteLine(response.Status); - /// ]]> - /// - public virtual async Task CloseAllConnectionsAsync(IEnumerable excluded = null, string reason = null, RequestContext context = null) - { - using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.CloseAllConnections"); - scope.Start(); - try - { - using HttpMessage message = CreateCloseAllConnectionsRequest(excluded, reason, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Close the connections in the hub. - /// Exclude these connectionIds when closing the connections in the hub. - /// The reason closing the client connection. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - /// This sample shows how to call CloseAllConnections. - /// ", ""); - /// - /// Response response = client.CloseAllConnections(); - /// Console.WriteLine(response.Status); - /// ]]> - /// This sample shows how to call CloseAllConnections with all parameters. - /// ", ""); - /// - /// Response response = client.CloseAllConnections(new String[]{""}, ""); - /// Console.WriteLine(response.Status); - /// ]]> - /// - public virtual Response CloseAllConnections(IEnumerable excluded = null, string reason = null, RequestContext context = null) - { - using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.CloseAllConnections"); - scope.Start(); - try - { - using HttpMessage message = CreateCloseAllConnectionsRequest(excluded, reason, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - /// Broadcast content inside request body to all the connected client connections. /// The content to send as the body of the request. Details of the request body schema are in the Remarks section below. /// Upload file type. Allowed values: "application/json" | "application/octet-stream" | "text/plain". @@ -312,31 +312,39 @@ public virtual Response SendToAll(RequestContent content, ContentType contentTyp } } - /// Check if the connection with the given connectionId exists. - /// The connection Id. + /// Close the client connection. + /// Target connection Id. + /// The reason closing the client connection. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - /// This sample shows how to call ConnectionExistsImplAsync with required parameters. + /// This sample shows how to call CloseConnectionAsync with required parameters. /// ", ""); /// - /// Response response = await client.ConnectionExistsImplAsync(""); + /// Response response = await client.CloseConnectionAsync(""); + /// Console.WriteLine(response.Status); + /// ]]> + /// This sample shows how to call CloseConnectionAsync with all parameters. + /// ", ""); + /// + /// Response response = await client.CloseConnectionAsync("", ""); /// Console.WriteLine(response.Status); /// ]]> /// - internal virtual async Task ConnectionExistsImplAsync(string connectionId, RequestContext context = null) + public virtual async Task CloseConnectionAsync(string connectionId, string reason = null, RequestContext context = null) { Argument.AssertNotNullOrEmpty(connectionId, nameof(connectionId)); - using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.ConnectionExistsImpl"); + using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.CloseConnection"); scope.Start(); try { - using HttpMessage message = CreateConnectionExistsImplRequest(connectionId, context); + using HttpMessage message = CreateCloseConnectionRequest(connectionId, reason, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -346,31 +354,39 @@ internal virtual async Task ConnectionExistsImplAsync(string connectio } } - /// Check if the connection with the given connectionId exists. - /// The connection Id. + /// Close the client connection. + /// Target connection Id. + /// The reason closing the client connection. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - /// This sample shows how to call ConnectionExistsImpl with required parameters. + /// This sample shows how to call CloseConnection with required parameters. /// ", ""); /// - /// Response response = client.ConnectionExistsImpl(""); + /// Response response = client.CloseConnection(""); + /// Console.WriteLine(response.Status); + /// ]]> + /// This sample shows how to call CloseConnection with all parameters. + /// ", ""); + /// + /// Response response = client.CloseConnection("", ""); /// Console.WriteLine(response.Status); /// ]]> /// - internal virtual Response ConnectionExistsImpl(string connectionId, RequestContext context = null) + public virtual Response CloseConnection(string connectionId, string reason = null, RequestContext context = null) { Argument.AssertNotNullOrEmpty(connectionId, nameof(connectionId)); - using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.ConnectionExistsImpl"); + using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.CloseConnection"); scope.Start(); try { - using HttpMessage message = CreateConnectionExistsImplRequest(connectionId, context); + using HttpMessage message = CreateCloseConnectionRequest(connectionId, reason, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -380,39 +396,31 @@ internal virtual Response ConnectionExistsImpl(string connectionId, RequestConte } } - /// Close the client connection. - /// Target connection Id. - /// The reason closing the client connection. + /// Check if the connection with the given connectionId exists. + /// The connection Id. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - /// This sample shows how to call CloseConnectionAsync with required parameters. - /// ", ""); - /// - /// Response response = await client.CloseConnectionAsync(""); - /// Console.WriteLine(response.Status); - /// ]]> - /// This sample shows how to call CloseConnectionAsync with all parameters. + /// This sample shows how to call ConnectionExistsImplAsync with required parameters. /// ", ""); /// - /// Response response = await client.CloseConnectionAsync("", ""); + /// Response response = await client.ConnectionExistsImplAsync(""); /// Console.WriteLine(response.Status); /// ]]> /// - public virtual async Task CloseConnectionAsync(string connectionId, string reason = null, RequestContext context = null) + internal virtual async Task ConnectionExistsImplAsync(string connectionId, RequestContext context = null) { Argument.AssertNotNullOrEmpty(connectionId, nameof(connectionId)); - using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.CloseConnection"); + using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.ConnectionExistsImpl"); scope.Start(); try { - using HttpMessage message = CreateCloseConnectionRequest(connectionId, reason, context); + using HttpMessage message = CreateConnectionExistsImplRequest(connectionId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -422,39 +430,31 @@ public virtual async Task CloseConnectionAsync(string connectionId, st } } - /// Close the client connection. - /// Target connection Id. - /// The reason closing the client connection. + /// Check if the connection with the given connectionId exists. + /// The connection Id. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - /// This sample shows how to call CloseConnection with required parameters. - /// ", ""); - /// - /// Response response = client.CloseConnection(""); - /// Console.WriteLine(response.Status); - /// ]]> - /// This sample shows how to call CloseConnection with all parameters. + /// This sample shows how to call ConnectionExistsImpl with required parameters. /// ", ""); /// - /// Response response = client.CloseConnection("", ""); + /// Response response = client.ConnectionExistsImpl(""); /// Console.WriteLine(response.Status); /// ]]> /// - public virtual Response CloseConnection(string connectionId, string reason = null, RequestContext context = null) + internal virtual Response ConnectionExistsImpl(string connectionId, RequestContext context = null) { Argument.AssertNotNullOrEmpty(connectionId, nameof(connectionId)); - using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.CloseConnection"); + using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.ConnectionExistsImpl"); scope.Start(); try { - using HttpMessage message = CreateCloseConnectionRequest(connectionId, reason, context); + using HttpMessage message = CreateConnectionExistsImplRequest(connectionId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -794,7 +794,7 @@ public virtual Response SendToGroup(string group, RequestContent content, Conten } } - /// Add a connection to the target group. + /// Remove a connection from the target group. /// Target group name, which length should be greater than 0 and less than 1025. /// Target connection Id. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. @@ -803,24 +803,24 @@ public virtual Response SendToGroup(string group, RequestContent content, Conten /// Service returned a non-success status code. /// The response returned from the service. /// - /// This sample shows how to call AddConnectionToGroupAsync with required parameters. + /// This sample shows how to call RemoveConnectionFromGroupAsync with required parameters. /// ", ""); /// - /// Response response = await client.AddConnectionToGroupAsync("", ""); + /// Response response = await client.RemoveConnectionFromGroupAsync("", ""); /// Console.WriteLine(response.Status); /// ]]> /// - public virtual async Task AddConnectionToGroupAsync(string group, string connectionId, RequestContext context = null) + public virtual async Task RemoveConnectionFromGroupAsync(string group, string connectionId, RequestContext context = null) { Argument.AssertNotNullOrEmpty(group, nameof(group)); Argument.AssertNotNullOrEmpty(connectionId, nameof(connectionId)); - using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.AddConnectionToGroup"); + using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.RemoveConnectionFromGroup"); scope.Start(); try { - using HttpMessage message = CreateAddConnectionToGroupRequest(group, connectionId, context); + using HttpMessage message = CreateRemoveConnectionFromGroupRequest(group, connectionId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -830,7 +830,7 @@ public virtual async Task AddConnectionToGroupAsync(string group, stri } } - /// Add a connection to the target group. + /// Remove a connection from the target group. /// Target group name, which length should be greater than 0 and less than 1025. /// Target connection Id. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. @@ -839,24 +839,24 @@ public virtual async Task AddConnectionToGroupAsync(string group, stri /// Service returned a non-success status code. /// The response returned from the service. /// - /// This sample shows how to call AddConnectionToGroup with required parameters. + /// This sample shows how to call RemoveConnectionFromGroup with required parameters. /// ", ""); /// - /// Response response = client.AddConnectionToGroup("", ""); + /// Response response = client.RemoveConnectionFromGroup("", ""); /// Console.WriteLine(response.Status); /// ]]> /// - public virtual Response AddConnectionToGroup(string group, string connectionId, RequestContext context = null) + public virtual Response RemoveConnectionFromGroup(string group, string connectionId, RequestContext context = null) { Argument.AssertNotNullOrEmpty(group, nameof(group)); Argument.AssertNotNullOrEmpty(connectionId, nameof(connectionId)); - using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.AddConnectionToGroup"); + using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.RemoveConnectionFromGroup"); scope.Start(); try { - using HttpMessage message = CreateAddConnectionToGroupRequest(group, connectionId, context); + using HttpMessage message = CreateRemoveConnectionFromGroupRequest(group, connectionId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -866,7 +866,7 @@ public virtual Response AddConnectionToGroup(string group, string connectionId, } } - /// Remove a connection from the target group. + /// Add a connection to the target group. /// Target group name, which length should be greater than 0 and less than 1025. /// Target connection Id. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. @@ -875,24 +875,24 @@ public virtual Response AddConnectionToGroup(string group, string connectionId, /// Service returned a non-success status code. /// The response returned from the service. /// - /// This sample shows how to call RemoveConnectionFromGroupAsync with required parameters. + /// This sample shows how to call AddConnectionToGroupAsync with required parameters. /// ", ""); /// - /// Response response = await client.RemoveConnectionFromGroupAsync("", ""); + /// Response response = await client.AddConnectionToGroupAsync("", ""); /// Console.WriteLine(response.Status); /// ]]> /// - public virtual async Task RemoveConnectionFromGroupAsync(string group, string connectionId, RequestContext context = null) + public virtual async Task AddConnectionToGroupAsync(string group, string connectionId, RequestContext context = null) { Argument.AssertNotNullOrEmpty(group, nameof(group)); Argument.AssertNotNullOrEmpty(connectionId, nameof(connectionId)); - using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.RemoveConnectionFromGroup"); + using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.AddConnectionToGroup"); scope.Start(); try { - using HttpMessage message = CreateRemoveConnectionFromGroupRequest(group, connectionId, context); + using HttpMessage message = CreateAddConnectionToGroupRequest(group, connectionId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -902,7 +902,7 @@ public virtual async Task RemoveConnectionFromGroupAsync(string group, } } - /// Remove a connection from the target group. + /// Add a connection to the target group. /// Target group name, which length should be greater than 0 and less than 1025. /// Target connection Id. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. @@ -911,24 +911,24 @@ public virtual async Task RemoveConnectionFromGroupAsync(string group, /// Service returned a non-success status code. /// The response returned from the service. /// - /// This sample shows how to call RemoveConnectionFromGroup with required parameters. + /// This sample shows how to call AddConnectionToGroup with required parameters. /// ", ""); /// - /// Response response = client.RemoveConnectionFromGroup("", ""); + /// Response response = client.AddConnectionToGroup("", ""); /// Console.WriteLine(response.Status); /// ]]> /// - public virtual Response RemoveConnectionFromGroup(string group, string connectionId, RequestContext context = null) + public virtual Response AddConnectionToGroup(string group, string connectionId, RequestContext context = null) { Argument.AssertNotNullOrEmpty(group, nameof(group)); Argument.AssertNotNullOrEmpty(connectionId, nameof(connectionId)); - using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.RemoveConnectionFromGroup"); + using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.AddConnectionToGroup"); scope.Start(); try { - using HttpMessage message = CreateRemoveConnectionFromGroupRequest(group, connectionId, context); + using HttpMessage message = CreateAddConnectionToGroupRequest(group, connectionId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -938,31 +938,41 @@ public virtual Response RemoveConnectionFromGroup(string group, string connectio } } - /// Check if there are any client connections connected for the given user. - /// Target user Id. + /// Revoke permission for the connection. + /// The permission: current supported actions are joinLeaveGroup and sendToGroup. Allowed values: "sendToGroup" | "joinLeaveGroup". + /// Target connection Id. + /// Optional. If not set, revoke the permission for all targets. If set, revoke the permission for the specific target. The meaning of the target depends on the specific permission. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - /// This sample shows how to call UserExistsImplAsync with required parameters. + /// This sample shows how to call RevokePermissionAsync with required parameters. /// ", ""); /// - /// Response response = await client.UserExistsImplAsync(""); + /// Response response = await client.RevokePermissionAsync("", ""); + /// Console.WriteLine(response.Status); + /// ]]> + /// This sample shows how to call RevokePermissionAsync with all parameters. + /// ", ""); + /// + /// Response response = await client.RevokePermissionAsync("", "", ""); /// Console.WriteLine(response.Status); /// ]]> /// - internal virtual async Task UserExistsImplAsync(string userId, RequestContext context = null) + internal virtual async Task RevokePermissionAsync(string permission, string connectionId, string targetName = null, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + Argument.AssertNotNullOrEmpty(permission, nameof(permission)); + Argument.AssertNotNullOrEmpty(connectionId, nameof(connectionId)); - using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.UserExistsImpl"); + using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.RevokePermission"); scope.Start(); try { - using HttpMessage message = CreateUserExistsImplRequest(userId, context); + using HttpMessage message = CreateRevokePermissionRequest(permission, connectionId, targetName, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -972,31 +982,41 @@ internal virtual async Task UserExistsImplAsync(string userId, Request } } - /// Check if there are any client connections connected for the given user. - /// Target user Id. + /// Revoke permission for the connection. + /// The permission: current supported actions are joinLeaveGroup and sendToGroup. Allowed values: "sendToGroup" | "joinLeaveGroup". + /// Target connection Id. + /// Optional. If not set, revoke the permission for all targets. If set, revoke the permission for the specific target. The meaning of the target depends on the specific permission. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - /// This sample shows how to call UserExistsImpl with required parameters. + /// This sample shows how to call RevokePermission with required parameters. /// ", ""); /// - /// Response response = client.UserExistsImpl(""); + /// Response response = client.RevokePermission("", ""); + /// Console.WriteLine(response.Status); + /// ]]> + /// This sample shows how to call RevokePermission with all parameters. + /// ", ""); + /// + /// Response response = client.RevokePermission("", "", ""); /// Console.WriteLine(response.Status); /// ]]> /// - internal virtual Response UserExistsImpl(string userId, RequestContext context = null) + internal virtual Response RevokePermission(string permission, string connectionId, string targetName = null, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + Argument.AssertNotNullOrEmpty(permission, nameof(permission)); + Argument.AssertNotNullOrEmpty(connectionId, nameof(connectionId)); - using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.UserExistsImpl"); + using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.RevokePermission"); scope.Start(); try { - using HttpMessage message = CreateUserExistsImplRequest(userId, context); + using HttpMessage message = CreateRevokePermissionRequest(permission, connectionId, targetName, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1006,40 +1026,41 @@ internal virtual Response UserExistsImpl(string userId, RequestContext context = } } - /// Close connections for the specific user. - /// The user Id. - /// Exclude these connectionIds when closing the connections for the user. - /// The reason closing the client connection. + /// Check if a connection has permission to the specified action. + /// The permission: current supported actions are joinLeaveGroup and sendToGroup. Allowed values: "sendToGroup" | "joinLeaveGroup". + /// Target connection Id. + /// Optional. If not set, get the permission for all targets. If set, get the permission for the specific target. The meaning of the target depends on the specific permission. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - /// This sample shows how to call CloseUserConnectionsAsync with required parameters. + /// This sample shows how to call CheckPermissionAsync with required parameters. /// ", ""); /// - /// Response response = await client.CloseUserConnectionsAsync(""); + /// Response response = await client.CheckPermissionAsync("", ""); /// Console.WriteLine(response.Status); /// ]]> - /// This sample shows how to call CloseUserConnectionsAsync with all parameters. + /// This sample shows how to call CheckPermissionAsync with all parameters. /// ", ""); /// - /// Response response = await client.CloseUserConnectionsAsync("", new String[]{""}, ""); + /// Response response = await client.CheckPermissionAsync("", "", ""); /// Console.WriteLine(response.Status); /// ]]> /// - public virtual async Task CloseUserConnectionsAsync(string userId, IEnumerable excluded = null, string reason = null, RequestContext context = null) + internal virtual async Task CheckPermissionAsync(string permission, string connectionId, string targetName = null, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + Argument.AssertNotNullOrEmpty(permission, nameof(permission)); + Argument.AssertNotNullOrEmpty(connectionId, nameof(connectionId)); - using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.CloseUserConnections"); + using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.CheckPermission"); scope.Start(); try { - using HttpMessage message = CreateCloseUserConnectionsRequest(userId, excluded, reason, context); + using HttpMessage message = CreateCheckPermissionRequest(permission, connectionId, targetName, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1049,40 +1070,41 @@ public virtual async Task CloseUserConnectionsAsync(string userId, IEn } } - /// Close connections for the specific user. - /// The user Id. - /// Exclude these connectionIds when closing the connections for the user. - /// The reason closing the client connection. + /// Check if a connection has permission to the specified action. + /// The permission: current supported actions are joinLeaveGroup and sendToGroup. Allowed values: "sendToGroup" | "joinLeaveGroup". + /// Target connection Id. + /// Optional. If not set, get the permission for all targets. If set, get the permission for the specific target. The meaning of the target depends on the specific permission. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - /// This sample shows how to call CloseUserConnections with required parameters. + /// This sample shows how to call CheckPermission with required parameters. /// ", ""); /// - /// Response response = client.CloseUserConnections(""); + /// Response response = client.CheckPermission("", ""); /// Console.WriteLine(response.Status); /// ]]> - /// This sample shows how to call CloseUserConnections with all parameters. + /// This sample shows how to call CheckPermission with all parameters. /// ", ""); /// - /// Response response = client.CloseUserConnections("", new String[]{""}, ""); + /// Response response = client.CheckPermission("", "", ""); /// Console.WriteLine(response.Status); /// ]]> /// - public virtual Response CloseUserConnections(string userId, IEnumerable excluded = null, string reason = null, RequestContext context = null) + internal virtual Response CheckPermission(string permission, string connectionId, string targetName = null, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + Argument.AssertNotNullOrEmpty(permission, nameof(permission)); + Argument.AssertNotNullOrEmpty(connectionId, nameof(connectionId)); - using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.CloseUserConnections"); + using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.CheckPermission"); scope.Start(); try { - using HttpMessage message = CreateCloseUserConnectionsRequest(userId, excluded, reason, context); + using HttpMessage message = CreateCheckPermissionRequest(permission, connectionId, targetName, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1092,36 +1114,41 @@ public virtual Response CloseUserConnections(string userId, IEnumerable } } - /// Send content inside request body to the specific user. - /// The user Id. - /// The content to send as the body of the request. Details of the request body schema are in the Remarks section below. - /// Upload file type. Allowed values: "application/json" | "application/octet-stream" | "text/plain". + /// Grant permission to the connection. + /// The permission: current supported actions are joinLeaveGroup and sendToGroup. Allowed values: "sendToGroup" | "joinLeaveGroup". + /// Target connection Id. + /// Optional. If not set, grant the permission to all the targets. If set, grant the permission to the specific target. The meaning of the target depends on the specific permission. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - /// This sample shows how to call SendToUserAsync with required parameters and request content. + /// This sample shows how to call GrantPermissionAsync with required parameters. /// ", ""); /// - /// var data = File.OpenRead(""); + /// Response response = await client.GrantPermissionAsync("", ""); + /// Console.WriteLine(response.Status); + /// ]]> + /// This sample shows how to call GrantPermissionAsync with all parameters. + /// ", ""); /// - /// Response response = await client.SendToUserAsync("", RequestContent.Create(data), ContentType.ApplicationOctetStream); + /// Response response = await client.GrantPermissionAsync("", "", ""); /// Console.WriteLine(response.Status); /// ]]> /// - public virtual async Task SendToUserAsync(string userId, RequestContent content, ContentType contentType, RequestContext context = null) + internal virtual async Task GrantPermissionAsync(string permission, string connectionId, string targetName = null, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(permission, nameof(permission)); + Argument.AssertNotNullOrEmpty(connectionId, nameof(connectionId)); - using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.SendToUser"); + using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.GrantPermission"); scope.Start(); try { - using HttpMessage message = CreateSendToUserRequest(userId, content, contentType, context); + using HttpMessage message = CreateGrantPermissionRequest(permission, connectionId, targetName, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1131,36 +1158,41 @@ public virtual async Task SendToUserAsync(string userId, RequestConten } } - /// Send content inside request body to the specific user. - /// The user Id. - /// The content to send as the body of the request. Details of the request body schema are in the Remarks section below. - /// Upload file type. Allowed values: "application/json" | "application/octet-stream" | "text/plain". + /// Grant permission to the connection. + /// The permission: current supported actions are joinLeaveGroup and sendToGroup. Allowed values: "sendToGroup" | "joinLeaveGroup". + /// Target connection Id. + /// Optional. If not set, grant the permission to all the targets. If set, grant the permission to the specific target. The meaning of the target depends on the specific permission. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - /// This sample shows how to call SendToUser with required parameters and request content. + /// This sample shows how to call GrantPermission with required parameters. /// ", ""); /// - /// var data = File.OpenRead(""); + /// Response response = client.GrantPermission("", ""); + /// Console.WriteLine(response.Status); + /// ]]> + /// This sample shows how to call GrantPermission with all parameters. + /// ", ""); /// - /// Response response = client.SendToUser("", RequestContent.Create(data), ContentType.ApplicationOctetStream); + /// Response response = client.GrantPermission("", "", ""); /// Console.WriteLine(response.Status); /// ]]> /// - public virtual Response SendToUser(string userId, RequestContent content, ContentType contentType, RequestContext context = null) + internal virtual Response GrantPermission(string permission, string connectionId, string targetName = null, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(permission, nameof(permission)); + Argument.AssertNotNullOrEmpty(connectionId, nameof(connectionId)); - using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.SendToUser"); + using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.GrantPermission"); scope.Start(); try { - using HttpMessage message = CreateSendToUserRequest(userId, content, contentType, context); + using HttpMessage message = CreateGrantPermissionRequest(permission, connectionId, targetName, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1170,7 +1202,7 @@ public virtual Response SendToUser(string userId, RequestContent content, Conten } } - /// Remove a user from all groups. + /// Check if there are any client connections connected for the given user. /// Target user Id. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. @@ -1178,23 +1210,23 @@ public virtual Response SendToUser(string userId, RequestContent content, Conten /// Service returned a non-success status code. /// The response returned from the service. /// - /// This sample shows how to call RemoveUserFromAllGroupsAsync with required parameters. + /// This sample shows how to call UserExistsImplAsync with required parameters. /// ", ""); /// - /// Response response = await client.RemoveUserFromAllGroupsAsync(""); + /// Response response = await client.UserExistsImplAsync(""); /// Console.WriteLine(response.Status); /// ]]> /// - public virtual async Task RemoveUserFromAllGroupsAsync(string userId, RequestContext context = null) + internal virtual async Task UserExistsImplAsync(string userId, RequestContext context = null) { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.RemoveUserFromAllGroups"); + using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.UserExistsImpl"); scope.Start(); try { - using HttpMessage message = CreateRemoveUserFromAllGroupsRequest(userId, context); + using HttpMessage message = CreateUserExistsImplRequest(userId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1204,7 +1236,7 @@ public virtual async Task RemoveUserFromAllGroupsAsync(string userId, } } - /// Remove a user from all groups. + /// Check if there are any client connections connected for the given user. /// Target user Id. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. @@ -1212,23 +1244,23 @@ public virtual async Task RemoveUserFromAllGroupsAsync(string userId, /// Service returned a non-success status code. /// The response returned from the service. /// - /// This sample shows how to call RemoveUserFromAllGroups with required parameters. + /// This sample shows how to call UserExistsImpl with required parameters. /// ", ""); /// - /// Response response = client.RemoveUserFromAllGroups(""); + /// Response response = client.UserExistsImpl(""); /// Console.WriteLine(response.Status); /// ]]> /// - public virtual Response RemoveUserFromAllGroups(string userId, RequestContext context = null) + internal virtual Response UserExistsImpl(string userId, RequestContext context = null) { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.RemoveUserFromAllGroups"); + using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.UserExistsImpl"); scope.Start(); try { - using HttpMessage message = CreateRemoveUserFromAllGroupsRequest(userId, context); + using HttpMessage message = CreateUserExistsImplRequest(userId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1238,41 +1270,40 @@ public virtual Response RemoveUserFromAllGroups(string userId, RequestContext co } } - /// Grant permission to the connection. - /// The permission: current supported actions are joinLeaveGroup and sendToGroup. Allowed values: "sendToGroup" | "joinLeaveGroup". - /// Target connection Id. - /// Optional. If not set, grant the permission to all the targets. If set, grant the permission to the specific target. The meaning of the target depends on the specific permission. + /// Close connections for the specific user. + /// The user Id. + /// Exclude these connectionIds when closing the connections for the user. + /// The reason closing the client connection. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - /// This sample shows how to call GrantPermissionAsync with required parameters. + /// This sample shows how to call CloseUserConnectionsAsync with required parameters. /// ", ""); /// - /// Response response = await client.GrantPermissionAsync("", ""); + /// Response response = await client.CloseUserConnectionsAsync(""); /// Console.WriteLine(response.Status); /// ]]> - /// This sample shows how to call GrantPermissionAsync with all parameters. + /// This sample shows how to call CloseUserConnectionsAsync with all parameters. /// ", ""); /// - /// Response response = await client.GrantPermissionAsync("", "", ""); + /// Response response = await client.CloseUserConnectionsAsync("", new String[]{""}, ""); /// Console.WriteLine(response.Status); /// ]]> /// - internal virtual async Task GrantPermissionAsync(string permission, string connectionId, string targetName = null, RequestContext context = null) + public virtual async Task CloseUserConnectionsAsync(string userId, IEnumerable excluded = null, string reason = null, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(permission, nameof(permission)); - Argument.AssertNotNullOrEmpty(connectionId, nameof(connectionId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.GrantPermission"); + using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.CloseUserConnections"); scope.Start(); try { - using HttpMessage message = CreateGrantPermissionRequest(permission, connectionId, targetName, context); + using HttpMessage message = CreateCloseUserConnectionsRequest(userId, excluded, reason, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1282,41 +1313,40 @@ internal virtual async Task GrantPermissionAsync(string permission, st } } - /// Grant permission to the connection. - /// The permission: current supported actions are joinLeaveGroup and sendToGroup. Allowed values: "sendToGroup" | "joinLeaveGroup". - /// Target connection Id. - /// Optional. If not set, grant the permission to all the targets. If set, grant the permission to the specific target. The meaning of the target depends on the specific permission. + /// Close connections for the specific user. + /// The user Id. + /// Exclude these connectionIds when closing the connections for the user. + /// The reason closing the client connection. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - /// This sample shows how to call GrantPermission with required parameters. + /// This sample shows how to call CloseUserConnections with required parameters. /// ", ""); /// - /// Response response = client.GrantPermission("", ""); + /// Response response = client.CloseUserConnections(""); /// Console.WriteLine(response.Status); /// ]]> - /// This sample shows how to call GrantPermission with all parameters. + /// This sample shows how to call CloseUserConnections with all parameters. /// ", ""); /// - /// Response response = client.GrantPermission("", "", ""); + /// Response response = client.CloseUserConnections("", new String[]{""}, ""); /// Console.WriteLine(response.Status); /// ]]> /// - internal virtual Response GrantPermission(string permission, string connectionId, string targetName = null, RequestContext context = null) + public virtual Response CloseUserConnections(string userId, IEnumerable excluded = null, string reason = null, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(permission, nameof(permission)); - Argument.AssertNotNullOrEmpty(connectionId, nameof(connectionId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.GrantPermission"); + using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.CloseUserConnections"); scope.Start(); try { - using HttpMessage message = CreateGrantPermissionRequest(permission, connectionId, targetName, context); + using HttpMessage message = CreateCloseUserConnectionsRequest(userId, excluded, reason, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1326,41 +1356,36 @@ internal virtual Response GrantPermission(string permission, string connectionId } } - /// Revoke permission for the connection. - /// The permission: current supported actions are joinLeaveGroup and sendToGroup. Allowed values: "sendToGroup" | "joinLeaveGroup". - /// Target connection Id. - /// Optional. If not set, revoke the permission for all targets. If set, revoke the permission for the specific target. The meaning of the target depends on the specific permission. + /// Send content inside request body to the specific user. + /// The user Id. + /// The content to send as the body of the request. Details of the request body schema are in the Remarks section below. + /// Upload file type. Allowed values: "application/json" | "application/octet-stream" | "text/plain". /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - /// This sample shows how to call RevokePermissionAsync with required parameters. + /// This sample shows how to call SendToUserAsync with required parameters and request content. /// ", ""); /// - /// Response response = await client.RevokePermissionAsync("", ""); - /// Console.WriteLine(response.Status); - /// ]]> - /// This sample shows how to call RevokePermissionAsync with all parameters. - /// ", ""); + /// var data = File.OpenRead(""); /// - /// Response response = await client.RevokePermissionAsync("", "", ""); + /// Response response = await client.SendToUserAsync("", RequestContent.Create(data), ContentType.ApplicationOctetStream); /// Console.WriteLine(response.Status); /// ]]> /// - internal virtual async Task RevokePermissionAsync(string permission, string connectionId, string targetName = null, RequestContext context = null) + public virtual async Task SendToUserAsync(string userId, RequestContent content, ContentType contentType, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(permission, nameof(permission)); - Argument.AssertNotNullOrEmpty(connectionId, nameof(connectionId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.RevokePermission"); + using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.SendToUser"); scope.Start(); try { - using HttpMessage message = CreateRevokePermissionRequest(permission, connectionId, targetName, context); + using HttpMessage message = CreateSendToUserRequest(userId, content, contentType, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1370,41 +1395,36 @@ internal virtual async Task RevokePermissionAsync(string permission, s } } - /// Revoke permission for the connection. - /// The permission: current supported actions are joinLeaveGroup and sendToGroup. Allowed values: "sendToGroup" | "joinLeaveGroup". - /// Target connection Id. - /// Optional. If not set, revoke the permission for all targets. If set, revoke the permission for the specific target. The meaning of the target depends on the specific permission. + /// Send content inside request body to the specific user. + /// The user Id. + /// The content to send as the body of the request. Details of the request body schema are in the Remarks section below. + /// Upload file type. Allowed values: "application/json" | "application/octet-stream" | "text/plain". /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - /// This sample shows how to call RevokePermission with required parameters. + /// This sample shows how to call SendToUser with required parameters and request content. /// ", ""); /// - /// Response response = client.RevokePermission("", ""); - /// Console.WriteLine(response.Status); - /// ]]> - /// This sample shows how to call RevokePermission with all parameters. - /// ", ""); + /// var data = File.OpenRead(""); /// - /// Response response = client.RevokePermission("", "", ""); + /// Response response = client.SendToUser("", RequestContent.Create(data), ContentType.ApplicationOctetStream); /// Console.WriteLine(response.Status); /// ]]> /// - internal virtual Response RevokePermission(string permission, string connectionId, string targetName = null, RequestContext context = null) + public virtual Response SendToUser(string userId, RequestContent content, ContentType contentType, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(permission, nameof(permission)); - Argument.AssertNotNullOrEmpty(connectionId, nameof(connectionId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.RevokePermission"); + using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.SendToUser"); scope.Start(); try { - using HttpMessage message = CreateRevokePermissionRequest(permission, connectionId, targetName, context); + using HttpMessage message = CreateSendToUserRequest(userId, content, contentType, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1414,41 +1434,31 @@ internal virtual Response RevokePermission(string permission, string connectionI } } - /// Check if a connection has permission to the specified action. - /// The permission: current supported actions are joinLeaveGroup and sendToGroup. Allowed values: "sendToGroup" | "joinLeaveGroup". - /// Target connection Id. - /// Optional. If not set, get the permission for all targets. If set, get the permission for the specific target. The meaning of the target depends on the specific permission. + /// Remove a user from all groups. + /// Target user Id. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - /// This sample shows how to call CheckPermissionAsync with required parameters. - /// ", ""); - /// - /// Response response = await client.CheckPermissionAsync("", ""); - /// Console.WriteLine(response.Status); - /// ]]> - /// This sample shows how to call CheckPermissionAsync with all parameters. + /// This sample shows how to call RemoveUserFromAllGroupsAsync with required parameters. /// ", ""); /// - /// Response response = await client.CheckPermissionAsync("", "", ""); + /// Response response = await client.RemoveUserFromAllGroupsAsync(""); /// Console.WriteLine(response.Status); /// ]]> /// - internal virtual async Task CheckPermissionAsync(string permission, string connectionId, string targetName = null, RequestContext context = null) + public virtual async Task RemoveUserFromAllGroupsAsync(string userId, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(permission, nameof(permission)); - Argument.AssertNotNullOrEmpty(connectionId, nameof(connectionId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.CheckPermission"); + using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.RemoveUserFromAllGroups"); scope.Start(); try { - using HttpMessage message = CreateCheckPermissionRequest(permission, connectionId, targetName, context); + using HttpMessage message = CreateRemoveUserFromAllGroupsRequest(userId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1458,41 +1468,31 @@ internal virtual async Task CheckPermissionAsync(string permission, st } } - /// Check if a connection has permission to the specified action. - /// The permission: current supported actions are joinLeaveGroup and sendToGroup. Allowed values: "sendToGroup" | "joinLeaveGroup". - /// Target connection Id. - /// Optional. If not set, get the permission for all targets. If set, get the permission for the specific target. The meaning of the target depends on the specific permission. + /// Remove a user from all groups. + /// Target user Id. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - /// This sample shows how to call CheckPermission with required parameters. - /// ", ""); - /// - /// Response response = client.CheckPermission("", ""); - /// Console.WriteLine(response.Status); - /// ]]> - /// This sample shows how to call CheckPermission with all parameters. + /// This sample shows how to call RemoveUserFromAllGroups with required parameters. /// ", ""); /// - /// Response response = client.CheckPermission("", "", ""); + /// Response response = client.RemoveUserFromAllGroups(""); /// Console.WriteLine(response.Status); /// ]]> /// - internal virtual Response CheckPermission(string permission, string connectionId, string targetName = null, RequestContext context = null) + public virtual Response RemoveUserFromAllGroups(string userId, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(permission, nameof(permission)); - Argument.AssertNotNullOrEmpty(connectionId, nameof(connectionId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.CheckPermission"); + using var scope = ClientDiagnostics.CreateScope("WebPubSubServiceClient.RemoveUserFromAllGroups"); scope.Start(); try { - using HttpMessage message = CreateCheckPermissionRequest(permission, connectionId, targetName, context); + using HttpMessage message = CreateRemoveUserFromAllGroupsRequest(userId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1502,30 +1502,26 @@ internal virtual Response CheckPermission(string permission, string connectionId } } - internal HttpMessage CreateGenerateClientTokenImplRequest(string userId, IEnumerable role, int? minutesToExpire, RequestContext context) + internal HttpMessage CreateCloseAllConnectionsRequest(IEnumerable excluded, string reason, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var message = _pipeline.CreateMessage(context, ResponseClassifier204); var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.AppendRaw(_endpoint, false); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); - uri.AppendPath("/:generateToken", false); - if (userId != null) - { - uri.AppendQuery("userId", userId, true); - } - if (role != null) + uri.AppendPath("/:closeConnections", false); + if (excluded != null) { - foreach (var param in role) + foreach (var param in excluded) { - uri.AppendQuery("role", param, true); + uri.AppendQuery("excluded", param, true); } } - if (minutesToExpire != null) + if (reason != null) { - uri.AppendQuery("minutesToExpire", minutesToExpire.Value, true); + uri.AppendQuery("reason", reason, true); } uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; @@ -1533,26 +1529,30 @@ internal HttpMessage CreateGenerateClientTokenImplRequest(string userId, IEnumer return message; } - internal HttpMessage CreateCloseAllConnectionsRequest(IEnumerable excluded, string reason, RequestContext context) + internal HttpMessage CreateGenerateClientTokenImplRequest(string userId, IEnumerable role, int? minutesToExpire, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.AppendRaw(_endpoint, false); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); - uri.AppendPath("/:closeConnections", false); - if (excluded != null) + uri.AppendPath("/:generateToken", false); + if (userId != null) { - foreach (var param in excluded) + uri.AppendQuery("userId", userId, true); + } + if (role != null) + { + foreach (var param in role) { - uri.AppendQuery("excluded", param, true); + uri.AppendQuery("role", param, true); } } - if (reason != null) + if (minutesToExpire != null) { - uri.AppendQuery("reason", reason, true); + uri.AppendQuery("minutesToExpire", minutesToExpire.Value, true); } uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; @@ -1585,41 +1585,40 @@ internal HttpMessage CreateSendToAllRequest(RequestContent content, ContentType return message; } - internal HttpMessage CreateConnectionExistsImplRequest(string connectionId, RequestContext context) + internal HttpMessage CreateCloseConnectionRequest(string connectionId, string reason, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier200404); + var message = _pipeline.CreateMessage(context, ResponseClassifier204); var request = message.Request; - request.Method = RequestMethod.Head; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.AppendRaw(_endpoint, false); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); uri.AppendPath("/connections/", false); uri.AppendPath(connectionId, true); + if (reason != null) + { + uri.AppendQuery("reason", reason, true); + } uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json, text/json"); return message; } - internal HttpMessage CreateCloseConnectionRequest(string connectionId, string reason, RequestContext context) + internal HttpMessage CreateConnectionExistsImplRequest(string connectionId, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var message = _pipeline.CreateMessage(context, ResponseClassifier200404); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Head; var uri = new RawRequestUriBuilder(); uri.AppendRaw(_endpoint, false); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); uri.AppendPath("/connections/", false); uri.AppendPath(connectionId, true); - if (reason != null) - { - uri.AppendQuery("reason", reason, true); - } uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; - request.Headers.Add("Accept", "application/json, text/json"); return message; } @@ -1656,7 +1655,6 @@ internal HttpMessage CreateGroupExistsImplRequest(string group, RequestContext c uri.AppendPath(group, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; - request.Headers.Add("Accept", "application/json, text/json"); return message; } @@ -1716,11 +1714,11 @@ internal HttpMessage CreateSendToGroupRequest(string group, RequestContent conte return message; } - internal HttpMessage CreateAddConnectionToGroupRequest(string group, string connectionId, RequestContext context) + internal HttpMessage CreateRemoveConnectionFromGroupRequest(string group, string connectionId, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier200404); + var message = _pipeline.CreateMessage(context, ResponseClassifier204); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.AppendRaw(_endpoint, false); uri.AppendPath("/api/hubs/", false); @@ -1735,11 +1733,11 @@ internal HttpMessage CreateAddConnectionToGroupRequest(string group, string conn return message; } - internal HttpMessage CreateRemoveConnectionFromGroupRequest(string group, string connectionId, RequestContext context) + internal HttpMessage CreateAddConnectionToGroupRequest(string group, string connectionId, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.AppendRaw(_endpoint, false); uri.AppendPath("/api/hubs/", false); @@ -1754,152 +1752,158 @@ internal HttpMessage CreateRemoveConnectionFromGroupRequest(string group, string return message; } - internal HttpMessage CreateUserExistsImplRequest(string userId, RequestContext context) + internal HttpMessage CreateRevokePermissionRequest(string permission, string connectionId, string targetName, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier200404); + var message = _pipeline.CreateMessage(context, ResponseClassifier204); var request = message.Request; - request.Method = RequestMethod.Head; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.AppendRaw(_endpoint, false); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userId, true); + uri.AppendPath("/permissions/", false); + uri.AppendPath(permission, true); + uri.AppendPath("/connections/", false); + uri.AppendPath(connectionId, true); + if (targetName != null) + { + uri.AppendQuery("targetName", targetName, true); + } uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json, text/json"); return message; } - internal HttpMessage CreateCloseUserConnectionsRequest(string userId, IEnumerable excluded, string reason, RequestContext context) + internal HttpMessage CreateCheckPermissionRequest(string permission, string connectionId, string targetName, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var message = _pipeline.CreateMessage(context, ResponseClassifier200404); var request = message.Request; - request.Method = RequestMethod.Post; + request.Method = RequestMethod.Head; var uri = new RawRequestUriBuilder(); uri.AppendRaw(_endpoint, false); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userId, true); - uri.AppendPath("/:closeConnections", false); - if (excluded != null) - { - foreach (var param in excluded) - { - uri.AppendQuery("excluded", param, true); - } - } - if (reason != null) + uri.AppendPath("/permissions/", false); + uri.AppendPath(permission, true); + uri.AppendPath("/connections/", false); + uri.AppendPath(connectionId, true); + if (targetName != null) { - uri.AppendQuery("reason", reason, true); + uri.AppendQuery("targetName", targetName, true); } uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; - request.Headers.Add("Accept", "application/json, text/json"); return message; } - internal HttpMessage CreateSendToUserRequest(string userId, RequestContent content, ContentType contentType, RequestContext context) + internal HttpMessage CreateGrantPermissionRequest(string permission, string connectionId, string targetName, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier202); + var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; - request.Method = RequestMethod.Post; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.AppendRaw(_endpoint, false); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userId, true); - uri.AppendPath("/:send", false); + uri.AppendPath("/permissions/", false); + uri.AppendPath(permission, true); + uri.AppendPath("/connections/", false); + uri.AppendPath(connectionId, true); + if (targetName != null) + { + uri.AppendQuery("targetName", targetName, true); + } uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json, text/json"); - request.Headers.Add("Content-Type", contentType.ToString()); - request.Content = content; return message; } - internal HttpMessage CreateAddUserToGroupRequest(string userId, string group, RequestContext context) + internal HttpMessage CreateUserExistsImplRequest(string userId, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200404); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Head; var uri = new RawRequestUriBuilder(); uri.AppendRaw(_endpoint, false); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); uri.AppendPath("/users/", false); uri.AppendPath(userId, true); - uri.AppendPath("/groups/", false); - uri.AppendPath(group, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; - request.Headers.Add("Accept", "application/json, text/json"); return message; } - internal HttpMessage CreateRemoveUserFromGroupRequest(string userId, string group, RequestContext context) + internal HttpMessage CreateCloseUserConnectionsRequest(string userId, IEnumerable excluded, string reason, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier204); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.AppendRaw(_endpoint, false); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); uri.AppendPath("/users/", false); uri.AppendPath(userId, true); - uri.AppendPath("/groups/", false); - uri.AppendPath(group, true); + uri.AppendPath("/:closeConnections", false); + if (excluded != null) + { + foreach (var param in excluded) + { + uri.AppendQuery("excluded", param, true); + } + } + if (reason != null) + { + uri.AppendQuery("reason", reason, true); + } uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json, text/json"); return message; } - internal HttpMessage CreateRemoveUserFromAllGroupsRequest(string userId, RequestContext context) + internal HttpMessage CreateSendToUserRequest(string userId, RequestContent content, ContentType contentType, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var message = _pipeline.CreateMessage(context, ResponseClassifier202); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.AppendRaw(_endpoint, false); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); uri.AppendPath("/users/", false); uri.AppendPath(userId, true); - uri.AppendPath("/groups", false); + uri.AppendPath("/:send", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json, text/json"); + request.Headers.Add("Content-Type", contentType.ToString()); + request.Content = content; return message; } - internal HttpMessage CreateGrantPermissionRequest(string permission, string connectionId, string targetName, RequestContext context) + internal HttpMessage CreateRemoveUserFromAllGroupsRequest(string userId, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var message = _pipeline.CreateMessage(context, ResponseClassifier204); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.AppendRaw(_endpoint, false); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); - uri.AppendPath("/permissions/", false); - uri.AppendPath(permission, true); - uri.AppendPath("/connections/", false); - uri.AppendPath(connectionId, true); - if (targetName != null) - { - uri.AppendQuery("targetName", targetName, true); - } + uri.AppendPath("/users/", false); + uri.AppendPath(userId, true); + uri.AppendPath("/groups", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json, text/json"); return message; } - internal HttpMessage CreateRevokePermissionRequest(string permission, string connectionId, string targetName, RequestContext context) + internal HttpMessage CreateRemoveUserFromGroupRequest(string userId, string group, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier204); var request = message.Request; @@ -1908,47 +1912,39 @@ internal HttpMessage CreateRevokePermissionRequest(string permission, string con uri.AppendRaw(_endpoint, false); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); - uri.AppendPath("/permissions/", false); - uri.AppendPath(permission, true); - uri.AppendPath("/connections/", false); - uri.AppendPath(connectionId, true); - if (targetName != null) - { - uri.AppendQuery("targetName", targetName, true); - } + uri.AppendPath("/users/", false); + uri.AppendPath(userId, true); + uri.AppendPath("/groups/", false); + uri.AppendPath(group, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json, text/json"); return message; } - internal HttpMessage CreateCheckPermissionRequest(string permission, string connectionId, string targetName, RequestContext context) + internal HttpMessage CreateAddUserToGroupRequest(string userId, string group, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier200404); + var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; - request.Method = RequestMethod.Head; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.AppendRaw(_endpoint, false); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); - uri.AppendPath("/permissions/", false); - uri.AppendPath(permission, true); - uri.AppendPath("/connections/", false); - uri.AppendPath(connectionId, true); - if (targetName != null) - { - uri.AppendQuery("targetName", targetName, true); - } + uri.AppendPath("/users/", false); + uri.AppendPath(userId, true); + uri.AppendPath("/groups/", false); + uri.AppendPath(group, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json, text/json"); return message; } - private static ResponseClassifier _responseClassifier200; - private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); private static ResponseClassifier _responseClassifier204; private static ResponseClassifier ResponseClassifier204 => _responseClassifier204 ??= new StatusCodeClassifier(stackalloc ushort[] { 204 }); + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); private static ResponseClassifier _responseClassifier202; private static ResponseClassifier ResponseClassifier202 => _responseClassifier202 ??= new StatusCodeClassifier(stackalloc ushort[] { 202 }); private static ResponseClassifier _responseClassifier200404; diff --git a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/autorest.md b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/autorest.md index 0c1e906f63b8..38d72726fc80 100644 --- a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/autorest.md +++ b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/autorest.md @@ -8,8 +8,8 @@ Run `dotnet build /t:GenerateCode` to generate code. ## Swagger Source(s) ``` yaml title: WebPubSubServiceClient -input-file: -- https://github.com/Azure/azure-rest-api-specs/blob/39c7d63c21b9a29efe3907d9b949d1c77b021907/specification/webpubsub/data-plane/WebPubSub/stable/2021-10-01/webpubsub.json +require: +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/webpubsub/data-plane/readme.md credential-types: AzureKeyCredential credential-header-name: Ocp-Apim-Subscription-Key ``` @@ -271,3 +271,4 @@ directive: where: $.paths["/api/hubs/{hub}/users/{userId}/:closeConnections"].post.parameters["0"] transform: $["x-ms-parameter-location"] = "client" ``` +