diff --git a/samples/AnomalyDetector/src/Generated/Docs/AnomalyDetectorClient.xml b/samples/AnomalyDetector/src/Generated/Docs/AnomalyDetectorClient.xml index be4834c07fa..6bd963417bf 100644 --- a/samples/AnomalyDetector/src/Generated/Docs/AnomalyDetectorClient.xml +++ b/samples/AnomalyDetector/src/Generated/Docs/AnomalyDetectorClient.xml @@ -2,78 +2,102 @@ - -This sample shows how to call DetectUnivariateEntireSeriesAsync with required parameters. + +This sample shows how to call DetectUnivariateEntireSeriesAsync. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var options = new UnivariateDetectionOptions(new TimeSeriesPoint[] +UnivariateDetectionOptions options = new UnivariateDetectionOptions(new List() { - new TimeSeriesPoint(3.14f) + new TimeSeriesPoint(123.45F) +}); +Response response = await client.DetectUnivariateEntireSeriesAsync(options); +]]> +This sample shows how to call DetectUnivariateEntireSeriesAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +UnivariateDetectionOptions options = new UnivariateDetectionOptions(new List() { - Timestamp = DateTimeOffset.UtcNow, + new TimeSeriesPoint(123.45F) + { + Timestamp = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), } }) { Granularity = TimeGranularity.Yearly, CustomInterval = 1234, Period = 1234, - MaxAnomalyRatio = 3.14f, + MaxAnomalyRatio = 123.45F, Sensitivity = 1234, ImputeMode = ImputeMode.Auto, - ImputeFixedValue = 3.14f, + ImputeFixedValue = 123.45F, }; -var result = await client.DetectUnivariateEntireSeriesAsync(options); -]]> - +Response response = await client.DetectUnivariateEntireSeriesAsync(options); +]]> - -This sample shows how to call DetectUnivariateEntireSeries with required parameters. + +This sample shows how to call DetectUnivariateEntireSeries. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var options = new UnivariateDetectionOptions(new TimeSeriesPoint[] +UnivariateDetectionOptions options = new UnivariateDetectionOptions(new List() { - new TimeSeriesPoint(3.14f) + new TimeSeriesPoint(123.45F) +}); +Response response = client.DetectUnivariateEntireSeries(options); +]]> +This sample shows how to call DetectUnivariateEntireSeries with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +UnivariateDetectionOptions options = new UnivariateDetectionOptions(new List() { - Timestamp = DateTimeOffset.UtcNow, + new TimeSeriesPoint(123.45F) + { + Timestamp = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), } }) { Granularity = TimeGranularity.Yearly, CustomInterval = 1234, Period = 1234, - MaxAnomalyRatio = 3.14f, + MaxAnomalyRatio = 123.45F, Sensitivity = 1234, ImputeMode = ImputeMode.Auto, - ImputeFixedValue = 3.14f, + ImputeFixedValue = 123.45F, }; -var result = client.DetectUnivariateEntireSeries(options); -]]> - +Response response = client.DetectUnivariateEntireSeries(options); +]]> - -This sample shows how to call DetectUnivariateEntireSeriesAsync with required request content, and how to parse the result. + +This sample shows how to call DetectUnivariateEntireSeriesAsync and parse the result. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var data = new { - series = new[] { - new { - value = 123.45f, +RequestContent content = RequestContent.Create(new +{ + series = new List() + { + new + { + value = 123.45F, } }, -}; - -Response response = await client.DetectUnivariateEntireSeriesAsync(RequestContent.Create(data)); +}); +Response response = await client.DetectUnivariateEntireSeriesAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("period").ToString()); @@ -84,29 +108,31 @@ Console.WriteLine(result.GetProperty("isAnomaly")[0].ToString()); Console.WriteLine(result.GetProperty("isNegativeAnomaly")[0].ToString()); Console.WriteLine(result.GetProperty("isPositiveAnomaly")[0].ToString()); ]]> -This sample shows how to call DetectUnivariateEntireSeriesAsync with all request content, and how to parse the result. +This sample shows how to call DetectUnivariateEntireSeriesAsync with all request content and parse the result. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var data = new { - series = new[] { - new { +RequestContent content = RequestContent.Create(new +{ + series = new List() + { + new + { timestamp = "2022-05-10T14:57:31.2311892-04:00", - value = 123.45f, + value = 123.45F, } }, granularity = "yearly", customInterval = 1234, period = 1234, - maxAnomalyRatio = 123.45f, + maxAnomalyRatio = 123.45F, sensitivity = 1234, imputeMode = "auto", - imputeFixedValue = 123.45f, -}; - -Response response = await client.DetectUnivariateEntireSeriesAsync(RequestContent.Create(data)); + imputeFixedValue = 123.45F, +}); +Response response = await client.DetectUnivariateEntireSeriesAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("period").ToString()); @@ -117,26 +143,27 @@ Console.WriteLine(result.GetProperty("isAnomaly")[0].ToString()); Console.WriteLine(result.GetProperty("isNegativeAnomaly")[0].ToString()); Console.WriteLine(result.GetProperty("isPositiveAnomaly")[0].ToString()); Console.WriteLine(result.GetProperty("severity")[0].ToString()); -]]> - +]]> - -This sample shows how to call DetectUnivariateEntireSeries with required request content, and how to parse the result. + +This sample shows how to call DetectUnivariateEntireSeries and parse the result. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var data = new { - series = new[] { - new { - value = 123.45f, +RequestContent content = RequestContent.Create(new +{ + series = new List() + { + new + { + value = 123.45F, } }, -}; - -Response response = client.DetectUnivariateEntireSeries(RequestContent.Create(data)); +}); +Response response = client.DetectUnivariateEntireSeries(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("period").ToString()); @@ -147,29 +174,31 @@ Console.WriteLine(result.GetProperty("isAnomaly")[0].ToString()); Console.WriteLine(result.GetProperty("isNegativeAnomaly")[0].ToString()); Console.WriteLine(result.GetProperty("isPositiveAnomaly")[0].ToString()); ]]> -This sample shows how to call DetectUnivariateEntireSeries with all request content, and how to parse the result. +This sample shows how to call DetectUnivariateEntireSeries with all request content and parse the result. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var data = new { - series = new[] { - new { +RequestContent content = RequestContent.Create(new +{ + series = new List() + { + new + { timestamp = "2022-05-10T14:57:31.2311892-04:00", - value = 123.45f, + value = 123.45F, } }, granularity = "yearly", customInterval = 1234, period = 1234, - maxAnomalyRatio = 123.45f, + maxAnomalyRatio = 123.45F, sensitivity = 1234, imputeMode = "auto", - imputeFixedValue = 123.45f, -}; - -Response response = client.DetectUnivariateEntireSeries(RequestContent.Create(data)); + imputeFixedValue = 123.45F, +}); +Response response = client.DetectUnivariateEntireSeries(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("period").ToString()); @@ -180,82 +209,105 @@ Console.WriteLine(result.GetProperty("isAnomaly")[0].ToString()); Console.WriteLine(result.GetProperty("isNegativeAnomaly")[0].ToString()); Console.WriteLine(result.GetProperty("isPositiveAnomaly")[0].ToString()); Console.WriteLine(result.GetProperty("severity")[0].ToString()); -]]> - +]]> - -This sample shows how to call DetectUnivariateLastPointAsync with required parameters. + +This sample shows how to call DetectUnivariateLastPointAsync. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var options = new UnivariateDetectionOptions(new TimeSeriesPoint[] +UnivariateDetectionOptions options = new UnivariateDetectionOptions(new List() { - new TimeSeriesPoint(3.14f) + new TimeSeriesPoint(123.45F) +}); +Response response = await client.DetectUnivariateLastPointAsync(options); +]]> +This sample shows how to call DetectUnivariateLastPointAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +UnivariateDetectionOptions options = new UnivariateDetectionOptions(new List() { - Timestamp = DateTimeOffset.UtcNow, + new TimeSeriesPoint(123.45F) + { + Timestamp = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), } }) { Granularity = TimeGranularity.Yearly, CustomInterval = 1234, Period = 1234, - MaxAnomalyRatio = 3.14f, + MaxAnomalyRatio = 123.45F, Sensitivity = 1234, ImputeMode = ImputeMode.Auto, - ImputeFixedValue = 3.14f, + ImputeFixedValue = 123.45F, }; -var result = await client.DetectUnivariateLastPointAsync(options); -]]> - +Response response = await client.DetectUnivariateLastPointAsync(options); +]]> - -This sample shows how to call DetectUnivariateLastPoint with required parameters. + +This sample shows how to call DetectUnivariateLastPoint. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var options = new UnivariateDetectionOptions(new TimeSeriesPoint[] +UnivariateDetectionOptions options = new UnivariateDetectionOptions(new List() { - new TimeSeriesPoint(3.14f) + new TimeSeriesPoint(123.45F) +}); +Response response = client.DetectUnivariateLastPoint(options); +]]> +This sample shows how to call DetectUnivariateLastPoint with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +UnivariateDetectionOptions options = new UnivariateDetectionOptions(new List() { - Timestamp = DateTimeOffset.UtcNow, + new TimeSeriesPoint(123.45F) + { + Timestamp = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), } }) { Granularity = TimeGranularity.Yearly, CustomInterval = 1234, Period = 1234, - MaxAnomalyRatio = 3.14f, + MaxAnomalyRatio = 123.45F, Sensitivity = 1234, ImputeMode = ImputeMode.Auto, - ImputeFixedValue = 3.14f, + ImputeFixedValue = 123.45F, }; -var result = client.DetectUnivariateLastPoint(options); -]]> - +Response response = client.DetectUnivariateLastPoint(options); +]]> - -This sample shows how to call DetectUnivariateLastPointAsync with required request content, and how to parse the result. + +This sample shows how to call DetectUnivariateLastPointAsync and parse the result. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var data = new { - series = new[] { - new { - value = 123.45f, +RequestContent content = RequestContent.Create(new +{ + series = new List() + { + new + { + value = 123.45F, } }, -}; - -Response response = await client.DetectUnivariateLastPointAsync(RequestContent.Create(data)); +}); +Response response = await client.DetectUnivariateLastPointAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("period").ToString()); @@ -267,29 +319,31 @@ Console.WriteLine(result.GetProperty("isAnomaly").ToString()); Console.WriteLine(result.GetProperty("isNegativeAnomaly").ToString()); Console.WriteLine(result.GetProperty("isPositiveAnomaly").ToString()); ]]> -This sample shows how to call DetectUnivariateLastPointAsync with all request content, and how to parse the result. +This sample shows how to call DetectUnivariateLastPointAsync with all request content and parse the result. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var data = new { - series = new[] { - new { +RequestContent content = RequestContent.Create(new +{ + series = new List() + { + new + { timestamp = "2022-05-10T14:57:31.2311892-04:00", - value = 123.45f, + value = 123.45F, } }, granularity = "yearly", customInterval = 1234, period = 1234, - maxAnomalyRatio = 123.45f, + maxAnomalyRatio = 123.45F, sensitivity = 1234, imputeMode = "auto", - imputeFixedValue = 123.45f, -}; - -Response response = await client.DetectUnivariateLastPointAsync(RequestContent.Create(data)); + imputeFixedValue = 123.45F, +}); +Response response = await client.DetectUnivariateLastPointAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("period").ToString()); @@ -301,26 +355,27 @@ Console.WriteLine(result.GetProperty("isAnomaly").ToString()); Console.WriteLine(result.GetProperty("isNegativeAnomaly").ToString()); Console.WriteLine(result.GetProperty("isPositiveAnomaly").ToString()); Console.WriteLine(result.GetProperty("severity").ToString()); -]]> - +]]> - -This sample shows how to call DetectUnivariateLastPoint with required request content, and how to parse the result. + +This sample shows how to call DetectUnivariateLastPoint and parse the result. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var data = new { - series = new[] { - new { - value = 123.45f, +RequestContent content = RequestContent.Create(new +{ + series = new List() + { + new + { + value = 123.45F, } }, -}; - -Response response = client.DetectUnivariateLastPoint(RequestContent.Create(data)); +}); +Response response = client.DetectUnivariateLastPoint(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("period").ToString()); @@ -332,29 +387,31 @@ Console.WriteLine(result.GetProperty("isAnomaly").ToString()); Console.WriteLine(result.GetProperty("isNegativeAnomaly").ToString()); Console.WriteLine(result.GetProperty("isPositiveAnomaly").ToString()); ]]> -This sample shows how to call DetectUnivariateLastPoint with all request content, and how to parse the result. +This sample shows how to call DetectUnivariateLastPoint with all request content and parse the result. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var data = new { - series = new[] { - new { +RequestContent content = RequestContent.Create(new +{ + series = new List() + { + new + { timestamp = "2022-05-10T14:57:31.2311892-04:00", - value = 123.45f, + value = 123.45F, } }, granularity = "yearly", customInterval = 1234, period = 1234, - maxAnomalyRatio = 123.45f, + maxAnomalyRatio = 123.45F, sensitivity = 1234, imputeMode = "auto", - imputeFixedValue = 123.45f, -}; - -Response response = client.DetectUnivariateLastPoint(RequestContent.Create(data)); + imputeFixedValue = 123.45F, +}); +Response response = client.DetectUnivariateLastPoint(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("period").ToString()); @@ -366,194 +423,252 @@ Console.WriteLine(result.GetProperty("isAnomaly").ToString()); Console.WriteLine(result.GetProperty("isNegativeAnomaly").ToString()); Console.WriteLine(result.GetProperty("isPositiveAnomaly").ToString()); Console.WriteLine(result.GetProperty("severity").ToString()); -]]> - +]]> - -This sample shows how to call DetectUnivariateChangePointAsync with required parameters. + +This sample shows how to call DetectUnivariateChangePointAsync. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var options = new UnivariateChangePointDetectionOptions(new TimeSeriesPoint[] +UnivariateChangePointDetectionOptions options = new UnivariateChangePointDetectionOptions(new List() { - new TimeSeriesPoint(3.14f) + new TimeSeriesPoint(123.45F) +}, TimeGranularity.Yearly); +Response response = await client.DetectUnivariateChangePointAsync(options); +]]> +This sample shows how to call DetectUnivariateChangePointAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +UnivariateChangePointDetectionOptions options = new UnivariateChangePointDetectionOptions(new List() { - Timestamp = DateTimeOffset.UtcNow, + new TimeSeriesPoint(123.45F) + { + Timestamp = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), } }, TimeGranularity.Yearly) { CustomInterval = 1234, Period = 1234, StableTrendWindow = 1234, - Threshold = 3.14f, + Threshold = 123.45F, }; -var result = await client.DetectUnivariateChangePointAsync(options); -]]> - +Response response = await client.DetectUnivariateChangePointAsync(options); +]]> - -This sample shows how to call DetectUnivariateChangePoint with required parameters. + +This sample shows how to call DetectUnivariateChangePoint. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var options = new UnivariateChangePointDetectionOptions(new TimeSeriesPoint[] +UnivariateChangePointDetectionOptions options = new UnivariateChangePointDetectionOptions(new List() { - new TimeSeriesPoint(3.14f) + new TimeSeriesPoint(123.45F) +}, TimeGranularity.Yearly); +Response response = client.DetectUnivariateChangePoint(options); +]]> +This sample shows how to call DetectUnivariateChangePoint with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +UnivariateChangePointDetectionOptions options = new UnivariateChangePointDetectionOptions(new List() { - Timestamp = DateTimeOffset.UtcNow, + new TimeSeriesPoint(123.45F) + { + Timestamp = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), } }, TimeGranularity.Yearly) { CustomInterval = 1234, Period = 1234, StableTrendWindow = 1234, - Threshold = 3.14f, + Threshold = 123.45F, }; -var result = client.DetectUnivariateChangePoint(options); -]]> - +Response response = client.DetectUnivariateChangePoint(options); +]]> - -This sample shows how to call DetectUnivariateChangePointAsync with required request content, and how to parse the result. + +This sample shows how to call DetectUnivariateChangePointAsync and parse the result. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var data = new { - series = new[] { - new { - value = 123.45f, +RequestContent content = RequestContent.Create(new +{ + series = new List() + { + new + { + value = 123.45F, } }, granularity = "yearly", -}; - -Response response = await client.DetectUnivariateChangePointAsync(RequestContent.Create(data)); +}); +Response response = await client.DetectUnivariateChangePointAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); ]]> -This sample shows how to call DetectUnivariateChangePointAsync with all request content, and how to parse the result. +This sample shows how to call DetectUnivariateChangePointAsync with all request content and parse the result. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var data = new { - series = new[] { - new { +RequestContent content = RequestContent.Create(new +{ + series = new List() + { + new + { timestamp = "2022-05-10T14:57:31.2311892-04:00", - value = 123.45f, + value = 123.45F, } }, granularity = "yearly", customInterval = 1234, period = 1234, stableTrendWindow = 1234, - threshold = 123.45f, -}; - -Response response = await client.DetectUnivariateChangePointAsync(RequestContent.Create(data)); + threshold = 123.45F, +}); +Response response = await client.DetectUnivariateChangePointAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("period").ToString()); Console.WriteLine(result.GetProperty("isChangePoint")[0].ToString()); Console.WriteLine(result.GetProperty("confidenceScores")[0].ToString()); -]]> - +]]> - -This sample shows how to call DetectUnivariateChangePoint with required request content, and how to parse the result. + +This sample shows how to call DetectUnivariateChangePoint and parse the result. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var data = new { - series = new[] { - new { - value = 123.45f, +RequestContent content = RequestContent.Create(new +{ + series = new List() + { + new + { + value = 123.45F, } }, granularity = "yearly", -}; - -Response response = client.DetectUnivariateChangePoint(RequestContent.Create(data)); +}); +Response response = client.DetectUnivariateChangePoint(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); ]]> -This sample shows how to call DetectUnivariateChangePoint with all request content, and how to parse the result. +This sample shows how to call DetectUnivariateChangePoint with all request content and parse the result. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var data = new { - series = new[] { - new { +RequestContent content = RequestContent.Create(new +{ + series = new List() + { + new + { timestamp = "2022-05-10T14:57:31.2311892-04:00", - value = 123.45f, + value = 123.45F, } }, granularity = "yearly", customInterval = 1234, period = 1234, stableTrendWindow = 1234, - threshold = 123.45f, -}; - -Response response = client.DetectUnivariateChangePoint(RequestContent.Create(data)); + threshold = 123.45F, +}); +Response response = client.DetectUnivariateChangePoint(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("period").ToString()); Console.WriteLine(result.GetProperty("isChangePoint")[0].ToString()); Console.WriteLine(result.GetProperty("confidenceScores")[0].ToString()); -]]> - +]]> - -This sample shows how to call GetMultivariateBatchDetectionResultAsync with required parameters. + +This sample shows how to call GetMultivariateBatchDetectionResultAsync. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var result = await client.GetMultivariateBatchDetectionResultAsync(Guid.NewGuid()); +Response response = await client.GetMultivariateBatchDetectionResultAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); ]]> - +This sample shows how to call GetMultivariateBatchDetectionResultAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +Response response = await client.GetMultivariateBatchDetectionResultAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); +]]> - -This sample shows how to call GetMultivariateBatchDetectionResult with required parameters. + +This sample shows how to call GetMultivariateBatchDetectionResult. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var result = client.GetMultivariateBatchDetectionResult(Guid.NewGuid()); +Response response = client.GetMultivariateBatchDetectionResult(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); ]]> - +This sample shows how to call GetMultivariateBatchDetectionResult with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +Response response = client.GetMultivariateBatchDetectionResult(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); +]]> - -This sample shows how to call GetMultivariateBatchDetectionResultAsync with required parameters and parse the result. + +This sample shows how to call GetMultivariateBatchDetectionResultAsync and parse the result. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -Response response = await client.GetMultivariateBatchDetectionResultAsync(Guid.NewGuid(), new RequestContext()); +Response response = await client.GetMultivariateBatchDetectionResultAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("resultId").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("dataSource").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("topContributorCount").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("startTime").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("endTime").ToString()); +Console.WriteLine(result.GetProperty("results")[0].GetProperty("timestamp").ToString()); +]]> +This sample shows how to call GetMultivariateBatchDetectionResultAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +Response response = await client.GetMultivariateBatchDetectionResultAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("resultId").ToString()); @@ -578,18 +693,34 @@ Console.WriteLine(result.GetProperty("results")[0].GetProperty("value").GetPrope Console.WriteLine(result.GetProperty("results")[0].GetProperty("value").GetProperty("interpretation")[0].GetProperty("correlationChanges").GetProperty("changedVariables")[0].ToString()); Console.WriteLine(result.GetProperty("results")[0].GetProperty("errors")[0].GetProperty("code").ToString()); Console.WriteLine(result.GetProperty("results")[0].GetProperty("errors")[0].GetProperty("message").ToString()); -]]> - +]]> - -This sample shows how to call GetMultivariateBatchDetectionResult with required parameters and parse the result. + +This sample shows how to call GetMultivariateBatchDetectionResult and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +Response response = client.GetMultivariateBatchDetectionResult(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("resultId").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("dataSource").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("topContributorCount").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("startTime").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("endTime").ToString()); +Console.WriteLine(result.GetProperty("results")[0].GetProperty("timestamp").ToString()); +]]> +This sample shows how to call GetMultivariateBatchDetectionResult with all parameters and parse the result. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -Response response = client.GetMultivariateBatchDetectionResult(Guid.NewGuid(), new RequestContext()); +Response response = client.GetMultivariateBatchDetectionResult(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("resultId").ToString()); @@ -614,193 +745,217 @@ Console.WriteLine(result.GetProperty("results")[0].GetProperty("value").GetPrope Console.WriteLine(result.GetProperty("results")[0].GetProperty("value").GetProperty("interpretation")[0].GetProperty("correlationChanges").GetProperty("changedVariables")[0].ToString()); Console.WriteLine(result.GetProperty("results")[0].GetProperty("errors")[0].GetProperty("code").ToString()); Console.WriteLine(result.GetProperty("results")[0].GetProperty("errors")[0].GetProperty("message").ToString()); -]]> - +]]> - -This sample shows how to call TrainMultivariateModelAsync with required parameters. + +This sample shows how to call TrainMultivariateModelAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +ModelInfo modelInfo = new ModelInfo("", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00")); +Response response = await client.TrainMultivariateModelAsync(modelInfo); +]]> +This sample shows how to call TrainMultivariateModelAsync with all parameters. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var modelInfo = new ModelInfo("", DateTimeOffset.UtcNow, DateTimeOffset.UtcNow) +ModelInfo modelInfo = new ModelInfo("", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00")) { DataSchema = DataSchema.OneTable, - DisplayName = "", + DisplayName = "", SlidingWindow = 1234, AlignPolicy = new AlignPolicy() -{ + { AlignMode = AlignMode.Inner, FillNAMethod = FillNAMethod.Previous, - PaddingValue = 3.14f, + PaddingValue = 123.45F, }, Status = ModelStatus.Created, DiagnosticsInfo = new DiagnosticsInfo() -{ + { ModelState = new ModelState() -{ - EpochIds = -{ + { + EpochIds = + { 1234 }, - TrainLosses = -{ - 3.14f + TrainLosses = + { + 123.45F }, - ValidationLosses = -{ - 3.14f + ValidationLosses = + { + 123.45F }, - LatenciesInSeconds = -{ - 3.14f + LatenciesInSeconds = + { + 123.45F }, }, - VariableStates = -{ + VariableStates = + { new VariableState() -{ - Variable = "", - FilledNARatio = 3.14f, + { + Variable = "", + FilledNARatio = 123.45F, EffectiveCount = 1234, - FirstTimestamp = DateTimeOffset.UtcNow, - LastTimestamp = DateTimeOffset.UtcNow, + FirstTimestamp = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + LastTimestamp = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), } }, }, }; -var result = await client.TrainMultivariateModelAsync(modelInfo); -]]> - +Response response = await client.TrainMultivariateModelAsync(modelInfo); +]]> - -This sample shows how to call TrainMultivariateModel with required parameters. + +This sample shows how to call TrainMultivariateModel. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var modelInfo = new ModelInfo("", DateTimeOffset.UtcNow, DateTimeOffset.UtcNow) +ModelInfo modelInfo = new ModelInfo("", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00")); +Response response = client.TrainMultivariateModel(modelInfo); +]]> +This sample shows how to call TrainMultivariateModel with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +ModelInfo modelInfo = new ModelInfo("", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00")) { DataSchema = DataSchema.OneTable, - DisplayName = "", + DisplayName = "", SlidingWindow = 1234, AlignPolicy = new AlignPolicy() -{ + { AlignMode = AlignMode.Inner, FillNAMethod = FillNAMethod.Previous, - PaddingValue = 3.14f, + PaddingValue = 123.45F, }, Status = ModelStatus.Created, DiagnosticsInfo = new DiagnosticsInfo() -{ + { ModelState = new ModelState() -{ - EpochIds = -{ + { + EpochIds = + { 1234 }, - TrainLosses = -{ - 3.14f + TrainLosses = + { + 123.45F }, - ValidationLosses = -{ - 3.14f + ValidationLosses = + { + 123.45F }, - LatenciesInSeconds = -{ - 3.14f + LatenciesInSeconds = + { + 123.45F }, }, - VariableStates = -{ + VariableStates = + { new VariableState() -{ - Variable = "", - FilledNARatio = 3.14f, + { + Variable = "", + FilledNARatio = 123.45F, EffectiveCount = 1234, - FirstTimestamp = DateTimeOffset.UtcNow, - LastTimestamp = DateTimeOffset.UtcNow, + FirstTimestamp = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + LastTimestamp = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), } }, }, }; -var result = client.TrainMultivariateModel(modelInfo); -]]> - +Response response = client.TrainMultivariateModel(modelInfo); +]]> - -This sample shows how to call TrainMultivariateModelAsync with required request content, and how to parse the result. + +This sample shows how to call TrainMultivariateModelAsync and parse the result. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var data = new { +RequestContent content = RequestContent.Create(new +{ dataSource = "", startTime = "2022-05-10T14:57:31.2311892-04:00", endTime = "2022-05-10T14:57:31.2311892-04:00", -}; - -Response response = await client.TrainMultivariateModelAsync(RequestContent.Create(data)); +}); +Response response = await client.TrainMultivariateModelAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("modelId").ToString()); Console.WriteLine(result.GetProperty("createdTime").ToString()); Console.WriteLine(result.GetProperty("lastUpdatedTime").ToString()); ]]> -This sample shows how to call TrainMultivariateModelAsync with all request content, and how to parse the result. +This sample shows how to call TrainMultivariateModelAsync with all request content and parse the result. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var data = new { +RequestContent content = RequestContent.Create(new +{ dataSource = "", dataSchema = "OneTable", startTime = "2022-05-10T14:57:31.2311892-04:00", endTime = "2022-05-10T14:57:31.2311892-04:00", displayName = "", slidingWindow = 1234, - alignPolicy = new { + alignPolicy = new + { alignMode = "Inner", fillNAMethod = "Previous", - paddingValue = 123.45f, + paddingValue = 123.45F, }, status = "CREATED", - diagnosticsInfo = new { - modelState = new { - epochIds = new[] { + diagnosticsInfo = new + { + modelState = new + { + epochIds = new List() + { 1234 }, - trainLosses = new[] { - 123.45f + trainLosses = new List() + { + 123.45F }, - validationLosses = new[] { - 123.45f + validationLosses = new List() + { + 123.45F }, - latenciesInSeconds = new[] { - 123.45f + latenciesInSeconds = new List() + { + 123.45F }, }, - variableStates = new[] { - new { + variableStates = new List() + { + new + { variable = "", - filledNARatio = 123.45f, + filledNARatio = 123.45F, effectiveCount = 1234, firstTimestamp = "2022-05-10T14:57:31.2311892-04:00", lastTimestamp = "2022-05-10T14:57:31.2311892-04:00", } }, }, -}; - -Response response = await client.TrainMultivariateModelAsync(RequestContent.Create(data)); +}); +Response response = await client.TrainMultivariateModelAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("modelId").ToString()); @@ -827,77 +982,85 @@ Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo") Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("effectiveCount").ToString()); Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("firstTimestamp").ToString()); Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("lastTimestamp").ToString()); -]]> - +]]> - -This sample shows how to call TrainMultivariateModel with required request content, and how to parse the result. + +This sample shows how to call TrainMultivariateModel and parse the result. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var data = new { +RequestContent content = RequestContent.Create(new +{ dataSource = "", startTime = "2022-05-10T14:57:31.2311892-04:00", endTime = "2022-05-10T14:57:31.2311892-04:00", -}; - -Response response = client.TrainMultivariateModel(RequestContent.Create(data)); +}); +Response response = client.TrainMultivariateModel(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("modelId").ToString()); Console.WriteLine(result.GetProperty("createdTime").ToString()); Console.WriteLine(result.GetProperty("lastUpdatedTime").ToString()); ]]> -This sample shows how to call TrainMultivariateModel with all request content, and how to parse the result. +This sample shows how to call TrainMultivariateModel with all request content and parse the result. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var data = new { +RequestContent content = RequestContent.Create(new +{ dataSource = "", dataSchema = "OneTable", startTime = "2022-05-10T14:57:31.2311892-04:00", endTime = "2022-05-10T14:57:31.2311892-04:00", displayName = "", slidingWindow = 1234, - alignPolicy = new { + alignPolicy = new + { alignMode = "Inner", fillNAMethod = "Previous", - paddingValue = 123.45f, + paddingValue = 123.45F, }, status = "CREATED", - diagnosticsInfo = new { - modelState = new { - epochIds = new[] { + diagnosticsInfo = new + { + modelState = new + { + epochIds = new List() + { 1234 }, - trainLosses = new[] { - 123.45f + trainLosses = new List() + { + 123.45F }, - validationLosses = new[] { - 123.45f + validationLosses = new List() + { + 123.45F }, - latenciesInSeconds = new[] { - 123.45f + latenciesInSeconds = new List() + { + 123.45F }, }, - variableStates = new[] { - new { + variableStates = new List() + { + new + { variable = "", - filledNARatio = 123.45f, + filledNARatio = 123.45F, effectiveCount = 1234, firstTimestamp = "2022-05-10T14:57:31.2311892-04:00", lastTimestamp = "2022-05-10T14:57:31.2311892-04:00", } }, }, -}; - -Response response = client.TrainMultivariateModel(RequestContent.Create(data)); +}); +Response response = client.TrainMultivariateModel(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("modelId").ToString()); @@ -924,68 +1087,110 @@ Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo") Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("effectiveCount").ToString()); Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("firstTimestamp").ToString()); Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("lastTimestamp").ToString()); -]]> - +]]> - -This sample shows how to call DeleteMultivariateModelAsync with required parameters. + +This sample shows how to call DeleteMultivariateModelAsync. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); Response response = await client.DeleteMultivariateModelAsync(""); Console.WriteLine(response.Status); ]]> - +This sample shows how to call DeleteMultivariateModelAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +Response response = await client.DeleteMultivariateModelAsync(""); +Console.WriteLine(response.Status); +]]> - -This sample shows how to call DeleteMultivariateModel with required parameters. + +This sample shows how to call DeleteMultivariateModel. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); Response response = client.DeleteMultivariateModel(""); Console.WriteLine(response.Status); ]]> - +This sample shows how to call DeleteMultivariateModel with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +Response response = client.DeleteMultivariateModel(""); +Console.WriteLine(response.Status); +]]> - -This sample shows how to call GetMultivariateModelAsync with required parameters. + +This sample shows how to call GetMultivariateModelAsync. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var result = await client.GetMultivariateModelAsync(""); +Response response = await client.GetMultivariateModelAsync(""); ]]> - +This sample shows how to call GetMultivariateModelAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +Response response = await client.GetMultivariateModelAsync(""); +]]> - -This sample shows how to call GetMultivariateModel with required parameters. + +This sample shows how to call GetMultivariateModel. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var result = client.GetMultivariateModel(""); +Response response = client.GetMultivariateModel(""); ]]> - +This sample shows how to call GetMultivariateModel with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +Response response = client.GetMultivariateModel(""); +]]> - -This sample shows how to call GetMultivariateModelAsync with required parameters and parse the result. + +This sample shows how to call GetMultivariateModelAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +Response response = await client.GetMultivariateModelAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("modelId").ToString()); +Console.WriteLine(result.GetProperty("createdTime").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedTime").ToString()); +]]> +This sample shows how to call GetMultivariateModelAsync with all parameters and parse the result. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -Response response = await client.GetMultivariateModelAsync("", new RequestContext()); +Response response = await client.GetMultivariateModelAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("modelId").ToString()); @@ -1012,18 +1217,30 @@ Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo") Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("effectiveCount").ToString()); Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("firstTimestamp").ToString()); Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("lastTimestamp").ToString()); -]]> - +]]> - -This sample shows how to call GetMultivariateModel with required parameters and parse the result. + +This sample shows how to call GetMultivariateModel and parse the result. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -Response response = client.GetMultivariateModel("", new RequestContext()); +Response response = client.GetMultivariateModel("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("modelId").ToString()); +Console.WriteLine(result.GetProperty("createdTime").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedTime").ToString()); +]]> +This sample shows how to call GetMultivariateModel with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +Response response = client.GetMultivariateModel("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("modelId").ToString()); @@ -1050,51 +1267,90 @@ Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo") Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("effectiveCount").ToString()); Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("firstTimestamp").ToString()); Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("lastTimestamp").ToString()); -]]> - +]]> - -This sample shows how to call DetectMultivariateBatchAnomalyAsync with required parameters. + +This sample shows how to call DetectMultivariateBatchAnomalyAsync. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var options = new MultivariateBatchDetectionOptions(new Uri("http://localhost:3000"), 1234, DateTimeOffset.UtcNow, DateTimeOffset.UtcNow); -var result = await client.DetectMultivariateBatchAnomalyAsync("", options); +MultivariateBatchDetectionOptions options = new MultivariateBatchDetectionOptions(new Uri("http://localhost:3000"), 1234, DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00")); +Response response = await client.DetectMultivariateBatchAnomalyAsync("", options); ]]> - +This sample shows how to call DetectMultivariateBatchAnomalyAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +MultivariateBatchDetectionOptions options = new MultivariateBatchDetectionOptions(new Uri("http://localhost:3000"), 1234, DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00")); +Response response = await client.DetectMultivariateBatchAnomalyAsync("", options); +]]> - -This sample shows how to call DetectMultivariateBatchAnomaly with required parameters. + +This sample shows how to call DetectMultivariateBatchAnomaly. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var options = new MultivariateBatchDetectionOptions(new Uri("http://localhost:3000"), 1234, DateTimeOffset.UtcNow, DateTimeOffset.UtcNow); -var result = client.DetectMultivariateBatchAnomaly("", options); +MultivariateBatchDetectionOptions options = new MultivariateBatchDetectionOptions(new Uri("http://localhost:3000"), 1234, DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00")); +Response response = client.DetectMultivariateBatchAnomaly("", options); ]]> - +This sample shows how to call DetectMultivariateBatchAnomaly with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +MultivariateBatchDetectionOptions options = new MultivariateBatchDetectionOptions(new Uri("http://localhost:3000"), 1234, DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00")); +Response response = client.DetectMultivariateBatchAnomaly("", options); +]]> - -This sample shows how to call DetectMultivariateBatchAnomalyAsync with required parameters and request content and parse the result. + +This sample shows how to call DetectMultivariateBatchAnomalyAsync and parse the result. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var data = new { +RequestContent content = RequestContent.Create(new +{ dataSource = "http://localhost:3000", topContributorCount = 1234, startTime = "2022-05-10T14:57:31.2311892-04:00", endTime = "2022-05-10T14:57:31.2311892-04:00", -}; +}); +Response response = await client.DetectMultivariateBatchAnomalyAsync("", content); -Response response = await client.DetectMultivariateBatchAnomalyAsync("", RequestContent.Create(data)); +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("resultId").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("dataSource").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("topContributorCount").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("startTime").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("endTime").ToString()); +Console.WriteLine(result.GetProperty("results")[0].GetProperty("timestamp").ToString()); +]]> +This sample shows how to call DetectMultivariateBatchAnomalyAsync with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +RequestContent content = RequestContent.Create(new +{ + dataSource = "http://localhost:3000", + topContributorCount = 1234, + startTime = "2022-05-10T14:57:31.2311892-04:00", + endTime = "2022-05-10T14:57:31.2311892-04:00", +}); +Response response = await client.DetectMultivariateBatchAnomalyAsync("", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("resultId").ToString()); @@ -1119,25 +1375,48 @@ Console.WriteLine(result.GetProperty("results")[0].GetProperty("value").GetPrope Console.WriteLine(result.GetProperty("results")[0].GetProperty("value").GetProperty("interpretation")[0].GetProperty("correlationChanges").GetProperty("changedVariables")[0].ToString()); Console.WriteLine(result.GetProperty("results")[0].GetProperty("errors")[0].GetProperty("code").ToString()); Console.WriteLine(result.GetProperty("results")[0].GetProperty("errors")[0].GetProperty("message").ToString()); -]]> - +]]> - -This sample shows how to call DetectMultivariateBatchAnomaly with required parameters and request content and parse the result. + +This sample shows how to call DetectMultivariateBatchAnomaly and parse the result. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var data = new { +RequestContent content = RequestContent.Create(new +{ dataSource = "http://localhost:3000", topContributorCount = 1234, startTime = "2022-05-10T14:57:31.2311892-04:00", endTime = "2022-05-10T14:57:31.2311892-04:00", -}; +}); +Response response = client.DetectMultivariateBatchAnomaly("", content); -Response response = client.DetectMultivariateBatchAnomaly("", RequestContent.Create(data)); +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("resultId").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("dataSource").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("topContributorCount").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("startTime").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("endTime").ToString()); +Console.WriteLine(result.GetProperty("results")[0].GetProperty("timestamp").ToString()); +]]> +This sample shows how to call DetectMultivariateBatchAnomaly with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +RequestContent content = RequestContent.Create(new +{ + dataSource = "http://localhost:3000", + topContributorCount = 1234, + startTime = "2022-05-10T14:57:31.2311892-04:00", + endTime = "2022-05-10T14:57:31.2311892-04:00", +}); +Response response = client.DetectMultivariateBatchAnomaly("", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("resultId").ToString()); @@ -1162,77 +1441,144 @@ Console.WriteLine(result.GetProperty("results")[0].GetProperty("value").GetPrope Console.WriteLine(result.GetProperty("results")[0].GetProperty("value").GetProperty("interpretation")[0].GetProperty("correlationChanges").GetProperty("changedVariables")[0].ToString()); Console.WriteLine(result.GetProperty("results")[0].GetProperty("errors")[0].GetProperty("code").ToString()); Console.WriteLine(result.GetProperty("results")[0].GetProperty("errors")[0].GetProperty("message").ToString()); -]]> - +]]> - -This sample shows how to call DetectMultivariateLastAnomalyAsync with required parameters. + +This sample shows how to call DetectMultivariateLastAnomalyAsync. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var options = new MultivariateLastDetectionOptions(new VariableValues[] +MultivariateLastDetectionOptions options = new MultivariateLastDetectionOptions(new List() { - new VariableValues("", new string[] -{ - "" - }, new float[] -{ - 3.14f + new VariableValues("",new List() + { + "" + },new List() + { + 123.45F }) }, 1234); -var result = await client.DetectMultivariateLastAnomalyAsync("", options); +Response response = await client.DetectMultivariateLastAnomalyAsync("", options); ]]> - +This sample shows how to call DetectMultivariateLastAnomalyAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +MultivariateLastDetectionOptions options = new MultivariateLastDetectionOptions(new List() +{ + new VariableValues("",new List() + { + "" + },new List() + { + 123.45F + }) +}, 1234); +Response response = await client.DetectMultivariateLastAnomalyAsync("", options); +]]> - -This sample shows how to call DetectMultivariateLastAnomaly with required parameters. + +This sample shows how to call DetectMultivariateLastAnomaly. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var options = new MultivariateLastDetectionOptions(new VariableValues[] -{ - new VariableValues("", new string[] +MultivariateLastDetectionOptions options = new MultivariateLastDetectionOptions(new List() { - "" - }, new float[] -{ - 3.14f + new VariableValues("",new List() + { + "" + },new List() + { + 123.45F }) }, 1234); -var result = client.DetectMultivariateLastAnomaly("", options); +Response response = client.DetectMultivariateLastAnomaly("", options); ]]> - +This sample shows how to call DetectMultivariateLastAnomaly with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +MultivariateLastDetectionOptions options = new MultivariateLastDetectionOptions(new List() +{ + new VariableValues("",new List() + { + "" + },new List() + { + 123.45F + }) +}, 1234); +Response response = client.DetectMultivariateLastAnomaly("", options); +]]> - -This sample shows how to call DetectMultivariateLastAnomalyAsync with required parameters and request content and parse the result. + +This sample shows how to call DetectMultivariateLastAnomalyAsync and parse the result. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var data = new { - variables = new[] { - new { +RequestContent content = RequestContent.Create(new +{ + variables = new List() + { + new + { variable = "", - timestamps = new[] { - "" + timestamps = new List() + { + "" }, - values = new[] { - 123.45f + values = new List() + { + 123.45F }, } }, topContributorCount = 1234, -}; +}); +Response response = await client.DetectMultivariateLastAnomalyAsync("", content); -Response response = await client.DetectMultivariateLastAnomalyAsync("", RequestContent.Create(data)); +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> +This sample shows how to call DetectMultivariateLastAnomalyAsync with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +RequestContent content = RequestContent.Create(new +{ + variables = new List() + { + new + { + variable = "", + timestamps = new List() + { + "" + }, + values = new List() + { + 123.45F + }, + } + }, + topContributorCount = 1234, +}); +Response response = await client.DetectMultivariateLastAnomalyAsync("", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("variableStates")[0].GetProperty("variable").ToString()); @@ -1249,33 +1595,66 @@ Console.WriteLine(result.GetProperty("results")[0].GetProperty("value").GetPrope Console.WriteLine(result.GetProperty("results")[0].GetProperty("value").GetProperty("interpretation")[0].GetProperty("correlationChanges").GetProperty("changedVariables")[0].ToString()); Console.WriteLine(result.GetProperty("results")[0].GetProperty("errors")[0].GetProperty("code").ToString()); Console.WriteLine(result.GetProperty("results")[0].GetProperty("errors")[0].GetProperty("message").ToString()); -]]> - +]]> - -This sample shows how to call DetectMultivariateLastAnomaly with required parameters and request content and parse the result. + +This sample shows how to call DetectMultivariateLastAnomaly and parse the result. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -var data = new { - variables = new[] { - new { +RequestContent content = RequestContent.Create(new +{ + variables = new List() + { + new + { variable = "", - timestamps = new[] { - "" + timestamps = new List() + { + "" }, - values = new[] { - 123.45f + values = new List() + { + 123.45F }, } }, topContributorCount = 1234, -}; +}); +Response response = client.DetectMultivariateLastAnomaly("", content); -Response response = client.DetectMultivariateLastAnomaly("", RequestContent.Create(data)); +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> +This sample shows how to call DetectMultivariateLastAnomaly with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +RequestContent content = RequestContent.Create(new +{ + variables = new List() + { + new + { + variable = "", + timestamps = new List() + { + "" + }, + values = new List() + { + 123.45F + }, + } + }, + topContributorCount = 1234, +}); +Response response = client.DetectMultivariateLastAnomaly("", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("variableStates")[0].GetProperty("variable").ToString()); @@ -1292,114 +1671,157 @@ Console.WriteLine(result.GetProperty("results")[0].GetProperty("value").GetPrope Console.WriteLine(result.GetProperty("results")[0].GetProperty("value").GetProperty("interpretation")[0].GetProperty("correlationChanges").GetProperty("changedVariables")[0].ToString()); Console.WriteLine(result.GetProperty("results")[0].GetProperty("errors")[0].GetProperty("code").ToString()); Console.WriteLine(result.GetProperty("results")[0].GetProperty("errors")[0].GetProperty("message").ToString()); -]]> - +]]> - -This sample shows how to call GetMultivariateModelsAsync with required parameters. + +This sample shows how to call GetMultivariateModelsAsync. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -await foreach (var item in client.GetMultivariateModelsAsync(1234, 1234)) +await foreach (AnomalyDetectionModel item in client.GetMultivariateModelsAsync()) { } ]]> - +This sample shows how to call GetMultivariateModelsAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +await foreach (AnomalyDetectionModel item in client.GetMultivariateModelsAsync(skip: 1234, maxCount: 1234)) +{ +} +]]> - -This sample shows how to call GetMultivariateModels with required parameters. + +This sample shows how to call GetMultivariateModels. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -foreach (var item in client.GetMultivariateModels(1234, 1234)) +foreach (AnomalyDetectionModel item in client.GetMultivariateModels()) { } ]]> - +This sample shows how to call GetMultivariateModels with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +foreach (AnomalyDetectionModel item in client.GetMultivariateModels(skip: 1234, maxCount: 1234)) +{ +} +]]> - -This sample shows how to call GetMultivariateModelsAsync with required parameters and parse the result. + +This sample shows how to call GetMultivariateModelsAsync and parse the result. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -await foreach (var item in client.GetMultivariateModelsAsync(1234, 1234, new RequestContext())) +await foreach (BinaryData item in client.GetMultivariateModelsAsync(null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("createdTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedTime").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("dataSource").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("dataSchema").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("startTime").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("endTime").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("displayName").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("slidingWindow").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("alignPolicy").GetProperty("alignMode").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("alignPolicy").GetProperty("fillNAMethod").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("alignPolicy").GetProperty("paddingValue").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("epochIds")[0].ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("trainLosses")[0].ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("validationLosses")[0].ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("latenciesInSeconds")[0].ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("variable").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("filledNARatio").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("effectiveCount").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("firstTimestamp").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("lastTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("modelId").ToString()); + Console.WriteLine(result[0].GetProperty("createdTime").ToString()); + Console.WriteLine(result[0].GetProperty("lastUpdatedTime").ToString()); } ]]> - +This sample shows how to call GetMultivariateModelsAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +await foreach (BinaryData item in client.GetMultivariateModelsAsync(1234, 1234, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("modelId").ToString()); + Console.WriteLine(result[0].GetProperty("createdTime").ToString()); + Console.WriteLine(result[0].GetProperty("lastUpdatedTime").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("dataSource").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("dataSchema").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("startTime").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("endTime").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("displayName").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("slidingWindow").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("alignPolicy").GetProperty("alignMode").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("alignPolicy").GetProperty("fillNAMethod").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("alignPolicy").GetProperty("paddingValue").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("status").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("errors")[0].GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("errors")[0].GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("epochIds")[0].ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("trainLosses")[0].ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("validationLosses")[0].ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("latenciesInSeconds")[0].ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("variable").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("filledNARatio").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("effectiveCount").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("firstTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("lastTimestamp").ToString()); +} +]]> - -This sample shows how to call GetMultivariateModels with required parameters and parse the result. + +This sample shows how to call GetMultivariateModels and parse the result. "); -var endpoint = new Uri(""); -var client = new AnomalyDetectorClient(endpoint, credential); +Uri endpoint = new Uri(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); -foreach (var item in client.GetMultivariateModels(1234, 1234, new RequestContext())) +foreach (BinaryData item in client.GetMultivariateModels(null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("createdTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedTime").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("dataSource").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("dataSchema").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("startTime").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("endTime").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("displayName").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("slidingWindow").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("alignPolicy").GetProperty("alignMode").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("alignPolicy").GetProperty("fillNAMethod").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("alignPolicy").GetProperty("paddingValue").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("epochIds")[0].ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("trainLosses")[0].ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("validationLosses")[0].ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("latenciesInSeconds")[0].ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("variable").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("filledNARatio").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("effectiveCount").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("firstTimestamp").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("lastTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("modelId").ToString()); + Console.WriteLine(result[0].GetProperty("createdTime").ToString()); + Console.WriteLine(result[0].GetProperty("lastUpdatedTime").ToString()); } ]]> - +This sample shows how to call GetMultivariateModels with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + +foreach (BinaryData item in client.GetMultivariateModels(1234, 1234, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("modelId").ToString()); + Console.WriteLine(result[0].GetProperty("createdTime").ToString()); + Console.WriteLine(result[0].GetProperty("lastUpdatedTime").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("dataSource").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("dataSchema").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("startTime").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("endTime").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("displayName").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("slidingWindow").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("alignPolicy").GetProperty("alignMode").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("alignPolicy").GetProperty("fillNAMethod").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("alignPolicy").GetProperty("paddingValue").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("status").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("errors")[0].GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("errors")[0].GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("epochIds")[0].ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("trainLosses")[0].ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("validationLosses")[0].ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("latenciesInSeconds")[0].ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("variable").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("filledNARatio").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("effectiveCount").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("firstTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("lastTimestamp").ToString()); +} +]]> \ No newline at end of file diff --git a/samples/AnomalyDetector/tests/Generated/Samples/Samples_AnomalyDetectorClient.cs b/samples/AnomalyDetector/tests/Generated/Samples/Samples_AnomalyDetectorClient.cs index 8d456fa6a9d..9fdcfc4ccde 100644 --- a/samples/AnomalyDetector/tests/Generated/Samples/Samples_AnomalyDetectorClient.cs +++ b/samples/AnomalyDetector/tests/Generated/Samples/Samples_AnomalyDetectorClient.cs @@ -7,9 +7,9 @@ using System; using System.Collections.Generic; -using System.IO; using System.Text.Json; using System.Threading.Tasks; +using AnomalyDetector; using AnomalyDetector.Models; using Azure; using Azure.Core; @@ -24,20 +24,21 @@ public class Samples_AnomalyDetectorClient [Ignore("Only validating compilation of examples")] public void Example_DetectUnivariateEntireSeries() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var data = new + RequestContent content = RequestContent.Create(new { - series = new[] { - new { - value = 123.45f, - } - }, - }; - - Response response = client.DetectUnivariateEntireSeries(RequestContent.Create(data)); + series = new List() +{ +new +{ +value = 123.45F, +} +}, + }); + Response response = client.DetectUnivariateEntireSeries(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("period").ToString()); @@ -53,28 +54,29 @@ public void Example_DetectUnivariateEntireSeries() [Ignore("Only validating compilation of examples")] public void Example_DetectUnivariateEntireSeries_AllParameters() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var data = new + RequestContent content = RequestContent.Create(new { - series = new[] { - new { - timestamp = "2022-05-10T14:57:31.2311892-04:00", - value = 123.45f, - } - }, + series = new List() +{ +new +{ +timestamp = "2022-05-10T14:57:31.2311892-04:00", +value = 123.45F, +} +}, granularity = "yearly", customInterval = 1234, period = 1234, - maxAnomalyRatio = 123.45f, + maxAnomalyRatio = 123.45F, sensitivity = 1234, imputeMode = "auto", - imputeFixedValue = 123.45f, - }; - - Response response = client.DetectUnivariateEntireSeries(RequestContent.Create(data)); + imputeFixedValue = 123.45F, + }); + Response response = client.DetectUnivariateEntireSeries(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("period").ToString()); @@ -89,22 +91,65 @@ public void Example_DetectUnivariateEntireSeries_AllParameters() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DetectUnivariateEntireSeries_Async() + public void Example_DetectUnivariateEntireSeries_Convenience() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var data = new - { - series = new[] { - new { - value = 123.45f, + UnivariateDetectionOptions options = new UnivariateDetectionOptions(new List() +{ +new TimeSeriesPoint(123.45F) +}); + Response response = client.DetectUnivariateEntireSeries(options); } - }, + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DetectUnivariateEntireSeries_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + + UnivariateDetectionOptions options = new UnivariateDetectionOptions(new List() +{ +new TimeSeriesPoint(123.45F) +{ +Timestamp = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), +} +}) + { + Granularity = TimeGranularity.Yearly, + CustomInterval = 1234, + Period = 1234, + MaxAnomalyRatio = 123.45F, + Sensitivity = 1234, + ImputeMode = ImputeMode.Auto, + ImputeFixedValue = 123.45F, }; + Response response = client.DetectUnivariateEntireSeries(options); + } - Response response = await client.DetectUnivariateEntireSeriesAsync(RequestContent.Create(data)); + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DetectUnivariateEntireSeries_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + + RequestContent content = RequestContent.Create(new + { + series = new List() +{ +new +{ +value = 123.45F, +} +}, + }); + Response response = await client.DetectUnivariateEntireSeriesAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("period").ToString()); @@ -120,28 +165,29 @@ public async Task Example_DetectUnivariateEntireSeries_Async() [Ignore("Only validating compilation of examples")] public async Task Example_DetectUnivariateEntireSeries_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var data = new + RequestContent content = RequestContent.Create(new { - series = new[] { - new { - timestamp = "2022-05-10T14:57:31.2311892-04:00", - value = 123.45f, - } - }, + series = new List() +{ +new +{ +timestamp = "2022-05-10T14:57:31.2311892-04:00", +value = 123.45F, +} +}, granularity = "yearly", customInterval = 1234, period = 1234, - maxAnomalyRatio = 123.45f, + maxAnomalyRatio = 123.45F, sensitivity = 1234, imputeMode = "auto", - imputeFixedValue = 123.45f, - }; - - Response response = await client.DetectUnivariateEntireSeriesAsync(RequestContent.Create(data)); + imputeFixedValue = 123.45F, + }); + Response response = await client.DetectUnivariateEntireSeriesAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("period").ToString()); @@ -158,47 +204,63 @@ public async Task Example_DetectUnivariateEntireSeries_AllParameters_Async() [Ignore("Only validating compilation of examples")] public async Task Example_DetectUnivariateEntireSeries_Convenience_Async() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var options = new UnivariateDetectionOptions(new TimeSeriesPoint[] - { - new TimeSeriesPoint(3.14f) + UnivariateDetectionOptions options = new UnivariateDetectionOptions(new List() { - Timestamp = DateTimeOffset.UtcNow, - } - }) +new TimeSeriesPoint(123.45F) +}); + Response response = await client.DetectUnivariateEntireSeriesAsync(options); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DetectUnivariateEntireSeries_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + + UnivariateDetectionOptions options = new UnivariateDetectionOptions(new List() +{ +new TimeSeriesPoint(123.45F) +{ +Timestamp = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), +} +}) { Granularity = TimeGranularity.Yearly, CustomInterval = 1234, Period = 1234, - MaxAnomalyRatio = 3.14f, + MaxAnomalyRatio = 123.45F, Sensitivity = 1234, ImputeMode = ImputeMode.Auto, - ImputeFixedValue = 3.14f, + ImputeFixedValue = 123.45F, }; - var result = await client.DetectUnivariateEntireSeriesAsync(options); + Response response = await client.DetectUnivariateEntireSeriesAsync(options); } [Test] [Ignore("Only validating compilation of examples")] public void Example_DetectUnivariateLastPoint() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var data = new + RequestContent content = RequestContent.Create(new { - series = new[] { - new { - value = 123.45f, - } - }, - }; - - Response response = client.DetectUnivariateLastPoint(RequestContent.Create(data)); + series = new List() +{ +new +{ +value = 123.45F, +} +}, + }); + Response response = client.DetectUnivariateLastPoint(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("period").ToString()); @@ -215,28 +277,29 @@ public void Example_DetectUnivariateLastPoint() [Ignore("Only validating compilation of examples")] public void Example_DetectUnivariateLastPoint_AllParameters() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var data = new + RequestContent content = RequestContent.Create(new { - series = new[] { - new { - timestamp = "2022-05-10T14:57:31.2311892-04:00", - value = 123.45f, - } - }, + series = new List() +{ +new +{ +timestamp = "2022-05-10T14:57:31.2311892-04:00", +value = 123.45F, +} +}, granularity = "yearly", customInterval = 1234, period = 1234, - maxAnomalyRatio = 123.45f, + maxAnomalyRatio = 123.45F, sensitivity = 1234, imputeMode = "auto", - imputeFixedValue = 123.45f, - }; - - Response response = client.DetectUnivariateLastPoint(RequestContent.Create(data)); + imputeFixedValue = 123.45F, + }); + Response response = client.DetectUnivariateLastPoint(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("period").ToString()); @@ -252,22 +315,65 @@ public void Example_DetectUnivariateLastPoint_AllParameters() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DetectUnivariateLastPoint_Async() + public void Example_DetectUnivariateLastPoint_Convenience() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var data = new - { - series = new[] { - new { - value = 123.45f, + UnivariateDetectionOptions options = new UnivariateDetectionOptions(new List() +{ +new TimeSeriesPoint(123.45F) +}); + Response response = client.DetectUnivariateLastPoint(options); } - }, + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DetectUnivariateLastPoint_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + + UnivariateDetectionOptions options = new UnivariateDetectionOptions(new List() +{ +new TimeSeriesPoint(123.45F) +{ +Timestamp = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), +} +}) + { + Granularity = TimeGranularity.Yearly, + CustomInterval = 1234, + Period = 1234, + MaxAnomalyRatio = 123.45F, + Sensitivity = 1234, + ImputeMode = ImputeMode.Auto, + ImputeFixedValue = 123.45F, }; + Response response = client.DetectUnivariateLastPoint(options); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DetectUnivariateLastPoint_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - Response response = await client.DetectUnivariateLastPointAsync(RequestContent.Create(data)); + RequestContent content = RequestContent.Create(new + { + series = new List() +{ +new +{ +value = 123.45F, +} +}, + }); + Response response = await client.DetectUnivariateLastPointAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("period").ToString()); @@ -284,28 +390,29 @@ public async Task Example_DetectUnivariateLastPoint_Async() [Ignore("Only validating compilation of examples")] public async Task Example_DetectUnivariateLastPoint_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var data = new + RequestContent content = RequestContent.Create(new { - series = new[] { - new { - timestamp = "2022-05-10T14:57:31.2311892-04:00", - value = 123.45f, - } - }, + series = new List() +{ +new +{ +timestamp = "2022-05-10T14:57:31.2311892-04:00", +value = 123.45F, +} +}, granularity = "yearly", customInterval = 1234, period = 1234, - maxAnomalyRatio = 123.45f, + maxAnomalyRatio = 123.45F, sensitivity = 1234, imputeMode = "auto", - imputeFixedValue = 123.45f, - }; - - Response response = await client.DetectUnivariateLastPointAsync(RequestContent.Create(data)); + imputeFixedValue = 123.45F, + }); + Response response = await client.DetectUnivariateLastPointAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("period").ToString()); @@ -323,48 +430,64 @@ public async Task Example_DetectUnivariateLastPoint_AllParameters_Async() [Ignore("Only validating compilation of examples")] public async Task Example_DetectUnivariateLastPoint_Convenience_Async() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var options = new UnivariateDetectionOptions(new TimeSeriesPoint[] - { - new TimeSeriesPoint(3.14f) + UnivariateDetectionOptions options = new UnivariateDetectionOptions(new List() { - Timestamp = DateTimeOffset.UtcNow, - } - }) +new TimeSeriesPoint(123.45F) +}); + Response response = await client.DetectUnivariateLastPointAsync(options); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DetectUnivariateLastPoint_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + + UnivariateDetectionOptions options = new UnivariateDetectionOptions(new List() +{ +new TimeSeriesPoint(123.45F) +{ +Timestamp = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), +} +}) { Granularity = TimeGranularity.Yearly, CustomInterval = 1234, Period = 1234, - MaxAnomalyRatio = 3.14f, + MaxAnomalyRatio = 123.45F, Sensitivity = 1234, ImputeMode = ImputeMode.Auto, - ImputeFixedValue = 3.14f, + ImputeFixedValue = 123.45F, }; - var result = await client.DetectUnivariateLastPointAsync(options); + Response response = await client.DetectUnivariateLastPointAsync(options); } [Test] [Ignore("Only validating compilation of examples")] public void Example_DetectUnivariateChangePoint() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var data = new + RequestContent content = RequestContent.Create(new { - series = new[] { - new { - value = 123.45f, - } - }, + series = new List() +{ +new +{ +value = 123.45F, +} +}, granularity = "yearly", - }; - - Response response = client.DetectUnivariateChangePoint(RequestContent.Create(data)); + }); + Response response = client.DetectUnivariateChangePoint(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -374,26 +497,27 @@ public void Example_DetectUnivariateChangePoint() [Ignore("Only validating compilation of examples")] public void Example_DetectUnivariateChangePoint_AllParameters() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var data = new + RequestContent content = RequestContent.Create(new { - series = new[] { - new { - timestamp = "2022-05-10T14:57:31.2311892-04:00", - value = 123.45f, - } - }, + series = new List() +{ +new +{ +timestamp = "2022-05-10T14:57:31.2311892-04:00", +value = 123.45F, +} +}, granularity = "yearly", customInterval = 1234, period = 1234, stableTrendWindow = 1234, - threshold = 123.45f, - }; - - Response response = client.DetectUnivariateChangePoint(RequestContent.Create(data)); + threshold = 123.45F, + }); + Response response = client.DetectUnivariateChangePoint(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("period").ToString()); @@ -403,23 +527,63 @@ public void Example_DetectUnivariateChangePoint_AllParameters() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DetectUnivariateChangePoint_Async() + public void Example_DetectUnivariateChangePoint_Convenience() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var data = new - { - series = new[] { - new { - value = 123.45f, + UnivariateChangePointDetectionOptions options = new UnivariateChangePointDetectionOptions(new List() +{ +new TimeSeriesPoint(123.45F) +}, TimeGranularity.Yearly); + Response response = client.DetectUnivariateChangePoint(options); } - }, - granularity = "yearly", + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DetectUnivariateChangePoint_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + + UnivariateChangePointDetectionOptions options = new UnivariateChangePointDetectionOptions(new List() +{ +new TimeSeriesPoint(123.45F) +{ +Timestamp = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), +} +}, TimeGranularity.Yearly) + { + CustomInterval = 1234, + Period = 1234, + StableTrendWindow = 1234, + Threshold = 123.45F, }; + Response response = client.DetectUnivariateChangePoint(options); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DetectUnivariateChangePoint_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - Response response = await client.DetectUnivariateChangePointAsync(RequestContent.Create(data)); + RequestContent content = RequestContent.Create(new + { + series = new List() +{ +new +{ +value = 123.45F, +} +}, + granularity = "yearly", + }); + Response response = await client.DetectUnivariateChangePointAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -429,26 +593,27 @@ public async Task Example_DetectUnivariateChangePoint_Async() [Ignore("Only validating compilation of examples")] public async Task Example_DetectUnivariateChangePoint_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var data = new + RequestContent content = RequestContent.Create(new { - series = new[] { - new { - timestamp = "2022-05-10T14:57:31.2311892-04:00", - value = 123.45f, - } - }, + series = new List() +{ +new +{ +timestamp = "2022-05-10T14:57:31.2311892-04:00", +value = 123.45F, +} +}, granularity = "yearly", customInterval = 1234, period = 1234, stableTrendWindow = 1234, - threshold = 123.45f, - }; - - Response response = await client.DetectUnivariateChangePointAsync(RequestContent.Create(data)); + threshold = 123.45F, + }); + Response response = await client.DetectUnivariateChangePointAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("period").ToString()); @@ -460,35 +625,50 @@ public async Task Example_DetectUnivariateChangePoint_AllParameters_Async() [Ignore("Only validating compilation of examples")] public async Task Example_DetectUnivariateChangePoint_Convenience_Async() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var options = new UnivariateChangePointDetectionOptions(new TimeSeriesPoint[] - { - new TimeSeriesPoint(3.14f) + UnivariateChangePointDetectionOptions options = new UnivariateChangePointDetectionOptions(new List() { - Timestamp = DateTimeOffset.UtcNow, - } - }, TimeGranularity.Yearly) +new TimeSeriesPoint(123.45F) +}, TimeGranularity.Yearly); + Response response = await client.DetectUnivariateChangePointAsync(options); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DetectUnivariateChangePoint_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + + UnivariateChangePointDetectionOptions options = new UnivariateChangePointDetectionOptions(new List() +{ +new TimeSeriesPoint(123.45F) +{ +Timestamp = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), +} +}, TimeGranularity.Yearly) { CustomInterval = 1234, Period = 1234, StableTrendWindow = 1234, - Threshold = 3.14f, + Threshold = 123.45F, }; - var result = await client.DetectUnivariateChangePointAsync(options); + Response response = await client.DetectUnivariateChangePointAsync(options); } [Test] [Ignore("Only validating compilation of examples")] public void Example_GetMultivariateBatchDetectionResult() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - Response response = client.GetMultivariateBatchDetectionResult(Guid.NewGuid(), new RequestContext()); + Response response = client.GetMultivariateBatchDetectionResult(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("resultId").ToString()); @@ -504,11 +684,11 @@ public void Example_GetMultivariateBatchDetectionResult() [Ignore("Only validating compilation of examples")] public void Example_GetMultivariateBatchDetectionResult_AllParameters() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - Response response = client.GetMultivariateBatchDetectionResult(Guid.NewGuid(), new RequestContext()); + Response response = client.GetMultivariateBatchDetectionResult(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("resultId").ToString()); @@ -535,15 +715,37 @@ public void Example_GetMultivariateBatchDetectionResult_AllParameters() Console.WriteLine(result.GetProperty("results")[0].GetProperty("errors")[0].GetProperty("message").ToString()); } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetMultivariateBatchDetectionResult_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + + Response response = client.GetMultivariateBatchDetectionResult(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetMultivariateBatchDetectionResult_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + + Response response = client.GetMultivariateBatchDetectionResult(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task Example_GetMultivariateBatchDetectionResult_Async() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - Response response = await client.GetMultivariateBatchDetectionResultAsync(Guid.NewGuid(), new RequestContext()); + Response response = await client.GetMultivariateBatchDetectionResultAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("resultId").ToString()); @@ -559,11 +761,11 @@ public async Task Example_GetMultivariateBatchDetectionResult_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetMultivariateBatchDetectionResult_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - Response response = await client.GetMultivariateBatchDetectionResultAsync(Guid.NewGuid(), new RequestContext()); + Response response = await client.GetMultivariateBatchDetectionResultAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("resultId").ToString()); @@ -594,29 +796,39 @@ public async Task Example_GetMultivariateBatchDetectionResult_AllParameters_Asyn [Ignore("Only validating compilation of examples")] public async Task Example_GetMultivariateBatchDetectionResult_Convenience_Async() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var result = await client.GetMultivariateBatchDetectionResultAsync(Guid.NewGuid()); + Response response = await client.GetMultivariateBatchDetectionResultAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetMultivariateBatchDetectionResult_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + + Response response = await client.GetMultivariateBatchDetectionResultAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); } [Test] [Ignore("Only validating compilation of examples")] public void Example_TrainMultivariateModel() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var data = new + RequestContent content = RequestContent.Create(new { dataSource = "", startTime = "2022-05-10T14:57:31.2311892-04:00", endTime = "2022-05-10T14:57:31.2311892-04:00", - }; - - Response response = client.TrainMultivariateModel(RequestContent.Create(data)); + }); + Response response = client.TrainMultivariateModel(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("modelId").ToString()); @@ -628,11 +840,11 @@ public void Example_TrainMultivariateModel() [Ignore("Only validating compilation of examples")] public void Example_TrainMultivariateModel_AllParameters() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var data = new + RequestContent content = RequestContent.Create(new { dataSource = "", dataSchema = "OneTable", @@ -644,39 +856,44 @@ public void Example_TrainMultivariateModel_AllParameters() { alignMode = "Inner", fillNAMethod = "Previous", - paddingValue = 123.45f, + paddingValue = 123.45F, }, status = "CREATED", diagnosticsInfo = new { modelState = new { - epochIds = new[] { - 1234 - }, - trainLosses = new[] { - 123.45f - }, - validationLosses = new[] { - 123.45f - }, - latenciesInSeconds = new[] { - 123.45f - }, + epochIds = new List() +{ +1234 +}, + trainLosses = new List() +{ +123.45F +}, + validationLosses = new List() +{ +123.45F +}, + latenciesInSeconds = new List() +{ +123.45F +}, }, - variableStates = new[] { - new { - variable = "", - filledNARatio = 123.45f, - effectiveCount = 1234, - firstTimestamp = "2022-05-10T14:57:31.2311892-04:00", - lastTimestamp = "2022-05-10T14:57:31.2311892-04:00", - } - }, + variableStates = new List() +{ +new +{ +variable = "", +filledNARatio = 123.45F, +effectiveCount = 1234, +firstTimestamp = "2022-05-10T14:57:31.2311892-04:00", +lastTimestamp = "2022-05-10T14:57:31.2311892-04:00", +} +}, }, - }; - - Response response = client.TrainMultivariateModel(RequestContent.Create(data)); + }); + Response response = client.TrainMultivariateModel(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("modelId").ToString()); @@ -705,22 +922,90 @@ public void Example_TrainMultivariateModel_AllParameters() Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("lastTimestamp").ToString()); } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TrainMultivariateModel_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + + ModelInfo modelInfo = new ModelInfo("", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00")); + Response response = client.TrainMultivariateModel(modelInfo); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TrainMultivariateModel_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + + ModelInfo modelInfo = new ModelInfo("", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00")) + { + DataSchema = DataSchema.OneTable, + DisplayName = "", + SlidingWindow = 1234, + AlignPolicy = new AlignPolicy() + { + AlignMode = AlignMode.Inner, + FillNAMethod = FillNAMethod.Previous, + PaddingValue = 123.45F, + }, + Status = ModelStatus.Created, + DiagnosticsInfo = new DiagnosticsInfo() + { + ModelState = new ModelState() + { + EpochIds = +{ +1234 +}, + TrainLosses = +{ +123.45F +}, + ValidationLosses = +{ +123.45F +}, + LatenciesInSeconds = +{ +123.45F +}, + }, + VariableStates = +{ +new VariableState() +{ +Variable = "", +FilledNARatio = 123.45F, +EffectiveCount = 1234, +FirstTimestamp = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), +LastTimestamp = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), +} +}, + }, + }; + Response response = client.TrainMultivariateModel(modelInfo); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task Example_TrainMultivariateModel_Async() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var data = new + RequestContent content = RequestContent.Create(new { dataSource = "", startTime = "2022-05-10T14:57:31.2311892-04:00", endTime = "2022-05-10T14:57:31.2311892-04:00", - }; - - Response response = await client.TrainMultivariateModelAsync(RequestContent.Create(data)); + }); + Response response = await client.TrainMultivariateModelAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("modelId").ToString()); @@ -732,11 +1017,11 @@ public async Task Example_TrainMultivariateModel_Async() [Ignore("Only validating compilation of examples")] public async Task Example_TrainMultivariateModel_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var data = new + RequestContent content = RequestContent.Create(new { dataSource = "", dataSchema = "OneTable", @@ -748,39 +1033,44 @@ public async Task Example_TrainMultivariateModel_AllParameters_Async() { alignMode = "Inner", fillNAMethod = "Previous", - paddingValue = 123.45f, + paddingValue = 123.45F, }, status = "CREATED", diagnosticsInfo = new { modelState = new { - epochIds = new[] { - 1234 - }, - trainLosses = new[] { - 123.45f - }, - validationLosses = new[] { - 123.45f - }, - latenciesInSeconds = new[] { - 123.45f - }, + epochIds = new List() +{ +1234 +}, + trainLosses = new List() +{ +123.45F +}, + validationLosses = new List() +{ +123.45F +}, + latenciesInSeconds = new List() +{ +123.45F +}, }, - variableStates = new[] { - new { - variable = "", - filledNARatio = 123.45f, - effectiveCount = 1234, - firstTimestamp = "2022-05-10T14:57:31.2311892-04:00", - lastTimestamp = "2022-05-10T14:57:31.2311892-04:00", - } - }, + variableStates = new List() +{ +new +{ +variable = "", +filledNARatio = 123.45F, +effectiveCount = 1234, +firstTimestamp = "2022-05-10T14:57:31.2311892-04:00", +lastTimestamp = "2022-05-10T14:57:31.2311892-04:00", +} +}, }, - }; - - Response response = await client.TrainMultivariateModelAsync(RequestContent.Create(data)); + }); + Response response = await client.TrainMultivariateModelAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("modelId").ToString()); @@ -813,20 +1103,32 @@ public async Task Example_TrainMultivariateModel_AllParameters_Async() [Ignore("Only validating compilation of examples")] public async Task Example_TrainMultivariateModel_Convenience_Async() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + + ModelInfo modelInfo = new ModelInfo("", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00")); + Response response = await client.TrainMultivariateModelAsync(modelInfo); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TrainMultivariateModel_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var modelInfo = new ModelInfo("", DateTimeOffset.UtcNow, DateTimeOffset.UtcNow) + ModelInfo modelInfo = new ModelInfo("", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00")) { DataSchema = DataSchema.OneTable, - DisplayName = "", + DisplayName = "", SlidingWindow = 1234, AlignPolicy = new AlignPolicy() { AlignMode = AlignMode.Inner, FillNAMethod = FillNAMethod.Previous, - PaddingValue = 3.14f, + PaddingValue = 123.45F, }, Status = ModelStatus.Created, DiagnosticsInfo = new DiagnosticsInfo() @@ -835,44 +1137,44 @@ public async Task Example_TrainMultivariateModel_Convenience_Async() { EpochIds = { - 1234 - }, +1234 +}, TrainLosses = { - 3.14f - }, +123.45F +}, ValidationLosses = { - 3.14f - }, +123.45F +}, LatenciesInSeconds = { - 3.14f - }, +123.45F +}, }, VariableStates = { - new VariableState() +new VariableState() { - Variable = "", - FilledNARatio = 3.14f, - EffectiveCount = 1234, - FirstTimestamp = DateTimeOffset.UtcNow, - LastTimestamp = DateTimeOffset.UtcNow, - } - }, +Variable = "", +FilledNARatio = 123.45F, +EffectiveCount = 1234, +FirstTimestamp = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), +LastTimestamp = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), +} +}, }, }; - var result = await client.TrainMultivariateModelAsync(modelInfo); + Response response = await client.TrainMultivariateModelAsync(modelInfo); } [Test] [Ignore("Only validating compilation of examples")] public void Example_DeleteMultivariateModel() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); Response response = client.DeleteMultivariateModel(""); Console.WriteLine(response.Status); @@ -882,9 +1184,9 @@ public void Example_DeleteMultivariateModel() [Ignore("Only validating compilation of examples")] public void Example_DeleteMultivariateModel_AllParameters() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); Response response = client.DeleteMultivariateModel(""); Console.WriteLine(response.Status); @@ -894,9 +1196,9 @@ public void Example_DeleteMultivariateModel_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_DeleteMultivariateModel_Async() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); Response response = await client.DeleteMultivariateModelAsync(""); Console.WriteLine(response.Status); @@ -906,9 +1208,9 @@ public async Task Example_DeleteMultivariateModel_Async() [Ignore("Only validating compilation of examples")] public async Task Example_DeleteMultivariateModel_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); Response response = await client.DeleteMultivariateModelAsync(""); Console.WriteLine(response.Status); @@ -918,11 +1220,11 @@ public async Task Example_DeleteMultivariateModel_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetMultivariateModel() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - Response response = client.GetMultivariateModel("", new RequestContext()); + Response response = client.GetMultivariateModel("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("modelId").ToString()); @@ -934,11 +1236,11 @@ public void Example_GetMultivariateModel() [Ignore("Only validating compilation of examples")] public void Example_GetMultivariateModel_AllParameters() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - Response response = client.GetMultivariateModel("", new RequestContext()); + Response response = client.GetMultivariateModel("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("modelId").ToString()); @@ -967,15 +1269,37 @@ public void Example_GetMultivariateModel_AllParameters() Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("lastTimestamp").ToString()); } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetMultivariateModel_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + + Response response = client.GetMultivariateModel(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetMultivariateModel_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + + Response response = client.GetMultivariateModel(""); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task Example_GetMultivariateModel_Async() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - Response response = await client.GetMultivariateModelAsync("", new RequestContext()); + Response response = await client.GetMultivariateModelAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("modelId").ToString()); @@ -987,11 +1311,11 @@ public async Task Example_GetMultivariateModel_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetMultivariateModel_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - Response response = await client.GetMultivariateModelAsync("", new RequestContext()); + Response response = await client.GetMultivariateModelAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("modelId").ToString()); @@ -1024,30 +1348,40 @@ public async Task Example_GetMultivariateModel_AllParameters_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetMultivariateModel_Convenience_Async() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + + Response response = await client.GetMultivariateModelAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetMultivariateModel_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var result = await client.GetMultivariateModelAsync(""); + Response response = await client.GetMultivariateModelAsync(""); } [Test] [Ignore("Only validating compilation of examples")] public void Example_DetectMultivariateBatchAnomaly() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var data = new + RequestContent content = RequestContent.Create(new { dataSource = "http://localhost:3000", topContributorCount = 1234, startTime = "2022-05-10T14:57:31.2311892-04:00", endTime = "2022-05-10T14:57:31.2311892-04:00", - }; - - Response response = client.DetectMultivariateBatchAnomaly("", RequestContent.Create(data)); + }); + Response response = client.DetectMultivariateBatchAnomaly("", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("resultId").ToString()); @@ -1063,19 +1397,18 @@ public void Example_DetectMultivariateBatchAnomaly() [Ignore("Only validating compilation of examples")] public void Example_DetectMultivariateBatchAnomaly_AllParameters() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var data = new + RequestContent content = RequestContent.Create(new { dataSource = "http://localhost:3000", topContributorCount = 1234, startTime = "2022-05-10T14:57:31.2311892-04:00", endTime = "2022-05-10T14:57:31.2311892-04:00", - }; - - Response response = client.DetectMultivariateBatchAnomaly("", RequestContent.Create(data)); + }); + Response response = client.DetectMultivariateBatchAnomaly("", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("resultId").ToString()); @@ -1102,23 +1435,46 @@ public void Example_DetectMultivariateBatchAnomaly_AllParameters() Console.WriteLine(result.GetProperty("results")[0].GetProperty("errors")[0].GetProperty("message").ToString()); } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DetectMultivariateBatchAnomaly_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + + MultivariateBatchDetectionOptions options = new MultivariateBatchDetectionOptions(new Uri("http://localhost:3000"), 1234, DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00")); + Response response = client.DetectMultivariateBatchAnomaly("", options); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DetectMultivariateBatchAnomaly_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + + MultivariateBatchDetectionOptions options = new MultivariateBatchDetectionOptions(new Uri("http://localhost:3000"), 1234, DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00")); + Response response = client.DetectMultivariateBatchAnomaly("", options); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task Example_DetectMultivariateBatchAnomaly_Async() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var data = new + RequestContent content = RequestContent.Create(new { dataSource = "http://localhost:3000", topContributorCount = 1234, startTime = "2022-05-10T14:57:31.2311892-04:00", endTime = "2022-05-10T14:57:31.2311892-04:00", - }; - - Response response = await client.DetectMultivariateBatchAnomalyAsync("", RequestContent.Create(data)); + }); + Response response = await client.DetectMultivariateBatchAnomalyAsync("", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("resultId").ToString()); @@ -1134,19 +1490,18 @@ public async Task Example_DetectMultivariateBatchAnomaly_Async() [Ignore("Only validating compilation of examples")] public async Task Example_DetectMultivariateBatchAnomaly_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var data = new + RequestContent content = RequestContent.Create(new { dataSource = "http://localhost:3000", topContributorCount = 1234, startTime = "2022-05-10T14:57:31.2311892-04:00", endTime = "2022-05-10T14:57:31.2311892-04:00", - }; - - Response response = await client.DetectMultivariateBatchAnomalyAsync("", RequestContent.Create(data)); + }); + Response response = await client.DetectMultivariateBatchAnomalyAsync("", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("resultId").ToString()); @@ -1177,39 +1532,54 @@ public async Task Example_DetectMultivariateBatchAnomaly_AllParameters_Async() [Ignore("Only validating compilation of examples")] public async Task Example_DetectMultivariateBatchAnomaly_Convenience_Async() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + + MultivariateBatchDetectionOptions options = new MultivariateBatchDetectionOptions(new Uri("http://localhost:3000"), 1234, DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00")); + Response response = await client.DetectMultivariateBatchAnomalyAsync("", options); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DetectMultivariateBatchAnomaly_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var options = new MultivariateBatchDetectionOptions(new Uri("http://localhost:3000"), 1234, DateTimeOffset.UtcNow, DateTimeOffset.UtcNow); - var result = await client.DetectMultivariateBatchAnomalyAsync("", options); + MultivariateBatchDetectionOptions options = new MultivariateBatchDetectionOptions(new Uri("http://localhost:3000"), 1234, DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00")); + Response response = await client.DetectMultivariateBatchAnomalyAsync("", options); } [Test] [Ignore("Only validating compilation of examples")] public void Example_DetectMultivariateLastAnomaly() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var data = new + RequestContent content = RequestContent.Create(new { - variables = new[] { - new { - variable = "", - timestamps = new[] { - "" - }, - values = new[] { - 123.45f - }, - } - }, + variables = new List() +{ +new +{ +variable = "", +timestamps = new List() +{ +"" +}, +values = new List() +{ +123.45F +}, +} +}, topContributorCount = 1234, - }; - - Response response = client.DetectMultivariateLastAnomaly("", RequestContent.Create(data)); + }); + Response response = client.DetectMultivariateLastAnomaly("", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -1219,27 +1589,30 @@ public void Example_DetectMultivariateLastAnomaly() [Ignore("Only validating compilation of examples")] public void Example_DetectMultivariateLastAnomaly_AllParameters() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var data = new + RequestContent content = RequestContent.Create(new { - variables = new[] { - new { - variable = "", - timestamps = new[] { - "" - }, - values = new[] { - 123.45f - }, - } - }, + variables = new List() +{ +new +{ +variable = "", +timestamps = new List() +{ +"" +}, +values = new List() +{ +123.45F +}, +} +}, topContributorCount = 1234, - }; - - Response response = client.DetectMultivariateLastAnomaly("", RequestContent.Create(data)); + }); + Response response = client.DetectMultivariateLastAnomaly("", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("variableStates")[0].GetProperty("variable").ToString()); @@ -1258,31 +1631,76 @@ public void Example_DetectMultivariateLastAnomaly_AllParameters() Console.WriteLine(result.GetProperty("results")[0].GetProperty("errors")[0].GetProperty("message").ToString()); } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DetectMultivariateLastAnomaly_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + + MultivariateLastDetectionOptions options = new MultivariateLastDetectionOptions(new List() +{ +new VariableValues("",new List() +{ +"" +},new List() +{ +123.45F +}) +}, 1234); + Response response = client.DetectMultivariateLastAnomaly("", options); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DetectMultivariateLastAnomaly_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + + MultivariateLastDetectionOptions options = new MultivariateLastDetectionOptions(new List() +{ +new VariableValues("",new List() +{ +"" +},new List() +{ +123.45F +}) +}, 1234); + Response response = client.DetectMultivariateLastAnomaly("", options); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task Example_DetectMultivariateLastAnomaly_Async() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var data = new + RequestContent content = RequestContent.Create(new { - variables = new[] { - new { - variable = "", - timestamps = new[] { - "" - }, - values = new[] { - 123.45f - }, - } - }, + variables = new List() +{ +new +{ +variable = "", +timestamps = new List() +{ +"" +}, +values = new List() +{ +123.45F +}, +} +}, topContributorCount = 1234, - }; - - Response response = await client.DetectMultivariateLastAnomalyAsync("", RequestContent.Create(data)); + }); + Response response = await client.DetectMultivariateLastAnomalyAsync("", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -1292,27 +1710,30 @@ public async Task Example_DetectMultivariateLastAnomaly_Async() [Ignore("Only validating compilation of examples")] public async Task Example_DetectMultivariateLastAnomaly_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var data = new + RequestContent content = RequestContent.Create(new { - variables = new[] { - new { - variable = "", - timestamps = new[] { - "" - }, - values = new[] { - 123.45f - }, - } - }, + variables = new List() +{ +new +{ +variable = "", +timestamps = new List() +{ +"" +}, +values = new List() +{ +123.45F +}, +} +}, topContributorCount = 1234, - }; - - Response response = await client.DetectMultivariateLastAnomalyAsync("", RequestContent.Create(data)); + }); + Response response = await client.DetectMultivariateLastAnomalyAsync("", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("variableStates")[0].GetProperty("variable").ToString()); @@ -1335,37 +1756,58 @@ public async Task Example_DetectMultivariateLastAnomaly_AllParameters_Async() [Ignore("Only validating compilation of examples")] public async Task Example_DetectMultivariateLastAnomaly_Convenience_Async() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - var options = new MultivariateLastDetectionOptions(new VariableValues[] - { - new VariableValues("", new string[] + MultivariateLastDetectionOptions options = new MultivariateLastDetectionOptions(new List() +{ +new VariableValues("",new List() +{ +"" +},new List() +{ +123.45F +}) +}, 1234); + Response response = await client.DetectMultivariateLastAnomalyAsync("", options); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DetectMultivariateLastAnomaly_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + + MultivariateLastDetectionOptions options = new MultivariateLastDetectionOptions(new List() +{ +new VariableValues("",new List() { - "" - }, new float[] +"" +},new List() { - 3.14f - }) - }, 1234); - var result = await client.DetectMultivariateLastAnomalyAsync("", options); +123.45F +}) +}, 1234); + Response response = await client.DetectMultivariateLastAnomalyAsync("", options); } [Test] [Ignore("Only validating compilation of examples")] public void Example_GetMultivariateModels() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - foreach (var item in client.GetMultivariateModels(1234, 1234, new RequestContext())) + foreach (BinaryData item in client.GetMultivariateModels(null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("createdTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedTime").ToString()); + Console.WriteLine(result[0].GetProperty("modelId").ToString()); + Console.WriteLine(result[0].GetProperty("createdTime").ToString()); + Console.WriteLine(result[0].GetProperty("lastUpdatedTime").ToString()); } } @@ -1373,37 +1815,63 @@ public void Example_GetMultivariateModels() [Ignore("Only validating compilation of examples")] public void Example_GetMultivariateModels_AllParameters() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - foreach (var item in client.GetMultivariateModels(1234, 1234, new RequestContext())) + foreach (BinaryData item in client.GetMultivariateModels(1234, 1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("createdTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedTime").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("dataSource").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("dataSchema").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("startTime").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("endTime").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("displayName").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("slidingWindow").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("alignPolicy").GetProperty("alignMode").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("alignPolicy").GetProperty("fillNAMethod").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("alignPolicy").GetProperty("paddingValue").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("epochIds")[0].ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("trainLosses")[0].ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("validationLosses")[0].ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("latenciesInSeconds")[0].ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("variable").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("filledNARatio").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("effectiveCount").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("firstTimestamp").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("lastTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("modelId").ToString()); + Console.WriteLine(result[0].GetProperty("createdTime").ToString()); + Console.WriteLine(result[0].GetProperty("lastUpdatedTime").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("dataSource").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("dataSchema").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("startTime").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("endTime").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("displayName").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("slidingWindow").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("alignPolicy").GetProperty("alignMode").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("alignPolicy").GetProperty("fillNAMethod").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("alignPolicy").GetProperty("paddingValue").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("status").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("errors")[0].GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("errors")[0].GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("epochIds")[0].ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("trainLosses")[0].ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("validationLosses")[0].ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("latenciesInSeconds")[0].ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("variable").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("filledNARatio").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("effectiveCount").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("firstTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("lastTimestamp").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetMultivariateModels_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + + foreach (AnomalyDetectionModel item in client.GetMultivariateModels()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetMultivariateModels_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + + foreach (AnomalyDetectionModel item in client.GetMultivariateModels(skip: 1234, maxCount: 1234)) + { } } @@ -1411,16 +1879,16 @@ public void Example_GetMultivariateModels_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetMultivariateModels_Async() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - await foreach (var item in client.GetMultivariateModelsAsync(1234, 1234, new RequestContext())) + await foreach (BinaryData item in client.GetMultivariateModelsAsync(null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("createdTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedTime").ToString()); + Console.WriteLine(result[0].GetProperty("modelId").ToString()); + Console.WriteLine(result[0].GetProperty("createdTime").ToString()); + Console.WriteLine(result[0].GetProperty("lastUpdatedTime").ToString()); } } @@ -1428,37 +1896,37 @@ public async Task Example_GetMultivariateModels_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetMultivariateModels_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - await foreach (var item in client.GetMultivariateModelsAsync(1234, 1234, new RequestContext())) + await foreach (BinaryData item in client.GetMultivariateModelsAsync(1234, 1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("createdTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedTime").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("dataSource").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("dataSchema").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("startTime").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("endTime").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("displayName").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("slidingWindow").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("alignPolicy").GetProperty("alignMode").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("alignPolicy").GetProperty("fillNAMethod").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("alignPolicy").GetProperty("paddingValue").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("epochIds")[0].ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("trainLosses")[0].ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("validationLosses")[0].ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("latenciesInSeconds")[0].ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("variable").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("filledNARatio").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("effectiveCount").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("firstTimestamp").ToString()); - Console.WriteLine(result.GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("lastTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("modelId").ToString()); + Console.WriteLine(result[0].GetProperty("createdTime").ToString()); + Console.WriteLine(result[0].GetProperty("lastUpdatedTime").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("dataSource").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("dataSchema").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("startTime").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("endTime").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("displayName").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("slidingWindow").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("alignPolicy").GetProperty("alignMode").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("alignPolicy").GetProperty("fillNAMethod").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("alignPolicy").GetProperty("paddingValue").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("status").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("errors")[0].GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("errors")[0].GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("epochIds")[0].ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("trainLosses")[0].ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("validationLosses")[0].ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("modelState").GetProperty("latenciesInSeconds")[0].ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("variable").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("filledNARatio").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("effectiveCount").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("firstTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("modelInfo").GetProperty("diagnosticsInfo").GetProperty("variableStates")[0].GetProperty("lastTimestamp").ToString()); } } @@ -1466,11 +1934,24 @@ public async Task Example_GetMultivariateModels_AllParameters_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetMultivariateModels_Convenience_Async() { - var credential = new AzureKeyCredential(""); - var endpoint = new Uri(""); - var client = new AnomalyDetectorClient(endpoint, credential); + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); + + await foreach (AnomalyDetectionModel item in client.GetMultivariateModelsAsync()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetMultivariateModels_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnomalyDetectorClient client = new AnomalyDetectorClient(endpoint, credential); - await foreach (var item in client.GetMultivariateModelsAsync(1234, 1234)) + await foreach (AnomalyDetectionModel item in client.GetMultivariateModelsAsync(skip: 1234, maxCount: 1234)) { } } diff --git a/samples/Azure.AI.DocumentTranslation/src/Generated/Docs/DocumentTranslationClient.xml b/samples/Azure.AI.DocumentTranslation/src/Generated/Docs/DocumentTranslationClient.xml index b51565c7556..139118eea5f 100644 --- a/samples/Azure.AI.DocumentTranslation/src/Generated/Docs/DocumentTranslationClient.xml +++ b/samples/Azure.AI.DocumentTranslation/src/Generated/Docs/DocumentTranslationClient.xml @@ -2,13 +2,29 @@ - -This sample shows how to call GetDocumentStatusAsync with required parameters and parse the result. + +This sample shows how to call GetDocumentStatusAsync and parse the result. "); -var client = new DocumentTranslationClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); -Response response = await client.GetDocumentStatusAsync(Guid.NewGuid(), Guid.NewGuid()); +Response response = await client.GetDocumentStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("sourcePath").ToString()); +Console.WriteLine(result.GetProperty("createdDateTimeUtc").ToString()); +Console.WriteLine(result.GetProperty("lastActionDateTimeUtc").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("to").ToString()); +Console.WriteLine(result.GetProperty("progress").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call GetDocumentStatusAsync with all parameters and parse the result. +"); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); + +Response response = await client.GetDocumentStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("path").ToString()); @@ -26,17 +42,32 @@ Console.WriteLine(result.GetProperty("error").GetProperty("innerError").GetPrope Console.WriteLine(result.GetProperty("progress").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("characterCharged").ToString()); -]]> - +]]> - -This sample shows how to call GetDocumentStatus with required parameters and parse the result. + +This sample shows how to call GetDocumentStatus and parse the result. +"); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); + +Response response = client.GetDocumentStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("sourcePath").ToString()); +Console.WriteLine(result.GetProperty("createdDateTimeUtc").ToString()); +Console.WriteLine(result.GetProperty("lastActionDateTimeUtc").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("to").ToString()); +Console.WriteLine(result.GetProperty("progress").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call GetDocumentStatus with all parameters and parse the result. "); -var client = new DocumentTranslationClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); -Response response = client.GetDocumentStatus(Guid.NewGuid(), Guid.NewGuid()); +Response response = client.GetDocumentStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("path").ToString()); @@ -54,17 +85,36 @@ Console.WriteLine(result.GetProperty("error").GetProperty("innerError").GetPrope Console.WriteLine(result.GetProperty("progress").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("characterCharged").ToString()); -]]> - +]]> - -This sample shows how to call GetTranslationStatusAsync with required parameters and parse the result. + +This sample shows how to call GetTranslationStatusAsync and parse the result. +"); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); + +Response response = await client.GetTranslationStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("createdDateTimeUtc").ToString()); +Console.WriteLine(result.GetProperty("lastActionDateTimeUtc").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("success").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("inProgress").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("notYetStarted").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("totalCharacterCharged").ToString()); +]]> +This sample shows how to call GetTranslationStatusAsync with all parameters and parse the result. "); -var client = new DocumentTranslationClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); -Response response = await client.GetTranslationStatusAsync(Guid.NewGuid()); +Response response = await client.GetTranslationStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -84,17 +134,36 @@ Console.WriteLine(result.GetProperty("summary").GetProperty("inProgress").ToStri Console.WriteLine(result.GetProperty("summary").GetProperty("notYetStarted").ToString()); Console.WriteLine(result.GetProperty("summary").GetProperty("cancelled").ToString()); Console.WriteLine(result.GetProperty("summary").GetProperty("totalCharacterCharged").ToString()); -]]> - +]]> - -This sample shows how to call GetTranslationStatus with required parameters and parse the result. + +This sample shows how to call GetTranslationStatus and parse the result. "); -var client = new DocumentTranslationClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); -Response response = client.GetTranslationStatus(Guid.NewGuid()); +Response response = client.GetTranslationStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("createdDateTimeUtc").ToString()); +Console.WriteLine(result.GetProperty("lastActionDateTimeUtc").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("success").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("inProgress").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("notYetStarted").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("totalCharacterCharged").ToString()); +]]> +This sample shows how to call GetTranslationStatus with all parameters and parse the result. +"); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); + +Response response = client.GetTranslationStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -114,17 +183,36 @@ Console.WriteLine(result.GetProperty("summary").GetProperty("inProgress").ToStri Console.WriteLine(result.GetProperty("summary").GetProperty("notYetStarted").ToString()); Console.WriteLine(result.GetProperty("summary").GetProperty("cancelled").ToString()); Console.WriteLine(result.GetProperty("summary").GetProperty("totalCharacterCharged").ToString()); -]]> - +]]> - -This sample shows how to call CancelTranslationAsync with required parameters and parse the result. + +This sample shows how to call CancelTranslationAsync and parse the result. +"); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); + +Response response = await client.CancelTranslationAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("createdDateTimeUtc").ToString()); +Console.WriteLine(result.GetProperty("lastActionDateTimeUtc").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("success").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("inProgress").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("notYetStarted").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("totalCharacterCharged").ToString()); +]]> +This sample shows how to call CancelTranslationAsync with all parameters and parse the result. "); -var client = new DocumentTranslationClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); -Response response = await client.CancelTranslationAsync(Guid.NewGuid()); +Response response = await client.CancelTranslationAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -144,17 +232,36 @@ Console.WriteLine(result.GetProperty("summary").GetProperty("inProgress").ToStri Console.WriteLine(result.GetProperty("summary").GetProperty("notYetStarted").ToString()); Console.WriteLine(result.GetProperty("summary").GetProperty("cancelled").ToString()); Console.WriteLine(result.GetProperty("summary").GetProperty("totalCharacterCharged").ToString()); -]]> - +]]> - -This sample shows how to call CancelTranslation with required parameters and parse the result. + +This sample shows how to call CancelTranslation and parse the result. +"); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); + +Response response = client.CancelTranslation(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("createdDateTimeUtc").ToString()); +Console.WriteLine(result.GetProperty("lastActionDateTimeUtc").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("success").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("inProgress").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("notYetStarted").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("totalCharacterCharged").ToString()); +]]> +This sample shows how to call CancelTranslation with all parameters and parse the result. "); -var client = new DocumentTranslationClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); -Response response = client.CancelTranslation(Guid.NewGuid()); +Response response = client.CancelTranslation(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -174,15 +281,26 @@ Console.WriteLine(result.GetProperty("summary").GetProperty("inProgress").ToStri Console.WriteLine(result.GetProperty("summary").GetProperty("notYetStarted").ToString()); Console.WriteLine(result.GetProperty("summary").GetProperty("cancelled").ToString()); Console.WriteLine(result.GetProperty("summary").GetProperty("totalCharacterCharged").ToString()); -]]> - +]]> - + This sample shows how to call GetSupportedDocumentFormatsAsync and parse the result. "); -var client = new DocumentTranslationClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); + +Response response = await client.GetSupportedDocumentFormatsAsync(); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("value")[0].GetProperty("format").ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("fileExtensions")[0].ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("contentTypes")[0].ToString()); +]]> +This sample shows how to call GetSupportedDocumentFormatsAsync with all request content and parse the result. +"); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); Response response = await client.GetSupportedDocumentFormatsAsync(); @@ -192,15 +310,26 @@ Console.WriteLine(result.GetProperty("value")[0].GetProperty("fileExtensions")[0 Console.WriteLine(result.GetProperty("value")[0].GetProperty("contentTypes")[0].ToString()); Console.WriteLine(result.GetProperty("value")[0].GetProperty("defaultVersion").ToString()); Console.WriteLine(result.GetProperty("value")[0].GetProperty("versions")[0].ToString()); -]]> - +]]> - + This sample shows how to call GetSupportedDocumentFormats and parse the result. "); -var client = new DocumentTranslationClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); + +Response response = client.GetSupportedDocumentFormats(); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("value")[0].GetProperty("format").ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("fileExtensions")[0].ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("contentTypes")[0].ToString()); +]]> +This sample shows how to call GetSupportedDocumentFormats with all request content and parse the result. +"); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); Response response = client.GetSupportedDocumentFormats(); @@ -210,15 +339,26 @@ Console.WriteLine(result.GetProperty("value")[0].GetProperty("fileExtensions")[0 Console.WriteLine(result.GetProperty("value")[0].GetProperty("contentTypes")[0].ToString()); Console.WriteLine(result.GetProperty("value")[0].GetProperty("defaultVersion").ToString()); Console.WriteLine(result.GetProperty("value")[0].GetProperty("versions")[0].ToString()); -]]> - +]]> - + This sample shows how to call GetSupportedGlossaryFormatsAsync and parse the result. "); -var client = new DocumentTranslationClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); + +Response response = await client.GetSupportedGlossaryFormatsAsync(); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("value")[0].GetProperty("format").ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("fileExtensions")[0].ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("contentTypes")[0].ToString()); +]]> +This sample shows how to call GetSupportedGlossaryFormatsAsync with all request content and parse the result. +"); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); Response response = await client.GetSupportedGlossaryFormatsAsync(); @@ -228,15 +368,26 @@ Console.WriteLine(result.GetProperty("value")[0].GetProperty("fileExtensions")[0 Console.WriteLine(result.GetProperty("value")[0].GetProperty("contentTypes")[0].ToString()); Console.WriteLine(result.GetProperty("value")[0].GetProperty("defaultVersion").ToString()); Console.WriteLine(result.GetProperty("value")[0].GetProperty("versions")[0].ToString()); -]]> - +]]> - + This sample shows how to call GetSupportedGlossaryFormats and parse the result. "); -var client = new DocumentTranslationClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); + +Response response = client.GetSupportedGlossaryFormats(); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("value")[0].GetProperty("format").ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("fileExtensions")[0].ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("contentTypes")[0].ToString()); +]]> +This sample shows how to call GetSupportedGlossaryFormats with all request content and parse the result. +"); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); Response response = client.GetSupportedGlossaryFormats(); @@ -246,259 +397,345 @@ Console.WriteLine(result.GetProperty("value")[0].GetProperty("fileExtensions")[0 Console.WriteLine(result.GetProperty("value")[0].GetProperty("contentTypes")[0].ToString()); Console.WriteLine(result.GetProperty("value")[0].GetProperty("defaultVersion").ToString()); Console.WriteLine(result.GetProperty("value")[0].GetProperty("versions")[0].ToString()); -]]> - +]]> - + This sample shows how to call GetSupportedStorageSourcesAsync and parse the result. "); -var client = new DocumentTranslationClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); Response response = await client.GetSupportedStorageSourcesAsync(); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("value")[0].ToString()); ]]> - +This sample shows how to call GetSupportedStorageSourcesAsync with all request content and parse the result. +"); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); + +Response response = await client.GetSupportedStorageSourcesAsync(); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("value")[0].ToString()); +]]> - + This sample shows how to call GetSupportedStorageSources and parse the result. "); -var client = new DocumentTranslationClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); Response response = client.GetSupportedStorageSources(); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("value")[0].ToString()); ]]> - +This sample shows how to call GetSupportedStorageSources with all request content and parse the result. +"); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); + +Response response = client.GetSupportedStorageSources(); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("value")[0].ToString()); +]]> - + This sample shows how to call GetTranslationsStatusAsync and parse the result. "); -var client = new DocumentTranslationClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); -await foreach (var item in client.GetTranslationsStatusAsync()) +await foreach (BinaryData item in client.GetTranslationsStatusAsync()) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("createdDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("lastActionDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("total").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("failed").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("success").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("inProgress").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("notYetStarted").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("cancelled").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("totalCharacterCharged").ToString()); + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("createdDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("lastActionDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("status").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("total").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("failed").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("success").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("inProgress").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("notYetStarted").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("cancelled").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("totalCharacterCharged").ToString()); } ]]> -This sample shows how to call GetTranslationsStatusAsync with all parameters, and how to parse the result. +This sample shows how to call GetTranslationsStatusAsync with all parameters and parse the result. "); -var client = new DocumentTranslationClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); -await foreach (var item in client.GetTranslationsStatusAsync(1234, 1234, 1234, new Guid[]{Guid.NewGuid()}, new String[]{""}, DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, new String[]{""})) +await foreach (BinaryData item in client.GetTranslationsStatusAsync(top: 1234, skip: 1234, maxpagesize: 1234, ids: new List() +{ + Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a") +}, statuses: new List() +{ + "" +}, createdDateTimeUtcStart: DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"), createdDateTimeUtcEnd: DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"), orderBy: new List() +{ + "" +})) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("createdDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("lastActionDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("innerError").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("innerError").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("innerError").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("total").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("failed").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("success").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("inProgress").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("notYetStarted").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("cancelled").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("totalCharacterCharged").ToString()); + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("createdDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("lastActionDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("status").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("innerError").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("innerError").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("innerError").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("total").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("failed").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("success").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("inProgress").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("notYetStarted").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("cancelled").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("totalCharacterCharged").ToString()); } -]]> - +]]> - + This sample shows how to call GetTranslationsStatus and parse the result. "); -var client = new DocumentTranslationClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); -foreach (var item in client.GetTranslationsStatus()) +foreach (BinaryData item in client.GetTranslationsStatus()) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("createdDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("lastActionDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("total").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("failed").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("success").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("inProgress").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("notYetStarted").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("cancelled").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("totalCharacterCharged").ToString()); + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("createdDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("lastActionDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("status").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("total").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("failed").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("success").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("inProgress").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("notYetStarted").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("cancelled").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("totalCharacterCharged").ToString()); } ]]> -This sample shows how to call GetTranslationsStatus with all parameters, and how to parse the result. +This sample shows how to call GetTranslationsStatus with all parameters and parse the result. "); -var client = new DocumentTranslationClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); -foreach (var item in client.GetTranslationsStatus(1234, 1234, 1234, new Guid[]{Guid.NewGuid()}, new String[]{""}, DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, new String[]{""})) +foreach (BinaryData item in client.GetTranslationsStatus(top: 1234, skip: 1234, maxpagesize: 1234, ids: new List() +{ + Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a") +}, statuses: new List() +{ + "" +}, createdDateTimeUtcStart: DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"), createdDateTimeUtcEnd: DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"), orderBy: new List() +{ + "" +})) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("createdDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("lastActionDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("innerError").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("innerError").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("innerError").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("total").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("failed").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("success").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("inProgress").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("notYetStarted").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("cancelled").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("totalCharacterCharged").ToString()); + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("createdDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("lastActionDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("status").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("innerError").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("innerError").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("innerError").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("total").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("failed").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("success").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("inProgress").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("notYetStarted").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("cancelled").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("totalCharacterCharged").ToString()); } -]]> - +]]> - -This sample shows how to call GetDocumentsStatusAsync with required parameters and parse the result. + +This sample shows how to call GetDocumentsStatusAsync and parse the result. "); -var client = new DocumentTranslationClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); -await foreach (var item in client.GetDocumentsStatusAsync(Guid.NewGuid())) +await foreach (BinaryData item in client.GetDocumentsStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"))) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("sourcePath").ToString()); - Console.WriteLine(result.GetProperty("createdDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("lastActionDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("to").ToString()); - Console.WriteLine(result.GetProperty("progress").ToString()); - Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("sourcePath").ToString()); + Console.WriteLine(result[0].GetProperty("createdDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("lastActionDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("status").ToString()); + Console.WriteLine(result[0].GetProperty("to").ToString()); + Console.WriteLine(result[0].GetProperty("progress").ToString()); + Console.WriteLine(result[0].GetProperty("id").ToString()); } ]]> -This sample shows how to call GetDocumentsStatusAsync with all parameters, and how to parse the result. +This sample shows how to call GetDocumentsStatusAsync with all parameters and parse the result. "); -var client = new DocumentTranslationClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); -await foreach (var item in client.GetDocumentsStatusAsync(Guid.NewGuid(), 1234, 1234, 1234, new Guid[]{Guid.NewGuid()}, new String[]{""}, DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, new String[]{""})) +await foreach (BinaryData item in client.GetDocumentsStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), top: 1234, skip: 1234, maxpagesize: 1234, ids: new List() +{ + Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a") +}, statuses: new List() +{ + "" +}, createdDateTimeUtcStart: DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"), createdDateTimeUtcEnd: DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"), orderBy: new List() +{ + "" +})) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("path").ToString()); - Console.WriteLine(result.GetProperty("sourcePath").ToString()); - Console.WriteLine(result.GetProperty("createdDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("lastActionDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("to").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("innerError").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("innerError").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("innerError").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("progress").ToString()); - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("characterCharged").ToString()); + Console.WriteLine(result[0].GetProperty("path").ToString()); + Console.WriteLine(result[0].GetProperty("sourcePath").ToString()); + Console.WriteLine(result[0].GetProperty("createdDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("lastActionDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("status").ToString()); + Console.WriteLine(result[0].GetProperty("to").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("innerError").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("innerError").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("innerError").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("progress").ToString()); + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("characterCharged").ToString()); } -]]> - +]]> - -This sample shows how to call GetDocumentsStatus with required parameters and parse the result. + +This sample shows how to call GetDocumentsStatus and parse the result. "); -var client = new DocumentTranslationClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); -foreach (var item in client.GetDocumentsStatus(Guid.NewGuid())) +foreach (BinaryData item in client.GetDocumentsStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"))) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("sourcePath").ToString()); - Console.WriteLine(result.GetProperty("createdDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("lastActionDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("to").ToString()); - Console.WriteLine(result.GetProperty("progress").ToString()); - Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("sourcePath").ToString()); + Console.WriteLine(result[0].GetProperty("createdDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("lastActionDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("status").ToString()); + Console.WriteLine(result[0].GetProperty("to").ToString()); + Console.WriteLine(result[0].GetProperty("progress").ToString()); + Console.WriteLine(result[0].GetProperty("id").ToString()); } ]]> -This sample shows how to call GetDocumentsStatus with all parameters, and how to parse the result. +This sample shows how to call GetDocumentsStatus with all parameters and parse the result. "); -var client = new DocumentTranslationClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); -foreach (var item in client.GetDocumentsStatus(Guid.NewGuid(), 1234, 1234, 1234, new Guid[]{Guid.NewGuid()}, new String[]{""}, DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, new String[]{""})) +foreach (BinaryData item in client.GetDocumentsStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), top: 1234, skip: 1234, maxpagesize: 1234, ids: new List() +{ + Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a") +}, statuses: new List() +{ + "" +}, createdDateTimeUtcStart: DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"), createdDateTimeUtcEnd: DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"), orderBy: new List() +{ + "" +})) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("path").ToString()); - Console.WriteLine(result.GetProperty("sourcePath").ToString()); - Console.WriteLine(result.GetProperty("createdDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("lastActionDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("to").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("innerError").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("innerError").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("innerError").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("progress").ToString()); - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("characterCharged").ToString()); + Console.WriteLine(result[0].GetProperty("path").ToString()); + Console.WriteLine(result[0].GetProperty("sourcePath").ToString()); + Console.WriteLine(result[0].GetProperty("createdDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("lastActionDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("status").ToString()); + Console.WriteLine(result[0].GetProperty("to").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("innerError").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("innerError").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("innerError").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("progress").ToString()); + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("characterCharged").ToString()); } -]]> - +]]> - -This sample shows how to call StartTranslationAsync with required parameters and request content. + +This sample shows how to call StartTranslationAsync. +"); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); + +RequestContent content = RequestContent.Create(new +{ + inputs = new List() + { + new + { + source = new + { + sourceUrl = "", + }, + targets = new List() + { + new + { + targetUrl = "", + language = "", + } + }, + } + }, +}); +Operation operation = await client.StartTranslationAsync(WaitUntil.Completed, content, new ContentType("application/json")); +]]> +This sample shows how to call StartTranslationAsync with all parameters and request content. "); -var client = new DocumentTranslationClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); -var data = new { - inputs = new[] { - new { - source = new { +RequestContent content = RequestContent.Create(new +{ + inputs = new List() + { + new + { + source = new + { sourceUrl = "", - filter = new { + filter = new + { prefix = "", suffix = "", }, language = "", storageSource = "AzureBlob", }, - targets = new[] { - new { + targets = new List() + { + new + { targetUrl = "", category = "", language = "", - glossaries = new[] { - new { + glossaries = new List() + { + new + { glossaryUrl = "", format = "", version = "", @@ -511,40 +748,73 @@ var data = new { storageType = "Folder", } }, -}; - -var operation = await client.StartTranslationAsync(WaitUntil.Completed, RequestContent.Create(data), ContentType.ApplicationOctetStream); - -Console.WriteLine(operation.GetRawResponse().Status); -]]> - +}); +Operation operation = await client.StartTranslationAsync(WaitUntil.Completed, content, new ContentType("application/json")); +]]> - -This sample shows how to call StartTranslation with required parameters and request content. + +This sample shows how to call StartTranslation. +"); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); + +RequestContent content = RequestContent.Create(new +{ + inputs = new List() + { + new + { + source = new + { + sourceUrl = "", + }, + targets = new List() + { + new + { + targetUrl = "", + language = "", + } + }, + } + }, +}); +Operation operation = client.StartTranslation(WaitUntil.Completed, content, new ContentType("application/json")); +]]> +This sample shows how to call StartTranslation with all parameters and request content. "); -var client = new DocumentTranslationClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +DocumentTranslationClient client = new DocumentTranslationClient("", credential); -var data = new { - inputs = new[] { - new { - source = new { +RequestContent content = RequestContent.Create(new +{ + inputs = new List() + { + new + { + source = new + { sourceUrl = "", - filter = new { + filter = new + { prefix = "", suffix = "", }, language = "", storageSource = "AzureBlob", }, - targets = new[] { - new { + targets = new List() + { + new + { targetUrl = "", category = "", language = "", - glossaries = new[] { - new { + glossaries = new List() + { + new + { glossaryUrl = "", format = "", version = "", @@ -557,13 +827,9 @@ var data = new { storageType = "Folder", } }, -}; - -var operation = client.StartTranslation(WaitUntil.Completed, RequestContent.Create(data), ContentType.ApplicationOctetStream); - -Console.WriteLine(operation.GetRawResponse().Status); -]]> - +}); +Operation operation = client.StartTranslation(WaitUntil.Completed, content, new ContentType("application/json")); +]]> \ No newline at end of file diff --git a/samples/Azure.AI.DocumentTranslation/tests/Generated/Samples/Samples_DocumentTranslationClient.cs b/samples/Azure.AI.DocumentTranslation/tests/Generated/Samples/Samples_DocumentTranslationClient.cs index 2d326d20cf1..f065e741bc4 100644 --- a/samples/Azure.AI.DocumentTranslation/tests/Generated/Samples/Samples_DocumentTranslationClient.cs +++ b/samples/Azure.AI.DocumentTranslation/tests/Generated/Samples/Samples_DocumentTranslationClient.cs @@ -7,10 +7,10 @@ using System; using System.Collections.Generic; -using System.IO; using System.Text.Json; using System.Threading.Tasks; using Azure; +using Azure.AI.DocumentTranslation; using Azure.Core; using Azure.Identity; using NUnit.Framework; @@ -23,10 +23,10 @@ public class Samples_DocumentTranslationClient [Ignore("Only validating compilation of examples")] public void Example_GetDocumentStatus() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); - Response response = client.GetDocumentStatus(Guid.NewGuid(), Guid.NewGuid()); + Response response = client.GetDocumentStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("sourcePath").ToString()); @@ -42,10 +42,10 @@ public void Example_GetDocumentStatus() [Ignore("Only validating compilation of examples")] public void Example_GetDocumentStatus_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); - Response response = client.GetDocumentStatus(Guid.NewGuid(), Guid.NewGuid()); + Response response = client.GetDocumentStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("path").ToString()); @@ -69,10 +69,10 @@ public void Example_GetDocumentStatus_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetDocumentStatus_Async() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); - Response response = await client.GetDocumentStatusAsync(Guid.NewGuid(), Guid.NewGuid()); + Response response = await client.GetDocumentStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("sourcePath").ToString()); @@ -88,10 +88,10 @@ public async Task Example_GetDocumentStatus_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetDocumentStatus_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); - Response response = await client.GetDocumentStatusAsync(Guid.NewGuid(), Guid.NewGuid()); + Response response = await client.GetDocumentStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("path").ToString()); @@ -115,10 +115,10 @@ public async Task Example_GetDocumentStatus_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetTranslationStatus() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); - Response response = client.GetTranslationStatus(Guid.NewGuid()); + Response response = client.GetTranslationStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -138,10 +138,10 @@ public void Example_GetTranslationStatus() [Ignore("Only validating compilation of examples")] public void Example_GetTranslationStatus_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); - Response response = client.GetTranslationStatus(Guid.NewGuid()); + Response response = client.GetTranslationStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -167,10 +167,10 @@ public void Example_GetTranslationStatus_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetTranslationStatus_Async() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); - Response response = await client.GetTranslationStatusAsync(Guid.NewGuid()); + Response response = await client.GetTranslationStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -190,10 +190,10 @@ public async Task Example_GetTranslationStatus_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetTranslationStatus_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); - Response response = await client.GetTranslationStatusAsync(Guid.NewGuid()); + Response response = await client.GetTranslationStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -219,10 +219,10 @@ public async Task Example_GetTranslationStatus_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_CancelTranslation() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); - Response response = client.CancelTranslation(Guid.NewGuid()); + Response response = client.CancelTranslation(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -242,10 +242,10 @@ public void Example_CancelTranslation() [Ignore("Only validating compilation of examples")] public void Example_CancelTranslation_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); - Response response = client.CancelTranslation(Guid.NewGuid()); + Response response = client.CancelTranslation(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -271,10 +271,10 @@ public void Example_CancelTranslation_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_CancelTranslation_Async() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); - Response response = await client.CancelTranslationAsync(Guid.NewGuid()); + Response response = await client.CancelTranslationAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -294,10 +294,10 @@ public async Task Example_CancelTranslation_Async() [Ignore("Only validating compilation of examples")] public async Task Example_CancelTranslation_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); - Response response = await client.CancelTranslationAsync(Guid.NewGuid()); + Response response = await client.CancelTranslationAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -323,8 +323,8 @@ public async Task Example_CancelTranslation_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetSupportedDocumentFormats() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); Response response = client.GetSupportedDocumentFormats(); @@ -338,8 +338,8 @@ public void Example_GetSupportedDocumentFormats() [Ignore("Only validating compilation of examples")] public void Example_GetSupportedDocumentFormats_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); Response response = client.GetSupportedDocumentFormats(); @@ -355,8 +355,8 @@ public void Example_GetSupportedDocumentFormats_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetSupportedDocumentFormats_Async() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); Response response = await client.GetSupportedDocumentFormatsAsync(); @@ -370,8 +370,8 @@ public async Task Example_GetSupportedDocumentFormats_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetSupportedDocumentFormats_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); Response response = await client.GetSupportedDocumentFormatsAsync(); @@ -387,8 +387,8 @@ public async Task Example_GetSupportedDocumentFormats_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetSupportedGlossaryFormats() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); Response response = client.GetSupportedGlossaryFormats(); @@ -402,8 +402,8 @@ public void Example_GetSupportedGlossaryFormats() [Ignore("Only validating compilation of examples")] public void Example_GetSupportedGlossaryFormats_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); Response response = client.GetSupportedGlossaryFormats(); @@ -419,8 +419,8 @@ public void Example_GetSupportedGlossaryFormats_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetSupportedGlossaryFormats_Async() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); Response response = await client.GetSupportedGlossaryFormatsAsync(); @@ -434,8 +434,8 @@ public async Task Example_GetSupportedGlossaryFormats_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetSupportedGlossaryFormats_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); Response response = await client.GetSupportedGlossaryFormatsAsync(); @@ -451,8 +451,8 @@ public async Task Example_GetSupportedGlossaryFormats_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetSupportedStorageSources() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); Response response = client.GetSupportedStorageSources(); @@ -464,8 +464,8 @@ public void Example_GetSupportedStorageSources() [Ignore("Only validating compilation of examples")] public void Example_GetSupportedStorageSources_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); Response response = client.GetSupportedStorageSources(); @@ -477,8 +477,8 @@ public void Example_GetSupportedStorageSources_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetSupportedStorageSources_Async() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); Response response = await client.GetSupportedStorageSourcesAsync(); @@ -490,8 +490,8 @@ public async Task Example_GetSupportedStorageSources_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetSupportedStorageSources_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); Response response = await client.GetSupportedStorageSourcesAsync(); @@ -503,23 +503,23 @@ public async Task Example_GetSupportedStorageSources_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetTranslationsStatus() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); - foreach (var item in client.GetTranslationsStatus()) + foreach (BinaryData item in client.GetTranslationsStatus()) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("createdDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("lastActionDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("total").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("failed").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("success").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("inProgress").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("notYetStarted").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("cancelled").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("totalCharacterCharged").ToString()); + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("createdDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("lastActionDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("status").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("total").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("failed").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("success").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("inProgress").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("notYetStarted").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("cancelled").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("totalCharacterCharged").ToString()); } } @@ -527,29 +527,38 @@ public void Example_GetTranslationsStatus() [Ignore("Only validating compilation of examples")] public void Example_GetTranslationsStatus_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); - foreach (var item in client.GetTranslationsStatus(1234, 1234, 1234, new Guid[] { Guid.NewGuid() }, new string[] { "" }, DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, new string[] { "" })) + foreach (BinaryData item in client.GetTranslationsStatus(top: 1234, skip: 1234, maxpagesize: 1234, ids: new List() +{ +Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a") +}, statuses: new List() +{ +"" +}, createdDateTimeUtcStart: DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"), createdDateTimeUtcEnd: DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"), orderBy: new List() +{ +"" +})) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("createdDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("lastActionDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("innerError").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("innerError").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("innerError").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("total").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("failed").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("success").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("inProgress").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("notYetStarted").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("cancelled").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("totalCharacterCharged").ToString()); + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("createdDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("lastActionDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("status").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("innerError").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("innerError").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("innerError").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("total").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("failed").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("success").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("inProgress").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("notYetStarted").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("cancelled").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("totalCharacterCharged").ToString()); } } @@ -557,23 +566,23 @@ public void Example_GetTranslationsStatus_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetTranslationsStatus_Async() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); - await foreach (var item in client.GetTranslationsStatusAsync()) + await foreach (BinaryData item in client.GetTranslationsStatusAsync()) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("createdDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("lastActionDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("total").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("failed").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("success").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("inProgress").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("notYetStarted").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("cancelled").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("totalCharacterCharged").ToString()); + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("createdDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("lastActionDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("status").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("total").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("failed").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("success").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("inProgress").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("notYetStarted").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("cancelled").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("totalCharacterCharged").ToString()); } } @@ -581,29 +590,38 @@ public async Task Example_GetTranslationsStatus_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetTranslationsStatus_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); - await foreach (var item in client.GetTranslationsStatusAsync(1234, 1234, 1234, new Guid[] { Guid.NewGuid() }, new string[] { "" }, DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, new string[] { "" })) + await foreach (BinaryData item in client.GetTranslationsStatusAsync(top: 1234, skip: 1234, maxpagesize: 1234, ids: new List() +{ +Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a") +}, statuses: new List() +{ +"" +}, createdDateTimeUtcStart: DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"), createdDateTimeUtcEnd: DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"), orderBy: new List() +{ +"" +})) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("createdDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("lastActionDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("innerError").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("innerError").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("innerError").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("total").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("failed").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("success").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("inProgress").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("notYetStarted").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("cancelled").ToString()); - Console.WriteLine(result.GetProperty("summary").GetProperty("totalCharacterCharged").ToString()); + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("createdDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("lastActionDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("status").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("innerError").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("innerError").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("innerError").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("total").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("failed").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("success").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("inProgress").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("notYetStarted").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("cancelled").ToString()); + Console.WriteLine(result[0].GetProperty("summary").GetProperty("totalCharacterCharged").ToString()); } } @@ -611,19 +629,19 @@ public async Task Example_GetTranslationsStatus_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetDocumentsStatus() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); - foreach (var item in client.GetDocumentsStatus(Guid.NewGuid())) + foreach (BinaryData item in client.GetDocumentsStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"))) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("sourcePath").ToString()); - Console.WriteLine(result.GetProperty("createdDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("lastActionDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("to").ToString()); - Console.WriteLine(result.GetProperty("progress").ToString()); - Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("sourcePath").ToString()); + Console.WriteLine(result[0].GetProperty("createdDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("lastActionDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("status").ToString()); + Console.WriteLine(result[0].GetProperty("to").ToString()); + Console.WriteLine(result[0].GetProperty("progress").ToString()); + Console.WriteLine(result[0].GetProperty("id").ToString()); } } @@ -631,27 +649,36 @@ public void Example_GetDocumentsStatus() [Ignore("Only validating compilation of examples")] public void Example_GetDocumentsStatus_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); - foreach (var item in client.GetDocumentsStatus(Guid.NewGuid(), 1234, 1234, 1234, new Guid[] { Guid.NewGuid() }, new string[] { "" }, DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, new string[] { "" })) + foreach (BinaryData item in client.GetDocumentsStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), top: 1234, skip: 1234, maxpagesize: 1234, ids: new List() +{ +Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a") +}, statuses: new List() +{ +"" +}, createdDateTimeUtcStart: DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"), createdDateTimeUtcEnd: DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"), orderBy: new List() +{ +"" +})) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("path").ToString()); - Console.WriteLine(result.GetProperty("sourcePath").ToString()); - Console.WriteLine(result.GetProperty("createdDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("lastActionDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("to").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("innerError").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("innerError").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("innerError").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("progress").ToString()); - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("characterCharged").ToString()); + Console.WriteLine(result[0].GetProperty("path").ToString()); + Console.WriteLine(result[0].GetProperty("sourcePath").ToString()); + Console.WriteLine(result[0].GetProperty("createdDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("lastActionDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("status").ToString()); + Console.WriteLine(result[0].GetProperty("to").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("innerError").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("innerError").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("innerError").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("progress").ToString()); + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("characterCharged").ToString()); } } @@ -659,19 +686,19 @@ public void Example_GetDocumentsStatus_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetDocumentsStatus_Async() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); - await foreach (var item in client.GetDocumentsStatusAsync(Guid.NewGuid())) + await foreach (BinaryData item in client.GetDocumentsStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"))) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("sourcePath").ToString()); - Console.WriteLine(result.GetProperty("createdDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("lastActionDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("to").ToString()); - Console.WriteLine(result.GetProperty("progress").ToString()); - Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("sourcePath").ToString()); + Console.WriteLine(result[0].GetProperty("createdDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("lastActionDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("status").ToString()); + Console.WriteLine(result[0].GetProperty("to").ToString()); + Console.WriteLine(result[0].GetProperty("progress").ToString()); + Console.WriteLine(result[0].GetProperty("id").ToString()); } } @@ -679,27 +706,36 @@ public async Task Example_GetDocumentsStatus_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetDocumentsStatus_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); - await foreach (var item in client.GetDocumentsStatusAsync(Guid.NewGuid(), 1234, 1234, 1234, new Guid[] { Guid.NewGuid() }, new string[] { "" }, DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, new string[] { "" })) + await foreach (BinaryData item in client.GetDocumentsStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), top: 1234, skip: 1234, maxpagesize: 1234, ids: new List() +{ +Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a") +}, statuses: new List() +{ +"" +}, createdDateTimeUtcStart: DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"), createdDateTimeUtcEnd: DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"), orderBy: new List() +{ +"" +})) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("path").ToString()); - Console.WriteLine(result.GetProperty("sourcePath").ToString()); - Console.WriteLine(result.GetProperty("createdDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("lastActionDateTimeUtc").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("to").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("innerError").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("innerError").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("innerError").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("progress").ToString()); - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("characterCharged").ToString()); + Console.WriteLine(result[0].GetProperty("path").ToString()); + Console.WriteLine(result[0].GetProperty("sourcePath").ToString()); + Console.WriteLine(result[0].GetProperty("createdDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("lastActionDateTimeUtc").ToString()); + Console.WriteLine(result[0].GetProperty("status").ToString()); + Console.WriteLine(result[0].GetProperty("to").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("innerError").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("innerError").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("innerError").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("progress").ToString()); + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("characterCharged").ToString()); } } @@ -707,150 +743,164 @@ public async Task Example_GetDocumentsStatus_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_StartTranslation() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); - var data = new + RequestContent content = RequestContent.Create(new { - inputs = new[] { - new { - source = new { - sourceUrl = "", - }, - targets = new[] { - new { - targetUrl = "", - language = "", - } - }, - } - }, - }; - - var operation = client.StartTranslation(WaitUntil.Completed, RequestContent.Create(data), ContentType.ApplicationOctetStream); - - Console.WriteLine(operation.GetRawResponse().Status); + inputs = new List() +{ +new +{ +source = new +{ +sourceUrl = "", +}, +targets = new List() +{ +new +{ +targetUrl = "", +language = "", +} +}, +} +}, + }); + Operation operation = client.StartTranslation(WaitUntil.Completed, content, new ContentType("application/json")); } [Test] [Ignore("Only validating compilation of examples")] public void Example_StartTranslation_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); - var data = new + RequestContent content = RequestContent.Create(new { - inputs = new[] { - new { - source = new { - sourceUrl = "", - filter = new { - prefix = "", - suffix = "", - }, - language = "", - storageSource = "AzureBlob", - }, - targets = new[] { - new { - targetUrl = "", - category = "", - language = "", - glossaries = new[] { - new { - glossaryUrl = "", - format = "", - version = "", - storageSource = "AzureBlob", - } - }, - storageSource = "AzureBlob", - } - }, - storageType = "Folder", - } - }, - }; - - var operation = client.StartTranslation(WaitUntil.Completed, RequestContent.Create(data), ContentType.ApplicationOctetStream); - - Console.WriteLine(operation.GetRawResponse().Status); + inputs = new List() +{ +new +{ +source = new +{ +sourceUrl = "", +filter = new +{ +prefix = "", +suffix = "", +}, +language = "", +storageSource = "AzureBlob", +}, +targets = new List() +{ +new +{ +targetUrl = "", +category = "", +language = "", +glossaries = new List() +{ +new +{ +glossaryUrl = "", +format = "", +version = "", +storageSource = "AzureBlob", +} +}, +storageSource = "AzureBlob", +} +}, +storageType = "Folder", +} +}, + }); + Operation operation = client.StartTranslation(WaitUntil.Completed, content, new ContentType("application/json")); } [Test] [Ignore("Only validating compilation of examples")] public async Task Example_StartTranslation_Async() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); - var data = new + RequestContent content = RequestContent.Create(new { - inputs = new[] { - new { - source = new { - sourceUrl = "", - }, - targets = new[] { - new { - targetUrl = "", - language = "", - } - }, - } - }, - }; - - var operation = await client.StartTranslationAsync(WaitUntil.Completed, RequestContent.Create(data), ContentType.ApplicationOctetStream); - - Console.WriteLine(operation.GetRawResponse().Status); + inputs = new List() +{ +new +{ +source = new +{ +sourceUrl = "", +}, +targets = new List() +{ +new +{ +targetUrl = "", +language = "", +} +}, +} +}, + }); + Operation operation = await client.StartTranslationAsync(WaitUntil.Completed, content, new ContentType("application/json")); } [Test] [Ignore("Only validating compilation of examples")] public async Task Example_StartTranslation_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new DocumentTranslationClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + DocumentTranslationClient client = new DocumentTranslationClient("", credential); - var data = new + RequestContent content = RequestContent.Create(new { - inputs = new[] { - new { - source = new { - sourceUrl = "", - filter = new { - prefix = "", - suffix = "", - }, - language = "", - storageSource = "AzureBlob", - }, - targets = new[] { - new { - targetUrl = "", - category = "", - language = "", - glossaries = new[] { - new { - glossaryUrl = "", - format = "", - version = "", - storageSource = "AzureBlob", - } - }, - storageSource = "AzureBlob", - } - }, - storageType = "Folder", - } - }, - }; - - var operation = await client.StartTranslationAsync(WaitUntil.Completed, RequestContent.Create(data), ContentType.ApplicationOctetStream); - - Console.WriteLine(operation.GetRawResponse().Status); + inputs = new List() +{ +new +{ +source = new +{ +sourceUrl = "", +filter = new +{ +prefix = "", +suffix = "", +}, +language = "", +storageSource = "AzureBlob", +}, +targets = new List() +{ +new +{ +targetUrl = "", +category = "", +language = "", +glossaries = new List() +{ +new +{ +glossaryUrl = "", +format = "", +version = "", +storageSource = "AzureBlob", +} +}, +storageSource = "AzureBlob", +} +}, +storageType = "Folder", +} +}, + }); + Operation operation = await client.StartTranslationAsync(WaitUntil.Completed, content, new ContentType("application/json")); } } } diff --git a/samples/Azure.Analytics.Purview.Account/src/Generated/Docs/PurviewAccountCollections.xml b/samples/Azure.Analytics.Purview.Account/src/Generated/Docs/PurviewAccountCollections.xml index a65b8236c1f..211f9561a17 100644 --- a/samples/Azure.Analytics.Purview.Account/src/Generated/Docs/PurviewAccountCollections.xml +++ b/samples/Azure.Analytics.Purview.Account/src/Generated/Docs/PurviewAccountCollections.xml @@ -2,14 +2,25 @@ - -This sample shows how to call GetCollectionAsync with required parameters and parse the result. + +This sample shows how to call GetCollectionAsync and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); -Response response = await client.GetCollectionAsync(new RequestContext()); +Response response = await client.GetCollectionAsync(null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> +This sample shows how to call GetCollectionAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + +Response response = await client.GetCollectionAsync(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("collectionProvisioningState").ToString()); @@ -24,18 +35,28 @@ Console.WriteLine(result.GetProperty("systemData").GetProperty("createdByType"). Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedAt").ToString()); Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedBy").ToString()); Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedByType").ToString()); -]]> - +]]> - -This sample shows how to call GetCollection with required parameters and parse the result. + +This sample shows how to call GetCollection and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + +Response response = client.GetCollection(null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> +This sample shows how to call GetCollection with all parameters and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); -Response response = client.GetCollection(new RequestContext()); +Response response = client.GetCollection(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("collectionProvisioningState").ToString()); @@ -50,39 +71,38 @@ Console.WriteLine(result.GetProperty("systemData").GetProperty("createdByType"). Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedAt").ToString()); Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedBy").ToString()); Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedByType").ToString()); -]]> - +]]> - + This sample shows how to call CreateOrUpdateCollectionAsync and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); -var data = new {}; - -Response response = await client.CreateOrUpdateCollectionAsync(RequestContent.Create(data)); +RequestContent content = RequestContent.Create(new object()); +Response response = await client.CreateOrUpdateCollectionAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); ]]> -This sample shows how to call CreateOrUpdateCollectionAsync with all request content, and how to parse the result. +This sample shows how to call CreateOrUpdateCollectionAsync with all request content and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); -var data = new { +RequestContent content = RequestContent.Create(new +{ description = "", friendlyName = "", - parentCollection = new { + parentCollection = new + { referenceName = "", }, -}; - -Response response = await client.CreateOrUpdateCollectionAsync(RequestContent.Create(data)); +}); +Response response = await client.CreateOrUpdateCollectionAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("collectionProvisioningState").ToString()); @@ -97,39 +117,38 @@ Console.WriteLine(result.GetProperty("systemData").GetProperty("createdByType"). Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedAt").ToString()); Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedBy").ToString()); Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedByType").ToString()); -]]> - +]]> - + This sample shows how to call CreateOrUpdateCollection and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); -var data = new {}; - -Response response = client.CreateOrUpdateCollection(RequestContent.Create(data)); +RequestContent content = RequestContent.Create(new object()); +Response response = client.CreateOrUpdateCollection(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); ]]> -This sample shows how to call CreateOrUpdateCollection with all request content, and how to parse the result. +This sample shows how to call CreateOrUpdateCollection with all request content and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); -var data = new { +RequestContent content = RequestContent.Create(new +{ description = "", friendlyName = "", - parentCollection = new { + parentCollection = new + { referenceName = "", }, -}; - -Response response = client.CreateOrUpdateCollection(RequestContent.Create(data)); +}); +Response response = client.CreateOrUpdateCollection(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("collectionProvisioningState").ToString()); @@ -144,154 +163,233 @@ Console.WriteLine(result.GetProperty("systemData").GetProperty("createdByType"). Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedAt").ToString()); Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedBy").ToString()); Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedByType").ToString()); -]]> - +]]> - + This sample shows how to call DeleteCollectionAsync. "); -var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); Response response = await client.DeleteCollectionAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call DeleteCollectionAsync with all request content. +"); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + +Response response = await client.DeleteCollectionAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call DeleteCollection. "); -var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); Response response = client.DeleteCollection(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call DeleteCollection with all request content. +"); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + +Response response = client.DeleteCollection(); +Console.WriteLine(response.Status); +]]> - -This sample shows how to call GetCollectionPathAsync with required parameters and parse the result. + +This sample shows how to call GetCollectionPathAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + +Response response = await client.GetCollectionPathAsync(null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> +This sample shows how to call GetCollectionPathAsync with all parameters and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); -Response response = await client.GetCollectionPathAsync(new RequestContext()); +Response response = await client.GetCollectionPathAsync(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("parentFriendlyNameChain")[0].ToString()); Console.WriteLine(result.GetProperty("parentNameChain")[0].ToString()); -]]> - +]]> - -This sample shows how to call GetCollectionPath with required parameters and parse the result. + +This sample shows how to call GetCollectionPath and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + +Response response = client.GetCollectionPath(null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> +This sample shows how to call GetCollectionPath with all parameters and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); -Response response = client.GetCollectionPath(new RequestContext()); +Response response = client.GetCollectionPath(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("parentFriendlyNameChain")[0].ToString()); Console.WriteLine(result.GetProperty("parentNameChain")[0].ToString()); -]]> - +]]> - -This sample shows how to call GetCollectionsAsync with required parameters and parse the result. + +This sample shows how to call GetCollectionsAsync and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(null); -await foreach (var item in client.GetCollectionsAsync("", new RequestContext())) +await foreach (BinaryData item in client.GetCollectionsAsync(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("collectionProvisioningState").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("friendlyName").ToString()); - Console.WriteLine(result.GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("parentCollection").GetProperty("referenceName").ToString()); - Console.WriteLine(result.GetProperty("parentCollection").GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("systemData").GetProperty("createdAt").ToString()); - Console.WriteLine(result.GetProperty("systemData").GetProperty("createdBy").ToString()); - Console.WriteLine(result.GetProperty("systemData").GetProperty("createdByType").ToString()); - Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedAt").ToString()); - Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedBy").ToString()); - Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedByType").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetCollectionsAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(null); + +await foreach (BinaryData item in client.GetCollectionsAsync("", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("collectionProvisioningState").ToString()); + Console.WriteLine(result[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("friendlyName").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("parentCollection").GetProperty("referenceName").ToString()); + Console.WriteLine(result[0].GetProperty("parentCollection").GetProperty("type").ToString()); + Console.WriteLine(result[0].GetProperty("systemData").GetProperty("createdAt").ToString()); + Console.WriteLine(result[0].GetProperty("systemData").GetProperty("createdBy").ToString()); + Console.WriteLine(result[0].GetProperty("systemData").GetProperty("createdByType").ToString()); + Console.WriteLine(result[0].GetProperty("systemData").GetProperty("lastModifiedAt").ToString()); + Console.WriteLine(result[0].GetProperty("systemData").GetProperty("lastModifiedBy").ToString()); + Console.WriteLine(result[0].GetProperty("systemData").GetProperty("lastModifiedByType").ToString()); +} +]]> - -This sample shows how to call GetCollections with required parameters and parse the result. + +This sample shows how to call GetCollections and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(null); -foreach (var item in client.GetCollections("", new RequestContext())) +foreach (BinaryData item in client.GetCollections(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("collectionProvisioningState").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("friendlyName").ToString()); - Console.WriteLine(result.GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("parentCollection").GetProperty("referenceName").ToString()); - Console.WriteLine(result.GetProperty("parentCollection").GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("systemData").GetProperty("createdAt").ToString()); - Console.WriteLine(result.GetProperty("systemData").GetProperty("createdBy").ToString()); - Console.WriteLine(result.GetProperty("systemData").GetProperty("createdByType").ToString()); - Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedAt").ToString()); - Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedBy").ToString()); - Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedByType").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetCollections with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(null); + +foreach (BinaryData item in client.GetCollections("", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("collectionProvisioningState").ToString()); + Console.WriteLine(result[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("friendlyName").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("parentCollection").GetProperty("referenceName").ToString()); + Console.WriteLine(result[0].GetProperty("parentCollection").GetProperty("type").ToString()); + Console.WriteLine(result[0].GetProperty("systemData").GetProperty("createdAt").ToString()); + Console.WriteLine(result[0].GetProperty("systemData").GetProperty("createdBy").ToString()); + Console.WriteLine(result[0].GetProperty("systemData").GetProperty("createdByType").ToString()); + Console.WriteLine(result[0].GetProperty("systemData").GetProperty("lastModifiedAt").ToString()); + Console.WriteLine(result[0].GetProperty("systemData").GetProperty("lastModifiedBy").ToString()); + Console.WriteLine(result[0].GetProperty("systemData").GetProperty("lastModifiedByType").ToString()); +} +]]> - -This sample shows how to call GetChildCollectionNamesAsync with required parameters and parse the result. + +This sample shows how to call GetChildCollectionNamesAsync and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); -await foreach (var item in client.GetChildCollectionNamesAsync("", new RequestContext())) +await foreach (BinaryData item in client.GetChildCollectionNamesAsync(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("friendlyName").ToString()); - Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetChildCollectionNamesAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + +await foreach (BinaryData item in client.GetChildCollectionNamesAsync("", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("friendlyName").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetChildCollectionNames with required parameters and parse the result. + +This sample shows how to call GetChildCollectionNames and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); -foreach (var item in client.GetChildCollectionNames("", new RequestContext())) +foreach (BinaryData item in client.GetChildCollectionNames(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("friendlyName").ToString()); - Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetChildCollectionNames with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + +foreach (BinaryData item in client.GetChildCollectionNames("", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("friendlyName").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); +} +]]> \ No newline at end of file diff --git a/samples/Azure.Analytics.Purview.Account/src/Generated/Docs/PurviewAccountResourceSetRules.xml b/samples/Azure.Analytics.Purview.Account/src/Generated/Docs/PurviewAccountResourceSetRules.xml index 82324acac8e..d433b683546 100644 --- a/samples/Azure.Analytics.Purview.Account/src/Generated/Docs/PurviewAccountResourceSetRules.xml +++ b/samples/Azure.Analytics.Purview.Account/src/Generated/Docs/PurviewAccountResourceSetRules.xml @@ -2,14 +2,25 @@ - -This sample shows how to call GetResourceSetRuleAsync with required parameters and parse the result. + +This sample shows how to call GetResourceSetRuleAsync and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountResourceSetRules client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); -Response response = await client.GetResourceSetRuleAsync(new RequestContext()); +Response response = await client.GetResourceSetRuleAsync(null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> +This sample shows how to call GetResourceSetRuleAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountResourceSetRules client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); + +Response response = await client.GetResourceSetRuleAsync(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("advancedResourceSet").GetProperty("modifiedAt").ToString()); @@ -97,18 +108,28 @@ Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRul Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("qualifiedName").ToString()); Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("storeType").ToString()); Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("version").ToString()); -]]> - +]]> - -This sample shows how to call GetResourceSetRule with required parameters and parse the result. + +This sample shows how to call GetResourceSetRule and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountResourceSetRules client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); -Response response = client.GetResourceSetRule(new RequestContext()); +Response response = client.GetResourceSetRule(null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> +This sample shows how to call GetResourceSetRule with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountResourceSetRules client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); + +Response response = client.GetResourceSetRule(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("advancedResourceSet").GetProperty("modifiedAt").ToString()); @@ -196,38 +217,41 @@ Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRul Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("qualifiedName").ToString()); Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("storeType").ToString()); Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("version").ToString()); -]]> - +]]> - + This sample shows how to call CreateOrUpdateResourceSetRuleAsync and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); - -var data = new {}; +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountResourceSetRules client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); -Response response = await client.CreateOrUpdateResourceSetRuleAsync(RequestContent.Create(data)); +RequestContent content = RequestContent.Create(new object()); +Response response = await client.CreateOrUpdateResourceSetRuleAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); ]]> -This sample shows how to call CreateOrUpdateResourceSetRuleAsync with all request content, and how to parse the result. +This sample shows how to call CreateOrUpdateResourceSetRuleAsync with all request content and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountResourceSetRules client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); -var data = new { - advancedResourceSet = new { +RequestContent content = RequestContent.Create(new +{ + advancedResourceSet = new + { modifiedAt = "2022-05-10T18:57:31.2311892Z", resourceSetProcessing = "Default", }, - pathPatternConfig = new { - acceptedPatterns = new[] { - new { + pathPatternConfig = new + { + acceptedPatterns = new List() + { + new + { createdBy = "", filterType = "Pattern", lastUpdatedTimestamp = 1234L, @@ -236,8 +260,10 @@ var data = new { path = "", } }, - complexReplacers = new[] { - new { + complexReplacers = new List() + { + new + { createdBy = "", description = "", disabled = true, @@ -252,17 +278,21 @@ var data = new { enableDefaultPatterns = true, lastUpdatedTimestamp = 1234L, modifiedBy = "", - normalizationRules = new[] { - new { + normalizationRules = new List() + { + new + { description = "", disabled = true, dynamicReplacement = true, - entityTypes = new[] { - "" + entityTypes = new List() + { + "" }, lastUpdatedTimestamp = 1234L, name = "", - regex = new { + regex = new + { maxDigits = 1234, maxLetters = 1234, minDashes = 1234, @@ -276,63 +306,37 @@ var data = new { regexStr = "", }, replaceWith = "", - version = 123.45d, + version = 123.45, } }, - regexReplacers = new[] { - new { + regexReplacers = new List() + { + new + { condition = "", createdBy = "", description = "", disabled = true, disableRecursiveReplacerApplication = true, - doNotReplaceRegex = new { - maxDigits = 1234, - maxLetters = 1234, - minDashes = 1234, - minDigits = 1234, - minDigitsOrLetters = 1234, - minDots = 1234, - minHex = 1234, - minLetters = 1234, - minUnderscores = 1234, - options = 1234, - regexStr = "", - }, lastUpdatedTimestamp = 1234L, modifiedBy = "", name = "", - regex = new { - maxDigits = 1234, - maxLetters = 1234, - minDashes = 1234, - minDigits = 1234, - minDigitsOrLetters = 1234, - minDots = 1234, - minHex = 1234, - minLetters = 1234, - minUnderscores = 1234, - options = 1234, - regexStr = "", - }, replaceWith = "", } }, - rejectedPatterns = new[] { - new { - createdBy = "", - filterType = "Pattern", - lastUpdatedTimestamp = 1234L, - modifiedBy = "", - name = "", - path = "", - } + rejectedPatterns = new List() + { + null }, - scopedRules = new[] { - new { + scopedRules = new List() + { + new + { bindingUrl = "", - rules = new[] { - new { + rules = new List() + { + new + { displayName = "", isResourceSet = true, lastUpdatedTimestamp = 1234L, @@ -345,9 +349,8 @@ var data = new { }, version = 1234, }, -}; - -Response response = await client.CreateOrUpdateResourceSetRuleAsync(RequestContent.Create(data)); +}); +Response response = await client.CreateOrUpdateResourceSetRuleAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("advancedResourceSet").GetProperty("modifiedAt").ToString()); @@ -435,38 +438,41 @@ Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRul Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("qualifiedName").ToString()); Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("storeType").ToString()); Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("version").ToString()); -]]> - +]]> - + This sample shows how to call CreateOrUpdateResourceSetRule and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountResourceSetRules client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); -var data = new {}; - -Response response = client.CreateOrUpdateResourceSetRule(RequestContent.Create(data)); +RequestContent content = RequestContent.Create(new object()); +Response response = client.CreateOrUpdateResourceSetRule(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); ]]> -This sample shows how to call CreateOrUpdateResourceSetRule with all request content, and how to parse the result. +This sample shows how to call CreateOrUpdateResourceSetRule with all request content and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountResourceSetRules client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); -var data = new { - advancedResourceSet = new { +RequestContent content = RequestContent.Create(new +{ + advancedResourceSet = new + { modifiedAt = "2022-05-10T18:57:31.2311892Z", resourceSetProcessing = "Default", }, - pathPatternConfig = new { - acceptedPatterns = new[] { - new { + pathPatternConfig = new + { + acceptedPatterns = new List() + { + new + { createdBy = "", filterType = "Pattern", lastUpdatedTimestamp = 1234L, @@ -475,8 +481,10 @@ var data = new { path = "", } }, - complexReplacers = new[] { - new { + complexReplacers = new List() + { + new + { createdBy = "", description = "", disabled = true, @@ -491,17 +499,21 @@ var data = new { enableDefaultPatterns = true, lastUpdatedTimestamp = 1234L, modifiedBy = "", - normalizationRules = new[] { - new { + normalizationRules = new List() + { + new + { description = "", disabled = true, dynamicReplacement = true, - entityTypes = new[] { - "" + entityTypes = new List() + { + "" }, lastUpdatedTimestamp = 1234L, name = "", - regex = new { + regex = new + { maxDigits = 1234, maxLetters = 1234, minDashes = 1234, @@ -515,63 +527,37 @@ var data = new { regexStr = "", }, replaceWith = "", - version = 123.45d, + version = 123.45, } }, - regexReplacers = new[] { - new { + regexReplacers = new List() + { + new + { condition = "", createdBy = "", description = "", disabled = true, disableRecursiveReplacerApplication = true, - doNotReplaceRegex = new { - maxDigits = 1234, - maxLetters = 1234, - minDashes = 1234, - minDigits = 1234, - minDigitsOrLetters = 1234, - minDots = 1234, - minHex = 1234, - minLetters = 1234, - minUnderscores = 1234, - options = 1234, - regexStr = "", - }, lastUpdatedTimestamp = 1234L, modifiedBy = "", name = "", - regex = new { - maxDigits = 1234, - maxLetters = 1234, - minDashes = 1234, - minDigits = 1234, - minDigitsOrLetters = 1234, - minDots = 1234, - minHex = 1234, - minLetters = 1234, - minUnderscores = 1234, - options = 1234, - regexStr = "", - }, replaceWith = "", } }, - rejectedPatterns = new[] { - new { - createdBy = "", - filterType = "Pattern", - lastUpdatedTimestamp = 1234L, - modifiedBy = "", - name = "", - path = "", - } + rejectedPatterns = new List() + { + null }, - scopedRules = new[] { - new { + scopedRules = new List() + { + new + { bindingUrl = "", - rules = new[] { - new { + rules = new List() + { + new + { displayName = "", isResourceSet = true, lastUpdatedTimestamp = 1234L, @@ -584,9 +570,8 @@ var data = new { }, version = 1234, }, -}; - -Response response = client.CreateOrUpdateResourceSetRule(RequestContent.Create(data)); +}); +Response response = client.CreateOrUpdateResourceSetRule(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("advancedResourceSet").GetProperty("modifiedAt").ToString()); @@ -674,34 +659,49 @@ Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRul Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("qualifiedName").ToString()); Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("storeType").ToString()); Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("version").ToString()); -]]> - +]]> - + This sample shows how to call DeleteResourceSetRuleAsync. "); -var client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountResourceSetRules client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); Response response = await client.DeleteResourceSetRuleAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call DeleteResourceSetRuleAsync with all request content. +"); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountResourceSetRules client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); + +Response response = await client.DeleteResourceSetRuleAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call DeleteResourceSetRule. "); -var client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountResourceSetRules client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); Response response = client.DeleteResourceSetRule(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call DeleteResourceSetRule with all request content. +"); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountResourceSetRules client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); + +Response response = client.DeleteResourceSetRule(); +Console.WriteLine(response.Status); +]]> \ No newline at end of file diff --git a/samples/Azure.Analytics.Purview.Account/src/Generated/Docs/PurviewAccountsClient.xml b/samples/Azure.Analytics.Purview.Account/src/Generated/Docs/PurviewAccountsClient.xml index 14e7d20801f..3aa945e053b 100644 --- a/samples/Azure.Analytics.Purview.Account/src/Generated/Docs/PurviewAccountsClient.xml +++ b/samples/Azure.Analytics.Purview.Account/src/Generated/Docs/PurviewAccountsClient.xml @@ -2,14 +2,25 @@ - -This sample shows how to call GetAccountPropertiesAsync with required parameters and parse the result. + +This sample shows how to call GetAccountPropertiesAsync and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); -Response response = await client.GetAccountPropertiesAsync(new RequestContext()); +Response response = await client.GetAccountPropertiesAsync(null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> +This sample shows how to call GetAccountPropertiesAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); + +Response response = await client.GetAccountPropertiesAsync(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -48,20 +59,30 @@ Console.WriteLine(result.GetProperty("systemData").GetProperty("createdByType"). Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedAt").ToString()); Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedBy").ToString()); Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedByType").ToString()); -Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("type").ToString()); -]]> - +]]> - -This sample shows how to call GetAccountProperties with required parameters and parse the result. + +This sample shows how to call GetAccountProperties and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); -Response response = client.GetAccountProperties(new RequestContext()); +Response response = client.GetAccountProperties(null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> +This sample shows how to call GetAccountProperties with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); + +Response response = client.GetAccountProperties(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -100,37 +121,35 @@ Console.WriteLine(result.GetProperty("systemData").GetProperty("createdByType"). Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedAt").ToString()); Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedBy").ToString()); Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedByType").ToString()); -Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("type").ToString()); -]]> - +]]> - + This sample shows how to call UpdateAccountPropertiesAsync and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); -var data = new {}; - -Response response = await client.UpdateAccountPropertiesAsync(RequestContent.Create(data)); +RequestContent content = RequestContent.Create(new object()); +Response response = await client.UpdateAccountPropertiesAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); ]]> -This sample shows how to call UpdateAccountPropertiesAsync with all request content, and how to parse the result. +This sample shows how to call UpdateAccountPropertiesAsync with all request content and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); -var data = new { +RequestContent content = RequestContent.Create(new +{ friendlyName = "", -}; - -Response response = await client.UpdateAccountPropertiesAsync(RequestContent.Create(data)); +}); +Response response = await client.UpdateAccountPropertiesAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -169,37 +188,35 @@ Console.WriteLine(result.GetProperty("systemData").GetProperty("createdByType"). Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedAt").ToString()); Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedBy").ToString()); Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedByType").ToString()); -Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("type").ToString()); -]]> - +]]> - + This sample shows how to call UpdateAccountProperties and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); -var data = new {}; - -Response response = client.UpdateAccountProperties(RequestContent.Create(data)); +RequestContent content = RequestContent.Create(new object()); +Response response = client.UpdateAccountProperties(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); ]]> -This sample shows how to call UpdateAccountProperties with all request content, and how to parse the result. +This sample shows how to call UpdateAccountProperties with all request content and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); -var data = new { +RequestContent content = RequestContent.Create(new +{ friendlyName = "", -}; - -Response response = client.UpdateAccountProperties(RequestContent.Create(data)); +}); +Response response = client.UpdateAccountProperties(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -238,308 +255,345 @@ Console.WriteLine(result.GetProperty("systemData").GetProperty("createdByType"). Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedAt").ToString()); Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedBy").ToString()); Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedByType").ToString()); -Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("type").ToString()); -]]> - +]]> - -This sample shows how to call GetAccessKeysAsync with required parameters and parse the result. + +This sample shows how to call GetAccessKeysAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); + +Response response = await client.GetAccessKeysAsync(null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> +This sample shows how to call GetAccessKeysAsync with all parameters and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); -Response response = await client.GetAccessKeysAsync(new RequestContext()); +Response response = await client.GetAccessKeysAsync(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("atlasKafkaPrimaryEndpoint").ToString()); Console.WriteLine(result.GetProperty("atlasKafkaSecondaryEndpoint").ToString()); -]]> - +]]> - -This sample shows how to call GetAccessKeys with required parameters and parse the result. + +This sample shows how to call GetAccessKeys and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); + +Response response = client.GetAccessKeys(null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> +This sample shows how to call GetAccessKeys with all parameters and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); -Response response = client.GetAccessKeys(new RequestContext()); +Response response = client.GetAccessKeys(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("atlasKafkaPrimaryEndpoint").ToString()); Console.WriteLine(result.GetProperty("atlasKafkaSecondaryEndpoint").ToString()); -]]> - +]]> - + This sample shows how to call RegenerateAccessKeyAsync and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); -var data = new {}; - -Response response = await client.RegenerateAccessKeyAsync(RequestContent.Create(data)); +RequestContent content = RequestContent.Create(new object()); +Response response = await client.RegenerateAccessKeyAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); ]]> -This sample shows how to call RegenerateAccessKeyAsync with all request content, and how to parse the result. +This sample shows how to call RegenerateAccessKeyAsync with all request content and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); -var data = new { +RequestContent content = RequestContent.Create(new +{ keyType = "PrimaryAtlasKafkaKey", -}; - -Response response = await client.RegenerateAccessKeyAsync(RequestContent.Create(data)); +}); +Response response = await client.RegenerateAccessKeyAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("atlasKafkaPrimaryEndpoint").ToString()); Console.WriteLine(result.GetProperty("atlasKafkaSecondaryEndpoint").ToString()); -]]> - +]]> - + This sample shows how to call RegenerateAccessKey and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential); - -var data = new {}; +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); -Response response = client.RegenerateAccessKey(RequestContent.Create(data)); +RequestContent content = RequestContent.Create(new object()); +Response response = client.RegenerateAccessKey(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); ]]> -This sample shows how to call RegenerateAccessKey with all request content, and how to parse the result. +This sample shows how to call RegenerateAccessKey with all request content and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); -var data = new { +RequestContent content = RequestContent.Create(new +{ keyType = "PrimaryAtlasKafkaKey", -}; - -Response response = client.RegenerateAccessKey(RequestContent.Create(data)); +}); +Response response = client.RegenerateAccessKey(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("atlasKafkaPrimaryEndpoint").ToString()); Console.WriteLine(result.GetProperty("atlasKafkaSecondaryEndpoint").ToString()); -]]> - +]]> - -This sample shows how to call GetResourceSetRulesAsync with required parameters and parse the result. + +This sample shows how to call GetResourceSetRulesAsync and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); -await foreach (var item in client.GetResourceSetRulesAsync("", new RequestContext())) +await foreach (BinaryData item in client.GetResourceSetRulesAsync(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("advancedResourceSet").GetProperty("modifiedAt").ToString()); - Console.WriteLine(result.GetProperty("advancedResourceSet").GetProperty("resourceSetProcessing").ToString()); - Console.WriteLine(result.GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("createdBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("filterType").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("lastUpdatedTimestamp").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("modifiedBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("path").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("createdBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("disabled").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("disableRecursiveReplacerApplication").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("lastUpdatedTimestamp").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("modifiedBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("typeName").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("createdBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("enableDefaultPatterns").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("lastUpdatedTimestamp").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("modifiedBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("disabled").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("dynamicReplacement").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("entityTypes")[0].ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("lastUpdatedTimestamp").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("maxDigits").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("maxLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDashes").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDigits").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDigitsOrLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDots").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minHex").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minUnderscores").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("options").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("regexStr").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("replaceWith").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("version").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("condition").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("createdBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("disabled").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("disableRecursiveReplacerApplication").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("maxDigits").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("maxLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDashes").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDigits").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDigitsOrLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDots").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minHex").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minUnderscores").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("options").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("regexStr").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("lastUpdatedTimestamp").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("modifiedBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("maxDigits").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("maxLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDashes").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDigits").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDigitsOrLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDots").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minHex").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minUnderscores").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("options").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("regexStr").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("replaceWith").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("createdBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("filterType").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("lastUpdatedTimestamp").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("modifiedBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("path").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("bindingUrl").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("displayName").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("isResourceSet").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("lastUpdatedTimestamp").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("qualifiedName").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("storeType").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("version").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetResourceSetRulesAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); + +await foreach (BinaryData item in client.GetResourceSetRulesAsync("", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("advancedResourceSet").GetProperty("modifiedAt").ToString()); + Console.WriteLine(result[0].GetProperty("advancedResourceSet").GetProperty("resourceSetProcessing").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("createdBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("filterType").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("lastUpdatedTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("modifiedBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("path").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("createdBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("disabled").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("disableRecursiveReplacerApplication").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("lastUpdatedTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("modifiedBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("typeName").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("createdBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("enableDefaultPatterns").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("lastUpdatedTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("modifiedBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("disabled").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("dynamicReplacement").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("entityTypes")[0].ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("lastUpdatedTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("maxDigits").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("maxLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDashes").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDigits").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDigitsOrLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDots").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minHex").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minUnderscores").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("options").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("regexStr").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("replaceWith").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("version").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("condition").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("createdBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("disabled").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("disableRecursiveReplacerApplication").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("maxDigits").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("maxLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDashes").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDigits").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDigitsOrLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDots").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minHex").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minUnderscores").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("options").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("regexStr").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("lastUpdatedTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("modifiedBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("maxDigits").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("maxLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDashes").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDigits").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDigitsOrLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDots").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minHex").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minUnderscores").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("options").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("regexStr").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("replaceWith").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("createdBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("filterType").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("lastUpdatedTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("modifiedBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("path").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("bindingUrl").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("displayName").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("isResourceSet").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("lastUpdatedTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("qualifiedName").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("storeType").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("version").ToString()); +} +]]> - -This sample shows how to call GetResourceSetRules with required parameters and parse the result. + +This sample shows how to call GetResourceSetRules and parse the result. "); -var client = new PurviewAccountsClient(endpoint, credential); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); -foreach (var item in client.GetResourceSetRules("", new RequestContext())) +foreach (BinaryData item in client.GetResourceSetRules(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("advancedResourceSet").GetProperty("modifiedAt").ToString()); - Console.WriteLine(result.GetProperty("advancedResourceSet").GetProperty("resourceSetProcessing").ToString()); - Console.WriteLine(result.GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("createdBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("filterType").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("lastUpdatedTimestamp").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("modifiedBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("path").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("createdBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("disabled").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("disableRecursiveReplacerApplication").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("lastUpdatedTimestamp").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("modifiedBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("typeName").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("createdBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("enableDefaultPatterns").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("lastUpdatedTimestamp").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("modifiedBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("disabled").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("dynamicReplacement").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("entityTypes")[0].ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("lastUpdatedTimestamp").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("maxDigits").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("maxLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDashes").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDigits").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDigitsOrLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDots").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minHex").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minUnderscores").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("options").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("regexStr").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("replaceWith").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("version").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("condition").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("createdBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("disabled").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("disableRecursiveReplacerApplication").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("maxDigits").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("maxLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDashes").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDigits").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDigitsOrLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDots").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minHex").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minUnderscores").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("options").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("regexStr").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("lastUpdatedTimestamp").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("modifiedBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("maxDigits").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("maxLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDashes").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDigits").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDigitsOrLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDots").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minHex").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minUnderscores").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("options").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("regexStr").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("replaceWith").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("createdBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("filterType").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("lastUpdatedTimestamp").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("modifiedBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("path").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("bindingUrl").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("displayName").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("isResourceSet").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("lastUpdatedTimestamp").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("qualifiedName").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("storeType").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("version").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetResourceSetRules with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); + +foreach (BinaryData item in client.GetResourceSetRules("", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("advancedResourceSet").GetProperty("modifiedAt").ToString()); + Console.WriteLine(result[0].GetProperty("advancedResourceSet").GetProperty("resourceSetProcessing").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("createdBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("filterType").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("lastUpdatedTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("modifiedBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("path").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("createdBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("disabled").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("disableRecursiveReplacerApplication").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("lastUpdatedTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("modifiedBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("typeName").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("createdBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("enableDefaultPatterns").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("lastUpdatedTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("modifiedBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("disabled").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("dynamicReplacement").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("entityTypes")[0].ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("lastUpdatedTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("maxDigits").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("maxLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDashes").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDigits").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDigitsOrLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDots").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minHex").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minUnderscores").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("options").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("regexStr").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("replaceWith").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("version").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("condition").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("createdBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("disabled").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("disableRecursiveReplacerApplication").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("maxDigits").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("maxLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDashes").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDigits").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDigitsOrLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDots").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minHex").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minUnderscores").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("options").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("regexStr").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("lastUpdatedTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("modifiedBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("maxDigits").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("maxLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDashes").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDigits").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDigitsOrLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDots").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minHex").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minUnderscores").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("options").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("regexStr").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("replaceWith").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("createdBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("filterType").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("lastUpdatedTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("modifiedBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("path").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("bindingUrl").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("displayName").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("isResourceSet").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("lastUpdatedTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("qualifiedName").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("storeType").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("version").ToString()); +} +]]> \ No newline at end of file diff --git a/samples/Azure.Analytics.Purview.Account/tests/Generated/Samples/Samples_PurviewAccountCollections.cs b/samples/Azure.Analytics.Purview.Account/tests/Generated/Samples/Samples_PurviewAccountCollections.cs index a2ff9d7e71b..1b3e08c54e5 100644 --- a/samples/Azure.Analytics.Purview.Account/tests/Generated/Samples/Samples_PurviewAccountCollections.cs +++ b/samples/Azure.Analytics.Purview.Account/tests/Generated/Samples/Samples_PurviewAccountCollections.cs @@ -6,11 +6,10 @@ #nullable disable using System; -using System.Collections.Generic; -using System.IO; using System.Text.Json; using System.Threading.Tasks; using Azure; +using Azure.Analytics.Purview.Account; using Azure.Core; using Azure.Identity; using NUnit.Framework; @@ -23,11 +22,11 @@ internal class Samples_PurviewAccountCollections [Ignore("Only validating compilation of examples")] public void Example_GetCollection() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); - Response response = client.GetCollection(new RequestContext()); + Response response = client.GetCollection(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -37,11 +36,11 @@ public void Example_GetCollection() [Ignore("Only validating compilation of examples")] public void Example_GetCollection_AllParameters() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); - Response response = client.GetCollection(new RequestContext()); + Response response = client.GetCollection(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("collectionProvisioningState").ToString()); @@ -62,11 +61,11 @@ public void Example_GetCollection_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetCollection_Async() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); - Response response = await client.GetCollectionAsync(new RequestContext()); + Response response = await client.GetCollectionAsync(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -76,11 +75,11 @@ public async Task Example_GetCollection_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetCollection_AllParameters_Async() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); - Response response = await client.GetCollectionAsync(new RequestContext()); + Response response = await client.GetCollectionAsync(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("collectionProvisioningState").ToString()); @@ -101,13 +100,12 @@ public async Task Example_GetCollection_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_CreateOrUpdateCollection() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); - var data = new { }; - - Response response = client.CreateOrUpdateCollection(RequestContent.Create(data)); + RequestContent content = RequestContent.Create(new object()); + Response response = client.CreateOrUpdateCollection(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -117,11 +115,11 @@ public void Example_CreateOrUpdateCollection() [Ignore("Only validating compilation of examples")] public void Example_CreateOrUpdateCollection_AllParameters() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); - var data = new + RequestContent content = RequestContent.Create(new { description = "", friendlyName = "", @@ -129,9 +127,8 @@ public void Example_CreateOrUpdateCollection_AllParameters() { referenceName = "", }, - }; - - Response response = client.CreateOrUpdateCollection(RequestContent.Create(data)); + }); + Response response = client.CreateOrUpdateCollection(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("collectionProvisioningState").ToString()); @@ -152,13 +149,12 @@ public void Example_CreateOrUpdateCollection_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_CreateOrUpdateCollection_Async() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); - var data = new { }; - - Response response = await client.CreateOrUpdateCollectionAsync(RequestContent.Create(data)); + RequestContent content = RequestContent.Create(new object()); + Response response = await client.CreateOrUpdateCollectionAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -168,11 +164,11 @@ public async Task Example_CreateOrUpdateCollection_Async() [Ignore("Only validating compilation of examples")] public async Task Example_CreateOrUpdateCollection_AllParameters_Async() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); - var data = new + RequestContent content = RequestContent.Create(new { description = "", friendlyName = "", @@ -180,9 +176,8 @@ public async Task Example_CreateOrUpdateCollection_AllParameters_Async() { referenceName = "", }, - }; - - Response response = await client.CreateOrUpdateCollectionAsync(RequestContent.Create(data)); + }); + Response response = await client.CreateOrUpdateCollectionAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("collectionProvisioningState").ToString()); @@ -203,9 +198,9 @@ public async Task Example_CreateOrUpdateCollection_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_DeleteCollection() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); Response response = client.DeleteCollection(); Console.WriteLine(response.Status); @@ -215,9 +210,9 @@ public void Example_DeleteCollection() [Ignore("Only validating compilation of examples")] public void Example_DeleteCollection_AllParameters() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); Response response = client.DeleteCollection(); Console.WriteLine(response.Status); @@ -227,9 +222,9 @@ public void Example_DeleteCollection_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_DeleteCollection_Async() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); Response response = await client.DeleteCollectionAsync(); Console.WriteLine(response.Status); @@ -239,9 +234,9 @@ public async Task Example_DeleteCollection_Async() [Ignore("Only validating compilation of examples")] public async Task Example_DeleteCollection_AllParameters_Async() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); Response response = await client.DeleteCollectionAsync(); Console.WriteLine(response.Status); @@ -251,11 +246,11 @@ public async Task Example_DeleteCollection_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetCollectionPath() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); - Response response = client.GetCollectionPath(new RequestContext()); + Response response = client.GetCollectionPath(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -265,11 +260,11 @@ public void Example_GetCollectionPath() [Ignore("Only validating compilation of examples")] public void Example_GetCollectionPath_AllParameters() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); - Response response = client.GetCollectionPath(new RequestContext()); + Response response = client.GetCollectionPath(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("parentFriendlyNameChain")[0].ToString()); @@ -280,11 +275,11 @@ public void Example_GetCollectionPath_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetCollectionPath_Async() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); - Response response = await client.GetCollectionPathAsync(new RequestContext()); + Response response = await client.GetCollectionPathAsync(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -294,11 +289,11 @@ public async Task Example_GetCollectionPath_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetCollectionPath_AllParameters_Async() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); - Response response = await client.GetCollectionPathAsync(new RequestContext()); + Response response = await client.GetCollectionPathAsync(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("parentFriendlyNameChain")[0].ToString()); @@ -309,14 +304,14 @@ public async Task Example_GetCollectionPath_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetCollections() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(null); - foreach (var item in client.GetCollections("", new RequestContext())) + foreach (BinaryData item in client.GetCollections(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -324,25 +319,25 @@ public void Example_GetCollections() [Ignore("Only validating compilation of examples")] public void Example_GetCollections_AllParameters() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(null); - foreach (var item in client.GetCollections("", new RequestContext())) + foreach (BinaryData item in client.GetCollections("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("collectionProvisioningState").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("friendlyName").ToString()); - Console.WriteLine(result.GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("parentCollection").GetProperty("referenceName").ToString()); - Console.WriteLine(result.GetProperty("parentCollection").GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("systemData").GetProperty("createdAt").ToString()); - Console.WriteLine(result.GetProperty("systemData").GetProperty("createdBy").ToString()); - Console.WriteLine(result.GetProperty("systemData").GetProperty("createdByType").ToString()); - Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedAt").ToString()); - Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedBy").ToString()); - Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedByType").ToString()); + Console.WriteLine(result[0].GetProperty("collectionProvisioningState").ToString()); + Console.WriteLine(result[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("friendlyName").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("parentCollection").GetProperty("referenceName").ToString()); + Console.WriteLine(result[0].GetProperty("parentCollection").GetProperty("type").ToString()); + Console.WriteLine(result[0].GetProperty("systemData").GetProperty("createdAt").ToString()); + Console.WriteLine(result[0].GetProperty("systemData").GetProperty("createdBy").ToString()); + Console.WriteLine(result[0].GetProperty("systemData").GetProperty("createdByType").ToString()); + Console.WriteLine(result[0].GetProperty("systemData").GetProperty("lastModifiedAt").ToString()); + Console.WriteLine(result[0].GetProperty("systemData").GetProperty("lastModifiedBy").ToString()); + Console.WriteLine(result[0].GetProperty("systemData").GetProperty("lastModifiedByType").ToString()); } } @@ -350,14 +345,14 @@ public void Example_GetCollections_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetCollections_Async() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(null); - await foreach (var item in client.GetCollectionsAsync("", new RequestContext())) + await foreach (BinaryData item in client.GetCollectionsAsync(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -365,25 +360,25 @@ public async Task Example_GetCollections_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetCollections_AllParameters_Async() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(null); - await foreach (var item in client.GetCollectionsAsync("", new RequestContext())) + await foreach (BinaryData item in client.GetCollectionsAsync("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("collectionProvisioningState").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("friendlyName").ToString()); - Console.WriteLine(result.GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("parentCollection").GetProperty("referenceName").ToString()); - Console.WriteLine(result.GetProperty("parentCollection").GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("systemData").GetProperty("createdAt").ToString()); - Console.WriteLine(result.GetProperty("systemData").GetProperty("createdBy").ToString()); - Console.WriteLine(result.GetProperty("systemData").GetProperty("createdByType").ToString()); - Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedAt").ToString()); - Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedBy").ToString()); - Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedByType").ToString()); + Console.WriteLine(result[0].GetProperty("collectionProvisioningState").ToString()); + Console.WriteLine(result[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("friendlyName").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("parentCollection").GetProperty("referenceName").ToString()); + Console.WriteLine(result[0].GetProperty("parentCollection").GetProperty("type").ToString()); + Console.WriteLine(result[0].GetProperty("systemData").GetProperty("createdAt").ToString()); + Console.WriteLine(result[0].GetProperty("systemData").GetProperty("createdBy").ToString()); + Console.WriteLine(result[0].GetProperty("systemData").GetProperty("createdByType").ToString()); + Console.WriteLine(result[0].GetProperty("systemData").GetProperty("lastModifiedAt").ToString()); + Console.WriteLine(result[0].GetProperty("systemData").GetProperty("lastModifiedBy").ToString()); + Console.WriteLine(result[0].GetProperty("systemData").GetProperty("lastModifiedByType").ToString()); } } @@ -391,14 +386,14 @@ public async Task Example_GetCollections_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetChildCollectionNames() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); - foreach (var item in client.GetChildCollectionNames("", new RequestContext())) + foreach (BinaryData item in client.GetChildCollectionNames(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -406,15 +401,15 @@ public void Example_GetChildCollectionNames() [Ignore("Only validating compilation of examples")] public void Example_GetChildCollectionNames_AllParameters() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); - foreach (var item in client.GetChildCollectionNames("", new RequestContext())) + foreach (BinaryData item in client.GetChildCollectionNames("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("friendlyName").ToString()); - Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("friendlyName").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); } } @@ -422,14 +417,14 @@ public void Example_GetChildCollectionNames_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetChildCollectionNames_Async() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); - await foreach (var item in client.GetChildCollectionNamesAsync("", new RequestContext())) + await foreach (BinaryData item in client.GetChildCollectionNamesAsync(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -437,15 +432,15 @@ public async Task Example_GetChildCollectionNames_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetChildCollectionNames_AllParameters_Async() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountCollections client = new PurviewAccountsClient(endpoint, credential).GetCollectionsClient(""); - await foreach (var item in client.GetChildCollectionNamesAsync("", new RequestContext())) + await foreach (BinaryData item in client.GetChildCollectionNamesAsync("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("friendlyName").ToString()); - Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("friendlyName").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); } } } diff --git a/samples/Azure.Analytics.Purview.Account/tests/Generated/Samples/Samples_PurviewAccountResourceSetRules.cs b/samples/Azure.Analytics.Purview.Account/tests/Generated/Samples/Samples_PurviewAccountResourceSetRules.cs index 2d5d6fc52f3..aad34eef6c5 100644 --- a/samples/Azure.Analytics.Purview.Account/tests/Generated/Samples/Samples_PurviewAccountResourceSetRules.cs +++ b/samples/Azure.Analytics.Purview.Account/tests/Generated/Samples/Samples_PurviewAccountResourceSetRules.cs @@ -7,10 +7,10 @@ using System; using System.Collections.Generic; -using System.IO; using System.Text.Json; using System.Threading.Tasks; using Azure; +using Azure.Analytics.Purview.Account; using Azure.Core; using Azure.Identity; using NUnit.Framework; @@ -23,11 +23,11 @@ internal class Samples_PurviewAccountResourceSetRules [Ignore("Only validating compilation of examples")] public void Example_GetResourceSetRule() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountResourceSetRules client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); - Response response = client.GetResourceSetRule(new RequestContext()); + Response response = client.GetResourceSetRule(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -37,11 +37,11 @@ public void Example_GetResourceSetRule() [Ignore("Only validating compilation of examples")] public void Example_GetResourceSetRule_AllParameters() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountResourceSetRules client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); - Response response = client.GetResourceSetRule(new RequestContext()); + Response response = client.GetResourceSetRule(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("advancedResourceSet").GetProperty("modifiedAt").ToString()); @@ -135,11 +135,11 @@ public void Example_GetResourceSetRule_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetResourceSetRule_Async() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountResourceSetRules client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); - Response response = await client.GetResourceSetRuleAsync(new RequestContext()); + Response response = await client.GetResourceSetRuleAsync(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -149,11 +149,11 @@ public async Task Example_GetResourceSetRule_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetResourceSetRule_AllParameters_Async() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountResourceSetRules client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); - Response response = await client.GetResourceSetRuleAsync(new RequestContext()); + Response response = await client.GetResourceSetRuleAsync(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("advancedResourceSet").GetProperty("modifiedAt").ToString()); @@ -247,13 +247,12 @@ public async Task Example_GetResourceSetRule_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_CreateOrUpdateResourceSetRule() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountResourceSetRules client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); - var data = new { }; - - Response response = client.CreateOrUpdateResourceSetRule(RequestContent.Create(data)); + RequestContent content = RequestContent.Create(new object()); + Response response = client.CreateOrUpdateResourceSetRule(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -263,11 +262,11 @@ public void Example_CreateOrUpdateResourceSetRule() [Ignore("Only validating compilation of examples")] public void Example_CreateOrUpdateResourceSetRule_AllParameters() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountResourceSetRules client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); - var data = new + RequestContent content = RequestContent.Create(new { advancedResourceSet = new { @@ -276,128 +275,109 @@ public void Example_CreateOrUpdateResourceSetRule_AllParameters() }, pathPatternConfig = new { - acceptedPatterns = new[] { - new { - createdBy = "", - filterType = "Pattern", - lastUpdatedTimestamp = 1234L, - modifiedBy = "", - name = "", - path = "", - } - }, - complexReplacers = new[] { - new { - createdBy = "", - description = "", - disabled = true, - disableRecursiveReplacerApplication = true, - lastUpdatedTimestamp = 1234L, - modifiedBy = "", - name = "", - typeName = "", - } - }, + acceptedPatterns = new List() +{ +new +{ +createdBy = "", +filterType = "Pattern", +lastUpdatedTimestamp = 1234L, +modifiedBy = "", +name = "", +path = "", +} +}, + complexReplacers = new List() +{ +new +{ +createdBy = "", +description = "", +disabled = true, +disableRecursiveReplacerApplication = true, +lastUpdatedTimestamp = 1234L, +modifiedBy = "", +name = "", +typeName = "", +} +}, createdBy = "", enableDefaultPatterns = true, lastUpdatedTimestamp = 1234L, modifiedBy = "", - normalizationRules = new[] { - new { - description = "", - disabled = true, - dynamicReplacement = true, - entityTypes = new[] { - "" - }, - lastUpdatedTimestamp = 1234L, - name = "", - regex = new { - maxDigits = 1234, - maxLetters = 1234, - minDashes = 1234, - minDigits = 1234, - minDigitsOrLetters = 1234, - minDots = 1234, - minHex = 1234, - minLetters = 1234, - minUnderscores = 1234, - options = 1234, - regexStr = "", - }, - replaceWith = "", - version = 123.45d, - } - }, - regexReplacers = new[] { - new { - condition = "", - createdBy = "", - description = "", - disabled = true, - disableRecursiveReplacerApplication = true, - doNotReplaceRegex = new { - maxDigits = 1234, - maxLetters = 1234, - minDashes = 1234, - minDigits = 1234, - minDigitsOrLetters = 1234, - minDots = 1234, - minHex = 1234, - minLetters = 1234, - minUnderscores = 1234, - options = 1234, - regexStr = "", - }, - lastUpdatedTimestamp = 1234L, - modifiedBy = "", - name = "", - regex = new { - maxDigits = 1234, - maxLetters = 1234, - minDashes = 1234, - minDigits = 1234, - minDigitsOrLetters = 1234, - minDots = 1234, - minHex = 1234, - minLetters = 1234, - minUnderscores = 1234, - options = 1234, - regexStr = "", - }, - replaceWith = "", - } - }, - rejectedPatterns = new[] { - new { - createdBy = "", - filterType = "Pattern", - lastUpdatedTimestamp = 1234L, - modifiedBy = "", - name = "", - path = "", - } - }, - scopedRules = new[] { - new { - bindingUrl = "", - rules = new[] { - new { - displayName = "", - isResourceSet = true, - lastUpdatedTimestamp = 1234L, - name = "", - qualifiedName = "", - } - }, - storeType = "", - } - }, + normalizationRules = new List() +{ +new +{ +description = "", +disabled = true, +dynamicReplacement = true, +entityTypes = new List() +{ +"" +}, +lastUpdatedTimestamp = 1234L, +name = "", +regex = new +{ +maxDigits = 1234, +maxLetters = 1234, +minDashes = 1234, +minDigits = 1234, +minDigitsOrLetters = 1234, +minDots = 1234, +minHex = 1234, +minLetters = 1234, +minUnderscores = 1234, +options = 1234, +regexStr = "", +}, +replaceWith = "", +version = 123.45, +} +}, + regexReplacers = new List() +{ +new +{ +condition = "", +createdBy = "", +description = "", +disabled = true, +disableRecursiveReplacerApplication = true, +lastUpdatedTimestamp = 1234L, +modifiedBy = "", +name = "", +replaceWith = "", +} +}, + rejectedPatterns = new List() +{ +null +}, + scopedRules = new List() +{ +new +{ +bindingUrl = "", +rules = new List() +{ +new +{ +displayName = "", +isResourceSet = true, +lastUpdatedTimestamp = 1234L, +name = "", +qualifiedName = "", +} +}, +storeType = "", +} +}, version = 1234, }, - }; - - Response response = client.CreateOrUpdateResourceSetRule(RequestContent.Create(data)); + }); + Response response = client.CreateOrUpdateResourceSetRule(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("advancedResourceSet").GetProperty("modifiedAt").ToString()); @@ -491,13 +471,12 @@ public void Example_CreateOrUpdateResourceSetRule_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_CreateOrUpdateResourceSetRule_Async() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountResourceSetRules client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); - var data = new { }; - - Response response = await client.CreateOrUpdateResourceSetRuleAsync(RequestContent.Create(data)); + RequestContent content = RequestContent.Create(new object()); + Response response = await client.CreateOrUpdateResourceSetRuleAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -507,11 +486,11 @@ public async Task Example_CreateOrUpdateResourceSetRule_Async() [Ignore("Only validating compilation of examples")] public async Task Example_CreateOrUpdateResourceSetRule_AllParameters_Async() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountResourceSetRules client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); - var data = new + RequestContent content = RequestContent.Create(new { advancedResourceSet = new { @@ -520,128 +499,109 @@ public async Task Example_CreateOrUpdateResourceSetRule_AllParameters_Async() }, pathPatternConfig = new { - acceptedPatterns = new[] { - new { - createdBy = "", - filterType = "Pattern", - lastUpdatedTimestamp = 1234L, - modifiedBy = "", - name = "", - path = "", - } - }, - complexReplacers = new[] { - new { - createdBy = "", - description = "", - disabled = true, - disableRecursiveReplacerApplication = true, - lastUpdatedTimestamp = 1234L, - modifiedBy = "", - name = "", - typeName = "", - } - }, + acceptedPatterns = new List() +{ +new +{ +createdBy = "", +filterType = "Pattern", +lastUpdatedTimestamp = 1234L, +modifiedBy = "", +name = "", +path = "", +} +}, + complexReplacers = new List() +{ +new +{ +createdBy = "", +description = "", +disabled = true, +disableRecursiveReplacerApplication = true, +lastUpdatedTimestamp = 1234L, +modifiedBy = "", +name = "", +typeName = "", +} +}, createdBy = "", enableDefaultPatterns = true, lastUpdatedTimestamp = 1234L, modifiedBy = "", - normalizationRules = new[] { - new { - description = "", - disabled = true, - dynamicReplacement = true, - entityTypes = new[] { - "" - }, - lastUpdatedTimestamp = 1234L, - name = "", - regex = new { - maxDigits = 1234, - maxLetters = 1234, - minDashes = 1234, - minDigits = 1234, - minDigitsOrLetters = 1234, - minDots = 1234, - minHex = 1234, - minLetters = 1234, - minUnderscores = 1234, - options = 1234, - regexStr = "", - }, - replaceWith = "", - version = 123.45d, - } - }, - regexReplacers = new[] { - new { - condition = "", - createdBy = "", - description = "", - disabled = true, - disableRecursiveReplacerApplication = true, - doNotReplaceRegex = new { - maxDigits = 1234, - maxLetters = 1234, - minDashes = 1234, - minDigits = 1234, - minDigitsOrLetters = 1234, - minDots = 1234, - minHex = 1234, - minLetters = 1234, - minUnderscores = 1234, - options = 1234, - regexStr = "", - }, - lastUpdatedTimestamp = 1234L, - modifiedBy = "", - name = "", - regex = new { - maxDigits = 1234, - maxLetters = 1234, - minDashes = 1234, - minDigits = 1234, - minDigitsOrLetters = 1234, - minDots = 1234, - minHex = 1234, - minLetters = 1234, - minUnderscores = 1234, - options = 1234, - regexStr = "", - }, - replaceWith = "", - } - }, - rejectedPatterns = new[] { - new { - createdBy = "", - filterType = "Pattern", - lastUpdatedTimestamp = 1234L, - modifiedBy = "", - name = "", - path = "", - } - }, - scopedRules = new[] { - new { - bindingUrl = "", - rules = new[] { - new { - displayName = "", - isResourceSet = true, - lastUpdatedTimestamp = 1234L, - name = "", - qualifiedName = "", - } - }, - storeType = "", - } - }, + normalizationRules = new List() +{ +new +{ +description = "", +disabled = true, +dynamicReplacement = true, +entityTypes = new List() +{ +"" +}, +lastUpdatedTimestamp = 1234L, +name = "", +regex = new +{ +maxDigits = 1234, +maxLetters = 1234, +minDashes = 1234, +minDigits = 1234, +minDigitsOrLetters = 1234, +minDots = 1234, +minHex = 1234, +minLetters = 1234, +minUnderscores = 1234, +options = 1234, +regexStr = "", +}, +replaceWith = "", +version = 123.45, +} +}, + regexReplacers = new List() +{ +new +{ +condition = "", +createdBy = "", +description = "", +disabled = true, +disableRecursiveReplacerApplication = true, +lastUpdatedTimestamp = 1234L, +modifiedBy = "", +name = "", +replaceWith = "", +} +}, + rejectedPatterns = new List() +{ +null +}, + scopedRules = new List() +{ +new +{ +bindingUrl = "", +rules = new List() +{ +new +{ +displayName = "", +isResourceSet = true, +lastUpdatedTimestamp = 1234L, +name = "", +qualifiedName = "", +} +}, +storeType = "", +} +}, version = 1234, }, - }; - - Response response = await client.CreateOrUpdateResourceSetRuleAsync(RequestContent.Create(data)); + }); + Response response = await client.CreateOrUpdateResourceSetRuleAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("advancedResourceSet").GetProperty("modifiedAt").ToString()); @@ -735,9 +695,9 @@ public async Task Example_CreateOrUpdateResourceSetRule_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_DeleteResourceSetRule() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountResourceSetRules client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); Response response = client.DeleteResourceSetRule(); Console.WriteLine(response.Status); @@ -747,9 +707,9 @@ public void Example_DeleteResourceSetRule() [Ignore("Only validating compilation of examples")] public void Example_DeleteResourceSetRule_AllParameters() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountResourceSetRules client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); Response response = client.DeleteResourceSetRule(); Console.WriteLine(response.Status); @@ -759,9 +719,9 @@ public void Example_DeleteResourceSetRule_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_DeleteResourceSetRule_Async() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountResourceSetRules client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); Response response = await client.DeleteResourceSetRuleAsync(); Console.WriteLine(response.Status); @@ -771,9 +731,9 @@ public async Task Example_DeleteResourceSetRule_Async() [Ignore("Only validating compilation of examples")] public async Task Example_DeleteResourceSetRule_AllParameters_Async() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountResourceSetRules client = new PurviewAccountsClient(endpoint, credential).GetResourceSetRulesClient(); Response response = await client.DeleteResourceSetRuleAsync(); Console.WriteLine(response.Status); diff --git a/samples/Azure.Analytics.Purview.Account/tests/Generated/Samples/Samples_PurviewAccountsClient.cs b/samples/Azure.Analytics.Purview.Account/tests/Generated/Samples/Samples_PurviewAccountsClient.cs index 496f6515eda..c9f83dd252e 100644 --- a/samples/Azure.Analytics.Purview.Account/tests/Generated/Samples/Samples_PurviewAccountsClient.cs +++ b/samples/Azure.Analytics.Purview.Account/tests/Generated/Samples/Samples_PurviewAccountsClient.cs @@ -6,11 +6,10 @@ #nullable disable using System; -using System.Collections.Generic; -using System.IO; using System.Text.Json; using System.Threading.Tasks; using Azure; +using Azure.Analytics.Purview.Account; using Azure.Core; using Azure.Identity; using NUnit.Framework; @@ -23,11 +22,11 @@ public class Samples_PurviewAccountsClient [Ignore("Only validating compilation of examples")] public void Example_GetAccountProperties() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); - Response response = client.GetAccountProperties(new RequestContext()); + Response response = client.GetAccountProperties(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -37,11 +36,11 @@ public void Example_GetAccountProperties() [Ignore("Only validating compilation of examples")] public void Example_GetAccountProperties_AllParameters() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); - Response response = client.GetAccountProperties(new RequestContext()); + Response response = client.GetAccountProperties(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -80,7 +79,7 @@ public void Example_GetAccountProperties_AllParameters() Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedAt").ToString()); Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedBy").ToString()); Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedByType").ToString()); - Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("type").ToString()); } @@ -88,11 +87,11 @@ public void Example_GetAccountProperties_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetAccountProperties_Async() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); - Response response = await client.GetAccountPropertiesAsync(new RequestContext()); + Response response = await client.GetAccountPropertiesAsync(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -102,11 +101,11 @@ public async Task Example_GetAccountProperties_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetAccountProperties_AllParameters_Async() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); - Response response = await client.GetAccountPropertiesAsync(new RequestContext()); + Response response = await client.GetAccountPropertiesAsync(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -145,7 +144,7 @@ public async Task Example_GetAccountProperties_AllParameters_Async() Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedAt").ToString()); Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedBy").ToString()); Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedByType").ToString()); - Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("type").ToString()); } @@ -153,13 +152,12 @@ public async Task Example_GetAccountProperties_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_UpdateAccountProperties() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); - var data = new { }; - - Response response = client.UpdateAccountProperties(RequestContent.Create(data)); + RequestContent content = RequestContent.Create(new object()); + Response response = client.UpdateAccountProperties(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -169,16 +167,15 @@ public void Example_UpdateAccountProperties() [Ignore("Only validating compilation of examples")] public void Example_UpdateAccountProperties_AllParameters() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); - var data = new + RequestContent content = RequestContent.Create(new { friendlyName = "", - }; - - Response response = client.UpdateAccountProperties(RequestContent.Create(data)); + }); + Response response = client.UpdateAccountProperties(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -217,7 +214,7 @@ public void Example_UpdateAccountProperties_AllParameters() Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedAt").ToString()); Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedBy").ToString()); Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedByType").ToString()); - Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("type").ToString()); } @@ -225,13 +222,12 @@ public void Example_UpdateAccountProperties_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_UpdateAccountProperties_Async() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); - var data = new { }; - - Response response = await client.UpdateAccountPropertiesAsync(RequestContent.Create(data)); + RequestContent content = RequestContent.Create(new object()); + Response response = await client.UpdateAccountPropertiesAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -241,16 +237,15 @@ public async Task Example_UpdateAccountProperties_Async() [Ignore("Only validating compilation of examples")] public async Task Example_UpdateAccountProperties_AllParameters_Async() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); - var data = new + RequestContent content = RequestContent.Create(new { friendlyName = "", - }; - - Response response = await client.UpdateAccountPropertiesAsync(RequestContent.Create(data)); + }); + Response response = await client.UpdateAccountPropertiesAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -289,7 +284,7 @@ public async Task Example_UpdateAccountProperties_AllParameters_Async() Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedAt").ToString()); Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedBy").ToString()); Console.WriteLine(result.GetProperty("systemData").GetProperty("lastModifiedByType").ToString()); - Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("type").ToString()); } @@ -297,11 +292,11 @@ public async Task Example_UpdateAccountProperties_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetAccessKeys() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); - Response response = client.GetAccessKeys(new RequestContext()); + Response response = client.GetAccessKeys(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -311,11 +306,11 @@ public void Example_GetAccessKeys() [Ignore("Only validating compilation of examples")] public void Example_GetAccessKeys_AllParameters() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); - Response response = client.GetAccessKeys(new RequestContext()); + Response response = client.GetAccessKeys(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("atlasKafkaPrimaryEndpoint").ToString()); @@ -326,11 +321,11 @@ public void Example_GetAccessKeys_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetAccessKeys_Async() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); - Response response = await client.GetAccessKeysAsync(new RequestContext()); + Response response = await client.GetAccessKeysAsync(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -340,11 +335,11 @@ public async Task Example_GetAccessKeys_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetAccessKeys_AllParameters_Async() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); - Response response = await client.GetAccessKeysAsync(new RequestContext()); + Response response = await client.GetAccessKeysAsync(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("atlasKafkaPrimaryEndpoint").ToString()); @@ -355,13 +350,12 @@ public async Task Example_GetAccessKeys_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_RegenerateAccessKey() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); - var data = new { }; - - Response response = client.RegenerateAccessKey(RequestContent.Create(data)); + RequestContent content = RequestContent.Create(new object()); + Response response = client.RegenerateAccessKey(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -371,16 +365,15 @@ public void Example_RegenerateAccessKey() [Ignore("Only validating compilation of examples")] public void Example_RegenerateAccessKey_AllParameters() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); - var data = new + RequestContent content = RequestContent.Create(new { keyType = "PrimaryAtlasKafkaKey", - }; - - Response response = client.RegenerateAccessKey(RequestContent.Create(data)); + }); + Response response = client.RegenerateAccessKey(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("atlasKafkaPrimaryEndpoint").ToString()); @@ -391,13 +384,12 @@ public void Example_RegenerateAccessKey_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_RegenerateAccessKey_Async() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); - var data = new { }; - - Response response = await client.RegenerateAccessKeyAsync(RequestContent.Create(data)); + RequestContent content = RequestContent.Create(new object()); + Response response = await client.RegenerateAccessKeyAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -407,16 +399,15 @@ public async Task Example_RegenerateAccessKey_Async() [Ignore("Only validating compilation of examples")] public async Task Example_RegenerateAccessKey_AllParameters_Async() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); - var data = new + RequestContent content = RequestContent.Create(new { keyType = "PrimaryAtlasKafkaKey", - }; - - Response response = await client.RegenerateAccessKeyAsync(RequestContent.Create(data)); + }); + Response response = await client.RegenerateAccessKeyAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("atlasKafkaPrimaryEndpoint").ToString()); @@ -427,14 +418,14 @@ public async Task Example_RegenerateAccessKey_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetResourceSetRules() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); - foreach (var item in client.GetResourceSetRules("", new RequestContext())) + foreach (BinaryData item in client.GetResourceSetRules(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -442,98 +433,98 @@ public void Example_GetResourceSetRules() [Ignore("Only validating compilation of examples")] public void Example_GetResourceSetRules_AllParameters() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); - foreach (var item in client.GetResourceSetRules("", new RequestContext())) + foreach (BinaryData item in client.GetResourceSetRules("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("advancedResourceSet").GetProperty("modifiedAt").ToString()); - Console.WriteLine(result.GetProperty("advancedResourceSet").GetProperty("resourceSetProcessing").ToString()); - Console.WriteLine(result.GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("createdBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("filterType").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("lastUpdatedTimestamp").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("modifiedBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("path").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("createdBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("disabled").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("disableRecursiveReplacerApplication").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("lastUpdatedTimestamp").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("modifiedBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("typeName").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("createdBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("enableDefaultPatterns").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("lastUpdatedTimestamp").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("modifiedBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("disabled").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("dynamicReplacement").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("entityTypes")[0].ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("lastUpdatedTimestamp").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("maxDigits").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("maxLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDashes").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDigits").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDigitsOrLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDots").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minHex").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minUnderscores").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("options").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("regexStr").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("replaceWith").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("version").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("condition").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("createdBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("disabled").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("disableRecursiveReplacerApplication").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("maxDigits").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("maxLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDashes").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDigits").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDigitsOrLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDots").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minHex").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minUnderscores").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("options").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("regexStr").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("lastUpdatedTimestamp").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("modifiedBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("maxDigits").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("maxLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDashes").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDigits").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDigitsOrLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDots").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minHex").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minUnderscores").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("options").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("regexStr").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("replaceWith").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("createdBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("filterType").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("lastUpdatedTimestamp").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("modifiedBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("path").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("bindingUrl").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("displayName").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("isResourceSet").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("lastUpdatedTimestamp").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("qualifiedName").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("storeType").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("version").ToString()); + Console.WriteLine(result[0].GetProperty("advancedResourceSet").GetProperty("modifiedAt").ToString()); + Console.WriteLine(result[0].GetProperty("advancedResourceSet").GetProperty("resourceSetProcessing").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("createdBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("filterType").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("lastUpdatedTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("modifiedBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("path").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("createdBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("disabled").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("disableRecursiveReplacerApplication").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("lastUpdatedTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("modifiedBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("typeName").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("createdBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("enableDefaultPatterns").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("lastUpdatedTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("modifiedBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("disabled").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("dynamicReplacement").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("entityTypes")[0].ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("lastUpdatedTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("maxDigits").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("maxLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDashes").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDigits").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDigitsOrLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDots").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minHex").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minUnderscores").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("options").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("regexStr").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("replaceWith").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("version").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("condition").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("createdBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("disabled").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("disableRecursiveReplacerApplication").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("maxDigits").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("maxLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDashes").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDigits").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDigitsOrLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDots").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minHex").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minUnderscores").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("options").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("regexStr").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("lastUpdatedTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("modifiedBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("maxDigits").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("maxLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDashes").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDigits").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDigitsOrLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDots").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minHex").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minUnderscores").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("options").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("regexStr").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("replaceWith").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("createdBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("filterType").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("lastUpdatedTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("modifiedBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("path").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("bindingUrl").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("displayName").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("isResourceSet").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("lastUpdatedTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("qualifiedName").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("storeType").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("version").ToString()); } } @@ -541,14 +532,14 @@ public void Example_GetResourceSetRules_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetResourceSetRules_Async() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); - await foreach (var item in client.GetResourceSetRulesAsync("", new RequestContext())) + await foreach (BinaryData item in client.GetResourceSetRulesAsync(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -556,98 +547,98 @@ public async Task Example_GetResourceSetRules_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetResourceSetRules_AllParameters_Async() { - var credential = new DefaultAzureCredential(); - var endpoint = new Uri(""); - var client = new PurviewAccountsClient(endpoint, credential); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + PurviewAccountsClient client = new PurviewAccountsClient(endpoint, credential); - await foreach (var item in client.GetResourceSetRulesAsync("", new RequestContext())) + await foreach (BinaryData item in client.GetResourceSetRulesAsync("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("advancedResourceSet").GetProperty("modifiedAt").ToString()); - Console.WriteLine(result.GetProperty("advancedResourceSet").GetProperty("resourceSetProcessing").ToString()); - Console.WriteLine(result.GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("createdBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("filterType").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("lastUpdatedTimestamp").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("modifiedBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("path").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("createdBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("disabled").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("disableRecursiveReplacerApplication").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("lastUpdatedTimestamp").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("modifiedBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("typeName").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("createdBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("enableDefaultPatterns").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("lastUpdatedTimestamp").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("modifiedBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("disabled").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("dynamicReplacement").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("entityTypes")[0].ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("lastUpdatedTimestamp").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("maxDigits").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("maxLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDashes").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDigits").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDigitsOrLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDots").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minHex").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minUnderscores").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("options").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("regexStr").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("replaceWith").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("version").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("condition").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("createdBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("disabled").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("disableRecursiveReplacerApplication").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("maxDigits").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("maxLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDashes").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDigits").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDigitsOrLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDots").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minHex").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minUnderscores").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("options").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("regexStr").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("lastUpdatedTimestamp").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("modifiedBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("maxDigits").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("maxLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDashes").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDigits").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDigitsOrLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDots").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minHex").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minLetters").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minUnderscores").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("options").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("regexStr").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("replaceWith").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("createdBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("filterType").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("lastUpdatedTimestamp").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("modifiedBy").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("path").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("bindingUrl").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("displayName").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("isResourceSet").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("lastUpdatedTimestamp").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("qualifiedName").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("storeType").ToString()); - Console.WriteLine(result.GetProperty("pathPatternConfig").GetProperty("version").ToString()); + Console.WriteLine(result[0].GetProperty("advancedResourceSet").GetProperty("modifiedAt").ToString()); + Console.WriteLine(result[0].GetProperty("advancedResourceSet").GetProperty("resourceSetProcessing").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("createdBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("filterType").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("lastUpdatedTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("modifiedBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("acceptedPatterns")[0].GetProperty("path").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("createdBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("disabled").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("disableRecursiveReplacerApplication").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("lastUpdatedTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("modifiedBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("complexReplacers")[0].GetProperty("typeName").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("createdBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("enableDefaultPatterns").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("lastUpdatedTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("modifiedBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("disabled").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("dynamicReplacement").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("entityTypes")[0].ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("lastUpdatedTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("maxDigits").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("maxLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDashes").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDigits").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDigitsOrLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minDots").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minHex").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("minUnderscores").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("options").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("regex").GetProperty("regexStr").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("replaceWith").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("normalizationRules")[0].GetProperty("version").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("condition").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("createdBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("disabled").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("disableRecursiveReplacerApplication").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("maxDigits").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("maxLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDashes").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDigits").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDigitsOrLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minDots").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minHex").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("minUnderscores").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("options").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("doNotReplaceRegex").GetProperty("regexStr").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("lastUpdatedTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("modifiedBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("maxDigits").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("maxLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDashes").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDigits").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDigitsOrLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minDots").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minHex").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minLetters").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("minUnderscores").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("options").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("regex").GetProperty("regexStr").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("regexReplacers")[0].GetProperty("replaceWith").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("createdBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("filterType").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("lastUpdatedTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("modifiedBy").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("rejectedPatterns")[0].GetProperty("path").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("bindingUrl").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("displayName").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("isResourceSet").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("lastUpdatedTimestamp").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("rules")[0].GetProperty("qualifiedName").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("scopedRules")[0].GetProperty("storeType").ToString()); + Console.WriteLine(result[0].GetProperty("pathPatternConfig").GetProperty("version").ToString()); } } } diff --git a/src/AutoRest.CSharp/Common/AutoRest/Plugins/GeneratedCodeWorkspace.cs b/src/AutoRest.CSharp/Common/AutoRest/Plugins/GeneratedCodeWorkspace.cs index 4f211153eac..6a2e1e390af 100644 --- a/src/AutoRest.CSharp/Common/AutoRest/Plugins/GeneratedCodeWorkspace.cs +++ b/src/AutoRest.CSharp/Common/AutoRest/Plugins/GeneratedCodeWorkspace.cs @@ -54,12 +54,12 @@ static GeneratedCodeWorkspace() private static Task? _cachedProject; private Project _project; - private Dictionary _docFiles { get; init; } + private Dictionary _xmlDocFiles { get; } private GeneratedCodeWorkspace(Project generatedCodeProject) { _project = generatedCodeProject; - _docFiles = new Dictionary(); + _xmlDocFiles = new(); } /// @@ -86,10 +86,10 @@ public void AddGeneratedFile(string name, string text) /// Add generated doc file. /// /// Name of the doc file, including the relative path to the "Generated" folder. - /// Content of the doc file. - public void AddGeneratedDocFile(string name, string text) + /// Content of the doc file. + public void AddGeneratedDocFile(string name, XmlDocumentFile xmlDocument) { - _docFiles.Add(name, text); + _xmlDocFiles.Add(name, xmlDocument); } public async IAsyncEnumerable<(string Name, string Text)> GetGeneratedFilesAsync() @@ -110,6 +110,9 @@ public void AddGeneratedDocFile(string name, string text) documents.Add(Task.Run(() => ProcessDocument(compilation, document, suppressedTypeNames))); } + var needProcessGeneratedDocs = _xmlDocFiles.Any(); + var generatedDocs = new Dictionary(); + foreach (var task in documents) { var processed = await task; @@ -118,11 +121,16 @@ public void AddGeneratedDocFile(string name, string text) processed = await Formatter.FormatAsync(processed); var text = await processed.GetSyntaxTreeAsync(); yield return (processed.Name, text!.ToString()); + if (needProcessGeneratedDocs) // TODO -- this is a workaround. In HLC, in some cases, there are multiple documents with the same name added in this list, and we get "dictionary same key has been added" exception + generatedDocs.Add(processed.Name, text); } - foreach (var doc in _docFiles) + foreach (var (docName, doc) in _xmlDocFiles) { - yield return (doc.Key, doc.Value); + var xmlWriter = doc.XmlDocWriter; + var testDocument = generatedDocs[doc.TestFileName]; + var content = await XmlFormatter.FormatAsync(xmlWriter, testDocument); + yield return (docName, content); } } diff --git a/src/AutoRest.CSharp/Common/AutoRest/Plugins/XmlDocumentFile.cs b/src/AutoRest.CSharp/Common/AutoRest/Plugins/XmlDocumentFile.cs new file mode 100644 index 00000000000..65fbd331e8b --- /dev/null +++ b/src/AutoRest.CSharp/Common/AutoRest/Plugins/XmlDocumentFile.cs @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +using AutoRest.CSharp.Generation.Writers; + +namespace AutoRest.CSharp.AutoRest.Plugins +{ + internal record XmlDocumentFile(string TestFileName, XmlDocWriter XmlDocWriter); +} diff --git a/src/AutoRest.CSharp/Common/AutoRest/Plugins/XmlFormatter.cs b/src/AutoRest.CSharp/Common/AutoRest/Plugins/XmlFormatter.cs new file mode 100644 index 00000000000..5bf8ffd4070 --- /dev/null +++ b/src/AutoRest.CSharp/Common/AutoRest/Plugins/XmlFormatter.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml; +using System.Xml.Linq; +using AutoRest.CSharp.Generation.Writers; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp.Syntax; + +namespace AutoRest.CSharp.AutoRest.Plugins +{ + internal class XmlFormatter + { + internal static async Task FormatAsync(XmlDocWriter writer, SyntaxTree syntaxTree) + { + var document = writer.Document; + var methods = await GetMethodsAsync(syntaxTree); + // first we need to get the members + var members = writer.Members; + + foreach (var member in members) + { + // get the example element + var exampleElement = member.Element("example"); + if (exampleElement == null) + continue; + + foreach (var codeElement in exampleElement.Elements("code")) + { + var testMethodName = codeElement.Value; + // find the magic comment and replace it with real code + if (methods.TryGetValue(testMethodName, out var methodDeclaration)) + { + var lines = GetLines(methodDeclaration.Body!); + var content = FormatContent(lines); + // this will give you + // <[[CDATA + // var our = code; + // ]]> + codeElement.ReplaceAll(new XCData(content)); + } + } + } + + var swriter = new XmlStringWriter(); + XmlWriterSettings settings = new XmlWriterSettings { OmitXmlDeclaration = false, Indent = true }; + using (XmlWriter xw = XmlWriter.Create(swriter, settings)) + { + document.Save(xw); + } + + return swriter.ToString(); + } + + private static string[] GetLines(BlockSyntax methodBlock) + { + if (!methodBlock.Statements.Any()) + return Array.Empty(); + + // here we have to get the string of all statements and then split by new lines + // this is because in the StatementSyntax, the NewLines (\n or \r\n) could appear at the end of the statement or at the beginning of the statement + // therefore to keep it simple, we just combine all the text together and then split by the new lines to trim the extra spaces in front of every line + var builder = new StringBuilder(); + foreach (var statement in methodBlock.Statements) + { + builder.Append(statement.ToFullString()); + } + + return builder.ToString().Split(Environment.NewLine); + } + + /// + /// This method trims the leading spaces of the lines, and it also adds proper amount of spaces to the content of spaces because of the bug of Roslyn: https://github.com/dotnet/roslyn/issues/8269 + /// + /// + /// + internal static string FormatContent(string[] lines) + { + if (!lines.Any()) + return string.Empty; + + var builder = new StringBuilder(); + + // find the first non-empty line + int lineNumber = -1; + for (int i = 0; i < lines.Length; i++) + { + var line = lines[i]; + if (!string.IsNullOrWhiteSpace(line)) + { + lineNumber = i; + break; + } + if (i > 0) + builder.AppendLine(); // we do not need a new line when it is the first line + builder.Append(line); + } + + if (lineNumber < 0) + return string.Empty; // every line is whitespaces + + // the following code is a temporarily workaround the Roslyn's format issue around collection initializers: https://github.com/dotnet/roslyn/issues/8269 + // if Roslyn could properly format the collection initializers and everything, this code should be as simple as: take a amount of spaces on the first line, trim spaces with the same amount on every line + // since the code we are processing here has been formatted by Roslyn, we only take the cases that lines starts or ends with { or } to format. + var stack = new Stack(); + stack.Push(0); + const int spaceIncrement = 4; + + for (int i = lineNumber; i < lines.Length; i++) + { + var line = lines[i].AsSpan(); + // first we count how many leading spaces we are having on this line + int count = 0; + while (count < line.Length && char.IsWhiteSpace(line[count])) + { + count++; + } + var spaceCount = count; + // if the rest part of the line leads by a }, we should decrease the amount of leading spaces + if (count < line.Length && line[count] == '}') + { + stack.Pop(); + } + // find out how many spaces we would like to prepend + var leadingSpaces = stack.Peek(); + // if the rest part of the line leads by a {, we increment the leading space + if (count < line.Length && line[count] == '{') + { + stack.Push(stack.Peek() + spaceIncrement); + } + builder.AppendLine(); + while (leadingSpaces > 0) + { + builder.Append(' '); + leadingSpaces--; + } + builder.Append(line.Slice(spaceCount)); + } + + return builder.ToString(); + } + + private static async Task> GetMethodsAsync(SyntaxTree syntaxTree) + { + var result = new Dictionary(); + var root = await syntaxTree.GetRootAsync(); + + foreach (var method in root.DescendantNodes().OfType()) + { + result.Add(method.Identifier.Text, method); + } + + return result; + } + + private class XmlStringWriter : StringWriter + { + public override Encoding Encoding => Encoding.UTF8; + } + } +} diff --git a/src/AutoRest.CSharp/Common/Generation/Types/CSharpType.cs b/src/AutoRest.CSharp/Common/Generation/Types/CSharpType.cs index 0dfbcd1e0f3..8d4a1515cea 100644 --- a/src/AutoRest.CSharp/Common/Generation/Types/CSharpType.cs +++ b/src/AutoRest.CSharp/Common/Generation/Types/CSharpType.cs @@ -190,7 +190,7 @@ private string ConvertParamName(bool useSquiggles) var name = IsFrameworkType ? CodeWriter.GetTypeNameMapping(FrameworkType) ?? Name : Name; if (IsNullable && IsValueType) name += "?"; - if (Arguments is not null && Arguments.Count() > 0) + if (Arguments is not null && Arguments.Length > 0) { name += useSquiggles ? "{" : "<"; name += string.Join(",", Arguments.Select(a => a.ConvertParamNameForDocs())); diff --git a/src/AutoRest.CSharp/Common/Generation/Types/TypeFactory.cs b/src/AutoRest.CSharp/Common/Generation/Types/TypeFactory.cs index c007627bb53..117b64f7d57 100644 --- a/src/AutoRest.CSharp/Common/Generation/Types/TypeFactory.cs +++ b/src/AutoRest.CSharp/Common/Generation/Types/TypeFactory.cs @@ -226,6 +226,8 @@ internal static bool IsIEnumerableType(CSharpType type) internal static bool IsIEnumerableOfT(CSharpType type) => type.IsFrameworkType && type.FrameworkType == typeof(IEnumerable<>); + internal static bool IsOperationOfT(CSharpType type) => type.IsFrameworkType && type.FrameworkType == typeof(Operation<>); + internal static bool IsIAsyncEnumerableOfT(CSharpType type) => type.IsFrameworkType && type.FrameworkType == typeof(IAsyncEnumerable<>); internal static bool IsAsyncPageable(CSharpType type) => type.IsFrameworkType && type.FrameworkType == typeof(AsyncPageable<>); diff --git a/src/AutoRest.CSharp/Common/Generation/Writers/CodeWriter.cs b/src/AutoRest.CSharp/Common/Generation/Writers/CodeWriter.cs index 6022ebeacf1..260408f6065 100644 --- a/src/AutoRest.CSharp/Common/Generation/Writers/CodeWriter.cs +++ b/src/AutoRest.CSharp/Common/Generation/Writers/CodeWriter.cs @@ -389,6 +389,7 @@ public CodeWriter Literal(object? o) double d => SyntaxFactory.Literal(d).ToString(), float f => SyntaxFactory.Literal(f).ToString(), bool b => b ? "true" : "false", + char c => SyntaxFactory.Literal(c).ToString(), BinaryData bd => bd.ToArray().Length == 0 ? "new byte[] { }" : SyntaxFactory.Literal(bd.ToString()).ToString(), _ => throw new NotImplementedException() }); diff --git a/src/AutoRest.CSharp/Common/Generation/Writers/XmlDocWriter.cs b/src/AutoRest.CSharp/Common/Generation/Writers/XmlDocWriter.cs index 25a794cc062..23961049919 100644 --- a/src/AutoRest.CSharp/Common/Generation/Writers/XmlDocWriter.cs +++ b/src/AutoRest.CSharp/Common/Generation/Writers/XmlDocWriter.cs @@ -3,8 +3,11 @@ using System; using System.Collections.Generic; -using System.Diagnostics; +using System.IO; +using System.Linq; using System.Text; +using System.Xml; +using System.Xml.Linq; namespace AutoRest.CSharp.Generation.Writers { @@ -13,108 +16,67 @@ namespace AutoRest.CSharp.Generation.Writers /// throught "// <include>" tag. /// For details, see: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/documentation-comments#d36-include /// - internal class XmlDocWriter : IFormatProvider, ICustomFormatter + internal class XmlDocWriter { - private IList Members = new List(); + private readonly XElement _membersElement; - private StringBuilder? CurrentWriter; - - /// - /// Write content of XML documentation. - /// - /// Tag name - /// Text context inside the given tag. - /// throws if this method is inovoked before is invoked. - public void WriteXmlDocumentation(string tag, FormattableString? text) + public XmlDocWriter() { - if (CurrentWriter == null) - { - throw new InvalidOperationException("Invoke 'CreateMember' first."); - } + _membersElement = new XElement("members"); + Document = new XDocument( + new XElement("doc", _membersElement) + ); + } - // skip empty content - if (text == null || string.IsNullOrEmpty(text.ToString())) - { - return; - } + public IEnumerable Members => _membersElement.Elements("member"); - // we don't add the indentation of XML doucment contents, because that will be carried over to the final doc - CurrentWriter.Append($"<{tag}>\n"); - CurrentWriter.Append(text.ToString(this)); - CurrentWriter.Append($"\n\n"); - } + public XDocument Document { get; } + private XElement? _lastMember = null; - public object? GetFormat(Type? formatType) + public XmlDocWriter AddMember(string docRef) { - if (formatType == typeof(ICustomFormatter)) - { - return this; - } - return null; + _lastMember = new XElement("member", new XAttribute("name", docRef)); + _membersElement.Add(_lastMember); + + return this; } - // a much simpler implementatoin of CodeWriter.Append(FormattableString) - // we only translate the necessary arguments in the formattable string - public string Format(string? format, object? arg, IFormatProvider? formatProvider) + public XmlDocWriter AddExamples(IEnumerable<(string ExampleInformation, string TestMethodName)> examples) { - switch (arg) + if (_lastMember != null && examples.Any()) { - case FormattableString fs: - return fs.ToString(formatProvider); - case IEnumerable fss: - var builder = new StringBuilder(); - foreach (var fs in fss) - { - builder.Append(fs.ToString(formatProvider)); - } - return builder.ToString(); - default: - string? s = arg?.ToString(); - if (s == null) - { - throw new ArgumentNullException(format); - } - return s; + var exampleElement = new XElement("example"); + foreach (var example in examples) + { + exampleElement.Add( + Environment.NewLine, + example.ExampleInformation, + Environment.NewLine, + new XElement("code", example.TestMethodName)); + } + + _lastMember.Add(exampleElement); } + + return this; } public override string ToString() { - // generated XML document follows the "/doc/members/member[@name={method_signature}]" structure - // here we add indentation of high level tags, just for readability - var builder = new StringBuilder("\n\n \n"); - - foreach (var member in Members) + var writer = new XmlStringWriter(); + XmlWriterSettings settings = new XmlWriterSettings { OmitXmlDeclaration = false, Indent = true }; + using (XmlWriter xw = XmlWriter.Create(writer, settings)) { - builder.Append(member); + Document.Save(xw); } - builder.Append(" \n"); - return builder.ToString(); + return writer.ToString(); } - internal IDisposable CreateMember(string name) + private class XmlStringWriter : StringWriter { - return new Member(name, this); - } - - // A element - private class Member : IDisposable - { - private readonly XmlDocWriter writer; - - internal Member(string name, XmlDocWriter writer) - { - this.writer = writer; - writer.CurrentWriter = new StringBuilder($" \n"); - } - - public void Dispose() - { - writer.CurrentWriter!.Append(" \n"); - writer.Members.Add(writer.CurrentWriter!.ToString()); - } + public override Encoding Encoding => Encoding.UTF8; } } } diff --git a/src/AutoRest.CSharp/Common/Input/InputTypes/Examples/ExampleMockValueBuilder.cs b/src/AutoRest.CSharp/Common/Input/InputTypes/Examples/ExampleMockValueBuilder.cs new file mode 100644 index 00000000000..e53a6ee91b2 --- /dev/null +++ b/src/AutoRest.CSharp/Common/Input/InputTypes/Examples/ExampleMockValueBuilder.cs @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AutoRest.CSharp.Common.Input.Examples +{ + internal class ExampleMockValueBuilder + { + public const string ShortVersionMockExampleKey = "ShortVersion"; + public const string MockExampleAllParameterKey = "AllParameters"; + + private const string EndpointMockValue = ""; + + private readonly static ConcurrentDictionary _cache = new(); + + public static InputClientExample BuildClientExample(InputClient client, bool useAllParameters) + { + _cache.Clear(); + var clientParameterExamples = new List(); + foreach (var parameter in client.Parameters) + { + if (!useAllParameters && !parameter.IsRequired) + { + continue; + } + var parameterExample = BuildParameterExample(parameter, useAllParameters); + clientParameterExamples.Add(parameterExample); + } + + return new(client, clientParameterExamples); + } + + public static InputOperationExample BuildOperationExample(InputOperation operation, bool useAllParameters) + { + _cache.Clear(); + + var parameterExamples = new List(); + foreach (var parameter in operation.Parameters) + { + if (!useAllParameters && !parameter.IsRequired) + { + continue; + } + var parameterExample = BuildParameterExample(parameter, useAllParameters); + parameterExamples.Add(parameterExample); + } + + return new(operation, parameterExamples); + } + + private static InputParameterExample BuildParameterExample(InputParameter parameter, bool useAllParameters) + { + // if the parameter is constant, we just put the constant into the example value instead of mocking a new one + if (parameter.Kind == InputOperationParameterKind.Constant) + { + InputExampleValue value; + if (parameter.DefaultValue != null) + { + // when it is constant, it could have DefaultValue + value = InputExampleValue.Value(parameter.Type, parameter.DefaultValue.Value); + } + else if (parameter.Type is InputUnionType unionType && unionType.UnionItemTypes.First() is InputLiteralType literalType) + { + // or it could be a union of literal types + value = InputExampleValue.Value(parameter.Type, literalType.Value); + } + else + { + // fallback to null + value = InputExampleValue.Null(parameter.Type); + } + return new(parameter, value); + } + + // if the parameter is endpoint + if (parameter.IsEndpoint) + { + var value = InputExampleValue.Value(parameter.Type, EndpointMockValue); + return new(parameter, value); + } + + if (parameter.DefaultValue != null) + { + var value = InputExampleValue.Value(parameter.Type, parameter.DefaultValue.Value); + return new(parameter, value); + } + + var exampleValue = BuildExampleValue(parameter.Type, parameter.Name, useAllParameters, new HashSet()); + return new(parameter, exampleValue); + } + + private static InputExampleValue BuildExampleValue(InputType type, string? hint, bool useAllParameters, HashSet visitedModels) => type switch + { + InputListType listType => BuildListExampleValue(listType, hint, useAllParameters, visitedModels), + InputDictionaryType dictionaryType => BuildDictionaryExampleValue(dictionaryType, hint, useAllParameters, visitedModels), + InputEnumType enumType => BuildEnumExampleValue(enumType), + InputPrimitiveType primitiveType => BuildPrimitiveExampleValue(primitiveType, hint), + InputLiteralType literalType => InputExampleValue.Value(literalType, literalType.Value), + InputModelType modelType => BuildModelExampleValue(modelType, useAllParameters, visitedModels), + InputUnionType unionType => BuildExampleValue(unionType.UnionItemTypes.First(), hint, useAllParameters, visitedModels), + _ => InputExampleValue.Object(type, new Dictionary()) + }; + + private static InputExampleValue BuildListExampleValue(InputListType listType, string? hint, bool useAllParameters, HashSet visitedModels) + { + var exampleElementValue = BuildExampleValue(listType.ElementType, hint, useAllParameters, visitedModels); + + return InputExampleValue.List(listType, new[] { exampleElementValue }); + } + + private static InputExampleValue BuildDictionaryExampleValue(InputDictionaryType dictionaryType, string? hint, bool useAllParameters, HashSet visitedModels) + { + var exampleValue = BuildExampleValue(dictionaryType.ValueType, hint, useAllParameters, visitedModels); + + return InputExampleValue.Object(dictionaryType, new Dictionary + { + ["key"] = exampleValue + }); + } + + private static InputExampleValue BuildEnumExampleValue(InputEnumType enumType) + { + var enumValue = enumType.AllowedValues.First(); + return InputExampleValue.Value(enumType, enumValue.Value); + } + + private static InputExampleValue BuildPrimitiveExampleValue(InputPrimitiveType primitiveType, string? hint) => primitiveType.Kind switch + { + InputTypeKind.Stream => InputExampleValue.Stream(primitiveType, ""), + InputTypeKind.Boolean => InputExampleValue.Value(primitiveType, true), + InputTypeKind.Date => InputExampleValue.Value(primitiveType, "2022-05-10"), + InputTypeKind.DateTime => InputExampleValue.Value(primitiveType, "2022-05-10T14:57:31.2311892-04:00"), + InputTypeKind.DateTimeISO8601 => InputExampleValue.Value(primitiveType, "2022-05-10T18:57:31.2311892Z"), + InputTypeKind.DateTimeRFC1123 => InputExampleValue.Value(primitiveType, "Tue, 10 May 2022 18:57:31 GMT"), + InputTypeKind.DateTimeRFC3339 => InputExampleValue.Value(primitiveType, "2022-05-10T18:57:31.2311892Z"), + InputTypeKind.DateTimeRFC7231 => InputExampleValue.Value(primitiveType, "Tue, 10 May 2022 18:57:31 GMT"), + InputTypeKind.DateTimeUnix => InputExampleValue.Value(primitiveType, 1652209051), + InputTypeKind.Float32 => InputExampleValue.Value(primitiveType, 123.45f), + InputTypeKind.Float64 => InputExampleValue.Value(primitiveType, 123.45d), + InputTypeKind.Float128 => InputExampleValue.Value(primitiveType, 123.45m), + InputTypeKind.Guid => InputExampleValue.Value(primitiveType, "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), + InputTypeKind.Int32 => InputExampleValue.Value(primitiveType, 1234), + InputTypeKind.Int64 => InputExampleValue.Value(primitiveType, 1234L), + InputTypeKind.String => string.IsNullOrWhiteSpace(hint) ? InputExampleValue.Value(primitiveType, "") : InputExampleValue.Value(primitiveType, $"<{hint}>"), + InputTypeKind.DurationISO8601 => InputExampleValue.Value(primitiveType, "PT1H23M45S"), + InputTypeKind.DurationConstant => InputExampleValue.Value(primitiveType, "01:23:45"), + InputTypeKind.Time => InputExampleValue.Value(primitiveType, "01:23:45"), + InputTypeKind.Uri => InputExampleValue.Value(primitiveType, "http://localhost:3000"), + InputTypeKind.DurationSeconds => InputExampleValue.Value(primitiveType, 10), + InputTypeKind.DurationSecondsFloat => InputExampleValue.Value(primitiveType, 10f), + _ => InputExampleValue.Object(primitiveType, new Dictionary()) + }; + + private static InputExampleValue BuildModelExampleValue(InputModelType model, bool useAllParameters, HashSet visitedModels) + { + if (visitedModels.Contains(model)) + return InputExampleValue.Null(model); + + var dict = new Dictionary(); + var result = InputExampleValue.Object(model, dict); + visitedModels.Add(model); + // if this model has a discriminator, we should return a derived type + if (model.DiscriminatorPropertyName != null) + { + model = model.DerivedModels.First(); + } + // then, we just iterate all the properties + foreach (var modelOrBase in model.GetSelfAndBaseModels()) + { + foreach (var property in modelOrBase.Properties) + { + if (property.IsReadOnly) + continue; + + if (!useAllParameters && !property.IsRequired) + continue; + + InputExampleValue exampleValue; + if (property.IsDiscriminator) + { + exampleValue = InputExampleValue.Value(property.Type, model.DiscriminatorValue!); + } + else + { + exampleValue = BuildExampleValue(property.Type, property.SerializedName, useAllParameters, visitedModels); + } + + dict.Add(property.SerializedName, exampleValue); + } + } + + return result; + } + } +} diff --git a/src/AutoRest.CSharp/Common/Input/InputTypes/Examples/InputClientExample.cs b/src/AutoRest.CSharp/Common/Input/InputTypes/Examples/InputClientExample.cs new file mode 100644 index 00000000000..d0e35dde160 --- /dev/null +++ b/src/AutoRest.CSharp/Common/Input/InputTypes/Examples/InputClientExample.cs @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +using System.Collections.Generic; + +namespace AutoRest.CSharp.Common.Input.Examples +{ + internal record InputClientExample(InputClient Client, IReadOnlyList ClientParameters); +} diff --git a/src/AutoRest.CSharp/Common/Input/InputTypes/Examples/InputExampleValue.cs b/src/AutoRest.CSharp/Common/Input/InputTypes/Examples/InputExampleValue.cs new file mode 100644 index 00000000000..639aea28e66 --- /dev/null +++ b/src/AutoRest.CSharp/Common/Input/InputTypes/Examples/InputExampleValue.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +using System.Collections.Generic; + +namespace AutoRest.CSharp.Common.Input.Examples +{ + internal abstract record InputExampleValue(InputType Type) + { + public static InputExampleValue Null(InputType type) => new InputExampleRawValue(type, null); + public static InputExampleValue Value(InputType type, object? rawValue) => new InputExampleRawValue(type, rawValue); + public static InputExampleValue List(InputType type, IReadOnlyList values) => new InputExampleListValue(type, values); + public static InputExampleValue Object(InputType type, IReadOnlyDictionary properties) => new InputExampleObjectValue(type, properties); + public static InputExampleValue Stream(InputType type, string filename) => new InputExampleStreamValue(type, filename); + } + + internal record InputExampleRawValue(InputType Type, object? RawValue) : InputExampleValue(Type); + + internal record InputExampleListValue(InputType Type, IReadOnlyList Values) : InputExampleValue(Type); + + internal record InputExampleObjectValue(InputType Type, IReadOnlyDictionary Values): InputExampleValue(Type); + + internal record InputExampleStreamValue(InputType Type, string Filename): InputExampleValue(Type); +} diff --git a/src/AutoRest.CSharp/Common/Input/InputTypes/Examples/InputOperationExample.cs b/src/AutoRest.CSharp/Common/Input/InputTypes/Examples/InputOperationExample.cs new file mode 100644 index 00000000000..1cdc0675b9a --- /dev/null +++ b/src/AutoRest.CSharp/Common/Input/InputTypes/Examples/InputOperationExample.cs @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +using System.Collections.Generic; + +namespace AutoRest.CSharp.Common.Input.Examples +{ + // TODO -- currently we do not need the responses. In the case that in the future we need to handle the responses in examples, we need to add a new class InputExampleResponse and a new property here + internal record InputOperationExample(InputOperation Operation, IReadOnlyList Parameters); +} diff --git a/src/AutoRest.CSharp/Common/Input/InputTypes/Examples/InputParameterExample.cs b/src/AutoRest.CSharp/Common/Input/InputTypes/Examples/InputParameterExample.cs new file mode 100644 index 00000000000..af1e76c4ccd --- /dev/null +++ b/src/AutoRest.CSharp/Common/Input/InputTypes/Examples/InputParameterExample.cs @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +using System.Collections.Generic; + +namespace AutoRest.CSharp.Common.Input.Examples +{ + internal record InputParameterExample(InputParameter Parameter, InputExampleValue ExampleValue); +} diff --git a/src/AutoRest.CSharp/Common/Input/InputTypes/InputClient.cs b/src/AutoRest.CSharp/Common/Input/InputTypes/InputClient.cs index a2dd27ff9c6..6ea21446a76 100644 --- a/src/AutoRest.CSharp/Common/Input/InputTypes/InputClient.cs +++ b/src/AutoRest.CSharp/Common/Input/InputTypes/InputClient.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using AutoRest.CSharp.Common.Input.Examples; namespace AutoRest.CSharp.Common.Input; @@ -17,4 +18,16 @@ public string Key } public InputClient() : this(string.Empty, string.Empty, Array.Empty(), true, Array.Empty(), null) { } + + private IReadOnlyDictionary? _examples; + public IReadOnlyDictionary Examples => _examples ??= EnsureExamples(); + + private IReadOnlyDictionary EnsureExamples() + { + return new Dictionary() + { + [ExampleMockValueBuilder.ShortVersionMockExampleKey] = ExampleMockValueBuilder.BuildClientExample(this, false), + [ExampleMockValueBuilder.MockExampleAllParameterKey] = ExampleMockValueBuilder.BuildClientExample(this, true) + }; + } } diff --git a/src/AutoRest.CSharp/Common/Input/InputTypes/InputModelProperty.cs b/src/AutoRest.CSharp/Common/Input/InputTypes/InputModelProperty.cs index e47963de29e..bd218d4b57a 100644 --- a/src/AutoRest.CSharp/Common/Input/InputTypes/InputModelProperty.cs +++ b/src/AutoRest.CSharp/Common/Input/InputTypes/InputModelProperty.cs @@ -6,7 +6,7 @@ namespace AutoRest.CSharp.Common.Input; -internal record InputModelProperty(string Name, string? SerializedName, string Description, InputType Type, bool IsRequired, bool IsReadOnly, bool IsDiscriminator) +internal record InputModelProperty(string Name, string SerializedName, string Description, InputType Type, bool IsRequired, bool IsReadOnly, bool IsDiscriminator) { public FormattableString? DefaultValue { get; init; } } diff --git a/src/AutoRest.CSharp/Common/Input/InputTypes/InputOperation.cs b/src/AutoRest.CSharp/Common/Input/InputTypes/InputOperation.cs index 96fe29b2a66..1e1c71a5fd3 100644 --- a/src/AutoRest.CSharp/Common/Input/InputTypes/InputOperation.cs +++ b/src/AutoRest.CSharp/Common/Input/InputTypes/InputOperation.cs @@ -4,9 +4,9 @@ using System; using System.Collections.Generic; using System.Linq; +using AutoRest.CSharp.Common.Input.Examples; using AutoRest.CSharp.Input; using AutoRest.CSharp.Utilities; -using Azure; using Azure.Core; namespace AutoRest.CSharp.Common.Input; @@ -69,4 +69,16 @@ public string CleanName } public bool KeepClientDefaultValue { get; set; } = Configuration.MethodsToKeepClientDefaultValue.Contains(Name); + + private IReadOnlyDictionary? _examples; + public IReadOnlyDictionary Examples => _examples ??= EnsureExamples(); + + private IReadOnlyDictionary EnsureExamples() + { + return new Dictionary() + { + [ExampleMockValueBuilder.ShortVersionMockExampleKey] = ExampleMockValueBuilder.BuildOperationExample(this, false), + [ExampleMockValueBuilder.MockExampleAllParameterKey] = ExampleMockValueBuilder.BuildOperationExample(this, true) + }; + } } diff --git a/src/AutoRest.CSharp/Common/Output/Models/Shared/Parameter.cs b/src/AutoRest.CSharp/Common/Output/Models/Shared/Parameter.cs index f10b13e54de..28a74f43460 100644 --- a/src/AutoRest.CSharp/Common/Output/Models/Shared/Parameter.cs +++ b/src/AutoRest.CSharp/Common/Output/Models/Shared/Parameter.cs @@ -5,18 +5,18 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; -using System.Runtime.CompilerServices; using AutoRest.CSharp.Common.Input; using AutoRest.CSharp.Generation.Types; using AutoRest.CSharp.Generation.Writers; using AutoRest.CSharp.Input; using AutoRest.CSharp.Output.Builders; using AutoRest.CSharp.Output.Models.Requests; +using AutoRest.CSharp.Output.Models.Serialization; using AutoRest.CSharp.Utilities; namespace AutoRest.CSharp.Output.Models.Shared { - internal record Parameter(string Name, string? Description, CSharpType Type, Constant? DefaultValue, ValidationType Validation, FormattableString? Initializer, bool IsApiVersionParameter = false, bool IsResourceIdentifier = false, bool SkipUrlEncoding = false, RequestLocation RequestLocation = RequestLocation.None, bool IsPropertyBag = false) + internal record Parameter(string Name, string? Description, CSharpType Type, Constant? DefaultValue, ValidationType Validation, FormattableString? Initializer, bool IsApiVersionParameter = false, bool IsResourceIdentifier = false, bool SkipUrlEncoding = false, RequestLocation RequestLocation = RequestLocation.None, SerializationFormat SerializationFormat = SerializationFormat.Default, bool IsPropertyBag = false) { public FormattableString? FormattableDescription => Description is null ? (FormattableString?)null : $"{Description}"; public CSharpAttribute[] Attributes { get; init; } = Array.Empty(); @@ -77,7 +77,8 @@ public static Parameter FromInputParameter(in InputParameter operationParameter, IsApiVersionParameter: operationParameter.IsApiVersion, IsResourceIdentifier: operationParameter.IsResourceParameter, SkipUrlEncoding: skipUrlEncoding, - RequestLocation: requestLocation); + RequestLocation: requestLocation, + SerializationFormat: operationParameter.SerializationFormat); } private static Constant? GetDefaultValue(InputParameter operationParameter, TypeFactory typeFactory) => operationParameter switch diff --git a/src/AutoRest.CSharp/Common/Output/Models/Types/ModelTypeProviderFields.cs b/src/AutoRest.CSharp/Common/Output/Models/Types/ModelTypeProviderFields.cs index a2c610ded55..e8751168c0c 100644 --- a/src/AutoRest.CSharp/Common/Output/Models/Types/ModelTypeProviderFields.cs +++ b/src/AutoRest.CSharp/Common/Output/Models/Types/ModelTypeProviderFields.cs @@ -89,7 +89,7 @@ public ModelTypeProviderFields(InputModelType inputModel, TypeFactory typeFactor continue; } var isReadOnly = IsReadOnly(serializationMapping.ExistingMember); - var inputModelProperty = new InputModelProperty(serializationMapping.ExistingMember.Name, serializationMapping.SerializationPath?.Last(), "to be removed by post process", InputPrimitiveType.Object, false, isReadOnly, false); + var inputModelProperty = new InputModelProperty(serializationMapping.ExistingMember.Name, serializationMapping.SerializationPath?.Last() ?? serializationMapping.ExistingMember.Name, "to be removed by post process", InputPrimitiveType.Object, false, isReadOnly, false); // we put the original type typeof(object) here as fallback. We do not really care about what type we get here, just to ensure there is a type generated // therefore the top type here is reasonable // the serialization will be generated for this type and it might has issues if the type is not recognized properly. diff --git a/src/AutoRest.CSharp/DataPlane/Output/DataPlaneRestClient.cs b/src/AutoRest.CSharp/DataPlane/Output/DataPlaneRestClient.cs index a6d1fda0426..e297d34be6a 100644 --- a/src/AutoRest.CSharp/DataPlane/Output/DataPlaneRestClient.cs +++ b/src/AutoRest.CSharp/DataPlane/Output/DataPlaneRestClient.cs @@ -65,7 +65,7 @@ private IEnumerable GetProtocolMethods(InputClient inputCl .Select(m => m.Operation) .Where(operation => IsProtocolMethodExists(operation, inputClient, context)); - return LowLevelClient.BuildMethods(_context.TypeFactory, operations, Fields, GetNamespaceName(inputClient, context), GetClientName(inputClient, context), null); + return LowLevelClient.BuildMethods(null, _context.TypeFactory, operations, Fields, GetNamespaceName(inputClient, context), GetClientName(inputClient, context), null); } private static string GetNamespaceName(InputClient inputClient, BuildContext context) diff --git a/src/AutoRest.CSharp/LowLevel/AutoRest/LowLevelTarget.cs b/src/AutoRest.CSharp/LowLevel/AutoRest/LowLevelTarget.cs index b9cdb33f0fa..4af3052e3c4 100644 --- a/src/AutoRest.CSharp/LowLevel/AutoRest/LowLevelTarget.cs +++ b/src/AutoRest.CSharp/LowLevel/AutoRest/LowLevelTarget.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. using System.Threading.Tasks; +using System.Xml.Linq; using AutoRest.CSharp.Common.Generation.Writers; using AutoRest.CSharp.Common.Input; using AutoRest.CSharp.Common.Output.PostProcessing; @@ -40,11 +41,13 @@ public static async Task ExecuteAsync(GeneratedCodeWorkspace project, InputNames var lowLevelClientWriter = new LowLevelClientWriter(codeWriter, xmlDocWriter, client); lowLevelClientWriter.WriteClient(); project.AddGeneratedFile($"{client.Type.Name}.cs", codeWriter.ToString()); - project.AddGeneratedDocFile($"Docs/{client.Type.Name}.xml", xmlDocWriter.ToString()); var exampleCompileCheckWriter = new ExampleCompileCheckWriter(client); exampleCompileCheckWriter.Write(); - project.AddGeneratedFile($"../../tests/Generated/Samples/Samples_{client.Type.Name}.cs", exampleCompileCheckWriter.ToString()); + var exampleFileCheckFilename = $"../../tests/Generated/Samples/Samples_{client.Type.Name}.cs"; + project.AddGeneratedFile(exampleFileCheckFilename, exampleCompileCheckWriter.ToString()); + + project.AddGeneratedDocFile($"Docs/{client.Type.Name}.xml", new XmlDocumentFile(exampleFileCheckFilename, xmlDocWriter)); } var optionsWriter = new CodeWriter(); diff --git a/src/AutoRest.CSharp/LowLevel/Extensions/CodeWriterExampleExtensions.cs b/src/AutoRest.CSharp/LowLevel/Extensions/CodeWriterExampleExtensions.cs new file mode 100644 index 00000000000..0fd032a2ed8 --- /dev/null +++ b/src/AutoRest.CSharp/LowLevel/Extensions/CodeWriterExampleExtensions.cs @@ -0,0 +1,522 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Text; +using System.Xml; +using AutoRest.CSharp.Common.Input; +using AutoRest.CSharp.Common.Input.Examples; +using AutoRest.CSharp.Generation.Types; +using AutoRest.CSharp.Generation.Writers; +using AutoRest.CSharp.Output.Models.Serialization; +using AutoRest.CSharp.Output.Models.Shared; +using AutoRest.CSharp.Output.Models.Types; +using AutoRest.CSharp.Output.Samples.Models; +using AutoRest.CSharp.Utilities; +using Azure; +using Azure.Core; +using Microsoft.CodeAnalysis.CSharp; + +namespace AutoRest.CSharp.LowLevel.Generation.Extensions +{ + internal static class CodeWriterExampleExtensions + { + public static CodeWriter AppendInputExampleValue(this CodeWriter writer, InputExampleValue exampleValue, CSharpType type, SerializationFormat serializationFormat, bool includeCollectionInitialization = true) + { + // handle list + if (TypeFactory.IsList(type)) + return writer.AppendListValue(type, exampleValue, serializationFormat, includeCollectionInitialization); + // handle dictionary + if (TypeFactory.IsDictionary(type)) + return writer.AppendDictionaryValue(type, exampleValue, serializationFormat, includeCollectionInitialization: includeCollectionInitialization); + + Type? frameworkType = type.SerializeAs != null ? type.SerializeAs : type.IsFrameworkType ? type.FrameworkType : null; + if (frameworkType != null) + { + // handle framework type + return writer.AppendFrameworkTypeValue(exampleValue, frameworkType, serializationFormat, includeCollectionInitialization); + } + + // handle implementation + return writer.AppendTypeProviderValue(type, exampleValue); + } + + private static CodeWriter AppendFrameworkTypeValue(this CodeWriter writer, InputExampleValue exampleValue, Type frameworkType, SerializationFormat serializationFormat, bool includeCollectionInitialization = true) + { + // handle objects - we usually do not generate object types, but for some rare cases (such as union type) we generate object + if (frameworkType == typeof(object)) + { + return writer.AppendFreeFormObject(exampleValue, includeCollectionInitialization); + } + + // handle RequestContent + if (frameworkType == typeof(RequestContent)) + { + return writer.AppendRequestContent(exampleValue); + } + + if (frameworkType == typeof(ETag) || + frameworkType == typeof(Uri) || + frameworkType == typeof(ResourceIdentifier) || + frameworkType == typeof(ResourceType) || + frameworkType == typeof(ContentType) || + frameworkType == typeof(RequestMethod) || + frameworkType == typeof(AzureLocation)) + { + if (exampleValue is InputExampleRawValue rawValue && rawValue.RawValue != null) + return writer.Append($"new {frameworkType}({rawValue.RawValue.ToString():L})"); + else + return writer.AppendRaw("default"); + } + + if (frameworkType == typeof(IPAddress)) + { + if (exampleValue is InputExampleRawValue rawValue && rawValue.RawValue != null) + return writer.Append($"{frameworkType}.Parse({rawValue.RawValue.ToString():L})"); + else + return writer.AppendRaw("default"); + } + + if (frameworkType == typeof(BinaryData)) + { + return writer.AppendBinaryData(exampleValue); + } + + if (frameworkType == typeof(TimeSpan)) + { + if (exampleValue is InputExampleRawValue rawValue && rawValue.RawValue is not null) + { + switch (serializationFormat) + { + case SerializationFormat.Duration_Seconds or SerializationFormat.Duration_Seconds_Float: + if (rawValue.RawValue is int or float or double) + return writer.Append($"{typeof(TimeSpan)}.FromSeconds({rawValue.RawValue:L})"); + break; + case SerializationFormat.Duration_ISO8601: + if (rawValue.RawValue is string duration) + return writer.Append($"{typeof(XmlConvert)}.ToTimeSpan({duration:L})"); + break; + case SerializationFormat.Time_ISO8601: + if (rawValue.RawValue is string time) + return writer.Append($"{typeof(TimeSpan)}.Parse({time:L})"); + break; + }; + } + + return writer.AppendRaw("default"); + } + + if (frameworkType == typeof(DateTimeOffset)) + { + if (exampleValue is InputExampleRawValue rawValue && rawValue.RawValue is not null) + { + switch (serializationFormat) + { + case SerializationFormat.DateTime_Unix: + if (rawValue.RawValue is int or long) + return writer.Append($"{typeof(DateTimeOffset)}.FromUnixTimeSeconds({rawValue.RawValue:L})"); + break; + case SerializationFormat.DateTime_RFC1123 or SerializationFormat.DateTime_RFC3339 or SerializationFormat.DateTime_RFC7231 or SerializationFormat.DateTime_ISO8601 or SerializationFormat.Date_ISO8601: + if (rawValue.RawValue is string s) + return writer.Append($"{typeof(DateTimeOffset)}.Parse({s:L})"); + break; + } + } + + return writer.AppendRaw("default"); + } + + if (frameworkType == typeof(Guid)) + { + if (exampleValue is InputExampleRawValue rawValue && rawValue.RawValue is string s) + { + return writer.Append($"{typeof(Guid)}.Parse({s:L})"); + } + + return writer.AppendRaw("default"); + } + + if (frameworkType == typeof(char) || + frameworkType == typeof(short) || + frameworkType == typeof(int) || + frameworkType == typeof(long) || + frameworkType == typeof(float) || + frameworkType == typeof(double) || + frameworkType == typeof(decimal)) + { + if (exampleValue is InputExampleRawValue rawValue && rawValue.RawValue is char or short or int or long or float or double or decimal) + { + if (frameworkType == rawValue.RawValue.GetType()) + return writer.Append($"{rawValue.RawValue:L}"); + else + return writer.Append($"({frameworkType}){rawValue.RawValue:L}"); + } + + return writer.AppendRaw("default"); + } + + if (frameworkType == typeof(string)) + { + if (exampleValue is InputExampleRawValue rawValue && rawValue.RawValue is not null) + { + return writer.Literal(rawValue.RawValue.ToString()); + } + + return writer.AppendRaw("default"); + } + + if (frameworkType == typeof(bool)) + { + if (exampleValue is InputExampleRawValue rawValue && rawValue.RawValue is bool b) + return writer.Literal(b); + + return writer.AppendRaw("default"); + } + + if (frameworkType == typeof(byte[])) + { + if (exampleValue is InputExampleRawValue rawValue && rawValue.RawValue is not null) + return writer.Append($"{typeof(Encoding)}.UTF8.GetBytes({rawValue.RawValue.ToString():L})"); + + return writer.AppendRaw("default"); + } + + return writer.AppendRaw("default"); + } + + public static CodeWriter AppendInputExampleParameterValue(this CodeWriter writer, Parameter parameter, InputExampleParameterValue exampleParameterValue) + { + // for optional parameter, we write the parameter name here + if (parameter.DefaultValue != null) + writer.Append($"{parameter.Name}: "); + + return writer.AppendInputExampleParameterValue(exampleParameterValue, parameter.SerializationFormat); + } + + public static CodeWriter AppendInputExampleParameterValue(this CodeWriter writer, InputExampleParameterValue exampleParameterValue, SerializationFormat serializationFormat) + { + if (exampleParameterValue.Value != null) + return writer.AppendInputExampleValue(exampleParameterValue.Value, exampleParameterValue.Type, serializationFormat); + else + return writer.Append(exampleParameterValue.Expression!); + } + + private static CodeWriter AppendRequestContent(this CodeWriter writer, InputExampleValue value) + { + if (value is InputExampleRawValue rawValue && rawValue.RawValue == null) + { + return writer.AppendRaw("null"); + } + else + { + return writer.Append($"{typeof(RequestContent)}.Create(") + .AppendFreeFormObject(value, true) + .AppendRaw(")"); + } + } + + private static CodeWriter AppendListValue(this CodeWriter writer, CSharpType listType, InputExampleValue exampleValue, SerializationFormat serializationFormat, bool includeCollectionInitialization = true) + { + var exampleListValue = exampleValue as InputExampleListValue; + // the collections in our generated SDK could never be assigned to, therefore if we have null value here, we can only assign an empty collection + var elements = exampleListValue?.Values ?? Enumerable.Empty(); + var elementType = listType.Arguments.Single(); + var initialization = includeCollectionInitialization ? (FormattableString)$"new {TypeFactory.GetImplementationType(listType)}()" : $""; + writer.Append(initialization); + if (elements.Any()) + { + using (writer.Scope($"", newLine: false)) + { + foreach (var itemValue in elements) + { + writer.AppendInputExampleValue(itemValue, elementType, serializationFormat); + if (elementType.IsFrameworkType) + writer.AppendRaw(","); + else + writer.LineRaw(","); + } + writer.RemoveTrailingComma(); + writer.Line(); + } + } + return writer; + } + + private static CodeWriter AppendDictionaryValue(this CodeWriter writer, CSharpType dictionaryType, InputExampleValue exampleValue, SerializationFormat serializationFormat, bool includeCollectionInitialization = true) + { + var exampleObjectValue = exampleValue as InputExampleObjectValue; + // the collections in our generated SDK could never be assigned to, therefore if we have null value here, we can only assign an empty collection + var keyValues = exampleObjectValue?.Values ?? new Dictionary(); + // since this is a dictionary, we take the first generic argument as the key type + // this is important because in our SDK, the key of a dictionary is not always a string. It could be a string-like type, for instance, a ResourceIdentifier + var keyType = dictionaryType.Arguments[0]; + // the second as the value type + var valueType = dictionaryType.Arguments[1]; + var initialization = includeCollectionInitialization ? (FormattableString)$"new {TypeFactory.GetImplementationType(dictionaryType)}()" : $""; + writer.Append(initialization); + if (keyValues.Any()) + { + using (writer.Scope($"", newLine: false)) + { + foreach (var (key, value) in keyValues) + { + // write key + writer.AppendRaw("["); + writer.AppendInputExampleValue(InputExampleValue.Value(InputPrimitiveType.String, key), keyType, SerializationFormat.Default); + writer.AppendRaw("] = "); + writer.AppendInputExampleValue(value, valueType, serializationFormat, includeCollectionInitialization); + writer.LineRaw(", "); + } + } + } + return writer; + } + + private static CodeWriter AppendBinaryData(this CodeWriter writer, InputExampleValue exampleValue) + { + // determine which method on BinaryData we want to use to serialize this BinaryData + string method = exampleValue is InputExampleRawValue exampleRawValue && exampleRawValue.RawValue is string ? "FromString" : "FromObjectAsJson"; + return writer.Append($"{typeof(BinaryData)}.{method}(") + .AppendFreeFormObject(exampleValue, true) + .AppendRaw(")"); + } + + private static CodeWriter AppendFreeFormObject(this CodeWriter writer, InputExampleValue exampleValue, bool includeCollectionInitialization = true) => exampleValue switch + { + InputExampleRawValue rawValue => rawValue.RawValue == null ? + writer.LineRaw("null") : + writer.AppendFrameworkTypeValue(exampleValue, rawValue.RawValue.GetType(), SerializationFormat.Default, includeCollectionInitialization), + InputExampleListValue listValue => writer.AppendListValue(typeof(IList), listValue, SerializationFormat.Default), + InputExampleObjectValue objectValue => CanBeInstantiatedByAnonymousObject(objectValue) ? + writer.AppendAnonymousObject(objectValue, includeCollectionInitialization) : + writer.AppendDictionaryValue(typeof(Dictionary), objectValue, SerializationFormat.Default, includeCollectionInitialization), + InputExampleStreamValue streamValue => writer.Append($"{typeof(File)}.OpenRead({streamValue.Filename:L})"), + _ => throw new InvalidOperationException($"unhandled case {exampleValue}") + }; + + private static CodeWriter AppendAnonymousObject(this CodeWriter writer, InputExampleObjectValue exampleObjectValue, bool includeCollectionInitialization = true) + { + // the collections in our generated SDK could never be assigned to, therefore if we have null value here, we can only assign an empty collection + var keyValues = exampleObjectValue?.Values ?? new Dictionary(); + if (keyValues.Any()) + { + using (writer.Scope($"new ", newLine: false)) + { + foreach (var (key, value) in keyValues) + { + // we only write a property when it is not null because an anonymous object cannot have null assignments (causes compilation error) + if (value is InputExampleRawValue rawValue && rawValue.RawValue == null) + continue; + + // write key + writer.Append($"{key} = "); + // write value + writer.AppendInputExampleValue(value, typeof(object), SerializationFormat.Default, includeCollectionInitialization); + writer.LineRaw(", "); + } + } + } + else + { + writer.Append($"new object()"); + } + return writer; + } + + private static bool CanBeInstantiatedByAnonymousObject(InputExampleObjectValue objectValue) + { + foreach (var (key, _) in objectValue.Values) + { + if (!SyntaxFacts.IsValidIdentifier(key) || SyntaxFacts.IsReservedKeyword(SyntaxFacts.GetKeywordKind(key))) + { + return false; + } + } + + return true; + } + + private static bool IsStringLikeType(CSharpType type) => type.IsFrameworkType && (_newInstanceInitializedTypes.Contains(type.FrameworkType) || _parsableInitializedTypes.Contains(type.FrameworkType)); + + private static readonly HashSet _newInstanceInitializedTypes = new() + { + typeof(ResourceIdentifier), + typeof(ResourceType), + typeof(Uri), + typeof(AzureLocation), typeof(AzureLocation?), + typeof(RequestMethod), typeof(RequestMethod?), + typeof(ContentType), typeof(ContentType?), + typeof(ETag), typeof(ETag?) + }; + + private static readonly HashSet _parsableInitializedTypes = new() + { + typeof(DateTimeOffset), + typeof(Guid), typeof(Guid?), + typeof(TimeSpan), typeof(TimeSpan?), + typeof(IPAddress) + }; + + private static CodeWriter AppendTypeProviderValue(this CodeWriter writer, CSharpType type, InputExampleValue exampleValue) + { + switch (type.Implementation) + { + case ObjectType objectType: + return writer.AppendObjectTypeValue(objectType, (exampleValue as InputExampleObjectValue)?.Values); + case EnumType enumType when exampleValue is InputExampleRawValue rawValue: + return writer.AppendEnumTypeValue(enumType, rawValue.RawValue!); + } + return writer.AppendRaw("default"); + } + + private static ObjectType GetActualImplementation(ObjectType objectType, IReadOnlyDictionary valueDict) + { + var discriminator = objectType.Discriminator; + // check if this has a discriminator + if (discriminator == null || !discriminator.HasDescendants) + return objectType; + var discriminatorPropertyName = discriminator.SerializedName; + // get value of this in the valueDict and we should always has a discriminator value in the example + if (!valueDict.TryGetValue(discriminatorPropertyName, out var exampleValue) || exampleValue is not InputExampleRawValue exampleRawValue || exampleRawValue.RawValue == null) + { + throw new InvalidOperationException($"Attempting to get the discriminator value for property `{discriminatorPropertyName}` on object type {objectType.Type.Name} but got none or non-primitive type"); + } + // the discriminator should always be a primitive type + var actualDiscriminatorValue = exampleRawValue.RawValue; + var implementation = discriminator.Implementations.FirstOrDefault(info => info.Key.Equals(actualDiscriminatorValue)); + if (implementation == null) + throw new InvalidOperationException($"Cannot find an implementation corresponding to the discriminator value {actualDiscriminatorValue} for object model type {objectType.Type.Name}"); + + return (ObjectType)implementation.Type.Implementation; + } + + private static CodeWriter AppendObjectTypeValue(this CodeWriter writer, ObjectType objectType, IReadOnlyDictionary? valueDict) + { + if (valueDict == null) + { + return writer.AppendRaw("null"); + } + + // need to get the actual ObjectType if this type has a discrinimator + objectType = GetActualImplementation(objectType, valueDict); + // get all the properties on this type, including the properties from its base type + var properties = new HashSet(objectType.EnumerateHierarchy().SelectMany(objectType => objectType.Properties)); + var constructor = objectType.InitializationConstructor; + writer.Append($"new {objectType.Type}("); + // build a map from parameter name to property + var propertyDict = properties.ToDictionary( + property => property.Declaration.Name.ToVariableName(), property => property); + // find the corresponding properties in the parameters + foreach (var parameter in constructor.Signature.Parameters) + { + // try every property, convert them to variable name and see if there are some of them matching + var property = propertyDict[parameter.Name]; + if (valueDict.TryGetValue(property.InputModelProperty!.SerializedName, out var exampleValue)) + { + properties.Remove(property); + writer.AppendInputExampleValue(exampleValue, property.Declaration.Type, property.SerializationFormat, includeCollectionInitialization: true).AppendRaw(","); + } + else + { + // if no match, we put default here + if (property.Declaration.Type.IsValueType && !property.Declaration.Type.IsNullable) + writer.AppendRaw("default"); + else + writer.AppendRaw("null"); + } + } + writer.RemoveTrailingComma(); + writer.AppendRaw(")"); + var propertiesToWrite = GetPropertiesToWrite(objectType, properties, valueDict); + if (propertiesToWrite.Count > 0) // only write the property initializers when there are properties to write + { + using (writer.Scope($"", newLine: false)) + { + foreach (var (property, exampleValue) in propertiesToWrite) + { + writer.Append($"{property.Declaration.Name} = "); + // we need to pass in the current type of this property to make sure its initialization is correct + writer.AppendInputExampleValue(exampleValue, property.Declaration.Type, property.SerializationFormat, includeCollectionInitialization: false); + writer.LineRaw(","); + } + } + } + return writer; + } + + private static Dictionary GetPropertiesToWrite(ObjectType objectType, IEnumerable properties, IReadOnlyDictionary valueDict) + { + var propertiesToWrite = new Dictionary(); + foreach (var property in properties) + { + var propertyToDeal = property; + var inputModelProperty = propertyToDeal.InputModelProperty; + if (inputModelProperty == null) + continue; // now we explicitly ignore all the AdditionalProperties + + if (!valueDict.TryGetValue(inputModelProperty.SerializedName, out var exampleValue)) + continue; // skip the property that does not have a value + + // check if this property is safe-flattened + var flattenedProperty = propertyToDeal.FlattenedProperty; + if (flattenedProperty != null) + { + // unwrap the single property object + exampleValue = UnwrapExampleValueFromSinglePropertySchema(exampleValue, flattenedProperty); + if (exampleValue == null) + continue; + propertyToDeal = flattenedProperty; + } + + if (!IsPropertyAssignable(propertyToDeal)) + continue; // now we explicitly ignore all the AdditionalProperties + + propertiesToWrite.Add(propertyToDeal, exampleValue); + } + + return propertiesToWrite; + } + + private static InputExampleValue? UnwrapExampleValueFromSinglePropertySchema(InputExampleValue exampleValue, FlattenedObjectTypeProperty flattenedProperty) + { + var hierarchyStack = flattenedProperty.BuildHierarchyStack(); + // reverse the stack because it is a stack, iterating it will start from the innerest property + // skip the first because this stack include the property we are handling here right now + foreach (var property in hierarchyStack.Reverse().Skip(1)) + { + var schemaProperty = property.SchemaProperty; + if (schemaProperty == null || exampleValue is not InputExampleObjectValue objectValue || !objectValue.Values.TryGetValue(schemaProperty.SerializedName, out var inner)) + return null; + // get the value of this layer + exampleValue = inner; + } + return exampleValue; + } + + private static bool IsPropertyAssignable(ObjectTypeProperty property) + => property.Declaration.Accessibility == "public" && (TypeFactory.IsReadWriteDictionary(property.Declaration.Type) || TypeFactory.IsReadWriteList(property.Declaration.Type) || !property.IsReadOnly); + + private static CodeWriter AppendEnumTypeValue(this CodeWriter writer, EnumType enumType, object value) + { + // find value in one of the choices. + // Here we convert the values to string then compare, because the raw value has the "primitive types are deserialized into strings" issue + var choice = enumType.Values.FirstOrDefault(c => StringComparer.Ordinal.Equals(value.ToString(), c.Value.Value?.ToString())); + writer.UseNamespace(enumType.Type.Namespace); + if (choice != null) + return writer.Append($"{enumType.Type.Name}.{choice.Declaration.Name}"); + // if we did not find a match, check if this is a SealedChoice, if so, we throw exceptions + if (!enumType.IsExtensible) + throw new InvalidOperationException($"Enum value `{value}` in example does not find in type {enumType.Type.Name}"); + return writer.Append($"new {enumType.Type}({value:L})"); + } + + public static void ConsoleWriteLine(this CodeWriter writer, FormattableString content) + { + writer.Line($"{typeof(Console)}.{nameof(Console.WriteLine)}({content});"); + } + } +} diff --git a/src/AutoRest.CSharp/LowLevel/Generation/ExampleCompileCheckWriter.cs b/src/AutoRest.CSharp/LowLevel/Generation/ExampleCompileCheckWriter.cs index 7c96250fdc6..619c49c6979 100644 --- a/src/AutoRest.CSharp/LowLevel/Generation/ExampleCompileCheckWriter.cs +++ b/src/AutoRest.CSharp/LowLevel/Generation/ExampleCompileCheckWriter.cs @@ -2,56 +2,36 @@ // Licensed under the MIT License. See License.txt in the project root for license information. using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; using System.Linq; -using System.Runtime.Serialization; -using System.Security.Cryptography.X509Certificates; -using System.Text; -using System.Threading; +using System.Text.Json; using System.Threading.Tasks; using AutoRest.CSharp.Generation.Types; using AutoRest.CSharp.Generation.Writers; -using AutoRest.CSharp.Input; +using AutoRest.CSharp.LowLevel.Generation.Extensions; using AutoRest.CSharp.Output.Models; using AutoRest.CSharp.Output.Models.Shared; -using NUnit.Framework; +using AutoRest.CSharp.Output.Samples.Models; namespace AutoRest.CSharp.LowLevel.Generation { internal class ExampleCompileCheckWriter { - private MethodSignature ExampleMethodSignature(string name, bool isAsync) => new MethodSignature( - $"Example_{name}", - null, - null, - isAsync ? MethodSignatureModifiers.Public | MethodSignatureModifiers.Async : MethodSignatureModifiers.Public, - isAsync ? typeof(Task) : (CSharpType?)null, - null, - Array.Empty(), - Attributes: new CSharpAttribute[] { new CSharpAttribute(typeof(TestAttribute)), new CSharpAttribute(typeof(IgnoreAttribute), "Only validating compilation of examples") }); - private LowLevelClient _client; private CodeWriter _writer; - private LowLevelExampleComposer _exampleComposer; public ExampleCompileCheckWriter(LowLevelClient client) { _client = client; _writer = new CodeWriter(); - _exampleComposer = new LowLevelExampleComposer(_client); } public void Write() { - //TODO: Once the code snippet composer uses CodeWriter these won't be needed - _writer.UseNamespace("Azure"); - _writer.UseNamespace("Azure.Core"); + // since our generator source code does not have the Azure.Identity dependency, we have to add this dependency separately _writer.UseNamespace("Azure.Identity"); - _writer.UseNamespace("System"); - _writer.UseNamespace("System.Collections.Generic"); - _writer.UseNamespace("System.IO"); - _writer.UseNamespace("System.Text.Json"); - if (Configuration.ModelNamespace && _client.HasConvenienceMethods) - _writer.UseNamespace($"{_client.Declaration.Namespace}.Models"); using (_writer.Namespace($"{_client.Declaration.Namespace}.Samples")) { @@ -59,108 +39,296 @@ public void Write() { foreach (var method in _client.ClientMethods) { - //TODO: we should make this more obvious to determine if something is convenience only - if (method.ProtocolMethodSignature.Modifiers.HasFlag(MethodSignatureModifiers.Public) && - !method.ProtocolMethodSignature.Attributes.Any(a => a.Type.Equals(typeof(ObsoleteAttribute))) && - !_client.IsMethodSuppressed(method.ProtocolMethodSignature) && - (_client.IsSubClient ? true : _client.GetEffectiveCtor() is not null)) + // TODO -- we keep two iterations here because we do not want to change the sequence of the method writing to get less changes in this PR + // TODO -- we could have a follow up PR that purely changes the order of methods + foreach (var sample in method.Samples) { - bool writeShortVersion = ShouldGenerateShortVersion(method); - - if (writeShortVersion) - WriteTestCompilation(method, false, false); - WriteTestCompilation(method, false, true); - - if (writeShortVersion) - WriteTestCompilation(method, true, false); - WriteTestCompilation(method, true, true); - + WriteTestMethod(sample, false); } - if (method.ConvenienceMethod is not null && - !method.ConvenienceMethod.IsDeprecatedForExamples() && - method.ConvenienceMethod.Signature.Modifiers.HasFlag(MethodSignatureModifiers.Public) && - (_client.IsSubClient ? true : _client.GetEffectiveCtor() is not null) && - !_client.IsMethodSuppressed(method.ConvenienceMethod.Signature)) - WriteConvenienceTestCompilation(method.ConvenienceMethod, method.ConvenienceMethod.Signature.Name, true, false); + foreach (var sample in method.Samples) + { + WriteTestMethod(sample, true); + } } } } } - private void WriteConvenienceTestCompilation(ConvenienceMethod method, string methodName, bool isAsync, bool useAllParameters) + private void WriteTestMethod(DpgOperationSample sample, bool isAsync) { - StringBuilder builder = new StringBuilder(); - var asyncKeyword = isAsync ? "Async" : ""; - _exampleComposer.ComposeConvenienceMethodExample(method, isAsync, false, $"{methodName}{asyncKeyword}", builder); - var testMethodName = methodName; - if (useAllParameters) + using (_writer.WriteMethodDeclaration(sample.GetExampleMethodSignature(isAsync))) { - testMethodName += "_AllParameters"; + var clientVar = WriteGetClient(sample); + + WriteSampleOperation(sample, sample.OperationMethodSignature.WithAsync(isAsync), clientVar, isAsync); } - testMethodName += "_Convenience"; - if (isAsync) + _writer.Line(); + } + + private CodeWriterDeclaration WriteGetClient(DpgOperationSample sample) + { + var clientCtor = sample.ClientInvocationChain.First(); + // handle authentication related parameters + var parameterDeclarations = WriteOperationInvocationParameters(sample, clientCtor.Parameters); + + var clientVar = new CodeWriterDeclaration("client"); + _writer.Append($"{sample.Client.Type} {clientVar:D} = "); + foreach (var method in sample.ClientInvocationChain) { - testMethodName += "_Async"; + WriteOperationInvocation(parameterDeclarations, sample, method); + _writer.AppendRaw("."); } - using (_writer.WriteMethodDeclaration(ExampleMethodSignature(testMethodName, isAsync))) + _writer.RemoveTrailingCharacter(); // this removes the last dot `.` + _writer.LineRaw(";"); + + _writer.Line(); + + return clientVar; + } + + private void WriteSampleOperation(DpgOperationSample sample, MethodSignature methodSignature, CodeWriterDeclaration clientVar, bool isAsync) + { + switch (sample.IsLongRunning, sample.IsPageable) + { + case (true, true): + WriteSampleLongRunningPageableOperationWithResponse(sample, methodSignature, clientVar, isAsync); + break; + case (true, false): + WriteSampleLongRunningOperationWithResponse(sample, methodSignature, clientVar, isAsync); + break; + case (false, true): + WriteSamplePageableOperationWithResponse(sample, methodSignature, clientVar, isAsync); + break; + case (false, false): + WriteSampleNormalOperationWithResponse(sample, methodSignature, clientVar, isAsync); + break; + }; + } + + private void WriteSampleLongRunningPageableOperationWithResponse(DpgOperationSample sample, MethodSignature methodSignature, CodeWriterDeclaration clientVar, bool isAsync) + { + // write the lro invocation + var operation = WriteSampleLongRunningOperation(sample, methodSignature, clientVar, isAsync); + + // write the paging invocation + var itemType = GetLongRunningPageableItemType(methodSignature.ReturnType); + var item = new CodeWriterDeclaration("item"); + _writer.AppendRawIf("await ", isAsync) + .Append($"foreach ({itemType} {item:D} in {operation}.Value)"); + using (_writer.Scope()) { - _writer.AppendRaw(builder.ToString()); + WriteNormalOperationResponse(sample, $"{item}", $"{item}.ToStream()"); } - _writer.Line(); + } + + private CodeWriterDeclaration WriteSampleLongRunningOperation(DpgOperationSample sample, MethodSignature methodSignature, CodeWriterDeclaration clientVar, bool isAsync) + { + var parameters = WriteOperationInvocationParameters(sample, methodSignature.Parameters); + + var returnType = GetReturnType(methodSignature.ReturnType); + var operation = new CodeWriterDeclaration("operation"); + _writer.Append($"{returnType} {operation:D} = ") + .AppendRawIf("await ", isAsync) + .Append($"{clientVar}."); + WriteOperationInvocation(parameters, sample, methodSignature); + _writer.LineRaw(";"); + + return operation; + } + + private void WriteSampleLongRunningOperationWithResponse(DpgOperationSample sample, MethodSignature methodSignature, CodeWriterDeclaration clientVar, bool isAsync) + { + var operation = WriteSampleLongRunningOperation(sample, methodSignature, clientVar, isAsync); + + if (sample.HasResponseBody) + { + var responseData = new CodeWriterDeclaration("responseData"); + var typeOfResult = GetReturnType(methodSignature.ReturnType).Arguments.Single(); + _writer.Line($"{typeOfResult} {responseData:D} = {operation}.Value;"); + WriteNormalOperationResponse(sample, $"{responseData}", $"{responseData}.ToStream()"); + } } - private bool ShouldGenerateShortVersion(LowLevelClientMethod method) + private void WriteSamplePageableOperationWithResponse(DpgOperationSample sample, MethodSignature methodSignature, CodeWriterDeclaration clientVar, bool isAsync) { - if (method.ConvenienceMethod is not null) + var parameters = WriteOperationInvocationParameters(sample, methodSignature.Parameters); + + var itemType = GetPageableItemType(methodSignature.ReturnType); + var item = new CodeWriterDeclaration("item"); + _writer.AppendRawIf("await ", isAsync) + .Append($"foreach ({itemType} {item:D} in {clientVar}."); + WriteOperationInvocation(parameters, sample, methodSignature); + _writer.LineRaw(")"); + + using (_writer.Scope()) { - if (method.ConvenienceMethod.Signature.Parameters.Count == method.ProtocolMethodSignature.Parameters.Count - 1 && - !method.ConvenienceMethod.Signature.Parameters.Last().Type.Equals(typeof(CancellationToken))) + WriteNormalOperationResponse(sample, $"{item}", $"{item}.ToStream()"); + } + } + + private void WriteSampleNormalOperationWithResponse(DpgOperationSample sample, MethodSignature methodSignature, CodeWriterDeclaration clientVar, bool isAsync) + { + var parameters = WriteOperationInvocationParameters(sample, methodSignature.Parameters); + + var returnType = GetReturnType(methodSignature.ReturnType); + var response = new CodeWriterDeclaration("response"); + + _writer.Append($"{returnType} {response:D} = ") + .AppendRawIf("await ", isAsync) + .Append($"{clientVar}."); + WriteOperationInvocation(parameters, sample, methodSignature); + _writer.LineRaw(";"); + + if (sample.HasResponseBody) + WriteNormalOperationResponse(sample, $"{response}", $"{response}.ContentStream"); + else + { + if (returnType.EqualsIgnoreNullable(typeof(Azure.Response))) { - bool allEqual = true; - for (int i = 0; i < method.ConvenienceMethod.Signature.Parameters.Count; i++) - { - if (!method.ConvenienceMethod.Signature.Parameters[i].Type.Equals(method.ProtocolMethodSignature.Parameters[i].Type)) - { - allEqual = false; - break; - } - } - if (allEqual) - { - return false; - } + _writer.ConsoleWriteLine($"{response}.Status"); + } + else + { + _writer.ConsoleWriteLine($"{response}.GetRawResponse().Status"); } } + } + + private void WriteNormalOperationResponse(DpgOperationSample sample, FormattableString resultVar, FormattableString jsonVar) + { + if (sample.IsResponseStream) + WriteStreamResponse(resultVar); else { - if (_client.HasMatchingCustomMethod(method)) - return false; + WriteOtherResponse(sample, resultVar, jsonVar); } + } - return true; + private void WriteStreamResponse(FormattableString resultVar) + { + using (_writer.Scope($"if ({resultVar}.ContentStream != null)")) + { + using (_writer.Scope($"using({typeof(Stream)} outFileStream = {typeof(File)}.{nameof(File.OpenWrite)}({"":L}))")) + { + _writer.Line($"{resultVar}.ContentStream.CopyTo(outFileStream);"); + } + } } - private void WriteTestCompilation(LowLevelClientMethod method, bool isAsync, bool useAllParameters) + private void WriteOtherResponse(DpgOperationSample sample, FormattableString resultVar, FormattableString jsonVar) { - StringBuilder builder = new StringBuilder(); - var asyncKeyword = isAsync ? "Async" : ""; - _exampleComposer.ComposeCodeSnippet(method, $"{method.RequestMethod.Name}{asyncKeyword}", isAsync, useAllParameters, builder); - var methodName = method.RequestMethod.Name; - if (useAllParameters) + // we do not write response handling for convenience methods + if (sample.IsConvenienceSample) + return; + + var result = new CodeWriterDeclaration("result"); + var apiInvocationChainList = sample.ComposeResponseParsingCode($"{result}"); + + _writer.Line(); + if (apiInvocationChainList.Any()) { - methodName += "_AllParameters"; + _writer.Line($"{typeof(JsonElement)} {result:D} = {typeof(JsonDocument)}.{nameof(JsonDocument.Parse)}({jsonVar}).RootElement;"); + foreach (var apiInvocationChain in apiInvocationChainList) + { + _writer.ConsoleWriteLine($"{apiInvocationChain.ToList().Join(".")}.ToString()"); + } } - if (isAsync) + else { - methodName += "_Async"; + _writer.ConsoleWriteLine($"{resultVar}.ToString()"); } - using (_writer.WriteMethodDeclaration(ExampleMethodSignature(methodName, isAsync))) + } + + private Dictionary WriteOperationInvocationParameters(DpgOperationSample sample, IEnumerable parameters) + { + var result = new Dictionary(); + foreach (var parameter in parameters) { - _writer.AppendRaw(builder.ToString()); + // some parameters are always inline + if (sample.IsInlineParameter(parameter)) + continue; + + if (sample.ParameterValueMapping.TryGetValue(parameter.Name, out var parameterValue)) + { + var declaration = new CodeWriterDeclaration(parameter.Name); + _writer.Append($"{parameter.Type} {declaration:D} = ") + .AppendInputExampleParameterValue(parameterValue, parameter.SerializationFormat).LineRaw(";"); + result.Add(parameter, declaration); + } } - _writer.Line(); + + return result; + } + + private void WriteOperationInvocation(Dictionary parameters, DpgOperationSample sample, MethodSignatureBase methodSignature) + { + _writer.AppendRawIf("new ", methodSignature is ConstructorSignature) + .Append($"{methodSignature.Name}("); + // write parameters + foreach (var parameter in methodSignature.Parameters) + { + if (sample.IsInlineParameter(parameter)) + { + // this is inline parameter, we just append its value here + if (sample.ParameterValueMapping.TryGetValue(parameter.Name, out var exampleValue)) + { + _writer.AppendInputExampleParameterValue(parameter, exampleValue).AppendRaw(","); + } + continue; + } + else if (parameters.TryGetValue(parameter, out var declaration)) + { + _writer.AppendIf($"{parameter.Name}: ", parameter.DefaultValue != null) + .Append($"{declaration:I}") + .AppendRaw(","); + } + } + _writer.RemoveTrailingComma(); + _writer.AppendRaw(")"); + } + + private static CSharpType GetReturnType(CSharpType? returnType) + { + if (returnType == null) + throw new InvalidOperationException("The return type of a client operation should never be null"); + + if (returnType.IsFrameworkType && returnType.FrameworkType.Equals(typeof(Task<>))) + { + return returnType.Arguments.Single(); + } + + return returnType; + } + + private static CSharpType GetLongRunningPageableItemType(CSharpType? returnType) + { + var unwrapOperation = GetOperationValueType(returnType); + + return GetPageableItemType(unwrapOperation); + } + + private static CSharpType GetOperationValueType(CSharpType? returnType) + { + if (returnType == null) + throw new InvalidOperationException("The return type of a client operation should never be null"); + + returnType = GetReturnType(returnType); + + Debug.Assert(TypeFactory.IsOperationOfT(returnType)); + + return returnType.Arguments.Single(); + } + + private static CSharpType GetPageableItemType(CSharpType? returnType) + { + if (returnType == null) + throw new InvalidOperationException("The return type of a client operation should never be null"); + + Debug.Assert(TypeFactory.IsPageable(returnType) || TypeFactory.IsAsyncPageable(returnType)); + + return returnType.Arguments.Single(); } public override string ToString() diff --git a/src/AutoRest.CSharp/LowLevel/Generation/LowLevelClientWriter.cs b/src/AutoRest.CSharp/LowLevel/Generation/LowLevelClientWriter.cs index 4997c493d0c..6adcd440fed 100644 --- a/src/AutoRest.CSharp/LowLevel/Generation/LowLevelClientWriter.cs +++ b/src/AutoRest.CSharp/LowLevel/Generation/LowLevelClientWriter.cs @@ -13,11 +13,11 @@ using AutoRest.CSharp.Common.Output.Models.Responses; using AutoRest.CSharp.Generation.Types; using AutoRest.CSharp.Input; -using AutoRest.CSharp.Output.Builders; using AutoRest.CSharp.Output.Models; using AutoRest.CSharp.Output.Models.Requests; using AutoRest.CSharp.Output.Models.Shared; using AutoRest.CSharp.Output.Models.Types; +using AutoRest.CSharp.Output.Samples.Models; using AutoRest.CSharp.Utilities; using Azure; using Azure.Core; @@ -39,14 +39,12 @@ internal class LowLevelClientWriter : ClientWriter private readonly CodeWriter _writer; private readonly XmlDocWriter _xmlDocWriter; private readonly LowLevelClient _client; - private readonly LowLevelExampleComposer _exampleComposer; public LowLevelClientWriter(CodeWriter writer, XmlDocWriter xmlDocWriter, LowLevelClient client) { _writer = writer; _xmlDocWriter = xmlDocWriter; _client = client; - _exampleComposer = new LowLevelExampleComposer(client); } public void WriteClient() @@ -68,9 +66,10 @@ public void WriteClient() if (clientMethod.ConvenienceMethod is { } convenienceMethod) { - WriteConvenienceMethodDocumentationWithExternalXmlDoc(convenienceMethod, clientMethod.RequestMethod, true); + var samples = clientMethod.Samples.Where(s => s.IsConvenienceSample); + WriteConvenienceMethodDocumentationWithExternalXmlDoc(convenienceMethod, samples, true); WriteConvenienceMethod(clientMethod, convenienceMethod, longRunning, pagingInfo, true); - WriteConvenienceMethodDocumentationWithExternalXmlDoc(convenienceMethod, clientMethod.RequestMethod, false); + WriteConvenienceMethodDocumentationWithExternalXmlDoc(convenienceMethod, samples, false); WriteConvenienceMethod(clientMethod, convenienceMethod, longRunning, pagingInfo, false); } @@ -530,20 +529,20 @@ private static void WriteResponseClassifier(CodeWriter writer, string responseCl } } - private void WriteProtocolMethodDocumentationWithExternalXmlDoc(LowLevelClientMethod clientMethod, bool async) + private void WriteProtocolMethodDocumentationWithExternalXmlDoc(LowLevelClientMethod clientMethod, bool isAsync) { - var methodSignature = clientMethod.ProtocolMethodSignature.WithAsync(async); + var methodSignature = clientMethod.ProtocolMethodSignature.WithAsync(isAsync); WriteConvenienceMethodOmitReasonIfNecessary(clientMethod.ConvenienceMethodOmittingMessage); - WriteMethodDocumentation(_writer, methodSignature, clientMethod, async); + WriteMethodDocumentation(_writer, methodSignature, clientMethod, isAsync); var docRef = GetMethodSignatureString(methodSignature); _writer.Line($"/// "); - using (_xmlDocWriter.CreateMember(docRef)) - { - _xmlDocWriter.WriteXmlDocumentation("example", _exampleComposer.Compose(clientMethod, async)); - WriteDocumentationRemarks(_xmlDocWriter.WriteXmlDocumentation, clientMethod.RequestMethod, clientMethod.PagingInfo != null, methodSignature, Array.Empty(), false, false, false); - } + + _xmlDocWriter.AddMember(docRef); + _xmlDocWriter.AddExamples( + clientMethod.Samples.Where(s => !s.IsConvenienceSample).Select(s => (s.GetSampleInformation(isAsync), s.GetExampleMethodSignature(isAsync).Name)) + ); } private void WriteConvenienceMethodOmitReasonIfNecessary(ConvenienceMethodOmittingMessage? message) @@ -555,19 +554,19 @@ private void WriteConvenienceMethodOmitReasonIfNecessary(ConvenienceMethodOmitti _writer.Line($"// {message.Message}"); } - private void WriteConvenienceMethodDocumentationWithExternalXmlDoc(ConvenienceMethod convenienceMethod, RestClientMethod restMethod, bool async) + private void WriteConvenienceMethodDocumentationWithExternalXmlDoc(ConvenienceMethod convenienceMethod, IEnumerable samples, bool isAsync) { - var methodSignature = convenienceMethod.Signature.WithAsync(async); + var methodSignature = convenienceMethod.Signature.WithAsync(isAsync); _writer.WriteMethodDocumentation(methodSignature); _writer.WriteXmlDocumentation("remarks", $"{methodSignature.DescriptionText}"); var docRef = GetMethodSignatureString(methodSignature); _writer.Line($"/// "); - using (_xmlDocWriter.CreateMember(docRef)) - { - _xmlDocWriter.WriteXmlDocumentation("example", _exampleComposer.Compose(convenienceMethod, async)); - WriteDocumentationRemarks(_xmlDocWriter.WriteXmlDocumentation, restMethod, convenienceMethod.IsPageable, methodSignature, Array.Empty(), false, false, false); - } + + _xmlDocWriter.AddMember(docRef); + _xmlDocWriter.AddExamples( + samples.Select(s => (s.GetSampleInformation(isAsync), s.GetExampleMethodSignature(isAsync).Name)) + ); } private static string GetMethodSignatureString(MethodSignature signature) @@ -696,98 +695,6 @@ private static void WriteMethodDocumentation(CodeWriter codeWriter, MethodSignat codeWriter.WriteXmlDocumentationReturns(text); } - private static string BuildSchemaFromDocs(SchemaDocumentation[] docs) - { - var docDict = docs.ToDictionary(d => d.SchemaName, d => d); - var builder = new StringBuilder(); - builder.AppendLine("{"); - BuildSchemaFromDoc(builder, docs.First(), docDict, 2); - builder.AppendLine("}"); - return builder.ToString(); - } - - //TODO: We should be able to deep link to the service schema documentation instead of creating our own. Keeping this function here until we confirm - private static IReadOnlyList CreateSchemaDocumentationRemarks(LowLevelClientMethod clientMethod, out bool hasRequestSchema, out bool hasResponseSchema) - { - var schemas = new List(); - - hasRequestSchema = AddRequestOrResponseInputType(schemas, clientMethod.RequestBodyType, "Request Body"); - - if (clientMethod.PagingInfo != null && clientMethod.ResponseBodyType is InputModelType modelType) - { - var itemType = modelType.Properties.FirstOrDefault(p => p.Name == clientMethod.PagingInfo.ItemName)?.Type; - hasResponseSchema = AddRequestOrResponseSchema(schemas, itemType, "Response Body"); - } - else - { - hasResponseSchema = AddRequestOrResponseInputType(schemas, clientMethod.ResponseBodyType, "Response Body"); - } - return schemas; - static bool AddRequestOrResponseInputType(List formattedSchemas, InputType? bodyType, string schemaName) => - bodyType switch - { - InputListType listType => AddRequestOrResponseInputType(formattedSchemas, listType.ElementType, schemaName), - InputDictionaryType dictionaryType => AddRequestOrResponseInputType(formattedSchemas, dictionaryType.ValueType, schemaName), - _ => AddRequestOrResponseSchema(formattedSchemas, bodyType, schemaName), - }; - - static bool AddRequestOrResponseSchema(List formattedSchemas, InputType? type, string schemaName) - { - if (type is null) - { - return false; - } - - var schemasToAdd = new List(); - if (type is InputModelType { DerivedModels.Count: > 0 } modelType) - { - var derivedModels = modelType.GetAllDerivedModels(); - if (derivedModels.Count > 1) - { - schemasToAdd.Add($"This method takes one of the JSON objects below as a payload. Please select a JSON object to view the schema for this.{Environment.NewLine}"); - } - - for (var index = 0; index < derivedModels.Count; index++) - { - var derivedModel = derivedModels[index]; - if (index == 1) - { - schemasToAdd.Add($"
~+ {derivedModels.Count - 1} more JSON objects"); - } - - var docs = GetSchemaDocumentationsForSchema(derivedModel, $"{derivedModel.Name.ToCleanName()} {schemaName}"); - if (docs != null) - { - schemasToAdd.Add($"
{derivedModel.Name.ToCleanName()}"); - schemasToAdd.Add($"Schema for {derivedModel.Name.ToCleanName()}:{Environment.NewLine}{BuildSchemaFromDocs(docs)}{Environment.NewLine}"); - schemasToAdd.Add($"
{Environment.NewLine}"); - } - } - if (derivedModels.Count > 1) - { - schemasToAdd.Add($"
{Environment.NewLine}"); - } - } - else - { - var docs = GetSchemaDocumentationsForSchema(type, schemaName); - if (docs != null) - { - schemasToAdd.Add($"Schema for {type.Name.ToCleanName()}:{Environment.NewLine}{BuildSchemaFromDocs(docs)}{Environment.NewLine}"); - } - } - - if (schemasToAdd.Count > 0) - { - formattedSchemas.Add($"{Environment.NewLine}{schemaName}:{Environment.NewLine}{Environment.NewLine}"); - formattedSchemas.AddRange(schemasToAdd); - return true; - } - - return false; - } - } - //TODO: We should be able to deep link to the service schema documentation instead of creating our own. Keeping this function here until we confirm private static void WriteDocumentationRemarks(Action writeXmlDocumentation, RestClientMethod requestMethod, bool isPagingMethod, MethodSignature methodSignature, IReadOnlyCollection schemas, bool hasRequestRemarks, bool hasResponseRemarks, bool addDescription) { @@ -874,75 +781,6 @@ private static void BuildSchemaFromDoc(StringBuilder builder, SchemaDocumentatio } } - private static SchemaDocumentation[]? GetSchemaDocumentationsForSchema(InputType type, string schemaName) - { - // Visit each schema in the graph and for object schemas, collect information about all the properties. - var visitedSchema = new HashSet(); - var typesToExplore = new Queue(new[] { type }); - var documentationObjects = new List<(string SchemaName, List Rows)>(); - - while (typesToExplore.Any()) - { - InputType toExplore = typesToExplore.Dequeue(); - - if (visitedSchema.Contains(toExplore.Name)) - { - continue; - } - - switch (toExplore) - { - case InputModelType modelType: - List propertyDocumentation = new(); - - // We must also include any properties introduced by our parent chain. - foreach (InputModelType modelOrBase in modelType.GetSelfAndBaseModels()) - { - foreach (InputModelProperty property in modelOrBase.Properties) - { - if (property.IsDiscriminator && property.Type is InputEnumType { IsExtensible: true } && modelType.DiscriminatorValue != null) - { - propertyDocumentation.Add(new SchemaDocumentation.DocumentationRow( - property.SerializedName ?? property.Name, - modelType.DiscriminatorValue, - property.IsRequired, - BuilderHelpers.EscapeXmlDocDescription(property.Description))); - - typesToExplore.Enqueue(property.Type); - continue; - } - - propertyDocumentation.Add(new SchemaDocumentation.DocumentationRow( - property.SerializedName ?? property.Name, - BuilderHelpers.EscapeXmlDocDescription(StringifyTypeForTable(property.Type)), - property.IsRequired, - BuilderHelpers.EscapeXmlDocDescription(property.Description))); - - typesToExplore.Enqueue(property.Type); - } - } - - documentationObjects.Add(new(toExplore == type ? schemaName : BuilderHelpers.EscapeXmlDocDescription(StringifyTypeForTable(toExplore)), propertyDocumentation)); - break; - case InputListType listType: - typesToExplore.Enqueue(listType.ElementType); - break; - case InputDictionaryType dictionaryType: - typesToExplore.Enqueue(dictionaryType.ValueType); - break; - } - - visitedSchema.Add(toExplore.Name); - } - - if (!documentationObjects.Any()) - { - return null; - } - - return documentationObjects.Select(o => new SchemaDocumentation(o.SchemaName, o.Rows.ToArray())).ToArray(); - } - private static string StringifyTypeForTable(InputType type) { static string RemovePrefix(string s, string prefix) diff --git a/src/AutoRest.CSharp/LowLevel/Generation/LowLevelExampleComposer.cs b/src/AutoRest.CSharp/LowLevel/Generation/LowLevelExampleComposer.cs deleted file mode 100644 index a81cbca916b..00000000000 --- a/src/AutoRest.CSharp/LowLevel/Generation/LowLevelExampleComposer.cs +++ /dev/null @@ -1,1276 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.Json; -using Azure; -using Azure.Core; -using AutoRest.CSharp.Generation.Types; -using AutoRest.CSharp.Common.Input; -using AutoRest.CSharp.Output.Models; -using AutoRest.CSharp.Output.Models.Shared; -using AutoRest.CSharp.Output.Models.Types; -using AutoRest.CSharp.Input; -using Microsoft.CodeAnalysis.CSharp; -using System.Threading; -using YamlDotNet.Core.Tokens; -using AutoRest.CSharp.Utilities; -using AutoRest.CSharp.Common.Utilities; - -namespace AutoRest.CSharp.Generation.Writers -{ - internal class LowLevelExampleComposer - { - private static readonly CSharpType UriType = new CSharpType(typeof(Uri)); - private static readonly CSharpType KeyAuthType = KnownParameters.KeyAuth.Type; - private static readonly CSharpType TokenAuthType = KnownParameters.TokenAuth.Type; - - private string ClientTypeName { get; } - private IReadOnlyList ClientInvocationChain { get; } - private LowLevelClient _client; - - - public LowLevelExampleComposer(LowLevelClient client) - { - _client = client; - ClientTypeName = client.Type.Name; - ClientInvocationChain = GetClientInvocationChain(client); - } - - public FormattableString Compose(LowLevelClientMethod clientMethod, bool async) - { - //skip non public protocol methods - if ((clientMethod.ProtocolMethodSignature.Modifiers & MethodSignatureModifiers.Public) == 0) - return $""; - - //skip obsolete protocol methods - if (clientMethod.ProtocolMethodSignature.Attributes.Any(a => a.Type.Equals(typeof(ObsoleteAttribute)))) - return $""; - - //skip suppressed protocol methods - if (_client.IsMethodSuppressed(clientMethod.ProtocolMethodSignature)) - return $""; - - //skip if there are no valid ctors - if (!_client.IsSubClient && _client.GetEffectiveCtor() is null) - return $""; - - var methodSignature = clientMethod.ProtocolMethodSignature.WithAsync(async); - var requestBodyType = clientMethod.RequestBodyType; - var builder = new StringBuilder(); - - if (HasNoCustomInput(methodSignature.Parameters)) // client.GetAllItems(RequestContext context = null) - { - ComposeExampleWithoutParameter(clientMethod, methodSignature.Name, async, true, builder); - } - else if (HasOptionalInputValue(methodSignature.Parameters, requestBodyType, out var requestModel)) - { - if (methodSignature.Parameters.All(p => p.IsOptionalInSignature)) - { - ComposeExampleWithoutParameter(clientMethod, methodSignature.Name, async, false, builder); - } - else if (requestBodyType != null && (requestModel == null || HasRequiredAndWritablePropertyFromTop(requestModel))) - { - ComposeExampleWithParametersAndRequestContent(clientMethod, methodSignature.Name, async, false, builder); - } - else - { - ComposeExampleWithoutRequestContent(clientMethod, methodSignature.Name, async, builder); - } - builder.AppendLine(); - ComposeExampleWithParametersAndRequestContent(clientMethod, methodSignature.Name, async, true, builder); - } - else - { - // client.GetAllItems(int a, RequestContext context = null) - ComposeExampleWithRequiredParameters(clientMethod, methodSignature.Name, async, builder); - } - - return $"{builder.ToString()}"; - } - - public FormattableString Compose(ConvenienceMethod convenienceMethod, bool async) - { - //skip when body param is obsolete - if (convenienceMethod.IsDeprecatedForExamples()) - return $""; - - //skip if not public - if (!convenienceMethod.Signature.Modifiers.HasFlag(MethodSignatureModifiers.Public)) - return $""; - - //skip if there are no valid ctors - if (!_client.IsSubClient && _client.GetEffectiveCtor() is null) - return $""; - - //skip suppressed convenience methods - if (_client.IsMethodSuppressed(convenienceMethod.Signature)) - return $""; - - var methodSignature = convenienceMethod.Signature.WithAsync(async); - var builder = new StringBuilder(); - - ComposeConvenienceMethodExample(convenienceMethod, async, true, methodSignature.Name, builder); - - return $"{builder.ToString()}"; - } - - internal void ComposeConvenienceMethodExample(ConvenienceMethod convenienceMethod, bool async, bool shouldWrap, string methodName, StringBuilder builder) - { - if (HasNoCustomInput(convenienceMethod.Signature.Parameters)) // client.GetAllItems(CancellationToken cancellationToken = default) - { - ComposeExampleWithoutParameter(convenienceMethod, methodName, async, true, shouldWrap, builder); - } - else - { - // client.GetAllItems(int a, RequestContext context = null) - ComposeExampleWithRequiredParameters(convenienceMethod, methodName, async, shouldWrap, builder); - } - } - - // `RequestContext = null` or `cancellationToken = default` is excluded - private static bool HasNoCustomInput(IReadOnlyList parameters) - => parameters.Count == 0 || (parameters.Count == 1 && (parameters[0].Equals(KnownParameters.RequestContext) || parameters[0].Equals(KnownParameters.CancellationTokenParameter))); - - // RequestContext is excluded - private static bool HasNonBodyCustomParameter(IReadOnlyList parameters) - => parameters.Any(p => p.RequestLocation != RequestLocation.Body && !p.Equals(KnownParameters.RequestContext)); - - private void ComposeExampleWithoutRequestContent(LowLevelClientMethod clientMethod, string methodName, bool async, StringBuilder builder) - { - var hasNonBodyParameter = HasNonBodyCustomParameter(clientMethod.ProtocolMethodSignature.Parameters); - builder.AppendLine($"This sample shows how to call {methodName}{(hasNonBodyParameter ? " with required parameters" : "")}{(clientMethod.ResponseBodyType != null ? " and parse the result" : "")}."); - ComposeWrappedCodeSnippet(clientMethod, methodName, async, false, builder); - } - - private void ComposeExampleWithRequiredParameters(LowLevelClientMethod clientMethod, string methodName, bool async, StringBuilder builder) - { - builder.AppendLine($"This sample shows how to call {methodName} with required {GenerateParameterAndRequestContentDescription(clientMethod.ProtocolMethodSignature.Parameters)}{(clientMethod.ResponseBodyType != null ? " and parse the result" : "")}."); - ComposeWrappedCodeSnippet(clientMethod, methodName, async, true, builder); - } - - private void ComposeExampleWithRequiredParameters(ConvenienceMethod convenienceMethod, string methodName, bool async, bool shouldWrap, StringBuilder builder) - { - if (shouldWrap) - builder.AppendLine($"This sample shows how to call {methodName} with required parameters."); - ComposeCodeSnippet(convenienceMethod, methodName, async, true, shouldWrap, builder); - } - - /// - /// Check top level properties of the given model, return true if a required and writable property is found. - /// - /// - /// - private bool HasRequiredAndWritablePropertyFromTop(InputModelType model) - => GetConcreteChildModel(model).GetSelfAndBaseModels().Any(m => m.Properties.Any(p => p.IsRequired && !p.IsReadOnly)); - - private bool HasOptionalInputValue(IReadOnlyList parameters, InputType? requestBodyType, out InputModelType? requestModel) - { - requestModel = requestBodyType as InputModelType; - if (parameters.Any(p => p.IsOptionalInSignature && !p.Equals(KnownParameters.RequestContext))) - { - return true; - } - - return requestModel != null && HasOptionalAndWritableProperty(requestModel); - } - - /// - /// Check if there is any optional and writable property in the given model hierarchy. - /// - /// - /// - private bool HasOptionalAndWritableProperty(InputModelType model) - { - // Visit each schema in the graph and for object schemas, check if any property is optional - var visitedModels = new HashSet(); - var modelsToExplore = new Queue(new[] { model }); - - while (modelsToExplore.Any()) - { - var toExplore = modelsToExplore.Dequeue(); - - if (visitedModels.Contains(toExplore)) - { - continue; - } - - foreach (var modelOrBase in GetConcreteChildModel(toExplore).GetSelfAndBaseModels()) - { - foreach (var prop in modelOrBase.Properties) - { - if (!prop.IsRequired && !prop.IsReadOnly) - { - return true; - } - - if (prop.Type is InputModelType modelType) - { - modelsToExplore.Enqueue(modelType); - } - } - } - - visitedModels.Add(toExplore); - } - - return false; - } - - private void ComposeExampleWithParametersAndRequestContent(LowLevelClientMethod clientMethod, string methodName, bool async, bool allParameters, StringBuilder builder) - { - builder.AppendLine($"This sample shows how to call {methodName} with {(allParameters ? "all" : "required")} {GenerateParameterAndRequestContentDescription(clientMethod.ProtocolMethodSignature.Parameters)}{(clientMethod.ResponseBodyType != null ? ", and how to parse the result" : "")}."); - ComposeWrappedCodeSnippet(clientMethod, methodName, async, allParameters, builder); - } - - private string GenerateParameterAndRequestContentDescription(IReadOnlyList parameters) - { - var hasNonBodyParameter = HasNonBodyCustomParameter(parameters); - var hasBodyParameter = parameters.Any(p => p.RequestLocation == RequestLocation.Body); - - if (hasNonBodyParameter) - { - if (hasBodyParameter) - { - return "parameters and request content"; - } - return "parameters"; - } - return "request content"; - } - - private void ComposeExampleWithoutParameter(LowLevelClientMethod clientMethod, string methodName, bool async, bool allParameters, StringBuilder builder) - { - builder.AppendLine($"This sample shows how to call {methodName}{(clientMethod.ResponseBodyType != null ? " and parse the result" : "")}."); - ComposeWrappedCodeSnippet(clientMethod, methodName, async, allParameters, builder); - } - - private void ComposeExampleWithoutParameter(ConvenienceMethod convenienceMethod, string methodName, bool async, bool allParameters, bool shouldWrap, StringBuilder builder) - { - if (shouldWrap) - builder.AppendLine($"This sample shows how to call {methodName}."); - ComposeCodeSnippet(convenienceMethod, methodName, async, allParameters, shouldWrap, builder); - } - - private void ComposeWrappedCodeSnippet(LowLevelClientMethod clientMethod, string methodName, bool async, bool allParameters, StringBuilder builder) - { - builder.AppendLine(""); - } - - private void ComposeCodeSnippet(ConvenienceMethod convenienceMethod, string methodName, bool async, bool allParameters, bool shouldWrap, StringBuilder builder) - { - if (shouldWrap) - builder.AppendLine(" p.RequestLocation == RequestLocation.Body); - foreach (var parameter in typeProviderTypedParameters) - { - ComposeBodyParameter(allParameters, parameter, builder); - } - - if (convenienceMethod.IsLongRunning) - { - if (convenienceMethod.IsPageable) - { - // do nothing, this never happen right now - } - else - { - ComposeHandleLongRunningResponseCode(convenienceMethod, methodName, async, allParameters, builder); - } - } - else if (convenienceMethod.IsPageable) - { - ComposeHandlePageableResponseCode(convenienceMethod, methodName, async, allParameters, builder); - } - else - { - ComposeHandleNormalResponseCode(convenienceMethod, methodName, async, allParameters, builder); - } - - if (shouldWrap) - builder.Append("]]>"); - } - - internal void ComposeCodeSnippet(LowLevelClientMethod clientMethod, string methodName, bool async, bool allParameters, StringBuilder builder) - { - ComposeGetClientCodes(builder); - builder.AppendLine(); - if (clientMethod.RequestBodyType != null) - { - ComposeRequestContent(allParameters, clientMethod.RequestBodyType, builder); - builder.AppendLine(); - } - - if (clientMethod.LongRunning != null) - { - if (clientMethod.PagingInfo != null && clientMethod.PagingInfo?.NextPageMethod != null) - { - ComposeHandleLongRunningPageableResponseCode(clientMethod, methodName, async, allParameters, builder); - } - else - { - ComposeHandleLongRunningResponseCode(clientMethod, methodName, async, allParameters, builder); - } - } - else if (clientMethod.PagingInfo != null) - { - ComposeHandlePageableResponseCode(clientMethod, methodName, async, allParameters, builder); - } - else - { - ComposeHandleNormalResponseCode(clientMethod, methodName, async, allParameters, builder); - } - } - - private void ComposeHandleLongRunningPageableResponseCode(LowLevelClientMethod clientMethod, string methodName, bool async, bool allParameters, StringBuilder builder) - { - if (clientMethod is not { ResponseBodyType: InputModelType { } responseModel }) - { - return; - } - - /* CODE PATTEN - * var operation = await client.{methodName}(WaitUntil.Completed, ...); - * - * await foreach (var item in operation.Value) - * { - * Console.WriteLine(item.ToString()); - * or - * JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - * Console.WriteLine(result[.GetProperty(...)...].ToString()); - * ... - * } - */ - builder.AppendLine($"var operation = {(async ? "await " : "")}client.{methodName}({MockParameterValues(clientMethod.ProtocolMethodSignature.Parameters.ToList(), MockParameterValue, allParameters)});"); - builder.AppendLine(); - using (Scope($"{(async ? "await " : "")}foreach (var item in operation.Value)", 0, builder, true)) - { - ComposeParsingPageableResponseCodes(responseModel, clientMethod.PagingInfo!.ItemName, allParameters, builder); - } - } - - private void ComposeHandleLongRunningResponseCode(LowLevelClientMethod clientMethod, string methodName, bool async, bool allParameters, StringBuilder builder) - { - /* GENERATED CODE PATTERN - * var operation = await client.{methodName}(WaitUntil.Completed, ...); - * - * Console.WriteLine(operation.GetRawResponse().Status); - * or - * BinaryData responseData = operation.Value; - * JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; - * Console.WriteLine(result[.GetProperty(...)...].ToString()); - * ... - */ - builder.AppendLine($"var operation = {(async ? "await " : "")}client.{methodName}({MockParameterValues(clientMethod.ProtocolMethodSignature.Parameters.ToList(), MockParameterValue, allParameters)});"); - builder.AppendLine(); - - if (clientMethod.ResponseBodyType == null) - { - builder.AppendLine("Console.WriteLine(operation.GetRawResponse().Status);"); - } - else - { - builder.AppendLine($"BinaryData responseData = operation.Value;"); - ComposeParsingLongRunningResponseCodes(allParameters, clientMethod.ResponseBodyType, builder); - } - } - - private void ComposeHandleLongRunningResponseCode(ConvenienceMethod convenienceMethod, string methodName, bool async, bool allParameters, StringBuilder builder) - { - /* GENERATED CODE PATTERN - * var operation = await client.{methodName}(WaitUntil.Completed, ...); - */ - builder.AppendLine($"var operation = {(async ? "await " : "")}client.{methodName}({MockParameterValues(convenienceMethod.Signature.Parameters.ToList(), MockConvenienceParameterValue, allParameters)});"); - } - - private void ComposeParsingLongRunningResponseCodes(bool allProperties, InputType inputType, StringBuilder builder) - { - if (inputType is InputPrimitiveType { Kind: InputTypeKind.Stream }) - { - using (Scope("using(Stream outFileStream = File.OpenWrite(\"\"))", 0, builder, true)) - { - builder.AppendLine(" responseData.ToStream().CopyTo(outFileStream);"); - } - return; - } - - var apiInvocationChainList = new List>(); - ComposeResponseParsingCode(allProperties, inputType, apiInvocationChainList, new Stack(new[] { "result" }), new HashSet()); - - if (apiInvocationChainList.Count == 0) - { - builder.AppendLine($"Console.WriteLine(responseData.ToString());"); - } - else - { - builder.AppendLine($"JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement;"); - foreach (var apiInvocationChain in apiInvocationChainList) - { - builder.AppendLine($"Console.WriteLine({string.Join(".", apiInvocationChain)}.ToString());"); - } - } - } - - private void ComposeHandlePageableResponseCode(LowLevelClientMethod clientMethod, string methodName, bool async, bool allParameters, StringBuilder builder) - { - if (clientMethod.ResponseBodyType is not InputModelType modelType) - { - return; - } - - /* GENERATED CODE PATTERN - * await foreach (var item in client.{methodName}(...)) - * { - * Console.WriteLine(item.ToString()); - * or - * JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - * Console.WriteLine(result[.GetProperty(...)...].ToString()); - * ... - * } - */ - using (Scope($"{(async ? "await " : "")}foreach (var item in client.{methodName}({MockParameterValues(clientMethod.ProtocolMethodSignature.Parameters.ToList(), MockParameterValue, allParameters)}))", 0, builder, true)) - { - ComposeParsingPageableResponseCodes(modelType, clientMethod.PagingInfo!.ItemName, allParameters, builder); - } - } - - private void ComposeHandlePageableResponseCode(ConvenienceMethod convenienceMethod, string methodName, bool async, bool allParameters, StringBuilder builder) - { - var methodSignature = convenienceMethod.Signature; - using (Scope($"{(async ? "await " : "")}foreach (var item in client.{methodName}({MockParameterValues(methodSignature.Parameters.ToList(), MockConvenienceParameterValue, allParameters)}))", 0, builder, true)) - { - } - } - - private void ComposeParsingPageableResponseCodes(InputModelType responseModelType, string pagingItemName, bool allProperties, StringBuilder builder) - { - foreach (var property in responseModelType.Properties) - { - if (property.SerializedName == pagingItemName && property.Type is InputListType listType) - { - var apiInvocationChainList = new List>(); - ComposeResponseParsingCode(allProperties, listType.ElementType, apiInvocationChainList, new Stack(new[] { "result" }), new HashSet { responseModelType }); - var parsingCodes = new List(apiInvocationChainList.Count + 1); - - if (apiInvocationChainList.Count == 0) - { - builder.Append(' ', 4); - builder.AppendLine($"Console.WriteLine(item.ToString());"); - } - else - { - builder.Append(' ', 4); - builder.AppendLine($"JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;"); - foreach (var apiInvocationChain in apiInvocationChainList) - { - builder.Append(' ', 4); - builder.AppendLine($"Console.WriteLine({string.Join(".", apiInvocationChain)}.ToString());"); - } - } - break; - } - } - } - - private void ComposeHandleNormalResponseCode(LowLevelClientMethod clientMethod, string methodName, bool async, bool allParameters, StringBuilder builder) - { - var resposneType = "Response"; - var responseVar = "response"; - if (clientMethod.RequestMethod.Operation.HttpMethod == RequestMethod.Head && Configuration.HeadAsBoolean) - { - resposneType = "Response"; - responseVar = "response.GetRawResponse()"; - } - builder.AppendLine($"{resposneType} response = {(async ? "await " : "")}client.{methodName}({MockParameterValues(clientMethod.ProtocolMethodSignature.Parameters.ToList(), MockParameterValue, allParameters)});"); - if (clientMethod.ResponseBodyType != null) - { - ComposeParsingNormalResponseCodes(allParameters, clientMethod.ResponseBodyType, responseVar, builder); - } - else - { - builder.AppendLine($"Console.WriteLine({responseVar}.Status);"); - } - } - - private void ComposeHandleNormalResponseCode(ConvenienceMethod convenienceMethod, string methodName, bool async, bool allParameters, StringBuilder builder) - { - // TODO -- need refactor to use CodeWriter and then reduce with Roslyn maybe? - var methodSignature = convenienceMethod.Signature; - builder.AppendLine($"var result = {(async ? "await " : string.Empty)}client.{methodName}({MockParameterValues(methodSignature.Parameters.ToList(), MockConvenienceParameterValue, allParameters)});"); - } - - private void ComposeParsingNormalResponseCodes(bool allProperties, InputType responseBodyType, string responseVar, StringBuilder builder) - { - if (responseBodyType is InputPrimitiveType { Kind: InputTypeKind.Stream }) - { - using (Scope($"if ({responseVar}.ContentStream != null)", 0, builder, true)) - { - using (Scope(" using(Stream outFileStream = File.OpenWrite(\"\"))", 4, builder, true)) - { - builder.AppendLine($" {responseVar}.ContentStream.CopyTo(outFileStream);"); - } - } - return; - } - - var apiInvocationChainList = new List>(); - ComposeResponseParsingCode(allProperties, responseBodyType, apiInvocationChainList, new Stack(new[] { "result" }), new HashSet()); - - builder.AppendLine(); - - if (apiInvocationChainList.Count == 0) - { - builder.AppendLine($"Console.WriteLine(response.ToString());"); - } - else - { - builder.AppendLine($"JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;"); - foreach (var apiInvocationChain in apiInvocationChainList) - { - builder.AppendLine($"Console.WriteLine({string.Join(".", apiInvocationChain)}.ToString());"); - } - } - } - - private void ComposeResponseParsingCode(bool allProperties, InputType type, List> apiInvocationChainList, Stack currentApiInvocationChain, HashSet visitedTypes) - { - switch (type) - { - case InputListType listType: - if (visitedTypes.Contains(listType.ElementType)) - { - return; - } - // {parentOp}[0] - var parentOp = currentApiInvocationChain.Pop(); - currentApiInvocationChain.Push($"{parentOp}[0]"); - ComposeResponseParsingCode(allProperties, listType.ElementType, apiInvocationChainList, currentApiInvocationChain, visitedTypes); - return; - case InputDictionaryType dictionaryType: - if (visitedTypes.Contains(dictionaryType.ValueType)) - { - return; - } - // .GetProperty("") - currentApiInvocationChain.Push("GetProperty(\"\")"); - ComposeResponseParsingCode(allProperties, dictionaryType.ValueType, apiInvocationChainList, currentApiInvocationChain, visitedTypes); - currentApiInvocationChain.Pop(); - return; - case InputModelType modelType: - ComposeResponseParsingCode(allProperties, modelType, apiInvocationChainList, currentApiInvocationChain, visitedTypes); - return; - } - - // primitive types, return - AddApiInvocationChainResult(apiInvocationChainList, currentApiInvocationChain); - } - - private void ComposeResponseParsingCode(bool allProperties, InputModelType model, List> apiInvocationChainList, Stack currentApiInvocationChain, HashSet visitedTypes) - { - foreach (var modelOrBase in model.GetSelfAndBaseModels()) - { - if (!modelOrBase.Properties.Any()) - { - continue; - } - - var propertiesToExplore = modelOrBase.Properties; - if (!allProperties) - { - propertiesToExplore = modelOrBase.Properties.Where(p => p.IsRequired).ToArray(); - } - - if (propertiesToExplore.Count == 0) // if you have a required property, but its child properties are all optional - { - // return the object - AddApiInvocationChainResult(apiInvocationChainList, currentApiInvocationChain); - return; - } - - foreach (var property in propertiesToExplore) - { - if (!visitedTypes.Contains(property.Type)) - { - // .GetProperty("{property_name}") - visitedTypes.Add(property.Type); - currentApiInvocationChain.Push($"GetProperty(\"{property.SerializedName}\")"); - ComposeResponseParsingCode(allProperties, property.Type, apiInvocationChainList, currentApiInvocationChain, visitedTypes); - currentApiInvocationChain.Pop(); - visitedTypes.Remove(property.Type); - } - } - } - } - - private void AddApiInvocationChainResult(List> apiInvocationChainList, Stack currentApiInvocationChain) - { - var finalChain = currentApiInvocationChain.ToList(); - finalChain.Reverse(); - apiInvocationChainList.Add(finalChain); - } - - private string MockParameterValues(IReadOnlyList parameters, Func parameterSelector, bool allParameters) - { - if (parameters.Count == 0) - { - return string.Empty; - } - - var parameterValues = new List(parameters.Count); - for (int i = 0; i < parameters.Count; i++) - { - //skip last param if its optional and cancellation token or request context - if (i == parameters.Count - 1 && parameters[i].IsOptionalInSignature && (parameters[i].Type.Equals(typeof(CancellationToken)) || parameters[i].Type.Equals(typeof(RequestContext)))) - continue; - - if (allParameters || parameters[i].DefaultValue == null) - { - parameterValues.Add(parameterSelector(parameters[i])); - } - } - return string.Join(", ", parameterValues); - } - - private string MockConvenienceParameterValue(Parameter parameter) - { - if (parameter.RequestLocation == RequestLocation.Body) - { - return $"{parameter.Name}"; - } - - return MockParameterValue(parameter); - } - - private string MockParameterValue(Parameter parameter) - { - if (parameter.RequestLocation == RequestLocation.Body) - { - return "RequestContent.Create(data)"; - } - - if (parameter.DefaultValue != null) - { - var defaultValue = parameter.DefaultValue.Value; - if (defaultValue.IsNewInstanceSentinel && defaultValue.Type.IsValueType) - { - return "default"; - } - - if (defaultValue.Value != null) // skip null default value like "string a = null" - { - if (defaultValue.Type.IsFrameworkType && defaultValue.Type.FrameworkType == typeof(string)) - { - return $"\"{defaultValue.Value}\""; - } - return JsonSerializer.Serialize(defaultValue.Value); - } - } - return MockParameterTypeValue(parameter.Name, parameter.Type); - } - - private string MockParameterTypeValue(string parameterName, CSharpType parameterType) - { - if (parameterType.IsFrameworkType) - { - var type = parameterType.FrameworkType; - - // Refer to TypeFactory.cs as how number type is created - if (type == typeof(long) || type == typeof(int)) - { - return "1234"; - } - - if (type == typeof(float)) - { - return "3.14f"; - } - - if (type == typeof(decimal) || type == typeof(double)) - { - return "3.14"; - } - - if (type == typeof(string)) - { - return $"\"<{parameterName}>\""; - } - - if (type == typeof(bool)) - { - return "true"; - } - - if (type == typeof(DateTimeOffset)) - { - return "DateTimeOffset.UtcNow"; - } - - if (type == typeof(DateTime)) - { - return "DateTime.UtcNow"; - } - - if (type == typeof(TimeSpan)) - { - return "new TimeSpan(1, 2, 3)"; - } - - if (type == typeof(MatchConditions)) - { - return "new MatchConditions { IfMatch = new ETag(\"\") }"; - } - - if (type == typeof(Guid)) - { - return "Guid.NewGuid()"; - } - - if (type == typeof(Uri)) - { - return "new Uri(\"http://localhost:3000\")"; - } - - if (type == typeof(WaitUntil)) - { - // use `Completed`, since we will not generate `operation.WaitForCompletion()` afterwards - return $"{nameof(WaitUntil)}.{nameof(WaitUntil.Completed)}"; - } - - if (type.IsEnum) - { - return $"{type.Name}.{Enum.GetNames(type)[0]}"; - } - - if (type == typeof(ContentType)) - { - return $"{nameof(ContentType)}.{nameof(ContentType.ApplicationOctetStream)}"; // stick to octect-stream? - } - - if (type == typeof(IEnumerable<>)) - { - var elementType = parameterType.Arguments[0]; - return $"new {elementType.Name}[]{{{MockParameterTypeValue(parameterName, elementType)}}}"; - } - - if (type == typeof(IDictionary<,>)) - { - var valueType = parameterType.Arguments[1]; - return $"new Dictionary{{ \"\" = {MockParameterTypeValue(parameterName, valueType)} }}"; - } - - if (type == typeof(BinaryData)) - { - return $"BinaryData.FromString(\"\")"; - } - - if (type == typeof(RequestContext)) - { - return $"new RequestContext()"; - } - - if (type == typeof(JsonElement)) - { - return $"new JsonElement()"; - } - - if (type == typeof(object)) - { - return $"new object()"; - } - } - - return "null"; // some unknown found - } - - private void ComposeRequestContent(bool composeAll, InputType requestBodyType, StringBuilder builder) - { - // var data = {value_expression}; - builder.Append("var data = "); - builder.Append(ComposeRequestContent(composeAll, requestBodyType, null, 0, new HashSet())); - builder.AppendLine(";"); - } - - private void ComposeBodyParameter(bool composeAll, Parameter bodyParameter, StringBuilder builder) - { - // var = {value_expression}; - builder.Append($"var {bodyParameter.Name} = "); - builder.Append(ComposeCSharpType(composeAll, bodyParameter.Type, null, 0, true, new HashSet())); - builder.AppendLine(";"); - } - - private string ComposeRequestContent(bool allProperties, InputType inputType, string? propertyDescription, int indent, HashSet visitedModels) => inputType switch - { - InputListType listType => ComposeArrayRequestContent(allProperties, listType.ElementType, indent, visitedModels), - InputDictionaryType dictionaryType => ComposeDictionaryRequestContent(allProperties, dictionaryType.ValueType, indent, visitedModels), - InputEnumType enumType => $"\"{enumType.AllowedValues.First().Value}\"", - InputPrimitiveType primitiveType => primitiveType.Kind switch - { - InputTypeKind.Stream => "File.OpenRead(\"\")", - InputTypeKind.Boolean => "true", - InputTypeKind.Date => "\"2022-05-10\"", - InputTypeKind.DateTime => "\"2022-05-10T14:57:31.2311892-04:00\"", - InputTypeKind.DateTimeISO8601 => "\"2022-05-10T18:57:31.2311892Z\"", - InputTypeKind.DateTimeRFC1123 => "\"Tue, 10 May 2022 18:57:31 GMT\"", - InputTypeKind.DateTimeRFC3339 => "\"2022-05-10T18:57:31.2311892Z\"", - InputTypeKind.DateTimeRFC7231 => "\"Tue, 10 May 2022 18:57:31 GMT\"", - InputTypeKind.DateTimeUnix => "\"1652209051\"", - InputTypeKind.Float32 => "123.45f", - InputTypeKind.Float64 => "123.45d", - InputTypeKind.Float128 => "123.45m", - InputTypeKind.Guid => "\"73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a\"", - InputTypeKind.Int32 => "1234", - InputTypeKind.Int64 => "1234L", - InputTypeKind.String => string.IsNullOrWhiteSpace(propertyDescription) ? "\"\"" : $"\"<{propertyDescription}>\"", - InputTypeKind.DurationISO8601 => "\"PT1H23M45S\"", - InputTypeKind.DurationConstant => "\"01:23:45\"", - InputTypeKind.Time => "\"01:23:45\"", - InputTypeKind.Uri => "\"http://localhost:3000\"", - _ => "new {}" - }, - InputLiteralType literalType => ComposeRequestContentForLiteral(literalType), - InputModelType modelType => ComposeModelRequestContent(allProperties, modelType, indent, visitedModels), - _ => "new {}" - }; - - private static string ComposeRequestContentForLiteral(InputLiteralType literalType) - { - var kind = literalType.LiteralValueType switch - { - InputPrimitiveType primivateType => primivateType.Kind, - InputEnumType enumType => enumType.EnumValueType.Kind, - _ => throw new InvalidOperationException($"Unsupported type for literal {literalType}") - }; - return kind switch - { - InputTypeKind.String => $"\"{literalType.Value}\"", - InputTypeKind.Boolean => (bool)literalType.Value ? "true" : "false", - _ => literalType.Value.ToString()!, // this branch we could get "int", "float". Calling ToString here will get the literal value of it without the quote. - }; - } - - private string ComposeCSharpType(bool allProperties, CSharpType type, string? propertyDescription, int indent, bool includeCollectionInitialization, HashSet visitedModels) => type switch - { - _ when TypeFactory.IsIEnumerableOfT(type) => ComposeArrayCSharpType(allProperties, type.Arguments.Single(), indent, includeCollectionInitialization, visitedModels), // IEnumerable is guaranteed to have one and only one generic parameter - _ when TypeFactory.IsReadWriteList(type) => ComposeArrayCSharpType(allProperties, type.Arguments.Single(), indent, includeCollectionInitialization, visitedModels), // IList is guaranteed to have one and only one generic parameter - _ when TypeFactory.IsReadWriteDictionary(type) => ComposeDictionaryCSharpType(allProperties, type.Arguments[0], type.Arguments[1], indent, includeCollectionInitialization, visitedModels), // IDictionary is guaranteed to have two generic parameters - { IsFrameworkType: true } => MockParameterTypeValue(propertyDescription ?? "null", type), - { IsFrameworkType: false, Implementation: ObjectType objectType } => ComposeObjectType(allProperties, objectType, indent, visitedModels), - { IsFrameworkType: false, Implementation: EnumType enumType } => $"{enumType.Type.Name}.{enumType.Values.First().Declaration.Name}", - _ => "null", - }; - - private string ComposeArrayRequestContent(bool allProperties, InputType elementType, int indent, HashSet visitedModels) - { - /* GENERATED CODE PATTERN - * new[] { - * {element_expression} - * } - * or - * new[] {} - */ - - var elementExpr = ComposeRequestContent(allProperties, elementType, null, indent + 4, visitedModels); - if (elementExpr == string.Empty) - { - return "new[] {}"; - } - - var builder = new StringBuilder(); - using (Scope("new[] ", indent, builder)) - { - builder.Append(' ', indent + 4).Append(elementExpr).AppendLine(); - } - return builder.ToString(); - } - - private string ComposeArrayCSharpType(bool allProperties, CSharpType elementType, int indent, bool includeCollectionInitialization, HashSet visitedModels) - { - /* GENERATED CODE PATTERN - * new [] { - * {element_expression} - * } - * or - * Array.Empty() - */ - - var elementName = elementType.ConvertParamNameForCode(); - if (elementName == "IList") - { - elementName = $"{elementType.Arguments[0].Name}[]"; - } - if (elementName == "IDictionary") - { - elementName = $"Dictionary"; - } - - var elementExpr = ComposeCSharpType(allProperties, elementType, null, indent + 4, includeCollectionInitialization, visitedModels); - if (elementExpr == string.Empty) - { - return includeCollectionInitialization ? $"Array.Empty<{elementName}>()" : "{}"; - } - - var builder = new StringBuilder(); - builder.AppendLine(includeCollectionInitialization ? $"new {elementName}[] " : ""); - using (Scope("", indent, builder)) - { - builder.Append(' ', indent + 4).Append(elementExpr).AppendLine(); - } - return builder.ToString(); - } - - private string ComposeDictionaryRequestContent(bool allProperties, InputType elementType, int indent, HashSet visitedModels) - { - /* GENERATED CODE PATTERN - * new { - * key = {value_expression}, - * } - * or - * new {} - */ - var valueExpr = ComposeRequestContent(allProperties, elementType, null, indent + 4, visitedModels); - if (valueExpr == string.Empty) - { - return "new {}"; - } - - var builder = new StringBuilder(); - using (Scope("new ", indent, builder)) - { - builder.Append(' ', indent + 4).AppendLine($"key = {valueExpr},"); - } - return builder.ToString(); - } - - private string ComposeDictionaryCSharpType(bool allProperties, CSharpType keyType, CSharpType valueType, int indent, bool includeCollectionInitialization, HashSet visitedModels) - { - /* GENERATED CODE PATTERN - * new Dictionary<{keyType}, {valueType}>{ - * [key] = {value_expression}, - * } - * or - * new Dictionary<{keyType}, {valueType}>() - */ - var valueExpr = ComposeCSharpType(allProperties, valueType, null, indent + 4, includeCollectionInitialization, visitedModels); - var keyExpr = keyType.Equals(typeof(int)) ? "0" : "\"key\""; //handle dictionary with int key - if (valueExpr == string.Empty) - { - return includeCollectionInitialization ? $"new Dictionary<{keyType.ConvertParamNameForCode()}, {valueType.ConvertParamNameForCode()}>()" : "{}"; - } - - var builder = new StringBuilder(); - builder.AppendLine(includeCollectionInitialization ? $"new Dictionary<{keyType.ConvertParamNameForCode()}, {valueType.ConvertParamNameForCode()}>" : ""); - using (Scope("", indent, builder)) - { - builder.Append(' ', indent + 4).AppendLine($"[{keyExpr}] = {valueExpr},"); - } - return builder.ToString(); - } - - private string ComposeModelRequestContent(bool allProperties, InputModelType model, int indent, HashSet visitedModels) - { - using (visitedModels.Push(model)) - { - /* GENERATED CODE PATTERN - * new { - * prop1 = {value_expression}, - * prop2 = {value_expression}, - * ... - * } - * or - * new {} - */ - var properties = new List(); - // We must also include any properties introduced by our parent chain. - // Try to get the concrete child type for polymorphism - var concreteModel = GetConcreteChildModel(model); - foreach (var modelOrBase in concreteModel.GetSelfAndBaseModels()) - { - if (allProperties) - { - properties.AddRange(modelOrBase.Properties.Where(p => !p.IsReadOnly)); - } - else - { - properties.AddRange(modelOrBase.Properties.Where(p => p.IsRequired && !p.IsReadOnly)); - } - } - - if (!properties.Any()) - { - return "new {}"; - } - - //remove references to my stack - _ = properties.RemoveAll(p => - visitedModels.Contains(p.Type) || - (p.Type is InputListType inputListType && visitedModels.Contains(inputListType.ElementType)) || - (p.Type is InputDictionaryType inputDictionaryType && visitedModels.Contains(inputDictionaryType.ValueType))); - - var propertyExpressions = new List(); - foreach (var property in properties) - { - string propertyValueExpr; - if (property.IsDiscriminator) - { - propertyValueExpr = property.Type is InputPrimitiveType { Kind: InputTypeKind.Boolean } or InputPrimitiveType { IsNumber: true } ? $"{concreteModel.DiscriminatorValue}" : $"\"{concreteModel.DiscriminatorValue}\""; - } - else - { - propertyValueExpr = ComposeRequestContent(allProperties, property.Type, property.SerializedName, indent + 4, visitedModels); - - } - - if (propertyValueExpr != "") - { - var propertyExprBuilder = new StringBuilder(); - propertyExprBuilder.Append(' ', indent + 4).Append($"{FixKeyWords(property.SerializedName!)} = {propertyValueExpr},"); - propertyExpressions.Add(propertyExprBuilder.ToString()); - } - } - - if (propertyExpressions.Count == 0) - { - return "new {}"; - } - - var builder = new StringBuilder(); - using (Scope("new ", indent, builder)) - { - foreach (var expr in propertyExpressions) - { - builder.AppendLine(expr); - } - } - return builder.ToString(); - } - } - - private string ComposeObjectType(bool allProperties, ObjectType model, int indent, HashSet visitedModels) - { - if (visitedModels.Contains(model)) - return string.Empty; - - using (visitedModels.Push(model)) - { - if (model.Discriminator != null && model.Discriminator.Implementations.Length > 0) - { - model = model.Discriminator.Implementations.Where(i => !i.Type.IsFrameworkType && i.Type.Implementation is ObjectType).Select(i => (i.Type.Implementation as ObjectType)!).First(); - } - - /* GENERATED CODE PATTERN - * new (parameterInCtor1, parameterInCtor2) { - * propNotInCtor1 = {value_expression}, - * propNotInCtor2 = {value_expression}, - * ... - * } - */ - // TODO -- rewrite this logic to use CodeWriterExtensions.WriteInitialization when we migrate to use CodeWriter. The WriteInitialization method will make the logic here a lot simpler - var builder = new StringBuilder(); - var concreteModel = GetConcreteChildModel(model); - var ctor = model.InitializationConstructor; - // write the ctor - var parameterExpressions = new List(); - foreach (var parameter in ctor.Signature.Parameters) - { - var parameterExpr = ComposeCSharpType(allProperties, parameter.Type, parameter.Name, indent, true, visitedModels); - parameterExpressions.Add(parameterExpr); - } - builder.Append($"new {model.Type.Name}(") - .Append(string.Join(", ", parameterExpressions)) - .Append(")"); - - // find other properties - if (allProperties) - { - // get all properties on this model, and then only keep those do not have an initializer on the ctor, which means they are not covered by the signature of the ctor - var propertiesToWrite = model.EnumerateHierarchy().SelectMany(model => model.Properties).Distinct() - .Where(p => p.Declaration.Accessibility == "public" && ctor.FindParameterByInitializedProperty(p) == null && IsPropertyAssignable(p)); - - var propertyExpressions = new List(); - foreach (var property in propertiesToWrite) - { - var propertyExpr = ComposeCSharpType(allProperties, property.Declaration.Type, property.Declaration.Name, indent + 4, false, visitedModels); - if (propertyExpr != string.Empty) - { - propertyExpressions.Add($"{property.Declaration.Name} = {propertyExpr},"); - } - } - - if (propertyExpressions.Any()) - { - builder.AppendLine(); - using (Scope("", indent, builder)) - { - foreach (var propertyExpr in propertyExpressions) - { - builder.Append(' ', indent + 4).AppendLine(propertyExpr); - } - } - } - } - - - return builder.ToString(); - - } - } - - private static bool IsPropertyAssignable(ObjectTypeProperty property) - => TypeFactory.IsReadWriteDictionary(property.Declaration.Type) || TypeFactory.IsReadWriteList(property.Declaration.Type) || !property.IsReadOnly; - - private string FixKeyWords(string serializedName) - { - // TODO -- this is incorrect, we should never change the property name here otherwise the serialized request content is wrong - // if the name changed after calling this method, we should use a dictionary instead of using anonymous object - var result = serializedName.Replace('-', '_').Replace(".", string.Empty); - return SyntaxFacts.GetKeywordKind(result) == SyntaxKind.None ? result : $"@{result}"; - } - - private void ComposeGetClientCodes(StringBuilder builder) - { - var clientConstructor = ClientInvocationChain[0]; - if (clientConstructor.Parameters.Any(p => p.Type.EqualsIgnoreNullable(KeyAuthType))) - { - builder.AppendLine("var credential = new AzureKeyCredential(\"\");"); - } - else if (clientConstructor.Parameters.Any(p => p.Type.EqualsIgnoreNullable(TokenAuthType))) - { - builder.AppendLine("var credential = new DefaultAzureCredential();"); - } - - if (clientConstructor.Parameters.Any(p => p.Type.EqualsIgnoreNullable(UriType))) - { - builder.AppendLine($"var endpoint = new Uri(\"<{GetEndpoint()}>\");"); - } - - var code = $"var client = new {ClientInvocationChain[0].Name}({MockClientConstructorParameterValues(ClientInvocationChain[0].Parameters)})"; - - if (ClientInvocationChain.Count > 1) - { - for (int i = 1; i < ClientInvocationChain.Count; i++) - { - var factoryMethod = ClientInvocationChain[i]; - code += GetFactoryMethodCode(factoryMethod); - } - } - builder.Append(code).AppendLine(";"); - } - - private string MockClientConstructorParameterValues(IReadOnlyList parameters) - { - var parameterValues = new List(parameters.Count); - foreach (var parameter in parameters) - { - if (parameter.Type.EqualsIgnoreNullable(UriType)) - { - parameterValues.Add("endpoint"); - } - else if (parameter.Name.Equals("endpoint", StringComparison.OrdinalIgnoreCase)) - { - // sometimes the endpoint parameter cannot be generated as Uri type, best efforts to guesss it - // see: https://github.com/Azure/autorest/issues/4571 - parameterValues.Add($"\"<{GetEndpoint()}>\""); - } - else if (parameter.Type.EqualsIgnoreNullable(KeyAuthType) || parameter.Type.EqualsIgnoreNullable(TokenAuthType)) - { - parameterValues.Add("credential"); - } - else - { - parameterValues.Add(MockParameterValue(parameter)); - } - } - return string.Join(", ", parameterValues); - } - - /// - /// Get the methods to be called to get the client, it should be like `Client(...).GetXXClient(..).GetYYClient(..)`. - /// It's composed of a constructor of non-subclient and a optional list of subclient factory methods. - /// - /// - private static IReadOnlyList GetClientInvocationChain(LowLevelClient client) - { - var callChain = new Stack(); - while (client.FactoryMethod != null) - { - callChain.Push(client.FactoryMethod.Signature); - if (client.ParentClient == null) - { - break; - } - - client = client.ParentClient; - } - callChain.Push(client.GetEffectiveCtor()!); - - return callChain.ToList(); - } - - private string GetFactoryMethodCode(MethodSignatureBase factoryMethod) - { - return $".{factoryMethod.Name}({MockParameterValues(factoryMethod.Parameters, MockParameterValue, true)})"; - } - - private static string GetEndpoint() - { - // TODO: is there a way to compose a data plane endpoint from swagger? - return "https://my-service.azure.com"; - } - - private static InputModelType GetConcreteChildModel(InputModelType model) - => model.DerivedModels.Any() ? model.DerivedModels[0] : model; - - private static ObjectType GetConcreteChildModel(ObjectType model) - { - if (!model.Declaration.IsAbstract || model.Discriminator is not { } discriminator || !discriminator.Implementations.Any()) - return model; - - var nonAbstractType = discriminator.Implementations.Select(impl => impl.Type).First(type => type.TryCast(out var objectType) && !objectType.Declaration.IsAbstract); - return (ObjectType)nonAbstractType.Implementation; // we selected this type by asserting it is ObjectType therefore this will never fail - } - - private CodeScope Scope(string content, int indent, StringBuilder builder, bool encloseWithNewLine = false) - { - builder.Append(content); - if (encloseWithNewLine) - { - builder.AppendLine().Append(' ', indent); - } - builder.AppendLine("{"); - return new CodeScope(builder, indent, encloseWithNewLine); - } - - private class CodeScope : IDisposable - { - private StringBuilder Builder { get; } - private int Indent { get; } - private bool EncloseWithNewLine { get; } - - internal CodeScope(StringBuilder builder, int indent, bool encloseWithNewLine) - { - Builder = builder; - Indent = indent; - EncloseWithNewLine = encloseWithNewLine; - } - - public void Dispose() - { - Builder.Append(' ', Indent).Append("}"); - if (EncloseWithNewLine) - { - Builder.AppendLine(); - } - } - } - } -} diff --git a/src/AutoRest.CSharp/LowLevel/Output/DpgOutputLibraryBuilder.cs b/src/AutoRest.CSharp/LowLevel/Output/DpgOutputLibraryBuilder.cs index b9627790b9d..660ce209b06 100644 --- a/src/AutoRest.CSharp/LowLevel/Output/DpgOutputLibraryBuilder.cs +++ b/src/AutoRest.CSharp/LowLevel/Output/DpgOutputLibraryBuilder.cs @@ -7,6 +7,7 @@ using System.Reflection; using System.Xml.Linq; using AutoRest.CSharp.Common.Input; +using AutoRest.CSharp.Common.Input.Examples; using AutoRest.CSharp.Common.Output.Builders; using AutoRest.CSharp.Common.Output.Models.Types; using AutoRest.CSharp.Common.Utilities; @@ -213,12 +214,12 @@ private static ClientInfo CreateClientInfo(InputClient ns, SourceInputModel? sou INamedTypeSymbol? existingType; if (sourceInputModel == null || (existingType = sourceInputModel.FindForType(clientNamespace, clientName)) == null) { - return new ClientInfo(ns.Name, clientName, clientNamespace, clientDescription, operations, clientParameters, resourceParameters); + return new ClientInfo(ns.Name, clientName, clientNamespace, clientDescription, operations, clientParameters, resourceParameters, ns.Examples); } clientName = existingType.Name; clientNamespace = existingType.ContainingNamespace.ToDisplayString(); - return new ClientInfo(ns.Name, clientName, clientNamespace, clientDescription, existingType, operations, clientParameters, resourceParameters); + return new ClientInfo(ns.Name, clientName, clientNamespace, clientDescription, existingType, operations, clientParameters, resourceParameters, ns.Examples); } private IReadOnlyList SetHierarchy(IReadOnlyDictionary clientInfosByName) @@ -242,10 +243,12 @@ private IReadOnlyList SetHierarchy(IReadOnlyDictionary c.ClientParameters).FirstOrDefault(p => p.IsEndpoint); + var infoForEndpoint = topLevelClients.FirstOrDefault(c => c.ClientParameters.Any(p => p.IsEndpoint)); + var endpointParameter = infoForEndpoint?.ClientParameters.FirstOrDefault(p => p.IsEndpoint); var clientParameters = endpointParameter != null ? new[] { endpointParameter } : Array.Empty(); + var clientExamples = infoForEndpoint?.Examples ?? new Dictionary(); - topLevelClientInfo = new ClientInfo(clientName, clientNamespace, clientParameters); + topLevelClientInfo = new ClientInfo(clientName, clientNamespace, clientParameters, clientExamples); } foreach (var clientInfo in topLevelClients) @@ -376,6 +379,7 @@ private IEnumerable CreateClients(IEnumerable client _rootNamespace.Auth, _sourceInputModel, clientOptions, + clientInfo.Examples, typeFactory) { SubClients = subClients @@ -396,6 +400,31 @@ private class ClientInfo public INamedTypeSymbol? ExistingType { get; } public IReadOnlyList Operations { get; } + private IReadOnlyDictionary _initialExamples; + private IReadOnlyDictionary? _examples; + public IReadOnlyDictionary Examples => _examples ??= EnsureExamples(); + + private IReadOnlyDictionary EnsureExamples() + { + // pick up all examples from child client infos here, since we might promote some parameters from child clients + var examples = new Dictionary(); + foreach (var (key, example) in _initialExamples) + { + var clientParameterExamples = new List(example.ClientParameters); + foreach (var child in Children) + { + if (child.Examples.TryGetValue(key, out var childExamples)) + { + clientParameterExamples.AddRange(childExamples.ClientParameters); + } + } + + examples.Add(key, new(example.Client, clientParameterExamples)); + } + + return examples; + } + private IReadOnlyList? _clientParameters; private IReadOnlyList _initClientParameters; public IReadOnlyList ClientParameters => _clientParameters ??= EnsureClientParameters(); @@ -409,18 +438,19 @@ private IReadOnlyList EnsureClientParameters() } return _initClientParameters; } + public ISet ResourceParameters { get; } public ClientInfo? Parent { get; set; } public IList Children { get; } public IList Requests { get; } - public ClientInfo(string operationGroupKey, string clientName, string clientNamespace, string clientDescription, IReadOnlyList operations, IReadOnlyList clientParameters, ISet resourceParameters) - : this(operationGroupKey, clientName, clientNamespace, clientDescription, null, operations, clientParameters, resourceParameters) + public ClientInfo(string operationGroupKey, string clientName, string clientNamespace, string clientDescription, IReadOnlyList operations, IReadOnlyList clientParameters, ISet resourceParameters, IReadOnlyDictionary examples) + : this(operationGroupKey, clientName, clientNamespace, clientDescription, null, operations, clientParameters, resourceParameters, examples) { } - public ClientInfo(string operationGroupKey, string clientName, string clientNamespace, string clientDescription, INamedTypeSymbol? existingType, IReadOnlyList operations, IReadOnlyList clientParameters, ISet resourceParameters) + public ClientInfo(string operationGroupKey, string clientName, string clientNamespace, string clientDescription, INamedTypeSymbol? existingType, IReadOnlyList operations, IReadOnlyList clientParameters, ISet resourceParameters, IReadOnlyDictionary examples) { OperationGroupKey = operationGroupKey; Name = clientName; @@ -432,9 +462,10 @@ public ClientInfo(string operationGroupKey, string clientName, string clientName ResourceParameters = resourceParameters; Children = new List(); Requests = new List(); + _initialExamples = examples; } - public ClientInfo(string clientName, string clientNamespace, IReadOnlyList clientParameters) + public ClientInfo(string clientName, string clientNamespace, IReadOnlyList clientParameters, IReadOnlyDictionary examples) { OperationGroupKey = string.Empty; Name = clientName; @@ -446,6 +477,7 @@ public ClientInfo(string clientName, string clientNamespace, IReadOnlyList(); Children = new List(); Requests = new List(); + _initialExamples = examples; } } } diff --git a/src/AutoRest.CSharp/LowLevel/Output/LowLevelClient.cs b/src/AutoRest.CSharp/LowLevel/Output/LowLevelClient.cs index b94ba0c8d65..7aa62089f61 100644 --- a/src/AutoRest.CSharp/LowLevel/Output/LowLevelClient.cs +++ b/src/AutoRest.CSharp/LowLevel/Output/LowLevelClient.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Text.RegularExpressions; using AutoRest.CSharp.Common.Input; +using AutoRest.CSharp.Common.Input.Examples; using AutoRest.CSharp.Common.Output.Builders; using AutoRest.CSharp.Common.Output.Models.Responses; using AutoRest.CSharp.Generation.Types; @@ -27,6 +28,7 @@ internal class LowLevelClient : TypeProvider private readonly string _libraryName; private readonly TypeFactory _typeFactory; private readonly IEnumerable _clientParameters; + private readonly IReadOnlyDictionary _clientParameterExamples; private readonly InputAuth _authorization; private readonly IEnumerable _operations; private readonly SourceInputModel? _sourceInputModel; @@ -49,7 +51,7 @@ internal class LowLevelClient : TypeProvider private bool? _isResourceClient; public bool IsResourceClient => _isResourceClient ??= Parameters.Any(p => p.IsResourceIdentifier); - public LowLevelClient(string name, string ns, string description, string libraryName, LowLevelClient? parentClient, IEnumerable operations, IEnumerable clientParameters, InputAuth authorization, SourceInputModel? sourceInputModel, ClientOptionsTypeProvider clientOptions, TypeFactory typeFactory) + public LowLevelClient(string name, string ns, string description, string libraryName, LowLevelClient? parentClient, IEnumerable operations, IEnumerable clientParameters, InputAuth authorization, SourceInputModel? sourceInputModel, ClientOptionsTypeProvider clientOptions, IReadOnlyDictionary examples, TypeFactory typeFactory) : base(ns, sourceInputModel) { _libraryName = libraryName; @@ -62,6 +64,7 @@ public LowLevelClient(string name, string ns, string description, string library ClientOptions = clientOptions; _clientParameters = clientParameters; + _clientParameterExamples = examples; _authorization = authorization; _operations = operations; _sourceInputModel = sourceInputModel; @@ -81,7 +84,7 @@ public LowLevelClient(string name, string ns, string description, string library public ConstructorSignature[] SecondaryConstructors => Constructors.SecondaryConstructors; private IReadOnlyList? _allClientMethods; - private IReadOnlyList AllClientMethods => _allClientMethods ??= BuildMethods(_typeFactory, _operations, Fields, Declaration.Namespace, Declaration.Name, _sourceInputModel).ToArray(); + private IReadOnlyList AllClientMethods => _allClientMethods ??= BuildMethods(this, _typeFactory, _operations, Fields, Declaration.Namespace, Declaration.Name, _sourceInputModel).ToArray(); private IReadOnlyList? _clientMethods; public IReadOnlyList ClientMethods => _clientMethods ??= AllClientMethods @@ -107,9 +110,9 @@ public IEnumerable CustomMethods() } - public static IEnumerable BuildMethods(TypeFactory typeFactory, IEnumerable operations, ClientFields fields, string namespaceName, string clientName, SourceInputModel? sourceInputModel) + public static IEnumerable BuildMethods(LowLevelClient? client, TypeFactory typeFactory, IEnumerable operations, ClientFields fields, string namespaceName, string clientName, SourceInputModel? sourceInputModel) { - var builders = operations.ToDictionary(o => o, o => new OperationMethodChainBuilder(o, namespaceName, clientName, fields, typeFactory, sourceInputModel)); + var builders = operations.ToDictionary(o => o, o => new OperationMethodChainBuilder(client, o, namespaceName, clientName, fields, typeFactory, sourceInputModel, client?._clientParameterExamples)); foreach (var (_, builder) in builders) { builder.BuildNextPageMethod(builders); diff --git a/src/AutoRest.CSharp/LowLevel/Output/LowLevelClientMethod.cs b/src/AutoRest.CSharp/LowLevel/Output/LowLevelClientMethod.cs index f3e12559205..164983aa779 100644 --- a/src/AutoRest.CSharp/LowLevel/Output/LowLevelClientMethod.cs +++ b/src/AutoRest.CSharp/LowLevel/Output/LowLevelClientMethod.cs @@ -1,9 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. +using System.Collections.Generic; using AutoRest.CSharp.Common.Input; using AutoRest.CSharp.Common.Output.Models; using AutoRest.CSharp.Output.Models.Requests; +using AutoRest.CSharp.Output.Samples.Models; namespace AutoRest.CSharp.Output.Models { @@ -17,6 +19,7 @@ internal record LowLevelClientMethod( ProtocolMethodPaging? PagingInfo, OperationLongRunning? LongRunning, RequestConditionHeaders ConditionHeaderFlag, + IEnumerable Samples, ConvenienceMethodOmittingMessage? ConvenienceMethodOmittingMessage) { public bool ShouldGenerateConvenienceMethodRef() diff --git a/src/AutoRest.CSharp/LowLevel/Output/OperationMethodChainBuilder.cs b/src/AutoRest.CSharp/LowLevel/Output/OperationMethodChainBuilder.cs index a03daf09a3e..a48c2c1cbc4 100644 --- a/src/AutoRest.CSharp/LowLevel/Output/OperationMethodChainBuilder.cs +++ b/src/AutoRest.CSharp/LowLevel/Output/OperationMethodChainBuilder.cs @@ -5,19 +5,20 @@ using System.Collections.Generic; using System.Linq; using AutoRest.CSharp.Common.Input; +using AutoRest.CSharp.Common.Input.Examples; using AutoRest.CSharp.Common.Output.Models; using AutoRest.CSharp.Generation.Types; -using AutoRest.CSharp.Output.Builders; +using AutoRest.CSharp.Input.Source; using AutoRest.CSharp.Output.Models.Requests; using AutoRest.CSharp.Output.Models.Serialization; using AutoRest.CSharp.Output.Models.Shared; using AutoRest.CSharp.Output.Models.Types; +using AutoRest.CSharp.Output.Samples.Models; using AutoRest.CSharp.Utilities; using Azure; using Azure.Core; using static AutoRest.CSharp.Output.Models.MethodSignatureModifiers; using Configuration = AutoRest.CSharp.Input.Configuration; -using AutoRest.CSharp.Input.Source; namespace AutoRest.CSharp.Output.Models { @@ -33,7 +34,9 @@ internal class OperationMethodChainBuilder private readonly string _namespaceName; private readonly string _clientName; + private readonly LowLevelClient? _client; private readonly ClientFields _fields; + private readonly IReadOnlyDictionary? _clientParameterExamples; private readonly TypeFactory _typeFactory; private readonly SourceInputModel? _sourceInputModel; private readonly List _orderedParameters; @@ -47,11 +50,13 @@ internal class OperationMethodChainBuilder private InputOperation Operation { get; } - public OperationMethodChainBuilder(InputOperation operation, string namespaceName, string clientName, ClientFields fields, TypeFactory typeFactory, SourceInputModel? sourceInputModel) + public OperationMethodChainBuilder(LowLevelClient? client, InputOperation operation, string namespaceName, string clientName, ClientFields fields, TypeFactory typeFactory, SourceInputModel? sourceInputModel, IReadOnlyDictionary? clientParameterExamples) { + _client = client; _namespaceName = namespaceName; _clientName = clientName; _fields = fields; + _clientParameterExamples = clientParameterExamples; _typeFactory = typeFactory; _sourceInputModel = sourceInputModel; _orderedParameters = new List(); @@ -100,7 +105,67 @@ public LowLevelClientMethod BuildOperationMethodChain() var requestBodyType = Operation.Parameters.FirstOrDefault(p => p.Location == RequestLocation.Body)?.Type; var responseBodyType = Operation.Responses.FirstOrDefault()?.BodyType; - return new LowLevelClientMethod(protocolMethodSignature, convenienceMethod, _restClientMethod, requestBodyType, responseBodyType, diagnostic, _protocolMethodPaging, Operation.LongRunning, _conditionHeaderFlag, convenienceMethodInfo.Message); + + // samples will build below + var samples = new List(); + + var method = new LowLevelClientMethod(protocolMethodSignature, convenienceMethod, _restClientMethod, requestBodyType, responseBodyType, diagnostic, _protocolMethodPaging, Operation.LongRunning, _conditionHeaderFlag, samples, convenienceMethodInfo.Message); + + BuildSamples(method, samples); + + return method; + } + + private void BuildSamples(LowLevelClientMethod method, List samples) + { + // we do not generate any sample if these variables are null + // they are only null when HLC calling methods in this class + if (_clientParameterExamples == null || _client == null) + return; + var shouldGenerateSample = DpgOperationSample.ShouldGenerateSample(_client, method.ProtocolMethodSignature); + + if (!shouldGenerateSample) + return; + + // short version samples + var shouldGenerateShortVersion = DpgOperationSample.ShouldGenerateShortVersion(_client, method); + + foreach (var (exampleKey, clientExample) in _clientParameterExamples) + { + if (!shouldGenerateShortVersion && exampleKey != ExampleMockValueBuilder.ShortVersionMockExampleKey) + continue; // skip the short example when we decide not to generate it + if (Operation.Examples.TryGetValue(exampleKey, out var operationExample)) + { + samples.Add(new( + _client, + method, + clientExample.ClientParameters, + operationExample, + false, + exampleKey == ExampleMockValueBuilder.ShortVersionMockExampleKey ? string.Empty : exampleKey)); // TODO -- this is temporary to minimize the diff + } + } + + // TODO -- this is intentional to keep the order of existing samples unchanged to minimize the amount of changes in the PR + // TODO -- will use a follow up PR to remove the double iteration + if (method.ConvenienceMethod != null && method.ConvenienceMethod.Signature.Modifiers.HasFlag(MethodSignatureModifiers.Public)) + { + foreach (var (exampleKey, clientExample) in _clientParameterExamples) + { + if (!shouldGenerateShortVersion && exampleKey != ExampleMockValueBuilder.ShortVersionMockExampleKey) + continue; // skip the short example when we decide not to generate it + if (Operation.Examples.TryGetValue(exampleKey, out var operationExample)) + { + samples.Add(new( + _client, + method, + clientExample.ClientParameters, + operationExample, + true, + exampleKey == ExampleMockValueBuilder.ShortVersionMockExampleKey ? string.Empty : exampleKey)); // TODO -- this is temporary to minimize the diff + } + } + } } private ConvenienceMethodGenerationInfo ShouldGenerateConvenienceMethod() diff --git a/src/AutoRest.CSharp/LowLevel/Output/Samples/DpgOperationSample.cs b/src/AutoRest.CSharp/LowLevel/Output/Samples/DpgOperationSample.cs new file mode 100644 index 00000000000..dabd9462748 --- /dev/null +++ b/src/AutoRest.CSharp/LowLevel/Output/Samples/DpgOperationSample.cs @@ -0,0 +1,522 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using AutoRest.CSharp.Common.Input; +using AutoRest.CSharp.Common.Input.Examples; +using AutoRest.CSharp.Generation.Types; +using AutoRest.CSharp.Output.Models; +using AutoRest.CSharp.Output.Models.Shared; +using AutoRest.CSharp.Output.Models.Types; +using AutoRest.CSharp.Utilities; +using Azure; +using NUnit.Framework; + +namespace AutoRest.CSharp.Output.Samples.Models +{ + internal class DpgOperationSample + { + public DpgOperationSample(LowLevelClient client, LowLevelClientMethod method, IEnumerable inputClientParameterExamples, InputOperationExample inputOperationExample, bool isConvenienceSample, string exampleKey) + { + Client = client; + Method = method; + _inputClientParameterExamples = inputClientParameterExamples; + _inputOperationExample = inputOperationExample; + ClientInvocationChain = GetClientInvocationChain(client); + IsConvenienceSample = isConvenienceSample; + _exampleKey = exampleKey; + _useAllParameters = exampleKey == ExampleMockValueBuilder.MockExampleAllParameterKey; // TODO -- only work around + _operationMethodSignature = isConvenienceSample ? method.ConvenienceMethod!.Signature : method.ProtocolMethodSignature; + } + + private readonly string _exampleKey; + private readonly bool _useAllParameters; + private readonly IEnumerable _inputClientParameterExamples; + private readonly InputOperationExample _inputOperationExample; + private readonly MethodSignature _operationMethodSignature; + + public bool IsConvenienceSample { get; } + public LowLevelClient Client { get; } + public LowLevelClientMethod Method { get; } + + public MethodSignature OperationMethodSignature => _operationMethodSignature; + + public bool IsLongRunning => IsConvenienceSample ? Method.ConvenienceMethod!.IsLongRunning : Method.LongRunning != null; + + public bool IsPageable => IsConvenienceSample ? Method.ConvenienceMethod!.IsPageable : Method.PagingInfo != null; + + public IReadOnlyList ClientInvocationChain { get; } + + /// + /// Get the methods to be called to get the client, it should be like `Client(...).GetXXClient(..).GetYYClient(..)`. + /// It's composed of a constructor of non-subclient and a optional list of subclient factory methods. + /// + /// + private static IReadOnlyList GetClientInvocationChain(LowLevelClient client) + { + var callChain = new Stack(); + while (client.FactoryMethod != null) + { + callChain.Push(client.FactoryMethod.Signature); + if (client.ParentClient == null) + { + break; + } + + client = client.ParentClient; + } + callChain.Push(client.GetEffectiveCtor()!); + + return callChain.ToList(); + } + + private string GetMethodName(bool isAsync) + { + var builder = new StringBuilder("Example_").Append(_operationMethodSignature.Name); + if (_useAllParameters) + { + builder.Append("_AllParameters"); + } + if (IsConvenienceSample) + { + builder.Append("_Convenience"); + } + if (isAsync) + { + builder.Append("_Async"); + } + return builder.ToString(); + } + + public MethodSignature GetExampleMethodSignature(bool isAsync) => new MethodSignature( + GetMethodName(isAsync), + null, + null, + isAsync ? MethodSignatureModifiers.Public | MethodSignatureModifiers.Async : MethodSignatureModifiers.Public, + isAsync ? typeof(Task) : (CSharpType?)null, + null, + Array.Empty(), + Attributes: new CSharpAttribute[] { new CSharpAttribute(typeof(TestAttribute)), new CSharpAttribute(typeof(IgnoreAttribute), "Only validating compilation of examples") }); + + private Dictionary? _parameterValueMapping; + public Dictionary ParameterValueMapping => _parameterValueMapping ??= EnsureParameterValueMapping(); + + private Dictionary EnsureParameterValueMapping() + { + var result = new Dictionary(); + var parameters = GetAllParameters(); + var parameterExamples = GetAllParameterExamples(); + + foreach (var parameter in parameters) + { + if (ProcessKnownParameters(result, parameter)) + continue; + + // find the corresponding input parameter + var exampleValue = FindExampleValueBySerializedName(parameterExamples, parameter.Name); + + if (exampleValue == null) + { + // if this is a required parameter and we did not find the corresponding parameter in the examples, we put the null + if (parameter.DefaultValue == null) + { + result.Add(parameter.Name, new InputExampleParameterValue(parameter, $"null")); + } + // if it is optional, we just do not put it in the map indicates that in the invocation we could omit it + } + else + { + // add it into the mapping + result.Add(parameter.Name, new InputExampleParameterValue(parameter, exampleValue)); + } + } + + return result; + } + + /// + /// Returns all the parameters that should be used in this sample + /// Only required parameters on this operation will be included if useAllParameters is false + /// Includes all parameters if useAllParameters is true + /// + /// + private IEnumerable GetAllParameters() + { + // here we should gather all the parameters from my client, and my parent client, and the parent client of my parent client, etc + foreach (var method in ClientInvocationChain) + { + foreach (var parameter in method.Parameters) + yield return parameter; + } + // then we return all the parameters on this operation + var parameters = _useAllParameters ? + _operationMethodSignature.Parameters : + _operationMethodSignature.Parameters.Where(p => p.DefaultValue == null); + foreach (var parameter in parameters) + yield return parameter; + } + + /// + /// This method returns all the related parameter examples on this particular method + /// + /// + private IEnumerable GetAllParameterExamples() + { + // first we return all the client parameters for reference + foreach (var parameter in _inputClientParameterExamples) + yield return parameter; + foreach (var parameter in _inputOperationExample.Parameters) + yield return parameter; + } + + private bool ProcessKnownParameters(Dictionary result, Parameter parameter) + { + if (parameter == KnownParameters.WaitForCompletion) + { + result.Add(parameter.Name, new InputExampleParameterValue(parameter, $"{typeof(WaitUntil)}.{nameof(WaitUntil.Completed)}")); + return true; + } + + if (parameter == KnownParameters.CancellationTokenParameter) + { + // we usually do not set this parameter in generated test cases + return true; + } + + if (parameter == KnownParameters.RequestContextRequired) + { + // we need the RequestContext to disambiguiate from the convenience method - but passing in a null value is allowed. + result.Add(parameter.Name, new InputExampleParameterValue(parameter, $"null")); + return true; + } + + // endpoint we kind of will change its description therefore here we only find it for name and type + if (IsSameParameter(parameter, KnownParameters.Endpoint)) + { + result.Add(parameter.Name, new InputExampleParameterValue(parameter, GetEndpointValue(parameter.Name))); + return true; + } + + // request content is also special + if (IsSameParameter(parameter, KnownParameters.RequestContent) || IsSameParameter(parameter, KnownParameters.RequestContentNullable)) + { + result.Add(parameter.Name, new InputExampleParameterValue(parameter, GetBodyParameterValue())); + return true; + } + + if (IsSameParameter(parameter, KnownParameters.RequestConditionsParameter) || IsSameParameter(parameter, KnownParameters.MatchConditionsParameter)) + { + // temporarily just return null value + result.Add(parameter.Name, new InputExampleParameterValue(parameter, $"null")); + return true; + } + + // handle credentials + if (parameter.Type.EqualsIgnoreNullable(KnownParameters.KeyAuth.Type)) + { + result.Add(parameter.Name, new InputExampleParameterValue(parameter, $"new {typeof(AzureKeyCredential)}({"":L})")); + return true; + } + + if (parameter.Type.EqualsIgnoreNullable(KnownParameters.TokenAuth.Type)) + { + result.Add(parameter.Name, new InputExampleParameterValue(parameter, $"new DefaultAzureCredential()")); + return true; + } + + return false; + } + + protected InputExampleValue? FindExampleValueBySerializedName(IEnumerable parameterExamples, string name) + { + foreach (var parameterExample in parameterExamples) + { + var parameter = parameterExample.Parameter; + // TODO -- we might need to refactor this when we finally separate protocol method and convenience method from the LowLevelClientMethod class + if (parameter.Kind == InputOperationParameterKind.Spread) + { + // when it is a spread parameter, it should always be InputModelType + var modelType = parameter.Type as InputModelType; + var objectExampleValue = parameterExample.ExampleValue as InputExampleObjectValue; + Debug.Assert(modelType != null); + Debug.Assert(objectExampleValue != null); + + foreach (var modelOrBase in modelType.GetSelfAndBaseModels()) + { + foreach (var property in modelOrBase.Properties) + { + if (property.Name.ToVariableName() == name) + { + return objectExampleValue.Values[property.SerializedName]; + } + } + } + } + else + { + if (parameter.Name.ToVariableName() == name) + { + return parameterExample.ExampleValue; + } + } + } + return null; + } + + public InputExampleValue GetEndpointValue(string parameterName) + { + var clientParameterValue = _inputClientParameterExamples.FirstOrDefault(e => e.Parameter.IsEndpoint)?.ExampleValue; + if (clientParameterValue != null) + return clientParameterValue; + + var operationParameterValue = _inputOperationExample.Parameters.FirstOrDefault(e => e.Parameter.IsEndpoint)?.ExampleValue; + if (operationParameterValue != null) + return operationParameterValue; + + // sometimes, especially in swagger projects, the parameter used as endpoint in our client, does not have the `IsEndpoint` flag, we have to fallback here so that we could at least have a value for it. + return InputExampleValue.Value(InputPrimitiveType.String, $"<{parameterName}>"); + } + + public bool IsInlineParameter(Parameter parameter) + { + if (IsSameParameter(parameter, KnownParameters.RequestContent) || IsSameParameter(parameter, KnownParameters.RequestContentNullable)) + return false; + + if (IsSameParameter(parameter, KnownParameters.Endpoint)) + return false; + + if (parameter.Type.EqualsIgnoreNullable(KnownParameters.KeyAuth.Type)) + return false; + + if (parameter.Type.EqualsIgnoreNullable(KnownParameters.TokenAuth.Type)) + return false; + + if (parameter.Type is { IsFrameworkType: false, Implementation: ObjectType }) + return false; + + return true; + } + + private InputExampleValue GetBodyParameterValue() + { + // we have a request body type + if (Method.RequestBodyType == null) + return InputExampleValue.Null(InputPrimitiveType.Object); + + //if (Method.RequestBodyType is InputPrimitiveType { Kind: InputTypeKind.Stream }) + // return InputExampleValue.Stream(Method.RequestBodyType, ""); + + // find the example value for this type + // if there is only one parameter is body parameter, we return it. + var bodyParameters = _inputOperationExample.Parameters.Where(e => e.Parameter is { Location: RequestLocation.Body }).ToArray(); + if (bodyParameters.Length == 1) + { + return bodyParameters.Single().ExampleValue; + } + // there could be multiple body parameters especially when we have a multiform content type operation + // if we have more than one body parameters which should happen very rarely, we just search the type in all parameters we have and get the first one that matches. + var bodyParameterExample = _inputOperationExample.Parameters.FirstOrDefault(e => e.Parameter.Type == Method.RequestBodyType); + if (bodyParameterExample != null) + { + return bodyParameterExample.ExampleValue; + } + + return InputExampleValue.Null(Method.RequestBodyType!); + } + + private static bool IsSameParameter(Parameter parameter, Parameter knownParameter) + => parameter.Name == knownParameter.Name && parameter.Type.EqualsIgnoreNullable(knownParameter.Type); + + public bool HasResponseBody => Method.ResponseBodyType != null; + public bool IsResponseStream => Method.ResponseBodyType is InputPrimitiveType { Kind: InputTypeKind.Stream }; + + /// + /// This method returns the Type we would like to deal with in the sample code. + /// For normal operation and long running operation, it is just the InputType of the response + /// For pageable operation, it is the InputType of the item + /// + /// + private InputType? GetEffectiveResponseType() + { + var responseType = Method.ResponseBodyType; + if (Method.PagingInfo == null) + return responseType; + + var pagingItemName = Method.PagingInfo.ItemName; + var listResultType = responseType as InputModelType; + var itemsArrayProperty = listResultType?.Properties.FirstOrDefault(p => p.SerializedName == pagingItemName && p.Type is InputListType); + return itemsArrayProperty?.Type as InputListType; + } + + public IEnumerable> ComposeResponseParsingCode(FormattableString rootElementVar) + { + var responseType = GetEffectiveResponseType(); + Debug.Assert(responseType != null); + var apiInvocationChainList = new List>(); + ComposeResponseParsingCode(_useAllParameters, responseType, apiInvocationChainList, new Stack(new FormattableString[] { rootElementVar }), new HashSet()); + + return apiInvocationChainList; + } + + private static void ComposeResponseParsingCode(bool useAllProperties, InputType type, List> apiInvocationChainList, Stack currentApiInvocationChain, HashSet visitedTypes) + { + switch (type) + { + case InputListType listType: + if (visitedTypes.Contains(listType.ElementType)) + return; + // {parentOp}[0] + var parentOp = currentApiInvocationChain.Pop(); + currentApiInvocationChain.Push($"{parentOp}[0]"); + ComposeResponseParsingCode(useAllProperties, listType.ElementType, apiInvocationChainList, currentApiInvocationChain, visitedTypes); + return; + case InputDictionaryType dictionaryType: + if (visitedTypes.Contains(dictionaryType.ValueType)) + return; + // .GetProrperty("") + currentApiInvocationChain.Push($"GetProperty({"":L})"); + ComposeResponseParsingCode(useAllProperties, dictionaryType.ValueType, apiInvocationChainList, currentApiInvocationChain, visitedTypes); + currentApiInvocationChain.Pop(); + return; + case InputModelType modelType: + ComposeResponseParsingCodeForModel(useAllProperties, modelType, apiInvocationChainList, currentApiInvocationChain, visitedTypes); + return; + } + + // primitive types, return + AddApiInvocationChainResult(apiInvocationChainList, currentApiInvocationChain); + } + + private static void ComposeResponseParsingCodeForModel(bool useAllProperties, InputModelType model, List> apiInvocationChainList, Stack currentApiInvocationChain, HashSet visitedTypes) + { + foreach (var modelOrBase in model.GetSelfAndBaseModels()) + { + if (!modelOrBase.Properties.Any()) + continue; + + var propertiesToExplore = useAllProperties ? + modelOrBase.Properties : + modelOrBase.Properties.Where(p => p.IsRequired); + + if (!propertiesToExplore.Any()) // if you have a required property, but its child properties are all optional + { + // return the object + AddApiInvocationChainResult(apiInvocationChainList, currentApiInvocationChain); + return; + } + + foreach (var property in propertiesToExplore) + { + if (!visitedTypes.Contains(property.Type)) + { + // .GetProperty("{propertyName}") + visitedTypes.Add(property.Type); + currentApiInvocationChain.Push($"GetProperty({property.SerializedName:L})"); + ComposeResponseParsingCode(useAllProperties, property.Type, apiInvocationChainList, currentApiInvocationChain, visitedTypes); + currentApiInvocationChain.Pop(); + visitedTypes.Remove(property.Type); + } + } + } + } + + private static void AddApiInvocationChainResult(List> apiInvocationChainList, Stack currentApiInvocationChain) + { + var finalChain = currentApiInvocationChain.ToList(); + finalChain.Reverse(); + apiInvocationChainList.Add(finalChain); + } + + // TODO -- this needs a refactor when we consolidate things around customization code https://github.com/Azure/autorest.csharp/issues/3370 + public static bool ShouldGenerateShortVersion(LowLevelClient client, LowLevelClientMethod method) + { + if (method.ConvenienceMethod is not null) + { + if (method.ConvenienceMethod.Signature.Parameters.Count == method.ProtocolMethodSignature.Parameters.Count - 1 && + !method.ConvenienceMethod.Signature.Parameters.Last().Type.Equals(typeof(CancellationToken))) + { + bool allEqual = true; + for (int i = 0; i < method.ConvenienceMethod.Signature.Parameters.Count; i++) + { + if (!method.ConvenienceMethod.Signature.Parameters[i].Type.Equals(method.ProtocolMethodSignature.Parameters[i].Type)) + { + allEqual = false; + break; + } + } + if (allEqual) + { + return false; + } + } + } + else + { + if (client.HasMatchingCustomMethod(method)) + return false; + } + + return true; + } + + public static bool ShouldGenerateSample(LowLevelClient client, MethodSignature protocolMethodSignature) + { + return protocolMethodSignature.Modifiers.HasFlag(MethodSignatureModifiers.Public) && + !protocolMethodSignature.Attributes.Any(a => a.Type.Equals(typeof(ObsoleteAttribute))) && + !client.IsMethodSuppressed(protocolMethodSignature) && + (client.IsSubClient ? true : client.GetEffectiveCtor() is not null); + } + + public string GetSampleInformation(bool isAsync) => IsConvenienceSample + ? GetSampleInformationForConvenience(Method.ConvenienceMethod!.Signature.WithAsync(isAsync)) + : GetSampleInformationForProtocol(Method.ProtocolMethodSignature.WithAsync(isAsync)); + + private string GetSampleInformationForConvenience(MethodSignature methodSignature) + { + var methodName = methodSignature.Name; + if (_useAllParameters) + { + return $"This sample shows how to call {methodName} with all parameters."; + } + + return $"This sample shows how to call {methodName}."; + } + + private string GetSampleInformationForProtocol(MethodSignature methodSignature) + { + var methodName = methodSignature.Name; + if (_useAllParameters) + { + return $"This sample shows how to call {methodName} with all {GenerateParameterAndRequestContentDescription(methodSignature.Parameters)}{(HasResponseBody ? " and parse the result" : "")}."; + } + + return $"This sample shows how to call {methodName}{(HasResponseBody ? " and parse the result" : string.Empty)}."; + } + + // RequestContext is excluded + private static bool HasNonBodyCustomParameter(IReadOnlyList parameters) + => parameters.Any(p => p.RequestLocation != RequestLocation.Body && !p.Equals(KnownParameters.RequestContext)); + + private string GenerateParameterAndRequestContentDescription(IReadOnlyList parameters) + { + var hasNonBodyParameter = HasNonBodyCustomParameter(parameters); + var hasBodyParameter = parameters.Any(p => p.RequestLocation == RequestLocation.Body); + + if (hasNonBodyParameter) + { + if (hasBodyParameter) + { + return "parameters and request content"; + } + return "parameters"; + } + return "request content"; + } + } +} diff --git a/src/AutoRest.CSharp/LowLevel/Output/Samples/InputExampleParameterValue.cs b/src/AutoRest.CSharp/LowLevel/Output/Samples/InputExampleParameterValue.cs new file mode 100644 index 00000000000..85607458a1c --- /dev/null +++ b/src/AutoRest.CSharp/LowLevel/Output/Samples/InputExampleParameterValue.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +using System; +using AutoRest.CSharp.Common.Input.Examples; +using AutoRest.CSharp.Generation.Types; +using AutoRest.CSharp.Output.Models.Requests; +using AutoRest.CSharp.Output.Models.Shared; + +namespace AutoRest.CSharp.Output.Samples.Models +{ + /// + /// A represents a value for a parameter, which could either be a , or a as a literal + /// + internal record InputExampleParameterValue + { + public string Name { get; } + + public CSharpType Type { get; } + + public InputExampleValue? Value { get; } + + public FormattableString? Expression { get; } + + private InputExampleParameterValue(string name, CSharpType type) + { + Name = name; + Type = type; + } + + public InputExampleParameterValue(Reference reference, InputExampleValue value) : this(reference.Name, reference.Type) + { + Value = value; + } + + public InputExampleParameterValue(Reference reference, FormattableString rawValue) : this(reference.Name, reference.Type) + { + Expression = rawValue; + } + + public InputExampleParameterValue(Parameter parameter, InputExampleValue value) : this(parameter.Name, parameter.Type) + { + Value = value; + } + + public InputExampleParameterValue(Parameter parameter, FormattableString rawValue) : this(parameter.Name, parameter.Type) + { + Expression = rawValue; + } + } +} diff --git a/src/AutoRest.CSharp/Mgmt/Output/Models/MgmtPropertyBag.cs b/src/AutoRest.CSharp/Mgmt/Output/Models/MgmtPropertyBag.cs index 72f2d465b33..5dcdfd95ea2 100644 --- a/src/AutoRest.CSharp/Mgmt/Output/Models/MgmtPropertyBag.cs +++ b/src/AutoRest.CSharp/Mgmt/Output/Models/MgmtPropertyBag.cs @@ -44,7 +44,7 @@ protected override TypeProvider EnsurePackModel() { var inputParameter = _operation.Parameters.FirstOrDefault(p => string.Equals(p.Name, parameter.Name, StringComparison.OrdinalIgnoreCase)); string? description = parameter.Description ?? $"The {parameter.Name}"; - var property = new InputModelProperty(parameter.Name, null, description, inputParameter!.Type, parameter.DefaultValue == null, false, false) + var property = new InputModelProperty(parameter.Name, parameter.Name, description, inputParameter!.Type, parameter.DefaultValue == null, false, false) { DefaultValue = GetDefaultValue(parameter) }; diff --git a/test/AutoRest.TestServer.Tests/Common/Generation/Writers/XmlDocWriterTests.cs b/test/AutoRest.TestServer.Tests/Common/Generation/Writers/XmlDocWriterTests.cs index 6107738f9c9..7d95f8c6ce0 100644 --- a/test/AutoRest.TestServer.Tests/Common/Generation/Writers/XmlDocWriterTests.cs +++ b/test/AutoRest.TestServer.Tests/Common/Generation/Writers/XmlDocWriterTests.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -using System; using NUnit.Framework; namespace AutoRest.CSharp.Generation.Writers @@ -16,33 +15,24 @@ public void Setup() Writer = new XmlDocWriter(); } - [Test] - public void NeedInvokeCreateMemberFirst() - { - Assert.Throws(() => Writer.WriteXmlDocumentation("test", null)); - } - [Test] public void EmptyContent() { - AssertEqual(@" + Assert.AreEqual(@" - - + ", Writer.ToString()); } [Test] public void EmptyMember() { - using (Writer.CreateMember("foo")) - { - }; - AssertEqual(@" + Writer.AddMember("foo"); + + Assert.AreEqual(@" - - + ", Writer.ToString()); } @@ -50,14 +40,19 @@ public void EmptyMember() [Test] public void EmptyTag() { - using (Writer.CreateMember("foo")) + Writer.AddMember("foo"); + Writer.AddExamples(new[] { - Writer.WriteXmlDocumentation("test", null); - }; - AssertEqual(@" + ("", "") + }); + + Assert.AreEqual(@" + + + ", Writer.ToString()); @@ -66,17 +61,19 @@ public void EmptyTag() [Test] public void OneTag() { - using (Writer.CreateMember("foo")) + Writer.AddMember("foo"); + Writer.AddExamples(new[] { - Writer.WriteXmlDocumentation("test", $"Hello, world!"); - }; - AssertEqual(@" + ("test", "Hello, world!") + }); + + Assert.AreEqual(@" - -Hello, world! - + +test +Hello, world! ", Writer.ToString()); @@ -85,56 +82,54 @@ public void OneTag() [Test] public void MultipleTags() { - using (Writer.CreateMember("foo")) + Writer.AddMember("foo"); + Writer.AddExamples(new[] { - Writer.WriteXmlDocumentation("test", $"Hello, world!"); - Writer.WriteXmlDocumentation("test", $"Hello, world!"); - }; - AssertEqual(@" + ("test", "Hello, world!"), + ("test2", "Hello, world, again!") + }); + + Assert.AreEqual(@" - -Hello, world! - - -Hello, world! - + +test +Hello, world! +test2 +Hello, world, again! ", Writer.ToString()); } + [Test] public void MultipleMembers() { - using (Writer.CreateMember("foo")) - { - Writer.WriteXmlDocumentation("test", $"Hello, world!"); - }; - using (Writer.CreateMember("fooAsync")) - { - Writer.WriteXmlDocumentation("test", $"Hello, world!"); - }; - AssertEqual(@" + Writer.AddMember("foo"); + Writer.AddExamples(new[] { + ("test", "Hello, world!"), + }); + Writer.AddMember("fooAsync"); + Writer.AddExamples(new[] { + ("test2", "Hello, world, again!"), + }); + + Assert.AreEqual(@" - -Hello, world! - + +test +Hello, world! - -Hello, world! - + +test2 +Hello, world, again! ", Writer.ToString()); } - - private void AssertEqual(string expect, string actual) - { - Assert.AreEqual(expect.Replace("\r\n", "\n"), actual); - } } } diff --git a/test/AutoRest.TestServer.Tests/Common/XmlFormatterTests.cs b/test/AutoRest.TestServer.Tests/Common/XmlFormatterTests.cs new file mode 100644 index 00000000000..86dc5b582c9 --- /dev/null +++ b/test/AutoRest.TestServer.Tests/Common/XmlFormatterTests.cs @@ -0,0 +1,119 @@ +using System; +using AutoRest.CSharp.AutoRest.Plugins; +using NUnit.Framework; + +namespace AutoRest.TestServer.Tests.Common +{ + public class XmlFormatterTests + { + [TestCaseSource(nameof(Data))] + public void ValidateContentIsProperlyFormatted(string multilineContent, string expected) + { + var lines = multilineContent.Split(Environment.NewLine); + var result = XmlFormatter.FormatContent(lines); + Assert.AreEqual(expected, result); + } + + // this XmlFormatter.FormatContent is a patch for the Roslyn formatter. It processes the content that has been formatted, + // therefore we did not introduce those edge cases like the curly braces does not match, etc + private static readonly object[] Data = new[] + { + new object[] + { + @" + Uri endpoint = new Uri(""""); + FirstTestTypeSpecClient client = new FirstTestTypeSpecClient(endpoint); + + Response response = await client.TopActionAsync(DateTimeOffset.Parse(""2022-05-10T14:57:31.2311892-04:00""), null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty(""name"").ToString()); + Console.WriteLine(result.GetProperty(""requiredUnion"").ToString()); + Console.WriteLine(result.GetProperty(""requiredLiteralString"").ToString()); + Console.WriteLine(result.GetProperty(""requiredLiteralInt"").ToString()); + Console.WriteLine(result.GetProperty(""requiredLiteralFloat"").ToString()); + Console.WriteLine(result.GetProperty(""requiredLiteralBool"").ToString()); + Console.WriteLine(result.GetProperty(""requiredBadDescription"").ToString()); + Console.WriteLine(result.GetProperty(""requiredNullableList"")[0].ToString()); +", @" +Uri endpoint = new Uri(""""); +FirstTestTypeSpecClient client = new FirstTestTypeSpecClient(endpoint); + +Response response = await client.TopActionAsync(DateTimeOffset.Parse(""2022-05-10T14:57:31.2311892-04:00""), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty(""name"").ToString()); +Console.WriteLine(result.GetProperty(""requiredUnion"").ToString()); +Console.WriteLine(result.GetProperty(""requiredLiteralString"").ToString()); +Console.WriteLine(result.GetProperty(""requiredLiteralInt"").ToString()); +Console.WriteLine(result.GetProperty(""requiredLiteralFloat"").ToString()); +Console.WriteLine(result.GetProperty(""requiredLiteralBool"").ToString()); +Console.WriteLine(result.GetProperty(""requiredBadDescription"").ToString()); +Console.WriteLine(result.GetProperty(""requiredNullableList"")[0].ToString()); +" + }, + new object[] + { + @" + Uri endpoint = new Uri(""""); + FirstTestTypeSpecClient client = new FirstTestTypeSpecClient(endpoint); + + RequestContent content = RequestContent.Create(new + { + name = """", + requiredUnion = """", + requiredLiteralString = ""accept"", + requiredLiteralInt = 123, + requiredLiteralFloat = 1.23F, + requiredLiteralBool = false, + requiredBadDescription = """", + requiredNullableList = new List() +{ +1234 +}, + }); + Response response = await client.AnonymousBodyAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty(""name"").ToString()); + Console.WriteLine(result.GetProperty(""requiredUnion"").ToString()); + Console.WriteLine(result.GetProperty(""requiredLiteralString"").ToString()); + Console.WriteLine(result.GetProperty(""requiredLiteralInt"").ToString()); + Console.WriteLine(result.GetProperty(""requiredLiteralFloat"").ToString()); + Console.WriteLine(result.GetProperty(""requiredLiteralBool"").ToString()); + Console.WriteLine(result.GetProperty(""requiredBadDescription"").ToString()); + Console.WriteLine(result.GetProperty(""requiredNullableList"")[0].ToString()); +", @" +Uri endpoint = new Uri(""""); +FirstTestTypeSpecClient client = new FirstTestTypeSpecClient(endpoint); + +RequestContent content = RequestContent.Create(new +{ + name = """", + requiredUnion = """", + requiredLiteralString = ""accept"", + requiredLiteralInt = 123, + requiredLiteralFloat = 1.23F, + requiredLiteralBool = false, + requiredBadDescription = """", + requiredNullableList = new List() + { + 1234 + }, +}); +Response response = await client.AnonymousBodyAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty(""name"").ToString()); +Console.WriteLine(result.GetProperty(""requiredUnion"").ToString()); +Console.WriteLine(result.GetProperty(""requiredLiteralString"").ToString()); +Console.WriteLine(result.GetProperty(""requiredLiteralInt"").ToString()); +Console.WriteLine(result.GetProperty(""requiredLiteralFloat"").ToString()); +Console.WriteLine(result.GetProperty(""requiredLiteralBool"").ToString()); +Console.WriteLine(result.GetProperty(""requiredBadDescription"").ToString()); +Console.WriteLine(result.GetProperty(""requiredNullableList"")[0].ToString()); +" + } + }; + } +} diff --git a/test/CadlRanchProjects/authentication/api-key/src/Generated/Docs/ApiKeyClient.xml b/test/CadlRanchProjects/authentication/api-key/src/Generated/Docs/ApiKeyClient.xml index 3561dad3c5d..b0da0d04b2c 100644 --- a/test/CadlRanchProjects/authentication/api-key/src/Generated/Docs/ApiKeyClient.xml +++ b/test/CadlRanchProjects/authentication/api-key/src/Generated/Docs/ApiKeyClient.xml @@ -2,52 +2,80 @@ - + This sample shows how to call ValidAsync. "); -var client = new ApiKeyClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +ApiKeyClient client = new ApiKeyClient(credential); Response response = await client.ValidAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call ValidAsync with all request content. +"); +ApiKeyClient client = new ApiKeyClient(credential); + +Response response = await client.ValidAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call Valid. "); -var client = new ApiKeyClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +ApiKeyClient client = new ApiKeyClient(credential); Response response = client.Valid(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call Valid with all request content. +"); +ApiKeyClient client = new ApiKeyClient(credential); + +Response response = client.Valid(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call InvalidAsync. "); -var client = new ApiKeyClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +ApiKeyClient client = new ApiKeyClient(credential); Response response = await client.InvalidAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call InvalidAsync with all request content. +"); +ApiKeyClient client = new ApiKeyClient(credential); + +Response response = await client.InvalidAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call Invalid. "); -var client = new ApiKeyClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +ApiKeyClient client = new ApiKeyClient(credential); Response response = client.Invalid(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call Invalid with all request content. +"); +ApiKeyClient client = new ApiKeyClient(credential); + +Response response = client.Invalid(); +Console.WriteLine(response.Status); +]]> \ No newline at end of file diff --git a/test/CadlRanchProjects/authentication/api-key/tests/Generated/Samples/Samples_ApiKeyClient.cs b/test/CadlRanchProjects/authentication/api-key/tests/Generated/Samples/Samples_ApiKeyClient.cs index 0e68cd4ac05..ad007f7a8f6 100644 --- a/test/CadlRanchProjects/authentication/api-key/tests/Generated/Samples/Samples_ApiKeyClient.cs +++ b/test/CadlRanchProjects/authentication/api-key/tests/Generated/Samples/Samples_ApiKeyClient.cs @@ -6,12 +6,9 @@ #nullable disable using System; -using System.Collections.Generic; -using System.IO; -using System.Text.Json; using System.Threading.Tasks; +using Authentication.ApiKey; using Azure; -using Azure.Core; using Azure.Identity; using NUnit.Framework; @@ -23,8 +20,8 @@ public class Samples_ApiKeyClient [Ignore("Only validating compilation of examples")] public void Example_Valid() { - var credential = new AzureKeyCredential(""); - var client = new ApiKeyClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + ApiKeyClient client = new ApiKeyClient(credential); Response response = client.Valid(); Console.WriteLine(response.Status); @@ -34,8 +31,8 @@ public void Example_Valid() [Ignore("Only validating compilation of examples")] public void Example_Valid_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new ApiKeyClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + ApiKeyClient client = new ApiKeyClient(credential); Response response = client.Valid(); Console.WriteLine(response.Status); @@ -45,8 +42,8 @@ public void Example_Valid_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_Valid_Async() { - var credential = new AzureKeyCredential(""); - var client = new ApiKeyClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + ApiKeyClient client = new ApiKeyClient(credential); Response response = await client.ValidAsync(); Console.WriteLine(response.Status); @@ -56,8 +53,8 @@ public async Task Example_Valid_Async() [Ignore("Only validating compilation of examples")] public async Task Example_Valid_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new ApiKeyClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + ApiKeyClient client = new ApiKeyClient(credential); Response response = await client.ValidAsync(); Console.WriteLine(response.Status); @@ -67,8 +64,8 @@ public async Task Example_Valid_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_Invalid() { - var credential = new AzureKeyCredential(""); - var client = new ApiKeyClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + ApiKeyClient client = new ApiKeyClient(credential); Response response = client.Invalid(); Console.WriteLine(response.Status); @@ -78,8 +75,8 @@ public void Example_Invalid() [Ignore("Only validating compilation of examples")] public void Example_Invalid_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new ApiKeyClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + ApiKeyClient client = new ApiKeyClient(credential); Response response = client.Invalid(); Console.WriteLine(response.Status); @@ -89,8 +86,8 @@ public void Example_Invalid_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_Invalid_Async() { - var credential = new AzureKeyCredential(""); - var client = new ApiKeyClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + ApiKeyClient client = new ApiKeyClient(credential); Response response = await client.InvalidAsync(); Console.WriteLine(response.Status); @@ -100,8 +97,8 @@ public async Task Example_Invalid_Async() [Ignore("Only validating compilation of examples")] public async Task Example_Invalid_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new ApiKeyClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + ApiKeyClient client = new ApiKeyClient(credential); Response response = await client.InvalidAsync(); Console.WriteLine(response.Status); diff --git a/test/CadlRanchProjects/authentication/http/custom/src/Generated/Docs/CustomClient.xml b/test/CadlRanchProjects/authentication/http/custom/src/Generated/Docs/CustomClient.xml index 855bfff7479..7b0468a6a47 100644 --- a/test/CadlRanchProjects/authentication/http/custom/src/Generated/Docs/CustomClient.xml +++ b/test/CadlRanchProjects/authentication/http/custom/src/Generated/Docs/CustomClient.xml @@ -2,52 +2,80 @@ - + This sample shows how to call ValidAsync. "); -var client = new CustomClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +CustomClient client = new CustomClient(credential); Response response = await client.ValidAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call ValidAsync with all request content. +"); +CustomClient client = new CustomClient(credential); + +Response response = await client.ValidAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call Valid. "); -var client = new CustomClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +CustomClient client = new CustomClient(credential); Response response = client.Valid(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call Valid with all request content. +"); +CustomClient client = new CustomClient(credential); + +Response response = client.Valid(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call InvalidAsync. "); -var client = new CustomClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +CustomClient client = new CustomClient(credential); Response response = await client.InvalidAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call InvalidAsync with all request content. +"); +CustomClient client = new CustomClient(credential); + +Response response = await client.InvalidAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call Invalid. "); -var client = new CustomClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +CustomClient client = new CustomClient(credential); Response response = client.Invalid(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call Invalid with all request content. +"); +CustomClient client = new CustomClient(credential); + +Response response = client.Invalid(); +Console.WriteLine(response.Status); +]]> \ No newline at end of file diff --git a/test/CadlRanchProjects/authentication/http/custom/tests/Generated/Samples/Samples_CustomClient.cs b/test/CadlRanchProjects/authentication/http/custom/tests/Generated/Samples/Samples_CustomClient.cs index 6766f1761f6..1a2526a0596 100644 --- a/test/CadlRanchProjects/authentication/http/custom/tests/Generated/Samples/Samples_CustomClient.cs +++ b/test/CadlRanchProjects/authentication/http/custom/tests/Generated/Samples/Samples_CustomClient.cs @@ -6,12 +6,9 @@ #nullable disable using System; -using System.Collections.Generic; -using System.IO; -using System.Text.Json; using System.Threading.Tasks; +using Authentication.Http.Custom; using Azure; -using Azure.Core; using Azure.Identity; using NUnit.Framework; @@ -23,8 +20,8 @@ public class Samples_CustomClient [Ignore("Only validating compilation of examples")] public void Example_Valid() { - var credential = new AzureKeyCredential(""); - var client = new CustomClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + CustomClient client = new CustomClient(credential); Response response = client.Valid(); Console.WriteLine(response.Status); @@ -34,8 +31,8 @@ public void Example_Valid() [Ignore("Only validating compilation of examples")] public void Example_Valid_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new CustomClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + CustomClient client = new CustomClient(credential); Response response = client.Valid(); Console.WriteLine(response.Status); @@ -45,8 +42,8 @@ public void Example_Valid_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_Valid_Async() { - var credential = new AzureKeyCredential(""); - var client = new CustomClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + CustomClient client = new CustomClient(credential); Response response = await client.ValidAsync(); Console.WriteLine(response.Status); @@ -56,8 +53,8 @@ public async Task Example_Valid_Async() [Ignore("Only validating compilation of examples")] public async Task Example_Valid_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new CustomClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + CustomClient client = new CustomClient(credential); Response response = await client.ValidAsync(); Console.WriteLine(response.Status); @@ -67,8 +64,8 @@ public async Task Example_Valid_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_Invalid() { - var credential = new AzureKeyCredential(""); - var client = new CustomClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + CustomClient client = new CustomClient(credential); Response response = client.Invalid(); Console.WriteLine(response.Status); @@ -78,8 +75,8 @@ public void Example_Invalid() [Ignore("Only validating compilation of examples")] public void Example_Invalid_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new CustomClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + CustomClient client = new CustomClient(credential); Response response = client.Invalid(); Console.WriteLine(response.Status); @@ -89,8 +86,8 @@ public void Example_Invalid_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_Invalid_Async() { - var credential = new AzureKeyCredential(""); - var client = new CustomClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + CustomClient client = new CustomClient(credential); Response response = await client.InvalidAsync(); Console.WriteLine(response.Status); @@ -100,8 +97,8 @@ public async Task Example_Invalid_Async() [Ignore("Only validating compilation of examples")] public async Task Example_Invalid_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new CustomClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + CustomClient client = new CustomClient(credential); Response response = await client.InvalidAsync(); Console.WriteLine(response.Status); diff --git a/test/CadlRanchProjects/authentication/oauth2/src/Generated/Docs/OAuth2Client.xml b/test/CadlRanchProjects/authentication/oauth2/src/Generated/Docs/OAuth2Client.xml index 230cdefe81e..6896a14a33c 100644 --- a/test/CadlRanchProjects/authentication/oauth2/src/Generated/Docs/OAuth2Client.xml +++ b/test/CadlRanchProjects/authentication/oauth2/src/Generated/Docs/OAuth2Client.xml @@ -2,52 +2,80 @@ - + This sample shows how to call ValidAsync. - +This sample shows how to call ValidAsync with all request content. + - + This sample shows how to call Valid. - +This sample shows how to call Valid with all request content. + - + This sample shows how to call InvalidAsync. - +This sample shows how to call InvalidAsync with all request content. + - + This sample shows how to call Invalid. - +This sample shows how to call Invalid with all request content. + \ No newline at end of file diff --git a/test/CadlRanchProjects/authentication/oauth2/tests/Generated/Samples/Samples_OAuth2Client.cs b/test/CadlRanchProjects/authentication/oauth2/tests/Generated/Samples/Samples_OAuth2Client.cs index 6fe60c27559..840a19d2cd5 100644 --- a/test/CadlRanchProjects/authentication/oauth2/tests/Generated/Samples/Samples_OAuth2Client.cs +++ b/test/CadlRanchProjects/authentication/oauth2/tests/Generated/Samples/Samples_OAuth2Client.cs @@ -6,10 +6,8 @@ #nullable disable using System; -using System.Collections.Generic; -using System.IO; -using System.Text.Json; using System.Threading.Tasks; +using Authentication.OAuth2; using Azure; using Azure.Core; using Azure.Identity; @@ -23,8 +21,8 @@ public class Samples_OAuth2Client [Ignore("Only validating compilation of examples")] public void Example_Valid() { - var credential = new DefaultAzureCredential(); - var client = new OAuth2Client(credential); + TokenCredential credential = new DefaultAzureCredential(); + OAuth2Client client = new OAuth2Client(credential); Response response = client.Valid(); Console.WriteLine(response.Status); @@ -34,8 +32,8 @@ public void Example_Valid() [Ignore("Only validating compilation of examples")] public void Example_Valid_AllParameters() { - var credential = new DefaultAzureCredential(); - var client = new OAuth2Client(credential); + TokenCredential credential = new DefaultAzureCredential(); + OAuth2Client client = new OAuth2Client(credential); Response response = client.Valid(); Console.WriteLine(response.Status); @@ -45,8 +43,8 @@ public void Example_Valid_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_Valid_Async() { - var credential = new DefaultAzureCredential(); - var client = new OAuth2Client(credential); + TokenCredential credential = new DefaultAzureCredential(); + OAuth2Client client = new OAuth2Client(credential); Response response = await client.ValidAsync(); Console.WriteLine(response.Status); @@ -56,8 +54,8 @@ public async Task Example_Valid_Async() [Ignore("Only validating compilation of examples")] public async Task Example_Valid_AllParameters_Async() { - var credential = new DefaultAzureCredential(); - var client = new OAuth2Client(credential); + TokenCredential credential = new DefaultAzureCredential(); + OAuth2Client client = new OAuth2Client(credential); Response response = await client.ValidAsync(); Console.WriteLine(response.Status); @@ -67,8 +65,8 @@ public async Task Example_Valid_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_Invalid() { - var credential = new DefaultAzureCredential(); - var client = new OAuth2Client(credential); + TokenCredential credential = new DefaultAzureCredential(); + OAuth2Client client = new OAuth2Client(credential); Response response = client.Invalid(); Console.WriteLine(response.Status); @@ -78,8 +76,8 @@ public void Example_Invalid() [Ignore("Only validating compilation of examples")] public void Example_Invalid_AllParameters() { - var credential = new DefaultAzureCredential(); - var client = new OAuth2Client(credential); + TokenCredential credential = new DefaultAzureCredential(); + OAuth2Client client = new OAuth2Client(credential); Response response = client.Invalid(); Console.WriteLine(response.Status); @@ -89,8 +87,8 @@ public void Example_Invalid_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_Invalid_Async() { - var credential = new DefaultAzureCredential(); - var client = new OAuth2Client(credential); + TokenCredential credential = new DefaultAzureCredential(); + OAuth2Client client = new OAuth2Client(credential); Response response = await client.InvalidAsync(); Console.WriteLine(response.Status); @@ -100,8 +98,8 @@ public async Task Example_Invalid_Async() [Ignore("Only validating compilation of examples")] public async Task Example_Invalid_AllParameters_Async() { - var credential = new DefaultAzureCredential(); - var client = new OAuth2Client(credential); + TokenCredential credential = new DefaultAzureCredential(); + OAuth2Client client = new OAuth2Client(credential); Response response = await client.InvalidAsync(); Console.WriteLine(response.Status); diff --git a/test/CadlRanchProjects/authentication/union/src/Generated/Docs/UnionClient.xml b/test/CadlRanchProjects/authentication/union/src/Generated/Docs/UnionClient.xml index 12fb0091009..01240117b32 100644 --- a/test/CadlRanchProjects/authentication/union/src/Generated/Docs/UnionClient.xml +++ b/test/CadlRanchProjects/authentication/union/src/Generated/Docs/UnionClient.xml @@ -2,52 +2,80 @@ - + This sample shows how to call ValidKeyAsync. "); -var client = new UnionClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +UnionClient client = new UnionClient(credential); Response response = await client.ValidKeyAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call ValidKeyAsync with all request content. +"); +UnionClient client = new UnionClient(credential); + +Response response = await client.ValidKeyAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call ValidKey. "); -var client = new UnionClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +UnionClient client = new UnionClient(credential); Response response = client.ValidKey(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call ValidKey with all request content. +"); +UnionClient client = new UnionClient(credential); + +Response response = client.ValidKey(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call ValidTokenAsync. "); -var client = new UnionClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +UnionClient client = new UnionClient(credential); Response response = await client.ValidTokenAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call ValidTokenAsync with all request content. +"); +UnionClient client = new UnionClient(credential); + +Response response = await client.ValidTokenAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call ValidToken. "); -var client = new UnionClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +UnionClient client = new UnionClient(credential); Response response = client.ValidToken(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call ValidToken with all request content. +"); +UnionClient client = new UnionClient(credential); + +Response response = client.ValidToken(); +Console.WriteLine(response.Status); +]]> \ No newline at end of file diff --git a/test/CadlRanchProjects/authentication/union/tests/Generated/Samples/Samples_UnionClient.cs b/test/CadlRanchProjects/authentication/union/tests/Generated/Samples/Samples_UnionClient.cs index b42ff85dc87..766bcda4167 100644 --- a/test/CadlRanchProjects/authentication/union/tests/Generated/Samples/Samples_UnionClient.cs +++ b/test/CadlRanchProjects/authentication/union/tests/Generated/Samples/Samples_UnionClient.cs @@ -6,12 +6,9 @@ #nullable disable using System; -using System.Collections.Generic; -using System.IO; -using System.Text.Json; using System.Threading.Tasks; +using Authentication.Union; using Azure; -using Azure.Core; using Azure.Identity; using NUnit.Framework; @@ -23,8 +20,8 @@ public class Samples_UnionClient [Ignore("Only validating compilation of examples")] public void Example_ValidKey() { - var credential = new AzureKeyCredential(""); - var client = new UnionClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + UnionClient client = new UnionClient(credential); Response response = client.ValidKey(); Console.WriteLine(response.Status); @@ -34,8 +31,8 @@ public void Example_ValidKey() [Ignore("Only validating compilation of examples")] public void Example_ValidKey_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new UnionClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + UnionClient client = new UnionClient(credential); Response response = client.ValidKey(); Console.WriteLine(response.Status); @@ -45,8 +42,8 @@ public void Example_ValidKey_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_ValidKey_Async() { - var credential = new AzureKeyCredential(""); - var client = new UnionClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + UnionClient client = new UnionClient(credential); Response response = await client.ValidKeyAsync(); Console.WriteLine(response.Status); @@ -56,8 +53,8 @@ public async Task Example_ValidKey_Async() [Ignore("Only validating compilation of examples")] public async Task Example_ValidKey_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new UnionClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + UnionClient client = new UnionClient(credential); Response response = await client.ValidKeyAsync(); Console.WriteLine(response.Status); @@ -67,8 +64,8 @@ public async Task Example_ValidKey_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_ValidToken() { - var credential = new AzureKeyCredential(""); - var client = new UnionClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + UnionClient client = new UnionClient(credential); Response response = client.ValidToken(); Console.WriteLine(response.Status); @@ -78,8 +75,8 @@ public void Example_ValidToken() [Ignore("Only validating compilation of examples")] public void Example_ValidToken_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new UnionClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + UnionClient client = new UnionClient(credential); Response response = client.ValidToken(); Console.WriteLine(response.Status); @@ -89,8 +86,8 @@ public void Example_ValidToken_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_ValidToken_Async() { - var credential = new AzureKeyCredential(""); - var client = new UnionClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + UnionClient client = new UnionClient(credential); Response response = await client.ValidTokenAsync(); Console.WriteLine(response.Status); @@ -100,8 +97,8 @@ public async Task Example_ValidToken_Async() [Ignore("Only validating compilation of examples")] public async Task Example_ValidToken_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new UnionClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + UnionClient client = new UnionClient(credential); Response response = await client.ValidTokenAsync(); Console.WriteLine(response.Status); diff --git a/test/CadlRanchProjects/azure/client-generator-core/internal/src/Generated/Docs/InternalClient.xml b/test/CadlRanchProjects/azure/client-generator-core/internal/src/Generated/Docs/InternalClient.xml index be41567586f..dcb3c0891ea 100644 --- a/test/CadlRanchProjects/azure/client-generator-core/internal/src/Generated/Docs/InternalClient.xml +++ b/test/CadlRanchProjects/azure/client-generator-core/internal/src/Generated/Docs/InternalClient.xml @@ -2,58 +2,80 @@ - -This sample shows how to call PublicOnlyAsync with required parameters. + +This sample shows how to call PublicOnlyAsync. "); +Response response = await client.PublicOnlyAsync(""); ]]> - +This sample shows how to call PublicOnlyAsync with all parameters. + response = await client.PublicOnlyAsync(""); +]]> - -This sample shows how to call PublicOnly with required parameters. + +This sample shows how to call PublicOnly. "); +Response response = client.PublicOnly(""); ]]> - +This sample shows how to call PublicOnly with all parameters. + response = client.PublicOnly(""); +]]> - -This sample shows how to call PublicOnlyAsync with required parameters and parse the result. + +This sample shows how to call PublicOnlyAsync and parse the result. ", new RequestContext()); +Response response = await client.PublicOnlyAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); ]]> - +This sample shows how to call PublicOnlyAsync with all parameters and parse the result. +", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +]]> - -This sample shows how to call PublicOnly with required parameters and parse the result. + +This sample shows how to call PublicOnly and parse the result. ", new RequestContext()); +Response response = client.PublicOnly("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); ]]> - - - - - - - - - +This sample shows how to call PublicOnly with all parameters and parse the result. +", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +]]> + + + + \ No newline at end of file diff --git a/test/CadlRanchProjects/azure/client-generator-core/internal/src/Generated/Docs/Shared.xml b/test/CadlRanchProjects/azure/client-generator-core/internal/src/Generated/Docs/Shared.xml index 3485cc2b788..d403f42cd9a 100644 --- a/test/CadlRanchProjects/azure/client-generator-core/internal/src/Generated/Docs/Shared.xml +++ b/test/CadlRanchProjects/azure/client-generator-core/internal/src/Generated/Docs/Shared.xml @@ -2,58 +2,80 @@ - -This sample shows how to call PublicAsync with required parameters. + +This sample shows how to call PublicAsync. "); +Response response = await client.PublicAsync(""); ]]> - +This sample shows how to call PublicAsync with all parameters. + response = await client.PublicAsync(""); +]]> - -This sample shows how to call Public with required parameters. + +This sample shows how to call Public. "); +Response response = client.Public(""); ]]> - +This sample shows how to call Public with all parameters. + response = client.Public(""); +]]> - -This sample shows how to call PublicAsync with required parameters and parse the result. + +This sample shows how to call PublicAsync and parse the result. ", new RequestContext()); +Response response = await client.PublicAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); ]]> - +This sample shows how to call PublicAsync with all parameters and parse the result. +", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +]]> - -This sample shows how to call Public with required parameters and parse the result. + +This sample shows how to call Public and parse the result. ", new RequestContext()); +Response response = client.Public("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); ]]> - - - - - - - - - +This sample shows how to call Public with all parameters and parse the result. +", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +]]> + + + + \ No newline at end of file diff --git a/test/CadlRanchProjects/azure/client-generator-core/internal/tests/Generated/Samples/Samples_InternalClient.cs b/test/CadlRanchProjects/azure/client-generator-core/internal/tests/Generated/Samples/Samples_InternalClient.cs index a705625bbb2..c3c3ff20a1d 100644 --- a/test/CadlRanchProjects/azure/client-generator-core/internal/tests/Generated/Samples/Samples_InternalClient.cs +++ b/test/CadlRanchProjects/azure/client-generator-core/internal/tests/Generated/Samples/Samples_InternalClient.cs @@ -6,14 +6,12 @@ #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; +using _Specs_.Azure.ClientGenerator.Core.Internal; using _Specs_.Azure.ClientGenerator.Core.Internal.Models; namespace _Specs_.Azure.ClientGenerator.Core.Internal.Samples @@ -24,9 +22,9 @@ public class Samples_InternalClient [Ignore("Only validating compilation of examples")] public void Example_PublicOnly() { - var client = new InternalClient(); + InternalClient client = new InternalClient(); - Response response = client.PublicOnly("", new RequestContext()); + Response response = client.PublicOnly("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -36,21 +34,39 @@ public void Example_PublicOnly() [Ignore("Only validating compilation of examples")] public void Example_PublicOnly_AllParameters() { - var client = new InternalClient(); + InternalClient client = new InternalClient(); - Response response = client.PublicOnly("", new RequestContext()); + Response response = client.PublicOnly("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_PublicOnly_Convenience() + { + InternalClient client = new InternalClient(); + + Response response = client.PublicOnly(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_PublicOnly_AllParameters_Convenience() + { + InternalClient client = new InternalClient(); + + Response response = client.PublicOnly(""); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task Example_PublicOnly_Async() { - var client = new InternalClient(); + InternalClient client = new InternalClient(); - Response response = await client.PublicOnlyAsync("", new RequestContext()); + Response response = await client.PublicOnlyAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -60,9 +76,9 @@ public async Task Example_PublicOnly_Async() [Ignore("Only validating compilation of examples")] public async Task Example_PublicOnly_AllParameters_Async() { - var client = new InternalClient(); + InternalClient client = new InternalClient(); - Response response = await client.PublicOnlyAsync("", new RequestContext()); + Response response = await client.PublicOnlyAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -72,9 +88,18 @@ public async Task Example_PublicOnly_AllParameters_Async() [Ignore("Only validating compilation of examples")] public async Task Example_PublicOnly_Convenience_Async() { - var client = new InternalClient(); + InternalClient client = new InternalClient(); + + Response response = await client.PublicOnlyAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_PublicOnly_AllParameters_Convenience_Async() + { + InternalClient client = new InternalClient(); - var result = await client.PublicOnlyAsync(""); + Response response = await client.PublicOnlyAsync(""); } } } diff --git a/test/CadlRanchProjects/azure/client-generator-core/internal/tests/Generated/Samples/Samples_Shared.cs b/test/CadlRanchProjects/azure/client-generator-core/internal/tests/Generated/Samples/Samples_Shared.cs index e8e001ae602..0a121cf2d6c 100644 --- a/test/CadlRanchProjects/azure/client-generator-core/internal/tests/Generated/Samples/Samples_Shared.cs +++ b/test/CadlRanchProjects/azure/client-generator-core/internal/tests/Generated/Samples/Samples_Shared.cs @@ -6,14 +6,12 @@ #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; +using _Specs_.Azure.ClientGenerator.Core.Internal; using _Specs_.Azure.ClientGenerator.Core.Internal.Models; namespace _Specs_.Azure.ClientGenerator.Core.Internal.Samples @@ -24,9 +22,9 @@ internal class Samples_Shared [Ignore("Only validating compilation of examples")] public void Example_Public() { - var client = new InternalClient().GetSharedClient(); + Shared client = new InternalClient().GetSharedClient(); - Response response = client.Public("", new RequestContext()); + Response response = client.Public("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -36,21 +34,39 @@ public void Example_Public() [Ignore("Only validating compilation of examples")] public void Example_Public_AllParameters() { - var client = new InternalClient().GetSharedClient(); + Shared client = new InternalClient().GetSharedClient(); - Response response = client.Public("", new RequestContext()); + Response response = client.Public("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Public_Convenience() + { + Shared client = new InternalClient().GetSharedClient(); + + Response response = client.Public(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Public_AllParameters_Convenience() + { + Shared client = new InternalClient().GetSharedClient(); + + Response response = client.Public(""); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task Example_Public_Async() { - var client = new InternalClient().GetSharedClient(); + Shared client = new InternalClient().GetSharedClient(); - Response response = await client.PublicAsync("", new RequestContext()); + Response response = await client.PublicAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -60,9 +76,9 @@ public async Task Example_Public_Async() [Ignore("Only validating compilation of examples")] public async Task Example_Public_AllParameters_Async() { - var client = new InternalClient().GetSharedClient(); + Shared client = new InternalClient().GetSharedClient(); - Response response = await client.PublicAsync("", new RequestContext()); + Response response = await client.PublicAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -72,9 +88,18 @@ public async Task Example_Public_AllParameters_Async() [Ignore("Only validating compilation of examples")] public async Task Example_Public_Convenience_Async() { - var client = new InternalClient().GetSharedClient(); + Shared client = new InternalClient().GetSharedClient(); + + Response response = await client.PublicAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Public_AllParameters_Convenience_Async() + { + Shared client = new InternalClient().GetSharedClient(); - var result = await client.PublicAsync(""); + Response response = await client.PublicAsync(""); } } } diff --git a/test/CadlRanchProjects/azure/core/basic/src/Generated/Docs/BasicClient.xml b/test/CadlRanchProjects/azure/core/basic/src/Generated/Docs/BasicClient.xml index 673b2dc0794..7a60be96d7d 100644 --- a/test/CadlRanchProjects/azure/core/basic/src/Generated/Docs/BasicClient.xml +++ b/test/CadlRanchProjects/azure/core/basic/src/Generated/Docs/BasicClient.xml @@ -2,37 +2,39 @@ - -This sample shows how to call CreateOrUpdateAsync with required parameters and request content, and how to parse the result. + +This sample shows how to call CreateOrUpdateAsync and parse the result. ", -}; - -Response response = await client.CreateOrUpdateAsync(1234, RequestContent.Create(data)); +}); +Response response = await client.CreateOrUpdateAsync(1234, content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); ]]> -This sample shows how to call CreateOrUpdateAsync with all parameters and request content, and how to parse the result. +This sample shows how to call CreateOrUpdateAsync with all parameters and request content and parse the result. ", - orders = new[] { - new { + orders = new List() + { + new + { userId = 1234, detail = "", } }, -}; - -Response response = await client.CreateOrUpdateAsync(1234, RequestContent.Create(data)); +}); +Response response = await client.CreateOrUpdateAsync(1234, content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -41,41 +43,42 @@ Console.WriteLine(result.GetProperty("orders")[0].GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("orders")[0].GetProperty("userId").ToString()); Console.WriteLine(result.GetProperty("orders")[0].GetProperty("detail").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); -]]> - +]]> - -This sample shows how to call CreateOrUpdate with required parameters and request content, and how to parse the result. + +This sample shows how to call CreateOrUpdate and parse the result. ", -}; - -Response response = client.CreateOrUpdate(1234, RequestContent.Create(data)); +}); +Response response = client.CreateOrUpdate(1234, content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); ]]> -This sample shows how to call CreateOrUpdate with all parameters and request content, and how to parse the result. +This sample shows how to call CreateOrUpdate with all parameters and request content and parse the result. ", - orders = new[] { - new { + orders = new List() + { + new + { userId = 1234, detail = "", } }, -}; - -Response response = client.CreateOrUpdate(1234, RequestContent.Create(data)); +}); +Response response = client.CreateOrUpdate(1234, content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -84,75 +87,88 @@ Console.WriteLine(result.GetProperty("orders")[0].GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("orders")[0].GetProperty("userId").ToString()); Console.WriteLine(result.GetProperty("orders")[0].GetProperty("detail").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); -]]> - +]]> - -This sample shows how to call CreateOrReplaceAsync with required parameters. + +This sample shows how to call CreateOrReplaceAsync. ") -{ - Orders = +User resource = new User(""); +Response response = await client.CreateOrReplaceAsync(1234, resource); +]]> +This sample shows how to call CreateOrReplaceAsync with all parameters. +") { - new UserOrder(1234, "") + Orders = + { + new UserOrder(1234,"") }, }; -var result = await client.CreateOrReplaceAsync(1234, resource); -]]> - +Response response = await client.CreateOrReplaceAsync(1234, resource); +]]> - -This sample shows how to call CreateOrReplace with required parameters. + +This sample shows how to call CreateOrReplace. ") -{ - Orders = +User resource = new User(""); +Response response = client.CreateOrReplace(1234, resource); +]]> +This sample shows how to call CreateOrReplace with all parameters. +") { - new UserOrder(1234, "") + Orders = + { + new UserOrder(1234,"") }, }; -var result = client.CreateOrReplace(1234, resource); -]]> - +Response response = client.CreateOrReplace(1234, resource); +]]> - -This sample shows how to call CreateOrReplaceAsync with required parameters and request content, and how to parse the result. + +This sample shows how to call CreateOrReplaceAsync and parse the result. ", -}; - -Response response = await client.CreateOrReplaceAsync(1234, RequestContent.Create(data)); +}); +Response response = await client.CreateOrReplaceAsync(1234, content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); ]]> -This sample shows how to call CreateOrReplaceAsync with all parameters and request content, and how to parse the result. +This sample shows how to call CreateOrReplaceAsync with all parameters and request content and parse the result. ", - orders = new[] { - new { + orders = new List() + { + new + { userId = 1234, detail = "", } }, -}; - -Response response = await client.CreateOrReplaceAsync(1234, RequestContent.Create(data)); +}); +Response response = await client.CreateOrReplaceAsync(1234, content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -161,41 +177,42 @@ Console.WriteLine(result.GetProperty("orders")[0].GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("orders")[0].GetProperty("userId").ToString()); Console.WriteLine(result.GetProperty("orders")[0].GetProperty("detail").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); -]]> - +]]> - -This sample shows how to call CreateOrReplace with required parameters and request content, and how to parse the result. + +This sample shows how to call CreateOrReplace and parse the result. ", -}; - -Response response = client.CreateOrReplace(1234, RequestContent.Create(data)); +}); +Response response = client.CreateOrReplace(1234, content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); ]]> -This sample shows how to call CreateOrReplace with all parameters and request content, and how to parse the result. +This sample shows how to call CreateOrReplace with all parameters and request content and parse the result. ", - orders = new[] { - new { + orders = new List() + { + new + { userId = 1234, detail = "", } }, -}; - -Response response = client.CreateOrReplace(1234, RequestContent.Create(data)); +}); +Response response = client.CreateOrReplace(1234, content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -204,36 +221,56 @@ Console.WriteLine(result.GetProperty("orders")[0].GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("orders")[0].GetProperty("userId").ToString()); Console.WriteLine(result.GetProperty("orders")[0].GetProperty("detail").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); -]]> - +]]> - -This sample shows how to call GetUserAsync with required parameters. + +This sample shows how to call GetUserAsync. response = await client.GetUserAsync(1234); ]]> - +This sample shows how to call GetUserAsync with all parameters. + response = await client.GetUserAsync(1234); +]]> - -This sample shows how to call GetUser with required parameters. + +This sample shows how to call GetUser. response = client.GetUser(1234); ]]> - +This sample shows how to call GetUser with all parameters. + response = client.GetUser(1234); +]]> - -This sample shows how to call GetUserAsync with required parameters and parse the result. + +This sample shows how to call GetUserAsync and parse the result. + +This sample shows how to call GetUserAsync with all parameters and parse the result. - +]]> - -This sample shows how to call GetUser with required parameters and parse the result. + +This sample shows how to call GetUser and parse the result. + +This sample shows how to call GetUser with all parameters and parse the result. - +]]> - -This sample shows how to call DeleteAsync with required parameters. + +This sample shows how to call DeleteAsync. - +This sample shows how to call DeleteAsync with all parameters. + - -This sample shows how to call Delete with required parameters. + +This sample shows how to call Delete. - +This sample shows how to call Delete with all parameters. + - -This sample shows how to call ExportAsync with required parameters. + +This sample shows how to call ExportAsync. "); +Response response = await client.ExportAsync(1234, ""); ]]> - +This sample shows how to call ExportAsync with all parameters. + response = await client.ExportAsync(1234, ""); +]]> - -This sample shows how to call Export with required parameters. + +This sample shows how to call Export. "); +Response response = client.Export(1234, ""); ]]> - +This sample shows how to call Export with all parameters. + response = client.Export(1234, ""); +]]> - -This sample shows how to call ExportAsync with required parameters and parse the result. + +This sample shows how to call ExportAsync and parse the result. +", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("etag").ToString()); +]]> +This sample shows how to call ExportAsync with all parameters and parse the result. ", new RequestContext()); +Response response = await client.ExportAsync(1234, "", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -320,16 +399,26 @@ Console.WriteLine(result.GetProperty("orders")[0].GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("orders")[0].GetProperty("userId").ToString()); Console.WriteLine(result.GetProperty("orders")[0].GetProperty("detail").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); -]]> - +]]> - -This sample shows how to call Export with required parameters and parse the result. + +This sample shows how to call Export and parse the result. +", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("etag").ToString()); +]]> +This sample shows how to call Export with all parameters and parse the result. ", new RequestContext()); +Response response = client.Export(1234, "", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -338,194 +427,337 @@ Console.WriteLine(result.GetProperty("orders")[0].GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("orders")[0].GetProperty("userId").ToString()); Console.WriteLine(result.GetProperty("orders")[0].GetProperty("detail").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); -]]> - +]]> - -This sample shows how to call GetUsersAsync with required parameters. + +This sample shows how to call GetUsersAsync. "}, "", new String[]{"" +}, expand: new List() +{ + "" +})) +{ +} +]]> - -This sample shows how to call GetUsers with required parameters. + +This sample shows how to call GetUsers. "}, "", new String[]{"" +}, expand: new List() +{ + "" +})) +{ +} +]]> - -This sample shows how to call GetUsersAsync with required parameters and parse the result. + +This sample shows how to call GetUsersAsync and parse the result. "}, "", new String[]{"" +}, new List() +{ + "" +}, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("orders")[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("orders")[0].GetProperty("userId").ToString()); + Console.WriteLine(result[0].GetProperty("orders")[0].GetProperty("detail").ToString()); + Console.WriteLine(result[0].GetProperty("etag").ToString()); +} +]]> - -This sample shows how to call GetUsers with required parameters and parse the result. + +This sample shows how to call GetUsers and parse the result. "}, "", new String[]{"" +}, new List() +{ + "" +}, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("orders")[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("orders")[0].GetProperty("userId").ToString()); + Console.WriteLine(result[0].GetProperty("orders")[0].GetProperty("detail").ToString()); + Console.WriteLine(result[0].GetProperty("etag").ToString()); +} +]]> - + This sample shows how to call GetWithPageAsync. - +This sample shows how to call GetWithPageAsync with all parameters. + - + This sample shows how to call GetWithPage. - +This sample shows how to call GetWithPage with all parameters. + - -This sample shows how to call GetWithPageAsync with required parameters and parse the result. + +This sample shows how to call GetWithPageAsync and parse the result. - +This sample shows how to call GetWithPageAsync with all parameters and parse the result. + - -This sample shows how to call GetWithPage with required parameters and parse the result. + +This sample shows how to call GetWithPage and parse the result. - +This sample shows how to call GetWithPage with all parameters and parse the result. + - + This sample shows how to call GetWithCustomPageModelAsync. - +This sample shows how to call GetWithCustomPageModelAsync with all parameters. + - + This sample shows how to call GetWithCustomPageModel. - +This sample shows how to call GetWithCustomPageModel with all parameters. + - -This sample shows how to call GetWithCustomPageModelAsync with required parameters and parse the result. + +This sample shows how to call GetWithCustomPageModelAsync and parse the result. - +This sample shows how to call GetWithCustomPageModelAsync with all parameters and parse the result. + - -This sample shows how to call GetWithCustomPageModel with required parameters and parse the result. + +This sample shows how to call GetWithCustomPageModel and parse the result. - +This sample shows how to call GetWithCustomPageModel with all parameters and parse the result. + \ No newline at end of file diff --git a/test/CadlRanchProjects/azure/core/basic/tests/Generated/Samples/Samples_BasicClient.cs b/test/CadlRanchProjects/azure/core/basic/tests/Generated/Samples/Samples_BasicClient.cs index d531f68b3e4..72bd2682ce5 100644 --- a/test/CadlRanchProjects/azure/core/basic/tests/Generated/Samples/Samples_BasicClient.cs +++ b/test/CadlRanchProjects/azure/core/basic/tests/Generated/Samples/Samples_BasicClient.cs @@ -7,13 +7,13 @@ 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; +using _Specs_.Azure.Core.Basic; using _Specs_.Azure.Core.Basic.Models; namespace _Specs_.Azure.Core.Basic.Samples @@ -24,14 +24,13 @@ public class Samples_BasicClient [Ignore("Only validating compilation of examples")] public void Example_CreateOrUpdate() { - var client = new BasicClient(); + BasicClient client = new BasicClient(); - var data = new + RequestContent content = RequestContent.Create(new { name = "", - }; - - Response response = client.CreateOrUpdate(1234, RequestContent.Create(data)); + }); + Response response = client.CreateOrUpdate(1234, content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -43,20 +42,21 @@ public void Example_CreateOrUpdate() [Ignore("Only validating compilation of examples")] public void Example_CreateOrUpdate_AllParameters() { - var client = new BasicClient(); + BasicClient client = new BasicClient(); - var data = new + RequestContent content = RequestContent.Create(new { name = "", - orders = new[] { - new { - userId = 1234, - detail = "", - } - }, - }; - - Response response = client.CreateOrUpdate(1234, RequestContent.Create(data)); + orders = new List() +{ +new +{ +userId = 1234, +detail = "", +} +}, + }); + Response response = client.CreateOrUpdate(1234, content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -71,14 +71,13 @@ public void Example_CreateOrUpdate_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_CreateOrUpdate_Async() { - var client = new BasicClient(); + BasicClient client = new BasicClient(); - var data = new + RequestContent content = RequestContent.Create(new { name = "", - }; - - Response response = await client.CreateOrUpdateAsync(1234, RequestContent.Create(data)); + }); + Response response = await client.CreateOrUpdateAsync(1234, content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -90,20 +89,21 @@ public async Task Example_CreateOrUpdate_Async() [Ignore("Only validating compilation of examples")] public async Task Example_CreateOrUpdate_AllParameters_Async() { - var client = new BasicClient(); + BasicClient client = new BasicClient(); - var data = new + RequestContent content = RequestContent.Create(new { name = "", - orders = new[] { - new { - userId = 1234, - detail = "", - } - }, - }; - - Response response = await client.CreateOrUpdateAsync(1234, RequestContent.Create(data)); + orders = new List() +{ +new +{ +userId = 1234, +detail = "", +} +}, + }); + Response response = await client.CreateOrUpdateAsync(1234, content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -118,14 +118,13 @@ public async Task Example_CreateOrUpdate_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_CreateOrReplace() { - var client = new BasicClient(); + BasicClient client = new BasicClient(); - var data = new + RequestContent content = RequestContent.Create(new { name = "", - }; - - Response response = client.CreateOrReplace(1234, RequestContent.Create(data)); + }); + Response response = client.CreateOrReplace(1234, content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -137,20 +136,21 @@ public void Example_CreateOrReplace() [Ignore("Only validating compilation of examples")] public void Example_CreateOrReplace_AllParameters() { - var client = new BasicClient(); + BasicClient client = new BasicClient(); - var data = new + RequestContent content = RequestContent.Create(new { name = "", - orders = new[] { - new { - userId = 1234, - detail = "", - } - }, - }; - - Response response = client.CreateOrReplace(1234, RequestContent.Create(data)); + orders = new List() +{ +new +{ +userId = 1234, +detail = "", +} +}, + }); + Response response = client.CreateOrReplace(1234, content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -163,16 +163,41 @@ public void Example_CreateOrReplace_AllParameters() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_CreateOrReplace_Async() + public void Example_CreateOrReplace_Convenience() { - var client = new BasicClient(); + BasicClient client = new BasicClient(); - var data = new + User resource = new User(""); + Response response = client.CreateOrReplace(1234, resource); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CreateOrReplace_AllParameters_Convenience() + { + BasicClient client = new BasicClient(); + + User resource = new User("") { - name = "", + Orders = +{ +new UserOrder(1234,"") +}, }; + Response response = client.CreateOrReplace(1234, resource); + } - Response response = await client.CreateOrReplaceAsync(1234, RequestContent.Create(data)); + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CreateOrReplace_Async() + { + BasicClient client = new BasicClient(); + + RequestContent content = RequestContent.Create(new + { + name = "", + }); + Response response = await client.CreateOrReplaceAsync(1234, content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -184,20 +209,21 @@ public async Task Example_CreateOrReplace_Async() [Ignore("Only validating compilation of examples")] public async Task Example_CreateOrReplace_AllParameters_Async() { - var client = new BasicClient(); + BasicClient client = new BasicClient(); - var data = new + RequestContent content = RequestContent.Create(new { name = "", - orders = new[] { - new { - userId = 1234, - detail = "", - } - }, - }; - - Response response = await client.CreateOrReplaceAsync(1234, RequestContent.Create(data)); + orders = new List() +{ +new +{ +userId = 1234, +detail = "", +} +}, + }); + Response response = await client.CreateOrReplaceAsync(1234, content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -212,25 +238,35 @@ public async Task Example_CreateOrReplace_AllParameters_Async() [Ignore("Only validating compilation of examples")] public async Task Example_CreateOrReplace_Convenience_Async() { - var client = new BasicClient(); + BasicClient client = new BasicClient(); + + User resource = new User(""); + Response response = await client.CreateOrReplaceAsync(1234, resource); + } - var resource = new User("") + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CreateOrReplace_AllParameters_Convenience_Async() + { + BasicClient client = new BasicClient(); + + User resource = new User("") { Orders = { - new UserOrder(1234, "") - }, +new UserOrder(1234,"") +}, }; - var result = await client.CreateOrReplaceAsync(1234, resource); + Response response = await client.CreateOrReplaceAsync(1234, resource); } [Test] [Ignore("Only validating compilation of examples")] public void Example_GetUser() { - var client = new BasicClient(); + BasicClient client = new BasicClient(); - Response response = client.GetUser(1234, new RequestContext()); + Response response = client.GetUser(1234, null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -242,9 +278,9 @@ public void Example_GetUser() [Ignore("Only validating compilation of examples")] public void Example_GetUser_AllParameters() { - var client = new BasicClient(); + BasicClient client = new BasicClient(); - Response response = client.GetUser(1234, new RequestContext()); + Response response = client.GetUser(1234, null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -255,13 +291,31 @@ public void Example_GetUser_AllParameters() Console.WriteLine(result.GetProperty("etag").ToString()); } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetUser_Convenience() + { + BasicClient client = new BasicClient(); + + Response response = client.GetUser(1234); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetUser_AllParameters_Convenience() + { + BasicClient client = new BasicClient(); + + Response response = client.GetUser(1234); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task Example_GetUser_Async() { - var client = new BasicClient(); + BasicClient client = new BasicClient(); - Response response = await client.GetUserAsync(1234, new RequestContext()); + Response response = await client.GetUserAsync(1234, null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -273,9 +327,9 @@ public async Task Example_GetUser_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetUser_AllParameters_Async() { - var client = new BasicClient(); + BasicClient client = new BasicClient(); - Response response = await client.GetUserAsync(1234, new RequestContext()); + Response response = await client.GetUserAsync(1234, null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -290,16 +344,25 @@ public async Task Example_GetUser_AllParameters_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetUser_Convenience_Async() { - var client = new BasicClient(); + BasicClient client = new BasicClient(); - var result = await client.GetUserAsync(1234); + Response response = await client.GetUserAsync(1234); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetUser_AllParameters_Convenience_Async() + { + BasicClient client = new BasicClient(); + + Response response = await client.GetUserAsync(1234); } [Test] [Ignore("Only validating compilation of examples")] public void Example_Delete() { - var client = new BasicClient(); + BasicClient client = new BasicClient(); Response response = client.Delete(1234); Console.WriteLine(response.Status); @@ -309,7 +372,7 @@ public void Example_Delete() [Ignore("Only validating compilation of examples")] public void Example_Delete_AllParameters() { - var client = new BasicClient(); + BasicClient client = new BasicClient(); Response response = client.Delete(1234); Console.WriteLine(response.Status); @@ -319,7 +382,7 @@ public void Example_Delete_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_Delete_Async() { - var client = new BasicClient(); + BasicClient client = new BasicClient(); Response response = await client.DeleteAsync(1234); Console.WriteLine(response.Status); @@ -329,7 +392,7 @@ public async Task Example_Delete_Async() [Ignore("Only validating compilation of examples")] public async Task Example_Delete_AllParameters_Async() { - var client = new BasicClient(); + BasicClient client = new BasicClient(); Response response = await client.DeleteAsync(1234); Console.WriteLine(response.Status); @@ -339,9 +402,9 @@ public async Task Example_Delete_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_Export() { - var client = new BasicClient(); + BasicClient client = new BasicClient(); - Response response = client.Export(1234, "", new RequestContext()); + Response response = client.Export(1234, "", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -353,9 +416,9 @@ public void Example_Export() [Ignore("Only validating compilation of examples")] public void Example_Export_AllParameters() { - var client = new BasicClient(); + BasicClient client = new BasicClient(); - Response response = client.Export(1234, "", new RequestContext()); + Response response = client.Export(1234, "", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -366,13 +429,31 @@ public void Example_Export_AllParameters() Console.WriteLine(result.GetProperty("etag").ToString()); } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Export_Convenience() + { + BasicClient client = new BasicClient(); + + Response response = client.Export(1234, ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Export_AllParameters_Convenience() + { + BasicClient client = new BasicClient(); + + Response response = client.Export(1234, ""); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task Example_Export_Async() { - var client = new BasicClient(); + BasicClient client = new BasicClient(); - Response response = await client.ExportAsync(1234, "", new RequestContext()); + Response response = await client.ExportAsync(1234, "", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -384,9 +465,9 @@ public async Task Example_Export_Async() [Ignore("Only validating compilation of examples")] public async Task Example_Export_AllParameters_Async() { - var client = new BasicClient(); + BasicClient client = new BasicClient(); - Response response = await client.ExportAsync(1234, "", new RequestContext()); + Response response = await client.ExportAsync(1234, "", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -401,23 +482,32 @@ public async Task Example_Export_AllParameters_Async() [Ignore("Only validating compilation of examples")] public async Task Example_Export_Convenience_Async() { - var client = new BasicClient(); + BasicClient client = new BasicClient(); + + Response response = await client.ExportAsync(1234, ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Export_AllParameters_Convenience_Async() + { + BasicClient client = new BasicClient(); - var result = await client.ExportAsync(1234, ""); + Response response = await client.ExportAsync(1234, ""); } [Test] [Ignore("Only validating compilation of examples")] public void Example_GetUsers() { - var client = new BasicClient(); + BasicClient client = new BasicClient(); - foreach (var item in client.GetUsers(1234, 1234, 1234, new string[] { "" }, "", new string[] { "" }, new string[] { "" }, new RequestContext())) + foreach (BinaryData item in client.GetUsers(1234, 1234, 1234, new List() +{ +"" +}, "", new List() +{ +"" +}, expand: new List() +{ +"" +})) + { } } @@ -443,14 +573,14 @@ public void Example_GetUsers_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetUsers_Async() { - var client = new BasicClient(); + BasicClient client = new BasicClient(); - await foreach (var item in client.GetUsersAsync(1234, 1234, 1234, new string[] { "" }, "", new string[] { "" }, new string[] { "" }, new RequestContext())) + await foreach (BinaryData item in client.GetUsersAsync(1234, 1234, 1234, new List() +{ +"" +}, "", new List() +{ +"" }, new string[] { "" })) + await foreach (User item in client.GetUsersAsync(maxCount: 1234, skip: 1234, maxpagesize: 1234, orderby: new List() +{ +"" +}, filter: "", select: new List() +{ +""); +Response response = await client.ContentTypeWithEncodingAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> - -This sample shows how to call ContentTypeWithEncoding with required request content and parse the result. + +This sample shows how to call ContentTypeWithEncoding and parse the result. "); -var client = new MediaTypesClient(credential); - -var data = ""; +AzureKeyCredential credential = new AzureKeyCredential(""); +MediaTypesClient client = new MediaTypesClient(credential); -Response response = client.ContentTypeWithEncoding(RequestContent.Create(data)); +RequestContent content = null; +Response response = client.ContentTypeWithEncoding(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); ]]> - +This sample shows how to call ContentTypeWithEncoding with all request content and parse the result. +"); +MediaTypesClient client = new MediaTypesClient(credential); + +RequestContent content = RequestContent.Create(""); +Response response = client.ContentTypeWithEncoding(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> - -This sample shows how to call BinaryBodyWithTwoContentTypesAsync with required parameters and request content and parse the result. + +This sample shows how to call BinaryBodyWithTwoContentTypesAsync and parse the result. "); -var client = new MediaTypesClient(credential); - -var data = File.OpenRead(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +MediaTypesClient client = new MediaTypesClient(credential); -Response response = await client.BinaryBodyWithTwoContentTypesAsync(RequestContent.Create(data), ContentType.ApplicationOctetStream); +RequestContent content = RequestContent.Create(File.OpenRead("")); +Response response = await client.BinaryBodyWithTwoContentTypesAsync(content, new ContentType("application/json")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); ]]> - +This sample shows how to call BinaryBodyWithTwoContentTypesAsync with all parameters and request content and parse the result. +"); +MediaTypesClient client = new MediaTypesClient(credential); + +RequestContent content = RequestContent.Create(File.OpenRead("")); +Response response = await client.BinaryBodyWithTwoContentTypesAsync(content, new ContentType("application/json")); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> - -This sample shows how to call BinaryBodyWithTwoContentTypes with required parameters and request content and parse the result. + +This sample shows how to call BinaryBodyWithTwoContentTypes and parse the result. "); -var client = new MediaTypesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +MediaTypesClient client = new MediaTypesClient(credential); -var data = File.OpenRead(""); - -Response response = client.BinaryBodyWithTwoContentTypes(RequestContent.Create(data), ContentType.ApplicationOctetStream); +RequestContent content = RequestContent.Create(File.OpenRead("")); +Response response = client.BinaryBodyWithTwoContentTypes(content, new ContentType("application/json")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); ]]> - +This sample shows how to call BinaryBodyWithTwoContentTypes with all parameters and request content and parse the result. +"); +MediaTypesClient client = new MediaTypesClient(credential); + +RequestContent content = RequestContent.Create(File.OpenRead("")); +Response response = client.BinaryBodyWithTwoContentTypes(content, new ContentType("application/json")); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> - -This sample shows how to call BinaryBodyWithThreeContentTypesAsync with required parameters and request content and parse the result. + +This sample shows how to call BinaryBodyWithThreeContentTypesAsync and parse the result. "); -var client = new MediaTypesClient(credential); - -var data = File.OpenRead(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +MediaTypesClient client = new MediaTypesClient(credential); -Response response = await client.BinaryBodyWithThreeContentTypesAsync(RequestContent.Create(data), ContentType.ApplicationOctetStream); +RequestContent content = RequestContent.Create(File.OpenRead("")); +Response response = await client.BinaryBodyWithThreeContentTypesAsync(content, new ContentType("application/json")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); ]]> - +This sample shows how to call BinaryBodyWithThreeContentTypesAsync with all parameters and request content and parse the result. +"); +MediaTypesClient client = new MediaTypesClient(credential); + +RequestContent content = RequestContent.Create(File.OpenRead("")); +Response response = await client.BinaryBodyWithThreeContentTypesAsync(content, new ContentType("application/json")); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> - -This sample shows how to call BinaryBodyWithThreeContentTypes with required parameters and request content and parse the result. + +This sample shows how to call BinaryBodyWithThreeContentTypes and parse the result. "); -var client = new MediaTypesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +MediaTypesClient client = new MediaTypesClient(credential); -var data = File.OpenRead(""); - -Response response = client.BinaryBodyWithThreeContentTypes(RequestContent.Create(data), ContentType.ApplicationOctetStream); +RequestContent content = RequestContent.Create(File.OpenRead("")); +Response response = client.BinaryBodyWithThreeContentTypes(content, new ContentType("application/json")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); ]]> - +This sample shows how to call BinaryBodyWithThreeContentTypes with all parameters and request content and parse the result. +"); +MediaTypesClient client = new MediaTypesClient(credential); + +RequestContent content = RequestContent.Create(File.OpenRead("")); +Response response = client.BinaryBodyWithThreeContentTypes(content, new ContentType("application/json")); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> - -This sample shows how to call BodyThreeTypesAsync with required parameters and request content and parse the result. + +This sample shows how to call BodyThreeTypesAsync and parse the result. "); -var client = new MediaTypesClient(credential); - -var data = File.OpenRead(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +MediaTypesClient client = new MediaTypesClient(credential); -Response response = await client.BodyThreeTypesAsync(RequestContent.Create(data), ContentType.ApplicationOctetStream); +RequestContent content = RequestContent.Create(File.OpenRead("")); +Response response = await client.BodyThreeTypesAsync(content, new ContentType("application/octet-stream")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); ]]> - +This sample shows how to call BodyThreeTypesAsync with all parameters and request content and parse the result. +"); +MediaTypesClient client = new MediaTypesClient(credential); + +RequestContent content = RequestContent.Create(File.OpenRead("")); +Response response = await client.BodyThreeTypesAsync(content, new ContentType("application/octet-stream")); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> - -This sample shows how to call BodyThreeTypes with required parameters and request content and parse the result. + +This sample shows how to call BodyThreeTypes and parse the result. "); -var client = new MediaTypesClient(credential); - -var data = File.OpenRead(""); +AzureKeyCredential credential = new AzureKeyCredential(""); +MediaTypesClient client = new MediaTypesClient(credential); -Response response = client.BodyThreeTypes(RequestContent.Create(data), ContentType.ApplicationOctetStream); +RequestContent content = RequestContent.Create(File.OpenRead("")); +Response response = client.BodyThreeTypes(content, new ContentType("application/octet-stream")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); ]]> - +This sample shows how to call BodyThreeTypes with all parameters and request content and parse the result. +"); +MediaTypesClient client = new MediaTypesClient(credential); + +RequestContent content = RequestContent.Create(File.OpenRead("")); +Response response = client.BodyThreeTypes(content, new ContentType("application/octet-stream")); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> - -This sample shows how to call PutTextAndJsonBodyAsync with required parameters and request content and parse the result. + +This sample shows how to call PutTextAndJsonBodyAsync and parse the result. "); -var client = new MediaTypesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +MediaTypesClient client = new MediaTypesClient(credential); -var data = ""; - -Response response = await client.PutTextAndJsonBodyAsync(RequestContent.Create(data), ContentType.ApplicationOctetStream); +RequestContent content = RequestContent.Create(""); +Response response = await client.PutTextAndJsonBodyAsync(content, new ContentType("application/json")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); ]]> - +This sample shows how to call PutTextAndJsonBodyAsync with all parameters and request content and parse the result. +"); +MediaTypesClient client = new MediaTypesClient(credential); + +RequestContent content = RequestContent.Create(""); +Response response = await client.PutTextAndJsonBodyAsync(content, new ContentType("application/json")); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> - -This sample shows how to call PutTextAndJsonBody with required parameters and request content and parse the result. + +This sample shows how to call PutTextAndJsonBody and parse the result. "); -var client = new MediaTypesClient(credential); - -var data = ""; +AzureKeyCredential credential = new AzureKeyCredential(""); +MediaTypesClient client = new MediaTypesClient(credential); -Response response = client.PutTextAndJsonBody(RequestContent.Create(data), ContentType.ApplicationOctetStream); +RequestContent content = RequestContent.Create(""); +Response response = client.PutTextAndJsonBody(content, new ContentType("application/json")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); ]]> - +This sample shows how to call PutTextAndJsonBody with all parameters and request content and parse the result. +"); +MediaTypesClient client = new MediaTypesClient(credential); + +RequestContent content = RequestContent.Create(""); +Response response = client.PutTextAndJsonBody(content, new ContentType("application/json")); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> \ No newline at end of file diff --git a/test/TestServerProjectsLowLevel/media_types/tests/Generated/Samples/Samples_MediaTypesClient.cs b/test/TestServerProjectsLowLevel/media_types/tests/Generated/Samples/Samples_MediaTypesClient.cs index 0a389b0be8a..5403d21fcc4 100644 --- a/test/TestServerProjectsLowLevel/media_types/tests/Generated/Samples/Samples_MediaTypesClient.cs +++ b/test/TestServerProjectsLowLevel/media_types/tests/Generated/Samples/Samples_MediaTypesClient.cs @@ -6,7 +6,6 @@ #nullable disable using System; -using System.Collections.Generic; using System.IO; using System.Text.Json; using System.Threading.Tasks; @@ -14,6 +13,7 @@ using Azure.Core; using Azure.Identity; using NUnit.Framework; +using media_types_LowLevel; namespace media_types_LowLevel.Samples { @@ -23,12 +23,11 @@ public class Samples_MediaTypesClient [Ignore("Only validating compilation of examples")] public void Example_AnalyzeBody() { - var credential = new AzureKeyCredential(""); - var client = new MediaTypesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + MediaTypesClient client = new MediaTypesClient(credential); - var data = File.OpenRead(""); - - Response response = client.AnalyzeBody(RequestContent.Create(data), ContentType.ApplicationOctetStream); + RequestContent content = null; + Response response = client.AnalyzeBody(content, new ContentType("application/pdf")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -38,12 +37,11 @@ public void Example_AnalyzeBody() [Ignore("Only validating compilation of examples")] public void Example_AnalyzeBody_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new MediaTypesClient(credential); - - var data = File.OpenRead(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + MediaTypesClient client = new MediaTypesClient(credential); - Response response = client.AnalyzeBody(RequestContent.Create(data), ContentType.ApplicationOctetStream); + RequestContent content = RequestContent.Create(File.OpenRead("")); + Response response = client.AnalyzeBody(content, new ContentType("application/pdf")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -53,12 +51,11 @@ public void Example_AnalyzeBody_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_AnalyzeBody_Async() { - var credential = new AzureKeyCredential(""); - var client = new MediaTypesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + MediaTypesClient client = new MediaTypesClient(credential); - var data = File.OpenRead(""); - - Response response = await client.AnalyzeBodyAsync(RequestContent.Create(data), ContentType.ApplicationOctetStream); + RequestContent content = null; + Response response = await client.AnalyzeBodyAsync(content, new ContentType("application/pdf")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -68,12 +65,11 @@ public async Task Example_AnalyzeBody_Async() [Ignore("Only validating compilation of examples")] public async Task Example_AnalyzeBody_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new MediaTypesClient(credential); - - var data = File.OpenRead(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + MediaTypesClient client = new MediaTypesClient(credential); - Response response = await client.AnalyzeBodyAsync(RequestContent.Create(data), ContentType.ApplicationOctetStream); + RequestContent content = RequestContent.Create(File.OpenRead("")); + Response response = await client.AnalyzeBodyAsync(content, new ContentType("application/pdf")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -83,12 +79,11 @@ public async Task Example_AnalyzeBody_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_AnalyzeBodyNoAcceptHeader() { - var credential = new AzureKeyCredential(""); - var client = new MediaTypesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + MediaTypesClient client = new MediaTypesClient(credential); - var data = File.OpenRead(""); - - Response response = client.AnalyzeBodyNoAcceptHeader(RequestContent.Create(data), ContentType.ApplicationOctetStream); + RequestContent content = null; + Response response = client.AnalyzeBodyNoAcceptHeader(content, new ContentType("application/pdf")); Console.WriteLine(response.Status); } @@ -96,12 +91,11 @@ public void Example_AnalyzeBodyNoAcceptHeader() [Ignore("Only validating compilation of examples")] public void Example_AnalyzeBodyNoAcceptHeader_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new MediaTypesClient(credential); - - var data = File.OpenRead(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + MediaTypesClient client = new MediaTypesClient(credential); - Response response = client.AnalyzeBodyNoAcceptHeader(RequestContent.Create(data), ContentType.ApplicationOctetStream); + RequestContent content = RequestContent.Create(File.OpenRead("")); + Response response = client.AnalyzeBodyNoAcceptHeader(content, new ContentType("application/pdf")); Console.WriteLine(response.Status); } @@ -109,12 +103,11 @@ public void Example_AnalyzeBodyNoAcceptHeader_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_AnalyzeBodyNoAcceptHeader_Async() { - var credential = new AzureKeyCredential(""); - var client = new MediaTypesClient(credential); - - var data = File.OpenRead(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + MediaTypesClient client = new MediaTypesClient(credential); - Response response = await client.AnalyzeBodyNoAcceptHeaderAsync(RequestContent.Create(data), ContentType.ApplicationOctetStream); + RequestContent content = null; + Response response = await client.AnalyzeBodyNoAcceptHeaderAsync(content, new ContentType("application/pdf")); Console.WriteLine(response.Status); } @@ -122,12 +115,11 @@ public async Task Example_AnalyzeBodyNoAcceptHeader_Async() [Ignore("Only validating compilation of examples")] public async Task Example_AnalyzeBodyNoAcceptHeader_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new MediaTypesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + MediaTypesClient client = new MediaTypesClient(credential); - var data = File.OpenRead(""); - - Response response = await client.AnalyzeBodyNoAcceptHeaderAsync(RequestContent.Create(data), ContentType.ApplicationOctetStream); + RequestContent content = RequestContent.Create(File.OpenRead("")); + Response response = await client.AnalyzeBodyNoAcceptHeaderAsync(content, new ContentType("application/pdf")); Console.WriteLine(response.Status); } @@ -135,12 +127,11 @@ public async Task Example_AnalyzeBodyNoAcceptHeader_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_ContentTypeWithEncoding() { - var credential = new AzureKeyCredential(""); - var client = new MediaTypesClient(credential); - - var data = ""; + AzureKeyCredential credential = new AzureKeyCredential(""); + MediaTypesClient client = new MediaTypesClient(credential); - Response response = client.ContentTypeWithEncoding(RequestContent.Create(data)); + RequestContent content = null; + Response response = client.ContentTypeWithEncoding(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -150,12 +141,11 @@ public void Example_ContentTypeWithEncoding() [Ignore("Only validating compilation of examples")] public void Example_ContentTypeWithEncoding_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new MediaTypesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + MediaTypesClient client = new MediaTypesClient(credential); - var data = ""; - - Response response = client.ContentTypeWithEncoding(RequestContent.Create(data)); + RequestContent content = RequestContent.Create(""); + Response response = client.ContentTypeWithEncoding(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -165,12 +155,11 @@ public void Example_ContentTypeWithEncoding_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_ContentTypeWithEncoding_Async() { - var credential = new AzureKeyCredential(""); - var client = new MediaTypesClient(credential); - - var data = ""; + AzureKeyCredential credential = new AzureKeyCredential(""); + MediaTypesClient client = new MediaTypesClient(credential); - Response response = await client.ContentTypeWithEncodingAsync(RequestContent.Create(data)); + RequestContent content = null; + Response response = await client.ContentTypeWithEncodingAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -180,12 +169,11 @@ public async Task Example_ContentTypeWithEncoding_Async() [Ignore("Only validating compilation of examples")] public async Task Example_ContentTypeWithEncoding_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new MediaTypesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + MediaTypesClient client = new MediaTypesClient(credential); - var data = ""; - - Response response = await client.ContentTypeWithEncodingAsync(RequestContent.Create(data)); + RequestContent content = RequestContent.Create(""); + Response response = await client.ContentTypeWithEncodingAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -195,12 +183,11 @@ public async Task Example_ContentTypeWithEncoding_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_BinaryBodyWithTwoContentTypes() { - var credential = new AzureKeyCredential(""); - var client = new MediaTypesClient(credential); - - var data = File.OpenRead(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + MediaTypesClient client = new MediaTypesClient(credential); - Response response = client.BinaryBodyWithTwoContentTypes(RequestContent.Create(data), ContentType.ApplicationOctetStream); + RequestContent content = RequestContent.Create(File.OpenRead("")); + Response response = client.BinaryBodyWithTwoContentTypes(content, new ContentType("application/json")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -210,12 +197,11 @@ public void Example_BinaryBodyWithTwoContentTypes() [Ignore("Only validating compilation of examples")] public void Example_BinaryBodyWithTwoContentTypes_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new MediaTypesClient(credential); - - var data = File.OpenRead(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + MediaTypesClient client = new MediaTypesClient(credential); - Response response = client.BinaryBodyWithTwoContentTypes(RequestContent.Create(data), ContentType.ApplicationOctetStream); + RequestContent content = RequestContent.Create(File.OpenRead("")); + Response response = client.BinaryBodyWithTwoContentTypes(content, new ContentType("application/json")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -225,12 +211,11 @@ public void Example_BinaryBodyWithTwoContentTypes_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_BinaryBodyWithTwoContentTypes_Async() { - var credential = new AzureKeyCredential(""); - var client = new MediaTypesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + MediaTypesClient client = new MediaTypesClient(credential); - var data = File.OpenRead(""); - - Response response = await client.BinaryBodyWithTwoContentTypesAsync(RequestContent.Create(data), ContentType.ApplicationOctetStream); + RequestContent content = RequestContent.Create(File.OpenRead("")); + Response response = await client.BinaryBodyWithTwoContentTypesAsync(content, new ContentType("application/json")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -240,12 +225,11 @@ public async Task Example_BinaryBodyWithTwoContentTypes_Async() [Ignore("Only validating compilation of examples")] public async Task Example_BinaryBodyWithTwoContentTypes_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new MediaTypesClient(credential); - - var data = File.OpenRead(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + MediaTypesClient client = new MediaTypesClient(credential); - Response response = await client.BinaryBodyWithTwoContentTypesAsync(RequestContent.Create(data), ContentType.ApplicationOctetStream); + RequestContent content = RequestContent.Create(File.OpenRead("")); + Response response = await client.BinaryBodyWithTwoContentTypesAsync(content, new ContentType("application/json")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -255,12 +239,11 @@ public async Task Example_BinaryBodyWithTwoContentTypes_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_BinaryBodyWithThreeContentTypes() { - var credential = new AzureKeyCredential(""); - var client = new MediaTypesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + MediaTypesClient client = new MediaTypesClient(credential); - var data = File.OpenRead(""); - - Response response = client.BinaryBodyWithThreeContentTypes(RequestContent.Create(data), ContentType.ApplicationOctetStream); + RequestContent content = RequestContent.Create(File.OpenRead("")); + Response response = client.BinaryBodyWithThreeContentTypes(content, new ContentType("application/json")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -270,12 +253,11 @@ public void Example_BinaryBodyWithThreeContentTypes() [Ignore("Only validating compilation of examples")] public void Example_BinaryBodyWithThreeContentTypes_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new MediaTypesClient(credential); - - var data = File.OpenRead(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + MediaTypesClient client = new MediaTypesClient(credential); - Response response = client.BinaryBodyWithThreeContentTypes(RequestContent.Create(data), ContentType.ApplicationOctetStream); + RequestContent content = RequestContent.Create(File.OpenRead("")); + Response response = client.BinaryBodyWithThreeContentTypes(content, new ContentType("application/json")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -285,12 +267,11 @@ public void Example_BinaryBodyWithThreeContentTypes_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_BinaryBodyWithThreeContentTypes_Async() { - var credential = new AzureKeyCredential(""); - var client = new MediaTypesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + MediaTypesClient client = new MediaTypesClient(credential); - var data = File.OpenRead(""); - - Response response = await client.BinaryBodyWithThreeContentTypesAsync(RequestContent.Create(data), ContentType.ApplicationOctetStream); + RequestContent content = RequestContent.Create(File.OpenRead("")); + Response response = await client.BinaryBodyWithThreeContentTypesAsync(content, new ContentType("application/json")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -300,12 +281,11 @@ public async Task Example_BinaryBodyWithThreeContentTypes_Async() [Ignore("Only validating compilation of examples")] public async Task Example_BinaryBodyWithThreeContentTypes_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new MediaTypesClient(credential); - - var data = File.OpenRead(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + MediaTypesClient client = new MediaTypesClient(credential); - Response response = await client.BinaryBodyWithThreeContentTypesAsync(RequestContent.Create(data), ContentType.ApplicationOctetStream); + RequestContent content = RequestContent.Create(File.OpenRead("")); + Response response = await client.BinaryBodyWithThreeContentTypesAsync(content, new ContentType("application/json")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -315,12 +295,11 @@ public async Task Example_BinaryBodyWithThreeContentTypes_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_BodyThreeTypes() { - var credential = new AzureKeyCredential(""); - var client = new MediaTypesClient(credential); - - var data = File.OpenRead(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + MediaTypesClient client = new MediaTypesClient(credential); - Response response = client.BodyThreeTypes(RequestContent.Create(data), ContentType.ApplicationOctetStream); + RequestContent content = RequestContent.Create(File.OpenRead("")); + Response response = client.BodyThreeTypes(content, new ContentType("application/octet-stream")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -330,12 +309,11 @@ public void Example_BodyThreeTypes() [Ignore("Only validating compilation of examples")] public void Example_BodyThreeTypes_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new MediaTypesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + MediaTypesClient client = new MediaTypesClient(credential); - var data = File.OpenRead(""); - - Response response = client.BodyThreeTypes(RequestContent.Create(data), ContentType.ApplicationOctetStream); + RequestContent content = RequestContent.Create(File.OpenRead("")); + Response response = client.BodyThreeTypes(content, new ContentType("application/octet-stream")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -345,12 +323,11 @@ public void Example_BodyThreeTypes_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_BodyThreeTypes_Async() { - var credential = new AzureKeyCredential(""); - var client = new MediaTypesClient(credential); - - var data = File.OpenRead(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + MediaTypesClient client = new MediaTypesClient(credential); - Response response = await client.BodyThreeTypesAsync(RequestContent.Create(data), ContentType.ApplicationOctetStream); + RequestContent content = RequestContent.Create(File.OpenRead("")); + Response response = await client.BodyThreeTypesAsync(content, new ContentType("application/octet-stream")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -360,12 +337,11 @@ public async Task Example_BodyThreeTypes_Async() [Ignore("Only validating compilation of examples")] public async Task Example_BodyThreeTypes_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new MediaTypesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + MediaTypesClient client = new MediaTypesClient(credential); - var data = File.OpenRead(""); - - Response response = await client.BodyThreeTypesAsync(RequestContent.Create(data), ContentType.ApplicationOctetStream); + RequestContent content = RequestContent.Create(File.OpenRead("")); + Response response = await client.BodyThreeTypesAsync(content, new ContentType("application/octet-stream")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -375,12 +351,11 @@ public async Task Example_BodyThreeTypes_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_PutTextAndJsonBody() { - var credential = new AzureKeyCredential(""); - var client = new MediaTypesClient(credential); - - var data = ""; + AzureKeyCredential credential = new AzureKeyCredential(""); + MediaTypesClient client = new MediaTypesClient(credential); - Response response = client.PutTextAndJsonBody(RequestContent.Create(data), ContentType.ApplicationOctetStream); + RequestContent content = RequestContent.Create(""); + Response response = client.PutTextAndJsonBody(content, new ContentType("application/json")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -390,12 +365,11 @@ public void Example_PutTextAndJsonBody() [Ignore("Only validating compilation of examples")] public void Example_PutTextAndJsonBody_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new MediaTypesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + MediaTypesClient client = new MediaTypesClient(credential); - var data = ""; - - Response response = client.PutTextAndJsonBody(RequestContent.Create(data), ContentType.ApplicationOctetStream); + RequestContent content = RequestContent.Create(""); + Response response = client.PutTextAndJsonBody(content, new ContentType("application/json")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -405,12 +379,11 @@ public void Example_PutTextAndJsonBody_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_PutTextAndJsonBody_Async() { - var credential = new AzureKeyCredential(""); - var client = new MediaTypesClient(credential); - - var data = ""; + AzureKeyCredential credential = new AzureKeyCredential(""); + MediaTypesClient client = new MediaTypesClient(credential); - Response response = await client.PutTextAndJsonBodyAsync(RequestContent.Create(data), ContentType.ApplicationOctetStream); + RequestContent content = RequestContent.Create(""); + Response response = await client.PutTextAndJsonBodyAsync(content, new ContentType("application/json")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -420,12 +393,11 @@ public async Task Example_PutTextAndJsonBody_Async() [Ignore("Only validating compilation of examples")] public async Task Example_PutTextAndJsonBody_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new MediaTypesClient(credential); - - var data = ""; + AzureKeyCredential credential = new AzureKeyCredential(""); + MediaTypesClient client = new MediaTypesClient(credential); - Response response = await client.PutTextAndJsonBodyAsync(RequestContent.Create(data), ContentType.ApplicationOctetStream); + RequestContent content = RequestContent.Create(""); + Response response = await client.PutTextAndJsonBodyAsync(content, new ContentType("application/json")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); diff --git a/test/TestServerProjectsLowLevel/paging/src/Generated/Docs/PagingClient.xml b/test/TestServerProjectsLowLevel/paging/src/Generated/Docs/PagingClient.xml index e855da9f0e6..a36b7486842 100644 --- a/test/TestServerProjectsLowLevel/paging/src/Generated/Docs/PagingClient.xml +++ b/test/TestServerProjectsLowLevel/paging/src/Generated/Docs/PagingClient.xml @@ -2,874 +2,1370 @@ - -This sample shows how to call GetNoItemNamePagesAsync with required parameters and parse the result. + +This sample shows how to call GetNoItemNamePagesAsync and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -await foreach (var item in client.GetNoItemNamePagesAsync(new RequestContext())) +await foreach (BinaryData item in client.GetNoItemNamePagesAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetNoItemNamePagesAsync with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +await foreach (BinaryData item in client.GetNoItemNamePagesAsync(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetNoItemNamePages with required parameters and parse the result. + +This sample shows how to call GetNoItemNamePages and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -foreach (var item in client.GetNoItemNamePages(new RequestContext())) +foreach (BinaryData item in client.GetNoItemNamePages(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetNoItemNamePages with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +foreach (BinaryData item in client.GetNoItemNamePages(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetEmptyNextLinkNamePagesAsync with required parameters and parse the result. + +This sample shows how to call GetEmptyNextLinkNamePagesAsync and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -await foreach (var item in client.GetEmptyNextLinkNamePagesAsync(new RequestContext())) +await foreach (BinaryData item in client.GetEmptyNextLinkNamePagesAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetEmptyNextLinkNamePagesAsync with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +await foreach (BinaryData item in client.GetEmptyNextLinkNamePagesAsync(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetEmptyNextLinkNamePages with required parameters and parse the result. + +This sample shows how to call GetEmptyNextLinkNamePages and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -foreach (var item in client.GetEmptyNextLinkNamePages(new RequestContext())) +foreach (BinaryData item in client.GetEmptyNextLinkNamePages(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetEmptyNextLinkNamePages with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +foreach (BinaryData item in client.GetEmptyNextLinkNamePages(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetNullNextLinkNamePagesAsync with required parameters and parse the result. + +This sample shows how to call GetNullNextLinkNamePagesAsync and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -await foreach (var item in client.GetNullNextLinkNamePagesAsync(new RequestContext())) +await foreach (BinaryData item in client.GetNullNextLinkNamePagesAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetNullNextLinkNamePagesAsync with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +await foreach (BinaryData item in client.GetNullNextLinkNamePagesAsync(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetNullNextLinkNamePages with required parameters and parse the result. + +This sample shows how to call GetNullNextLinkNamePages and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -foreach (var item in client.GetNullNextLinkNamePages(new RequestContext())) +foreach (BinaryData item in client.GetNullNextLinkNamePages(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetNullNextLinkNamePages with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +foreach (BinaryData item in client.GetNullNextLinkNamePages(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetSinglePagesAsync with required parameters and parse the result. + +This sample shows how to call GetSinglePagesAsync and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -await foreach (var item in client.GetSinglePagesAsync(new RequestContext())) +await foreach (BinaryData item in client.GetSinglePagesAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetSinglePagesAsync with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +await foreach (BinaryData item in client.GetSinglePagesAsync(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetSinglePages with required parameters and parse the result. + +This sample shows how to call GetSinglePages and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -foreach (var item in client.GetSinglePages(new RequestContext())) +foreach (BinaryData item in client.GetSinglePages(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetSinglePages with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +foreach (BinaryData item in client.GetSinglePages(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - + This sample shows how to call GetSinglePagesWithBodyParamsAsync and parse the result. "); -var client = new PagingClient(credential); - -var data = new {}; +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -await foreach (var item in client.GetSinglePagesWithBodyParamsAsync(RequestContent.Create(data))) +RequestContent content = RequestContent.Create(new object()); +await foreach (BinaryData item in client.GetSinglePagesWithBodyParamsAsync(content)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } ]]> -This sample shows how to call GetSinglePagesWithBodyParamsAsync with all request content, and how to parse the result. +This sample shows how to call GetSinglePagesWithBodyParamsAsync with all request content and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -var data = new { +RequestContent content = RequestContent.Create(new +{ name = "", -}; - -await foreach (var item in client.GetSinglePagesWithBodyParamsAsync(RequestContent.Create(data))) +}); +await foreach (BinaryData item in client.GetSinglePagesWithBodyParamsAsync(content)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } -]]> - +]]> - + This sample shows how to call GetSinglePagesWithBodyParams and parse the result. "); -var client = new PagingClient(credential); - -var data = new {}; +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -foreach (var item in client.GetSinglePagesWithBodyParams(RequestContent.Create(data))) +RequestContent content = RequestContent.Create(new object()); +foreach (BinaryData item in client.GetSinglePagesWithBodyParams(content)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } ]]> -This sample shows how to call GetSinglePagesWithBodyParams with all request content, and how to parse the result. +This sample shows how to call GetSinglePagesWithBodyParams with all request content and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -var data = new { +RequestContent content = RequestContent.Create(new +{ name = "", -}; - -foreach (var item in client.GetSinglePagesWithBodyParams(RequestContent.Create(data))) +}); +foreach (BinaryData item in client.GetSinglePagesWithBodyParams(content)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } -]]> - +]]> - -This sample shows how to call FirstResponseEmptyAsync with required parameters and parse the result. + +This sample shows how to call FirstResponseEmptyAsync and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -await foreach (var item in client.FirstResponseEmptyAsync(new RequestContext())) +await foreach (BinaryData item in client.FirstResponseEmptyAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call FirstResponseEmptyAsync with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +await foreach (BinaryData item in client.FirstResponseEmptyAsync(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call FirstResponseEmpty with required parameters and parse the result. + +This sample shows how to call FirstResponseEmpty and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -foreach (var item in client.FirstResponseEmpty(new RequestContext())) +foreach (BinaryData item in client.FirstResponseEmpty(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call FirstResponseEmpty with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +foreach (BinaryData item in client.FirstResponseEmpty(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetMultiplePagesAsync with required parameters and parse the result. + +This sample shows how to call GetMultiplePagesAsync and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -await foreach (var item in client.GetMultiplePagesAsync(1234, 1234, new RequestContext())) +await foreach (BinaryData item in client.GetMultiplePagesAsync(null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetMultiplePagesAsync with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +await foreach (BinaryData item in client.GetMultiplePagesAsync(1234, 1234, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetMultiplePages with required parameters and parse the result. + +This sample shows how to call GetMultiplePages and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -foreach (var item in client.GetMultiplePages(1234, 1234, new RequestContext())) +foreach (BinaryData item in client.GetMultiplePages(null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetMultiplePages with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +foreach (BinaryData item in client.GetMultiplePages(1234, 1234, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetWithQueryParamsAsync with required parameters and parse the result. + +This sample shows how to call GetWithQueryParamsAsync and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -await foreach (var item in client.GetWithQueryParamsAsync(1234, new RequestContext())) +await foreach (BinaryData item in client.GetWithQueryParamsAsync(1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetWithQueryParamsAsync with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +await foreach (BinaryData item in client.GetWithQueryParamsAsync(1234, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetWithQueryParams with required parameters and parse the result. + +This sample shows how to call GetWithQueryParams and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -foreach (var item in client.GetWithQueryParams(1234, new RequestContext())) +foreach (BinaryData item in client.GetWithQueryParams(1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetWithQueryParams with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +foreach (BinaryData item in client.GetWithQueryParams(1234, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call DuplicateParamsAsync with required parameters and parse the result. + +This sample shows how to call DuplicateParamsAsync and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -await foreach (var item in client.DuplicateParamsAsync("", new RequestContext())) +await foreach (BinaryData item in client.DuplicateParamsAsync(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call DuplicateParamsAsync with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +await foreach (BinaryData item in client.DuplicateParamsAsync("", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call DuplicateParams with required parameters and parse the result. + +This sample shows how to call DuplicateParams and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -foreach (var item in client.DuplicateParams("", new RequestContext())) +foreach (BinaryData item in client.DuplicateParams(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call DuplicateParams with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +foreach (BinaryData item in client.DuplicateParams("", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call PageWithMaxPageSizeAsync with required parameters and parse the result. + +This sample shows how to call PageWithMaxPageSizeAsync and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -await foreach (var item in client.PageWithMaxPageSizeAsync("", new RequestContext())) +await foreach (BinaryData item in client.PageWithMaxPageSizeAsync(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call PageWithMaxPageSizeAsync with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +await foreach (BinaryData item in client.PageWithMaxPageSizeAsync("5", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call PageWithMaxPageSize with required parameters and parse the result. + +This sample shows how to call PageWithMaxPageSize and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -foreach (var item in client.PageWithMaxPageSize("", new RequestContext())) +foreach (BinaryData item in client.PageWithMaxPageSize(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call PageWithMaxPageSize with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +foreach (BinaryData item in client.PageWithMaxPageSize("5", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call NextOperationWithQueryParamsAsync with required parameters and parse the result. + +This sample shows how to call NextOperationWithQueryParamsAsync and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -await foreach (var item in client.NextOperationWithQueryParamsAsync(new RequestContext())) +await foreach (BinaryData item in client.NextOperationWithQueryParamsAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call NextOperationWithQueryParamsAsync with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +await foreach (BinaryData item in client.NextOperationWithQueryParamsAsync(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call NextOperationWithQueryParams with required parameters and parse the result. + +This sample shows how to call NextOperationWithQueryParams and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -foreach (var item in client.NextOperationWithQueryParams(new RequestContext())) +foreach (BinaryData item in client.NextOperationWithQueryParams(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call NextOperationWithQueryParams with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +foreach (BinaryData item in client.NextOperationWithQueryParams(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetOdataMultiplePagesAsync with required parameters and parse the result. + +This sample shows how to call GetOdataMultiplePagesAsync and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -await foreach (var item in client.GetOdataMultiplePagesAsync(1234, 1234, new RequestContext())) +await foreach (BinaryData item in client.GetOdataMultiplePagesAsync(null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetOdataMultiplePagesAsync with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +await foreach (BinaryData item in client.GetOdataMultiplePagesAsync(1234, 1234, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetOdataMultiplePages with required parameters and parse the result. + +This sample shows how to call GetOdataMultiplePages and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -foreach (var item in client.GetOdataMultiplePages(1234, 1234, new RequestContext())) +foreach (BinaryData item in client.GetOdataMultiplePages(null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetOdataMultiplePages with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +foreach (BinaryData item in client.GetOdataMultiplePages(1234, 1234, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetMultiplePagesWithOffsetAsync with required parameters and parse the result. + +This sample shows how to call GetMultiplePagesWithOffsetAsync and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -await foreach (var item in client.GetMultiplePagesWithOffsetAsync(1234, 1234, 1234, new RequestContext())) +await foreach (BinaryData item in client.GetMultiplePagesWithOffsetAsync(1234, null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetMultiplePagesWithOffsetAsync with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +await foreach (BinaryData item in client.GetMultiplePagesWithOffsetAsync(1234, 1234, 1234, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetMultiplePagesWithOffset with required parameters and parse the result. + +This sample shows how to call GetMultiplePagesWithOffset and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -foreach (var item in client.GetMultiplePagesWithOffset(1234, 1234, 1234, new RequestContext())) +foreach (BinaryData item in client.GetMultiplePagesWithOffset(1234, null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetMultiplePagesWithOffset with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +foreach (BinaryData item in client.GetMultiplePagesWithOffset(1234, 1234, 1234, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetMultiplePagesRetryFirstAsync with required parameters and parse the result. + +This sample shows how to call GetMultiplePagesRetryFirstAsync and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -await foreach (var item in client.GetMultiplePagesRetryFirstAsync(new RequestContext())) +await foreach (BinaryData item in client.GetMultiplePagesRetryFirstAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetMultiplePagesRetryFirstAsync with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +await foreach (BinaryData item in client.GetMultiplePagesRetryFirstAsync(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetMultiplePagesRetryFirst with required parameters and parse the result. + +This sample shows how to call GetMultiplePagesRetryFirst and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -foreach (var item in client.GetMultiplePagesRetryFirst(new RequestContext())) +foreach (BinaryData item in client.GetMultiplePagesRetryFirst(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetMultiplePagesRetryFirst with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +foreach (BinaryData item in client.GetMultiplePagesRetryFirst(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetMultiplePagesRetrySecondAsync with required parameters and parse the result. + +This sample shows how to call GetMultiplePagesRetrySecondAsync and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -await foreach (var item in client.GetMultiplePagesRetrySecondAsync(new RequestContext())) +await foreach (BinaryData item in client.GetMultiplePagesRetrySecondAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetMultiplePagesRetrySecondAsync with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +await foreach (BinaryData item in client.GetMultiplePagesRetrySecondAsync(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetMultiplePagesRetrySecond with required parameters and parse the result. + +This sample shows how to call GetMultiplePagesRetrySecond and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -foreach (var item in client.GetMultiplePagesRetrySecond(new RequestContext())) +foreach (BinaryData item in client.GetMultiplePagesRetrySecond(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetMultiplePagesRetrySecond with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +foreach (BinaryData item in client.GetMultiplePagesRetrySecond(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetSinglePagesFailureAsync with required parameters and parse the result. + +This sample shows how to call GetSinglePagesFailureAsync and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -await foreach (var item in client.GetSinglePagesFailureAsync(new RequestContext())) +await foreach (BinaryData item in client.GetSinglePagesFailureAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetSinglePagesFailureAsync with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +await foreach (BinaryData item in client.GetSinglePagesFailureAsync(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetSinglePagesFailure with required parameters and parse the result. + +This sample shows how to call GetSinglePagesFailure and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -foreach (var item in client.GetSinglePagesFailure(new RequestContext())) +foreach (BinaryData item in client.GetSinglePagesFailure(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetSinglePagesFailure with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +foreach (BinaryData item in client.GetSinglePagesFailure(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetMultiplePagesFailureAsync with required parameters and parse the result. + +This sample shows how to call GetMultiplePagesFailureAsync and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -await foreach (var item in client.GetMultiplePagesFailureAsync(new RequestContext())) +await foreach (BinaryData item in client.GetMultiplePagesFailureAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetMultiplePagesFailureAsync with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +await foreach (BinaryData item in client.GetMultiplePagesFailureAsync(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetMultiplePagesFailure with required parameters and parse the result. + +This sample shows how to call GetMultiplePagesFailure and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -foreach (var item in client.GetMultiplePagesFailure(new RequestContext())) +foreach (BinaryData item in client.GetMultiplePagesFailure(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetMultiplePagesFailure with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +foreach (BinaryData item in client.GetMultiplePagesFailure(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetMultiplePagesFailureUriAsync with required parameters and parse the result. + +This sample shows how to call GetMultiplePagesFailureUriAsync and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -await foreach (var item in client.GetMultiplePagesFailureUriAsync(new RequestContext())) +await foreach (BinaryData item in client.GetMultiplePagesFailureUriAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetMultiplePagesFailureUriAsync with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +await foreach (BinaryData item in client.GetMultiplePagesFailureUriAsync(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetMultiplePagesFailureUri with required parameters and parse the result. + +This sample shows how to call GetMultiplePagesFailureUri and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -foreach (var item in client.GetMultiplePagesFailureUri(new RequestContext())) +foreach (BinaryData item in client.GetMultiplePagesFailureUri(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetMultiplePagesFailureUri with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +foreach (BinaryData item in client.GetMultiplePagesFailureUri(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetMultiplePagesFragmentNextLinkAsync with required parameters and parse the result. + +This sample shows how to call GetMultiplePagesFragmentNextLinkAsync and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -await foreach (var item in client.GetMultiplePagesFragmentNextLinkAsync("", "", new RequestContext())) +await foreach (BinaryData item in client.GetMultiplePagesFragmentNextLinkAsync("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetMultiplePagesFragmentNextLinkAsync with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +await foreach (BinaryData item in client.GetMultiplePagesFragmentNextLinkAsync("", "", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetMultiplePagesFragmentNextLink with required parameters and parse the result. + +This sample shows how to call GetMultiplePagesFragmentNextLink and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -foreach (var item in client.GetMultiplePagesFragmentNextLink("", "", new RequestContext())) +foreach (BinaryData item in client.GetMultiplePagesFragmentNextLink("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetMultiplePagesFragmentNextLink with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +foreach (BinaryData item in client.GetMultiplePagesFragmentNextLink("", "", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetMultiplePagesFragmentWithGroupingNextLinkAsync with required parameters and parse the result. + +This sample shows how to call GetMultiplePagesFragmentWithGroupingNextLinkAsync and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -await foreach (var item in client.GetMultiplePagesFragmentWithGroupingNextLinkAsync("", "", new RequestContext())) +await foreach (BinaryData item in client.GetMultiplePagesFragmentWithGroupingNextLinkAsync("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetMultiplePagesFragmentWithGroupingNextLinkAsync with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +await foreach (BinaryData item in client.GetMultiplePagesFragmentWithGroupingNextLinkAsync("", "", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetMultiplePagesFragmentWithGroupingNextLink with required parameters and parse the result. + +This sample shows how to call GetMultiplePagesFragmentWithGroupingNextLink and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -foreach (var item in client.GetMultiplePagesFragmentWithGroupingNextLink("", "", new RequestContext())) +foreach (BinaryData item in client.GetMultiplePagesFragmentWithGroupingNextLink("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetMultiplePagesFragmentWithGroupingNextLink with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +foreach (BinaryData item in client.GetMultiplePagesFragmentWithGroupingNextLink("", "", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call AppendApiVersionAsync with required parameters and parse the result. + +This sample shows how to call AppendApiVersionAsync and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -await foreach (var item in client.AppendApiVersionAsync(new RequestContext())) +await foreach (BinaryData item in client.AppendApiVersionAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call AppendApiVersionAsync with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +await foreach (BinaryData item in client.AppendApiVersionAsync(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call AppendApiVersion with required parameters and parse the result. + +This sample shows how to call AppendApiVersion and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -foreach (var item in client.AppendApiVersion(new RequestContext())) +foreach (BinaryData item in client.AppendApiVersion(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call AppendApiVersion with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +foreach (BinaryData item in client.AppendApiVersion(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call ReplaceApiVersionAsync with required parameters and parse the result. + +This sample shows how to call ReplaceApiVersionAsync and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -await foreach (var item in client.ReplaceApiVersionAsync(new RequestContext())) +await foreach (BinaryData item in client.ReplaceApiVersionAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call ReplaceApiVersionAsync with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +await foreach (BinaryData item in client.ReplaceApiVersionAsync(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call ReplaceApiVersion with required parameters and parse the result. + +This sample shows how to call ReplaceApiVersion and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -foreach (var item in client.ReplaceApiVersion(new RequestContext())) +foreach (BinaryData item in client.ReplaceApiVersion(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call ReplaceApiVersion with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +foreach (BinaryData item in client.ReplaceApiVersion(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call NextFragmentAsync with required parameters and parse the result. + +This sample shows how to call NextFragmentAsync and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -await foreach (var item in client.NextFragmentAsync("", "", "", new RequestContext())) +await foreach (BinaryData item in client.NextFragmentAsync("", "", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call NextFragmentAsync with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +await foreach (BinaryData item in client.NextFragmentAsync("", "", "", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call NextFragment with required parameters and parse the result. + +This sample shows how to call NextFragment and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -foreach (var item in client.NextFragment("", "", "", new RequestContext())) +foreach (BinaryData item in client.NextFragment("", "", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call NextFragment with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +foreach (BinaryData item in client.NextFragment("", "", "", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call NextFragmentWithGroupingAsync with required parameters and parse the result. + +This sample shows how to call NextFragmentWithGroupingAsync and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -await foreach (var item in client.NextFragmentWithGroupingAsync("", "", "", new RequestContext())) +await foreach (BinaryData item in client.NextFragmentWithGroupingAsync("", "", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call NextFragmentWithGroupingAsync with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +await foreach (BinaryData item in client.NextFragmentWithGroupingAsync("", "", "", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call NextFragmentWithGrouping with required parameters and parse the result. + +This sample shows how to call NextFragmentWithGrouping and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -foreach (var item in client.NextFragmentWithGrouping("", "", "", new RequestContext())) +foreach (BinaryData item in client.NextFragmentWithGrouping("", "", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call NextFragmentWithGrouping with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +foreach (BinaryData item in client.NextFragmentWithGrouping("", "", "", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetPagingModelWithItemNameWithXMSClientNameAsync with required parameters and parse the result. + +This sample shows how to call GetPagingModelWithItemNameWithXMSClientNameAsync and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -await foreach (var item in client.GetPagingModelWithItemNameWithXMSClientNameAsync(new RequestContext())) +await foreach (BinaryData item in client.GetPagingModelWithItemNameWithXMSClientNameAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetPagingModelWithItemNameWithXMSClientNameAsync with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +await foreach (BinaryData item in client.GetPagingModelWithItemNameWithXMSClientNameAsync(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetPagingModelWithItemNameWithXMSClientName with required parameters and parse the result. + +This sample shows how to call GetPagingModelWithItemNameWithXMSClientName and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -foreach (var item in client.GetPagingModelWithItemNameWithXMSClientName(new RequestContext())) +foreach (BinaryData item in client.GetPagingModelWithItemNameWithXMSClientName(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetPagingModelWithItemNameWithXMSClientName with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +foreach (BinaryData item in client.GetPagingModelWithItemNameWithXMSClientName(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetMultiplePagesLROAsync with required parameters and parse the result. + +This sample shows how to call GetMultiplePagesLROAsync and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -var operation = await client.GetMultiplePagesLROAsync(WaitUntil.Completed, 1234, 1234, new RequestContext()); - -await foreach (var item in operation.Value) +Operation> operation = await client.GetMultiplePagesLROAsync(WaitUntil.Completed, null, null, null); +await foreach (BinaryData item in operation.Value) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetMultiplePagesLROAsync with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +Operation> operation = await client.GetMultiplePagesLROAsync(WaitUntil.Completed, 1234, 1234, null); +await foreach (BinaryData item in operation.Value) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> - -This sample shows how to call GetMultiplePagesLRO with required parameters and parse the result. + +This sample shows how to call GetMultiplePagesLRO and parse the result. "); -var client = new PagingClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PagingClient client = new PagingClient(credential); -var operation = client.GetMultiplePagesLRO(WaitUntil.Completed, 1234, 1234, new RequestContext()); - -foreach (var item in operation.Value) +Operation> operation = client.GetMultiplePagesLRO(WaitUntil.Completed, null, null, null); +foreach (BinaryData item in operation.Value) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].ToString()); } ]]> - +This sample shows how to call GetMultiplePagesLRO with all parameters and parse the result. +"); +PagingClient client = new PagingClient(credential); + +Operation> operation = client.GetMultiplePagesLRO(WaitUntil.Completed, 1234, 1234, null); +foreach (BinaryData item in operation.Value) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); +} +]]> \ No newline at end of file diff --git a/test/TestServerProjectsLowLevel/paging/tests/Generated/Samples/Samples_PagingClient.cs b/test/TestServerProjectsLowLevel/paging/tests/Generated/Samples/Samples_PagingClient.cs index 5e39c3aced5..0a1004a5e13 100644 --- a/test/TestServerProjectsLowLevel/paging/tests/Generated/Samples/Samples_PagingClient.cs +++ b/test/TestServerProjectsLowLevel/paging/tests/Generated/Samples/Samples_PagingClient.cs @@ -6,14 +6,13 @@ #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; +using paging_LowLevel; namespace paging_LowLevel.Samples { @@ -23,13 +22,13 @@ public class Samples_PagingClient [Ignore("Only validating compilation of examples")] public void Example_GetNoItemNamePages() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetNoItemNamePages(new RequestContext())) + foreach (BinaryData item in client.GetNoItemNamePages(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -37,14 +36,14 @@ public void Example_GetNoItemNamePages() [Ignore("Only validating compilation of examples")] public void Example_GetNoItemNamePages_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetNoItemNamePages(new RequestContext())) + foreach (BinaryData item in client.GetNoItemNamePages(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -52,13 +51,13 @@ public void Example_GetNoItemNamePages_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetNoItemNamePages_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetNoItemNamePagesAsync(new RequestContext())) + await foreach (BinaryData item in client.GetNoItemNamePagesAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -66,14 +65,14 @@ public async Task Example_GetNoItemNamePages_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetNoItemNamePages_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetNoItemNamePagesAsync(new RequestContext())) + await foreach (BinaryData item in client.GetNoItemNamePagesAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -81,13 +80,13 @@ public async Task Example_GetNoItemNamePages_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetEmptyNextLinkNamePages() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetEmptyNextLinkNamePages(new RequestContext())) + foreach (BinaryData item in client.GetEmptyNextLinkNamePages(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -95,14 +94,14 @@ public void Example_GetEmptyNextLinkNamePages() [Ignore("Only validating compilation of examples")] public void Example_GetEmptyNextLinkNamePages_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetEmptyNextLinkNamePages(new RequestContext())) + foreach (BinaryData item in client.GetEmptyNextLinkNamePages(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -110,13 +109,13 @@ public void Example_GetEmptyNextLinkNamePages_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetEmptyNextLinkNamePages_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetEmptyNextLinkNamePagesAsync(new RequestContext())) + await foreach (BinaryData item in client.GetEmptyNextLinkNamePagesAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -124,14 +123,14 @@ public async Task Example_GetEmptyNextLinkNamePages_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetEmptyNextLinkNamePages_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetEmptyNextLinkNamePagesAsync(new RequestContext())) + await foreach (BinaryData item in client.GetEmptyNextLinkNamePagesAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -139,13 +138,13 @@ public async Task Example_GetEmptyNextLinkNamePages_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetNullNextLinkNamePages() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetNullNextLinkNamePages(new RequestContext())) + foreach (BinaryData item in client.GetNullNextLinkNamePages(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -153,14 +152,14 @@ public void Example_GetNullNextLinkNamePages() [Ignore("Only validating compilation of examples")] public void Example_GetNullNextLinkNamePages_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetNullNextLinkNamePages(new RequestContext())) + foreach (BinaryData item in client.GetNullNextLinkNamePages(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -168,13 +167,13 @@ public void Example_GetNullNextLinkNamePages_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetNullNextLinkNamePages_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetNullNextLinkNamePagesAsync(new RequestContext())) + await foreach (BinaryData item in client.GetNullNextLinkNamePagesAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -182,14 +181,14 @@ public async Task Example_GetNullNextLinkNamePages_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetNullNextLinkNamePages_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetNullNextLinkNamePagesAsync(new RequestContext())) + await foreach (BinaryData item in client.GetNullNextLinkNamePagesAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -197,13 +196,13 @@ public async Task Example_GetNullNextLinkNamePages_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetSinglePages() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetSinglePages(new RequestContext())) + foreach (BinaryData item in client.GetSinglePages(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -211,14 +210,14 @@ public void Example_GetSinglePages() [Ignore("Only validating compilation of examples")] public void Example_GetSinglePages_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetSinglePages(new RequestContext())) + foreach (BinaryData item in client.GetSinglePages(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -226,13 +225,13 @@ public void Example_GetSinglePages_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetSinglePages_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetSinglePagesAsync(new RequestContext())) + await foreach (BinaryData item in client.GetSinglePagesAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -240,14 +239,14 @@ public async Task Example_GetSinglePages_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetSinglePages_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetSinglePagesAsync(new RequestContext())) + await foreach (BinaryData item in client.GetSinglePagesAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -255,15 +254,14 @@ public async Task Example_GetSinglePages_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetSinglePagesWithBodyParams() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - var data = new { }; - - foreach (var item in client.GetSinglePagesWithBodyParams(RequestContent.Create(data))) + RequestContent content = RequestContent.Create(new object()); + foreach (BinaryData item in client.GetSinglePagesWithBodyParams(content)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -271,19 +269,18 @@ public void Example_GetSinglePagesWithBodyParams() [Ignore("Only validating compilation of examples")] public void Example_GetSinglePagesWithBodyParams_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - var data = new + RequestContent content = RequestContent.Create(new { name = "", - }; - - foreach (var item in client.GetSinglePagesWithBodyParams(RequestContent.Create(data))) + }); + foreach (BinaryData item in client.GetSinglePagesWithBodyParams(content)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -291,15 +288,14 @@ public void Example_GetSinglePagesWithBodyParams_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetSinglePagesWithBodyParams_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - var data = new { }; - - await foreach (var item in client.GetSinglePagesWithBodyParamsAsync(RequestContent.Create(data))) + RequestContent content = RequestContent.Create(new object()); + await foreach (BinaryData item in client.GetSinglePagesWithBodyParamsAsync(content)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -307,19 +303,18 @@ public async Task Example_GetSinglePagesWithBodyParams_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetSinglePagesWithBodyParams_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - var data = new + RequestContent content = RequestContent.Create(new { name = "", - }; - - await foreach (var item in client.GetSinglePagesWithBodyParamsAsync(RequestContent.Create(data))) + }); + await foreach (BinaryData item in client.GetSinglePagesWithBodyParamsAsync(content)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -327,13 +322,13 @@ public async Task Example_GetSinglePagesWithBodyParams_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_FirstResponseEmpty() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.FirstResponseEmpty(new RequestContext())) + foreach (BinaryData item in client.FirstResponseEmpty(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -341,14 +336,14 @@ public void Example_FirstResponseEmpty() [Ignore("Only validating compilation of examples")] public void Example_FirstResponseEmpty_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.FirstResponseEmpty(new RequestContext())) + foreach (BinaryData item in client.FirstResponseEmpty(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -356,13 +351,13 @@ public void Example_FirstResponseEmpty_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_FirstResponseEmpty_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.FirstResponseEmptyAsync(new RequestContext())) + await foreach (BinaryData item in client.FirstResponseEmptyAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -370,14 +365,14 @@ public async Task Example_FirstResponseEmpty_Async() [Ignore("Only validating compilation of examples")] public async Task Example_FirstResponseEmpty_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.FirstResponseEmptyAsync(new RequestContext())) + await foreach (BinaryData item in client.FirstResponseEmptyAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -385,13 +380,13 @@ public async Task Example_FirstResponseEmpty_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetMultiplePages() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetMultiplePages(1234, 1234, new RequestContext())) + foreach (BinaryData item in client.GetMultiplePages(null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -399,14 +394,14 @@ public void Example_GetMultiplePages() [Ignore("Only validating compilation of examples")] public void Example_GetMultiplePages_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetMultiplePages(1234, 1234, new RequestContext())) + foreach (BinaryData item in client.GetMultiplePages(1234, 1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -414,13 +409,13 @@ public void Example_GetMultiplePages_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetMultiplePages_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetMultiplePagesAsync(1234, 1234, new RequestContext())) + await foreach (BinaryData item in client.GetMultiplePagesAsync(null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -428,14 +423,14 @@ public async Task Example_GetMultiplePages_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetMultiplePages_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetMultiplePagesAsync(1234, 1234, new RequestContext())) + await foreach (BinaryData item in client.GetMultiplePagesAsync(1234, 1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -443,13 +438,13 @@ public async Task Example_GetMultiplePages_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetWithQueryParams() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetWithQueryParams(1234, new RequestContext())) + foreach (BinaryData item in client.GetWithQueryParams(1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -457,14 +452,14 @@ public void Example_GetWithQueryParams() [Ignore("Only validating compilation of examples")] public void Example_GetWithQueryParams_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetWithQueryParams(1234, new RequestContext())) + foreach (BinaryData item in client.GetWithQueryParams(1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -472,13 +467,13 @@ public void Example_GetWithQueryParams_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetWithQueryParams_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetWithQueryParamsAsync(1234, new RequestContext())) + await foreach (BinaryData item in client.GetWithQueryParamsAsync(1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -486,14 +481,14 @@ public async Task Example_GetWithQueryParams_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetWithQueryParams_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetWithQueryParamsAsync(1234, new RequestContext())) + await foreach (BinaryData item in client.GetWithQueryParamsAsync(1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -501,13 +496,13 @@ public async Task Example_GetWithQueryParams_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_DuplicateParams() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.DuplicateParams("", new RequestContext())) + foreach (BinaryData item in client.DuplicateParams(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -515,14 +510,14 @@ public void Example_DuplicateParams() [Ignore("Only validating compilation of examples")] public void Example_DuplicateParams_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.DuplicateParams("", new RequestContext())) + foreach (BinaryData item in client.DuplicateParams("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -530,13 +525,13 @@ public void Example_DuplicateParams_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_DuplicateParams_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.DuplicateParamsAsync("", new RequestContext())) + await foreach (BinaryData item in client.DuplicateParamsAsync(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -544,14 +539,14 @@ public async Task Example_DuplicateParams_Async() [Ignore("Only validating compilation of examples")] public async Task Example_DuplicateParams_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.DuplicateParamsAsync("", new RequestContext())) + await foreach (BinaryData item in client.DuplicateParamsAsync("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -559,13 +554,13 @@ public async Task Example_DuplicateParams_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_PageWithMaxPageSize() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.PageWithMaxPageSize("", new RequestContext())) + foreach (BinaryData item in client.PageWithMaxPageSize(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -573,14 +568,14 @@ public void Example_PageWithMaxPageSize() [Ignore("Only validating compilation of examples")] public void Example_PageWithMaxPageSize_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.PageWithMaxPageSize("", new RequestContext())) + foreach (BinaryData item in client.PageWithMaxPageSize("5", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -588,13 +583,13 @@ public void Example_PageWithMaxPageSize_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_PageWithMaxPageSize_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.PageWithMaxPageSizeAsync("", new RequestContext())) + await foreach (BinaryData item in client.PageWithMaxPageSizeAsync(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -602,14 +597,14 @@ public async Task Example_PageWithMaxPageSize_Async() [Ignore("Only validating compilation of examples")] public async Task Example_PageWithMaxPageSize_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.PageWithMaxPageSizeAsync("", new RequestContext())) + await foreach (BinaryData item in client.PageWithMaxPageSizeAsync("5", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -617,13 +612,13 @@ public async Task Example_PageWithMaxPageSize_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_NextOperationWithQueryParams() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.NextOperationWithQueryParams(new RequestContext())) + foreach (BinaryData item in client.NextOperationWithQueryParams(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -631,14 +626,14 @@ public void Example_NextOperationWithQueryParams() [Ignore("Only validating compilation of examples")] public void Example_NextOperationWithQueryParams_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.NextOperationWithQueryParams(new RequestContext())) + foreach (BinaryData item in client.NextOperationWithQueryParams(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -646,13 +641,13 @@ public void Example_NextOperationWithQueryParams_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_NextOperationWithQueryParams_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.NextOperationWithQueryParamsAsync(new RequestContext())) + await foreach (BinaryData item in client.NextOperationWithQueryParamsAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -660,14 +655,14 @@ public async Task Example_NextOperationWithQueryParams_Async() [Ignore("Only validating compilation of examples")] public async Task Example_NextOperationWithQueryParams_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.NextOperationWithQueryParamsAsync(new RequestContext())) + await foreach (BinaryData item in client.NextOperationWithQueryParamsAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -675,13 +670,13 @@ public async Task Example_NextOperationWithQueryParams_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetOdataMultiplePages() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetOdataMultiplePages(1234, 1234, new RequestContext())) + foreach (BinaryData item in client.GetOdataMultiplePages(null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -689,14 +684,14 @@ public void Example_GetOdataMultiplePages() [Ignore("Only validating compilation of examples")] public void Example_GetOdataMultiplePages_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetOdataMultiplePages(1234, 1234, new RequestContext())) + foreach (BinaryData item in client.GetOdataMultiplePages(1234, 1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -704,13 +699,13 @@ public void Example_GetOdataMultiplePages_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetOdataMultiplePages_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetOdataMultiplePagesAsync(1234, 1234, new RequestContext())) + await foreach (BinaryData item in client.GetOdataMultiplePagesAsync(null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -718,14 +713,14 @@ public async Task Example_GetOdataMultiplePages_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetOdataMultiplePages_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetOdataMultiplePagesAsync(1234, 1234, new RequestContext())) + await foreach (BinaryData item in client.GetOdataMultiplePagesAsync(1234, 1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -733,13 +728,13 @@ public async Task Example_GetOdataMultiplePages_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetMultiplePagesWithOffset() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetMultiplePagesWithOffset(1234, 1234, 1234, new RequestContext())) + foreach (BinaryData item in client.GetMultiplePagesWithOffset(1234, null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -747,14 +742,14 @@ public void Example_GetMultiplePagesWithOffset() [Ignore("Only validating compilation of examples")] public void Example_GetMultiplePagesWithOffset_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetMultiplePagesWithOffset(1234, 1234, 1234, new RequestContext())) + foreach (BinaryData item in client.GetMultiplePagesWithOffset(1234, 1234, 1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -762,13 +757,13 @@ public void Example_GetMultiplePagesWithOffset_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetMultiplePagesWithOffset_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetMultiplePagesWithOffsetAsync(1234, 1234, 1234, new RequestContext())) + await foreach (BinaryData item in client.GetMultiplePagesWithOffsetAsync(1234, null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -776,14 +771,14 @@ public async Task Example_GetMultiplePagesWithOffset_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetMultiplePagesWithOffset_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetMultiplePagesWithOffsetAsync(1234, 1234, 1234, new RequestContext())) + await foreach (BinaryData item in client.GetMultiplePagesWithOffsetAsync(1234, 1234, 1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -791,13 +786,13 @@ public async Task Example_GetMultiplePagesWithOffset_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetMultiplePagesRetryFirst() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetMultiplePagesRetryFirst(new RequestContext())) + foreach (BinaryData item in client.GetMultiplePagesRetryFirst(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -805,14 +800,14 @@ public void Example_GetMultiplePagesRetryFirst() [Ignore("Only validating compilation of examples")] public void Example_GetMultiplePagesRetryFirst_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetMultiplePagesRetryFirst(new RequestContext())) + foreach (BinaryData item in client.GetMultiplePagesRetryFirst(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -820,13 +815,13 @@ public void Example_GetMultiplePagesRetryFirst_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetMultiplePagesRetryFirst_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetMultiplePagesRetryFirstAsync(new RequestContext())) + await foreach (BinaryData item in client.GetMultiplePagesRetryFirstAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -834,14 +829,14 @@ public async Task Example_GetMultiplePagesRetryFirst_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetMultiplePagesRetryFirst_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetMultiplePagesRetryFirstAsync(new RequestContext())) + await foreach (BinaryData item in client.GetMultiplePagesRetryFirstAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -849,13 +844,13 @@ public async Task Example_GetMultiplePagesRetryFirst_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetMultiplePagesRetrySecond() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetMultiplePagesRetrySecond(new RequestContext())) + foreach (BinaryData item in client.GetMultiplePagesRetrySecond(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -863,14 +858,14 @@ public void Example_GetMultiplePagesRetrySecond() [Ignore("Only validating compilation of examples")] public void Example_GetMultiplePagesRetrySecond_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetMultiplePagesRetrySecond(new RequestContext())) + foreach (BinaryData item in client.GetMultiplePagesRetrySecond(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -878,13 +873,13 @@ public void Example_GetMultiplePagesRetrySecond_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetMultiplePagesRetrySecond_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetMultiplePagesRetrySecondAsync(new RequestContext())) + await foreach (BinaryData item in client.GetMultiplePagesRetrySecondAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -892,14 +887,14 @@ public async Task Example_GetMultiplePagesRetrySecond_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetMultiplePagesRetrySecond_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetMultiplePagesRetrySecondAsync(new RequestContext())) + await foreach (BinaryData item in client.GetMultiplePagesRetrySecondAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -907,13 +902,13 @@ public async Task Example_GetMultiplePagesRetrySecond_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetSinglePagesFailure() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetSinglePagesFailure(new RequestContext())) + foreach (BinaryData item in client.GetSinglePagesFailure(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -921,14 +916,14 @@ public void Example_GetSinglePagesFailure() [Ignore("Only validating compilation of examples")] public void Example_GetSinglePagesFailure_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetSinglePagesFailure(new RequestContext())) + foreach (BinaryData item in client.GetSinglePagesFailure(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -936,13 +931,13 @@ public void Example_GetSinglePagesFailure_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetSinglePagesFailure_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetSinglePagesFailureAsync(new RequestContext())) + await foreach (BinaryData item in client.GetSinglePagesFailureAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -950,14 +945,14 @@ public async Task Example_GetSinglePagesFailure_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetSinglePagesFailure_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetSinglePagesFailureAsync(new RequestContext())) + await foreach (BinaryData item in client.GetSinglePagesFailureAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -965,13 +960,13 @@ public async Task Example_GetSinglePagesFailure_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetMultiplePagesFailure() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetMultiplePagesFailure(new RequestContext())) + foreach (BinaryData item in client.GetMultiplePagesFailure(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -979,14 +974,14 @@ public void Example_GetMultiplePagesFailure() [Ignore("Only validating compilation of examples")] public void Example_GetMultiplePagesFailure_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetMultiplePagesFailure(new RequestContext())) + foreach (BinaryData item in client.GetMultiplePagesFailure(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -994,13 +989,13 @@ public void Example_GetMultiplePagesFailure_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetMultiplePagesFailure_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetMultiplePagesFailureAsync(new RequestContext())) + await foreach (BinaryData item in client.GetMultiplePagesFailureAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -1008,14 +1003,14 @@ public async Task Example_GetMultiplePagesFailure_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetMultiplePagesFailure_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetMultiplePagesFailureAsync(new RequestContext())) + await foreach (BinaryData item in client.GetMultiplePagesFailureAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -1023,13 +1018,13 @@ public async Task Example_GetMultiplePagesFailure_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetMultiplePagesFailureUri() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetMultiplePagesFailureUri(new RequestContext())) + foreach (BinaryData item in client.GetMultiplePagesFailureUri(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -1037,14 +1032,14 @@ public void Example_GetMultiplePagesFailureUri() [Ignore("Only validating compilation of examples")] public void Example_GetMultiplePagesFailureUri_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetMultiplePagesFailureUri(new RequestContext())) + foreach (BinaryData item in client.GetMultiplePagesFailureUri(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -1052,13 +1047,13 @@ public void Example_GetMultiplePagesFailureUri_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetMultiplePagesFailureUri_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetMultiplePagesFailureUriAsync(new RequestContext())) + await foreach (BinaryData item in client.GetMultiplePagesFailureUriAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -1066,14 +1061,14 @@ public async Task Example_GetMultiplePagesFailureUri_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetMultiplePagesFailureUri_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetMultiplePagesFailureUriAsync(new RequestContext())) + await foreach (BinaryData item in client.GetMultiplePagesFailureUriAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -1081,13 +1076,13 @@ public async Task Example_GetMultiplePagesFailureUri_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetMultiplePagesFragmentNextLink() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetMultiplePagesFragmentNextLink("", "", new RequestContext())) + foreach (BinaryData item in client.GetMultiplePagesFragmentNextLink("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -1095,14 +1090,14 @@ public void Example_GetMultiplePagesFragmentNextLink() [Ignore("Only validating compilation of examples")] public void Example_GetMultiplePagesFragmentNextLink_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetMultiplePagesFragmentNextLink("", "", new RequestContext())) + foreach (BinaryData item in client.GetMultiplePagesFragmentNextLink("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -1110,13 +1105,13 @@ public void Example_GetMultiplePagesFragmentNextLink_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetMultiplePagesFragmentNextLink_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetMultiplePagesFragmentNextLinkAsync("", "", new RequestContext())) + await foreach (BinaryData item in client.GetMultiplePagesFragmentNextLinkAsync("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -1124,14 +1119,14 @@ public async Task Example_GetMultiplePagesFragmentNextLink_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetMultiplePagesFragmentNextLink_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetMultiplePagesFragmentNextLinkAsync("", "", new RequestContext())) + await foreach (BinaryData item in client.GetMultiplePagesFragmentNextLinkAsync("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -1139,13 +1134,13 @@ public async Task Example_GetMultiplePagesFragmentNextLink_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetMultiplePagesFragmentWithGroupingNextLink() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetMultiplePagesFragmentWithGroupingNextLink("", "", new RequestContext())) + foreach (BinaryData item in client.GetMultiplePagesFragmentWithGroupingNextLink("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -1153,14 +1148,14 @@ public void Example_GetMultiplePagesFragmentWithGroupingNextLink() [Ignore("Only validating compilation of examples")] public void Example_GetMultiplePagesFragmentWithGroupingNextLink_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetMultiplePagesFragmentWithGroupingNextLink("", "", new RequestContext())) + foreach (BinaryData item in client.GetMultiplePagesFragmentWithGroupingNextLink("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -1168,13 +1163,13 @@ public void Example_GetMultiplePagesFragmentWithGroupingNextLink_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetMultiplePagesFragmentWithGroupingNextLink_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetMultiplePagesFragmentWithGroupingNextLinkAsync("", "", new RequestContext())) + await foreach (BinaryData item in client.GetMultiplePagesFragmentWithGroupingNextLinkAsync("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -1182,14 +1177,14 @@ public async Task Example_GetMultiplePagesFragmentWithGroupingNextLink_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetMultiplePagesFragmentWithGroupingNextLink_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetMultiplePagesFragmentWithGroupingNextLinkAsync("", "", new RequestContext())) + await foreach (BinaryData item in client.GetMultiplePagesFragmentWithGroupingNextLinkAsync("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -1197,13 +1192,13 @@ public async Task Example_GetMultiplePagesFragmentWithGroupingNextLink_AllParame [Ignore("Only validating compilation of examples")] public void Example_AppendApiVersion() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.AppendApiVersion(new RequestContext())) + foreach (BinaryData item in client.AppendApiVersion(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -1211,14 +1206,14 @@ public void Example_AppendApiVersion() [Ignore("Only validating compilation of examples")] public void Example_AppendApiVersion_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.AppendApiVersion(new RequestContext())) + foreach (BinaryData item in client.AppendApiVersion(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -1226,13 +1221,13 @@ public void Example_AppendApiVersion_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_AppendApiVersion_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.AppendApiVersionAsync(new RequestContext())) + await foreach (BinaryData item in client.AppendApiVersionAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -1240,14 +1235,14 @@ public async Task Example_AppendApiVersion_Async() [Ignore("Only validating compilation of examples")] public async Task Example_AppendApiVersion_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.AppendApiVersionAsync(new RequestContext())) + await foreach (BinaryData item in client.AppendApiVersionAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -1255,13 +1250,13 @@ public async Task Example_AppendApiVersion_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_ReplaceApiVersion() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.ReplaceApiVersion(new RequestContext())) + foreach (BinaryData item in client.ReplaceApiVersion(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -1269,14 +1264,14 @@ public void Example_ReplaceApiVersion() [Ignore("Only validating compilation of examples")] public void Example_ReplaceApiVersion_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.ReplaceApiVersion(new RequestContext())) + foreach (BinaryData item in client.ReplaceApiVersion(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -1284,13 +1279,13 @@ public void Example_ReplaceApiVersion_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_ReplaceApiVersion_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.ReplaceApiVersionAsync(new RequestContext())) + await foreach (BinaryData item in client.ReplaceApiVersionAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -1298,14 +1293,14 @@ public async Task Example_ReplaceApiVersion_Async() [Ignore("Only validating compilation of examples")] public async Task Example_ReplaceApiVersion_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.ReplaceApiVersionAsync(new RequestContext())) + await foreach (BinaryData item in client.ReplaceApiVersionAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -1313,13 +1308,13 @@ public async Task Example_ReplaceApiVersion_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_NextFragment() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.NextFragment("", "", "", new RequestContext())) + foreach (BinaryData item in client.NextFragment("", "", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -1327,14 +1322,14 @@ public void Example_NextFragment() [Ignore("Only validating compilation of examples")] public void Example_NextFragment_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.NextFragment("", "", "", new RequestContext())) + foreach (BinaryData item in client.NextFragment("", "", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -1342,13 +1337,13 @@ public void Example_NextFragment_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_NextFragment_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.NextFragmentAsync("", "", "", new RequestContext())) + await foreach (BinaryData item in client.NextFragmentAsync("", "", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -1356,14 +1351,14 @@ public async Task Example_NextFragment_Async() [Ignore("Only validating compilation of examples")] public async Task Example_NextFragment_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.NextFragmentAsync("", "", "", new RequestContext())) + await foreach (BinaryData item in client.NextFragmentAsync("", "", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -1371,13 +1366,13 @@ public async Task Example_NextFragment_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_NextFragmentWithGrouping() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.NextFragmentWithGrouping("", "", "", new RequestContext())) + foreach (BinaryData item in client.NextFragmentWithGrouping("", "", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -1385,14 +1380,14 @@ public void Example_NextFragmentWithGrouping() [Ignore("Only validating compilation of examples")] public void Example_NextFragmentWithGrouping_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.NextFragmentWithGrouping("", "", "", new RequestContext())) + foreach (BinaryData item in client.NextFragmentWithGrouping("", "", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -1400,13 +1395,13 @@ public void Example_NextFragmentWithGrouping_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_NextFragmentWithGrouping_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.NextFragmentWithGroupingAsync("", "", "", new RequestContext())) + await foreach (BinaryData item in client.NextFragmentWithGroupingAsync("", "", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -1414,14 +1409,14 @@ public async Task Example_NextFragmentWithGrouping_Async() [Ignore("Only validating compilation of examples")] public async Task Example_NextFragmentWithGrouping_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.NextFragmentWithGroupingAsync("", "", "", new RequestContext())) + await foreach (BinaryData item in client.NextFragmentWithGroupingAsync("", "", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -1429,13 +1424,13 @@ public async Task Example_NextFragmentWithGrouping_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetPagingModelWithItemNameWithXMSClientName() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetPagingModelWithItemNameWithXMSClientName(new RequestContext())) + foreach (BinaryData item in client.GetPagingModelWithItemNameWithXMSClientName(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -1443,14 +1438,14 @@ public void Example_GetPagingModelWithItemNameWithXMSClientName() [Ignore("Only validating compilation of examples")] public void Example_GetPagingModelWithItemNameWithXMSClientName_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in client.GetPagingModelWithItemNameWithXMSClientName(new RequestContext())) + foreach (BinaryData item in client.GetPagingModelWithItemNameWithXMSClientName(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -1458,13 +1453,13 @@ public void Example_GetPagingModelWithItemNameWithXMSClientName_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetPagingModelWithItemNameWithXMSClientName_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetPagingModelWithItemNameWithXMSClientNameAsync(new RequestContext())) + await foreach (BinaryData item in client.GetPagingModelWithItemNameWithXMSClientNameAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -1472,14 +1467,14 @@ public async Task Example_GetPagingModelWithItemNameWithXMSClientName_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetPagingModelWithItemNameWithXMSClientName_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in client.GetPagingModelWithItemNameWithXMSClientNameAsync(new RequestContext())) + await foreach (BinaryData item in client.GetPagingModelWithItemNameWithXMSClientNameAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -1487,15 +1482,14 @@ public async Task Example_GetPagingModelWithItemNameWithXMSClientName_AllParamet [Ignore("Only validating compilation of examples")] public void Example_GetMultiplePagesLRO() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - var operation = client.GetMultiplePagesLRO(WaitUntil.Completed, 1234, 1234, new RequestContext()); - - foreach (var item in operation.Value) + Operation> operation = client.GetMultiplePagesLRO(WaitUntil.Completed, null, null, null); + foreach (BinaryData item in operation.Value) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -1503,16 +1497,15 @@ public void Example_GetMultiplePagesLRO() [Ignore("Only validating compilation of examples")] public void Example_GetMultiplePagesLRO_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); - - var operation = client.GetMultiplePagesLRO(WaitUntil.Completed, 1234, 1234, new RequestContext()); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - foreach (var item in operation.Value) + Operation> operation = client.GetMultiplePagesLRO(WaitUntil.Completed, 1234, 1234, null); + foreach (BinaryData item in operation.Value) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } @@ -1520,15 +1513,14 @@ public void Example_GetMultiplePagesLRO_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetMultiplePagesLRO_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - var operation = await client.GetMultiplePagesLROAsync(WaitUntil.Completed, 1234, 1234, new RequestContext()); - - await foreach (var item in operation.Value) + Operation> operation = await client.GetMultiplePagesLROAsync(WaitUntil.Completed, null, null, null); + await foreach (BinaryData item in operation.Value) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result[0].ToString()); } } @@ -1536,16 +1528,15 @@ public async Task Example_GetMultiplePagesLRO_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetMultiplePagesLRO_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PagingClient(credential); - - var operation = await client.GetMultiplePagesLROAsync(WaitUntil.Completed, 1234, 1234, new RequestContext()); + AzureKeyCredential credential = new AzureKeyCredential(""); + PagingClient client = new PagingClient(credential); - await foreach (var item in operation.Value) + Operation> operation = await client.GetMultiplePagesLROAsync(WaitUntil.Completed, 1234, 1234, null); + await foreach (BinaryData item in operation.Value) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("properties").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("properties").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("properties").GetProperty("name").ToString()); } } } diff --git a/test/TestServerProjectsLowLevel/security-aad/src/Generated/Docs/AutorestSecurityAadClient.xml b/test/TestServerProjectsLowLevel/security-aad/src/Generated/Docs/AutorestSecurityAadClient.xml index d15c820c620..bc3bd699bde 100644 --- a/test/TestServerProjectsLowLevel/security-aad/src/Generated/Docs/AutorestSecurityAadClient.xml +++ b/test/TestServerProjectsLowLevel/security-aad/src/Generated/Docs/AutorestSecurityAadClient.xml @@ -2,28 +2,42 @@ - + This sample shows how to call HeadAsync. - +This sample shows how to call HeadAsync with all request content. + - + This sample shows how to call Head. - +This sample shows how to call Head with all request content. + \ No newline at end of file diff --git a/test/TestServerProjectsLowLevel/security-aad/tests/Generated/Samples/Samples_AutorestSecurityAadClient.cs b/test/TestServerProjectsLowLevel/security-aad/tests/Generated/Samples/Samples_AutorestSecurityAadClient.cs index 9076d10efab..965ad404070 100644 --- a/test/TestServerProjectsLowLevel/security-aad/tests/Generated/Samples/Samples_AutorestSecurityAadClient.cs +++ b/test/TestServerProjectsLowLevel/security-aad/tests/Generated/Samples/Samples_AutorestSecurityAadClient.cs @@ -6,14 +6,12 @@ #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; +using security_aad_LowLevel; namespace security_aad_LowLevel.Samples { @@ -23,8 +21,8 @@ public class Samples_AutorestSecurityAadClient [Ignore("Only validating compilation of examples")] public void Example_Head() { - var credential = new DefaultAzureCredential(); - var client = new AutorestSecurityAadClient(credential); + TokenCredential credential = new DefaultAzureCredential(); + AutorestSecurityAadClient client = new AutorestSecurityAadClient(credential); Response response = client.Head(); Console.WriteLine(response.Status); @@ -34,8 +32,8 @@ public void Example_Head() [Ignore("Only validating compilation of examples")] public void Example_Head_AllParameters() { - var credential = new DefaultAzureCredential(); - var client = new AutorestSecurityAadClient(credential); + TokenCredential credential = new DefaultAzureCredential(); + AutorestSecurityAadClient client = new AutorestSecurityAadClient(credential); Response response = client.Head(); Console.WriteLine(response.Status); @@ -45,8 +43,8 @@ public void Example_Head_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_Head_Async() { - var credential = new DefaultAzureCredential(); - var client = new AutorestSecurityAadClient(credential); + TokenCredential credential = new DefaultAzureCredential(); + AutorestSecurityAadClient client = new AutorestSecurityAadClient(credential); Response response = await client.HeadAsync(); Console.WriteLine(response.Status); @@ -56,8 +54,8 @@ public async Task Example_Head_Async() [Ignore("Only validating compilation of examples")] public async Task Example_Head_AllParameters_Async() { - var credential = new DefaultAzureCredential(); - var client = new AutorestSecurityAadClient(credential); + TokenCredential credential = new DefaultAzureCredential(); + AutorestSecurityAadClient client = new AutorestSecurityAadClient(credential); Response response = await client.HeadAsync(); Console.WriteLine(response.Status); diff --git a/test/TestServerProjectsLowLevel/security-key/src/Generated/Docs/AutorestSecurityKeyClient.xml b/test/TestServerProjectsLowLevel/security-key/src/Generated/Docs/AutorestSecurityKeyClient.xml index e52d2990de0..c5aea00e8a5 100644 --- a/test/TestServerProjectsLowLevel/security-key/src/Generated/Docs/AutorestSecurityKeyClient.xml +++ b/test/TestServerProjectsLowLevel/security-key/src/Generated/Docs/AutorestSecurityKeyClient.xml @@ -2,28 +2,42 @@ - + This sample shows how to call HeadAsync. "); -var client = new AutorestSecurityKeyClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +AutorestSecurityKeyClient client = new AutorestSecurityKeyClient(credential); Response response = await client.HeadAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call HeadAsync with all request content. +"); +AutorestSecurityKeyClient client = new AutorestSecurityKeyClient(credential); + +Response response = await client.HeadAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call Head. "); -var client = new AutorestSecurityKeyClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +AutorestSecurityKeyClient client = new AutorestSecurityKeyClient(credential); Response response = client.Head(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call Head with all request content. +"); +AutorestSecurityKeyClient client = new AutorestSecurityKeyClient(credential); + +Response response = client.Head(); +Console.WriteLine(response.Status); +]]> \ No newline at end of file diff --git a/test/TestServerProjectsLowLevel/security-key/tests/Generated/Samples/Samples_AutorestSecurityKeyClient.cs b/test/TestServerProjectsLowLevel/security-key/tests/Generated/Samples/Samples_AutorestSecurityKeyClient.cs index 714e775586b..f6109be7974 100644 --- a/test/TestServerProjectsLowLevel/security-key/tests/Generated/Samples/Samples_AutorestSecurityKeyClient.cs +++ b/test/TestServerProjectsLowLevel/security-key/tests/Generated/Samples/Samples_AutorestSecurityKeyClient.cs @@ -6,14 +6,11 @@ #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; +using security_key_LowLevel; namespace security_key_LowLevel.Samples { @@ -23,8 +20,8 @@ public class Samples_AutorestSecurityKeyClient [Ignore("Only validating compilation of examples")] public void Example_Head() { - var credential = new AzureKeyCredential(""); - var client = new AutorestSecurityKeyClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + AutorestSecurityKeyClient client = new AutorestSecurityKeyClient(credential); Response response = client.Head(); Console.WriteLine(response.Status); @@ -34,8 +31,8 @@ public void Example_Head() [Ignore("Only validating compilation of examples")] public void Example_Head_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new AutorestSecurityKeyClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + AutorestSecurityKeyClient client = new AutorestSecurityKeyClient(credential); Response response = client.Head(); Console.WriteLine(response.Status); @@ -45,8 +42,8 @@ public void Example_Head_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_Head_Async() { - var credential = new AzureKeyCredential(""); - var client = new AutorestSecurityKeyClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + AutorestSecurityKeyClient client = new AutorestSecurityKeyClient(credential); Response response = await client.HeadAsync(); Console.WriteLine(response.Status); @@ -56,8 +53,8 @@ public async Task Example_Head_Async() [Ignore("Only validating compilation of examples")] public async Task Example_Head_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new AutorestSecurityKeyClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + AutorestSecurityKeyClient client = new AutorestSecurityKeyClient(credential); Response response = await client.HeadAsync(); Console.WriteLine(response.Status); diff --git a/test/TestServerProjectsLowLevel/url-multi-collectionFormat/src/Generated/Docs/QueriesClient.xml b/test/TestServerProjectsLowLevel/url-multi-collectionFormat/src/Generated/Docs/QueriesClient.xml index 1a298c1fc9a..6e76617d3ab 100644 --- a/test/TestServerProjectsLowLevel/url-multi-collectionFormat/src/Generated/Docs/QueriesClient.xml +++ b/test/TestServerProjectsLowLevel/url-multi-collectionFormat/src/Generated/Docs/QueriesClient.xml @@ -2,124 +2,136 @@ - + This sample shows how to call ArrayStringMultiNullAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.ArrayStringMultiNullAsync(); Console.WriteLine(response.Status); ]]> This sample shows how to call ArrayStringMultiNullAsync with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = await client.ArrayStringMultiNullAsync(new String[]{""}); +Response response = await client.ArrayStringMultiNullAsync(arrayQuery: new List() +{ + "" +}); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call ArrayStringMultiNull. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.ArrayStringMultiNull(); Console.WriteLine(response.Status); ]]> This sample shows how to call ArrayStringMultiNull with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = client.ArrayStringMultiNull(new String[]{""}); +Response response = client.ArrayStringMultiNull(arrayQuery: new List() +{ + "" +}); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call ArrayStringMultiEmptyAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.ArrayStringMultiEmptyAsync(); Console.WriteLine(response.Status); ]]> This sample shows how to call ArrayStringMultiEmptyAsync with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = await client.ArrayStringMultiEmptyAsync(new String[]{""}); +Response response = await client.ArrayStringMultiEmptyAsync(arrayQuery: new List() +{ + "" +}); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call ArrayStringMultiEmpty. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.ArrayStringMultiEmpty(); Console.WriteLine(response.Status); ]]> This sample shows how to call ArrayStringMultiEmpty with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = client.ArrayStringMultiEmpty(new String[]{""}); +Response response = client.ArrayStringMultiEmpty(arrayQuery: new List() +{ + "" +}); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call ArrayStringMultiValidAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.ArrayStringMultiValidAsync(); Console.WriteLine(response.Status); ]]> This sample shows how to call ArrayStringMultiValidAsync with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = await client.ArrayStringMultiValidAsync(new String[]{""}); +Response response = await client.ArrayStringMultiValidAsync(arrayQuery: new List() +{ + "" +}); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call ArrayStringMultiValid. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.ArrayStringMultiValid(); Console.WriteLine(response.Status); ]]> This sample shows how to call ArrayStringMultiValid with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = client.ArrayStringMultiValid(new String[]{""}); +Response response = client.ArrayStringMultiValid(arrayQuery: new List() +{ + "" +}); Console.WriteLine(response.Status); -]]> - +]]> \ No newline at end of file diff --git a/test/TestServerProjectsLowLevel/url-multi-collectionFormat/tests/Generated/Samples/Samples_QueriesClient.cs b/test/TestServerProjectsLowLevel/url-multi-collectionFormat/tests/Generated/Samples/Samples_QueriesClient.cs index f79a91db74b..0f8d541ce64 100644 --- a/test/TestServerProjectsLowLevel/url-multi-collectionFormat/tests/Generated/Samples/Samples_QueriesClient.cs +++ b/test/TestServerProjectsLowLevel/url-multi-collectionFormat/tests/Generated/Samples/Samples_QueriesClient.cs @@ -7,13 +7,11 @@ 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; +using url_multi_collectionFormat_LowLevel; namespace url_multi_collectionFormat_LowLevel.Samples { @@ -23,8 +21,8 @@ public class Samples_QueriesClient [Ignore("Only validating compilation of examples")] public void Example_ArrayStringMultiNull() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.ArrayStringMultiNull(); Console.WriteLine(response.Status); @@ -34,10 +32,13 @@ public void Example_ArrayStringMultiNull() [Ignore("Only validating compilation of examples")] public void Example_ArrayStringMultiNull_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = client.ArrayStringMultiNull(new string[] { "" }); + Response response = client.ArrayStringMultiNull(arrayQuery: new List() +{ +"" +}); Console.WriteLine(response.Status); } @@ -45,8 +46,8 @@ public void Example_ArrayStringMultiNull_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_ArrayStringMultiNull_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.ArrayStringMultiNullAsync(); Console.WriteLine(response.Status); @@ -56,10 +57,13 @@ public async Task Example_ArrayStringMultiNull_Async() [Ignore("Only validating compilation of examples")] public async Task Example_ArrayStringMultiNull_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = await client.ArrayStringMultiNullAsync(new string[] { "" }); + Response response = await client.ArrayStringMultiNullAsync(arrayQuery: new List() +{ +"" +}); Console.WriteLine(response.Status); } @@ -67,8 +71,8 @@ public async Task Example_ArrayStringMultiNull_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_ArrayStringMultiEmpty() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.ArrayStringMultiEmpty(); Console.WriteLine(response.Status); @@ -78,10 +82,13 @@ public void Example_ArrayStringMultiEmpty() [Ignore("Only validating compilation of examples")] public void Example_ArrayStringMultiEmpty_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = client.ArrayStringMultiEmpty(new string[] { "" }); + Response response = client.ArrayStringMultiEmpty(arrayQuery: new List() +{ +"" +}); Console.WriteLine(response.Status); } @@ -89,8 +96,8 @@ public void Example_ArrayStringMultiEmpty_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_ArrayStringMultiEmpty_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.ArrayStringMultiEmptyAsync(); Console.WriteLine(response.Status); @@ -100,10 +107,13 @@ public async Task Example_ArrayStringMultiEmpty_Async() [Ignore("Only validating compilation of examples")] public async Task Example_ArrayStringMultiEmpty_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = await client.ArrayStringMultiEmptyAsync(new string[] { "" }); + Response response = await client.ArrayStringMultiEmptyAsync(arrayQuery: new List() +{ +"" +}); Console.WriteLine(response.Status); } @@ -111,8 +121,8 @@ public async Task Example_ArrayStringMultiEmpty_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_ArrayStringMultiValid() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.ArrayStringMultiValid(); Console.WriteLine(response.Status); @@ -122,10 +132,13 @@ public void Example_ArrayStringMultiValid() [Ignore("Only validating compilation of examples")] public void Example_ArrayStringMultiValid_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = client.ArrayStringMultiValid(new string[] { "" }); + Response response = client.ArrayStringMultiValid(arrayQuery: new List() +{ +"" +}); Console.WriteLine(response.Status); } @@ -133,8 +146,8 @@ public void Example_ArrayStringMultiValid_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_ArrayStringMultiValid_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.ArrayStringMultiValidAsync(); Console.WriteLine(response.Status); @@ -144,10 +157,13 @@ public async Task Example_ArrayStringMultiValid_Async() [Ignore("Only validating compilation of examples")] public async Task Example_ArrayStringMultiValid_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = await client.ArrayStringMultiValidAsync(new string[] { "" }); + Response response = await client.ArrayStringMultiValidAsync(arrayQuery: new List() +{ +"" +}); Console.WriteLine(response.Status); } } diff --git a/test/TestServerProjectsLowLevel/url/src/Generated/Docs/PathItemsClient.xml b/test/TestServerProjectsLowLevel/url/src/Generated/Docs/PathItemsClient.xml index b35dd4ca905..58a7e0d8230 100644 --- a/test/TestServerProjectsLowLevel/url/src/Generated/Docs/PathItemsClient.xml +++ b/test/TestServerProjectsLowLevel/url/src/Generated/Docs/PathItemsClient.xml @@ -2,164 +2,156 @@ - -This sample shows how to call GetAllWithValuesAsync with required parameters. + +This sample shows how to call GetAllWithValuesAsync. "); -var client = new PathItemsClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathItemsClient client = new PathItemsClient("", credential); Response response = await client.GetAllWithValuesAsync("", ""); Console.WriteLine(response.Status); ]]> This sample shows how to call GetAllWithValuesAsync with all parameters. "); -var client = new PathItemsClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathItemsClient client = new PathItemsClient("", credential); -Response response = await client.GetAllWithValuesAsync("", "", "", ""); +Response response = await client.GetAllWithValuesAsync("", "", pathItemStringQuery: "", localStringQuery: ""); Console.WriteLine(response.Status); -]]> - +]]> - -This sample shows how to call GetAllWithValues with required parameters. + +This sample shows how to call GetAllWithValues. "); -var client = new PathItemsClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathItemsClient client = new PathItemsClient("", credential); Response response = client.GetAllWithValues("", ""); Console.WriteLine(response.Status); ]]> This sample shows how to call GetAllWithValues with all parameters. "); -var client = new PathItemsClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathItemsClient client = new PathItemsClient("", credential); -Response response = client.GetAllWithValues("", "", "", ""); +Response response = client.GetAllWithValues("", "", pathItemStringQuery: "", localStringQuery: ""); Console.WriteLine(response.Status); -]]> - +]]> - -This sample shows how to call GetGlobalQueryNullAsync with required parameters. + +This sample shows how to call GetGlobalQueryNullAsync. "); -var client = new PathItemsClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathItemsClient client = new PathItemsClient("", credential); Response response = await client.GetGlobalQueryNullAsync("", ""); Console.WriteLine(response.Status); ]]> This sample shows how to call GetGlobalQueryNullAsync with all parameters. "); -var client = new PathItemsClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathItemsClient client = new PathItemsClient("", credential); -Response response = await client.GetGlobalQueryNullAsync("", "", "", ""); +Response response = await client.GetGlobalQueryNullAsync("", "", pathItemStringQuery: "", localStringQuery: ""); Console.WriteLine(response.Status); -]]> - +]]> - -This sample shows how to call GetGlobalQueryNull with required parameters. + +This sample shows how to call GetGlobalQueryNull. "); -var client = new PathItemsClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathItemsClient client = new PathItemsClient("", credential); Response response = client.GetGlobalQueryNull("", ""); Console.WriteLine(response.Status); ]]> This sample shows how to call GetGlobalQueryNull with all parameters. "); -var client = new PathItemsClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathItemsClient client = new PathItemsClient("", credential); -Response response = client.GetGlobalQueryNull("", "", "", ""); +Response response = client.GetGlobalQueryNull("", "", pathItemStringQuery: "", localStringQuery: ""); Console.WriteLine(response.Status); -]]> - +]]> - -This sample shows how to call GetGlobalAndLocalQueryNullAsync with required parameters. + +This sample shows how to call GetGlobalAndLocalQueryNullAsync. "); -var client = new PathItemsClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathItemsClient client = new PathItemsClient("", credential); Response response = await client.GetGlobalAndLocalQueryNullAsync("", ""); Console.WriteLine(response.Status); ]]> This sample shows how to call GetGlobalAndLocalQueryNullAsync with all parameters. "); -var client = new PathItemsClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathItemsClient client = new PathItemsClient("", credential); -Response response = await client.GetGlobalAndLocalQueryNullAsync("", "", "", ""); +Response response = await client.GetGlobalAndLocalQueryNullAsync("", "", pathItemStringQuery: "", localStringQuery: ""); Console.WriteLine(response.Status); -]]> - +]]> - -This sample shows how to call GetGlobalAndLocalQueryNull with required parameters. + +This sample shows how to call GetGlobalAndLocalQueryNull. "); -var client = new PathItemsClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathItemsClient client = new PathItemsClient("", credential); Response response = client.GetGlobalAndLocalQueryNull("", ""); Console.WriteLine(response.Status); ]]> This sample shows how to call GetGlobalAndLocalQueryNull with all parameters. "); -var client = new PathItemsClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathItemsClient client = new PathItemsClient("", credential); -Response response = client.GetGlobalAndLocalQueryNull("", "", "", ""); +Response response = client.GetGlobalAndLocalQueryNull("", "", pathItemStringQuery: "", localStringQuery: ""); Console.WriteLine(response.Status); -]]> - +]]> - -This sample shows how to call GetLocalPathItemQueryNullAsync with required parameters. + +This sample shows how to call GetLocalPathItemQueryNullAsync. "); -var client = new PathItemsClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathItemsClient client = new PathItemsClient("", credential); Response response = await client.GetLocalPathItemQueryNullAsync("", ""); Console.WriteLine(response.Status); ]]> This sample shows how to call GetLocalPathItemQueryNullAsync with all parameters. "); -var client = new PathItemsClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathItemsClient client = new PathItemsClient("", credential); -Response response = await client.GetLocalPathItemQueryNullAsync("", "", "", ""); +Response response = await client.GetLocalPathItemQueryNullAsync("", "", pathItemStringQuery: "", localStringQuery: ""); Console.WriteLine(response.Status); -]]> - +]]> - -This sample shows how to call GetLocalPathItemQueryNull with required parameters. + +This sample shows how to call GetLocalPathItemQueryNull. "); -var client = new PathItemsClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathItemsClient client = new PathItemsClient("", credential); Response response = client.GetLocalPathItemQueryNull("", ""); Console.WriteLine(response.Status); ]]> This sample shows how to call GetLocalPathItemQueryNull with all parameters. "); -var client = new PathItemsClient("", credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathItemsClient client = new PathItemsClient("", credential); -Response response = client.GetLocalPathItemQueryNull("", "", "", ""); +Response response = client.GetLocalPathItemQueryNull("", "", pathItemStringQuery: "", localStringQuery: ""); Console.WriteLine(response.Status); -]]> - +]]> \ No newline at end of file diff --git a/test/TestServerProjectsLowLevel/url/src/Generated/Docs/PathsClient.xml b/test/TestServerProjectsLowLevel/url/src/Generated/Docs/PathsClient.xml index 0957cedace2..9c3c2c4ddbf 100644 --- a/test/TestServerProjectsLowLevel/url/src/Generated/Docs/PathsClient.xml +++ b/test/TestServerProjectsLowLevel/url/src/Generated/Docs/PathsClient.xml @@ -2,652 +2,1042 @@ - + This sample shows how to call GetBooleanTrueAsync. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = await client.GetBooleanTrueAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call GetBooleanTrueAsync with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = await client.GetBooleanTrueAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call GetBooleanTrue. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = client.GetBooleanTrue(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call GetBooleanTrue with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = client.GetBooleanTrue(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call GetBooleanFalseAsync. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = await client.GetBooleanFalseAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call GetBooleanFalseAsync with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = await client.GetBooleanFalseAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call GetBooleanFalse. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = client.GetBooleanFalse(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call GetBooleanFalse with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = client.GetBooleanFalse(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call GetIntOneMillionAsync. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = await client.GetIntOneMillionAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call GetIntOneMillionAsync with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = await client.GetIntOneMillionAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call GetIntOneMillion. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = client.GetIntOneMillion(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call GetIntOneMillion with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = client.GetIntOneMillion(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call GetIntNegativeOneMillionAsync. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = await client.GetIntNegativeOneMillionAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call GetIntNegativeOneMillionAsync with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = await client.GetIntNegativeOneMillionAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call GetIntNegativeOneMillion. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = client.GetIntNegativeOneMillion(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call GetIntNegativeOneMillion with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = client.GetIntNegativeOneMillion(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call GetTenBillionAsync. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = await client.GetTenBillionAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call GetTenBillionAsync with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = await client.GetTenBillionAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call GetTenBillion. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = client.GetTenBillion(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call GetTenBillion with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = client.GetTenBillion(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call GetNegativeTenBillionAsync. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = await client.GetNegativeTenBillionAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call GetNegativeTenBillionAsync with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = await client.GetNegativeTenBillionAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call GetNegativeTenBillion. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = client.GetNegativeTenBillion(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call GetNegativeTenBillion with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = client.GetNegativeTenBillion(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call FloatScientificPositiveAsync. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = await client.FloatScientificPositiveAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call FloatScientificPositiveAsync with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = await client.FloatScientificPositiveAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call FloatScientificPositive. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = client.FloatScientificPositive(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call FloatScientificPositive with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = client.FloatScientificPositive(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call FloatScientificNegativeAsync. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = await client.FloatScientificNegativeAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call FloatScientificNegativeAsync with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = await client.FloatScientificNegativeAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call FloatScientificNegative. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = client.FloatScientificNegative(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call FloatScientificNegative with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = client.FloatScientificNegative(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call DoubleDecimalPositiveAsync. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = await client.DoubleDecimalPositiveAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call DoubleDecimalPositiveAsync with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = await client.DoubleDecimalPositiveAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call DoubleDecimalPositive. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = client.DoubleDecimalPositive(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call DoubleDecimalPositive with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = client.DoubleDecimalPositive(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call DoubleDecimalNegativeAsync. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = await client.DoubleDecimalNegativeAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call DoubleDecimalNegativeAsync with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = await client.DoubleDecimalNegativeAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call DoubleDecimalNegative. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = client.DoubleDecimalNegative(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call DoubleDecimalNegative with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = client.DoubleDecimalNegative(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call StringUnicodeAsync. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = await client.StringUnicodeAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call StringUnicodeAsync with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = await client.StringUnicodeAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call StringUnicode. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = client.StringUnicode(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call StringUnicode with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = client.StringUnicode(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call StringUrlEncodedAsync. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = await client.StringUrlEncodedAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call StringUrlEncodedAsync with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = await client.StringUrlEncodedAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call StringUrlEncoded. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = client.StringUrlEncoded(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call StringUrlEncoded with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = client.StringUrlEncoded(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call StringUrlNonEncodedAsync. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = await client.StringUrlNonEncodedAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call StringUrlNonEncodedAsync with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = await client.StringUrlNonEncodedAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call StringUrlNonEncoded. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = client.StringUrlNonEncoded(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call StringUrlNonEncoded with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = client.StringUrlNonEncoded(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call StringEmptyAsync. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = await client.StringEmptyAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call StringEmptyAsync with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = await client.StringEmptyAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call StringEmpty. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = client.StringEmpty(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call StringEmpty with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = client.StringEmpty(); +Console.WriteLine(response.Status); +]]> - -This sample shows how to call StringNullAsync with required parameters. + +This sample shows how to call StringNullAsync. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = await client.StringNullAsync(""); Console.WriteLine(response.Status); ]]> - +This sample shows how to call StringNullAsync with all parameters. +"); +PathsClient client = new PathsClient(credential); + +Response response = await client.StringNullAsync(""); +Console.WriteLine(response.Status); +]]> - -This sample shows how to call StringNull with required parameters. + +This sample shows how to call StringNull. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = client.StringNull(""); Console.WriteLine(response.Status); ]]> - +This sample shows how to call StringNull with all parameters. +"); +PathsClient client = new PathsClient(credential); + +Response response = client.StringNull(""); +Console.WriteLine(response.Status); +]]> - -This sample shows how to call EnumValidAsync with required parameters. + +This sample shows how to call EnumValidAsync. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); -Response response = await client.EnumValidAsync(""); +Response response = await client.EnumValidAsync("red color"); Console.WriteLine(response.Status); ]]> - +This sample shows how to call EnumValidAsync with all parameters. +"); +PathsClient client = new PathsClient(credential); + +Response response = await client.EnumValidAsync("red color"); +Console.WriteLine(response.Status); +]]> - -This sample shows how to call EnumValid with required parameters. + +This sample shows how to call EnumValid. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); -Response response = client.EnumValid(""); +Response response = client.EnumValid("red color"); Console.WriteLine(response.Status); ]]> - +This sample shows how to call EnumValid with all parameters. +"); +PathsClient client = new PathsClient(credential); + +Response response = client.EnumValid("red color"); +Console.WriteLine(response.Status); +]]> - -This sample shows how to call EnumNullAsync with required parameters. + +This sample shows how to call EnumNullAsync. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); -Response response = await client.EnumNullAsync(""); +Response response = await client.EnumNullAsync("red color"); Console.WriteLine(response.Status); ]]> - +This sample shows how to call EnumNullAsync with all parameters. +"); +PathsClient client = new PathsClient(credential); + +Response response = await client.EnumNullAsync("red color"); +Console.WriteLine(response.Status); +]]> - -This sample shows how to call EnumNull with required parameters. + +This sample shows how to call EnumNull. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); -Response response = client.EnumNull(""); +Response response = client.EnumNull("red color"); Console.WriteLine(response.Status); ]]> - +This sample shows how to call EnumNull with all parameters. +"); +PathsClient client = new PathsClient(credential); + +Response response = client.EnumNull("red color"); +Console.WriteLine(response.Status); +]]> - -This sample shows how to call ByteMultiByteAsync with required parameters. + +This sample shows how to call ByteMultiByteAsync. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); -Response response = await client.ByteMultiByteAsync(BinaryData.FromString("")); +Response response = await client.ByteMultiByteAsync(BinaryData.FromObjectAsJson(new object())); Console.WriteLine(response.Status); ]]> - +This sample shows how to call ByteMultiByteAsync with all parameters. +"); +PathsClient client = new PathsClient(credential); + +Response response = await client.ByteMultiByteAsync(BinaryData.FromObjectAsJson(new object())); +Console.WriteLine(response.Status); +]]> - -This sample shows how to call ByteMultiByte with required parameters. + +This sample shows how to call ByteMultiByte. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); -Response response = client.ByteMultiByte(BinaryData.FromString("")); +Response response = client.ByteMultiByte(BinaryData.FromObjectAsJson(new object())); Console.WriteLine(response.Status); ]]> - +This sample shows how to call ByteMultiByte with all parameters. +"); +PathsClient client = new PathsClient(credential); + +Response response = client.ByteMultiByte(BinaryData.FromObjectAsJson(new object())); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call ByteEmptyAsync. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = await client.ByteEmptyAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call ByteEmptyAsync with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = await client.ByteEmptyAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call ByteEmpty. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = client.ByteEmpty(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call ByteEmpty with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = client.ByteEmpty(); +Console.WriteLine(response.Status); +]]> - -This sample shows how to call ByteNullAsync with required parameters. + +This sample shows how to call ByteNullAsync. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); -Response response = await client.ByteNullAsync(BinaryData.FromString("")); +Response response = await client.ByteNullAsync(BinaryData.FromObjectAsJson(new object())); Console.WriteLine(response.Status); ]]> - +This sample shows how to call ByteNullAsync with all parameters. +"); +PathsClient client = new PathsClient(credential); + +Response response = await client.ByteNullAsync(BinaryData.FromObjectAsJson(new object())); +Console.WriteLine(response.Status); +]]> - -This sample shows how to call ByteNull with required parameters. + +This sample shows how to call ByteNull. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); -Response response = client.ByteNull(BinaryData.FromString("")); +Response response = client.ByteNull(BinaryData.FromObjectAsJson(new object())); Console.WriteLine(response.Status); ]]> - +This sample shows how to call ByteNull with all parameters. +"); +PathsClient client = new PathsClient(credential); + +Response response = client.ByteNull(BinaryData.FromObjectAsJson(new object())); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call DateValidAsync. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = await client.DateValidAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call DateValidAsync with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = await client.DateValidAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call DateValid. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = client.DateValid(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call DateValid with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = client.DateValid(); +Console.WriteLine(response.Status); +]]> - -This sample shows how to call DateNullAsync with required parameters. + +This sample shows how to call DateNullAsync. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); -Response response = await client.DateNullAsync(DateTimeOffset.UtcNow); +Response response = await client.DateNullAsync(DateTimeOffset.Parse("2022-05-10")); Console.WriteLine(response.Status); ]]> - +This sample shows how to call DateNullAsync with all parameters. +"); +PathsClient client = new PathsClient(credential); + +Response response = await client.DateNullAsync(DateTimeOffset.Parse("2022-05-10")); +Console.WriteLine(response.Status); +]]> - -This sample shows how to call DateNull with required parameters. + +This sample shows how to call DateNull. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); -Response response = client.DateNull(DateTimeOffset.UtcNow); +Response response = client.DateNull(DateTimeOffset.Parse("2022-05-10")); Console.WriteLine(response.Status); ]]> - +This sample shows how to call DateNull with all parameters. +"); +PathsClient client = new PathsClient(credential); + +Response response = client.DateNull(DateTimeOffset.Parse("2022-05-10")); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call DateTimeValidAsync. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = await client.DateTimeValidAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call DateTimeValidAsync with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = await client.DateTimeValidAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call DateTimeValid. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); Response response = client.DateTimeValid(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call DateTimeValid with all request content. +"); +PathsClient client = new PathsClient(credential); + +Response response = client.DateTimeValid(); +Console.WriteLine(response.Status); +]]> - -This sample shows how to call DateTimeNullAsync with required parameters. + +This sample shows how to call DateTimeNullAsync. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); -Response response = await client.DateTimeNullAsync(DateTimeOffset.UtcNow); +Response response = await client.DateTimeNullAsync(DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z")); Console.WriteLine(response.Status); ]]> - +This sample shows how to call DateTimeNullAsync with all parameters. +"); +PathsClient client = new PathsClient(credential); + +Response response = await client.DateTimeNullAsync(DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z")); +Console.WriteLine(response.Status); +]]> - -This sample shows how to call DateTimeNull with required parameters. + +This sample shows how to call DateTimeNull. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); -Response response = client.DateTimeNull(DateTimeOffset.UtcNow); +Response response = client.DateTimeNull(DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z")); Console.WriteLine(response.Status); ]]> - +This sample shows how to call DateTimeNull with all parameters. +"); +PathsClient client = new PathsClient(credential); + +Response response = client.DateTimeNull(DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z")); +Console.WriteLine(response.Status); +]]> - -This sample shows how to call Base64UrlAsync with required parameters. + +This sample shows how to call Base64UrlAsync. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); -Response response = await client.Base64UrlAsync(BinaryData.FromString("")); +Response response = await client.Base64UrlAsync(BinaryData.FromObjectAsJson(new object())); Console.WriteLine(response.Status); ]]> - +This sample shows how to call Base64UrlAsync with all parameters. +"); +PathsClient client = new PathsClient(credential); + +Response response = await client.Base64UrlAsync(BinaryData.FromObjectAsJson(new object())); +Console.WriteLine(response.Status); +]]> - -This sample shows how to call Base64Url with required parameters. + +This sample shows how to call Base64Url. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); -Response response = client.Base64Url(BinaryData.FromString("")); +Response response = client.Base64Url(BinaryData.FromObjectAsJson(new object())); Console.WriteLine(response.Status); ]]> - +This sample shows how to call Base64Url with all parameters. +"); +PathsClient client = new PathsClient(credential); + +Response response = client.Base64Url(BinaryData.FromObjectAsJson(new object())); +Console.WriteLine(response.Status); +]]> - -This sample shows how to call ArrayCsvInPathAsync with required parameters. + +This sample shows how to call ArrayCsvInPathAsync. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); -Response response = await client.ArrayCsvInPathAsync(new String[]{""}); +Response response = await client.ArrayCsvInPathAsync(new List() +{ + "" +}); Console.WriteLine(response.Status); ]]> - +This sample shows how to call ArrayCsvInPathAsync with all parameters. +"); +PathsClient client = new PathsClient(credential); + +Response response = await client.ArrayCsvInPathAsync(new List() +{ + "" +}); +Console.WriteLine(response.Status); +]]> - -This sample shows how to call ArrayCsvInPath with required parameters. + +This sample shows how to call ArrayCsvInPath. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); -Response response = client.ArrayCsvInPath(new String[]{""}); +Response response = client.ArrayCsvInPath(new List() +{ + "" +}); Console.WriteLine(response.Status); ]]> - +This sample shows how to call ArrayCsvInPath with all parameters. +"); +PathsClient client = new PathsClient(credential); + +Response response = client.ArrayCsvInPath(new List() +{ + "" +}); +Console.WriteLine(response.Status); +]]> - -This sample shows how to call UnixTimeUrlAsync with required parameters. + +This sample shows how to call UnixTimeUrlAsync. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); -Response response = await client.UnixTimeUrlAsync(DateTimeOffset.UtcNow); +Response response = await client.UnixTimeUrlAsync(DateTimeOffset.FromUnixTimeSeconds(1652209051)); Console.WriteLine(response.Status); ]]> - +This sample shows how to call UnixTimeUrlAsync with all parameters. +"); +PathsClient client = new PathsClient(credential); + +Response response = await client.UnixTimeUrlAsync(DateTimeOffset.FromUnixTimeSeconds(1652209051)); +Console.WriteLine(response.Status); +]]> - -This sample shows how to call UnixTimeUrl with required parameters. + +This sample shows how to call UnixTimeUrl. "); -var client = new PathsClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +PathsClient client = new PathsClient(credential); -Response response = client.UnixTimeUrl(DateTimeOffset.UtcNow); +Response response = client.UnixTimeUrl(DateTimeOffset.FromUnixTimeSeconds(1652209051)); Console.WriteLine(response.Status); ]]> - +This sample shows how to call UnixTimeUrl with all parameters. +"); +PathsClient client = new PathsClient(credential); + +Response response = client.UnixTimeUrl(DateTimeOffset.FromUnixTimeSeconds(1652209051)); +Console.WriteLine(response.Status); +]]> \ No newline at end of file diff --git a/test/TestServerProjectsLowLevel/url/src/Generated/Docs/QueriesClient.xml b/test/TestServerProjectsLowLevel/url/src/Generated/Docs/QueriesClient.xml index 994544075b1..78060e0e91e 100644 --- a/test/TestServerProjectsLowLevel/url/src/Generated/Docs/QueriesClient.xml +++ b/test/TestServerProjectsLowLevel/url/src/Generated/Docs/QueriesClient.xml @@ -2,1148 +2,1376 @@ - + This sample shows how to call GetBooleanTrueAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.GetBooleanTrueAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call GetBooleanTrueAsync with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = await client.GetBooleanTrueAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call GetBooleanTrue. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.GetBooleanTrue(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call GetBooleanTrue with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = client.GetBooleanTrue(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call GetBooleanFalseAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.GetBooleanFalseAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call GetBooleanFalseAsync with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = await client.GetBooleanFalseAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call GetBooleanFalse. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.GetBooleanFalse(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call GetBooleanFalse with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = client.GetBooleanFalse(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call GetBooleanNullAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.GetBooleanNullAsync(); Console.WriteLine(response.Status); ]]> This sample shows how to call GetBooleanNullAsync with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = await client.GetBooleanNullAsync(true); +Response response = await client.GetBooleanNullAsync(boolQuery: true); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call GetBooleanNull. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.GetBooleanNull(); Console.WriteLine(response.Status); ]]> This sample shows how to call GetBooleanNull with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = client.GetBooleanNull(true); +Response response = client.GetBooleanNull(boolQuery: true); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call GetIntOneMillionAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.GetIntOneMillionAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call GetIntOneMillionAsync with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = await client.GetIntOneMillionAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call GetIntOneMillion. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.GetIntOneMillion(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call GetIntOneMillion with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = client.GetIntOneMillion(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call GetIntNegativeOneMillionAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.GetIntNegativeOneMillionAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call GetIntNegativeOneMillionAsync with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = await client.GetIntNegativeOneMillionAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call GetIntNegativeOneMillion. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.GetIntNegativeOneMillion(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call GetIntNegativeOneMillion with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = client.GetIntNegativeOneMillion(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call GetIntNullAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.GetIntNullAsync(); Console.WriteLine(response.Status); ]]> This sample shows how to call GetIntNullAsync with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = await client.GetIntNullAsync(1234); +Response response = await client.GetIntNullAsync(intQuery: 1234); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call GetIntNull. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.GetIntNull(); Console.WriteLine(response.Status); ]]> This sample shows how to call GetIntNull with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = client.GetIntNull(1234); +Response response = client.GetIntNull(intQuery: 1234); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call GetTenBillionAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.GetTenBillionAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call GetTenBillionAsync with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = await client.GetTenBillionAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call GetTenBillion. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.GetTenBillion(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call GetTenBillion with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = client.GetTenBillion(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call GetNegativeTenBillionAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.GetNegativeTenBillionAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call GetNegativeTenBillionAsync with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = await client.GetNegativeTenBillionAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call GetNegativeTenBillion. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.GetNegativeTenBillion(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call GetNegativeTenBillion with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = client.GetNegativeTenBillion(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call GetLongNullAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.GetLongNullAsync(); Console.WriteLine(response.Status); ]]> This sample shows how to call GetLongNullAsync with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = await client.GetLongNullAsync(1234); +Response response = await client.GetLongNullAsync(longQuery: 1234L); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call GetLongNull. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.GetLongNull(); Console.WriteLine(response.Status); ]]> This sample shows how to call GetLongNull with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = client.GetLongNull(1234); +Response response = client.GetLongNull(longQuery: 1234L); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call FloatScientificPositiveAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.FloatScientificPositiveAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call FloatScientificPositiveAsync with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = await client.FloatScientificPositiveAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call FloatScientificPositive. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.FloatScientificPositive(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call FloatScientificPositive with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = client.FloatScientificPositive(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call FloatScientificNegativeAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.FloatScientificNegativeAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call FloatScientificNegativeAsync with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = await client.FloatScientificNegativeAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call FloatScientificNegative. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.FloatScientificNegative(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call FloatScientificNegative with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = client.FloatScientificNegative(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call FloatNullAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.FloatNullAsync(); Console.WriteLine(response.Status); ]]> This sample shows how to call FloatNullAsync with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = await client.FloatNullAsync(3.14f); +Response response = await client.FloatNullAsync(floatQuery: 123.45F); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call FloatNull. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.FloatNull(); Console.WriteLine(response.Status); ]]> This sample shows how to call FloatNull with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = client.FloatNull(3.14f); +Response response = client.FloatNull(floatQuery: 123.45F); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call DoubleDecimalPositiveAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.DoubleDecimalPositiveAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call DoubleDecimalPositiveAsync with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = await client.DoubleDecimalPositiveAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call DoubleDecimalPositive. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.DoubleDecimalPositive(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call DoubleDecimalPositive with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = client.DoubleDecimalPositive(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call DoubleDecimalNegativeAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.DoubleDecimalNegativeAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call DoubleDecimalNegativeAsync with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = await client.DoubleDecimalNegativeAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call DoubleDecimalNegative. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.DoubleDecimalNegative(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call DoubleDecimalNegative with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = client.DoubleDecimalNegative(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call DoubleNullAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.DoubleNullAsync(); Console.WriteLine(response.Status); ]]> This sample shows how to call DoubleNullAsync with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = await client.DoubleNullAsync(3.14); +Response response = await client.DoubleNullAsync(doubleQuery: 123.45); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call DoubleNull. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.DoubleNull(); Console.WriteLine(response.Status); ]]> This sample shows how to call DoubleNull with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = client.DoubleNull(3.14); +Response response = client.DoubleNull(doubleQuery: 123.45); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call StringUnicodeAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.StringUnicodeAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call StringUnicodeAsync with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = await client.StringUnicodeAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call StringUnicode. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.StringUnicode(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call StringUnicode with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = client.StringUnicode(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call StringUrlEncodedAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.StringUrlEncodedAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call StringUrlEncodedAsync with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = await client.StringUrlEncodedAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call StringUrlEncoded. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.StringUrlEncoded(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call StringUrlEncoded with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = client.StringUrlEncoded(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call StringEmptyAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.StringEmptyAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call StringEmptyAsync with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = await client.StringEmptyAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call StringEmpty. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.StringEmpty(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call StringEmpty with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = client.StringEmpty(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call StringNullAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.StringNullAsync(); Console.WriteLine(response.Status); ]]> This sample shows how to call StringNullAsync with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = await client.StringNullAsync(""); +Response response = await client.StringNullAsync(stringQuery: ""); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call StringNull. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.StringNull(); Console.WriteLine(response.Status); ]]> This sample shows how to call StringNull with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = client.StringNull(""); +Response response = client.StringNull(stringQuery: ""); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call EnumValidAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.EnumValidAsync(); Console.WriteLine(response.Status); ]]> This sample shows how to call EnumValidAsync with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = await client.EnumValidAsync(""); +Response response = await client.EnumValidAsync(enumQuery: "red color"); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call EnumValid. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.EnumValid(); Console.WriteLine(response.Status); ]]> This sample shows how to call EnumValid with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = client.EnumValid(""); +Response response = client.EnumValid(enumQuery: "red color"); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call EnumNullAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.EnumNullAsync(); Console.WriteLine(response.Status); ]]> This sample shows how to call EnumNullAsync with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = await client.EnumNullAsync(""); +Response response = await client.EnumNullAsync(enumQuery: "red color"); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call EnumNull. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.EnumNull(); Console.WriteLine(response.Status); ]]> This sample shows how to call EnumNull with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = client.EnumNull(""); +Response response = client.EnumNull(enumQuery: "red color"); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call ByteMultiByteAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.ByteMultiByteAsync(); Console.WriteLine(response.Status); ]]> This sample shows how to call ByteMultiByteAsync with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = await client.ByteMultiByteAsync(BinaryData.FromString("")); +Response response = await client.ByteMultiByteAsync(byteQuery: BinaryData.FromObjectAsJson(new object())); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call ByteMultiByte. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.ByteMultiByte(); Console.WriteLine(response.Status); ]]> This sample shows how to call ByteMultiByte with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = client.ByteMultiByte(BinaryData.FromString("")); +Response response = client.ByteMultiByte(byteQuery: BinaryData.FromObjectAsJson(new object())); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call ByteEmptyAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.ByteEmptyAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call ByteEmptyAsync with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = await client.ByteEmptyAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call ByteEmpty. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.ByteEmpty(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call ByteEmpty with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = client.ByteEmpty(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call ByteNullAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.ByteNullAsync(); Console.WriteLine(response.Status); ]]> This sample shows how to call ByteNullAsync with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = await client.ByteNullAsync(BinaryData.FromString("")); +Response response = await client.ByteNullAsync(byteQuery: BinaryData.FromObjectAsJson(new object())); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call ByteNull. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.ByteNull(); Console.WriteLine(response.Status); ]]> This sample shows how to call ByteNull with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = client.ByteNull(BinaryData.FromString("")); +Response response = client.ByteNull(byteQuery: BinaryData.FromObjectAsJson(new object())); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call DateValidAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.DateValidAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call DateValidAsync with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = await client.DateValidAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call DateValid. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.DateValid(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call DateValid with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = client.DateValid(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call DateNullAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.DateNullAsync(); Console.WriteLine(response.Status); ]]> This sample shows how to call DateNullAsync with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = await client.DateNullAsync(DateTimeOffset.UtcNow); +Response response = await client.DateNullAsync(dateQuery: DateTimeOffset.Parse("2022-05-10")); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call DateNull. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.DateNull(); Console.WriteLine(response.Status); ]]> This sample shows how to call DateNull with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = client.DateNull(DateTimeOffset.UtcNow); +Response response = client.DateNull(dateQuery: DateTimeOffset.Parse("2022-05-10")); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call DateTimeValidAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.DateTimeValidAsync(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call DateTimeValidAsync with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = await client.DateTimeValidAsync(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call DateTimeValid. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.DateTimeValid(); Console.WriteLine(response.Status); ]]> - +This sample shows how to call DateTimeValid with all request content. +"); +QueriesClient client = new QueriesClient(credential); + +Response response = client.DateTimeValid(); +Console.WriteLine(response.Status); +]]> - + This sample shows how to call DateTimeNullAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.DateTimeNullAsync(); Console.WriteLine(response.Status); ]]> This sample shows how to call DateTimeNullAsync with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = await client.DateTimeNullAsync(DateTimeOffset.UtcNow); +Response response = await client.DateTimeNullAsync(dateTimeQuery: DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z")); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call DateTimeNull. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.DateTimeNull(); Console.WriteLine(response.Status); ]]> This sample shows how to call DateTimeNull with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = client.DateTimeNull(DateTimeOffset.UtcNow); +Response response = client.DateTimeNull(dateTimeQuery: DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z")); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call ArrayStringCsvValidAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.ArrayStringCsvValidAsync(); Console.WriteLine(response.Status); ]]> This sample shows how to call ArrayStringCsvValidAsync with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = await client.ArrayStringCsvValidAsync(new String[]{""}); +Response response = await client.ArrayStringCsvValidAsync(arrayQuery: new List() +{ + "" +}); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call ArrayStringCsvValid. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.ArrayStringCsvValid(); Console.WriteLine(response.Status); ]]> This sample shows how to call ArrayStringCsvValid with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = client.ArrayStringCsvValid(new String[]{""}); +Response response = client.ArrayStringCsvValid(arrayQuery: new List() +{ + "" +}); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call ArrayStringCsvNullAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.ArrayStringCsvNullAsync(); Console.WriteLine(response.Status); ]]> This sample shows how to call ArrayStringCsvNullAsync with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = await client.ArrayStringCsvNullAsync(new String[]{""}); +Response response = await client.ArrayStringCsvNullAsync(arrayQuery: new List() +{ + "" +}); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call ArrayStringCsvNull. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.ArrayStringCsvNull(); Console.WriteLine(response.Status); ]]> This sample shows how to call ArrayStringCsvNull with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = client.ArrayStringCsvNull(new String[]{""}); +Response response = client.ArrayStringCsvNull(arrayQuery: new List() +{ + "" +}); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call ArrayStringCsvEmptyAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.ArrayStringCsvEmptyAsync(); Console.WriteLine(response.Status); ]]> This sample shows how to call ArrayStringCsvEmptyAsync with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = await client.ArrayStringCsvEmptyAsync(new String[]{""}); +Response response = await client.ArrayStringCsvEmptyAsync(arrayQuery: new List() +{ + "" +}); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call ArrayStringCsvEmpty. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.ArrayStringCsvEmpty(); Console.WriteLine(response.Status); ]]> This sample shows how to call ArrayStringCsvEmpty with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = client.ArrayStringCsvEmpty(new String[]{""}); +Response response = client.ArrayStringCsvEmpty(arrayQuery: new List() +{ + "" +}); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call ArrayStringNoCollectionFormatEmptyAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.ArrayStringNoCollectionFormatEmptyAsync(); Console.WriteLine(response.Status); ]]> This sample shows how to call ArrayStringNoCollectionFormatEmptyAsync with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = await client.ArrayStringNoCollectionFormatEmptyAsync(new String[]{""}); +Response response = await client.ArrayStringNoCollectionFormatEmptyAsync(arrayQuery: new List() +{ + "" +}); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call ArrayStringNoCollectionFormatEmpty. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.ArrayStringNoCollectionFormatEmpty(); Console.WriteLine(response.Status); ]]> This sample shows how to call ArrayStringNoCollectionFormatEmpty with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = client.ArrayStringNoCollectionFormatEmpty(new String[]{""}); +Response response = client.ArrayStringNoCollectionFormatEmpty(arrayQuery: new List() +{ + "" +}); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call ArrayStringSsvValidAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.ArrayStringSsvValidAsync(); Console.WriteLine(response.Status); ]]> This sample shows how to call ArrayStringSsvValidAsync with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = await client.ArrayStringSsvValidAsync(new String[]{""}); +Response response = await client.ArrayStringSsvValidAsync(arrayQuery: new List() +{ + "" +}); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call ArrayStringSsvValid. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.ArrayStringSsvValid(); Console.WriteLine(response.Status); ]]> This sample shows how to call ArrayStringSsvValid with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = client.ArrayStringSsvValid(new String[]{""}); +Response response = client.ArrayStringSsvValid(arrayQuery: new List() +{ + "" +}); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call ArrayStringTsvValidAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.ArrayStringTsvValidAsync(); Console.WriteLine(response.Status); ]]> This sample shows how to call ArrayStringTsvValidAsync with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = await client.ArrayStringTsvValidAsync(new String[]{""}); +Response response = await client.ArrayStringTsvValidAsync(arrayQuery: new List() +{ + "" +}); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call ArrayStringTsvValid. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.ArrayStringTsvValid(); Console.WriteLine(response.Status); ]]> This sample shows how to call ArrayStringTsvValid with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = client.ArrayStringTsvValid(new String[]{""}); +Response response = client.ArrayStringTsvValid(arrayQuery: new List() +{ + "" +}); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call ArrayStringPipesValidAsync. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = await client.ArrayStringPipesValidAsync(); Console.WriteLine(response.Status); ]]> This sample shows how to call ArrayStringPipesValidAsync with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = await client.ArrayStringPipesValidAsync(new String[]{""}); +Response response = await client.ArrayStringPipesValidAsync(arrayQuery: new List() +{ + "" +}); Console.WriteLine(response.Status); -]]> - +]]> - + This sample shows how to call ArrayStringPipesValid. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); Response response = client.ArrayStringPipesValid(); Console.WriteLine(response.Status); ]]> This sample shows how to call ArrayStringPipesValid with all parameters. "); -var client = new QueriesClient(credential); +AzureKeyCredential credential = new AzureKeyCredential(""); +QueriesClient client = new QueriesClient(credential); -Response response = client.ArrayStringPipesValid(new String[]{""}); +Response response = client.ArrayStringPipesValid(arrayQuery: new List() +{ + "" +}); Console.WriteLine(response.Status); -]]> - +]]> \ No newline at end of file diff --git a/test/TestServerProjectsLowLevel/url/tests/Generated/Samples/Samples_PathItemsClient.cs b/test/TestServerProjectsLowLevel/url/tests/Generated/Samples/Samples_PathItemsClient.cs index 51bcc535c10..2aacece5276 100644 --- a/test/TestServerProjectsLowLevel/url/tests/Generated/Samples/Samples_PathItemsClient.cs +++ b/test/TestServerProjectsLowLevel/url/tests/Generated/Samples/Samples_PathItemsClient.cs @@ -6,14 +6,11 @@ #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; +using url_LowLevel; namespace url_LowLevel.Samples { @@ -23,8 +20,8 @@ public class Samples_PathItemsClient [Ignore("Only validating compilation of examples")] public void Example_GetAllWithValues() { - var credential = new AzureKeyCredential(""); - var client = new PathItemsClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathItemsClient client = new PathItemsClient("", credential); Response response = client.GetAllWithValues("", ""); Console.WriteLine(response.Status); @@ -34,10 +31,10 @@ public void Example_GetAllWithValues() [Ignore("Only validating compilation of examples")] public void Example_GetAllWithValues_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathItemsClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathItemsClient client = new PathItemsClient("", credential); - Response response = client.GetAllWithValues("", "", "", ""); + Response response = client.GetAllWithValues("", "", pathItemStringQuery: "", localStringQuery: ""); Console.WriteLine(response.Status); } @@ -45,8 +42,8 @@ public void Example_GetAllWithValues_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetAllWithValues_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathItemsClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathItemsClient client = new PathItemsClient("", credential); Response response = await client.GetAllWithValuesAsync("", ""); Console.WriteLine(response.Status); @@ -56,10 +53,10 @@ public async Task Example_GetAllWithValues_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetAllWithValues_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathItemsClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathItemsClient client = new PathItemsClient("", credential); - Response response = await client.GetAllWithValuesAsync("", "", "", ""); + Response response = await client.GetAllWithValuesAsync("", "", pathItemStringQuery: "", localStringQuery: ""); Console.WriteLine(response.Status); } @@ -67,8 +64,8 @@ public async Task Example_GetAllWithValues_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetGlobalQueryNull() { - var credential = new AzureKeyCredential(""); - var client = new PathItemsClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathItemsClient client = new PathItemsClient("", credential); Response response = client.GetGlobalQueryNull("", ""); Console.WriteLine(response.Status); @@ -78,10 +75,10 @@ public void Example_GetGlobalQueryNull() [Ignore("Only validating compilation of examples")] public void Example_GetGlobalQueryNull_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathItemsClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathItemsClient client = new PathItemsClient("", credential); - Response response = client.GetGlobalQueryNull("", "", "", ""); + Response response = client.GetGlobalQueryNull("", "", pathItemStringQuery: "", localStringQuery: ""); Console.WriteLine(response.Status); } @@ -89,8 +86,8 @@ public void Example_GetGlobalQueryNull_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetGlobalQueryNull_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathItemsClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathItemsClient client = new PathItemsClient("", credential); Response response = await client.GetGlobalQueryNullAsync("", ""); Console.WriteLine(response.Status); @@ -100,10 +97,10 @@ public async Task Example_GetGlobalQueryNull_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetGlobalQueryNull_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathItemsClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathItemsClient client = new PathItemsClient("", credential); - Response response = await client.GetGlobalQueryNullAsync("", "", "", ""); + Response response = await client.GetGlobalQueryNullAsync("", "", pathItemStringQuery: "", localStringQuery: ""); Console.WriteLine(response.Status); } @@ -111,8 +108,8 @@ public async Task Example_GetGlobalQueryNull_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetGlobalAndLocalQueryNull() { - var credential = new AzureKeyCredential(""); - var client = new PathItemsClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathItemsClient client = new PathItemsClient("", credential); Response response = client.GetGlobalAndLocalQueryNull("", ""); Console.WriteLine(response.Status); @@ -122,10 +119,10 @@ public void Example_GetGlobalAndLocalQueryNull() [Ignore("Only validating compilation of examples")] public void Example_GetGlobalAndLocalQueryNull_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathItemsClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathItemsClient client = new PathItemsClient("", credential); - Response response = client.GetGlobalAndLocalQueryNull("", "", "", ""); + Response response = client.GetGlobalAndLocalQueryNull("", "", pathItemStringQuery: "", localStringQuery: ""); Console.WriteLine(response.Status); } @@ -133,8 +130,8 @@ public void Example_GetGlobalAndLocalQueryNull_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetGlobalAndLocalQueryNull_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathItemsClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathItemsClient client = new PathItemsClient("", credential); Response response = await client.GetGlobalAndLocalQueryNullAsync("", ""); Console.WriteLine(response.Status); @@ -144,10 +141,10 @@ public async Task Example_GetGlobalAndLocalQueryNull_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetGlobalAndLocalQueryNull_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathItemsClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathItemsClient client = new PathItemsClient("", credential); - Response response = await client.GetGlobalAndLocalQueryNullAsync("", "", "", ""); + Response response = await client.GetGlobalAndLocalQueryNullAsync("", "", pathItemStringQuery: "", localStringQuery: ""); Console.WriteLine(response.Status); } @@ -155,8 +152,8 @@ public async Task Example_GetGlobalAndLocalQueryNull_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetLocalPathItemQueryNull() { - var credential = new AzureKeyCredential(""); - var client = new PathItemsClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathItemsClient client = new PathItemsClient("", credential); Response response = client.GetLocalPathItemQueryNull("", ""); Console.WriteLine(response.Status); @@ -166,10 +163,10 @@ public void Example_GetLocalPathItemQueryNull() [Ignore("Only validating compilation of examples")] public void Example_GetLocalPathItemQueryNull_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathItemsClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathItemsClient client = new PathItemsClient("", credential); - Response response = client.GetLocalPathItemQueryNull("", "", "", ""); + Response response = client.GetLocalPathItemQueryNull("", "", pathItemStringQuery: "", localStringQuery: ""); Console.WriteLine(response.Status); } @@ -177,8 +174,8 @@ public void Example_GetLocalPathItemQueryNull_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetLocalPathItemQueryNull_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathItemsClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathItemsClient client = new PathItemsClient("", credential); Response response = await client.GetLocalPathItemQueryNullAsync("", ""); Console.WriteLine(response.Status); @@ -188,10 +185,10 @@ public async Task Example_GetLocalPathItemQueryNull_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetLocalPathItemQueryNull_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathItemsClient("", credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathItemsClient client = new PathItemsClient("", credential); - Response response = await client.GetLocalPathItemQueryNullAsync("", "", "", ""); + Response response = await client.GetLocalPathItemQueryNullAsync("", "", pathItemStringQuery: "", localStringQuery: ""); Console.WriteLine(response.Status); } } diff --git a/test/TestServerProjectsLowLevel/url/tests/Generated/Samples/Samples_PathsClient.cs b/test/TestServerProjectsLowLevel/url/tests/Generated/Samples/Samples_PathsClient.cs index edfdc9d7135..4ac264821e5 100644 --- a/test/TestServerProjectsLowLevel/url/tests/Generated/Samples/Samples_PathsClient.cs +++ b/test/TestServerProjectsLowLevel/url/tests/Generated/Samples/Samples_PathsClient.cs @@ -7,13 +7,11 @@ 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; +using url_LowLevel; namespace url_LowLevel.Samples { @@ -23,8 +21,8 @@ public class Samples_PathsClient [Ignore("Only validating compilation of examples")] public void Example_GetBooleanTrue() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.GetBooleanTrue(); Console.WriteLine(response.Status); @@ -34,8 +32,8 @@ public void Example_GetBooleanTrue() [Ignore("Only validating compilation of examples")] public void Example_GetBooleanTrue_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.GetBooleanTrue(); Console.WriteLine(response.Status); @@ -45,8 +43,8 @@ public void Example_GetBooleanTrue_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetBooleanTrue_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.GetBooleanTrueAsync(); Console.WriteLine(response.Status); @@ -56,8 +54,8 @@ public async Task Example_GetBooleanTrue_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetBooleanTrue_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.GetBooleanTrueAsync(); Console.WriteLine(response.Status); @@ -67,8 +65,8 @@ public async Task Example_GetBooleanTrue_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetBooleanFalse() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.GetBooleanFalse(); Console.WriteLine(response.Status); @@ -78,8 +76,8 @@ public void Example_GetBooleanFalse() [Ignore("Only validating compilation of examples")] public void Example_GetBooleanFalse_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.GetBooleanFalse(); Console.WriteLine(response.Status); @@ -89,8 +87,8 @@ public void Example_GetBooleanFalse_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetBooleanFalse_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.GetBooleanFalseAsync(); Console.WriteLine(response.Status); @@ -100,8 +98,8 @@ public async Task Example_GetBooleanFalse_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetBooleanFalse_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.GetBooleanFalseAsync(); Console.WriteLine(response.Status); @@ -111,8 +109,8 @@ public async Task Example_GetBooleanFalse_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetIntOneMillion() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.GetIntOneMillion(); Console.WriteLine(response.Status); @@ -122,8 +120,8 @@ public void Example_GetIntOneMillion() [Ignore("Only validating compilation of examples")] public void Example_GetIntOneMillion_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.GetIntOneMillion(); Console.WriteLine(response.Status); @@ -133,8 +131,8 @@ public void Example_GetIntOneMillion_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetIntOneMillion_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.GetIntOneMillionAsync(); Console.WriteLine(response.Status); @@ -144,8 +142,8 @@ public async Task Example_GetIntOneMillion_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetIntOneMillion_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.GetIntOneMillionAsync(); Console.WriteLine(response.Status); @@ -155,8 +153,8 @@ public async Task Example_GetIntOneMillion_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetIntNegativeOneMillion() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.GetIntNegativeOneMillion(); Console.WriteLine(response.Status); @@ -166,8 +164,8 @@ public void Example_GetIntNegativeOneMillion() [Ignore("Only validating compilation of examples")] public void Example_GetIntNegativeOneMillion_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.GetIntNegativeOneMillion(); Console.WriteLine(response.Status); @@ -177,8 +175,8 @@ public void Example_GetIntNegativeOneMillion_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetIntNegativeOneMillion_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.GetIntNegativeOneMillionAsync(); Console.WriteLine(response.Status); @@ -188,8 +186,8 @@ public async Task Example_GetIntNegativeOneMillion_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetIntNegativeOneMillion_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.GetIntNegativeOneMillionAsync(); Console.WriteLine(response.Status); @@ -199,8 +197,8 @@ public async Task Example_GetIntNegativeOneMillion_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetTenBillion() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.GetTenBillion(); Console.WriteLine(response.Status); @@ -210,8 +208,8 @@ public void Example_GetTenBillion() [Ignore("Only validating compilation of examples")] public void Example_GetTenBillion_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.GetTenBillion(); Console.WriteLine(response.Status); @@ -221,8 +219,8 @@ public void Example_GetTenBillion_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetTenBillion_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.GetTenBillionAsync(); Console.WriteLine(response.Status); @@ -232,8 +230,8 @@ public async Task Example_GetTenBillion_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetTenBillion_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.GetTenBillionAsync(); Console.WriteLine(response.Status); @@ -243,8 +241,8 @@ public async Task Example_GetTenBillion_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetNegativeTenBillion() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.GetNegativeTenBillion(); Console.WriteLine(response.Status); @@ -254,8 +252,8 @@ public void Example_GetNegativeTenBillion() [Ignore("Only validating compilation of examples")] public void Example_GetNegativeTenBillion_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.GetNegativeTenBillion(); Console.WriteLine(response.Status); @@ -265,8 +263,8 @@ public void Example_GetNegativeTenBillion_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetNegativeTenBillion_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.GetNegativeTenBillionAsync(); Console.WriteLine(response.Status); @@ -276,8 +274,8 @@ public async Task Example_GetNegativeTenBillion_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetNegativeTenBillion_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.GetNegativeTenBillionAsync(); Console.WriteLine(response.Status); @@ -287,8 +285,8 @@ public async Task Example_GetNegativeTenBillion_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_FloatScientificPositive() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.FloatScientificPositive(); Console.WriteLine(response.Status); @@ -298,8 +296,8 @@ public void Example_FloatScientificPositive() [Ignore("Only validating compilation of examples")] public void Example_FloatScientificPositive_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.FloatScientificPositive(); Console.WriteLine(response.Status); @@ -309,8 +307,8 @@ public void Example_FloatScientificPositive_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_FloatScientificPositive_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.FloatScientificPositiveAsync(); Console.WriteLine(response.Status); @@ -320,8 +318,8 @@ public async Task Example_FloatScientificPositive_Async() [Ignore("Only validating compilation of examples")] public async Task Example_FloatScientificPositive_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.FloatScientificPositiveAsync(); Console.WriteLine(response.Status); @@ -331,8 +329,8 @@ public async Task Example_FloatScientificPositive_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_FloatScientificNegative() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.FloatScientificNegative(); Console.WriteLine(response.Status); @@ -342,8 +340,8 @@ public void Example_FloatScientificNegative() [Ignore("Only validating compilation of examples")] public void Example_FloatScientificNegative_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.FloatScientificNegative(); Console.WriteLine(response.Status); @@ -353,8 +351,8 @@ public void Example_FloatScientificNegative_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_FloatScientificNegative_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.FloatScientificNegativeAsync(); Console.WriteLine(response.Status); @@ -364,8 +362,8 @@ public async Task Example_FloatScientificNegative_Async() [Ignore("Only validating compilation of examples")] public async Task Example_FloatScientificNegative_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.FloatScientificNegativeAsync(); Console.WriteLine(response.Status); @@ -375,8 +373,8 @@ public async Task Example_FloatScientificNegative_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_DoubleDecimalPositive() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.DoubleDecimalPositive(); Console.WriteLine(response.Status); @@ -386,8 +384,8 @@ public void Example_DoubleDecimalPositive() [Ignore("Only validating compilation of examples")] public void Example_DoubleDecimalPositive_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.DoubleDecimalPositive(); Console.WriteLine(response.Status); @@ -397,8 +395,8 @@ public void Example_DoubleDecimalPositive_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_DoubleDecimalPositive_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.DoubleDecimalPositiveAsync(); Console.WriteLine(response.Status); @@ -408,8 +406,8 @@ public async Task Example_DoubleDecimalPositive_Async() [Ignore("Only validating compilation of examples")] public async Task Example_DoubleDecimalPositive_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.DoubleDecimalPositiveAsync(); Console.WriteLine(response.Status); @@ -419,8 +417,8 @@ public async Task Example_DoubleDecimalPositive_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_DoubleDecimalNegative() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.DoubleDecimalNegative(); Console.WriteLine(response.Status); @@ -430,8 +428,8 @@ public void Example_DoubleDecimalNegative() [Ignore("Only validating compilation of examples")] public void Example_DoubleDecimalNegative_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.DoubleDecimalNegative(); Console.WriteLine(response.Status); @@ -441,8 +439,8 @@ public void Example_DoubleDecimalNegative_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_DoubleDecimalNegative_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.DoubleDecimalNegativeAsync(); Console.WriteLine(response.Status); @@ -452,8 +450,8 @@ public async Task Example_DoubleDecimalNegative_Async() [Ignore("Only validating compilation of examples")] public async Task Example_DoubleDecimalNegative_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.DoubleDecimalNegativeAsync(); Console.WriteLine(response.Status); @@ -463,8 +461,8 @@ public async Task Example_DoubleDecimalNegative_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_StringUnicode() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.StringUnicode(); Console.WriteLine(response.Status); @@ -474,8 +472,8 @@ public void Example_StringUnicode() [Ignore("Only validating compilation of examples")] public void Example_StringUnicode_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.StringUnicode(); Console.WriteLine(response.Status); @@ -485,8 +483,8 @@ public void Example_StringUnicode_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_StringUnicode_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.StringUnicodeAsync(); Console.WriteLine(response.Status); @@ -496,8 +494,8 @@ public async Task Example_StringUnicode_Async() [Ignore("Only validating compilation of examples")] public async Task Example_StringUnicode_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.StringUnicodeAsync(); Console.WriteLine(response.Status); @@ -507,8 +505,8 @@ public async Task Example_StringUnicode_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_StringUrlEncoded() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.StringUrlEncoded(); Console.WriteLine(response.Status); @@ -518,8 +516,8 @@ public void Example_StringUrlEncoded() [Ignore("Only validating compilation of examples")] public void Example_StringUrlEncoded_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.StringUrlEncoded(); Console.WriteLine(response.Status); @@ -529,8 +527,8 @@ public void Example_StringUrlEncoded_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_StringUrlEncoded_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.StringUrlEncodedAsync(); Console.WriteLine(response.Status); @@ -540,8 +538,8 @@ public async Task Example_StringUrlEncoded_Async() [Ignore("Only validating compilation of examples")] public async Task Example_StringUrlEncoded_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.StringUrlEncodedAsync(); Console.WriteLine(response.Status); @@ -551,8 +549,8 @@ public async Task Example_StringUrlEncoded_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_StringUrlNonEncoded() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.StringUrlNonEncoded(); Console.WriteLine(response.Status); @@ -562,8 +560,8 @@ public void Example_StringUrlNonEncoded() [Ignore("Only validating compilation of examples")] public void Example_StringUrlNonEncoded_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.StringUrlNonEncoded(); Console.WriteLine(response.Status); @@ -573,8 +571,8 @@ public void Example_StringUrlNonEncoded_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_StringUrlNonEncoded_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.StringUrlNonEncodedAsync(); Console.WriteLine(response.Status); @@ -584,8 +582,8 @@ public async Task Example_StringUrlNonEncoded_Async() [Ignore("Only validating compilation of examples")] public async Task Example_StringUrlNonEncoded_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.StringUrlNonEncodedAsync(); Console.WriteLine(response.Status); @@ -595,8 +593,8 @@ public async Task Example_StringUrlNonEncoded_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_StringEmpty() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.StringEmpty(); Console.WriteLine(response.Status); @@ -606,8 +604,8 @@ public void Example_StringEmpty() [Ignore("Only validating compilation of examples")] public void Example_StringEmpty_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.StringEmpty(); Console.WriteLine(response.Status); @@ -617,8 +615,8 @@ public void Example_StringEmpty_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_StringEmpty_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.StringEmptyAsync(); Console.WriteLine(response.Status); @@ -628,8 +626,8 @@ public async Task Example_StringEmpty_Async() [Ignore("Only validating compilation of examples")] public async Task Example_StringEmpty_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.StringEmptyAsync(); Console.WriteLine(response.Status); @@ -639,8 +637,8 @@ public async Task Example_StringEmpty_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_StringNull() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.StringNull(""); Console.WriteLine(response.Status); @@ -650,8 +648,8 @@ public void Example_StringNull() [Ignore("Only validating compilation of examples")] public void Example_StringNull_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.StringNull(""); Console.WriteLine(response.Status); @@ -661,8 +659,8 @@ public void Example_StringNull_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_StringNull_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.StringNullAsync(""); Console.WriteLine(response.Status); @@ -672,8 +670,8 @@ public async Task Example_StringNull_Async() [Ignore("Only validating compilation of examples")] public async Task Example_StringNull_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.StringNullAsync(""); Console.WriteLine(response.Status); @@ -683,10 +681,10 @@ public async Task Example_StringNull_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_EnumValid() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = client.EnumValid(""); + Response response = client.EnumValid("red color"); Console.WriteLine(response.Status); } @@ -694,10 +692,10 @@ public void Example_EnumValid() [Ignore("Only validating compilation of examples")] public void Example_EnumValid_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = client.EnumValid(""); + Response response = client.EnumValid("red color"); Console.WriteLine(response.Status); } @@ -705,10 +703,10 @@ public void Example_EnumValid_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_EnumValid_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = await client.EnumValidAsync(""); + Response response = await client.EnumValidAsync("red color"); Console.WriteLine(response.Status); } @@ -716,10 +714,10 @@ public async Task Example_EnumValid_Async() [Ignore("Only validating compilation of examples")] public async Task Example_EnumValid_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = await client.EnumValidAsync(""); + Response response = await client.EnumValidAsync("red color"); Console.WriteLine(response.Status); } @@ -727,10 +725,10 @@ public async Task Example_EnumValid_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_EnumNull() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = client.EnumNull(""); + Response response = client.EnumNull("red color"); Console.WriteLine(response.Status); } @@ -738,10 +736,10 @@ public void Example_EnumNull() [Ignore("Only validating compilation of examples")] public void Example_EnumNull_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = client.EnumNull(""); + Response response = client.EnumNull("red color"); Console.WriteLine(response.Status); } @@ -749,10 +747,10 @@ public void Example_EnumNull_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_EnumNull_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = await client.EnumNullAsync(""); + Response response = await client.EnumNullAsync("red color"); Console.WriteLine(response.Status); } @@ -760,10 +758,10 @@ public async Task Example_EnumNull_Async() [Ignore("Only validating compilation of examples")] public async Task Example_EnumNull_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = await client.EnumNullAsync(""); + Response response = await client.EnumNullAsync("red color"); Console.WriteLine(response.Status); } @@ -771,10 +769,10 @@ public async Task Example_EnumNull_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_ByteMultiByte() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = client.ByteMultiByte(BinaryData.FromString("")); + Response response = client.ByteMultiByte(BinaryData.FromObjectAsJson(new object())); Console.WriteLine(response.Status); } @@ -782,10 +780,10 @@ public void Example_ByteMultiByte() [Ignore("Only validating compilation of examples")] public void Example_ByteMultiByte_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = client.ByteMultiByte(BinaryData.FromString("")); + Response response = client.ByteMultiByte(BinaryData.FromObjectAsJson(new object())); Console.WriteLine(response.Status); } @@ -793,10 +791,10 @@ public void Example_ByteMultiByte_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_ByteMultiByte_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = await client.ByteMultiByteAsync(BinaryData.FromString("")); + Response response = await client.ByteMultiByteAsync(BinaryData.FromObjectAsJson(new object())); Console.WriteLine(response.Status); } @@ -804,10 +802,10 @@ public async Task Example_ByteMultiByte_Async() [Ignore("Only validating compilation of examples")] public async Task Example_ByteMultiByte_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = await client.ByteMultiByteAsync(BinaryData.FromString("")); + Response response = await client.ByteMultiByteAsync(BinaryData.FromObjectAsJson(new object())); Console.WriteLine(response.Status); } @@ -815,8 +813,8 @@ public async Task Example_ByteMultiByte_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_ByteEmpty() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.ByteEmpty(); Console.WriteLine(response.Status); @@ -826,8 +824,8 @@ public void Example_ByteEmpty() [Ignore("Only validating compilation of examples")] public void Example_ByteEmpty_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.ByteEmpty(); Console.WriteLine(response.Status); @@ -837,8 +835,8 @@ public void Example_ByteEmpty_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_ByteEmpty_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.ByteEmptyAsync(); Console.WriteLine(response.Status); @@ -848,8 +846,8 @@ public async Task Example_ByteEmpty_Async() [Ignore("Only validating compilation of examples")] public async Task Example_ByteEmpty_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.ByteEmptyAsync(); Console.WriteLine(response.Status); @@ -859,10 +857,10 @@ public async Task Example_ByteEmpty_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_ByteNull() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = client.ByteNull(BinaryData.FromString("")); + Response response = client.ByteNull(BinaryData.FromObjectAsJson(new object())); Console.WriteLine(response.Status); } @@ -870,10 +868,10 @@ public void Example_ByteNull() [Ignore("Only validating compilation of examples")] public void Example_ByteNull_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = client.ByteNull(BinaryData.FromString("")); + Response response = client.ByteNull(BinaryData.FromObjectAsJson(new object())); Console.WriteLine(response.Status); } @@ -881,10 +879,10 @@ public void Example_ByteNull_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_ByteNull_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = await client.ByteNullAsync(BinaryData.FromString("")); + Response response = await client.ByteNullAsync(BinaryData.FromObjectAsJson(new object())); Console.WriteLine(response.Status); } @@ -892,10 +890,10 @@ public async Task Example_ByteNull_Async() [Ignore("Only validating compilation of examples")] public async Task Example_ByteNull_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = await client.ByteNullAsync(BinaryData.FromString("")); + Response response = await client.ByteNullAsync(BinaryData.FromObjectAsJson(new object())); Console.WriteLine(response.Status); } @@ -903,8 +901,8 @@ public async Task Example_ByteNull_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_DateValid() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.DateValid(); Console.WriteLine(response.Status); @@ -914,8 +912,8 @@ public void Example_DateValid() [Ignore("Only validating compilation of examples")] public void Example_DateValid_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.DateValid(); Console.WriteLine(response.Status); @@ -925,8 +923,8 @@ public void Example_DateValid_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_DateValid_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.DateValidAsync(); Console.WriteLine(response.Status); @@ -936,8 +934,8 @@ public async Task Example_DateValid_Async() [Ignore("Only validating compilation of examples")] public async Task Example_DateValid_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.DateValidAsync(); Console.WriteLine(response.Status); @@ -947,10 +945,10 @@ public async Task Example_DateValid_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_DateNull() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = client.DateNull(DateTimeOffset.UtcNow); + Response response = client.DateNull(DateTimeOffset.Parse("2022-05-10")); Console.WriteLine(response.Status); } @@ -958,10 +956,10 @@ public void Example_DateNull() [Ignore("Only validating compilation of examples")] public void Example_DateNull_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = client.DateNull(DateTimeOffset.UtcNow); + Response response = client.DateNull(DateTimeOffset.Parse("2022-05-10")); Console.WriteLine(response.Status); } @@ -969,10 +967,10 @@ public void Example_DateNull_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_DateNull_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = await client.DateNullAsync(DateTimeOffset.UtcNow); + Response response = await client.DateNullAsync(DateTimeOffset.Parse("2022-05-10")); Console.WriteLine(response.Status); } @@ -980,10 +978,10 @@ public async Task Example_DateNull_Async() [Ignore("Only validating compilation of examples")] public async Task Example_DateNull_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = await client.DateNullAsync(DateTimeOffset.UtcNow); + Response response = await client.DateNullAsync(DateTimeOffset.Parse("2022-05-10")); Console.WriteLine(response.Status); } @@ -991,8 +989,8 @@ public async Task Example_DateNull_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_DateTimeValid() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.DateTimeValid(); Console.WriteLine(response.Status); @@ -1002,8 +1000,8 @@ public void Example_DateTimeValid() [Ignore("Only validating compilation of examples")] public void Example_DateTimeValid_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = client.DateTimeValid(); Console.WriteLine(response.Status); @@ -1013,8 +1011,8 @@ public void Example_DateTimeValid_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_DateTimeValid_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.DateTimeValidAsync(); Console.WriteLine(response.Status); @@ -1024,8 +1022,8 @@ public async Task Example_DateTimeValid_Async() [Ignore("Only validating compilation of examples")] public async Task Example_DateTimeValid_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); Response response = await client.DateTimeValidAsync(); Console.WriteLine(response.Status); @@ -1035,10 +1033,10 @@ public async Task Example_DateTimeValid_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_DateTimeNull() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = client.DateTimeNull(DateTimeOffset.UtcNow); + Response response = client.DateTimeNull(DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z")); Console.WriteLine(response.Status); } @@ -1046,10 +1044,10 @@ public void Example_DateTimeNull() [Ignore("Only validating compilation of examples")] public void Example_DateTimeNull_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = client.DateTimeNull(DateTimeOffset.UtcNow); + Response response = client.DateTimeNull(DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z")); Console.WriteLine(response.Status); } @@ -1057,10 +1055,10 @@ public void Example_DateTimeNull_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_DateTimeNull_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = await client.DateTimeNullAsync(DateTimeOffset.UtcNow); + Response response = await client.DateTimeNullAsync(DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z")); Console.WriteLine(response.Status); } @@ -1068,10 +1066,10 @@ public async Task Example_DateTimeNull_Async() [Ignore("Only validating compilation of examples")] public async Task Example_DateTimeNull_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = await client.DateTimeNullAsync(DateTimeOffset.UtcNow); + Response response = await client.DateTimeNullAsync(DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z")); Console.WriteLine(response.Status); } @@ -1079,10 +1077,10 @@ public async Task Example_DateTimeNull_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_Base64Url() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = client.Base64Url(BinaryData.FromString("")); + Response response = client.Base64Url(BinaryData.FromObjectAsJson(new object())); Console.WriteLine(response.Status); } @@ -1090,10 +1088,10 @@ public void Example_Base64Url() [Ignore("Only validating compilation of examples")] public void Example_Base64Url_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = client.Base64Url(BinaryData.FromString("")); + Response response = client.Base64Url(BinaryData.FromObjectAsJson(new object())); Console.WriteLine(response.Status); } @@ -1101,10 +1099,10 @@ public void Example_Base64Url_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_Base64Url_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = await client.Base64UrlAsync(BinaryData.FromString("")); + Response response = await client.Base64UrlAsync(BinaryData.FromObjectAsJson(new object())); Console.WriteLine(response.Status); } @@ -1112,10 +1110,10 @@ public async Task Example_Base64Url_Async() [Ignore("Only validating compilation of examples")] public async Task Example_Base64Url_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = await client.Base64UrlAsync(BinaryData.FromString("")); + Response response = await client.Base64UrlAsync(BinaryData.FromObjectAsJson(new object())); Console.WriteLine(response.Status); } @@ -1123,10 +1121,13 @@ public async Task Example_Base64Url_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_ArrayCsvInPath() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = client.ArrayCsvInPath(new string[] { "" }); + Response response = client.ArrayCsvInPath(new List() +{ +"" +}); Console.WriteLine(response.Status); } @@ -1134,10 +1135,13 @@ public void Example_ArrayCsvInPath() [Ignore("Only validating compilation of examples")] public void Example_ArrayCsvInPath_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = client.ArrayCsvInPath(new string[] { "" }); + Response response = client.ArrayCsvInPath(new List() +{ +"" +}); Console.WriteLine(response.Status); } @@ -1145,10 +1149,13 @@ public void Example_ArrayCsvInPath_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_ArrayCsvInPath_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = await client.ArrayCsvInPathAsync(new string[] { "" }); + Response response = await client.ArrayCsvInPathAsync(new List() +{ +"" +}); Console.WriteLine(response.Status); } @@ -1156,10 +1163,13 @@ public async Task Example_ArrayCsvInPath_Async() [Ignore("Only validating compilation of examples")] public async Task Example_ArrayCsvInPath_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = await client.ArrayCsvInPathAsync(new string[] { "" }); + Response response = await client.ArrayCsvInPathAsync(new List() +{ +"" +}); Console.WriteLine(response.Status); } @@ -1167,10 +1177,10 @@ public async Task Example_ArrayCsvInPath_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_UnixTimeUrl() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = client.UnixTimeUrl(DateTimeOffset.UtcNow); + Response response = client.UnixTimeUrl(DateTimeOffset.FromUnixTimeSeconds(1652209051)); Console.WriteLine(response.Status); } @@ -1178,10 +1188,10 @@ public void Example_UnixTimeUrl() [Ignore("Only validating compilation of examples")] public void Example_UnixTimeUrl_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = client.UnixTimeUrl(DateTimeOffset.UtcNow); + Response response = client.UnixTimeUrl(DateTimeOffset.FromUnixTimeSeconds(1652209051)); Console.WriteLine(response.Status); } @@ -1189,10 +1199,10 @@ public void Example_UnixTimeUrl_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_UnixTimeUrl_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = await client.UnixTimeUrlAsync(DateTimeOffset.UtcNow); + Response response = await client.UnixTimeUrlAsync(DateTimeOffset.FromUnixTimeSeconds(1652209051)); Console.WriteLine(response.Status); } @@ -1200,10 +1210,10 @@ public async Task Example_UnixTimeUrl_Async() [Ignore("Only validating compilation of examples")] public async Task Example_UnixTimeUrl_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new PathsClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + PathsClient client = new PathsClient(credential); - Response response = await client.UnixTimeUrlAsync(DateTimeOffset.UtcNow); + Response response = await client.UnixTimeUrlAsync(DateTimeOffset.FromUnixTimeSeconds(1652209051)); Console.WriteLine(response.Status); } } diff --git a/test/TestServerProjectsLowLevel/url/tests/Generated/Samples/Samples_QueriesClient.cs b/test/TestServerProjectsLowLevel/url/tests/Generated/Samples/Samples_QueriesClient.cs index a5c656532d7..bae3aec3fe9 100644 --- a/test/TestServerProjectsLowLevel/url/tests/Generated/Samples/Samples_QueriesClient.cs +++ b/test/TestServerProjectsLowLevel/url/tests/Generated/Samples/Samples_QueriesClient.cs @@ -7,13 +7,11 @@ 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; +using url_LowLevel; namespace url_LowLevel.Samples { @@ -23,8 +21,8 @@ public class Samples_QueriesClient [Ignore("Only validating compilation of examples")] public void Example_GetBooleanTrue() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.GetBooleanTrue(); Console.WriteLine(response.Status); @@ -34,8 +32,8 @@ public void Example_GetBooleanTrue() [Ignore("Only validating compilation of examples")] public void Example_GetBooleanTrue_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.GetBooleanTrue(); Console.WriteLine(response.Status); @@ -45,8 +43,8 @@ public void Example_GetBooleanTrue_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetBooleanTrue_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.GetBooleanTrueAsync(); Console.WriteLine(response.Status); @@ -56,8 +54,8 @@ public async Task Example_GetBooleanTrue_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetBooleanTrue_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.GetBooleanTrueAsync(); Console.WriteLine(response.Status); @@ -67,8 +65,8 @@ public async Task Example_GetBooleanTrue_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetBooleanFalse() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.GetBooleanFalse(); Console.WriteLine(response.Status); @@ -78,8 +76,8 @@ public void Example_GetBooleanFalse() [Ignore("Only validating compilation of examples")] public void Example_GetBooleanFalse_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.GetBooleanFalse(); Console.WriteLine(response.Status); @@ -89,8 +87,8 @@ public void Example_GetBooleanFalse_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetBooleanFalse_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.GetBooleanFalseAsync(); Console.WriteLine(response.Status); @@ -100,8 +98,8 @@ public async Task Example_GetBooleanFalse_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetBooleanFalse_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.GetBooleanFalseAsync(); Console.WriteLine(response.Status); @@ -111,8 +109,8 @@ public async Task Example_GetBooleanFalse_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetBooleanNull() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.GetBooleanNull(); Console.WriteLine(response.Status); @@ -122,10 +120,10 @@ public void Example_GetBooleanNull() [Ignore("Only validating compilation of examples")] public void Example_GetBooleanNull_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = client.GetBooleanNull(true); + Response response = client.GetBooleanNull(boolQuery: true); Console.WriteLine(response.Status); } @@ -133,8 +131,8 @@ public void Example_GetBooleanNull_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetBooleanNull_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.GetBooleanNullAsync(); Console.WriteLine(response.Status); @@ -144,10 +142,10 @@ public async Task Example_GetBooleanNull_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetBooleanNull_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = await client.GetBooleanNullAsync(true); + Response response = await client.GetBooleanNullAsync(boolQuery: true); Console.WriteLine(response.Status); } @@ -155,8 +153,8 @@ public async Task Example_GetBooleanNull_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetIntOneMillion() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.GetIntOneMillion(); Console.WriteLine(response.Status); @@ -166,8 +164,8 @@ public void Example_GetIntOneMillion() [Ignore("Only validating compilation of examples")] public void Example_GetIntOneMillion_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.GetIntOneMillion(); Console.WriteLine(response.Status); @@ -177,8 +175,8 @@ public void Example_GetIntOneMillion_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetIntOneMillion_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.GetIntOneMillionAsync(); Console.WriteLine(response.Status); @@ -188,8 +186,8 @@ public async Task Example_GetIntOneMillion_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetIntOneMillion_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.GetIntOneMillionAsync(); Console.WriteLine(response.Status); @@ -199,8 +197,8 @@ public async Task Example_GetIntOneMillion_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetIntNegativeOneMillion() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.GetIntNegativeOneMillion(); Console.WriteLine(response.Status); @@ -210,8 +208,8 @@ public void Example_GetIntNegativeOneMillion() [Ignore("Only validating compilation of examples")] public void Example_GetIntNegativeOneMillion_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.GetIntNegativeOneMillion(); Console.WriteLine(response.Status); @@ -221,8 +219,8 @@ public void Example_GetIntNegativeOneMillion_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetIntNegativeOneMillion_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.GetIntNegativeOneMillionAsync(); Console.WriteLine(response.Status); @@ -232,8 +230,8 @@ public async Task Example_GetIntNegativeOneMillion_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetIntNegativeOneMillion_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.GetIntNegativeOneMillionAsync(); Console.WriteLine(response.Status); @@ -243,8 +241,8 @@ public async Task Example_GetIntNegativeOneMillion_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetIntNull() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.GetIntNull(); Console.WriteLine(response.Status); @@ -254,10 +252,10 @@ public void Example_GetIntNull() [Ignore("Only validating compilation of examples")] public void Example_GetIntNull_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = client.GetIntNull(1234); + Response response = client.GetIntNull(intQuery: 1234); Console.WriteLine(response.Status); } @@ -265,8 +263,8 @@ public void Example_GetIntNull_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetIntNull_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.GetIntNullAsync(); Console.WriteLine(response.Status); @@ -276,10 +274,10 @@ public async Task Example_GetIntNull_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetIntNull_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = await client.GetIntNullAsync(1234); + Response response = await client.GetIntNullAsync(intQuery: 1234); Console.WriteLine(response.Status); } @@ -287,8 +285,8 @@ public async Task Example_GetIntNull_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetTenBillion() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.GetTenBillion(); Console.WriteLine(response.Status); @@ -298,8 +296,8 @@ public void Example_GetTenBillion() [Ignore("Only validating compilation of examples")] public void Example_GetTenBillion_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.GetTenBillion(); Console.WriteLine(response.Status); @@ -309,8 +307,8 @@ public void Example_GetTenBillion_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetTenBillion_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.GetTenBillionAsync(); Console.WriteLine(response.Status); @@ -320,8 +318,8 @@ public async Task Example_GetTenBillion_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetTenBillion_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.GetTenBillionAsync(); Console.WriteLine(response.Status); @@ -331,8 +329,8 @@ public async Task Example_GetTenBillion_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetNegativeTenBillion() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.GetNegativeTenBillion(); Console.WriteLine(response.Status); @@ -342,8 +340,8 @@ public void Example_GetNegativeTenBillion() [Ignore("Only validating compilation of examples")] public void Example_GetNegativeTenBillion_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.GetNegativeTenBillion(); Console.WriteLine(response.Status); @@ -353,8 +351,8 @@ public void Example_GetNegativeTenBillion_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetNegativeTenBillion_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.GetNegativeTenBillionAsync(); Console.WriteLine(response.Status); @@ -364,8 +362,8 @@ public async Task Example_GetNegativeTenBillion_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetNegativeTenBillion_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.GetNegativeTenBillionAsync(); Console.WriteLine(response.Status); @@ -375,8 +373,8 @@ public async Task Example_GetNegativeTenBillion_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetLongNull() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.GetLongNull(); Console.WriteLine(response.Status); @@ -386,10 +384,10 @@ public void Example_GetLongNull() [Ignore("Only validating compilation of examples")] public void Example_GetLongNull_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = client.GetLongNull(1234); + Response response = client.GetLongNull(longQuery: 1234L); Console.WriteLine(response.Status); } @@ -397,8 +395,8 @@ public void Example_GetLongNull_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetLongNull_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.GetLongNullAsync(); Console.WriteLine(response.Status); @@ -408,10 +406,10 @@ public async Task Example_GetLongNull_Async() [Ignore("Only validating compilation of examples")] public async Task Example_GetLongNull_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = await client.GetLongNullAsync(1234); + Response response = await client.GetLongNullAsync(longQuery: 1234L); Console.WriteLine(response.Status); } @@ -419,8 +417,8 @@ public async Task Example_GetLongNull_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_FloatScientificPositive() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.FloatScientificPositive(); Console.WriteLine(response.Status); @@ -430,8 +428,8 @@ public void Example_FloatScientificPositive() [Ignore("Only validating compilation of examples")] public void Example_FloatScientificPositive_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.FloatScientificPositive(); Console.WriteLine(response.Status); @@ -441,8 +439,8 @@ public void Example_FloatScientificPositive_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_FloatScientificPositive_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.FloatScientificPositiveAsync(); Console.WriteLine(response.Status); @@ -452,8 +450,8 @@ public async Task Example_FloatScientificPositive_Async() [Ignore("Only validating compilation of examples")] public async Task Example_FloatScientificPositive_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.FloatScientificPositiveAsync(); Console.WriteLine(response.Status); @@ -463,8 +461,8 @@ public async Task Example_FloatScientificPositive_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_FloatScientificNegative() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.FloatScientificNegative(); Console.WriteLine(response.Status); @@ -474,8 +472,8 @@ public void Example_FloatScientificNegative() [Ignore("Only validating compilation of examples")] public void Example_FloatScientificNegative_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.FloatScientificNegative(); Console.WriteLine(response.Status); @@ -485,8 +483,8 @@ public void Example_FloatScientificNegative_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_FloatScientificNegative_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.FloatScientificNegativeAsync(); Console.WriteLine(response.Status); @@ -496,8 +494,8 @@ public async Task Example_FloatScientificNegative_Async() [Ignore("Only validating compilation of examples")] public async Task Example_FloatScientificNegative_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.FloatScientificNegativeAsync(); Console.WriteLine(response.Status); @@ -507,8 +505,8 @@ public async Task Example_FloatScientificNegative_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_FloatNull() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.FloatNull(); Console.WriteLine(response.Status); @@ -518,10 +516,10 @@ public void Example_FloatNull() [Ignore("Only validating compilation of examples")] public void Example_FloatNull_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = client.FloatNull(3.14f); + Response response = client.FloatNull(floatQuery: 123.45F); Console.WriteLine(response.Status); } @@ -529,8 +527,8 @@ public void Example_FloatNull_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_FloatNull_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.FloatNullAsync(); Console.WriteLine(response.Status); @@ -540,10 +538,10 @@ public async Task Example_FloatNull_Async() [Ignore("Only validating compilation of examples")] public async Task Example_FloatNull_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = await client.FloatNullAsync(3.14f); + Response response = await client.FloatNullAsync(floatQuery: 123.45F); Console.WriteLine(response.Status); } @@ -551,8 +549,8 @@ public async Task Example_FloatNull_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_DoubleDecimalPositive() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.DoubleDecimalPositive(); Console.WriteLine(response.Status); @@ -562,8 +560,8 @@ public void Example_DoubleDecimalPositive() [Ignore("Only validating compilation of examples")] public void Example_DoubleDecimalPositive_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.DoubleDecimalPositive(); Console.WriteLine(response.Status); @@ -573,8 +571,8 @@ public void Example_DoubleDecimalPositive_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_DoubleDecimalPositive_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.DoubleDecimalPositiveAsync(); Console.WriteLine(response.Status); @@ -584,8 +582,8 @@ public async Task Example_DoubleDecimalPositive_Async() [Ignore("Only validating compilation of examples")] public async Task Example_DoubleDecimalPositive_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.DoubleDecimalPositiveAsync(); Console.WriteLine(response.Status); @@ -595,8 +593,8 @@ public async Task Example_DoubleDecimalPositive_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_DoubleDecimalNegative() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.DoubleDecimalNegative(); Console.WriteLine(response.Status); @@ -606,8 +604,8 @@ public void Example_DoubleDecimalNegative() [Ignore("Only validating compilation of examples")] public void Example_DoubleDecimalNegative_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.DoubleDecimalNegative(); Console.WriteLine(response.Status); @@ -617,8 +615,8 @@ public void Example_DoubleDecimalNegative_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_DoubleDecimalNegative_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.DoubleDecimalNegativeAsync(); Console.WriteLine(response.Status); @@ -628,8 +626,8 @@ public async Task Example_DoubleDecimalNegative_Async() [Ignore("Only validating compilation of examples")] public async Task Example_DoubleDecimalNegative_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.DoubleDecimalNegativeAsync(); Console.WriteLine(response.Status); @@ -639,8 +637,8 @@ public async Task Example_DoubleDecimalNegative_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_DoubleNull() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.DoubleNull(); Console.WriteLine(response.Status); @@ -650,10 +648,10 @@ public void Example_DoubleNull() [Ignore("Only validating compilation of examples")] public void Example_DoubleNull_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = client.DoubleNull(3.14); + Response response = client.DoubleNull(doubleQuery: 123.45); Console.WriteLine(response.Status); } @@ -661,8 +659,8 @@ public void Example_DoubleNull_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_DoubleNull_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.DoubleNullAsync(); Console.WriteLine(response.Status); @@ -672,10 +670,10 @@ public async Task Example_DoubleNull_Async() [Ignore("Only validating compilation of examples")] public async Task Example_DoubleNull_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = await client.DoubleNullAsync(3.14); + Response response = await client.DoubleNullAsync(doubleQuery: 123.45); Console.WriteLine(response.Status); } @@ -683,8 +681,8 @@ public async Task Example_DoubleNull_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_StringUnicode() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.StringUnicode(); Console.WriteLine(response.Status); @@ -694,8 +692,8 @@ public void Example_StringUnicode() [Ignore("Only validating compilation of examples")] public void Example_StringUnicode_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.StringUnicode(); Console.WriteLine(response.Status); @@ -705,8 +703,8 @@ public void Example_StringUnicode_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_StringUnicode_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.StringUnicodeAsync(); Console.WriteLine(response.Status); @@ -716,8 +714,8 @@ public async Task Example_StringUnicode_Async() [Ignore("Only validating compilation of examples")] public async Task Example_StringUnicode_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.StringUnicodeAsync(); Console.WriteLine(response.Status); @@ -727,8 +725,8 @@ public async Task Example_StringUnicode_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_StringUrlEncoded() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.StringUrlEncoded(); Console.WriteLine(response.Status); @@ -738,8 +736,8 @@ public void Example_StringUrlEncoded() [Ignore("Only validating compilation of examples")] public void Example_StringUrlEncoded_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.StringUrlEncoded(); Console.WriteLine(response.Status); @@ -749,8 +747,8 @@ public void Example_StringUrlEncoded_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_StringUrlEncoded_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.StringUrlEncodedAsync(); Console.WriteLine(response.Status); @@ -760,8 +758,8 @@ public async Task Example_StringUrlEncoded_Async() [Ignore("Only validating compilation of examples")] public async Task Example_StringUrlEncoded_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.StringUrlEncodedAsync(); Console.WriteLine(response.Status); @@ -771,8 +769,8 @@ public async Task Example_StringUrlEncoded_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_StringEmpty() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.StringEmpty(); Console.WriteLine(response.Status); @@ -782,8 +780,8 @@ public void Example_StringEmpty() [Ignore("Only validating compilation of examples")] public void Example_StringEmpty_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.StringEmpty(); Console.WriteLine(response.Status); @@ -793,8 +791,8 @@ public void Example_StringEmpty_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_StringEmpty_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.StringEmptyAsync(); Console.WriteLine(response.Status); @@ -804,8 +802,8 @@ public async Task Example_StringEmpty_Async() [Ignore("Only validating compilation of examples")] public async Task Example_StringEmpty_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.StringEmptyAsync(); Console.WriteLine(response.Status); @@ -815,8 +813,8 @@ public async Task Example_StringEmpty_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_StringNull() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.StringNull(); Console.WriteLine(response.Status); @@ -826,10 +824,10 @@ public void Example_StringNull() [Ignore("Only validating compilation of examples")] public void Example_StringNull_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = client.StringNull(""); + Response response = client.StringNull(stringQuery: ""); Console.WriteLine(response.Status); } @@ -837,8 +835,8 @@ public void Example_StringNull_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_StringNull_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.StringNullAsync(); Console.WriteLine(response.Status); @@ -848,10 +846,10 @@ public async Task Example_StringNull_Async() [Ignore("Only validating compilation of examples")] public async Task Example_StringNull_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = await client.StringNullAsync(""); + Response response = await client.StringNullAsync(stringQuery: ""); Console.WriteLine(response.Status); } @@ -859,8 +857,8 @@ public async Task Example_StringNull_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_EnumValid() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.EnumValid(); Console.WriteLine(response.Status); @@ -870,10 +868,10 @@ public void Example_EnumValid() [Ignore("Only validating compilation of examples")] public void Example_EnumValid_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = client.EnumValid(""); + Response response = client.EnumValid(enumQuery: "red color"); Console.WriteLine(response.Status); } @@ -881,8 +879,8 @@ public void Example_EnumValid_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_EnumValid_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.EnumValidAsync(); Console.WriteLine(response.Status); @@ -892,10 +890,10 @@ public async Task Example_EnumValid_Async() [Ignore("Only validating compilation of examples")] public async Task Example_EnumValid_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = await client.EnumValidAsync(""); + Response response = await client.EnumValidAsync(enumQuery: "red color"); Console.WriteLine(response.Status); } @@ -903,8 +901,8 @@ public async Task Example_EnumValid_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_EnumNull() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.EnumNull(); Console.WriteLine(response.Status); @@ -914,10 +912,10 @@ public void Example_EnumNull() [Ignore("Only validating compilation of examples")] public void Example_EnumNull_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = client.EnumNull(""); + Response response = client.EnumNull(enumQuery: "red color"); Console.WriteLine(response.Status); } @@ -925,8 +923,8 @@ public void Example_EnumNull_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_EnumNull_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.EnumNullAsync(); Console.WriteLine(response.Status); @@ -936,10 +934,10 @@ public async Task Example_EnumNull_Async() [Ignore("Only validating compilation of examples")] public async Task Example_EnumNull_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = await client.EnumNullAsync(""); + Response response = await client.EnumNullAsync(enumQuery: "red color"); Console.WriteLine(response.Status); } @@ -947,8 +945,8 @@ public async Task Example_EnumNull_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_ByteMultiByte() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.ByteMultiByte(); Console.WriteLine(response.Status); @@ -958,10 +956,10 @@ public void Example_ByteMultiByte() [Ignore("Only validating compilation of examples")] public void Example_ByteMultiByte_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = client.ByteMultiByte(BinaryData.FromString("")); + Response response = client.ByteMultiByte(byteQuery: BinaryData.FromObjectAsJson(new object())); Console.WriteLine(response.Status); } @@ -969,8 +967,8 @@ public void Example_ByteMultiByte_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_ByteMultiByte_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.ByteMultiByteAsync(); Console.WriteLine(response.Status); @@ -980,10 +978,10 @@ public async Task Example_ByteMultiByte_Async() [Ignore("Only validating compilation of examples")] public async Task Example_ByteMultiByte_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = await client.ByteMultiByteAsync(BinaryData.FromString("")); + Response response = await client.ByteMultiByteAsync(byteQuery: BinaryData.FromObjectAsJson(new object())); Console.WriteLine(response.Status); } @@ -991,8 +989,8 @@ public async Task Example_ByteMultiByte_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_ByteEmpty() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.ByteEmpty(); Console.WriteLine(response.Status); @@ -1002,8 +1000,8 @@ public void Example_ByteEmpty() [Ignore("Only validating compilation of examples")] public void Example_ByteEmpty_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.ByteEmpty(); Console.WriteLine(response.Status); @@ -1013,8 +1011,8 @@ public void Example_ByteEmpty_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_ByteEmpty_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.ByteEmptyAsync(); Console.WriteLine(response.Status); @@ -1024,8 +1022,8 @@ public async Task Example_ByteEmpty_Async() [Ignore("Only validating compilation of examples")] public async Task Example_ByteEmpty_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.ByteEmptyAsync(); Console.WriteLine(response.Status); @@ -1035,8 +1033,8 @@ public async Task Example_ByteEmpty_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_ByteNull() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.ByteNull(); Console.WriteLine(response.Status); @@ -1046,10 +1044,10 @@ public void Example_ByteNull() [Ignore("Only validating compilation of examples")] public void Example_ByteNull_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = client.ByteNull(BinaryData.FromString("")); + Response response = client.ByteNull(byteQuery: BinaryData.FromObjectAsJson(new object())); Console.WriteLine(response.Status); } @@ -1057,8 +1055,8 @@ public void Example_ByteNull_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_ByteNull_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.ByteNullAsync(); Console.WriteLine(response.Status); @@ -1068,10 +1066,10 @@ public async Task Example_ByteNull_Async() [Ignore("Only validating compilation of examples")] public async Task Example_ByteNull_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = await client.ByteNullAsync(BinaryData.FromString("")); + Response response = await client.ByteNullAsync(byteQuery: BinaryData.FromObjectAsJson(new object())); Console.WriteLine(response.Status); } @@ -1079,8 +1077,8 @@ public async Task Example_ByteNull_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_DateValid() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.DateValid(); Console.WriteLine(response.Status); @@ -1090,8 +1088,8 @@ public void Example_DateValid() [Ignore("Only validating compilation of examples")] public void Example_DateValid_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.DateValid(); Console.WriteLine(response.Status); @@ -1101,8 +1099,8 @@ public void Example_DateValid_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_DateValid_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.DateValidAsync(); Console.WriteLine(response.Status); @@ -1112,8 +1110,8 @@ public async Task Example_DateValid_Async() [Ignore("Only validating compilation of examples")] public async Task Example_DateValid_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.DateValidAsync(); Console.WriteLine(response.Status); @@ -1123,8 +1121,8 @@ public async Task Example_DateValid_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_DateNull() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.DateNull(); Console.WriteLine(response.Status); @@ -1134,10 +1132,10 @@ public void Example_DateNull() [Ignore("Only validating compilation of examples")] public void Example_DateNull_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = client.DateNull(DateTimeOffset.UtcNow); + Response response = client.DateNull(dateQuery: DateTimeOffset.Parse("2022-05-10")); Console.WriteLine(response.Status); } @@ -1145,8 +1143,8 @@ public void Example_DateNull_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_DateNull_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.DateNullAsync(); Console.WriteLine(response.Status); @@ -1156,10 +1154,10 @@ public async Task Example_DateNull_Async() [Ignore("Only validating compilation of examples")] public async Task Example_DateNull_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = await client.DateNullAsync(DateTimeOffset.UtcNow); + Response response = await client.DateNullAsync(dateQuery: DateTimeOffset.Parse("2022-05-10")); Console.WriteLine(response.Status); } @@ -1167,8 +1165,8 @@ public async Task Example_DateNull_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_DateTimeValid() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.DateTimeValid(); Console.WriteLine(response.Status); @@ -1178,8 +1176,8 @@ public void Example_DateTimeValid() [Ignore("Only validating compilation of examples")] public void Example_DateTimeValid_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.DateTimeValid(); Console.WriteLine(response.Status); @@ -1189,8 +1187,8 @@ public void Example_DateTimeValid_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_DateTimeValid_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.DateTimeValidAsync(); Console.WriteLine(response.Status); @@ -1200,8 +1198,8 @@ public async Task Example_DateTimeValid_Async() [Ignore("Only validating compilation of examples")] public async Task Example_DateTimeValid_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.DateTimeValidAsync(); Console.WriteLine(response.Status); @@ -1211,8 +1209,8 @@ public async Task Example_DateTimeValid_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_DateTimeNull() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.DateTimeNull(); Console.WriteLine(response.Status); @@ -1222,10 +1220,10 @@ public void Example_DateTimeNull() [Ignore("Only validating compilation of examples")] public void Example_DateTimeNull_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = client.DateTimeNull(DateTimeOffset.UtcNow); + Response response = client.DateTimeNull(dateTimeQuery: DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z")); Console.WriteLine(response.Status); } @@ -1233,8 +1231,8 @@ public void Example_DateTimeNull_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_DateTimeNull_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.DateTimeNullAsync(); Console.WriteLine(response.Status); @@ -1244,10 +1242,10 @@ public async Task Example_DateTimeNull_Async() [Ignore("Only validating compilation of examples")] public async Task Example_DateTimeNull_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = await client.DateTimeNullAsync(DateTimeOffset.UtcNow); + Response response = await client.DateTimeNullAsync(dateTimeQuery: DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z")); Console.WriteLine(response.Status); } @@ -1255,8 +1253,8 @@ public async Task Example_DateTimeNull_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_ArrayStringCsvValid() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.ArrayStringCsvValid(); Console.WriteLine(response.Status); @@ -1266,10 +1264,13 @@ public void Example_ArrayStringCsvValid() [Ignore("Only validating compilation of examples")] public void Example_ArrayStringCsvValid_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = client.ArrayStringCsvValid(new string[] { "" }); + Response response = client.ArrayStringCsvValid(arrayQuery: new List() +{ +"" +}); Console.WriteLine(response.Status); } @@ -1277,8 +1278,8 @@ public void Example_ArrayStringCsvValid_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_ArrayStringCsvValid_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.ArrayStringCsvValidAsync(); Console.WriteLine(response.Status); @@ -1288,10 +1289,13 @@ public async Task Example_ArrayStringCsvValid_Async() [Ignore("Only validating compilation of examples")] public async Task Example_ArrayStringCsvValid_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = await client.ArrayStringCsvValidAsync(new string[] { "" }); + Response response = await client.ArrayStringCsvValidAsync(arrayQuery: new List() +{ +"" +}); Console.WriteLine(response.Status); } @@ -1299,8 +1303,8 @@ public async Task Example_ArrayStringCsvValid_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_ArrayStringCsvNull() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.ArrayStringCsvNull(); Console.WriteLine(response.Status); @@ -1310,10 +1314,13 @@ public void Example_ArrayStringCsvNull() [Ignore("Only validating compilation of examples")] public void Example_ArrayStringCsvNull_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = client.ArrayStringCsvNull(new string[] { "" }); + Response response = client.ArrayStringCsvNull(arrayQuery: new List() +{ +"" +}); Console.WriteLine(response.Status); } @@ -1321,8 +1328,8 @@ public void Example_ArrayStringCsvNull_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_ArrayStringCsvNull_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.ArrayStringCsvNullAsync(); Console.WriteLine(response.Status); @@ -1332,10 +1339,13 @@ public async Task Example_ArrayStringCsvNull_Async() [Ignore("Only validating compilation of examples")] public async Task Example_ArrayStringCsvNull_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = await client.ArrayStringCsvNullAsync(new string[] { "" }); + Response response = await client.ArrayStringCsvNullAsync(arrayQuery: new List() +{ +"" +}); Console.WriteLine(response.Status); } @@ -1343,8 +1353,8 @@ public async Task Example_ArrayStringCsvNull_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_ArrayStringCsvEmpty() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.ArrayStringCsvEmpty(); Console.WriteLine(response.Status); @@ -1354,10 +1364,13 @@ public void Example_ArrayStringCsvEmpty() [Ignore("Only validating compilation of examples")] public void Example_ArrayStringCsvEmpty_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = client.ArrayStringCsvEmpty(new string[] { "" }); + Response response = client.ArrayStringCsvEmpty(arrayQuery: new List() +{ +"" +}); Console.WriteLine(response.Status); } @@ -1365,8 +1378,8 @@ public void Example_ArrayStringCsvEmpty_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_ArrayStringCsvEmpty_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.ArrayStringCsvEmptyAsync(); Console.WriteLine(response.Status); @@ -1376,10 +1389,13 @@ public async Task Example_ArrayStringCsvEmpty_Async() [Ignore("Only validating compilation of examples")] public async Task Example_ArrayStringCsvEmpty_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = await client.ArrayStringCsvEmptyAsync(new string[] { "" }); + Response response = await client.ArrayStringCsvEmptyAsync(arrayQuery: new List() +{ +"" +}); Console.WriteLine(response.Status); } @@ -1387,8 +1403,8 @@ public async Task Example_ArrayStringCsvEmpty_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_ArrayStringNoCollectionFormatEmpty() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.ArrayStringNoCollectionFormatEmpty(); Console.WriteLine(response.Status); @@ -1398,10 +1414,13 @@ public void Example_ArrayStringNoCollectionFormatEmpty() [Ignore("Only validating compilation of examples")] public void Example_ArrayStringNoCollectionFormatEmpty_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = client.ArrayStringNoCollectionFormatEmpty(new string[] { "" }); + Response response = client.ArrayStringNoCollectionFormatEmpty(arrayQuery: new List() +{ +"" +}); Console.WriteLine(response.Status); } @@ -1409,8 +1428,8 @@ public void Example_ArrayStringNoCollectionFormatEmpty_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_ArrayStringNoCollectionFormatEmpty_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.ArrayStringNoCollectionFormatEmptyAsync(); Console.WriteLine(response.Status); @@ -1420,10 +1439,13 @@ public async Task Example_ArrayStringNoCollectionFormatEmpty_Async() [Ignore("Only validating compilation of examples")] public async Task Example_ArrayStringNoCollectionFormatEmpty_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = await client.ArrayStringNoCollectionFormatEmptyAsync(new string[] { "" }); + Response response = await client.ArrayStringNoCollectionFormatEmptyAsync(arrayQuery: new List() +{ +"" +}); Console.WriteLine(response.Status); } @@ -1431,8 +1453,8 @@ public async Task Example_ArrayStringNoCollectionFormatEmpty_AllParameters_Async [Ignore("Only validating compilation of examples")] public void Example_ArrayStringSsvValid() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.ArrayStringSsvValid(); Console.WriteLine(response.Status); @@ -1442,10 +1464,13 @@ public void Example_ArrayStringSsvValid() [Ignore("Only validating compilation of examples")] public void Example_ArrayStringSsvValid_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = client.ArrayStringSsvValid(new string[] { "" }); + Response response = client.ArrayStringSsvValid(arrayQuery: new List() +{ +"" +}); Console.WriteLine(response.Status); } @@ -1453,8 +1478,8 @@ public void Example_ArrayStringSsvValid_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_ArrayStringSsvValid_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.ArrayStringSsvValidAsync(); Console.WriteLine(response.Status); @@ -1464,10 +1489,13 @@ public async Task Example_ArrayStringSsvValid_Async() [Ignore("Only validating compilation of examples")] public async Task Example_ArrayStringSsvValid_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = await client.ArrayStringSsvValidAsync(new string[] { "" }); + Response response = await client.ArrayStringSsvValidAsync(arrayQuery: new List() +{ +"" +}); Console.WriteLine(response.Status); } @@ -1475,8 +1503,8 @@ public async Task Example_ArrayStringSsvValid_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_ArrayStringTsvValid() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.ArrayStringTsvValid(); Console.WriteLine(response.Status); @@ -1486,10 +1514,13 @@ public void Example_ArrayStringTsvValid() [Ignore("Only validating compilation of examples")] public void Example_ArrayStringTsvValid_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = client.ArrayStringTsvValid(new string[] { "" }); + Response response = client.ArrayStringTsvValid(arrayQuery: new List() +{ +"" +}); Console.WriteLine(response.Status); } @@ -1497,8 +1528,8 @@ public void Example_ArrayStringTsvValid_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_ArrayStringTsvValid_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.ArrayStringTsvValidAsync(); Console.WriteLine(response.Status); @@ -1508,10 +1539,13 @@ public async Task Example_ArrayStringTsvValid_Async() [Ignore("Only validating compilation of examples")] public async Task Example_ArrayStringTsvValid_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = await client.ArrayStringTsvValidAsync(new string[] { "" }); + Response response = await client.ArrayStringTsvValidAsync(arrayQuery: new List() +{ +"" +}); Console.WriteLine(response.Status); } @@ -1519,8 +1553,8 @@ public async Task Example_ArrayStringTsvValid_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_ArrayStringPipesValid() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = client.ArrayStringPipesValid(); Console.WriteLine(response.Status); @@ -1530,10 +1564,13 @@ public void Example_ArrayStringPipesValid() [Ignore("Only validating compilation of examples")] public void Example_ArrayStringPipesValid_AllParameters() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = client.ArrayStringPipesValid(new string[] { "" }); + Response response = client.ArrayStringPipesValid(arrayQuery: new List() +{ +"" +}); Console.WriteLine(response.Status); } @@ -1541,8 +1578,8 @@ public void Example_ArrayStringPipesValid_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_ArrayStringPipesValid_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); Response response = await client.ArrayStringPipesValidAsync(); Console.WriteLine(response.Status); @@ -1552,10 +1589,13 @@ public async Task Example_ArrayStringPipesValid_Async() [Ignore("Only validating compilation of examples")] public async Task Example_ArrayStringPipesValid_AllParameters_Async() { - var credential = new AzureKeyCredential(""); - var client = new QueriesClient(credential); + AzureKeyCredential credential = new AzureKeyCredential(""); + QueriesClient client = new QueriesClient(credential); - Response response = await client.ArrayStringPipesValidAsync(new string[] { "" }); + Response response = await client.ArrayStringPipesValidAsync(arrayQuery: new List() +{ +"" +}); Console.WriteLine(response.Status); } }