From 06f4b352b94f94fdad14f95055e6386e014ac3c1 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 15 Jun 2023 09:11:45 +0000 Subject: [PATCH] CodeGen from PR 23927 in Azure/azure-rest-api-specs Merge efe2ec0e7099d1815b97bb003b6ad40a935370af into ced38c4a96ec198d544b115f7d3627b4c63e0883 --- .../src/Generated/Docs/HealthApiClient.xml | 6 +- .../src/Generated/Docs/WebPubSubClient.xml | 121 +++++++++ .../Generated/Docs/WebPubSubServiceClient.xml | 162 ++++++++---- .../src/Generated/HealthApiClient.cs | 8 +- .../src/Generated/WebPubSubClient.cs | 244 ++++++++++++++++++ .../src/Generated/WebPubSubServiceClient.cs | 133 ++++++---- .../Azure.Messaging.WebPubSub/src/autorest.md | 5 +- .../Samples/Samples_HealthApiClient.cs | 12 +- .../Samples/Samples_WebPubSubClient.cs | 150 +++++++++++ .../Samples/Samples_WebPubSubServiceClient.cs | 160 ++++++++---- 10 files changed, 831 insertions(+), 170 deletions(-) create mode 100644 sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/Docs/WebPubSubClient.xml create mode 100644 sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/WebPubSubClient.cs create mode 100644 sdk/webpubsub/Azure.Messaging.WebPubSub/tests/Generated/Samples/Samples_WebPubSubClient.cs diff --git a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/Docs/HealthApiClient.xml b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/Docs/HealthApiClient.xml index 7cfbd124a805..f51023c1c30d 100644 --- a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/Docs/HealthApiClient.xml +++ b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/Docs/HealthApiClient.xml @@ -5,7 +5,8 @@ This sample shows how to call GetServiceStatusAsync. "); +var endpoint = new Uri(""); +var client = new HealthApiClient(endpoint); Response response = await client.GetServiceStatusAsync(); Console.WriteLine(response.Status); @@ -16,7 +17,8 @@ Console.WriteLine(response.Status); This sample shows how to call GetServiceStatus. "); +var endpoint = new Uri(""); +var client = new HealthApiClient(endpoint); Response response = client.GetServiceStatus(); Console.WriteLine(response.Status); diff --git a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/Docs/WebPubSubClient.xml b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/Docs/WebPubSubClient.xml new file mode 100644 index 000000000000..e8c5c4c4c748 --- /dev/null +++ b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/Docs/WebPubSubClient.xml @@ -0,0 +1,121 @@ + + + + + +This sample shows how to call AddConnectionsToGroupsAsync with required parameters. +"); +var client = new WebPubSubClient(endpoint); + +var data = new {}; + +Response response = await client.AddConnectionsToGroupsAsync("", RequestContent.Create(data)); +Console.WriteLine(response.Status); +]]> +This sample shows how to call AddConnectionsToGroupsAsync with all parameters and request content. +"); +var client = new WebPubSubClient(endpoint); + +var data = new { + groups = new[] { + "" + }, + filter = "", +}; + +Response response = await client.AddConnectionsToGroupsAsync("", RequestContent.Create(data)); +Console.WriteLine(response.Status); +]]> + + + + +This sample shows how to call AddConnectionsToGroups with required parameters. +"); +var client = new WebPubSubClient(endpoint); + +var data = new {}; + +Response response = client.AddConnectionsToGroups("", RequestContent.Create(data)); +Console.WriteLine(response.Status); +]]> +This sample shows how to call AddConnectionsToGroups with all parameters and request content. +"); +var client = new WebPubSubClient(endpoint); + +var data = new { + groups = new[] { + "" + }, + filter = "", +}; + +Response response = client.AddConnectionsToGroups("", RequestContent.Create(data)); +Console.WriteLine(response.Status); +]]> + + + + +This sample shows how to call RemoveConnectionsFromGroupsAsync with required parameters. +"); +var client = new WebPubSubClient(endpoint); + +var data = new {}; + +Response response = await client.RemoveConnectionsFromGroupsAsync("", RequestContent.Create(data)); +Console.WriteLine(response.Status); +]]> +This sample shows how to call RemoveConnectionsFromGroupsAsync with all parameters and request content. +"); +var client = new WebPubSubClient(endpoint); + +var data = new { + groups = new[] { + "" + }, + filter = "", +}; + +Response response = await client.RemoveConnectionsFromGroupsAsync("", RequestContent.Create(data)); +Console.WriteLine(response.Status); +]]> + + + + +This sample shows how to call RemoveConnectionsFromGroups with required parameters. +"); +var client = new WebPubSubClient(endpoint); + +var data = new {}; + +Response response = client.RemoveConnectionsFromGroups("", RequestContent.Create(data)); +Console.WriteLine(response.Status); +]]> +This sample shows how to call RemoveConnectionsFromGroups with all parameters and request content. +"); +var client = new WebPubSubClient(endpoint); + +var data = new { + groups = new[] { + "" + }, + filter = "", +}; + +Response response = client.RemoveConnectionsFromGroups("", RequestContent.Create(data)); +Console.WriteLine(response.Status); +]]> + + + + \ No newline at end of file diff --git a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/Docs/WebPubSubServiceClient.xml b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/Docs/WebPubSubServiceClient.xml index fb481e3e8639..222c56dde88b 100644 --- a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/Docs/WebPubSubServiceClient.xml +++ b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/Docs/WebPubSubServiceClient.xml @@ -5,14 +5,16 @@ This sample shows how to call CloseAllConnectionsAsync. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); Response response = await client.CloseAllConnectionsAsync(); Console.WriteLine(response.Status); ]]> This sample shows how to call CloseAllConnectionsAsync with all parameters. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); Response response = await client.CloseAllConnectionsAsync(new String[]{""}, ""); Console.WriteLine(response.Status); @@ -23,14 +25,16 @@ Console.WriteLine(response.Status); This sample shows how to call CloseAllConnections. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); Response response = client.CloseAllConnections(); Console.WriteLine(response.Status); ]]> This sample shows how to call CloseAllConnections with all parameters. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); Response response = client.CloseAllConnections(new String[]{""}, ""); Console.WriteLine(response.Status); @@ -41,11 +45,12 @@ Console.WriteLine(response.Status); - + This sample shows how to call SendToAllAsync with required parameters and request content. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); @@ -54,20 +59,22 @@ Console.WriteLine(response.Status); ]]> This sample shows how to call SendToAllAsync with all parameters and request content. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); -Response response = await client.SendToAllAsync(RequestContent.Create(data), ContentType.ApplicationOctetStream, new String[]{""}, ""); +Response response = await client.SendToAllAsync(RequestContent.Create(data), ContentType.ApplicationOctetStream, new String[]{""}, "", 1234); Console.WriteLine(response.Status); ]]> - + This sample shows how to call SendToAll with required parameters and request content. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); @@ -76,11 +83,12 @@ Console.WriteLine(response.Status); ]]> This sample shows how to call SendToAll with all parameters and request content. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); -Response response = client.SendToAll(RequestContent.Create(data), ContentType.ApplicationOctetStream, new String[]{""}, ""); +Response response = client.SendToAll(RequestContent.Create(data), ContentType.ApplicationOctetStream, new String[]{""}, "", 1234); Console.WriteLine(response.Status); ]]> @@ -89,14 +97,16 @@ Console.WriteLine(response.Status); This sample shows how to call CloseConnectionAsync with required parameters. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); Response response = await client.CloseConnectionAsync(""); Console.WriteLine(response.Status); ]]> This sample shows how to call CloseConnectionAsync with all parameters. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); Response response = await client.CloseConnectionAsync("", ""); Console.WriteLine(response.Status); @@ -107,14 +117,16 @@ Console.WriteLine(response.Status); This sample shows how to call CloseConnection with required parameters. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); Response response = client.CloseConnection(""); Console.WriteLine(response.Status); ]]> This sample shows how to call CloseConnection with all parameters. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); Response response = client.CloseConnection("", ""); Console.WriteLine(response.Status); @@ -125,37 +137,60 @@ Console.WriteLine(response.Status); - + This sample shows how to call SendToConnectionAsync with required parameters and request content. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); Response response = await client.SendToConnectionAsync("", RequestContent.Create(data), ContentType.ApplicationOctetStream); Console.WriteLine(response.Status); ]]> +This sample shows how to call SendToConnectionAsync with all parameters and request content. +"); +var client = new WebPubSubServiceClient(endpoint, ""); + +var data = File.OpenRead(""); + +Response response = await client.SendToConnectionAsync("", RequestContent.Create(data), ContentType.ApplicationOctetStream, 1234); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call SendToConnection with required parameters and request content. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); Response response = client.SendToConnection("", RequestContent.Create(data), ContentType.ApplicationOctetStream); Console.WriteLine(response.Status); ]]> +This sample shows how to call SendToConnection with all parameters and request content. +"); +var client = new WebPubSubServiceClient(endpoint, ""); + +var data = File.OpenRead(""); + +Response response = client.SendToConnection("", RequestContent.Create(data), ContentType.ApplicationOctetStream, 1234); +Console.WriteLine(response.Status); +]]> This sample shows how to call RemoveConnectionFromAllGroupsAsync with required parameters. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); Response response = await client.RemoveConnectionFromAllGroupsAsync(""); Console.WriteLine(response.Status); @@ -166,7 +201,8 @@ Console.WriteLine(response.Status); This sample shows how to call RemoveConnectionFromAllGroups with required parameters. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); Response response = client.RemoveConnectionFromAllGroups(""); Console.WriteLine(response.Status); @@ -181,14 +217,16 @@ Console.WriteLine(response.Status); This sample shows how to call CloseGroupConnectionsAsync with required parameters. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); Response response = await client.CloseGroupConnectionsAsync(""); Console.WriteLine(response.Status); ]]> This sample shows how to call CloseGroupConnectionsAsync with all parameters. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); Response response = await client.CloseGroupConnectionsAsync("", new String[]{""}, ""); Console.WriteLine(response.Status); @@ -199,25 +237,28 @@ Console.WriteLine(response.Status); This sample shows how to call CloseGroupConnections with required parameters. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); Response response = client.CloseGroupConnections(""); Console.WriteLine(response.Status); ]]> This sample shows how to call CloseGroupConnections with all parameters. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); Response response = client.CloseGroupConnections("", new String[]{""}, ""); Console.WriteLine(response.Status); ]]> - + This sample shows how to call SendToGroupAsync with required parameters and request content. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); @@ -226,20 +267,22 @@ Console.WriteLine(response.Status); ]]> This sample shows how to call SendToGroupAsync with all parameters and request content. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); -Response response = await client.SendToGroupAsync("", RequestContent.Create(data), ContentType.ApplicationOctetStream, new String[]{""}, ""); +Response response = await client.SendToGroupAsync("", RequestContent.Create(data), ContentType.ApplicationOctetStream, new String[]{""}, "", 1234); Console.WriteLine(response.Status); ]]> - + This sample shows how to call SendToGroup with required parameters and request content. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); @@ -248,11 +291,12 @@ Console.WriteLine(response.Status); ]]> This sample shows how to call SendToGroup with all parameters and request content. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); -Response response = client.SendToGroup("", RequestContent.Create(data), ContentType.ApplicationOctetStream, new String[]{""}, ""); +Response response = client.SendToGroup("", RequestContent.Create(data), ContentType.ApplicationOctetStream, new String[]{""}, "", 1234); Console.WriteLine(response.Status); ]]> @@ -261,7 +305,8 @@ Console.WriteLine(response.Status); This sample shows how to call RemoveConnectionFromGroupAsync with required parameters. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); Response response = await client.RemoveConnectionFromGroupAsync("", ""); Console.WriteLine(response.Status); @@ -272,7 +317,8 @@ Console.WriteLine(response.Status); This sample shows how to call RemoveConnectionFromGroup with required parameters. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); Response response = client.RemoveConnectionFromGroup("", ""); Console.WriteLine(response.Status); @@ -283,7 +329,8 @@ Console.WriteLine(response.Status); This sample shows how to call AddConnectionToGroupAsync with required parameters. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); Response response = await client.AddConnectionToGroupAsync("", ""); Console.WriteLine(response.Status); @@ -294,7 +341,8 @@ Console.WriteLine(response.Status); This sample shows how to call AddConnectionToGroup with required parameters. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); Response response = client.AddConnectionToGroup("", ""); Console.WriteLine(response.Status); @@ -321,14 +369,16 @@ Console.WriteLine(response.Status); This sample shows how to call CloseUserConnectionsAsync with required parameters. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); Response response = await client.CloseUserConnectionsAsync(""); Console.WriteLine(response.Status); ]]> This sample shows how to call CloseUserConnectionsAsync with all parameters. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); Response response = await client.CloseUserConnectionsAsync("", new String[]{""}, ""); Console.WriteLine(response.Status); @@ -339,25 +389,28 @@ Console.WriteLine(response.Status); This sample shows how to call CloseUserConnections with required parameters. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); Response response = client.CloseUserConnections(""); Console.WriteLine(response.Status); ]]> This sample shows how to call CloseUserConnections with all parameters. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); Response response = client.CloseUserConnections("", new String[]{""}, ""); Console.WriteLine(response.Status); ]]> - + This sample shows how to call SendToUserAsync with required parameters and request content. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); @@ -366,20 +419,22 @@ Console.WriteLine(response.Status); ]]> This sample shows how to call SendToUserAsync with all parameters and request content. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); -Response response = await client.SendToUserAsync("", RequestContent.Create(data), ContentType.ApplicationOctetStream, ""); +Response response = await client.SendToUserAsync("", RequestContent.Create(data), ContentType.ApplicationOctetStream, "", 1234); Console.WriteLine(response.Status); ]]> - + This sample shows how to call SendToUser with required parameters and request content. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); @@ -388,11 +443,12 @@ Console.WriteLine(response.Status); ]]> This sample shows how to call SendToUser with all parameters and request content. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); -Response response = client.SendToUser("", RequestContent.Create(data), ContentType.ApplicationOctetStream, ""); +Response response = client.SendToUser("", RequestContent.Create(data), ContentType.ApplicationOctetStream, "", 1234); Console.WriteLine(response.Status); ]]> @@ -401,7 +457,8 @@ Console.WriteLine(response.Status); This sample shows how to call RemoveUserFromAllGroupsAsync with required parameters. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); Response response = await client.RemoveUserFromAllGroupsAsync(""); Console.WriteLine(response.Status); @@ -412,7 +469,8 @@ Console.WriteLine(response.Status); This sample shows how to call RemoveUserFromAllGroups with required parameters. ", ""); +var endpoint = new Uri(""); +var client = new WebPubSubServiceClient(endpoint, ""); Response response = client.RemoveUserFromAllGroups(""); Console.WriteLine(response.Status); diff --git a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/HealthApiClient.cs b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/HealthApiClient.cs index aafc0300af45..4fd6c9d84523 100644 --- a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/HealthApiClient.cs +++ b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/HealthApiClient.cs @@ -18,7 +18,7 @@ namespace Azure.Messaging.WebPubSub internal partial class HealthApiClient { private readonly HttpPipeline _pipeline; - private readonly string _endpoint; + private readonly Uri _endpoint; private readonly string _apiVersion; /// The ClientDiagnostics is used to provide tracing support for the client library. @@ -35,7 +35,7 @@ protected HealthApiClient() /// Initializes a new instance of HealthApiClient. /// HTTP or HTTPS endpoint for the Web PubSub service instance. /// is null. - public HealthApiClient(string endpoint) : this(endpoint, new WebPubSubServiceClientOptions()) + public HealthApiClient(Uri endpoint) : this(endpoint, new WebPubSubServiceClientOptions()) { } @@ -43,7 +43,7 @@ protected HealthApiClient() /// HTTP or HTTPS endpoint for the Web PubSub service instance. /// The options for configuring the client. /// is null. - public HealthApiClient(string endpoint, WebPubSubServiceClientOptions options) + public HealthApiClient(Uri endpoint, WebPubSubServiceClientOptions options) { Argument.AssertNotNull(endpoint, nameof(endpoint)); options ??= new WebPubSubServiceClientOptions(); @@ -120,7 +120,7 @@ internal HttpMessage CreateGetServiceStatusRequest(RequestContext context) var request = message.Request; request.Method = RequestMethod.Head; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/api/health", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; diff --git a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/WebPubSubClient.cs b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/WebPubSubClient.cs new file mode 100644 index 000000000000..ba6e26990385 --- /dev/null +++ b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/WebPubSubClient.cs @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Messaging.WebPubSub +{ + // Data plane generated client. + /// The WebPubSub service client. + public partial class WebPubSubClient + { + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of WebPubSubClient for mocking. + protected WebPubSubClient() + { + } + + /// Initializes a new instance of WebPubSubClient. + /// HTTP or HTTPS endpoint for the Web PubSub service instance. + /// is null. + public WebPubSubClient(Uri endpoint) : this(endpoint, new WebPubSubServiceClientOptions()) + { + } + + /// Initializes a new instance of WebPubSubClient. + /// HTTP or HTTPS endpoint for the Web PubSub service instance. + /// The options for configuring the client. + /// is null. + public WebPubSubClient(Uri endpoint, WebPubSubServiceClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + options ??= new WebPubSubServiceClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), Array.Empty(), new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; + } + + /// + /// [Protocol Method] Add filtered connections to multiple groups. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore. + /// The content to send as the body of the request. + /// 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. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task AddConnectionsToGroupsAsync(string hub, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(hub, nameof(hub)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("WebPubSubClient.AddConnectionsToGroups"); + scope.Start(); + try + { + using HttpMessage message = CreateAddConnectionsToGroupsRequest(hub, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Add filtered connections to multiple groups. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore. + /// The content to send as the body of the request. + /// 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. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response AddConnectionsToGroups(string hub, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(hub, nameof(hub)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("WebPubSubClient.AddConnectionsToGroups"); + scope.Start(); + try + { + using HttpMessage message = CreateAddConnectionsToGroupsRequest(hub, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Remove filtered connections from multiple groups. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore. + /// The content to send as the body of the request. + /// 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. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task RemoveConnectionsFromGroupsAsync(string hub, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(hub, nameof(hub)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("WebPubSubClient.RemoveConnectionsFromGroups"); + scope.Start(); + try + { + using HttpMessage message = CreateRemoveConnectionsFromGroupsRequest(hub, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Remove filtered connections from multiple groups. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore. + /// The content to send as the body of the request. + /// 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. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response RemoveConnectionsFromGroups(string hub, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(hub, nameof(hub)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("WebPubSubClient.RemoveConnectionsFromGroups"); + scope.Start(); + try + { + using HttpMessage message = CreateRemoveConnectionsFromGroupsRequest(hub, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + internal HttpMessage CreateAddConnectionsToGroupsRequest(string hub, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/api/hubs/", false); + uri.AppendPath(hub, true); + uri.AppendPath("/:addToGroups", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateRemoveConnectionsFromGroupsRequest(string hub, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/api/hubs/", false); + uri.AppendPath(hub, true); + uri.AppendPath("/:removeFromGroups", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + } +} diff --git a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/WebPubSubServiceClient.cs b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/WebPubSubServiceClient.cs index e463b9b2b402..d5736616eccd 100644 --- a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/WebPubSubServiceClient.cs +++ b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/WebPubSubServiceClient.cs @@ -19,7 +19,7 @@ namespace Azure.Messaging.WebPubSub public partial class WebPubSubServiceClient { private readonly HttpPipeline _pipeline; - private readonly string _endpoint; + private readonly Uri _endpoint; private readonly string _hub; private readonly string _apiVersion; @@ -34,6 +34,15 @@ protected WebPubSubServiceClient() { } + /// Initializes a new instance of WebPubSubServiceClient. + /// HTTP or HTTPS endpoint for the Web PubSub service instance. + /// Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public WebPubSubServiceClient(Uri endpoint, string hub) : this(endpoint, hub, new WebPubSubServiceClientOptions()) + { + } + /// /// [Protocol Method] Close the connections in the hub. /// @@ -180,12 +189,13 @@ internal virtual Response GenerateClientTokenImpl(string userId = null, IEnumera /// Upload file type. Allowed values: "application/json" | "application/octet-stream" | "text/plain". /// Excluded connection Ids. /// Following OData filter syntax to filter out the subscribers receiving the messages. + /// The time-to-live (TTL) value in seconds for messages sent to the service. 0 is the default value, which means the message never expires. 300 is the maximum value. If this parameter is non-zero, messages that are not consumed by the client within the specified TTL will be dropped by the service. This parameter can help when the client's bandwidth is limited. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task SendToAllAsync(RequestContent content, ContentType contentType, IEnumerable excluded = null, string filter = null, RequestContext context = null) + /// + public virtual async Task SendToAllAsync(RequestContent content, ContentType contentType, IEnumerable excluded = null, string filter = null, int? messageTtlSeconds = null, RequestContext context = null) { Argument.AssertNotNull(content, nameof(content)); @@ -193,7 +203,7 @@ public virtual async Task SendToAllAsync(RequestContent content, Conte scope.Start(); try { - using HttpMessage message = CreateSendToAllRequest(content, contentType, excluded, filter, context); + using HttpMessage message = CreateSendToAllRequest(content, contentType, excluded, filter, messageTtlSeconds, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -217,12 +227,13 @@ public virtual async Task SendToAllAsync(RequestContent content, Conte /// Upload file type. Allowed values: "application/json" | "application/octet-stream" | "text/plain". /// Excluded connection Ids. /// Following OData filter syntax to filter out the subscribers receiving the messages. + /// The time-to-live (TTL) value in seconds for messages sent to the service. 0 is the default value, which means the message never expires. 300 is the maximum value. If this parameter is non-zero, messages that are not consumed by the client within the specified TTL will be dropped by the service. This parameter can help when the client's bandwidth is limited. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response SendToAll(RequestContent content, ContentType contentType, IEnumerable excluded = null, string filter = null, RequestContext context = null) + /// + public virtual Response SendToAll(RequestContent content, ContentType contentType, IEnumerable excluded = null, string filter = null, int? messageTtlSeconds = null, RequestContext context = null) { Argument.AssertNotNull(content, nameof(content)); @@ -230,7 +241,7 @@ public virtual Response SendToAll(RequestContent content, ContentType contentTyp scope.Start(); try { - using HttpMessage message = CreateSendToAllRequest(content, contentType, excluded, filter, context); + using HttpMessage message = CreateSendToAllRequest(content, contentType, excluded, filter, messageTtlSeconds, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -395,13 +406,14 @@ internal virtual Response ConnectionExistsImpl(string connectionId, RequestConte /// The connection Id. /// The content to send as the body of the request. /// Upload file type. Allowed values: "application/json" | "application/octet-stream" | "text/plain". + /// The time-to-live (TTL) value in seconds for messages sent to the service. 0 is the default value, which means the message never expires. 300 is the maximum value. If this parameter is non-zero, messages that are not consumed by the client within the specified TTL will be dropped by the service. This parameter can help when the client's bandwidth is limited. /// 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. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task SendToConnectionAsync(string connectionId, RequestContent content, ContentType contentType, RequestContext context = null) + /// + public virtual async Task SendToConnectionAsync(string connectionId, RequestContent content, ContentType contentType, int? messageTtlSeconds = null, RequestContext context = null) { Argument.AssertNotNullOrEmpty(connectionId, nameof(connectionId)); Argument.AssertNotNull(content, nameof(content)); @@ -410,7 +422,7 @@ public virtual async Task SendToConnectionAsync(string connectionId, R scope.Start(); try { - using HttpMessage message = CreateSendToConnectionRequest(connectionId, content, contentType, context); + using HttpMessage message = CreateSendToConnectionRequest(connectionId, content, contentType, messageTtlSeconds, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -433,13 +445,14 @@ public virtual async Task SendToConnectionAsync(string connectionId, R /// The connection Id. /// The content to send as the body of the request. /// Upload file type. Allowed values: "application/json" | "application/octet-stream" | "text/plain". + /// The time-to-live (TTL) value in seconds for messages sent to the service. 0 is the default value, which means the message never expires. 300 is the maximum value. If this parameter is non-zero, messages that are not consumed by the client within the specified TTL will be dropped by the service. This parameter can help when the client's bandwidth is limited. /// 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. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response SendToConnection(string connectionId, RequestContent content, ContentType contentType, RequestContext context = null) + /// + public virtual Response SendToConnection(string connectionId, RequestContent content, ContentType contentType, int? messageTtlSeconds = null, RequestContext context = null) { Argument.AssertNotNullOrEmpty(connectionId, nameof(connectionId)); Argument.AssertNotNull(content, nameof(content)); @@ -448,7 +461,7 @@ public virtual Response SendToConnection(string connectionId, RequestContent con scope.Start(); try { - using HttpMessage message = CreateSendToConnectionRequest(connectionId, content, contentType, context); + using HttpMessage message = CreateSendToConnectionRequest(connectionId, content, contentType, messageTtlSeconds, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -687,13 +700,14 @@ public virtual Response CloseGroupConnections(string group, IEnumerable /// Upload file type. Allowed values: "application/json" | "application/octet-stream" | "text/plain". /// Excluded connection Ids. /// Following OData filter syntax to filter out the subscribers receiving the messages. + /// The time-to-live (TTL) value in seconds for messages sent to the service. 0 is the default value, which means the message never expires. 300 is the maximum value. If this parameter is non-zero, messages that are not consumed by the client within the specified TTL will be dropped by the service. This parameter can help when the client's bandwidth is limited. /// 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. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task SendToGroupAsync(string group, RequestContent content, ContentType contentType, IEnumerable excluded = null, string filter = null, RequestContext context = null) + /// + public virtual async Task SendToGroupAsync(string group, RequestContent content, ContentType contentType, IEnumerable excluded = null, string filter = null, int? messageTtlSeconds = null, RequestContext context = null) { Argument.AssertNotNullOrEmpty(group, nameof(group)); Argument.AssertNotNull(content, nameof(content)); @@ -702,7 +716,7 @@ public virtual async Task SendToGroupAsync(string group, RequestConten scope.Start(); try { - using HttpMessage message = CreateSendToGroupRequest(group, content, contentType, excluded, filter, context); + using HttpMessage message = CreateSendToGroupRequest(group, content, contentType, excluded, filter, messageTtlSeconds, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -727,13 +741,14 @@ public virtual async Task SendToGroupAsync(string group, RequestConten /// Upload file type. Allowed values: "application/json" | "application/octet-stream" | "text/plain". /// Excluded connection Ids. /// Following OData filter syntax to filter out the subscribers receiving the messages. + /// The time-to-live (TTL) value in seconds for messages sent to the service. 0 is the default value, which means the message never expires. 300 is the maximum value. If this parameter is non-zero, messages that are not consumed by the client within the specified TTL will be dropped by the service. This parameter can help when the client's bandwidth is limited. /// 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. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response SendToGroup(string group, RequestContent content, ContentType contentType, IEnumerable excluded = null, string filter = null, RequestContext context = null) + /// + public virtual Response SendToGroup(string group, RequestContent content, ContentType contentType, IEnumerable excluded = null, string filter = null, int? messageTtlSeconds = null, RequestContext context = null) { Argument.AssertNotNullOrEmpty(group, nameof(group)); Argument.AssertNotNull(content, nameof(content)); @@ -742,7 +757,7 @@ public virtual Response SendToGroup(string group, RequestContent content, Conten scope.Start(); try { - using HttpMessage message = CreateSendToGroupRequest(group, content, contentType, excluded, filter, context); + using HttpMessage message = CreateSendToGroupRequest(group, content, contentType, excluded, filter, messageTtlSeconds, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1286,13 +1301,14 @@ public virtual Response CloseUserConnections(string userId, IEnumerable /// The content to send as the body of the request. /// Upload file type. Allowed values: "application/json" | "application/octet-stream" | "text/plain". /// Following OData filter syntax to filter out the subscribers receiving the messages. + /// The time-to-live (TTL) value in seconds for messages sent to the service. 0 is the default value, which means the message never expires. 300 is the maximum value. If this parameter is non-zero, messages that are not consumed by the client within the specified TTL will be dropped by the service. This parameter can help when the client's bandwidth is limited. /// 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. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task SendToUserAsync(string userId, RequestContent content, ContentType contentType, string filter = null, RequestContext context = null) + /// + public virtual async Task SendToUserAsync(string userId, RequestContent content, ContentType contentType, string filter = null, int? messageTtlSeconds = null, RequestContext context = null) { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); Argument.AssertNotNull(content, nameof(content)); @@ -1301,7 +1317,7 @@ public virtual async Task SendToUserAsync(string userId, RequestConten scope.Start(); try { - using HttpMessage message = CreateSendToUserRequest(userId, content, contentType, filter, context); + using HttpMessage message = CreateSendToUserRequest(userId, content, contentType, filter, messageTtlSeconds, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1325,13 +1341,14 @@ public virtual async Task SendToUserAsync(string userId, RequestConten /// The content to send as the body of the request. /// Upload file type. Allowed values: "application/json" | "application/octet-stream" | "text/plain". /// Following OData filter syntax to filter out the subscribers receiving the messages. + /// The time-to-live (TTL) value in seconds for messages sent to the service. 0 is the default value, which means the message never expires. 300 is the maximum value. If this parameter is non-zero, messages that are not consumed by the client within the specified TTL will be dropped by the service. This parameter can help when the client's bandwidth is limited. /// 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. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response SendToUser(string userId, RequestContent content, ContentType contentType, string filter = null, RequestContext context = null) + /// + public virtual Response SendToUser(string userId, RequestContent content, ContentType contentType, string filter = null, int? messageTtlSeconds = null, RequestContext context = null) { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); Argument.AssertNotNull(content, nameof(content)); @@ -1340,7 +1357,7 @@ public virtual Response SendToUser(string userId, RequestContent content, Conten scope.Start(); try { - using HttpMessage message = CreateSendToUserRequest(userId, content, contentType, filter, context); + using HttpMessage message = CreateSendToUserRequest(userId, content, contentType, filter, messageTtlSeconds, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1426,7 +1443,7 @@ internal HttpMessage CreateCloseAllConnectionsRequest(IEnumerable exclud var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); uri.AppendPath("/:closeConnections", false); @@ -1453,7 +1470,7 @@ internal HttpMessage CreateGenerateClientTokenImplRequest(string userId, IEnumer var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); uri.AppendPath("/:generateToken", false); @@ -1485,13 +1502,13 @@ internal HttpMessage CreateGenerateClientTokenImplRequest(string userId, IEnumer return message; } - internal HttpMessage CreateSendToAllRequest(RequestContent content, ContentType contentType, IEnumerable excluded, string filter, RequestContext context) + internal HttpMessage CreateSendToAllRequest(RequestContent content, ContentType contentType, IEnumerable excluded, string filter, int? messageTtlSeconds, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier202); var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); uri.AppendPath("/:send", false); @@ -1507,6 +1524,10 @@ internal HttpMessage CreateSendToAllRequest(RequestContent content, ContentType { uri.AppendQuery("filter", filter, true); } + if (messageTtlSeconds != null) + { + uri.AppendQuery("messageTtlSeconds", messageTtlSeconds.Value, true); + } request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", contentType.ToString()); @@ -1520,7 +1541,7 @@ internal HttpMessage CreateCloseConnectionRequest(string connectionId, string re var request = message.Request; request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); uri.AppendPath("/connections/", false); @@ -1541,7 +1562,7 @@ internal HttpMessage CreateConnectionExistsImplRequest(string connectionId, Requ var request = message.Request; request.Method = RequestMethod.Head; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); uri.AppendPath("/connections/", false); @@ -1551,19 +1572,23 @@ internal HttpMessage CreateConnectionExistsImplRequest(string connectionId, Requ return message; } - internal HttpMessage CreateSendToConnectionRequest(string connectionId, RequestContent content, ContentType contentType, RequestContext context) + internal HttpMessage CreateSendToConnectionRequest(string connectionId, RequestContent content, ContentType contentType, int? messageTtlSeconds, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier202); var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); uri.AppendPath("/connections/", false); uri.AppendPath(connectionId, true); uri.AppendPath("/:send", false); uri.AppendQuery("api-version", _apiVersion, true); + if (messageTtlSeconds != null) + { + uri.AppendQuery("messageTtlSeconds", messageTtlSeconds.Value, true); + } request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", contentType.ToString()); @@ -1577,7 +1602,7 @@ internal HttpMessage CreateRemoveConnectionFromAllGroupsRequest(string connectio var request = message.Request; request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); uri.AppendPath("/connections/", false); @@ -1595,7 +1620,7 @@ internal HttpMessage CreateGroupExistsImplRequest(string group, RequestContext c var request = message.Request; request.Method = RequestMethod.Head; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); uri.AppendPath("/groups/", false); @@ -1611,7 +1636,7 @@ internal HttpMessage CreateCloseGroupConnectionsRequest(string group, IEnumerabl var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); uri.AppendPath("/groups/", false); @@ -1634,13 +1659,13 @@ internal HttpMessage CreateCloseGroupConnectionsRequest(string group, IEnumerabl return message; } - internal HttpMessage CreateSendToGroupRequest(string group, RequestContent content, ContentType contentType, IEnumerable excluded, string filter, RequestContext context) + internal HttpMessage CreateSendToGroupRequest(string group, RequestContent content, ContentType contentType, IEnumerable excluded, string filter, int? messageTtlSeconds, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier202); var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); uri.AppendPath("/groups/", false); @@ -1658,6 +1683,10 @@ internal HttpMessage CreateSendToGroupRequest(string group, RequestContent conte { uri.AppendQuery("filter", filter, true); } + if (messageTtlSeconds != null) + { + uri.AppendQuery("messageTtlSeconds", messageTtlSeconds.Value, true); + } request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", contentType.ToString()); @@ -1671,7 +1700,7 @@ internal HttpMessage CreateRemoveConnectionFromGroupRequest(string group, string var request = message.Request; request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); uri.AppendPath("/groups/", false); @@ -1690,7 +1719,7 @@ internal HttpMessage CreateAddConnectionToGroupRequest(string group, string conn var request = message.Request; request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); uri.AppendPath("/groups/", false); @@ -1709,7 +1738,7 @@ internal HttpMessage CreateRevokePermissionRequest(string permission, string con var request = message.Request; request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); uri.AppendPath("/permissions/", false); @@ -1732,7 +1761,7 @@ internal HttpMessage CreateCheckPermissionRequest(string permission, string conn var request = message.Request; request.Method = RequestMethod.Head; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); uri.AppendPath("/permissions/", false); @@ -1754,7 +1783,7 @@ internal HttpMessage CreateGrantPermissionRequest(string permission, string conn var request = message.Request; request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); uri.AppendPath("/permissions/", false); @@ -1777,7 +1806,7 @@ internal HttpMessage CreateUserExistsImplRequest(string userId, RequestContext c var request = message.Request; request.Method = RequestMethod.Head; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); uri.AppendPath("/users/", false); @@ -1793,7 +1822,7 @@ internal HttpMessage CreateCloseUserConnectionsRequest(string userId, IEnumerabl var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); uri.AppendPath("/users/", false); @@ -1816,13 +1845,13 @@ internal HttpMessage CreateCloseUserConnectionsRequest(string userId, IEnumerabl return message; } - internal HttpMessage CreateSendToUserRequest(string userId, RequestContent content, ContentType contentType, string filter, RequestContext context) + internal HttpMessage CreateSendToUserRequest(string userId, RequestContent content, ContentType contentType, string filter, int? messageTtlSeconds, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier202); var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); uri.AppendPath("/users/", false); @@ -1833,6 +1862,10 @@ internal HttpMessage CreateSendToUserRequest(string userId, RequestContent conte { uri.AppendQuery("filter", filter, true); } + if (messageTtlSeconds != null) + { + uri.AppendQuery("messageTtlSeconds", messageTtlSeconds.Value, true); + } request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", contentType.ToString()); @@ -1846,7 +1879,7 @@ internal HttpMessage CreateRemoveUserFromAllGroupsRequest(string userId, Request var request = message.Request; request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); uri.AppendPath("/users/", false); @@ -1864,7 +1897,7 @@ internal HttpMessage CreateRemoveUserFromGroupRequest(string userId, string grou var request = message.Request; request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); uri.AppendPath("/users/", false); @@ -1883,7 +1916,7 @@ internal HttpMessage CreateAddUserToGroupRequest(string userId, string group, Re var request = message.Request; request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/api/hubs/", false); uri.AppendPath(_hub, true); uri.AppendPath("/users/", false); diff --git a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/autorest.md b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/autorest.md index e58099aef541..331607439539 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/1735a92bdc79b446385a36ba063ea5235680709f/specification/webpubsub/data-plane/WebPubSub/stable/2022-11-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 ``` @@ -282,3 +282,4 @@ directive: where: $.paths["/api/hubs/{hub}/connections/{connectionId}/groups"].delete.parameters["0"] transform: $["x-ms-parameter-location"] = "client" ``` + diff --git a/sdk/webpubsub/Azure.Messaging.WebPubSub/tests/Generated/Samples/Samples_HealthApiClient.cs b/sdk/webpubsub/Azure.Messaging.WebPubSub/tests/Generated/Samples/Samples_HealthApiClient.cs index 5076471ac164..8b3c39e592c5 100644 --- a/sdk/webpubsub/Azure.Messaging.WebPubSub/tests/Generated/Samples/Samples_HealthApiClient.cs +++ b/sdk/webpubsub/Azure.Messaging.WebPubSub/tests/Generated/Samples/Samples_HealthApiClient.cs @@ -23,7 +23,8 @@ public class Samples_HealthApiClient [Ignore("Only validating compilation of examples")] public void Example_GetServiceStatus() { - var client = new HealthApiClient(""); + var endpoint = new Uri(""); + var client = new HealthApiClient(endpoint); Response response = client.GetServiceStatus(); Console.WriteLine(response.Status); @@ -33,7 +34,8 @@ public void Example_GetServiceStatus() [Ignore("Only validating compilation of examples")] public void Example_GetServiceStatus_AllParameters() { - var client = new HealthApiClient(""); + var endpoint = new Uri(""); + var client = new HealthApiClient(endpoint); Response response = client.GetServiceStatus(); Console.WriteLine(response.Status); @@ -43,7 +45,8 @@ public void Example_GetServiceStatus_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetServiceStatus_Async() { - var client = new HealthApiClient(""); + var endpoint = new Uri(""); + var client = new HealthApiClient(endpoint); Response response = await client.GetServiceStatusAsync(); Console.WriteLine(response.Status); @@ -53,7 +56,8 @@ public async Task Example_GetServiceStatus_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetServiceStatus_AllParameters_Async() { - var client = new HealthApiClient(""); + var endpoint = new Uri(""); + var client = new HealthApiClient(endpoint); Response response = await client.GetServiceStatusAsync(); Console.WriteLine(response.Status); diff --git a/sdk/webpubsub/Azure.Messaging.WebPubSub/tests/Generated/Samples/Samples_WebPubSubClient.cs b/sdk/webpubsub/Azure.Messaging.WebPubSub/tests/Generated/Samples/Samples_WebPubSubClient.cs new file mode 100644 index 000000000000..14b9f14b1ef7 --- /dev/null +++ b/sdk/webpubsub/Azure.Messaging.WebPubSub/tests/Generated/Samples/Samples_WebPubSubClient.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.IO; +using System.Text.Json; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Messaging.WebPubSub.Samples +{ + public class Samples_WebPubSubClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AddConnectionsToGroups() + { + var endpoint = new Uri(""); + var client = new WebPubSubClient(endpoint); + + var data = new { }; + + Response response = client.AddConnectionsToGroups("", RequestContent.Create(data)); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AddConnectionsToGroups_AllParameters() + { + var endpoint = new Uri(""); + var client = new WebPubSubClient(endpoint); + + var data = new + { + groups = new[] { + "" + }, + filter = "", + }; + + Response response = client.AddConnectionsToGroups("", RequestContent.Create(data)); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AddConnectionsToGroups_Async() + { + var endpoint = new Uri(""); + var client = new WebPubSubClient(endpoint); + + var data = new { }; + + Response response = await client.AddConnectionsToGroupsAsync("", RequestContent.Create(data)); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AddConnectionsToGroups_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new WebPubSubClient(endpoint); + + var data = new + { + groups = new[] { + "" + }, + filter = "", + }; + + Response response = await client.AddConnectionsToGroupsAsync("", RequestContent.Create(data)); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_RemoveConnectionsFromGroups() + { + var endpoint = new Uri(""); + var client = new WebPubSubClient(endpoint); + + var data = new { }; + + Response response = client.RemoveConnectionsFromGroups("", RequestContent.Create(data)); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_RemoveConnectionsFromGroups_AllParameters() + { + var endpoint = new Uri(""); + var client = new WebPubSubClient(endpoint); + + var data = new + { + groups = new[] { + "" + }, + filter = "", + }; + + Response response = client.RemoveConnectionsFromGroups("", RequestContent.Create(data)); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_RemoveConnectionsFromGroups_Async() + { + var endpoint = new Uri(""); + var client = new WebPubSubClient(endpoint); + + var data = new { }; + + Response response = await client.RemoveConnectionsFromGroupsAsync("", RequestContent.Create(data)); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_RemoveConnectionsFromGroups_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new WebPubSubClient(endpoint); + + var data = new + { + groups = new[] { + "" + }, + filter = "", + }; + + Response response = await client.RemoveConnectionsFromGroupsAsync("", RequestContent.Create(data)); + Console.WriteLine(response.Status); + } + } +} diff --git a/sdk/webpubsub/Azure.Messaging.WebPubSub/tests/Generated/Samples/Samples_WebPubSubServiceClient.cs b/sdk/webpubsub/Azure.Messaging.WebPubSub/tests/Generated/Samples/Samples_WebPubSubServiceClient.cs index af906aa9b4f8..b865cf013d42 100644 --- a/sdk/webpubsub/Azure.Messaging.WebPubSub/tests/Generated/Samples/Samples_WebPubSubServiceClient.cs +++ b/sdk/webpubsub/Azure.Messaging.WebPubSub/tests/Generated/Samples/Samples_WebPubSubServiceClient.cs @@ -23,7 +23,8 @@ public class Samples_WebPubSubServiceClient [Ignore("Only validating compilation of examples")] public void Example_CloseAllConnections() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = client.CloseAllConnections(); Console.WriteLine(response.Status); @@ -33,7 +34,8 @@ public void Example_CloseAllConnections() [Ignore("Only validating compilation of examples")] public void Example_CloseAllConnections_AllParameters() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = client.CloseAllConnections(new string[] { "" }, ""); Console.WriteLine(response.Status); @@ -43,7 +45,8 @@ public void Example_CloseAllConnections_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_CloseAllConnections_Async() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = await client.CloseAllConnectionsAsync(); Console.WriteLine(response.Status); @@ -53,7 +56,8 @@ public async Task Example_CloseAllConnections_Async() [Ignore("Only validating compilation of examples")] public async Task Example_CloseAllConnections_AllParameters_Async() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = await client.CloseAllConnectionsAsync(new string[] { "" }, ""); Console.WriteLine(response.Status); @@ -63,7 +67,8 @@ public async Task Example_CloseAllConnections_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_SendToAll() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); @@ -75,11 +80,12 @@ public void Example_SendToAll() [Ignore("Only validating compilation of examples")] public void Example_SendToAll_AllParameters() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); - Response response = client.SendToAll(RequestContent.Create(data), ContentType.ApplicationOctetStream, new string[] { "" }, ""); + Response response = client.SendToAll(RequestContent.Create(data), ContentType.ApplicationOctetStream, new string[] { "" }, "", 1234); Console.WriteLine(response.Status); } @@ -87,7 +93,8 @@ public void Example_SendToAll_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_SendToAll_Async() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); @@ -99,11 +106,12 @@ public async Task Example_SendToAll_Async() [Ignore("Only validating compilation of examples")] public async Task Example_SendToAll_AllParameters_Async() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); - Response response = await client.SendToAllAsync(RequestContent.Create(data), ContentType.ApplicationOctetStream, new string[] { "" }, ""); + Response response = await client.SendToAllAsync(RequestContent.Create(data), ContentType.ApplicationOctetStream, new string[] { "" }, "", 1234); Console.WriteLine(response.Status); } @@ -111,7 +119,8 @@ public async Task Example_SendToAll_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_CloseConnection() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = client.CloseConnection(""); Console.WriteLine(response.Status); @@ -121,7 +130,8 @@ public void Example_CloseConnection() [Ignore("Only validating compilation of examples")] public void Example_CloseConnection_AllParameters() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = client.CloseConnection("", ""); Console.WriteLine(response.Status); @@ -131,7 +141,8 @@ public void Example_CloseConnection_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_CloseConnection_Async() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = await client.CloseConnectionAsync(""); Console.WriteLine(response.Status); @@ -141,7 +152,8 @@ public async Task Example_CloseConnection_Async() [Ignore("Only validating compilation of examples")] public async Task Example_CloseConnection_AllParameters_Async() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = await client.CloseConnectionAsync("", ""); Console.WriteLine(response.Status); @@ -151,7 +163,8 @@ public async Task Example_CloseConnection_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_SendToConnection() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); @@ -163,11 +176,12 @@ public void Example_SendToConnection() [Ignore("Only validating compilation of examples")] public void Example_SendToConnection_AllParameters() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); - Response response = client.SendToConnection("", RequestContent.Create(data), ContentType.ApplicationOctetStream); + Response response = client.SendToConnection("", RequestContent.Create(data), ContentType.ApplicationOctetStream, 1234); Console.WriteLine(response.Status); } @@ -175,7 +189,8 @@ public void Example_SendToConnection_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_SendToConnection_Async() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); @@ -187,11 +202,12 @@ public async Task Example_SendToConnection_Async() [Ignore("Only validating compilation of examples")] public async Task Example_SendToConnection_AllParameters_Async() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); - Response response = await client.SendToConnectionAsync("", RequestContent.Create(data), ContentType.ApplicationOctetStream); + Response response = await client.SendToConnectionAsync("", RequestContent.Create(data), ContentType.ApplicationOctetStream, 1234); Console.WriteLine(response.Status); } @@ -199,7 +215,8 @@ public async Task Example_SendToConnection_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_RemoveConnectionFromAllGroups() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = client.RemoveConnectionFromAllGroups(""); Console.WriteLine(response.Status); @@ -209,7 +226,8 @@ public void Example_RemoveConnectionFromAllGroups() [Ignore("Only validating compilation of examples")] public void Example_RemoveConnectionFromAllGroups_AllParameters() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = client.RemoveConnectionFromAllGroups(""); Console.WriteLine(response.Status); @@ -219,7 +237,8 @@ public void Example_RemoveConnectionFromAllGroups_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_RemoveConnectionFromAllGroups_Async() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = await client.RemoveConnectionFromAllGroupsAsync(""); Console.WriteLine(response.Status); @@ -229,7 +248,8 @@ public async Task Example_RemoveConnectionFromAllGroups_Async() [Ignore("Only validating compilation of examples")] public async Task Example_RemoveConnectionFromAllGroups_AllParameters_Async() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = await client.RemoveConnectionFromAllGroupsAsync(""); Console.WriteLine(response.Status); @@ -239,7 +259,8 @@ public async Task Example_RemoveConnectionFromAllGroups_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_CloseGroupConnections() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = client.CloseGroupConnections(""); Console.WriteLine(response.Status); @@ -249,7 +270,8 @@ public void Example_CloseGroupConnections() [Ignore("Only validating compilation of examples")] public void Example_CloseGroupConnections_AllParameters() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = client.CloseGroupConnections("", new string[] { "" }, ""); Console.WriteLine(response.Status); @@ -259,7 +281,8 @@ public void Example_CloseGroupConnections_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_CloseGroupConnections_Async() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = await client.CloseGroupConnectionsAsync(""); Console.WriteLine(response.Status); @@ -269,7 +292,8 @@ public async Task Example_CloseGroupConnections_Async() [Ignore("Only validating compilation of examples")] public async Task Example_CloseGroupConnections_AllParameters_Async() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = await client.CloseGroupConnectionsAsync("", new string[] { "" }, ""); Console.WriteLine(response.Status); @@ -279,7 +303,8 @@ public async Task Example_CloseGroupConnections_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_SendToGroup() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); @@ -291,11 +316,12 @@ public void Example_SendToGroup() [Ignore("Only validating compilation of examples")] public void Example_SendToGroup_AllParameters() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); - Response response = client.SendToGroup("", RequestContent.Create(data), ContentType.ApplicationOctetStream, new string[] { "" }, ""); + Response response = client.SendToGroup("", RequestContent.Create(data), ContentType.ApplicationOctetStream, new string[] { "" }, "", 1234); Console.WriteLine(response.Status); } @@ -303,7 +329,8 @@ public void Example_SendToGroup_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_SendToGroup_Async() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); @@ -315,11 +342,12 @@ public async Task Example_SendToGroup_Async() [Ignore("Only validating compilation of examples")] public async Task Example_SendToGroup_AllParameters_Async() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); - Response response = await client.SendToGroupAsync("", RequestContent.Create(data), ContentType.ApplicationOctetStream, new string[] { "" }, ""); + Response response = await client.SendToGroupAsync("", RequestContent.Create(data), ContentType.ApplicationOctetStream, new string[] { "" }, "", 1234); Console.WriteLine(response.Status); } @@ -327,7 +355,8 @@ public async Task Example_SendToGroup_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_RemoveConnectionFromGroup() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = client.RemoveConnectionFromGroup("", ""); Console.WriteLine(response.Status); @@ -337,7 +366,8 @@ public void Example_RemoveConnectionFromGroup() [Ignore("Only validating compilation of examples")] public void Example_RemoveConnectionFromGroup_AllParameters() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = client.RemoveConnectionFromGroup("", ""); Console.WriteLine(response.Status); @@ -347,7 +377,8 @@ public void Example_RemoveConnectionFromGroup_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_RemoveConnectionFromGroup_Async() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = await client.RemoveConnectionFromGroupAsync("", ""); Console.WriteLine(response.Status); @@ -357,7 +388,8 @@ public async Task Example_RemoveConnectionFromGroup_Async() [Ignore("Only validating compilation of examples")] public async Task Example_RemoveConnectionFromGroup_AllParameters_Async() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = await client.RemoveConnectionFromGroupAsync("", ""); Console.WriteLine(response.Status); @@ -367,7 +399,8 @@ public async Task Example_RemoveConnectionFromGroup_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_AddConnectionToGroup() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = client.AddConnectionToGroup("", ""); Console.WriteLine(response.Status); @@ -377,7 +410,8 @@ public void Example_AddConnectionToGroup() [Ignore("Only validating compilation of examples")] public void Example_AddConnectionToGroup_AllParameters() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = client.AddConnectionToGroup("", ""); Console.WriteLine(response.Status); @@ -387,7 +421,8 @@ public void Example_AddConnectionToGroup_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_AddConnectionToGroup_Async() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = await client.AddConnectionToGroupAsync("", ""); Console.WriteLine(response.Status); @@ -397,7 +432,8 @@ public async Task Example_AddConnectionToGroup_Async() [Ignore("Only validating compilation of examples")] public async Task Example_AddConnectionToGroup_AllParameters_Async() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = await client.AddConnectionToGroupAsync("", ""); Console.WriteLine(response.Status); @@ -407,7 +443,8 @@ public async Task Example_AddConnectionToGroup_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_CloseUserConnections() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = client.CloseUserConnections(""); Console.WriteLine(response.Status); @@ -417,7 +454,8 @@ public void Example_CloseUserConnections() [Ignore("Only validating compilation of examples")] public void Example_CloseUserConnections_AllParameters() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = client.CloseUserConnections("", new string[] { "" }, ""); Console.WriteLine(response.Status); @@ -427,7 +465,8 @@ public void Example_CloseUserConnections_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_CloseUserConnections_Async() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = await client.CloseUserConnectionsAsync(""); Console.WriteLine(response.Status); @@ -437,7 +476,8 @@ public async Task Example_CloseUserConnections_Async() [Ignore("Only validating compilation of examples")] public async Task Example_CloseUserConnections_AllParameters_Async() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = await client.CloseUserConnectionsAsync("", new string[] { "" }, ""); Console.WriteLine(response.Status); @@ -447,7 +487,8 @@ public async Task Example_CloseUserConnections_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_SendToUser() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); @@ -459,11 +500,12 @@ public void Example_SendToUser() [Ignore("Only validating compilation of examples")] public void Example_SendToUser_AllParameters() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); - Response response = client.SendToUser("", RequestContent.Create(data), ContentType.ApplicationOctetStream, ""); + Response response = client.SendToUser("", RequestContent.Create(data), ContentType.ApplicationOctetStream, "", 1234); Console.WriteLine(response.Status); } @@ -471,7 +513,8 @@ public void Example_SendToUser_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_SendToUser_Async() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); @@ -483,11 +526,12 @@ public async Task Example_SendToUser_Async() [Ignore("Only validating compilation of examples")] public async Task Example_SendToUser_AllParameters_Async() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); var data = File.OpenRead(""); - Response response = await client.SendToUserAsync("", RequestContent.Create(data), ContentType.ApplicationOctetStream, ""); + Response response = await client.SendToUserAsync("", RequestContent.Create(data), ContentType.ApplicationOctetStream, "", 1234); Console.WriteLine(response.Status); } @@ -495,7 +539,8 @@ public async Task Example_SendToUser_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_RemoveUserFromAllGroups() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = client.RemoveUserFromAllGroups(""); Console.WriteLine(response.Status); @@ -505,7 +550,8 @@ public void Example_RemoveUserFromAllGroups() [Ignore("Only validating compilation of examples")] public void Example_RemoveUserFromAllGroups_AllParameters() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = client.RemoveUserFromAllGroups(""); Console.WriteLine(response.Status); @@ -515,7 +561,8 @@ public void Example_RemoveUserFromAllGroups_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_RemoveUserFromAllGroups_Async() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = await client.RemoveUserFromAllGroupsAsync(""); Console.WriteLine(response.Status); @@ -525,7 +572,8 @@ public async Task Example_RemoveUserFromAllGroups_Async() [Ignore("Only validating compilation of examples")] public async Task Example_RemoveUserFromAllGroups_AllParameters_Async() { - var client = new WebPubSubServiceClient("", ""); + var endpoint = new Uri(""); + var client = new WebPubSubServiceClient(endpoint, ""); Response response = await client.RemoveUserFromAllGroupsAsync(""); Console.WriteLine(response.Status);